decocms 3.19.2 → 3.20.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 (274) hide show
  1. package/dist/client/assets/{AlertCircle-msrZcybq.js → AlertCircle-B-p2hhbf.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-Byrpe9WP.js → ArrowUpRight-Bq-dJGgn.js} +1 -1
  3. package/dist/client/assets/{Check-Jqq0Xl3a.js → Check-CSixRgqh.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-DSS55ngx.js → CheckCircle-CqLcOI7o.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-BSX6I-22.js → ChevronDown-BptXi8Ef.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-WDS7c9Oj.js → ChevronLeft-Bq6F--2K.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-rpdEZJUq.js → ChevronRight-CtziSifX.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-CZxdSjaK.js → ChevronUp-DChs66VU.js} +1 -1
  9. package/dist/client/assets/{Container-Ds9oBR1K.js → Container-DIwdobum.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-oDmXH8rL.js → DotsVertical-DQ3UGDDE.js} +1 -1
  11. package/dist/client/assets/{Eye-DBlsn1hC.js → Eye-DepFjUJE.js} +1 -1
  12. package/dist/client/assets/{FilterLines-Bl-ckLoL.js → FilterLines-CIJgiiLT.js} +1 -1
  13. package/dist/client/assets/{Globe01-jNcghhQz.js → Globe01-BayTDYGC.js} +1 -1
  14. package/dist/client/assets/{HardDrive-DEvNg8yq.js → HardDrive-OwnJRrIS.js} +1 -1
  15. package/dist/client/assets/{Key01-zn3UtDG9.js → Key01-CR8zfCdU.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-CqI5nVLL.js → LayoutLeft-6fPyjOVd.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-D0jjtfJs.js → LinkExternal01-B2YZgRTN.js} +1 -1
  18. package/dist/client/assets/{Monitor01-DthONXqr.js → Monitor01-BNXW6pu5.js} +1 -1
  19. package/dist/client/assets/{Palette-DW9tW514.js → Palette-siqkt4cQ.js} +1 -1
  20. package/dist/client/assets/{Play-ERiPM4DA.js → Play-CBt0NeLA.js} +1 -1
  21. package/dist/client/assets/{Plus-CFWiqWHN.js → Plus-gXoAw_mX.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-D05DrWxG.js → RefreshCcw01-DlKjMM-5.js} +1 -1
  23. package/dist/client/assets/{SearchMd-Dki_7scv.js → SearchMd-z6b-QOmX.js} +1 -1
  24. package/dist/client/assets/{Settings02-DaFOyqDZ.js → Settings02-C7YqxsZL.js} +1 -1
  25. package/dist/client/assets/{Shield01-0VPaG49X.js → Shield01-BT66FEMI.js} +1 -1
  26. package/dist/client/assets/{Star01-DlcdN00s.js → Star01-q6EhXttt.js} +1 -1
  27. package/dist/client/assets/{Stars01-Bc7S8o1J.js → Stars01-DcMeK1n0.js} +1 -1
  28. package/dist/client/assets/{Stars02-B_dlwxCr.js → Stars02-DJ4Y5TfK.js} +1 -1
  29. package/dist/client/assets/{Sun-BqBChjnU.js → Sun-CeFpMHQU.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-lNhGk_hy.js → SwitchHorizontal01-__hAuhZa.js} +1 -1
  31. package/dist/client/assets/{Tool01-CcCi4KvQ.js → Tool01-DXWYgeBe.js} +1 -1
  32. package/dist/client/assets/{Trash01-BxTQxIdp.js → Trash01-B91-1KNk.js} +1 -1
  33. package/dist/client/assets/{Upload01-DX71wpXa.js → Upload01-CcwGyBRP.js} +1 -1
  34. package/dist/client/assets/{User01-Nh_tiNpg.js → User01-JR_76gHl.js} +1 -1
  35. package/dist/client/assets/{Users01-BwVZocdt.js → Users01-BM2QLqUJ.js} +1 -1
  36. package/dist/client/assets/{Users03-BHZni5n9.js → Users03-D5pU3_ql.js} +1 -1
  37. package/dist/client/assets/{X-ss5Xz1Et.js → X-DCWlm9Ta.js} +1 -1
  38. package/dist/client/assets/{XCircle-BB0lZzsa.js → XCircle-CEKwTNMD.js} +1 -1
  39. package/dist/client/assets/{XClose-PQOZtIep.js → XClose-DhQ5V0ST.js} +1 -1
  40. package/dist/client/assets/{Zap-B2IJIN30.js → Zap-BLBAeivN.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-CNqz5kEa.js → ZapSquare-DSdwG_FE.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-DMw3YmC-.js → ZoomOut-CCPaeWry.js} +1 -1
  43. package/dist/client/assets/{access-gate-Dy05Kfsj.js → access-gate-DXlQ8iVy.js} +1 -1
  44. package/dist/client/assets/{accordion-DUAiTQ1X.js → accordion-CsQ2TTIf.js} +1 -1
  45. package/dist/client/assets/add-section-modal-ilTOPIUe.js +1 -0
  46. package/dist/client/assets/{agent-capabilities-Dgku04Fj.js → agent-capabilities-CuNGQogd.js} +1 -1
  47. package/dist/client/assets/{agent-icon-BKyPZSrU.js → agent-icon-Lc1AgwlE.js} +1 -1
  48. package/dist/client/assets/{agent-icons-LDbRdVXw.js → agent-icons-Cprwkzhw.js} +1 -1
  49. package/dist/client/assets/agents-list--b7dVWdV.js +1 -0
  50. package/dist/client/assets/ai-providers-Dw2EV4N6.js +1 -0
  51. package/dist/client/assets/{alert-BFYJRHz0.js → alert-HSAarVhN.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-CdMTKexh.js → alert-dialog-DJLxSS_E.js} +1 -1
  53. package/dist/client/assets/app-editor-ZPlbW7dI.js +1 -0
  54. package/dist/client/assets/{auth-catchall-CMK3_4n7.js → auth-catchall-DeBOSldf.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-CjTM8YYN.js → auth-split-layout-DKKncNKx.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-Dyfpfy2H.js → automation-list-row-C8yWYA2H.js} +1 -1
  57. package/dist/client/assets/automation-runs-D-WPNg7m.js +1 -0
  58. package/dist/client/assets/automations-C0KOU0yb.js +1 -0
  59. package/dist/client/assets/{avatar-DO0XQWG0.js → avatar-3vQWE5Hu.js} +1 -1
  60. package/dist/client/assets/{badge-URBzLEND.js → badge-DF6gVmsi.js} +1 -1
  61. package/dist/client/assets/brand-context-EmCiQUXD.js +1 -0
  62. package/dist/client/assets/buckets-SH6KUYAQ.js +1 -0
  63. package/dist/client/assets/{calendar-D2iLp4AZ.js → calendar-CCqv5TgR.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-DRUhmmMs.js → capability-load-error-Dn3qy9VI.js} +1 -1
  65. package/dist/client/assets/{card-BBYtsRQu.js → card-CeH_PUFE.js} +1 -1
  66. package/dist/client/assets/{chat-context-D6r0VrdY.js → chat-context-BIie9ysT.js} +1 -1
  67. package/dist/client/assets/{checkbox-lq9fHOVc.js → checkbox-DFFY_m2B.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-B5PGlqVe.js → cli-auth-success-CKQ9nJ3v.js} +1 -1
  69. package/dist/client/assets/collection-detail-BVeEbzxz.js +1 -0
  70. package/dist/client/assets/{collection-display-button-DEKclzZV.js → collection-display-button-_le1JW4q.js} +1 -1
  71. package/dist/client/assets/{collection-search-B16Qll3H.js → collection-search-Bryj5VYk.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-BQ-724WQ.js → collection-table-wrapper-DoTnvoII.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-D2P_kf5B.js → collection-tabs-Y3w8w2D4.js} +1 -1
  74. package/dist/client/assets/{collections-CfqnSWiG.js → collections-B-UBhIxv.js} +1 -1
  75. package/dist/client/assets/{command-BFdTdJIk.js → command-KyGHPzm4.js} +1 -1
  76. package/dist/client/assets/connect-desktop-dialog-BeLm4wl6.js +1 -0
  77. package/dist/client/assets/connection-card-Dug8PvM2.js +1 -0
  78. package/dist/client/assets/connection-detail-BXK_93LF.js +1 -0
  79. package/dist/client/assets/{connection-form-helpers-c057Q0nC.js → connection-form-helpers-Ce4ZXQGG.js} +1 -1
  80. package/dist/client/assets/connections-CVEBwrj4.js +1 -0
  81. package/dist/client/assets/{decopilot-sse-pool-DldV1nWG.js → decopilot-sse-pool-vfZK3kan.js} +1 -1
  82. package/dist/client/assets/{dialog-C_ezrgSP.js → dialog-nXKceTRB.js} +1 -1
  83. package/dist/client/assets/domain-settings-OHWjjHlQ.js +1 -0
  84. package/dist/client/assets/{drawer-BXY4BcX7.js → drawer-lSnonzW3.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-Dh2MQHLA.js → dropdown-menu-DpfpR4kx.js} +1 -1
  86. package/dist/client/assets/dynamic-plugin-layout-BYQB-ubA.js +1 -0
  87. package/dist/client/assets/{empty-state-2i4c7wH5.js → empty-state-BJuYi96S.js} +1 -1
  88. package/dist/client/assets/{empty-state-B7yWolnH.js → empty-state-CY7XUbo0.js} +1 -1
  89. package/dist/client/assets/extract-connection-data-DxtHEsy3.js +1 -0
  90. package/dist/client/assets/features-DeiC9LXr.js +1 -0
  91. package/dist/client/assets/file-explorer-Ch6ZQfZO.js +2 -0
  92. package/dist/client/assets/{file-type-icon-aIKNVhBg.js → file-type-icon-B2skJERp.js} +1 -1
  93. package/dist/client/assets/{files-Cd9F57xn.js → files-CZNNukx-.js} +1 -1
  94. package/dist/client/assets/{form-CkEhbzy7.js → form-BM4RuTjX.js} +1 -1
  95. package/dist/client/assets/general-sYzqMtl5.js +1 -0
  96. package/dist/client/assets/{generate-id-DaY0KVY7.js → generate-id-DvX29Me7.js} +1 -1
  97. package/dist/client/assets/{github-repo-picker-CdHH9nCY.js → github-repo-picker-Dlio4Q6_.js} +1 -1
  98. package/dist/client/assets/{header-tab-button-0jfaFdUX.js → header-tab-button-BY6bk4Fs.js} +1 -1
  99. package/dist/client/assets/{hover-card-BCAj_Xd_.js → hover-card-DASEEDYA.js} +1 -1
  100. package/dist/client/assets/image-field-BTCmGBNs.js +1 -0
  101. package/dist/client/assets/{index-BzKJxpwN.js → index-1xoY7YJX.js} +1 -1
  102. package/dist/client/assets/{index-5X0_pyXB.js → index-BXzjL9VS.js} +4 -4
  103. package/dist/client/assets/{index-Bo3JNDr-.js → index-BfzqpoYd.js} +3 -3
  104. package/dist/client/assets/{index-C3nMRDmD.js → index-CVPVNlMM.js} +1 -1
  105. package/dist/client/assets/{index-y0aPO23E.js → index-CaqKcth7.js} +1 -1
  106. package/dist/client/assets/{index-CB3uLwGL.js → index-CnLAq3ph.js} +1 -1
  107. package/dist/client/assets/{index-BEEslzRu.js → index-D3hStv8f.js} +1 -1
  108. package/dist/client/assets/{index-DQjHfKU7.js → index-D4BxVbG6.js} +1 -1
  109. package/dist/client/assets/index-DFmAjKzK.js +1 -0
  110. package/dist/client/assets/{index-SuF349z9.js → index-DOW4VN4f.js} +1 -1
  111. package/dist/client/assets/{index-tKIVUSzL.js → index-DcxEaxY4.js} +1 -1
  112. package/dist/client/assets/index-Dey5W81J.js +1 -0
  113. package/dist/client/assets/index-e3NOZKNP.js +1 -0
  114. package/dist/client/assets/{index-DmIZ-CRb.js → index-nkMA7ZNv.js} +1 -1
  115. package/dist/client/assets/{index-redirect-B-EGzrp3.js → index-redirect-Dz1DdiHC.js} +1 -1
  116. package/dist/client/assets/{index-CLQbUNOD.js → index-uO0JijnU.js} +1 -1
  117. package/dist/client/assets/{infiniteQueryObserver-DDvMhEnM.js → infiniteQueryObserver-CvEVG_TM.js} +1 -1
  118. package/dist/client/assets/{input-pRrhjAXj.js → input-BGQcwAaL.js} +1 -1
  119. package/dist/client/assets/{integration-icon-Sjhpbwvw.js → integration-icon-B-zr5uGs.js} +1 -1
  120. package/dist/client/assets/{label-D6vCqN0W.js → label-zIig0cjv.js} +1 -1
  121. package/dist/client/assets/{layout-C3MgBkSM.js → layout-VuI1aPBj.js} +1 -1
  122. package/dist/client/assets/{login-pZHNqArS.js → login-DgI1VcxE.js} +1 -1
  123. package/dist/client/assets/members-BdlFzlWX.js +3 -0
  124. package/dist/client/assets/{monaco-editor-Bjbp__XB.js → monaco-editor-DQviDtyP.js} +1 -1
  125. package/dist/client/assets/{monitoring-stats-row-Wql_ZRjG.js → monitoring-stats-row-Bsjs_3xk.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-DKR05MxD.js → oauth-callback-CuHVTba4.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-ai-provider-DwJNXQg2.js → oauth-callback-ai-provider-B-N2lOyI.js} +1 -1
  128. package/dist/client/assets/{onboarding-zW8Ab_91.js → onboarding-CqGFHsnX.js} +1 -1
  129. package/dist/client/assets/{org-install-D7P0yXNw.js → org-install-B0qdlOKM.js} +1 -1
  130. package/dist/client/assets/{org-layout-CWLWFcEi.js → org-layout-CMGneEfe.js} +1 -1
  131. package/dist/client/assets/org-plugin-layout-DGdROiZB.js +1 -0
  132. package/dist/client/assets/{page-seo-form-DXk-FMdG.js → page-seo-form-C3bI8Neh.js} +1 -1
  133. package/dist/client/assets/page-seo-sheet-Cs2jXSnd.js +1 -0
  134. package/dist/client/assets/{pair-xjLo0yuO.js → pair-NC4sCATE.js} +1 -1
  135. package/dist/client/assets/{plugin-empty-state-Bhd84nYD.js → plugin-empty-state-FQw8SLzO.js} +1 -1
  136. package/dist/client/assets/{plugin-header-f8Msl2wi.js → plugin-header-D-cxTW9a.js} +1 -1
  137. package/dist/client/assets/plugin-layout-DECTyQVg.js +1 -0
  138. package/dist/client/assets/{popover-DCPb5csG.js → popover-B1xAxEac.js} +1 -1
  139. package/dist/client/assets/{post-editor-iEJFy1Z1.js → post-editor-BXy1yxCV.js} +1 -1
  140. package/dist/client/assets/{primitives-DcoU6ix7.js → primitives-CANqy_LE.js} +1 -1
  141. package/dist/client/assets/{profile-DoEK5_UU.js → profile-UNuXVjVg.js} +1 -1
  142. package/dist/client/assets/project-app-view-7DW_WhHA.js +1 -0
  143. package/dist/client/assets/record-editor-D9aMJ7nl.js +1 -0
  144. package/dist/client/assets/registry-Ddq3KnAW.js +2 -0
  145. package/dist/client/assets/{registry-layout-CO50gP_1.js → registry-layout-DH7-iD95.js} +1 -1
  146. package/dist/client/assets/{require-capability-CrKIqEWt.js → require-capability-Bi88Fg3q.js} +1 -1
  147. package/dist/client/assets/{required-auth-layout-B_-dVCbU.js → required-auth-layout-3IQyeREK.js} +1 -1
  148. package/dist/client/assets/{reset-password-CVpBId6U.js → reset-password-Dstl0VXR.js} +1 -1
  149. package/dist/client/assets/{resizable-Cigu4A4t.js → resizable-Cx-Y9zvP.js} +1 -1
  150. package/dist/client/assets/roles-BrYnRIt_.js +1 -0
  151. package/dist/client/assets/{save-status-DN0Z06hy.js → save-status-DSB279Mq.js} +1 -1
  152. package/dist/client/assets/{schema-form-CZZ44g0g.js → schema-form-f_EsRXt1.js} +1 -1
  153. package/dist/client/assets/{scroll-area-CKvBXrNm.js → scroll-area-BYy84ztj.js} +1 -1
  154. package/dist/client/assets/{search-input-BcAmdKUD.js → search-input-C3i2qrnL.js} +1 -1
  155. package/dist/client/assets/secrets-CAO0zPct.js +1 -0
  156. package/dist/client/assets/{sections-editor-DXWHdiRY.js → sections-editor-Dq0mEIsn.js} +1 -1
  157. package/dist/client/assets/{select-DUXB6LHg.js → select-DpYu937I.js} +1 -1
  158. package/dist/client/assets/{select-model-RkJ8YMBz.js → select-model-B8gz_8C_.js} +1 -1
  159. package/dist/client/assets/seo-editor-DCppyDVT.js +1 -0
  160. package/dist/client/assets/{settings-layout-Dae86zhx.js → settings-layout-BYi6Agz-.js} +1 -1
  161. package/dist/client/assets/{settings-section-Udn4AewC.js → settings-section-pgSq0Nbi.js} +1 -1
  162. package/dist/client/assets/{sheet-APxs0kGR.js → sheet-y2Nja_Ue.js} +1 -1
  163. package/dist/client/assets/{shell-controls-Bgcfbug_.js → shell-controls-DyDfxDen.js} +1 -1
  164. package/dist/client/assets/shell-layout-D8qm1N5L.js +1 -0
  165. package/dist/client/assets/shell-route-loading-DQ0B9hX1.js +1 -0
  166. package/dist/client/assets/{sidebar-K8V064sc.js → sidebar-B3S1MC-b.js} +1 -1
  167. package/dist/client/assets/{skeleton-BWZ-ns9j.js → skeleton-thGJKlMg.js} +1 -1
  168. package/dist/client/assets/{sortable.esm-IvhH0Iiq.js → sortable.esm-DYE94iJD.js} +1 -1
  169. package/dist/client/assets/{spinner-DykCTvUx.js → spinner-j70e5pPL.js} +1 -1
  170. package/dist/client/assets/sso-DUhv1jLf.js +1 -0
  171. package/dist/client/assets/store-DxrJkSaq.js +1 -0
  172. package/dist/client/assets/store-registry-B_QywLhG.js +2 -0
  173. package/dist/client/assets/{switch-Bf2tQWC3.js → switch-BZi96ipJ.js} +1 -1
  174. package/dist/client/assets/{tab-id-Z7cJvW4r.js → tab-id-CjkvF5Bz.js} +1 -1
  175. package/dist/client/assets/{table-DU3PQ5SO.js → table-C3TjNbDC.js} +1 -1
  176. package/dist/client/assets/{tabs-C4QJjUKZ.js → tabs-sqzEAKlk.js} +1 -1
  177. package/dist/client/assets/{task-status-C_c_TK_P.js → task-status-CgfEdw1R.js} +1 -1
  178. package/dist/client/assets/{textarea-CRDofezZ.js → textarea-Bo_ElpPh.js} +1 -1
  179. package/dist/client/assets/{toggle-group-DNr9xMf4.js → toggle-group-jYWXBndg.js} +1 -1
  180. package/dist/client/assets/{toolbar-CC3BF_Yz.js → toolbar-BIjePcgn.js} +1 -1
  181. package/dist/client/assets/{tools-list-B9w2rXkH.js → tools-list-9Kj7tcM0.js} +1 -1
  182. package/dist/client/assets/{tooltip-DiB01_WS.js → tooltip-CC_mfaKY.js} +1 -1
  183. package/dist/client/assets/{types-CPIf7aKP.js → types-btWFnXlQ.js} +1 -1
  184. package/dist/client/assets/use-ai-providers-D2jZ5H5p.js +1 -0
  185. package/dist/client/assets/use-automations-B6ZTT5n1.js +1 -0
  186. package/dist/client/assets/{use-capability-B8Eh6LHX.js → use-capability-aJI8msnV.js} +1 -1
  187. package/dist/client/assets/{use-collections-D1vJ7KDI.js → use-collections-vRlJo8MD.js} +1 -1
  188. package/dist/client/assets/use-connection-MP_sOdrQ.js +1 -0
  189. package/dist/client/assets/{use-copy-DJBZ7llF.js → use-copy-BkzArvj8.js} +1 -1
  190. package/dist/client/assets/{use-create-virtual-mcp-tcowS75Z.js → use-create-virtual-mcp-C88u5wPn.js} +1 -1
  191. package/dist/client/assets/{use-debounced-autosave-E8kOZ2rg.js → use-debounced-autosave-C2TtzjZB.js} +1 -1
  192. package/dist/client/assets/use-delete-connection-D8ryW-Gn.js +1 -0
  193. package/dist/client/assets/use-file-configs-DGSgkVs8.js +1 -0
  194. package/dist/client/assets/{use-infinite-scroll-BO_ygUIj.js → use-infinite-scroll-BYw2UY-G.js} +1 -1
  195. package/dist/client/assets/{use-list-state-BBborJz5.js → use-list-state-CyVLGIWk.js} +1 -1
  196. package/dist/client/assets/use-mcp-client-Brxiewn2.js +10 -0
  197. package/dist/client/assets/{use-mcp-prompts-DTnBUNSR.js → use-mcp-prompts-CKvrvNSD.js} +1 -1
  198. package/dist/client/assets/{use-mcp-tools--TbVUEHw.js → use-mcp-tools-DFeiBffX.js} +1 -1
  199. package/dist/client/assets/{use-members-CP2TjOkz.js → use-members-D6H6sd8q.js} +1 -1
  200. package/dist/client/assets/{use-navigate-to-agent-ChUqlb7q.js → use-navigate-to-agent-BRFls8tQ.js} +1 -1
  201. package/dist/client/assets/{use-org-auth-client-CVHBFmlC.js → use-org-auth-client-IT7XMFB9.js} +1 -1
  202. package/dist/client/assets/{use-org-sso-BQ_zhmY7.js → use-org-sso-BWWAvGBF.js} +1 -1
  203. package/dist/client/assets/{use-organization-roles-gDiU_5OY.js → use-organization-roles-S9xtJ6m2.js} +1 -1
  204. package/dist/client/assets/use-organization-settings-DjvlRnDe.js +1 -0
  205. package/dist/client/assets/use-registry-connections-BQfixYFV.js +1 -0
  206. package/dist/client/assets/use-secrets-DEcBibJG.js +1 -0
  207. package/dist/client/assets/{use-status-sounds-rIt45hGE.js → use-status-sounds-BJZxFfhN.js} +1 -1
  208. package/dist/client/assets/{use-view-mode-B9WldwT_.js → use-view-mode-DXlui5dm.js} +1 -1
  209. package/dist/client/assets/use-virtual-mcp-DDTG_-f6.js +1 -0
  210. package/dist/client/assets/useInfiniteQuery-BEouccKd.js +1 -0
  211. package/dist/client/assets/{useRouterState-jE6zoz2C.js → useRouterState-xsU2zFoM.js} +1 -1
  212. package/dist/client/assets/useSuspenseInfiniteQuery-wDDb-pw7.js +1 -0
  213. package/dist/client/assets/user-BZco0YX9.js +1 -0
  214. package/dist/client/assets/{view-mode-toggle-DJ96lxjY.js → view-mode-toggle-BN8FgH0K.js} +1 -1
  215. package/dist/client/assets/workflow-BxGrEeHN.js +1 -0
  216. package/dist/client/assets/workflow-detail-QkGhQ2hI.js +1 -0
  217. package/dist/client/index.html +1 -1
  218. package/dist/server/cli.js +474 -474
  219. package/dist/server/migrate.js +59 -59
  220. package/dist/server/server.js +294 -294
  221. package/package.json +1 -1
  222. package/dist/client/assets/add-section-modal-D-zNEV3B.js +0 -1
  223. package/dist/client/assets/agents-list-Dj7ic2Dh.js +0 -1
  224. package/dist/client/assets/ai-providers-Bd8VAgPS.js +0 -1
  225. package/dist/client/assets/app-editor-4FrQqyyR.js +0 -1
  226. package/dist/client/assets/automation-runs-CM6KeAFb.js +0 -1
  227. package/dist/client/assets/automations-Dx01NKv5.js +0 -1
  228. package/dist/client/assets/brand-context-Bs-U2ENL.js +0 -1
  229. package/dist/client/assets/buckets-B-Q1NekA.js +0 -1
  230. package/dist/client/assets/collection-detail-DhDlm7aW.js +0 -1
  231. package/dist/client/assets/connect-desktop-dialog-CQieKA-J.js +0 -1
  232. package/dist/client/assets/connection-card-C9_ODHSl.js +0 -1
  233. package/dist/client/assets/connection-detail-CXKE542G.js +0 -1
  234. package/dist/client/assets/connections-Ce2UYd8O.js +0 -1
  235. package/dist/client/assets/constants-DnLx7qAL.js +0 -10
  236. package/dist/client/assets/domain-settings-Baa5UpRo.js +0 -1
  237. package/dist/client/assets/dynamic-plugin-layout-CDzYViwh.js +0 -1
  238. package/dist/client/assets/extract-connection-data-DA0TusY7.js +0 -1
  239. package/dist/client/assets/features-mw4p_55R.js +0 -1
  240. package/dist/client/assets/file-explorer-D01B6ew7.js +0 -2
  241. package/dist/client/assets/general-CBO1uvux.js +0 -1
  242. package/dist/client/assets/image-field--SXcw0ky.js +0 -1
  243. package/dist/client/assets/index-B7uL8QHF.js +0 -1
  244. package/dist/client/assets/index-CaRCU_dm.js +0 -1
  245. package/dist/client/assets/index-b10tcUiE.js +0 -1
  246. package/dist/client/assets/members-BHJUwlaz.js +0 -3
  247. package/dist/client/assets/org-plugin-layout-BdMC4Vqk.js +0 -1
  248. package/dist/client/assets/page-seo-sheet-BhbqCiMK.js +0 -1
  249. package/dist/client/assets/plugin-layout-BOOK9Xek.js +0 -1
  250. package/dist/client/assets/project-app-view-I-ihH2pa.js +0 -1
  251. package/dist/client/assets/record-editor-B3au-a1a.js +0 -1
  252. package/dist/client/assets/registry-DRgEl7oe.js +0 -2
  253. package/dist/client/assets/roles-GL8hDqyq.js +0 -1
  254. package/dist/client/assets/secrets-BDm9CTfF.js +0 -1
  255. package/dist/client/assets/seo-editor-CpDs-iFW.js +0 -1
  256. package/dist/client/assets/shell-layout-CR4v7ckW.js +0 -1
  257. package/dist/client/assets/shell-route-loading-DsuTmhLJ.js +0 -1
  258. package/dist/client/assets/sso-CC6JYBVF.js +0 -1
  259. package/dist/client/assets/store-BrHHoj0k.js +0 -1
  260. package/dist/client/assets/store-registry-S28KyWy2.js +0 -2
  261. package/dist/client/assets/use-ai-providers-BjPpexbU.js +0 -1
  262. package/dist/client/assets/use-automations-BBSTcglu.js +0 -1
  263. package/dist/client/assets/use-connection-DdLSeZAg.js +0 -1
  264. package/dist/client/assets/use-delete-connection-DuTlEus3.js +0 -1
  265. package/dist/client/assets/use-file-configs-D5IgpPGg.js +0 -1
  266. package/dist/client/assets/use-organization-settings-BUiVq2US.js +0 -1
  267. package/dist/client/assets/use-registry-connections-D60Z6_by.js +0 -1
  268. package/dist/client/assets/use-secrets-q3tZhEWP.js +0 -1
  269. package/dist/client/assets/use-virtual-mcp-Cf2-Lb_Q.js +0 -1
  270. package/dist/client/assets/useInfiniteQuery-B-1Io71h.js +0 -1
  271. package/dist/client/assets/useSuspenseInfiniteQuery-Do8GUcN_.js +0 -1
  272. package/dist/client/assets/user-B2olHrh6.js +0 -1
  273. package/dist/client/assets/workflow-KUgH1RpA.js +0 -1
  274. package/dist/client/assets/workflow-detail-Cy-Ds6Hs.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as z,e as H,c as K,j as s,q as Se,K as re,bb as dt,n as Re,l as fe,B as ne,T as Pe,aH as Ie,W as se,aJ as De,aK as ke,G as $e,H as mt,I as ut,a as Fe,o as he,t as Oe,F as Ke,v as ft,E as ht,f as gt,d as xt}from"./index-BfzqpoYd.js";import{u as pt}from"./use-organization-roles-S9xtJ6m2.js";import{u as je}from"./use-org-auth-client-IT7XMFB9.js";import{B as ge}from"./badge-DF6gVmsi.js";import{A as Qe,a as He,b as qe,c as Ze,d as Xe,f as Je,e as We,g as et}from"./alert-dialog-DJLxSS_E.js";import{D as bt,a as Et,b as Tt,c as _t}from"./dropdown-menu-DpfpR4kx.js";import{i as It}from"./DotsVertical-DQ3UGDDE.js";import{s as Ae}from"./Plus-gXoAw_mX.js";import{s as St}from"./Trash01-B91-1KNk.js";import{C as Nt}from"./collection-table-wrapper-DoTnvoII.js";import{P as te}from"./index-CVPVNlMM.js";import{E as Ge}from"./empty-state-BJuYi96S.js";import{S as ve}from"./search-input-C3i2qrnL.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-B-zr5uGs.js";import{u as Ct}from"./use-infinite-scroll-BYw2UY-G.js";import{C as we}from"./checkbox-DFFY_m2B.js";import{i as At}from"./RefreshCcw01-DlKjMM-5.js";import{u as Rt}from"./useSuspenseInfiniteQuery-wDDb-pw7.js";import{u as Ot,S as jt}from"./use-mcp-client-Brxiewn2.js";import{C as vt}from"./collection-search-Bryj5VYk.js";import{u as nt}from"./use-members-D6H6sd8q.js";import{u as yt}from"./use-connection-MP_sOdrQ.js";import{u as wt,d as Lt}from"./use-ai-providers-D2jZ5H5p.js";import{A as lt}from"./avatar-3vQWE5Hu.js";import{S as xe}from"./switch-BZi96ipJ.js";import{c as pe,b as be,T as Ee,a as Te}from"./tooltip-CC_mfaKY.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-pgSq0Nbi.js";import{t as Mt}from"./ChevronDown-BptXi8Ef.js";import{i as Pt}from"./ChevronRight-CtziSifX.js";import{i as ze}from"./X-DCWlm9Ta.js";import{a as Dt}from"./use-capability-aJI8msnV.js";import{A as kt}from"./access-gate-DXlQ8iVy.js";import"./Check-CSixRgqh.js";import"./table-C3TjNbDC.js";import"./SwitchHorizontal01-__hAuhZa.js";import"./sidebar-B3S1MC-b.js";import"./LayoutLeft-6fPyjOVd.js";import"./sheet-y2Nja_Ue.js";import"./SearchMd-z6b-QOmX.js";import"./Container-DIwdobum.js";import"./agent-icon-Lc1AgwlE.js";import"./AlertCircle-B-p2hhbf.js";import"./Tool01-DXWYgeBe.js";import"./XCircle-CEKwTNMD.js";import"./ArrowUpRight-Bq-dJGgn.js";import"./ZapSquare-DSdwG_FE.js";import"./Users03-D5pU3_ql.js";import"./CheckCircle-CqLcOI7o.js";import"./ChevronLeft-Bq6F--2K.js";import"./ChevronUp-DChs66VU.js";import"./Eye-DepFjUJE.js";import"./ZoomOut-CCPaeWry.js";import"./Globe01-BayTDYGC.js";import"./FilterLines-CIJgiiLT.js";import"./Star01-q6EhXttt.js";import"./Palette-siqkt4cQ.js";import"./HardDrive-OwnJRrIS.js";import"./Stars02-DJ4Y5TfK.js";import"./Key01-CR8zfCdU.js";import"./LinkExternal01-B2YZgRTN.js";import"./Monitor01-BNXW6pu5.js";import"./Sun-CeFpMHQU.js";import"./Play-CBt0NeLA.js";import"./Settings02-C7YqxsZL.js";import"./Shield01-BT66FEMI.js";import"./Stars01-DcMeK1n0.js";import"./Upload01-CcwGyBRP.js";import"./User01-JR_76gHl.js";import"./Users01-BM2QLqUJ.js";import"./XClose-DhQ5V0ST.js";import"./Zap-BLBAeivN.js";import"./infiniteQueryObserver-CvEVG_TM.js";import"./use-collections-vRlJo8MD.js";import"./card-CeH_PUFE.js";import"./capability-load-error-Dn3qy9VI.js";const Le="basic-usage",Me=[{id:Le,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Me.find(t=>t.id===Le)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===Le)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const o=new Set(e);for(const r of t.tools)o.add(r);return Array.from(o)}const l=new Set(e);for(const o of t.tools)l.delete(o);return Array.from(l)}const zt=z.memo(function(e){const n=H.c(21),{connection:l,isSelected:o,hasToolsEnabled:r,activeToolsCount:c,totalToolsCount:f,onSelect:d,onToggle:h}=e,g=o?"bg-accent/50":"hover:bg-muted/50";let a;n[0]!==g?(a=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),n[0]=g,n[1]=a):a=n[1];let x;n[2]!==l.icon||n[3]!==l.title?(x=s.jsx(ye,{icon:l.icon,name:l.title,size:"xs"}),n[2]=l.icon,n[3]=l.title,n[4]=x):x=n[4];let i;n[5]!==l.title?(i=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),n[5]=l.title,n[6]=i):i=n[6];let m;n[7]!==d||n[8]!==x||n[9]!==i?(m=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:d,children:[x,i]}),n[7]=d,n[8]=x,n[9]=i,n[10]=m):m=n[10];let _;n[11]!==c||n[12]!==l.tools||n[13]!==r||n[14]!==h||n[15]!==f?(_=l.tools&&l.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[c,"/",f]}),s.jsx(we,{checked:r,onCheckedChange:h,onClick:Ft})]}),n[11]=c,n[12]=l.tools,n[13]=r,n[14]=h,n[15]=f,n[16]=_):_=n[16];let E;return n[17]!==a||n[18]!==m||n[19]!==_?(E=s.jsxs("div",{className:a,children:[m,_]}),n[17]=a,n[18]=m,n[19]=_,n[20]=E):E=n[20],E}),Yt=z.memo(function(e){const n=H.c(18),{connectionId:l,tool:o,isSelected:r,onToggle:c}=e,f=`tool-${l}-${o.name}`,d=r?"text-foreground":"text-muted-foreground";let h;n[0]!==d?(h=K("text-sm font-medium",d),n[0]=d,n[1]=h):h=n[1];let g;n[2]!==h||n[3]!==o.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:h,children:o.name})}),n[2]=h,n[3]=o.name,n[4]=g):g=n[4];let a;n[5]!==o.description?(a=o.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:o.description}),n[5]=o.description,n[6]=a):a=n[6];let x;n[7]!==g||n[8]!==a?(x=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,a]}),n[7]=g,n[8]=a,n[9]=x):x=n[9];const i=`tool-${l}-${o.name}`;let m;n[10]!==r||n[11]!==c||n[12]!==i?(m=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:i,checked:r,onCheckedChange:c,onClick:Kt})}),n[10]=r,n[11]=c,n[12]=i,n[13]=m):m=n[13];let _;return n[14]!==f||n[15]!==x||n[16]!==m?(_=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:f,children:[x,m]}),n[14]=f,n[15]=x,n[16]=m,n[17]=_):_=n[17],_});function $t({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[o,r]=z.useState(""),c=l!==void 0?l:o,f=z.useDeferredValue(c),[d,h]=z.useState("all"),[g,a]=z.useState(!1),x=z.useRef(new Set(Object.keys(t))),{org:i}=Se(),m=Ot({connectionId:jt,orgId:i.id,orgSlug:i.slug}),_=100,E=f.trim(),T=E?{operator:"or",conditions:[{field:["title"],operator:"contains",value:E},{field:["description"],operator:"contains",value:E}]}:void 0,N=!!n,C={...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:_,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:I,fetchNextPage:R,hasNextPage:p,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,i.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...T&&{where:T},orderBy:[{field:["updated_at"],direction:"asc"}],limit:_,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),S=I?.pages.flatMap(b=>b?.items??[])??[],j=Ct(R,p??!1,O),u=n?S.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):S,w=x.current,A=[...w.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!w.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(d==="all")return!0;const D=U(b.id);return d==="selected"?D:d==="unselected"?!D:!0}),[L,Y]=z.useState(G[0]?.id??null),y=L?G.find(b=>b.id===L)??null:null,{data:M,isFetching:$}=Re({queryKey:re.collectionItem(m,i.id,"","CONNECTIONS",L??""),queryFn:async()=>L?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:L}})).structuredContent?.item??null:null,enabled:!!L,staleTime:3e4}),F=M?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===L?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,Y(b)),e(Z)},oe=b=>{Y(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",g&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:o,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>h("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>h("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>h("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",d==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:c?"No connections found":d==="selected"?"No servers selected":d==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=L===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",g?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:$?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx(Yt,{connectionId:y.id,tool:b,isSelected:X(y.id,b.name),onToggle:()=>J(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function Ft(t){return t.stopPropagation()}function Kt(t){return t.stopPropagation()}const Ne=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ht(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ne.length;return Ne[n]??Ne[0]}function qt(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=H.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:o,onPermissionsChange:r,readOnly:c,searchQuery:f}=t,d=c===void 0?!1:c;let h;e[0]!==f?(h=f.trim().toLowerCase(),e[0]=f,e[1]=h):h=e[1];const g=z.useDeferredValue(h);let a;if(e[2]!==n||e[3]!==g||e[4]!==o||e[5]!==r||e[6]!==d||e[7]!==f||e[8]!==l){const x=Ut(),i=(v,I)=>{if(!d){if(n&&I){const R=x.flatMap(es).flatMap(Wt);o(!1),r(R.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!I))}};let m;e[10]!==g?(m=v=>{const{section:I,capabilities:R}=v;return{section:I,capabilities:R.filter(p=>!g||p.label.toLowerCase().includes(g)||p.description.toLowerCase().includes(g))}},e[10]=g,e[11]=m):m=e[11];const _=x.map(m).filter(Jt);let E;e[12]!==n||e[13]!==o||e[14]!==r?(E=()=>{o(!n),r([])},e[12]=n,e[13]=o,e[14]=r,e[15]=E):E=e[15];let T;e[16]!==n||e[17]!==d||e[18]!==E?(T=Ye(n,d,E),e[16]=n,e[17]=d,e[18]=E,e[19]=T):T=e[19];let N;e[20]!==n||e[21]!==o||e[22]!==r||e[23]!==d?(N=d?void 0:()=>{o(!n),r([])},e[20]=n,e[21]=o,e[22]=r,e[23]=d,e[24]=N):N=e[24];let C;e[25]!==T||e[26]!==N?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:T,onClick:N})})}),e[25]=T,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,_.length===0&&g?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",f,"”"]}):_.map(v=>{const{section:I,capabilities:R}=v;return s.jsx(Ue,{title:I,children:s.jsx(Be,{children:R.map(p=>{const O=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(O,d,()=>i(p,O)),onClick:d?void 0:()=>i(p,O)},p.id)})})},I)})]})}),e[2]=n,e[3]=g,e[4]=o,e[5]=r,e[6]=d,e[7]=f,e[8]=l,e[9]=a}else a=e[9];return a}function Jt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=H.c(44),{connectionId:n,subProviderId:l,subProviderName:o,groupLogo:r,models:c,allConnectionModelIds:f,selectedModels:d,allowAllModels:h,allConnectionModelsSelected:g,onToggleModel:a,onExitAllowAll:x,readOnly:i,defaultExpanded:m}=t,[_,E]=z.useState(m),T=m||_,N=E,[C,v]=z.useState(rt);let I;e[0]!==g||e[1]!==h||e[2]!==d?(I=j=>h||g||d.includes("*")||d.includes(j),e[0]=g,e[1]=h,e[2]=d,e[3]=I):I=e[3];const R=I;let p;if(e[4]!==R||e[5]!==c){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],p=c.filter(j),e[4]=R,e[5]=c,e[6]=p}else p=e[6];const O=p.length;let S;if(e[9]!==f||e[10]!==h||e[11]!==n||e[12]!==O||e[13]!==T||e[14]!==r||e[15]!==R||e[16]!==c||e[17]!==x||e[18]!==a||e[19]!==i||e[20]!==l||e[21]!==o||e[22]!==C){const j=c.slice(0,C),u=c.length>C;let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=()=>N(cs),e[24]=w):w=e[24];const A=r??tt[l]??st;let k;e[25]!==o||e[26]!==A?(k=s.jsx(ye,{icon:A,name:o,size:"sm"}),e[25]=o,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==o?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:o}),e[28]=o,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==O||e[34]!==c.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",c.length," enabled"]}),e[33]=O,e[34]=c.length,e[35]=B):B=e[35];let L;e[36]!==T?(L=T?s.jsx(Mt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=T,e[37]=L):L=e[37];let Y;e[38]!==L||e[39]!==B?(Y=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,L]}),e[38]=L,e[39]=B,e[40]=Y):Y=e[40];let y;e[41]!==Y||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:w,children:[U,Y]}),e[41]=Y,e[42]=U,e[43]=y):y=e[43],S=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,T&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(M=>{const $=R(M.id),F=()=>{if(!i){if(h){x(n,f,M.id);return}a(n,M.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!i&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:M.title})}),s.jsx("div",{onClick:as,children:i?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:$,disabled:!0,onCheckedChange:rs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:$,onCheckedChange:F})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",c.length-C," remaining)"]})]})]}),e[9]=f,e[10]=h,e[11]=n,e[12]=O,e[13]=T,e[14]=r,e[15]=R,e[16]=c,e[17]=x,e[18]=a,e[19]=i,e[20]=l,e[21]=o,e[22]=C,e[23]=S}else S=e[23];return S}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=H.c(33),{connection:n,selectedModels:l,allowAllModels:o,onToggleModel:r,onExitAllowAll:c,allConnectionModelsSelected:f,searchQuery:d,readOnly:h}=t,g=Lt(n.id);let a,x,i,m,_;if(e[0]!==f||e[1]!==o||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==c||e[6]!==r||e[7]!==g||e[8]!==h||e[9]!==d||e[10]!==l){_=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=g.filter(hs).map(N),v=d.trim().toLowerCase(),I=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(I.length===0){_=null;break e}const R=new Map;for(const A of I){const k=ss(A.id,n.providerId),G=R.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),R.set(k,G)}const p=Array.from(R.entries()).map(fs).sort(us),O=p.length===1||v.length>0;i="flex flex-col gap-3";const S=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==S?(j=s.jsx("img",{src:S,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=S,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let w;e[21]!==u?(w=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=w):w=e[22],e[23]!==w||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,w]}),e[23]=w,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:o,allConnectionModelsSelected:f,onToggleModel:r,onExitAllowAll:c,readOnly:h,defaultExpanded:O},A.id))}e[0]=f,e[1]=o,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=c,e[6]=r,e[7]=g,e[8]=h,e[9]=d,e[10]=l,e[11]=a,e[12]=x,e[13]=i,e[14]=m,e[15]=_}else a=e[11],x=e[12],i=e[13],m=e[14],_=e[15];if(_!==Symbol.for("react.early_return_sentinel"))return _;let E;e[26]!==a||e[27]!==x?(E=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=E):E=e[28];let T;return e[29]!==i||e[30]!==m||e[31]!==E?(T=s.jsxs("div",{className:i,children:[m,E]}),e[29]=i,e[30]=m,e[31]=E,e[32]=T):T=e[32],T}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=H.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:o,onModelSetChange:r,readOnly:c,searchQuery:f}=t,d=c===void 0?!1:c,h=z.useDeferredValue(f),g=wt();let a;e[0]!==l||e[1]!==r?(a=(p,O)=>{const S=l[p]??[],j={...l};if(S.includes(O)){const u=S.filter(w=>w!==O);u.length===0?delete j[p]:j[p]=u}else j[p]=[...S,O];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let i;e[3]!==l||e[4]!==o||e[5]!==r?(i=(p,O,S)=>{o(!1),r({...l,[p]:O.filter(j=>j!==S)})},e[3]=l,e[4]=o,e[5]=r,e[6]=i):i=e[6];const m=i,_=!d&&"hover:bg-muted/50 cursor-pointer";let E;e[7]!==_?(E=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",_),e[7]=_,e[8]=E):E=e[8];let T;e[9]!==n||e[10]!==o||e[11]!==r||e[12]!==d?(T=()=>{if(d)return;const p=!n;o(p),p&&r({})},e[9]=n,e[10]=o,e[11]=r,e[12]=d,e[13]=T):T=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=e[14];let C;e[15]!==n||e[16]!==o||e[17]!==r||e[18]!==d?(C=s.jsx("div",{onClick:ps,children:d?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{o(p),p&&r({})}})}),e[15]=n,e[16]=o,e[17]=r,e[18]=d,e[19]=C):C=e[19];let v;e[20]!==E||e[21]!==T||e[22]!==C?(v=s.jsxs("div",{className:E,onClick:T,children:[N,C]}),e[20]=E,e[21]=T,e[22]=C,e[23]=v):v=e[23];let I;e[24]!==g||e[25]!==n||e[26]!==h||e[27]!==m||e[28]!==l||e[29]!==d||e[30]!==x?(I=g.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):g.map(p=>s.jsx(z.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:h,readOnly:d})},p.id)),e[24]=g,e[25]=n,e[26]=h,e[27]=m,e[28]=l,e[29]=d,e[30]=x,e[31]=I):I=e[31];let R;return e[32]!==I||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,I]}),e[32]=I,e[33]=v,e[34]=R):R=e[34],R}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.c(52),{open:n,onOpenChange:l,selectedMemberIds:o,onAddMembers:r}=t,[c,f]=z.useState(""),d=z.useDeferredValue(c);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[g,a]=z.useState(h),{data:x}=nt();let i,m,_,E,T,N,C,v,I,R,p;if(e[1]!==x?.data?.members||e[2]!==d||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==g||e[7]!==c||e[8]!==o){const U=x?.data?.members??[];let B;e[20]!==d?(B=y=>{const M=d.toLowerCase();return y.user?.name?.toLowerCase().includes(M)||y.user?.email?.toLowerCase().includes(M)},e[20]=d,e[21]=B):B=e[21];const L=U.filter(B);let Y;e[22]!==r||e[23]!==l||e[24]!==g?(Y=()=>{r(g),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=g,e[25]=Y):Y=e[25],_=Y,m=Qe,R=n,p=l,i=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Xe,{children:"Select members to add to this role."})]}),e[26]=I):I=e[26],N="flex flex-col h-80",e[27]!==c?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:c,onChange:f,placeholder:"Search members...",className:"w-full"})}),e[27]=c,e[28]=C):C=e[28],E="flex-1 overflow-auto",T=L.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:c?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:L.map(y=>{const M=y.role!=="owner",$=o.includes(y.id),F=g.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!M||$?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||$,onCheckedChange:()=>{!M||$||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!M||$}),s.jsx(lt,{url:y.user?.image??void 0,fallback:ot(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!M&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),$&&M&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=d,e[3]=r,e[4]=l,e[5]=n,e[6]=g,e[7]=c,e[8]=o,e[9]=i,e[10]=m,e[11]=_,e[12]=E,e[13]=T,e[14]=N,e[15]=C,e[16]=v,e[17]=I,e[18]=R,e[19]=p}else i=e[9],m=e[10],_=e[11],E=e[12],T=e[13],N=e[14],C=e[15],v=e[16],I=e[17],R=e[18],p=e[19];let O;e[29]!==E||e[30]!==T?(O=s.jsx("div",{className:E,children:T}),e[29]=E,e[30]=T,e[31]=O):O=e[31];let S;e[32]!==O||e[33]!==N||e[34]!==C?(S=s.jsxs("div",{className:N,children:[C,O]}),e[32]=O,e[33]=N,e[34]=C,e[35]=S):S=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=g.length===0,w=g.length>0&&`(${g.length})`;let A;e[37]!==_||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:_,disabled:u,children:["Add ",w]})]}),e[37]=_,e[38]=u,e[39]=w,e[40]=A):A=e[40];let k;e[41]!==i||e[42]!==S||e[43]!==A||e[44]!==v||e[45]!==I?(k=s.jsxs(i,{className:v,children:[I,S,A]}),e[41]=i,e[42]=S,e[43]=A,e[44]=v,e[45]=I,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==R||e[50]!==p?(G=s.jsx(m,{open:R,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=p,e[51]=G):G=e[51],G}function Es(t){const e=H.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:o,readOnlyMessage:r,searchQuery:c,addMemberDialogOpen:f,onAddMemberDialogOpenChange:d}=t,h=o===void 0?!1:o,g=r===void 0?"Owner membership cannot be changed":r,a=z.useDeferredValue(c),{data:x}=nt();let i,m,_;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==h||e[5]!==g||e[6]!==c){const v=x?.data?.members??[];let I;e[10]!==n?(I=S=>n.includes(S.id),e[10]=n,e[11]=I):I=e[11];const R=v.filter(I);let p;e[12]!==a?(p=S=>{const j=a.toLowerCase();return S.user?.name?.toLowerCase().includes(j)||S.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const O=R.filter(p);_="flex flex-col h-full",i="flex-1 overflow-auto",m=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',c,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:O.map(S=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:S.user?.image??void 0,fallback:ot(S.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:S.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.user?.email})]}),h?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:g})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==S.id)),children:s.jsx(ze,{size:16})})]},S.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=h,e[5]=g,e[6]=c,e[7]=i,e[8]=m,e[9]=_}else i=e[7],m=e[8],_=e[9];let E;e[14]!==i||e[15]!==m?(E=s.jsx("div",{className:i,children:m}),e[14]=i,e[15]=m,e[16]=E):E=e[16];let T;e[17]!==n||e[18]!==l?(T=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=T):T=e[19];let N;e[20]!==f||e[21]!==n||e[22]!==d||e[23]!==T?(N=s.jsx(bs,{open:f,onOpenChange:d,selectedMemberIds:n,onAddMembers:T}),e[20]=f,e[21]=n,e[22]=d,e[23]=T,e[24]=N):N=e[24];let C;return e[25]!==_||e[26]!==E||e[27]!==N?(C=s.jsxs("div",{className:_,children:[E,N]}),e[25]=_,e[26]=E,e[27]=N,e[28]=C):C=e[28],C}function Ts(t){const e=H.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx(z.Suspense,{fallback:n,children:s.jsx(Es,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const o=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:o,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ss(t,e,n){const l=t.permission||{},o=l.self||[],r=o.includes("*"),c=r?[]:o.filter(a=>a!=="*"),f={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const i of n)f[i.id]=x.includes("*")?i.tools?.map(m=>m.name)??[]:x;else{const i=n.find(m=>m.id===a);i&&(f[a]=x.includes("*")?i.tools?.map(m=>m.name)??[]:x)}const d=l.models||[],h=d.length===0||d.includes("*:*"),g={};if(!h)for(const a of d){const x=a.indexOf(":");if(x===-1)continue;const i=a.slice(0,x),m=a.slice(x+1);g[i]||(g[i]=[]),g[i].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:c,toolSet:f,allowAllModels:h,modelSet:g,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ns(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,o]of Object.entries(t.toolSet))if(o.length>0){const c=e.find(f=>f.id===l)?.tools?.map(f=>f.name)??[];n[l]=c.length>0&&c.every(f=>o.includes(f))?["*"]:o}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[o,r]of Object.entries(t.modelSet))for(const c of r)l.push(`${o}:${c}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ss(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=H.c(6),{readOnly:n,readOnlyMessage:l,onOpen:o}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=d):d=e[0];let h;return e[1]!==r?(h=s.jsx(pe,{children:s.jsxs(be,{children:[d,s.jsx(Te,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=h):h=e[2],h}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ae,{size:16}),e[3]=c):c=e[3];let f;return e[4]!==o?(f=s.jsxs(ne,{variant:"outline",size:"sm",onClick:o,children:[c,"Add Member"]}),e[4]=o,e[5]=f):f=e[5],f}function Rs(t){const e=H.c(14),{locator:n}=Se(),l=je(),o=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let c;e[2]!==l?(c=()=>l.organization.listMembers(),e[2]=l,e[3]=c):c=e[3];let f;e[4]!==r||e[5]!==c?(f={queryKey:r,queryFn:c},e[4]=r,e[5]=c,e[6]=f):f=e[6];const{data:d,isPending:h}=Re(f);if(h||!o){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=i):i=e[7],i}let g;e[8]!==d?.data?.members?(g=d?.data?.members??[],e[8]=d?.data?.members,e[9]=g):g=e[9];const a=g;let x;return e[10]!==o||e[11]!==a||e[12]!==t?(x=s.jsx(Os,{...t,members:a,connections:o}),e[10]=o,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Os({target:t,onBack:e,onSaved:n,members:l,connections:o}){const{locator:r}=Se(),c=je(),f=$e(),d=t.kind==="builtin",h=t.kind==="builtin"&&t.role==="owner",g=t.kind==="new",[a,x]=z.useState(d?"org":"mcp"),i=mt({resolver:ut(Zt),defaultValues:Cs(t,l,o)}),m=i.formState.isValid,_=i.formState.isDirty,E=Fe({mutationFn:async u=>{const w=Ns(u,o),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const L=l.filter(M=>M.role===(B??U)).map(M=>M.id),Y=u.memberIds.filter(M=>!L.includes(M)),y=L.filter(M=>!u.memberIds.includes(M));for(const M of Y){const $=await c.organization.updateMemberRole({memberId:M,role:[U]});if($?.error)throw new Error($.error.message??"Something went wrong")}for(const M of y){const $=await c.organization.updateMemberRole({memberId:M,role:["user"]});if($?.error)throw new Error($.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,L=U!==B,Y=await c.organization.updateRole({roleId:u.role.id,data:{permission:w,...L?{roleName:U}:{}}});if(Y?.error)throw new Error(Y.error.message??"Something went wrong");return await G(L?U:B,L?B:void 0),L?{...u,role:{...u.role,slug:U}}:u}else{const U=await c.organization.createRole({role:A,permission:w});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const L=await c.organization.updateMemberRole({memberId:B,role:[A]});if(L?.error)throw new Error(L.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,w)=>{f.invalidateQueries({queryKey:re.members(r)}),f.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!w.role.id&&!w.role.slug,k=w.role.slug==="owner"&&!w.role.id;Oe(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:w.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),i.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),T=i.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),i.setFocus("role.label");return}E.mutate(u)}),N=!h,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...h?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[I,R]=z.useState(""),[p,O]=z.useState(!1),S=u=>{x(u),R("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:E.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:T,disabled:E.isPending||!m||!_,children:E.isPending?"Saving...":g?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?qt(t.role):Ht(i.watch("role.label")))}),h&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),g||t.kind==="custom"?s.jsx("input",{...i.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:g}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>S(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:I,onChange:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!h&&s.jsx($t,{toolSet:i.watch("toolSet"),onToolSetChange:u=>i.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:I}),a==="org"&&s.jsx(Xt,{allowAllStaticPermissions:i.watch("allowAllStaticPermissions"),staticPermissions:i.watch("staticPermissions"),onAllowAllChange:u=>i.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>i.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:h,searchQuery:I}),a==="models"&&s.jsx(gs,{allowAllModels:i.watch("allowAllModels"),modelSet:i.watch("modelSet"),onAllowAllChange:u=>i.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>i.setValue("modelSet",u,{shouldDirty:!0}),readOnly:h,searchQuery:I}),a==="members"&&s.jsx(Ts,{memberIds:i.watch("memberIds"),onMemberIdsChange:u=>i.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:I,addMemberDialogOpen:p,onAddMemberDialogOpenChange:O})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.c(6),{area:n,children:l}=t,{isPrivileged:o,loading:r,error:c}=Dt();let f;return e[0]!==n||e[1]!==l||e[2]!==c||e[3]!==o||e[4]!==r?(f=s.jsx(kt,{granted:o,loading:r,error:c,area:n,children:l}),e[0]=n,e[1]=l,e[2]=c,e[3]=o,e[4]=r,e[5]=f):f=e[5],f}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"];function ws(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const o=t.charCodeAt(l);e=(e<<5)-e+o,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const Ls={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ms(t,e){return e?Ls[t]??"bg-neutral-400":ws(t)}function Ps(){const t=H.c(77),[e,n]=z.useState(""),[l,o]=z.useState(null),r=gt();let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},t[0]=c):c=t[0];const{role:f}=xt(c),{locator:d}=Se(),h=je(),g=$e(),{customRoles:a,refetch:x}=pt();let i;t[1]!==r?(i=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=i):i=t[2];const m=i;let _;e:{if(!f){_=null;break e}if(f==="new"){_={kind:"new"};break e}if(f.startsWith("builtin-")){_={kind:"builtin",role:f.slice(8)};break e}let P;t[3]!==f?(P=ae=>ae.id===f,t[3]=f,t[4]=P):P=t[4];const V=a.find(P);_=V?{kind:"custom",role:V}:null}const E=_;let T;t[5]!==d?(T=re.members(d),t[5]=d,t[6]=T):T=t[6];let N;t[7]!==h?(N=()=>h.organization.listMembers(),t[7]=h,t[8]=N):N=t[8];let C;t[9]!==T||t[10]!==N?(C={queryKey:T,queryFn:N},t[9]=T,t[10]=N,t[11]=C):C=t[11];const{data:v}=Re(C);let I;t[12]!==v?.data?.members?(I=v?.data?.members??[],t[12]=v?.data?.members,t[13]=I):I=t[13];const R=I;let p;t[14]!==R?(p=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=p):p=t[15];const O=p;let S;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,t[23]=ae):ae=t[23];const at=a.map(ae);if(S=[...V,...at],e){const ce=e.toLowerCase();S=S.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=O,t[18]=e,t[19]=S}else S=t[19];let j;t[24]!==h?(j=async P=>{const V=await h.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=h,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Oe("role_deleted",{role_id:V}),g.invalidateQueries({queryKey:re.members(d)}),g.invalidateQueries({queryKey:re.organizationRoles(d)}),he.success("Role deleted successfully!"),x(),E?.kind==="custom"&&E.role.id===V&&m(void 0)},onError:zs});let w,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},w={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=w,t[27]=A,t[28]=k,t[29]=G):(w=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,w,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(bt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(It,{size:16})})}),s.jsx(Tt,{align:"end",onClick:Ds,children:s.jsxs(_t,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&o({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let L;t[31]!==m?(L=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=L):L=t[32];const Y=L;if(E){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Rs,{target:E,onBack:P,onSaved:V},js(E))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let $;t[40]!==e?($=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=$):$=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let X;t[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Ae,{size:16}),t[44]=X):X=t[44];let J;t[45]!==F?(J=s.jsxs(ne,{onClick:F,children:[X,"Create Role"]}),t[45]=F,t[46]=J):J=t[46];let le;t[47]!==$||t[48]!==J?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[$,J]}),t[47]=$,t[48]=J,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==S||t[53]!==B||t[54]!==Y||t[55]!==oe?(ie=s.jsx(Nt,{columns:B,data:S,isLoading:!1,onRowClick:Y,emptyState:oe}),t[52]=S,t[53]=B,t[54]=Y,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&o(null),t[60]=Q):Q=t[60];let q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,s.jsxs(Xe,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),o(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(He,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ms(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Oe("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx(z.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function fl(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{fl as default};
@@ -1 +1 @@
1
- import{e as m,j as s,l as o}from"./index-Bo3JNDr-.js";import{i as c}from"./AlertCircle-msrZcybq.js";import{i as l}from"./Check-Jqq0Xl3a.js";function u(i){const e=m.c(3),{isPending:a,isError:n}=i;if(n){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[s.jsx(c,{size:13}),"Couldn't save"]}),e[0]=t):t=e[0],t}if(a){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(o,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=t):t=e[1],t}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[s.jsx(l,{size:13}),"Saved"]}),e[2]=r):r=e[2],r}export{u as S};
1
+ import{e as m,j as s,l as o}from"./index-BfzqpoYd.js";import{i as c}from"./AlertCircle-B-p2hhbf.js";import{i as l}from"./Check-CSixRgqh.js";function u(i){const e=m.c(3),{isPending:a,isError:n}=i;if(n){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[s.jsx(c,{size:13}),"Couldn't save"]}),e[0]=t):t=e[0],t}if(a){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(o,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=t):t=e[1],t}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[s.jsx(l,{size:13}),"Saved"]}),e[2]=r):r=e[2],r}export{u as S};
@@ -1 +1 @@
1
- import{e as R,j as r,r as K,B as ie,c as je,o as oe}from"./index-Bo3JNDr-.js";import{a9 as Pe,u as De,ap as pe,G as he}from"./agent-icon-BKyPZSrU.js";import{C as Re}from"./calendar-D2iLp4AZ.js";import{I as ee}from"./input-pRrhjAXj.js";import{L as G}from"./label-D6vCqN0W.js";import{a as ze,b as Be,P as Ee}from"./popover-DCPb5csG.js";import{T as Ve}from"./textarea-CRDofezZ.js";import{S as Me}from"./switch-Bf2tQWC3.js";import{c as ve,S as Ne,a as we,b as Te,d as Ce}from"./select-DUXB6LHg.js";import{d as Ue}from"./ZoomOut-DMw3YmC-.js";import{s as Le}from"./Plus-CFWiqWHN.js";import{s as ke}from"./Trash01-BxTQxIdp.js";import{D as We,a as He,b as Ye,c as Ke}from"./dropdown-menu-Dh2MQHLA.js";import{e as Se,u as Ge,L as Qe,F as Xe,I as xe}from"./image-field--SXcw0ky.js";import{U as ae,V as Ze,W as qe}from"./index-5X0_pyXB.js";import{t as Ae}from"./ChevronDown-BSX6I-22.js";import{i as $e}from"./ChevronRight-rpdEZJUq.js";import{i as Je}from"./Upload01-DX71wpXa.js";import{c as et}from"./use-file-configs-D5IgpPGg.js";function tt(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function rt(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(l=>l.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const s=e.find(l=>typeof l.value=="string");if(s)return s.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function Ie(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ie);const e=t;return e.__resolveType?rt(e)??t:_e(e)}function _e(t){const e={};for(const[n,s]of Object.entries(t))e[n]=Ie(s);return e}function nt(t,e){return e.split(".").reduce((n,s)=>{if(!(n==null||typeof n!="object"))return n[s]},t)}function Oe(t){return t==null?"":Array.isArray(t)?t.map(Oe).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function ce(t,e){if(!t.includes("{"))return;const n=_e(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(l,i,o)=>{const d=(i??o??"").trim();return Oe(nt(n,d))}).trim()||void 0}function st(t,e){if(e.includes("{"))return ce(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const s=n.map(l=>l==null?"":String(l)).filter(Boolean).join(",");if(s)return s}}function it(t,e,n){if(typeof t=="string")return t||`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){const s=t;if(n?.titleBy){const i=st(s,n.titleBy);if(i)return i}if(n?.title){const i=ce(n.title,s);if(i)return i;if(!n.title.includes("{"))return n.title}for(const i of["name","label","title","alt","text","href","id"]){const o=s[i];if(typeof o=="string"&&o)return o;if(Array.isArray(o)){const d=o.map(a=>a==null?"":String(a)).filter(Boolean).join(",");if(d)return d}}const l=s.__resolveType;if(typeof l=="string"&&l){const i=l.split("/").at(-1);if(i)return i.replace(/\.tsx?$/,"")}}return`Item ${e+1}`}function lt(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const n=e.properties;return n?.mobile?"{{{image.mobile}}}":n?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function ot(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=lt(e);if(!n)return;const s=ce(n,t);if(!s)return;const l=Se(s)||s;return tt(l)}const q=t=>String(t).padStart(2,"0"),at="1900-01-01",ct="2099-12-31",dt="1900-01-01T00:00",ut="2099-12-31T23:59";function ft(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const n=new Date(t);return Number.isNaN(n.getTime())?"":`${n.getUTCFullYear()}-${q(n.getUTCMonth()+1)}-${q(n.getUTCDate())}`}function mt(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function pt(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${q(e.getMonth()+1)}-${q(e.getDate())}T${q(e.getHours())}:${q(e.getMinutes())}`}function ht(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function xt(t){const e=R.c(29),{id:n,withTime:s,value:l,onChange:i}=t,[o,d]=K.useState(!1);let a;e[0]!==l||e[1]!==s?(a=s?pt(l):ft(l),e[0]=l,e[1]=s,e[2]=a):a=e[2];const c=a;let f;e[3]!==i||e[4]!==s?(f=k=>{i(s?ht(k.target.value):mt(k.target.value))},e[3]=i,e[4]=s,e[5]=f):f=e[5];const u=f;let m;if(e[6]!==l){const k=l?new Date(l):null;m=k&&!Number.isNaN(k.getTime())?k:null,e[6]=l,e[7]=m}else m=e[7];const h=m;let y;e[8]!==i||e[9]!==h||e[10]!==s?(y=k=>{k&&(s&&h?k.setHours(h.getHours(),h.getMinutes(),0,0):k.setHours(0,0,0,0),i(k.toISOString()),d(!1))},e[8]=i,e[9]=h,e[10]=s,e[11]=y):y=e[11];const p=y,g=s?"datetime-local":"date",x=s?dt:at,b=s?ut:ct;let j;e[12]!==u||e[13]!==n||e[14]!==c||e[15]!==g||e[16]!==x||e[17]!==b?(j=r.jsx(ee,{id:n,type:g,min:x,max:b,value:c,onChange:u,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=u,e[13]=n,e[14]=c,e[15]=g,e[16]=x,e[17]=b,e[18]=j):j=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(ze,{asChild:!0,children:r.jsx(ie,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:r.jsx(Pe,{className:"h-4 w-4"})})}),e[19]=v):v=e[19];const w=h??void 0;let N;e[20]!==p||e[21]!==w?(N=r.jsx(Be,{className:"w-auto p-0",align:"end",children:r.jsx(Re,{mode:"single",selected:w,onSelect:p,initialFocus:!0})}),e[20]=p,e[21]=w,e[22]=N):N=e[22];let C;e[23]!==o||e[24]!==N?(C=r.jsxs(Ee,{open:o,onOpenChange:d,children:[v,N]}),e[23]=o,e[24]=N,e[25]=C):C=e[25];let $;return e[26]!==C||e[27]!==j?($=r.jsxs("div",{className:"flex gap-1",children:[j,C]}),e[26]=C,e[27]=j,e[28]=$):$=e[28],$}function ne(t){const e=R.c(8),{htmlFor:n,label:s,description:l}=t;let i;e[0]!==n||e[1]!==s?(i=r.jsx(G,{htmlFor:n,children:s}),e[0]=n,e[1]=s,e[2]=i):i=e[2];let o;e[3]!==l?(o=l&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l}),e[3]=l,e[4]=o):o=e[4];let d;return e[5]!==i||e[6]!==o?(d=r.jsxs("div",{className:"space-y-0.5",children:[i,o]}),e[5]=i,e[6]=o,e[7]=d):d=e[7],d}function se(t){const e=R.c(61),{schema:n,value:s,onChange:l,path:i,label:o}=t,d=typeof s=="string"?s:"",a=n.format;if(a==="textarea"||a==="rich-text"||a==="rich-text-inline"||a==="markdown"){let p;e[0]!==o||e[1]!==i||e[2]!==n.description?(p=r.jsx(ne,{htmlFor:i,label:o,description:n.description}),e[0]=o,e[1]=i,e[2]=n.description,e[3]=p):p=e[3];let g;e[4]!==l?(g=j=>l(j.target.value),e[4]=l,e[5]=g):g=e[5];let x;e[6]!==i||e[7]!==d||e[8]!==g?(x=r.jsx(Ve,{id:i,value:d,onChange:g,rows:4}),e[6]=i,e[7]=d,e[8]=g,e[9]=x):x=e[9];let b;return e[10]!==p||e[11]!==x?(b=r.jsxs("div",{className:"space-y-2",children:[p,x]}),e[10]=p,e[11]=x,e[12]=b):b=e[12],b}if(a==="date"||a==="date-time"){let p;e[13]!==o||e[14]!==i||e[15]!==n.description?(p=r.jsx(ne,{htmlFor:i,label:o,description:n.description}),e[13]=o,e[14]=i,e[15]=n.description,e[16]=p):p=e[16];const g=a==="date-time";let x;e[17]!==l||e[18]!==i||e[19]!==d||e[20]!==g?(x=r.jsx(xt,{id:i,withTime:g,value:d,onChange:l}),e[17]=l,e[18]=i,e[19]=d,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==p||e[23]!==x?(b=r.jsxs("div",{className:"space-y-2",children:[p,x]}),e[22]=p,e[23]=x,e[24]=b):b=e[24],b}if(a==="color-input"){let p;e[25]!==o||e[26]!==i||e[27]!==n.description?(p=r.jsx(ne,{htmlFor:i,label:o,description:n.description}),e[25]=o,e[26]=i,e[27]=n.description,e[28]=p):p=e[28];const g=d||"#000000";let x;e[29]!==l?(x=C=>l(C.target.value),e[29]=l,e[30]=x):x=e[30];let b;e[31]!==g||e[32]!==x?(b=r.jsx("input",{type:"color",value:g,onChange:x,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[31]=g,e[32]=x,e[33]=b):b=e[33];let j;e[34]!==l?(j=C=>l(C.target.value),e[34]=l,e[35]=j):j=e[35];let v;e[36]!==i||e[37]!==d||e[38]!==j?(v=r.jsx(ee,{id:i,value:d,onChange:j,placeholder:"#000000",className:"h-10 flex-1"}),e[36]=i,e[37]=d,e[38]=j,e[39]=v):v=e[39];let w;e[40]!==b||e[41]!==v?(w=r.jsxs("div",{className:"flex items-center gap-2",children:[b,v]}),e[40]=b,e[41]=v,e[42]=w):w=e[42];let N;return e[43]!==p||e[44]!==w?(N=r.jsxs("div",{className:"space-y-2",children:[p,w]}),e[43]=p,e[44]=w,e[45]=N):N=e[45],N}let c;e[46]!==o||e[47]!==i||e[48]!==n.description?(c=r.jsx(ne,{htmlFor:i,label:o,description:n.description}),e[46]=o,e[47]=i,e[48]=n.description,e[49]=c):c=e[49];const f=a==="url"?"url":"text";let u;e[50]!==l?(u=p=>l(p.target.value),e[50]=l,e[51]=u):u=e[51];const m=n.default!=null?String(n.default):void 0;let h;e[52]!==i||e[53]!==d||e[54]!==f||e[55]!==u||e[56]!==m?(h=r.jsx(ee,{id:i,type:f,value:d,onChange:u,placeholder:m,className:"h-10"}),e[52]=i,e[53]=d,e[54]=f,e[55]=u,e[56]=m,e[57]=h):h=e[57];let y;return e[58]!==c||e[59]!==h?(y=r.jsxs("div",{className:"space-y-2",children:[c,h]}),e[58]=c,e[59]=h,e[60]=y):y=e[60],y}function gt(t){const e=R.c(17),{schema:n,value:s,onChange:l,path:i,label:o}=t,d=typeof s=="number"?s:"";let a;e[0]!==o||e[1]!==i?(a=r.jsx(G,{htmlFor:i,children:o}),e[0]=o,e[1]=i,e[2]=a):a=e[2];let c;e[3]!==n.description?(c=n.description&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=c):c=e[4];let f;e[5]!==a||e[6]!==c?(f=r.jsxs("div",{className:"space-y-0.5",children:[a,c]}),e[5]=a,e[6]=c,e[7]=f):f=e[7];let u;e[8]!==l?(u=y=>{const p=y.target.value;l(p===""?void 0:Number(p))},e[8]=l,e[9]=u):u=e[9];let m;e[10]!==d||e[11]!==i||e[12]!==u?(m=r.jsx(ee,{id:i,type:"number",value:d,onChange:u,className:"h-10"}),e[10]=d,e[11]=i,e[12]=u,e[13]=m):m=e[13];let h;return e[14]!==f||e[15]!==m?(h=r.jsxs("div",{className:"space-y-2",children:[f,m]}),e[14]=f,e[15]=m,e[16]=h):h=e[16],h}function yt(t){const e=R.c(17),{value:n,onChange:s,path:l,label:i,schema:o}=t,d=typeof n=="boolean"?n:!1;let a;e[0]!==i||e[1]!==l?(a=r.jsx(G,{htmlFor:l,children:i}),e[0]=i,e[1]=l,e[2]=a):a=e[2];let c;e[3]!==o.description?(c=o.description&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:o.description}),e[3]=o.description,e[4]=c):c=e[4];let f;e[5]!==a||e[6]!==c?(f=r.jsxs("div",{className:"space-y-0.5",children:[a,c]}),e[5]=a,e[6]=c,e[7]=f):f=e[7];let u;e[8]!==s?(u=y=>s(y),e[8]=s,e[9]=u):u=e[9];let m;e[10]!==d||e[11]!==l||e[12]!==u?(m=r.jsx(Me,{id:l,checked:d,onCheckedChange:u}),e[10]=d,e[11]=l,e[12]=u,e[13]=m):m=e[13];let h;return e[14]!==f||e[15]!==m?(h=r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[f,m]}),e[14]=f,e[15]=m,e[16]=h):h=e[16],h}const de="__enum_empty__";function ue(t){return t===""?de:String(t)}function bt(t,e){if(t===de)return"";const n=e.find(s=>ue(s)===t);return n!==void 0?n:t}function jt(t,e){return t==null?e.some(n=>n==="")?de:void 0:ue(t)}function vt(t){return t===""?"":String(t)}function Nt(t){const e=R.c(28),{schema:n,value:s,onChange:l,path:i,label:o}=t;let d;e[0]!==n.enum?(d=n.enum??[],e[0]=n.enum,e[1]=d):d=e[1];const a=d;let c;e[2]!==a||e[3]!==s?(c=jt(s,a),e[2]=a,e[3]=s,e[4]=c):c=e[4];const f=c;let u;e[5]!==o||e[6]!==i?(u=r.jsx(G,{htmlFor:i,children:o}),e[5]=o,e[6]=i,e[7]=u):u=e[7];let m;e[8]!==n.description?(m=n.description&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=m):m=e[9];let h;e[10]!==u||e[11]!==m?(h=r.jsxs("div",{className:"space-y-0.5",children:[u,m]}),e[10]=u,e[11]=m,e[12]=h):h=e[12];let y;e[13]!==l||e[14]!==a?(y=v=>l(bt(v,a)),e[13]=l,e[14]=a,e[15]=y):y=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(Ne,{className:"h-10",children:r.jsx(we,{placeholder:"Select..."})}),e[16]=p):p=e[16];let g;e[17]!==a?(g=a.map(wt),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==g?(x=r.jsx(Te,{children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==f||e[22]!==y||e[23]!==x?(b=r.jsxs(Ce,{value:f,onValueChange:y,children:[p,x]}),e[21]=f,e[22]=y,e[23]=x,e[24]=b):b=e[24];let j;return e[25]!==b||e[26]!==h?(j=r.jsxs("div",{className:"space-y-2",children:[h,b]}),e[25]=b,e[26]=h,e[27]=j):j=e[27],j}function wt(t){const e=ue(t);return r.jsx(ve,{value:e,children:vt(t)},e)}function Tt(t){const e=R.c(32),{schema:n,value:s,onChange:l,path:i,label:o,breadcrumbPath:d,onBreadcrumbChange:a}=t,c=d===void 0?[]:d,f=Array.isArray(s)?s:[],u=n.items,[m,h]=K.useState(null);let y;e[0]!==u?(y=(T,S)=>it(T,S,u),e[0]=u,e[1]=y):y=e[1];const p=y,g=()=>{const T=u?.type,S=u?.default!==void 0?u.default:T==="object"?{}:T==="block-ref"?(()=>{const _=u?.anyOfRefs?.[0]?.resolveType;return typeof _!="string"||ae(_)?{}:{__resolveType:_}})():T==="number"||T==="integer"?0:T==="boolean"?!1:T==="array"?[]:"",A=[...f,S];l(A);const I=A.length-1;h(I),a?.([...c,p(S,I)])},x=T=>{l(f.filter((S,A)=>A!==T)),m===T&&(h(null),a?.(c))},b=(T,S)=>{const A=[...f];A[T]=S,l(A),m===T&&a?.([...c,p(S,T)])};if(m!==null&&m<f.length){const T=f[m],S=[...c,p(T,m)],A=u?.type==="object"&&u.properties?r.jsx(fe,{schema:u,value:T,onChange:_=>b(m,_),basePath:`${i}.${m}`,breadcrumbPath:S,onBreadcrumbChange:a}):u?Fe({schema:u,value:T,onChange:_=>b(m,_),path:`${i}.${m}`,label:u.title??`Item ${m+1}`,breadcrumbPath:S,onBreadcrumbChange:a}):null;let I;return e[2]!==A?(I=r.jsx("div",{className:"min-w-0 space-y-4",children:A}),e[2]=A,e[3]=I):I=e[3],I}let j;e[4]!==o?(j=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[4]=o,e[5]=j):j=e[5];let v;e[6]!==f.length?(v=f.length>0&&r.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:f.length}),e[6]=f.length,e[7]=v):v=e[7];let w;e[8]!==j||e[9]!==v?(w=r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[j,v]}),e[8]=j,e[9]=v,e[10]=w):w=e[10];let N;e[11]!==n.description?(N=n.description&&r.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=N):N=e[12];let C;e[13]!==w||e[14]!==N?(C=r.jsxs("div",{className:"min-w-0 space-y-0.5",children:[w,N]}),e[13]=w,e[14]=N,e[15]=C):C=e[15];let $;e[16]!==c||e[17]!==p||e[18]!==u||e[19]!==f||e[20]!==a||e[21]!==i||e[22]!==x||e[23]!==h?($=f.length>0&&r.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:f.map((T,S)=>{const A=p(T,S),I=ot(T,u);return r.jsxs("div",{className:"group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground",children:[r.jsx(Ue,{className:"size-3.5 shrink-0 cursor-grab text-muted-foreground/40"}),r.jsxs("button",{type:"button",onClick:()=>{h(S),a?.([...c,A])},className:"flex min-w-0 flex-1 items-center gap-2.5 text-left text-sm",title:A,children:[I&&r.jsx("img",{src:I,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),r.jsx("span",{className:"min-w-0 truncate",children:A})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(ie,{type:"button",variant:"ghost",size:"icon","aria-label":`Open actions for ${A}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:Ct,children:r.jsx(De,{size:14})})}),r.jsx(Ye,{align:"end",children:r.jsxs(Ke,{className:"text-destructive focus:text-destructive",onClick:()=>x(S),children:[r.jsx(ke,{size:14}),"Delete"]})})]})]},`${i}.${S}`)})}),e[16]=c,e[17]=p,e[18]=u,e[19]=f,e[20]=a,e[21]=i,e[22]=x,e[23]=h,e[24]=$):$=e[24];let k;e[25]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Le,{size:14}),e[25]=k):k=e[25];let P;e[26]!==g?(P=r.jsxs("button",{type:"button",onClick:g,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[k,"Add item"]}),e[26]=g,e[27]=P):P=e[27];let D;return e[28]!==P||e[29]!==C||e[30]!==$?(D=r.jsxs("div",{className:"space-y-2",children:[C,$,P]}),e[28]=P,e[29]=C,e[30]=$,e[31]=D):D=e[31],D}function Ct(t){return t.stopPropagation()}function kt(t){const e=R.c(37),{schema:n,value:s,onChange:l,path:i,label:o,breadcrumbPath:d,onBreadcrumbChange:a}=t,[c,f]=K.useState(!1);let u;e[0]!==s?(u=s!=null&&typeof s=="object"&&!Array.isArray(s)?s:{},e[0]=s,e[1]=u):u=e[1];const m=u;if(!n.properties)return null;const h=`${i}-fields`;let y;e[2]!==d?(y=d??[],e[2]=d,e[3]=y):y=e[3];let p;e[4]!==o||e[5]!==y?(p=[...y,o],e[4]=o,e[5]=y,e[6]=p):p=e[6];const g=p;let x;e[7]!==d||e[8]!==g||e[9]!==a||e[10]!==c?(x=()=>{const k=!c;f(k),a?.(k?g:d??[])},e[7]=d,e[8]=g,e[9]=a,e[10]=c,e[11]=x):x=e[11];const b=x;let j;e[12]!==c?(j=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:c?r.jsx(Ae,{size:16}):r.jsx($e,{size:16})}),e[12]=c,e[13]=j):j=e[13];let v;e[14]!==o?(v=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[14]=o,e[15]=v):v=e[15];let w;e[16]!==h||e[17]!==b||e[18]!==c||e[19]!==j||e[20]!==v?(w=r.jsxs("button",{type:"button","aria-expanded":c,"aria-controls":h,onClick:b,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[j,v]}),e[16]=h,e[17]=b,e[18]=c,e[19]=j,e[20]=v,e[21]=w):w=e[21];let N;e[22]!==n.description?(N=n.description&&r.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=N):N=e[23];let C;e[24]!==h||e[25]!==g||e[26]!==m||e[27]!==a||e[28]!==l||e[29]!==c||e[30]!==i||e[31]!==n?(C=c&&r.jsx("div",{id:h,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:r.jsx(fe,{schema:n,value:m,onChange:l,basePath:i,breadcrumbPath:g,onBreadcrumbChange:a})}),e[24]=h,e[25]=g,e[26]=m,e[27]=a,e[28]=l,e[29]=c,e[30]=i,e[31]=n,e[32]=C):C=e[32];let $;return e[33]!==w||e[34]!==N||e[35]!==C?($=r.jsxs("div",{className:"min-w-0 space-y-2",children:[w,N,C]}),e[33]=w,e[34]=N,e[35]=C,e[36]=$):$=e[36],$}function St(t){if(!t?.properties)return{};const e={};for(const[n,s]of Object.entries(t.properties))n.startsWith("__")||n==="@type"||(s.default!==void 0?e[n]=s.default:s.type==="boolean"?e[n]=!1:s.type==="string"?e[n]="":s.type==="number"||s.type==="integer"?e[n]=0:s.type==="object"&&(e[n]={}));return e}function At(t,e){const n=e[0]?.resolveType??"";if(!t||typeof t!="object"||Array.isArray(t))return n;const s=t;if(typeof s.__resolveType=="string"){const o=e.find(d=>Ze(d.resolveType,s.__resolveType));if(o)return o.resolveType}let l=n,i=-1;for(const o of e){if(!o.schema?.properties)continue;const a=Object.keys(o.schema.properties).filter(c=>!c.startsWith("__")&&c!=="@type"&&c!=="action"&&c!=="alt").filter(c=>s[c]!==void 0).length;a>0&&a>i&&(i=a,l=o.resolveType)}if(i>0)return l;for(const o of e){if(!o.schema?.properties)continue;const d=Object.keys(o.schema.properties).filter(a=>s[a]!==void 0).length;d>0&&d>i&&(i=d,l=o.resolveType)}return l}function $t(t){const e=R.c(23),{path:n,open:s,onOpenChange:l,title:i,nested:o,nestedBlockRef:d}=t,a=`${n}-loader-config`,c=d&&"ml-1";let f;e[0]!==c?(f=je("rounded-lg border border-border/80 bg-muted/30",c),e[0]=c,e[1]=f):f=e[1];let u;e[2]!==l||e[3]!==s?(u=()=>l(!s),e[2]=l,e[3]=s,e[4]=u):u=e[4];let m;e[5]!==s?(m=r.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:s?r.jsx(Ae,{size:16}):r.jsx($e,{size:16})}),e[5]=s,e[6]=m):m=e[6];let h;e[7]!==i?(h=r.jsx("span",{className:"min-w-0 truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:i}),e[7]=i,e[8]=h):h=e[8];let y;e[9]!==a||e[10]!==s||e[11]!==u||e[12]!==m||e[13]!==h?(y=r.jsxs("button",{type:"button","aria-expanded":s,"aria-controls":a,onClick:u,className:"group flex w-full min-w-0 items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[m,h]}),e[9]=a,e[10]=s,e[11]=u,e[12]=m,e[13]=h,e[14]=y):y=e[14];let p;e[15]!==a||e[16]!==o||e[17]!==s?(p=s&&r.jsx("div",{id:a,className:"border-t border-border/60 px-4 pb-4 pt-3",children:r.jsx("div",{className:"border-l border-border/80 pl-4",children:o})}),e[15]=a,e[16]=o,e[17]=s,e[18]=p):p=e[18];let g;return e[19]!==f||e[20]!==y||e[21]!==p?(g=r.jsxs("div",{className:f,children:[y,p]}),e[19]=f,e[20]=y,e[21]=p,e[22]=g):g=e[22],g}function ge(t){const e=R.c(35),{schema:n,value:s,onChange:l,path:i,label:o,breadcrumbPath:d,onBreadcrumbChange:a}=t,c=(n.anyOfRefs??[]).filter(_t),f=c.length>0?At(s,c):c[0]?.resolveType??"",[u,m]=K.useState(f),[h,y]=K.useState(!1);if(c.length>0){const N=u||f;let C;e[0]!==N?(C=O=>O.resolveType===N,e[0]=N,e[1]=C):C=e[1];const $=c.find(C),k=O=>{m(O);const V=c.find(U=>U.resolveType===O),M=new Set(Object.keys(V?.schema?.properties??{})),Q=s!==null&&typeof s=="object"&&!Array.isArray(s)?s:{},J=Object.fromEntries(Object.entries(Q).filter(U=>{const[H]=U;return M.has(H)})),W={...St(V?.schema),...J};if(ae(O)){l(W);return}l({...W,__resolveType:O})};let P;e[2]!==N||e[3]!==l?(P=O=>{if(!ae(N)||O===null||typeof O!="object"||Array.isArray(O)){l(O);return}const{__resolveType:V,...M}=O;l(M)},e[2]=N,e[3]=l,e[4]=P):P=e[4];const D=P,T=$?.schema?.properties?r.jsx(fe,{schema:$.schema,value:s,onChange:D,basePath:i,breadcrumbPath:d,onBreadcrumbChange:a}):null,S=n.type==="block-ref";let A;e[5]!==i?(A=i.includes("."),e[5]=i,e[6]=A):A=e[6];const I=A;let _;e[7]!==o||e[8]!==i?(_=r.jsx(G,{htmlFor:i,children:o}),e[7]=o,e[8]=i,e[9]=_):_=e[9];let z;e[10]===Symbol.for("react.memo_cache_sentinel")?(z=r.jsx(Ne,{children:r.jsx(we,{placeholder:"Select..."})}),e[10]=z):z=e[10];let B;e[11]!==n.description?(B=n.description&&r.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=B):B=e[12];let E;return e[13]!==S||e[14]!==I||e[15]!==h||e[16]!==T||e[17]!==i?(E=T&&(S?r.jsx($t,{path:i,open:h,onOpenChange:y,title:I?"Configuration":"Loader configuration",nested:T,nestedBlockRef:I}):T),e[13]=S,e[14]=I,e[15]=h,e[16]=T,e[17]=i,e[18]=E):E=e[18],r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[_,r.jsxs(Ce,{value:N,onValueChange:k,children:[z,r.jsx(Te,{children:c.map(It)})]}),B]}),E]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let p;e[19]!==o||e[20]!==i?(p=r.jsx(G,{htmlFor:i,children:o}),e[19]=o,e[20]=i,e[21]=p):p=e[21];const g=s!=null?String(s):"";let x;e[22]!==l?(x=N=>l(N.target.value),e[22]=l,e[23]=x):x=e[23];const b=n.description??"";let j;e[24]!==i||e[25]!==g||e[26]!==x||e[27]!==b?(j=r.jsx("input",{id:i,type:"text",value:g,onChange:x,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:b}),e[24]=i,e[25]=g,e[26]=x,e[27]=b,e[28]=j):j=e[28];let v;e[29]!==n.description?(v=n.description&&r.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[29]=n.description,e[30]=v):v=e[30];let w;return e[31]!==p||e[32]!==j||e[33]!==v?(w=r.jsxs("div",{className:"space-y-1.5",children:[p,j,v]}),e[31]=p,e[32]=j,e[33]=v,e[34]=w):w=e[34],w}function It(t){return r.jsx(ve,{value:t.resolveType,children:t.title??qe(t.resolveType)??t.resolveType},t.resolveType)}function _t(t){return t.resolveType!==""}function ye(t){const e=R.c(2),{ext:n}=t;if(!n)return null;let s;return e[0]!==n?(s=r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:n}),e[0]=n,e[1]=s):s=e[1],s}function Ot(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Ft(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function be(t){const e=R.c(72),{schema:n,value:s,onChange:l,path:i,label:o}=t,d=n.format==="video-uri",a=Se(s),[c,f]=K.useState(!1),[u,m]=K.useState(!1),h=a?Ot(a):"",y=h?Ft(h):"",p=et(),g=Ge();let x;e[0]!==p.data?.configs?(x=function(){const F=p.data?.configs??[];if(F.length===1)return F[0].id;if(F.length===0)return null;const L=typeof window<"u"?window.localStorage.getItem(Qe):null;return F.some(re=>re.id===L)?L:null},e[0]=p.data?.configs,e[1]=x):x=e[1];const b=x;let j;e[2]!==d||e[3]!==l||e[4]!==b||e[5]!==f||e[6]!==g?(j=async function(F){if(!F)return;let L=Array.from(F);if(L.length===0)return;if(d&&(L=L.filter(Pt),L.length===0)){oe.error("Please drop a video file (mp4, webm, …).");return}const re=b();if(!re){f(!0);return}try{const le=await g.mutateAsync({configId:re,file:L[0]});l(le.publicUrl),L.length>1&&oe.info(`Uploaded ${L[0].name}; extra files were ignored (single-select field).`)}catch(le){const me=le;oe.error(me instanceof Error?me.message:"Upload failed")}},e[2]=d,e[3]=l,e[4]=b,e[5]=f,e[6]=g,e[7]=j):j=e[7];const v=j;let w;e[8]!==m?(w=function(F){F.preventDefault(),F.dataTransfer.types.includes("Files")&&m(!0)},e[8]=m,e[9]=w):w=e[9];const N=w;let C;e[10]!==m?(C=function(F){F.currentTarget===F.target&&m(!1)},e[10]=m,e[11]=C):C=e[11];const $=C;let k;e[12]!==v||e[13]!==m?(k=function(F){F.preventDefault(),m(!1),v(F.dataTransfer.files)},e[12]=v,e[13]=m,e[14]=k):k=e[14];const P=k;let D;e[15]!==o||e[16]!==i?(D=r.jsx(G,{htmlFor:i,className:"text-muted-foreground",children:o}),e[15]=o,e[16]=i,e[17]=D):D=e[17];let T;e[18]!==n.description?(T=n.description&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=T):T=e[19];let S;e[20]!==D||e[21]!==T?(S=r.jsxs("div",{className:"min-w-0 space-y-0.5",children:[D,T]}),e[20]=D,e[21]=T,e[22]=S):S=e[22];const A=u&&"border-primary ring-2 ring-primary/30",I=g.isPending&&"pointer-events-none opacity-60";let _;e[23]!==I||e[24]!==A?(_=je("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",A,I),e[23]=I,e[24]=A,e[25]=_):_=e[25];let z;e[26]!==y||e[27]!==h||e[28]!==d||e[29]!==f||e[30]!==a||e[31]!==g.isPending?(z=a?d?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:r.jsx("video",{src:a,preload:"metadata",className:"h-full w-full object-contain"},a)}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx(pe,{size:14,className:"shrink-0 text-muted-foreground"}),r.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:h}),r.jsx(ye,{ext:y})]})]}):r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[r.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:r.jsx(he,{size:18,className:"text-muted-foreground"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium",children:h}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a})]}),r.jsx(ye,{ext:y})]}):r.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[d?r.jsx(pe,{size:20}):r.jsx(he,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:g.isPending?"Uploading…":d?"Drop a video here or click to browse":"Drop a file or click to browse"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[26]=y,e[27]=h,e[28]=d,e[29]=f,e[30]=a,e[31]=g.isPending,e[32]=z):z=e[32];let B;e[33]!==u?(B=u&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[33]=u,e[34]=B):B=e[34];let E;e[35]!==$||e[36]!==N||e[37]!==P||e[38]!==_||e[39]!==z||e[40]!==B?(E=r.jsxs("div",{onDragOver:N,onDragLeave:$,onDrop:P,className:_,children:[z,B]}),e[35]=$,e[36]=N,e[37]=P,e[38]=_,e[39]=z,e[40]=B,e[41]=E):E=e[41];let O;e[42]!==l?(O=Y=>l(Y.target.value),e[42]=l,e[43]=O):O=e[43];let V;e[44]!==i||e[45]!==a||e[46]!==O?(V=r.jsx(ee,{id:i,type:"url",value:a,onChange:O,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[44]=i,e[45]=a,e[46]=O,e[47]=V):V=e[47];let M;e[48]!==f?(M=()=>f(!0),e[48]=f,e[49]=M):M=e[49];let Q;e[50]===Symbol.for("react.memo_cache_sentinel")?(Q=r.jsx(Je,{size:14}),e[50]=Q):Q=e[50];const J=a?"Replace":"Browse";let W;e[51]!==M||e[52]!==J?(W=r.jsxs(ie,{type:"button",variant:"outline",size:"sm",onClick:M,className:"h-9 shrink-0",children:[Q,J]}),e[51]=M,e[52]=J,e[53]=W):W=e[53];let U;e[54]!==l||e[55]!==a?(U=a&&r.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(""),className:"h-9 shrink-0","aria-label":"Remove file",children:r.jsx(ke,{size:14})}),e[54]=l,e[55]=a,e[56]=U):U=e[56];let H;e[57]!==V||e[58]!==W||e[59]!==U?(H=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[V,W,U]}),e[57]=V,e[58]=W,e[59]=U,e[60]=H):H=e[60];let X;e[61]!==l?(X=Y=>l(Y),e[61]=l,e[62]=X):X=e[62];let Z;e[63]!==c||e[64]!==f||e[65]!==X?(Z=r.jsx(Xe,{open:c,onOpenChange:f,mode:"any",onSelect:X}),e[63]=c,e[64]=f,e[65]=X,e[66]=Z):Z=e[66];let te;return e[67]!==E||e[68]!==H||e[69]!==Z||e[70]!==S?(te=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[S,E,H,Z]}),e[67]=E,e[68]=H,e[69]=Z,e[70]=S,e[71]=te):te=e[71],te}function Pt(t){return t.type.startsWith("video/")}const Dt=new Set(["__resolveType","@type"]);function Rt(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return null;const e=t.anyOfRefs[0].resolveType;return e.endsWith("/multivariate/image.ts")?"image":e.endsWith("/multivariate/video.ts")||e.endsWith("/multivariate/file.ts")?"file":null}function zt(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Bt(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function Fe(t){const{schema:e,value:n}=t;if(e.type==="block-ref"||n!==null&&typeof n=="object"&&!Array.isArray(n)&&typeof n.__resolveType=="string"&&e.anyOfRefs){const o=Rt(e);return o==="image"?r.jsx(xe,{...t},t.path):o==="file"?r.jsx(be,{...t},t.path):e.anyOfRefs?r.jsx(ge,{...t},t.path):null}if(e.format==="image-uri")return r.jsx(xe,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(be,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(Nt,{...t},t.path);if(e.type==="anyOf")return r.jsx(ge,{...t},t.path);const s=n??Bt(e.type,e.default);if(s==null)return null;const l={...t,value:s},i=n==null?e.type??typeof s:Array.isArray(s)?"array":typeof s;if(i==="array"||Array.isArray(s))return r.jsx(Tt,{...l},t.path);switch(i){case"boolean":return r.jsx(yt,{...l},t.path);case"number":case"integer":return r.jsx(gt,{...l},t.path);case"string":{const o=e.format;return o==="color-input"?r.jsx(se,{...l},t.path):o==="textarea"||o==="rich-text"||o==="html"?r.jsx(se,{...l},t.path):r.jsx(se,{...l},t.path)}case"object":return s!==null&&typeof s=="object"&&!Array.isArray(s)?r.jsx(kt,{...l},t.path):null;default:return r.jsx(se,{...l},t.path)}}function fe(t){const e=R.c(13),{schema:n,value:s,onChange:l,basePath:i,breadcrumbPath:o,onBreadcrumbChange:d}=t;let a;e[0]!==o?(a=o===void 0?[]:o,e[0]=o,e[1]=a):a=e[1];const c=a,f=n.properties;if(!f)return null;let u;e[2]!==s?(u=s!=null&&typeof s=="object"&&!Array.isArray(s)?s:{},e[2]=s,e[3]=u):u=e[3];const m=u;let h,y;if(e[4]!==i||e[5]!==c||e[6]!==m||e[7]!==d||e[8]!==l||e[9]!==f){y=Symbol.for("react.early_return_sentinel");e:{const p=Object.keys(f).filter(Et);if(p.length===0){let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[12]=x):x=e[12],y=x;break e}const g=(x,b)=>{l({...m,[x]:b})};h=r.jsx("div",{className:"min-w-0 space-y-6",children:p.map(x=>{const b=f[x];if(!b)return null;const j=i?`${i}.${x}`:x,v=b.title??zt(x);return Fe({schema:b,value:m[x],onChange:w=>g(x,w),path:j,label:v,breadcrumbPath:c,onBreadcrumbChange:d})})})}e[4]=i,e[5]=c,e[6]=m,e[7]=d,e[8]=l,e[9]=f,e[10]=h,e[11]=y}else h=e[10],y=e[11];return y!==Symbol.for("react.early_return_sentinel")?y:h}function Et(t){return!Dt.has(t)}export{fe as S,Fe as a,se as b,ce as r,tt as s};
1
+ import{e as R,j as r,r as K,B as ie,c as je,o as oe}from"./index-BfzqpoYd.js";import{a9 as Pe,u as De,ap as pe,G as he}from"./agent-icon-Lc1AgwlE.js";import{C as Re}from"./calendar-CCqv5TgR.js";import{I as ee}from"./input-BGQcwAaL.js";import{L as G}from"./label-zIig0cjv.js";import{a as ze,b as Be,P as Ee}from"./popover-B1xAxEac.js";import{T as Ve}from"./textarea-Bo_ElpPh.js";import{S as Me}from"./switch-BZi96ipJ.js";import{c as ve,S as Ne,a as we,b as Te,d as Ce}from"./select-DpYu937I.js";import{d as Ue}from"./ZoomOut-CCPaeWry.js";import{s as Le}from"./Plus-gXoAw_mX.js";import{s as ke}from"./Trash01-B91-1KNk.js";import{D as We,a as He,b as Ye,c as Ke}from"./dropdown-menu-DpfpR4kx.js";import{e as Se,u as Ge,L as Qe,F as Xe,I as xe}from"./image-field-BTCmGBNs.js";import{U as ae,V as Ze,W as qe}from"./index-BXzjL9VS.js";import{t as Ae}from"./ChevronDown-BptXi8Ef.js";import{i as $e}from"./ChevronRight-CtziSifX.js";import{i as Je}from"./Upload01-CcwGyBRP.js";import{c as et}from"./use-file-configs-DGSgkVs8.js";function tt(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function rt(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(l=>l.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const s=e.find(l=>typeof l.value=="string");if(s)return s.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function Ie(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ie);const e=t;return e.__resolveType?rt(e)??t:_e(e)}function _e(t){const e={};for(const[n,s]of Object.entries(t))e[n]=Ie(s);return e}function nt(t,e){return e.split(".").reduce((n,s)=>{if(!(n==null||typeof n!="object"))return n[s]},t)}function Oe(t){return t==null?"":Array.isArray(t)?t.map(Oe).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function ce(t,e){if(!t.includes("{"))return;const n=_e(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(l,i,o)=>{const d=(i??o??"").trim();return Oe(nt(n,d))}).trim()||void 0}function st(t,e){if(e.includes("{"))return ce(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const s=n.map(l=>l==null?"":String(l)).filter(Boolean).join(",");if(s)return s}}function it(t,e,n){if(typeof t=="string")return t||`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){const s=t;if(n?.titleBy){const i=st(s,n.titleBy);if(i)return i}if(n?.title){const i=ce(n.title,s);if(i)return i;if(!n.title.includes("{"))return n.title}for(const i of["name","label","title","alt","text","href","id"]){const o=s[i];if(typeof o=="string"&&o)return o;if(Array.isArray(o)){const d=o.map(a=>a==null?"":String(a)).filter(Boolean).join(",");if(d)return d}}const l=s.__resolveType;if(typeof l=="string"&&l){const i=l.split("/").at(-1);if(i)return i.replace(/\.tsx?$/,"")}}return`Item ${e+1}`}function lt(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const n=e.properties;return n?.mobile?"{{{image.mobile}}}":n?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function ot(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=lt(e);if(!n)return;const s=ce(n,t);if(!s)return;const l=Se(s)||s;return tt(l)}const q=t=>String(t).padStart(2,"0"),at="1900-01-01",ct="2099-12-31",dt="1900-01-01T00:00",ut="2099-12-31T23:59";function ft(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const n=new Date(t);return Number.isNaN(n.getTime())?"":`${n.getUTCFullYear()}-${q(n.getUTCMonth()+1)}-${q(n.getUTCDate())}`}function mt(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function pt(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${q(e.getMonth()+1)}-${q(e.getDate())}T${q(e.getHours())}:${q(e.getMinutes())}`}function ht(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function xt(t){const e=R.c(29),{id:n,withTime:s,value:l,onChange:i}=t,[o,d]=K.useState(!1);let a;e[0]!==l||e[1]!==s?(a=s?pt(l):ft(l),e[0]=l,e[1]=s,e[2]=a):a=e[2];const c=a;let f;e[3]!==i||e[4]!==s?(f=k=>{i(s?ht(k.target.value):mt(k.target.value))},e[3]=i,e[4]=s,e[5]=f):f=e[5];const u=f;let m;if(e[6]!==l){const k=l?new Date(l):null;m=k&&!Number.isNaN(k.getTime())?k:null,e[6]=l,e[7]=m}else m=e[7];const h=m;let y;e[8]!==i||e[9]!==h||e[10]!==s?(y=k=>{k&&(s&&h?k.setHours(h.getHours(),h.getMinutes(),0,0):k.setHours(0,0,0,0),i(k.toISOString()),d(!1))},e[8]=i,e[9]=h,e[10]=s,e[11]=y):y=e[11];const p=y,g=s?"datetime-local":"date",x=s?dt:at,b=s?ut:ct;let j;e[12]!==u||e[13]!==n||e[14]!==c||e[15]!==g||e[16]!==x||e[17]!==b?(j=r.jsx(ee,{id:n,type:g,min:x,max:b,value:c,onChange:u,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=u,e[13]=n,e[14]=c,e[15]=g,e[16]=x,e[17]=b,e[18]=j):j=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=r.jsx(ze,{asChild:!0,children:r.jsx(ie,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:r.jsx(Pe,{className:"h-4 w-4"})})}),e[19]=v):v=e[19];const w=h??void 0;let N;e[20]!==p||e[21]!==w?(N=r.jsx(Be,{className:"w-auto p-0",align:"end",children:r.jsx(Re,{mode:"single",selected:w,onSelect:p,initialFocus:!0})}),e[20]=p,e[21]=w,e[22]=N):N=e[22];let C;e[23]!==o||e[24]!==N?(C=r.jsxs(Ee,{open:o,onOpenChange:d,children:[v,N]}),e[23]=o,e[24]=N,e[25]=C):C=e[25];let $;return e[26]!==C||e[27]!==j?($=r.jsxs("div",{className:"flex gap-1",children:[j,C]}),e[26]=C,e[27]=j,e[28]=$):$=e[28],$}function ne(t){const e=R.c(8),{htmlFor:n,label:s,description:l}=t;let i;e[0]!==n||e[1]!==s?(i=r.jsx(G,{htmlFor:n,children:s}),e[0]=n,e[1]=s,e[2]=i):i=e[2];let o;e[3]!==l?(o=l&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l}),e[3]=l,e[4]=o):o=e[4];let d;return e[5]!==i||e[6]!==o?(d=r.jsxs("div",{className:"space-y-0.5",children:[i,o]}),e[5]=i,e[6]=o,e[7]=d):d=e[7],d}function se(t){const e=R.c(61),{schema:n,value:s,onChange:l,path:i,label:o}=t,d=typeof s=="string"?s:"",a=n.format;if(a==="textarea"||a==="rich-text"||a==="rich-text-inline"||a==="markdown"){let p;e[0]!==o||e[1]!==i||e[2]!==n.description?(p=r.jsx(ne,{htmlFor:i,label:o,description:n.description}),e[0]=o,e[1]=i,e[2]=n.description,e[3]=p):p=e[3];let g;e[4]!==l?(g=j=>l(j.target.value),e[4]=l,e[5]=g):g=e[5];let x;e[6]!==i||e[7]!==d||e[8]!==g?(x=r.jsx(Ve,{id:i,value:d,onChange:g,rows:4}),e[6]=i,e[7]=d,e[8]=g,e[9]=x):x=e[9];let b;return e[10]!==p||e[11]!==x?(b=r.jsxs("div",{className:"space-y-2",children:[p,x]}),e[10]=p,e[11]=x,e[12]=b):b=e[12],b}if(a==="date"||a==="date-time"){let p;e[13]!==o||e[14]!==i||e[15]!==n.description?(p=r.jsx(ne,{htmlFor:i,label:o,description:n.description}),e[13]=o,e[14]=i,e[15]=n.description,e[16]=p):p=e[16];const g=a==="date-time";let x;e[17]!==l||e[18]!==i||e[19]!==d||e[20]!==g?(x=r.jsx(xt,{id:i,withTime:g,value:d,onChange:l}),e[17]=l,e[18]=i,e[19]=d,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==p||e[23]!==x?(b=r.jsxs("div",{className:"space-y-2",children:[p,x]}),e[22]=p,e[23]=x,e[24]=b):b=e[24],b}if(a==="color-input"){let p;e[25]!==o||e[26]!==i||e[27]!==n.description?(p=r.jsx(ne,{htmlFor:i,label:o,description:n.description}),e[25]=o,e[26]=i,e[27]=n.description,e[28]=p):p=e[28];const g=d||"#000000";let x;e[29]!==l?(x=C=>l(C.target.value),e[29]=l,e[30]=x):x=e[30];let b;e[31]!==g||e[32]!==x?(b=r.jsx("input",{type:"color",value:g,onChange:x,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[31]=g,e[32]=x,e[33]=b):b=e[33];let j;e[34]!==l?(j=C=>l(C.target.value),e[34]=l,e[35]=j):j=e[35];let v;e[36]!==i||e[37]!==d||e[38]!==j?(v=r.jsx(ee,{id:i,value:d,onChange:j,placeholder:"#000000",className:"h-10 flex-1"}),e[36]=i,e[37]=d,e[38]=j,e[39]=v):v=e[39];let w;e[40]!==b||e[41]!==v?(w=r.jsxs("div",{className:"flex items-center gap-2",children:[b,v]}),e[40]=b,e[41]=v,e[42]=w):w=e[42];let N;return e[43]!==p||e[44]!==w?(N=r.jsxs("div",{className:"space-y-2",children:[p,w]}),e[43]=p,e[44]=w,e[45]=N):N=e[45],N}let c;e[46]!==o||e[47]!==i||e[48]!==n.description?(c=r.jsx(ne,{htmlFor:i,label:o,description:n.description}),e[46]=o,e[47]=i,e[48]=n.description,e[49]=c):c=e[49];const f=a==="url"?"url":"text";let u;e[50]!==l?(u=p=>l(p.target.value),e[50]=l,e[51]=u):u=e[51];const m=n.default!=null?String(n.default):void 0;let h;e[52]!==i||e[53]!==d||e[54]!==f||e[55]!==u||e[56]!==m?(h=r.jsx(ee,{id:i,type:f,value:d,onChange:u,placeholder:m,className:"h-10"}),e[52]=i,e[53]=d,e[54]=f,e[55]=u,e[56]=m,e[57]=h):h=e[57];let y;return e[58]!==c||e[59]!==h?(y=r.jsxs("div",{className:"space-y-2",children:[c,h]}),e[58]=c,e[59]=h,e[60]=y):y=e[60],y}function gt(t){const e=R.c(17),{schema:n,value:s,onChange:l,path:i,label:o}=t,d=typeof s=="number"?s:"";let a;e[0]!==o||e[1]!==i?(a=r.jsx(G,{htmlFor:i,children:o}),e[0]=o,e[1]=i,e[2]=a):a=e[2];let c;e[3]!==n.description?(c=n.description&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=c):c=e[4];let f;e[5]!==a||e[6]!==c?(f=r.jsxs("div",{className:"space-y-0.5",children:[a,c]}),e[5]=a,e[6]=c,e[7]=f):f=e[7];let u;e[8]!==l?(u=y=>{const p=y.target.value;l(p===""?void 0:Number(p))},e[8]=l,e[9]=u):u=e[9];let m;e[10]!==d||e[11]!==i||e[12]!==u?(m=r.jsx(ee,{id:i,type:"number",value:d,onChange:u,className:"h-10"}),e[10]=d,e[11]=i,e[12]=u,e[13]=m):m=e[13];let h;return e[14]!==f||e[15]!==m?(h=r.jsxs("div",{className:"space-y-2",children:[f,m]}),e[14]=f,e[15]=m,e[16]=h):h=e[16],h}function yt(t){const e=R.c(17),{value:n,onChange:s,path:l,label:i,schema:o}=t,d=typeof n=="boolean"?n:!1;let a;e[0]!==i||e[1]!==l?(a=r.jsx(G,{htmlFor:l,children:i}),e[0]=i,e[1]=l,e[2]=a):a=e[2];let c;e[3]!==o.description?(c=o.description&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:o.description}),e[3]=o.description,e[4]=c):c=e[4];let f;e[5]!==a||e[6]!==c?(f=r.jsxs("div",{className:"space-y-0.5",children:[a,c]}),e[5]=a,e[6]=c,e[7]=f):f=e[7];let u;e[8]!==s?(u=y=>s(y),e[8]=s,e[9]=u):u=e[9];let m;e[10]!==d||e[11]!==l||e[12]!==u?(m=r.jsx(Me,{id:l,checked:d,onCheckedChange:u}),e[10]=d,e[11]=l,e[12]=u,e[13]=m):m=e[13];let h;return e[14]!==f||e[15]!==m?(h=r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[f,m]}),e[14]=f,e[15]=m,e[16]=h):h=e[16],h}const de="__enum_empty__";function ue(t){return t===""?de:String(t)}function bt(t,e){if(t===de)return"";const n=e.find(s=>ue(s)===t);return n!==void 0?n:t}function jt(t,e){return t==null?e.some(n=>n==="")?de:void 0:ue(t)}function vt(t){return t===""?"":String(t)}function Nt(t){const e=R.c(28),{schema:n,value:s,onChange:l,path:i,label:o}=t;let d;e[0]!==n.enum?(d=n.enum??[],e[0]=n.enum,e[1]=d):d=e[1];const a=d;let c;e[2]!==a||e[3]!==s?(c=jt(s,a),e[2]=a,e[3]=s,e[4]=c):c=e[4];const f=c;let u;e[5]!==o||e[6]!==i?(u=r.jsx(G,{htmlFor:i,children:o}),e[5]=o,e[6]=i,e[7]=u):u=e[7];let m;e[8]!==n.description?(m=n.description&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=m):m=e[9];let h;e[10]!==u||e[11]!==m?(h=r.jsxs("div",{className:"space-y-0.5",children:[u,m]}),e[10]=u,e[11]=m,e[12]=h):h=e[12];let y;e[13]!==l||e[14]!==a?(y=v=>l(bt(v,a)),e[13]=l,e[14]=a,e[15]=y):y=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=r.jsx(Ne,{className:"h-10",children:r.jsx(we,{placeholder:"Select..."})}),e[16]=p):p=e[16];let g;e[17]!==a?(g=a.map(wt),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==g?(x=r.jsx(Te,{children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==f||e[22]!==y||e[23]!==x?(b=r.jsxs(Ce,{value:f,onValueChange:y,children:[p,x]}),e[21]=f,e[22]=y,e[23]=x,e[24]=b):b=e[24];let j;return e[25]!==b||e[26]!==h?(j=r.jsxs("div",{className:"space-y-2",children:[h,b]}),e[25]=b,e[26]=h,e[27]=j):j=e[27],j}function wt(t){const e=ue(t);return r.jsx(ve,{value:e,children:vt(t)},e)}function Tt(t){const e=R.c(32),{schema:n,value:s,onChange:l,path:i,label:o,breadcrumbPath:d,onBreadcrumbChange:a}=t,c=d===void 0?[]:d,f=Array.isArray(s)?s:[],u=n.items,[m,h]=K.useState(null);let y;e[0]!==u?(y=(T,S)=>it(T,S,u),e[0]=u,e[1]=y):y=e[1];const p=y,g=()=>{const T=u?.type,S=u?.default!==void 0?u.default:T==="object"?{}:T==="block-ref"?(()=>{const _=u?.anyOfRefs?.[0]?.resolveType;return typeof _!="string"||ae(_)?{}:{__resolveType:_}})():T==="number"||T==="integer"?0:T==="boolean"?!1:T==="array"?[]:"",A=[...f,S];l(A);const I=A.length-1;h(I),a?.([...c,p(S,I)])},x=T=>{l(f.filter((S,A)=>A!==T)),m===T&&(h(null),a?.(c))},b=(T,S)=>{const A=[...f];A[T]=S,l(A),m===T&&a?.([...c,p(S,T)])};if(m!==null&&m<f.length){const T=f[m],S=[...c,p(T,m)],A=u?.type==="object"&&u.properties?r.jsx(fe,{schema:u,value:T,onChange:_=>b(m,_),basePath:`${i}.${m}`,breadcrumbPath:S,onBreadcrumbChange:a}):u?Fe({schema:u,value:T,onChange:_=>b(m,_),path:`${i}.${m}`,label:u.title??`Item ${m+1}`,breadcrumbPath:S,onBreadcrumbChange:a}):null;let I;return e[2]!==A?(I=r.jsx("div",{className:"min-w-0 space-y-4",children:A}),e[2]=A,e[3]=I):I=e[3],I}let j;e[4]!==o?(j=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[4]=o,e[5]=j):j=e[5];let v;e[6]!==f.length?(v=f.length>0&&r.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:f.length}),e[6]=f.length,e[7]=v):v=e[7];let w;e[8]!==j||e[9]!==v?(w=r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[j,v]}),e[8]=j,e[9]=v,e[10]=w):w=e[10];let N;e[11]!==n.description?(N=n.description&&r.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=N):N=e[12];let C;e[13]!==w||e[14]!==N?(C=r.jsxs("div",{className:"min-w-0 space-y-0.5",children:[w,N]}),e[13]=w,e[14]=N,e[15]=C):C=e[15];let $;e[16]!==c||e[17]!==p||e[18]!==u||e[19]!==f||e[20]!==a||e[21]!==i||e[22]!==x||e[23]!==h?($=f.length>0&&r.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:f.map((T,S)=>{const A=p(T,S),I=ot(T,u);return r.jsxs("div",{className:"group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground",children:[r.jsx(Ue,{className:"size-3.5 shrink-0 cursor-grab text-muted-foreground/40"}),r.jsxs("button",{type:"button",onClick:()=>{h(S),a?.([...c,A])},className:"flex min-w-0 flex-1 items-center gap-2.5 text-left text-sm",title:A,children:[I&&r.jsx("img",{src:I,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),r.jsx("span",{className:"min-w-0 truncate",children:A})]}),r.jsxs(We,{children:[r.jsx(He,{asChild:!0,children:r.jsx(ie,{type:"button",variant:"ghost",size:"icon","aria-label":`Open actions for ${A}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:Ct,children:r.jsx(De,{size:14})})}),r.jsx(Ye,{align:"end",children:r.jsxs(Ke,{className:"text-destructive focus:text-destructive",onClick:()=>x(S),children:[r.jsx(ke,{size:14}),"Delete"]})})]})]},`${i}.${S}`)})}),e[16]=c,e[17]=p,e[18]=u,e[19]=f,e[20]=a,e[21]=i,e[22]=x,e[23]=h,e[24]=$):$=e[24];let k;e[25]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(Le,{size:14}),e[25]=k):k=e[25];let P;e[26]!==g?(P=r.jsxs("button",{type:"button",onClick:g,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[k,"Add item"]}),e[26]=g,e[27]=P):P=e[27];let D;return e[28]!==P||e[29]!==C||e[30]!==$?(D=r.jsxs("div",{className:"space-y-2",children:[C,$,P]}),e[28]=P,e[29]=C,e[30]=$,e[31]=D):D=e[31],D}function Ct(t){return t.stopPropagation()}function kt(t){const e=R.c(37),{schema:n,value:s,onChange:l,path:i,label:o,breadcrumbPath:d,onBreadcrumbChange:a}=t,[c,f]=K.useState(!1);let u;e[0]!==s?(u=s!=null&&typeof s=="object"&&!Array.isArray(s)?s:{},e[0]=s,e[1]=u):u=e[1];const m=u;if(!n.properties)return null;const h=`${i}-fields`;let y;e[2]!==d?(y=d??[],e[2]=d,e[3]=y):y=e[3];let p;e[4]!==o||e[5]!==y?(p=[...y,o],e[4]=o,e[5]=y,e[6]=p):p=e[6];const g=p;let x;e[7]!==d||e[8]!==g||e[9]!==a||e[10]!==c?(x=()=>{const k=!c;f(k),a?.(k?g:d??[])},e[7]=d,e[8]=g,e[9]=a,e[10]=c,e[11]=x):x=e[11];const b=x;let j;e[12]!==c?(j=r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:c?r.jsx(Ae,{size:16}):r.jsx($e,{size:16})}),e[12]=c,e[13]=j):j=e[13];let v;e[14]!==o?(v=r.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[14]=o,e[15]=v):v=e[15];let w;e[16]!==h||e[17]!==b||e[18]!==c||e[19]!==j||e[20]!==v?(w=r.jsxs("button",{type:"button","aria-expanded":c,"aria-controls":h,onClick:b,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[j,v]}),e[16]=h,e[17]=b,e[18]=c,e[19]=j,e[20]=v,e[21]=w):w=e[21];let N;e[22]!==n.description?(N=n.description&&r.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=N):N=e[23];let C;e[24]!==h||e[25]!==g||e[26]!==m||e[27]!==a||e[28]!==l||e[29]!==c||e[30]!==i||e[31]!==n?(C=c&&r.jsx("div",{id:h,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:r.jsx(fe,{schema:n,value:m,onChange:l,basePath:i,breadcrumbPath:g,onBreadcrumbChange:a})}),e[24]=h,e[25]=g,e[26]=m,e[27]=a,e[28]=l,e[29]=c,e[30]=i,e[31]=n,e[32]=C):C=e[32];let $;return e[33]!==w||e[34]!==N||e[35]!==C?($=r.jsxs("div",{className:"min-w-0 space-y-2",children:[w,N,C]}),e[33]=w,e[34]=N,e[35]=C,e[36]=$):$=e[36],$}function St(t){if(!t?.properties)return{};const e={};for(const[n,s]of Object.entries(t.properties))n.startsWith("__")||n==="@type"||(s.default!==void 0?e[n]=s.default:s.type==="boolean"?e[n]=!1:s.type==="string"?e[n]="":s.type==="number"||s.type==="integer"?e[n]=0:s.type==="object"&&(e[n]={}));return e}function At(t,e){const n=e[0]?.resolveType??"";if(!t||typeof t!="object"||Array.isArray(t))return n;const s=t;if(typeof s.__resolveType=="string"){const o=e.find(d=>Ze(d.resolveType,s.__resolveType));if(o)return o.resolveType}let l=n,i=-1;for(const o of e){if(!o.schema?.properties)continue;const a=Object.keys(o.schema.properties).filter(c=>!c.startsWith("__")&&c!=="@type"&&c!=="action"&&c!=="alt").filter(c=>s[c]!==void 0).length;a>0&&a>i&&(i=a,l=o.resolveType)}if(i>0)return l;for(const o of e){if(!o.schema?.properties)continue;const d=Object.keys(o.schema.properties).filter(a=>s[a]!==void 0).length;d>0&&d>i&&(i=d,l=o.resolveType)}return l}function $t(t){const e=R.c(23),{path:n,open:s,onOpenChange:l,title:i,nested:o,nestedBlockRef:d}=t,a=`${n}-loader-config`,c=d&&"ml-1";let f;e[0]!==c?(f=je("rounded-lg border border-border/80 bg-muted/30",c),e[0]=c,e[1]=f):f=e[1];let u;e[2]!==l||e[3]!==s?(u=()=>l(!s),e[2]=l,e[3]=s,e[4]=u):u=e[4];let m;e[5]!==s?(m=r.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:s?r.jsx(Ae,{size:16}):r.jsx($e,{size:16})}),e[5]=s,e[6]=m):m=e[6];let h;e[7]!==i?(h=r.jsx("span",{className:"min-w-0 truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:i}),e[7]=i,e[8]=h):h=e[8];let y;e[9]!==a||e[10]!==s||e[11]!==u||e[12]!==m||e[13]!==h?(y=r.jsxs("button",{type:"button","aria-expanded":s,"aria-controls":a,onClick:u,className:"group flex w-full min-w-0 items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[m,h]}),e[9]=a,e[10]=s,e[11]=u,e[12]=m,e[13]=h,e[14]=y):y=e[14];let p;e[15]!==a||e[16]!==o||e[17]!==s?(p=s&&r.jsx("div",{id:a,className:"border-t border-border/60 px-4 pb-4 pt-3",children:r.jsx("div",{className:"border-l border-border/80 pl-4",children:o})}),e[15]=a,e[16]=o,e[17]=s,e[18]=p):p=e[18];let g;return e[19]!==f||e[20]!==y||e[21]!==p?(g=r.jsxs("div",{className:f,children:[y,p]}),e[19]=f,e[20]=y,e[21]=p,e[22]=g):g=e[22],g}function ge(t){const e=R.c(35),{schema:n,value:s,onChange:l,path:i,label:o,breadcrumbPath:d,onBreadcrumbChange:a}=t,c=(n.anyOfRefs??[]).filter(_t),f=c.length>0?At(s,c):c[0]?.resolveType??"",[u,m]=K.useState(f),[h,y]=K.useState(!1);if(c.length>0){const N=u||f;let C;e[0]!==N?(C=O=>O.resolveType===N,e[0]=N,e[1]=C):C=e[1];const $=c.find(C),k=O=>{m(O);const V=c.find(U=>U.resolveType===O),M=new Set(Object.keys(V?.schema?.properties??{})),Q=s!==null&&typeof s=="object"&&!Array.isArray(s)?s:{},J=Object.fromEntries(Object.entries(Q).filter(U=>{const[H]=U;return M.has(H)})),W={...St(V?.schema),...J};if(ae(O)){l(W);return}l({...W,__resolveType:O})};let P;e[2]!==N||e[3]!==l?(P=O=>{if(!ae(N)||O===null||typeof O!="object"||Array.isArray(O)){l(O);return}const{__resolveType:V,...M}=O;l(M)},e[2]=N,e[3]=l,e[4]=P):P=e[4];const D=P,T=$?.schema?.properties?r.jsx(fe,{schema:$.schema,value:s,onChange:D,basePath:i,breadcrumbPath:d,onBreadcrumbChange:a}):null,S=n.type==="block-ref";let A;e[5]!==i?(A=i.includes("."),e[5]=i,e[6]=A):A=e[6];const I=A;let _;e[7]!==o||e[8]!==i?(_=r.jsx(G,{htmlFor:i,children:o}),e[7]=o,e[8]=i,e[9]=_):_=e[9];let z;e[10]===Symbol.for("react.memo_cache_sentinel")?(z=r.jsx(Ne,{children:r.jsx(we,{placeholder:"Select..."})}),e[10]=z):z=e[10];let B;e[11]!==n.description?(B=n.description&&r.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=B):B=e[12];let E;return e[13]!==S||e[14]!==I||e[15]!==h||e[16]!==T||e[17]!==i?(E=T&&(S?r.jsx($t,{path:i,open:h,onOpenChange:y,title:I?"Configuration":"Loader configuration",nested:T,nestedBlockRef:I}):T),e[13]=S,e[14]=I,e[15]=h,e[16]=T,e[17]=i,e[18]=E):E=e[18],r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[_,r.jsxs(Ce,{value:N,onValueChange:k,children:[z,r.jsx(Te,{children:c.map(It)})]}),B]}),E]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let p;e[19]!==o||e[20]!==i?(p=r.jsx(G,{htmlFor:i,children:o}),e[19]=o,e[20]=i,e[21]=p):p=e[21];const g=s!=null?String(s):"";let x;e[22]!==l?(x=N=>l(N.target.value),e[22]=l,e[23]=x):x=e[23];const b=n.description??"";let j;e[24]!==i||e[25]!==g||e[26]!==x||e[27]!==b?(j=r.jsx("input",{id:i,type:"text",value:g,onChange:x,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:b}),e[24]=i,e[25]=g,e[26]=x,e[27]=b,e[28]=j):j=e[28];let v;e[29]!==n.description?(v=n.description&&r.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[29]=n.description,e[30]=v):v=e[30];let w;return e[31]!==p||e[32]!==j||e[33]!==v?(w=r.jsxs("div",{className:"space-y-1.5",children:[p,j,v]}),e[31]=p,e[32]=j,e[33]=v,e[34]=w):w=e[34],w}function It(t){return r.jsx(ve,{value:t.resolveType,children:t.title??qe(t.resolveType)??t.resolveType},t.resolveType)}function _t(t){return t.resolveType!==""}function ye(t){const e=R.c(2),{ext:n}=t;if(!n)return null;let s;return e[0]!==n?(s=r.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:n}),e[0]=n,e[1]=s):s=e[1],s}function Ot(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Ft(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function be(t){const e=R.c(72),{schema:n,value:s,onChange:l,path:i,label:o}=t,d=n.format==="video-uri",a=Se(s),[c,f]=K.useState(!1),[u,m]=K.useState(!1),h=a?Ot(a):"",y=h?Ft(h):"",p=et(),g=Ge();let x;e[0]!==p.data?.configs?(x=function(){const F=p.data?.configs??[];if(F.length===1)return F[0].id;if(F.length===0)return null;const L=typeof window<"u"?window.localStorage.getItem(Qe):null;return F.some(re=>re.id===L)?L:null},e[0]=p.data?.configs,e[1]=x):x=e[1];const b=x;let j;e[2]!==d||e[3]!==l||e[4]!==b||e[5]!==f||e[6]!==g?(j=async function(F){if(!F)return;let L=Array.from(F);if(L.length===0)return;if(d&&(L=L.filter(Pt),L.length===0)){oe.error("Please drop a video file (mp4, webm, …).");return}const re=b();if(!re){f(!0);return}try{const le=await g.mutateAsync({configId:re,file:L[0]});l(le.publicUrl),L.length>1&&oe.info(`Uploaded ${L[0].name}; extra files were ignored (single-select field).`)}catch(le){const me=le;oe.error(me instanceof Error?me.message:"Upload failed")}},e[2]=d,e[3]=l,e[4]=b,e[5]=f,e[6]=g,e[7]=j):j=e[7];const v=j;let w;e[8]!==m?(w=function(F){F.preventDefault(),F.dataTransfer.types.includes("Files")&&m(!0)},e[8]=m,e[9]=w):w=e[9];const N=w;let C;e[10]!==m?(C=function(F){F.currentTarget===F.target&&m(!1)},e[10]=m,e[11]=C):C=e[11];const $=C;let k;e[12]!==v||e[13]!==m?(k=function(F){F.preventDefault(),m(!1),v(F.dataTransfer.files)},e[12]=v,e[13]=m,e[14]=k):k=e[14];const P=k;let D;e[15]!==o||e[16]!==i?(D=r.jsx(G,{htmlFor:i,className:"text-muted-foreground",children:o}),e[15]=o,e[16]=i,e[17]=D):D=e[17];let T;e[18]!==n.description?(T=n.description&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=T):T=e[19];let S;e[20]!==D||e[21]!==T?(S=r.jsxs("div",{className:"min-w-0 space-y-0.5",children:[D,T]}),e[20]=D,e[21]=T,e[22]=S):S=e[22];const A=u&&"border-primary ring-2 ring-primary/30",I=g.isPending&&"pointer-events-none opacity-60";let _;e[23]!==I||e[24]!==A?(_=je("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",A,I),e[23]=I,e[24]=A,e[25]=_):_=e[25];let z;e[26]!==y||e[27]!==h||e[28]!==d||e[29]!==f||e[30]!==a||e[31]!==g.isPending?(z=a?d?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:r.jsx("video",{src:a,preload:"metadata",className:"h-full w-full object-contain"},a)}),r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx(pe,{size:14,className:"shrink-0 text-muted-foreground"}),r.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:h}),r.jsx(ye,{ext:y})]})]}):r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[r.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:r.jsx(he,{size:18,className:"text-muted-foreground"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium",children:h}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a})]}),r.jsx(ye,{ext:y})]}):r.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[d?r.jsx(pe,{size:20}):r.jsx(he,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:g.isPending?"Uploading…":d?"Drop a video here or click to browse":"Drop a file or click to browse"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[26]=y,e[27]=h,e[28]=d,e[29]=f,e[30]=a,e[31]=g.isPending,e[32]=z):z=e[32];let B;e[33]!==u?(B=u&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[33]=u,e[34]=B):B=e[34];let E;e[35]!==$||e[36]!==N||e[37]!==P||e[38]!==_||e[39]!==z||e[40]!==B?(E=r.jsxs("div",{onDragOver:N,onDragLeave:$,onDrop:P,className:_,children:[z,B]}),e[35]=$,e[36]=N,e[37]=P,e[38]=_,e[39]=z,e[40]=B,e[41]=E):E=e[41];let O;e[42]!==l?(O=Y=>l(Y.target.value),e[42]=l,e[43]=O):O=e[43];let V;e[44]!==i||e[45]!==a||e[46]!==O?(V=r.jsx(ee,{id:i,type:"url",value:a,onChange:O,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[44]=i,e[45]=a,e[46]=O,e[47]=V):V=e[47];let M;e[48]!==f?(M=()=>f(!0),e[48]=f,e[49]=M):M=e[49];let Q;e[50]===Symbol.for("react.memo_cache_sentinel")?(Q=r.jsx(Je,{size:14}),e[50]=Q):Q=e[50];const J=a?"Replace":"Browse";let W;e[51]!==M||e[52]!==J?(W=r.jsxs(ie,{type:"button",variant:"outline",size:"sm",onClick:M,className:"h-9 shrink-0",children:[Q,J]}),e[51]=M,e[52]=J,e[53]=W):W=e[53];let U;e[54]!==l||e[55]!==a?(U=a&&r.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(""),className:"h-9 shrink-0","aria-label":"Remove file",children:r.jsx(ke,{size:14})}),e[54]=l,e[55]=a,e[56]=U):U=e[56];let H;e[57]!==V||e[58]!==W||e[59]!==U?(H=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[V,W,U]}),e[57]=V,e[58]=W,e[59]=U,e[60]=H):H=e[60];let X;e[61]!==l?(X=Y=>l(Y),e[61]=l,e[62]=X):X=e[62];let Z;e[63]!==c||e[64]!==f||e[65]!==X?(Z=r.jsx(Xe,{open:c,onOpenChange:f,mode:"any",onSelect:X}),e[63]=c,e[64]=f,e[65]=X,e[66]=Z):Z=e[66];let te;return e[67]!==E||e[68]!==H||e[69]!==Z||e[70]!==S?(te=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[S,E,H,Z]}),e[67]=E,e[68]=H,e[69]=Z,e[70]=S,e[71]=te):te=e[71],te}function Pt(t){return t.type.startsWith("video/")}const Dt=new Set(["__resolveType","@type"]);function Rt(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return null;const e=t.anyOfRefs[0].resolveType;return e.endsWith("/multivariate/image.ts")?"image":e.endsWith("/multivariate/video.ts")||e.endsWith("/multivariate/file.ts")?"file":null}function zt(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Bt(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function Fe(t){const{schema:e,value:n}=t;if(e.type==="block-ref"||n!==null&&typeof n=="object"&&!Array.isArray(n)&&typeof n.__resolveType=="string"&&e.anyOfRefs){const o=Rt(e);return o==="image"?r.jsx(xe,{...t},t.path):o==="file"?r.jsx(be,{...t},t.path):e.anyOfRefs?r.jsx(ge,{...t},t.path):null}if(e.format==="image-uri")return r.jsx(xe,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return r.jsx(be,{...t},t.path);if(e.enum&&e.enum.length>0)return r.jsx(Nt,{...t},t.path);if(e.type==="anyOf")return r.jsx(ge,{...t},t.path);const s=n??Bt(e.type,e.default);if(s==null)return null;const l={...t,value:s},i=n==null?e.type??typeof s:Array.isArray(s)?"array":typeof s;if(i==="array"||Array.isArray(s))return r.jsx(Tt,{...l},t.path);switch(i){case"boolean":return r.jsx(yt,{...l},t.path);case"number":case"integer":return r.jsx(gt,{...l},t.path);case"string":{const o=e.format;return o==="color-input"?r.jsx(se,{...l},t.path):o==="textarea"||o==="rich-text"||o==="html"?r.jsx(se,{...l},t.path):r.jsx(se,{...l},t.path)}case"object":return s!==null&&typeof s=="object"&&!Array.isArray(s)?r.jsx(kt,{...l},t.path):null;default:return r.jsx(se,{...l},t.path)}}function fe(t){const e=R.c(13),{schema:n,value:s,onChange:l,basePath:i,breadcrumbPath:o,onBreadcrumbChange:d}=t;let a;e[0]!==o?(a=o===void 0?[]:o,e[0]=o,e[1]=a):a=e[1];const c=a,f=n.properties;if(!f)return null;let u;e[2]!==s?(u=s!=null&&typeof s=="object"&&!Array.isArray(s)?s:{},e[2]=s,e[3]=u):u=e[3];const m=u;let h,y;if(e[4]!==i||e[5]!==c||e[6]!==m||e[7]!==d||e[8]!==l||e[9]!==f){y=Symbol.for("react.early_return_sentinel");e:{const p=Object.keys(f).filter(Et);if(p.length===0){let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[12]=x):x=e[12],y=x;break e}const g=(x,b)=>{l({...m,[x]:b})};h=r.jsx("div",{className:"min-w-0 space-y-6",children:p.map(x=>{const b=f[x];if(!b)return null;const j=i?`${i}.${x}`:x,v=b.title??zt(x);return Fe({schema:b,value:m[x],onChange:w=>g(x,w),path:j,label:v,breadcrumbPath:c,onBreadcrumbChange:d})})})}e[4]=i,e[5]=c,e[6]=m,e[7]=d,e[8]=l,e[9]=f,e[10]=h,e[11]=y}else h=e[10],y=e[11];return y!==Symbol.for("react.early_return_sentinel")?y:h}function Et(t){return!Dt.has(t)}export{fe as S,Fe as a,se as b,ce as r,tt as s};
@@ -1,4 +1,4 @@
1
- import{r as w,dE as $l,bF as ju,j as O,aU as Hu,b5 as St,dF as Wu,a7 as it,a8 as Qe,bk as On,bh as Uu,bi as qu,bx as Mt,dy as Fl,ag as _l,bg as Ku,ad as ut,e as Vl,c as jl}from"./index-Bo3JNDr-.js";import{e as Ju}from"./select-DUXB6LHg.js";function Q(n){this.content=n}Q.prototype={constructor:Q,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Q(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Q(t)},addToStart:function(n,e){return new Q([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Q(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Q(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Q.from(n),n.size?new Q(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Q.from(n),n.size?new Q(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Q.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Q.from=function(n){if(n instanceof Q)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Q(e)};function Hl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Hl(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wl(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wl(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Hl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wl(this,e,t,r)}findIndex(e){if(e==0)return Ln(0,e);if(e==this.size)return Ln(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Ln(t+1,i):Ln(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const ls={index:0,offset:0};function Ln(n,e){return ls.index=n,ls.offset=e,ls}function Qn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Qn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Qn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let z=class Ps{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ps.none;if(e instanceof Ps)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};z.none=[];class Zn extends Error{}class v{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ql(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Ul(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return v.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new v(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new v(e,r,s)}}v.empty=new v(k.empty,0,0);function Ul(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Ul(i.content,e-s-1,t-s-1)))}function ql(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=ql(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Gu(n,e,t){if(t.openStart>n.depth)throw new Zn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Zn("Inconsistent open depths");return Kl(n,e,t,0)}function Kl(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kl(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return yt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Yu(t,n);return yt(i,Gl(n,o,l,e,r))}else return yt(i,er(n,e,r))}function Jl(n,e){if(!e.type.compatibleContent(n.type))throw new Zn("Cannot join "+e.type.name+" onto "+n.type.name)}function Ls(n,e,t){let r=n.node(t);return Jl(r,e.node(t)),r}function gt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function an(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(gt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)gt(s.child(l),r);e&&e.depth==t&&e.textOffset&&gt(e.nodeBefore,r)}function yt(n,e){return n.type.checkContent(e),n.copy(e)}function Gl(n,e,t,r,s){let i=n.depth>s&&Ls(n,e,s+1),o=r.depth>s&&Ls(t,r,s+1),l=[];return an(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jl(i,o),gt(yt(i,Gl(n,e,t,r,s+1)),l)):(i&&gt(yt(i,er(n,e,s+1)),l),an(e,t,s,l),o&&gt(yt(o,er(t,r,s+1)),l)),an(r,null,s,l),new k(l)}function er(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let s=Ls(n,e,t+1);gt(yt(s,er(n,e,t+1)),r)}return an(e,null,t,r),new k(r)}function Yu(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class kn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return z.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new tr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new kn(t,r,i)}static resolveCached(e,t){let r=so.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else so.set(e,r=new Xu);let s=r.elts[r.i]=kn.resolve(e,t);return r.i=(r.i+1)%Qu,s}}class Xu{constructor(){this.elts=[],this.i=0}}const Qu=12,so=new WeakMap;class tr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Zu=Object.create(null);class Ee{constructor(e,t,r,s=z.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Qn(this.attrs,t||e.defaultAttrs||Zu)&&z.sameSet(this.marks,r||z.none)}copy(e=null){return e==this.content?this:new Ee(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ee(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return v.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new v(c,s.depth-o,i.depth-o)}replace(e,t,r){return Gu(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return kn.resolveCached(this,e)}resolveNoCache(e){return kn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Yl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=z.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!z.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Ee.prototype.text=void 0;class nr extends Ee{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new nr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new nr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Yl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class wt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new ed(e,t);if(r.next==null)return wt.empty;let s=Xl(r);r.next&&r.err("Unexpected trailing text");let i=ld(od(s));return ad(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
1
+ import{r as w,dE as $l,bF as ju,j as O,aU as Hu,b5 as St,dF as Wu,a7 as it,a8 as Qe,bk as On,bh as Uu,bi as qu,bx as Mt,dy as Fl,ag as _l,bg as Ku,ad as ut,e as Vl,c as jl}from"./index-BfzqpoYd.js";import{e as Ju}from"./select-DpYu937I.js";function Q(n){this.content=n}Q.prototype={constructor:Q,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Q(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Q(t)},addToStart:function(n,e){return new Q([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Q(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Q(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Q.from(n),n.size?new Q(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Q.from(n),n.size?new Q(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Q.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Q.from=function(n){if(n instanceof Q)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Q(e)};function Hl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Hl(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wl(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wl(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Hl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wl(this,e,t,r)}findIndex(e){if(e==0)return Ln(0,e);if(e==this.size)return Ln(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Ln(t+1,i):Ln(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const ls={index:0,offset:0};function Ln(n,e){return ls.index=n,ls.offset=e,ls}function Qn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Qn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Qn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let z=class Ps{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ps.none;if(e instanceof Ps)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};z.none=[];class Zn extends Error{}class v{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ql(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Ul(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return v.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new v(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new v(e,r,s)}}v.empty=new v(k.empty,0,0);function Ul(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Ul(i.content,e-s-1,t-s-1)))}function ql(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=ql(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Gu(n,e,t){if(t.openStart>n.depth)throw new Zn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Zn("Inconsistent open depths");return Kl(n,e,t,0)}function Kl(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kl(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return yt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Yu(t,n);return yt(i,Gl(n,o,l,e,r))}else return yt(i,er(n,e,r))}function Jl(n,e){if(!e.type.compatibleContent(n.type))throw new Zn("Cannot join "+e.type.name+" onto "+n.type.name)}function Ls(n,e,t){let r=n.node(t);return Jl(r,e.node(t)),r}function gt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function an(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(gt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)gt(s.child(l),r);e&&e.depth==t&&e.textOffset&&gt(e.nodeBefore,r)}function yt(n,e){return n.type.checkContent(e),n.copy(e)}function Gl(n,e,t,r,s){let i=n.depth>s&&Ls(n,e,s+1),o=r.depth>s&&Ls(t,r,s+1),l=[];return an(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jl(i,o),gt(yt(i,Gl(n,e,t,r,s+1)),l)):(i&&gt(yt(i,er(n,e,s+1)),l),an(e,t,s,l),o&&gt(yt(o,er(t,r,s+1)),l)),an(r,null,s,l),new k(l)}function er(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let s=Ls(n,e,t+1);gt(yt(s,er(n,e,t+1)),r)}return an(e,null,t,r),new k(r)}function Yu(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class kn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return z.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new tr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new kn(t,r,i)}static resolveCached(e,t){let r=so.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else so.set(e,r=new Xu);let s=r.elts[r.i]=kn.resolve(e,t);return r.i=(r.i+1)%Qu,s}}class Xu{constructor(){this.elts=[],this.i=0}}const Qu=12,so=new WeakMap;class tr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Zu=Object.create(null);class Ee{constructor(e,t,r,s=z.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Qn(this.attrs,t||e.defaultAttrs||Zu)&&z.sameSet(this.marks,r||z.none)}copy(e=null){return e==this.content?this:new Ee(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ee(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return v.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new v(c,s.depth-o,i.depth-o)}replace(e,t,r){return Gu(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return kn.resolveCached(this,e)}resolveNoCache(e){return kn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Yl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=z.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!z.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Ee.prototype.text=void 0;class nr extends Ee{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new nr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new nr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Yl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class wt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new ed(e,t);if(r.next==null)return wt.empty;let s=Xl(r);r.next&&r.err("Unexpected trailing text");let i=ld(od(s));return ad(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
2
2
  `)}}wt.empty=new wt(!0);class ed{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Xl(n){let e=[];do e.push(td(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function td(n){let e=[];do e.push(nd(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function nd(n){let e=id(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=rd(n,e);else break;return e}function io(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function rd(n,e){let t=io(n),r=t;return n.eat(",")&&(n.next!="}"?r=io(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function sd(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function id(n){if(n.eat("(")){let e=Xl(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=sd(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function od(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Ql(n,e){return e-n}function oo(n,e){let t=[];return r(e),t.sort(Ql);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function ld(n){let e=Object.create(null);return t(oo(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);oo(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new wt(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Ql);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function ad(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Zl(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function ea(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function ta(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function na(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ud(n,r,e[r]);return t}let lo=class ra{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=na(e,r.attrs),this.defaultAttrs=Zl(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==wt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ea(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ee(this,this.computeAttrs(e),k.from(t),z.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new Ee(this,this.computeAttrs(e),t,z.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(k.empty,!0);return i?new Ee(this,e,t.append(i),z.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ta(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:z.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ra(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function cd(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class ud{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?cd(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class jr{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=na(e,s.attrs),this.excluded=null;let i=Zl(this.attrs);this.instance=i?new z(this,i):null}create(e=null){return!e&&this.instance?this.instance:new z(this,ea(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new jr(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ta(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class sa{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Q.from(e.nodes),t.marks=Q.from(e.marks||{}),this.nodes=lo.compile(this.spec.nodes,this),this.marks=jr.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=wt.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?ao(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:ao(this,o.split(" "))}this.nodeFromJSON=s=>Ee.fromJSON(this,s),this.markFromJSON=s=>z.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof lo){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new nr(r,r.defaultAttrs,e,z.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ao(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function dd(n){return n.tag!=null}function fd(n){return n.style!=null}class Ze{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(dd(s))this.tags.push(s);else if(fd(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new uo(this,t,!1);return r.addAll(e,z.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new uo(this,t,!0);return r.addAll(e,z.none,t.from,t.to),v.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(md(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=fo(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=fo(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ze(e,Ze.schemaRules(e)))}}const ia={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},hd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oa={ol:!0,ul:!0},xn=1,Bs=2,cn=4;function co(n,e,t){return e!=null?(e?xn:0)|(e==="full"?Bs:0):n&&n.whitespace=="pre"?xn|Bs:t&~cn}class Bn{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=z.none,this.match=i||(o&cn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&xn)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ia.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class uo{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=co(null,t.preserveWhitespace,0)|(r?cn:0);s?i=new Bn(s.type,s.attrs,z.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Bn(null,null,z.none,!0,null,o):i=new Bn(e.schema.topNodeType,null,z.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Bs?"full":this.localPreserveWS||(s.options&xn)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;oa.hasOwnProperty(o)&&this.parser.normalizeLists&&pd(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:hd.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(ia.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=z.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):ho(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=co(e,i,o.options);o.options&cn&&o.content.length==0&&(l|=cn);let a=z.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):ho(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Bn(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=xn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function pd(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&oa.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function md(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function fo(n){let e={};for(let t in n)e[t]=n[t];return e}function ho(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class At{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=as(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Kn(as(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Kn(as(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Kn(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new At(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=po(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return po(e.marks)}}function po(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function as(n){return n.document||window.document}const mo=new WeakMap;function gd(n){let e=mo.get(n);return e===void 0&&mo.set(n,e=yd(n)),e}function yd(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Kn(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=gd(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Kn(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const la=65535,aa=Math.pow(2,16);function bd(n,e){return n+e*aa}function go(n){return n&la}function kd(n){return(n-(n&la))/aa}const ca=1,ua=2,Jn=4,da=8;class zs{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&da)>0}get deletedBefore(){return(this.delInfo&(ca|Jn))>0}get deletedAfter(){return(this.delInfo&(ua|Jn))>0}get deletedAcross(){return(this.delInfo&Jn)>0}}class fe{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&fe.empty)return fe.empty}recover(e){let t=0,r=go(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+kd(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:bd(l/3,e-a),m=e==a?ua:e==d?ca:Jn;return(t<0?e!=a:e!=d)&&(m|=da),new zs(h,m,p)}s+=u-c}return r?e+s:new zs(e+s,0,null)}touches(e,t){let r=0,s=go(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new fe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?fe.empty:new fe(e<0?[0,-e,0]:[0,0,e])}}fe.empty=new fe([]);class Sn{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Sn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new Sn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new zs(e,s,null)}}const cs=Object.create(null);class se{getMap(){return fe.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=cs[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in cs)throw new RangeError("Duplicate use of step JSON ID "+e);return cs[e]=t,t.prototype.jsonID=e,t}}class q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new q(e,null)}static fail(e){return new q(null,e)}static fromReplace(e,t,r,s){try{return q.ok(e.replace(t,r,s))}catch(i){if(i instanceof Zn)return q.fail(i.message);throw i}}}function di(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(di(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return k.fromArray(r)}class Ge extends se{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new v(di(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,i)}invert(){return new ve(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ge(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ge(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ge(t.from,t.to,e.markFromJSON(t.mark))}}se.jsonID("addMark",Ge);class ve extends se{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new v(di(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,r)}invert(){return new Ge(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ve(t.pos,r.pos,this.mark)}merge(e){return e instanceof ve&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ve(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ve(t.from,t.to,e.markFromJSON(t.mark))}}se.jsonID("removeMark",ve);class Ye extends se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new v(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Ye(this.pos,t.marks[s]);return new Ye(this.pos,this.mark)}}return new Ct(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ye(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ye(t.pos,e.markFromJSON(t.mark))}}se.jsonID("addNodeMark",Ye);class Ct extends se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new v(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ye(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ct(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ct(t.pos,e.markFromJSON(t.mark))}}se.jsonID("removeNodeMark",Ct);class U extends se{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&$s(e,this.from,this.to)?q.fail("Structure replace would overwrite content"):q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fe([this.from,this.to-this.from,this.slice.size])}invert(e){return new U(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&U.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new U(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof U)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?v.empty:new v(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new U(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?v.empty:new v(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new U(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new U(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}U.MAP_BIAS=1;se.jsonID("replace",U);class Y extends se{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&($s(e,this.from,this.gapFrom)||$s(e,this.gapTo,this.to)))return q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?q.fromReplace(e,this.from,this.to,r):q.fail("Content does not fit in gap")}getMap(){return new fe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Y(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new Y(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Y(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}se.jsonID("replaceAround",Y);function $s(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function xd(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:s.push(o=new ve(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Ge(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function Sd(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof jr){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==i-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new ve(o.from,o.to,o.style)))}function fi(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new U(l,u,v.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ve(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new v(k.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new U(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(k.empty,!0);n.replace(l,l,new v(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function wd(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Yt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!wd(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function Cd(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=k.empty,d=0;for(let p=i,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=k.from(r.node(p).copy(u)),d++):a--;let f=k.empty,h=0;for(let p=i,m=!1;p>t;p--)m||s.after(p+1)<s.end(p)?(m=!0,f=k.from(s.node(p).copy(f)),h++):c++;n.step(new Y(a,c,o,l,new v(u.append(f),d,h),u.size-d,!0))}function hi(n,e,t=null,r=n){let s=vd(n,e),i=s&&Ed(r,e);return i?s.map(yo).concat({type:e,attrs:t}).concat(i.map(yo)):null}function yo(n){return{type:n,attrs:null}}function vd(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function Ed(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function Td(n,e,t){let r=k.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new Y(s,i,s,i,new v(r,0,0),t.length,!0))}function Md(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&Ad(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&ha(n,o,l,i),fi(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new Y(d,f,d+1,f-1,new v(k.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&fa(n,o,l,i),!1}})}function fa(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function ha(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -1 +1 @@
1
- import{e as b,c as w,j as a,l as j}from"./index-Bo3JNDr-.js";import{i as N}from"./SearchMd-Dki_7scv.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
1
+ import{e as b,c as w,j as a,l as j}from"./index-BfzqpoYd.js";import{i as N}from"./SearchMd-z6b-QOmX.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
@@ -0,0 +1 @@
1
+ import{e as f,j as t,E as P,r as j,F as w,B as S,o as y}from"./index-BfzqpoYd.js";import{i as k}from"./AlertCircle-B-p2hhbf.js";import{s as z}from"./Plus-gXoAw_mX.js";import{s as F}from"./User01-JR_76gHl.js";import{t as E}from"./Users01-BM2QLqUJ.js";import{D as $,a as I,b as O,c as A,e as R,d as T}from"./dialog-nXKceTRB.js";import{I as N}from"./input-BGQcwAaL.js";import{L as g}from"./label-zIig0cjv.js";import{d as B,S as V,a as L,b as q,c as C}from"./select-DpYu937I.js";import{S as H}from"./skeleton-thGJKlMg.js";import{T as K}from"./textarea-Bo_ElpPh.js";import{P as b}from"./index-CVPVNlMM.js";import{c as W}from"./settings-section-pgSq0Nbi.js";import{u as Y,a as G}from"./use-secrets-DEcBibJG.js";import{R as J}from"./require-capability-Bi88Fg3q.js";import"./X-DCWlm9Ta.js";import"./tooltip-CC_mfaKY.js";import"./Check-CSixRgqh.js";import"./ChevronDown-BptXi8Ef.js";import"./ChevronUp-DChs66VU.js";import"./sidebar-B3S1MC-b.js";import"./LayoutLeft-6fPyjOVd.js";import"./sheet-y2Nja_Ue.js";import"./card-CeH_PUFE.js";import"./ArrowUpRight-Bq-dJGgn.js";import"./use-mcp-client-Brxiewn2.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-capability-aJI8msnV.js";import"./access-gate-DXlQ8iVy.js";import"./capability-load-error-Dn3qy9VI.js";function M(s){const e=f.c(3),{error:r}=s;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(k,{size:16}),e[0]=a):a=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[a,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=f.c(5),{scope:r}=s,a=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==a?(i=t.jsx(a,{size:12}),e[0]=a,e[1]=i):i=e[1];let o;return e[2]!==n||e[3]!==i?(o=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=o):o=e[4],o}function D(s){const e=f.c(20),{secret:r}=s;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=a):a=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let o;e[5]!==n||e[6]!==i?(o=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=o):o=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==o||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[a,t.jsxs("div",{className:"min-w-0",children:[o,d]})]}),e[10]=o,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let c;e[15]!==l?(c=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=c):c=e[16];let x;return e[17]!==u||e[18]!==c?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,c]}),e[17]=u,e[18]=c,e[19]=x):x=e[19],x}function U(s){const e=f.c(5),{onCreate:r}=s;let a,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=a,e[1]=n):(a=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let o;return e[3]!==r?(o=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[a,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=o):o=e[4],o}function _({open:s,onOpenChange:e}){const[r,a]=j.useState("organization"),[n,i]=j.useState(""),[o,d]=j.useState(""),[u,l]=j.useState(""),c=G();function x(){a("organization"),i(""),d(""),l("")}function p(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!o))try{await c.mutateAsync({scope:r,name:n.trim(),value:o,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),p()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):p()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>a(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:o,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:p,disabled:c.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:c.isPending||!n.trim()||!o,children:c.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=f.c(21),e=Y(),[r,a]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>a(!0)}),s[0]=l):l=s[0];let c;return s[1]!==r?(c=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:a})]}),s[1]=r,s[2]=c):c=s[2],c}let n,i,o;if(s[3]!==e){const l=e.filter(se),c=e.filter(te),x=e.length===1?"":"s";let p;s[7]!==e.length||s[8]!==x?(p=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=p):p=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>a(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==p?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[p,m]}),s[12]=p,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,o=c.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:c.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=o}else n=s[4],i=s[5],o=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:a}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==o||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,o,d]}),s[16]=n,s[17]=i,s[18]=o,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=f.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Oe(){const s=f.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Oe as default};