decocms 4.561.0 → 4.562.1

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 (383) hide show
  1. package/dist/client/assets/{AlertCircle-DlXniLTL.js → AlertCircle-Cwj2JDLb.js} +1 -1
  2. package/dist/client/assets/{AreaChart-9TAFJEQT.js → AreaChart-M71cxP0N.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DIqRNJY3.js → ArrowLeft-D6im8CSl.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-Cy-4CLBm.js → ArrowUp-zoWFBt83.js} +1 -1
  5. package/dist/client/assets/{CartesianChart-pC5Ct2Py.js → CartesianChart-CkRq1ukN.js} +1 -1
  6. package/dist/client/assets/{CategoricalChart-ChT3v5_x.js → CategoricalChart-CJyVrm-b.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DdQJ6K1s.js → CheckCircle-Dycaqr3_.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-DJwn4vk3.js → ChevronSelectorVertical-Cq__IjWt.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-0ZUNuXoh.js → ChevronUp-B0uKxpVg.js} +1 -1
  10. package/dist/client/assets/{CreditCard01-BzR1cQHR.js → CreditCard01-CMHPxKus.js} +1 -1
  11. package/dist/client/assets/{Globe04-DgADHmww.js → Globe04-BLpPYUUd.js} +1 -1
  12. package/dist/client/assets/{Key01-BnGTLStV.js → Key01-KS2Cdqso.js} +1 -1
  13. package/dist/client/assets/{LinkBroken01-DuElxfIa.js → LinkBroken01-CFo-1erV.js} +1 -1
  14. package/dist/client/assets/{Minus-DKEGggSd.js → Minus-CR14C6Ew.js} +1 -1
  15. package/dist/client/assets/{Monitor01-RPmPp9yV.js → Monitor01-PjSuNm4O.js} +1 -1
  16. package/dist/client/assets/{Play-CCrxvWEX.js → Play-DAD0wkps.js} +1 -1
  17. package/dist/client/assets/{Plus-Dwl0ymG8.js → Plus-Caq968Zm.js} +1 -1
  18. package/dist/client/assets/{ReferenceLine-DLcYrvmE.js → ReferenceLine-DEAQfOjW.js} +1 -1
  19. package/dist/client/assets/{SearchMd-Cf7uAP7Q.js → SearchMd-BionSqTl.js} +1 -1
  20. package/dist/client/assets/{ShoppingBag01-lKolYH3w.js → ShoppingBag01-DUpALglE.js} +1 -1
  21. package/dist/client/assets/{Sun-CLH4DOsz.js → Sun-x19ShBxe.js} +1 -1
  22. package/dist/client/assets/{SwitchHorizontal01-AyEyHl5j.js → SwitchHorizontal01-Dghq_Bvd.js} +1 -1
  23. package/dist/client/assets/{Tool01-D54u8MkG.js → Tool01-GdBdG6P_.js} +1 -1
  24. package/dist/client/assets/{Tooltip-CDBpzwgt.js → Tooltip-CDDThlKy.js} +1 -1
  25. package/dist/client/assets/{Trash01-CLcCE4W6.js → Trash01-DhMVlpac.js} +1 -1
  26. package/dist/client/assets/{Upload01-CQ4MgovG.js → Upload01-hsehoAUh.js} +1 -1
  27. package/dist/client/assets/{UserSquare-DorunsHP.js → UserSquare-T5uOviXx.js} +1 -1
  28. package/dist/client/assets/{Users01-mVHDEY41.js → Users01-DDaeVlhF.js} +1 -1
  29. package/dist/client/assets/{XClose-DJErxj2G.js → XClose-NmocES7U.js} +1 -1
  30. package/dist/client/assets/{Zap-C1zrSwKR.js → Zap-aTbgq59l.js} +1 -1
  31. package/dist/client/assets/{access-gate-C2fRlAo_.js → access-gate-CpAtBb_h.js} +1 -1
  32. package/dist/client/assets/{add-connection-dialog-vc7esFXt.js → add-connection-dialog-BFqv_pWT.js} +1 -1
  33. package/dist/client/assets/agent-app-ZW_Vm-c7.js +1 -0
  34. package/dist/client/assets/{agent-assets-7ydz3P8Q.js → agent-assets-kQe7VufN.js} +1 -1
  35. package/dist/client/assets/{agent-automation-BU4egU3g.js → agent-automation-7-KjK-1c.js} +1 -1
  36. package/dist/client/assets/{agent-automations-LhCkKpX3.js → agent-automations-DnNwxwTt.js} +1 -1
  37. package/dist/client/assets/agent-calendar-CbAiDaBT.js +1 -0
  38. package/dist/client/assets/{agent-capabilities-C_fHyyST.js → agent-capabilities-DKq2l6j_.js} +1 -1
  39. package/dist/client/assets/{agent-connect-sources-B6vNvPYt.js → agent-connect-sources-SuTyB8Qe.js} +1 -1
  40. package/dist/client/assets/agent-deck-8VVMhl7J.js +1 -0
  41. package/dist/client/assets/{agent-e2e-Bqq8mI7x.js → agent-e2e-C9FJgu1a.js} +1 -1
  42. package/dist/client/assets/{agent-file-Bi75RtUP.js → agent-file-D5ZobkO7.js} +1 -1
  43. package/dist/client/assets/{agent-hosting-BoJ7XB5h.js → agent-hosting-Df5G-pNf.js} +1 -1
  44. package/dist/client/assets/{agent-icon-qder0a6G.js → agent-icon-DD6O0sln.js} +1 -1
  45. package/dist/client/assets/agent-library-C_HTRhOS.js +1 -0
  46. package/dist/client/assets/agent-library-file-8gKy0Im-.js +1 -0
  47. package/dist/client/assets/agent-overview-CSsPaJjm.js +1 -0
  48. package/dist/client/assets/{agent-releases-Bd2Tpw8T.js → agent-releases-6IDVzk1I.js} +1 -1
  49. package/dist/client/assets/agent-settings-uWS3yWiw.js +1 -0
  50. package/dist/client/assets/{agent-site-editor-CDMr8brx.js → agent-site-editor-YGSo4JHf.js} +1 -1
  51. package/dist/client/assets/agent-site-editor-code-wtgSW_Bw.js +2 -0
  52. package/dist/client/assets/agent-site-editor-content-BC5jgNMj.js +1 -0
  53. package/dist/client/assets/agent-site-editor-preview-Dd0H-yKP.js +1 -0
  54. package/dist/client/assets/agent-view-C4jCWfsN.js +1 -0
  55. package/dist/client/assets/{agent-view-guard-PjkyYQIO.js → agent-view-guard-Ud9RVhUT.js} +1 -1
  56. package/dist/client/assets/{ai-providers-dLqMBFxg.js → ai-providers-CdWvTe6E.js} +1 -1
  57. package/dist/client/assets/{alert-CngVua4h.js → alert-rSlkmSpl.js} +1 -1
  58. package/dist/client/assets/{analytics-sections-B89f2wMG.js → analytics-sections-CdJGMHGj.js} +1 -1
  59. package/dist/client/assets/{api-keys-Dw9LLspW.js → api-keys-CgV7T2W3.js} +1 -1
  60. package/dist/client/assets/api-keys-CmWPTVBS.js +1 -0
  61. package/dist/client/assets/{app-editor-DjCF4o53.js → app-editor-DQrUb2qq.js} +1 -1
  62. package/dist/client/assets/{asset-utils-uyXmTXD2.js → asset-utils-DJaTbmOK.js} +1 -1
  63. package/dist/client/assets/{auth-DXM0rgLv.js → auth-Dfx2bf9S.js} +1 -1
  64. package/dist/client/assets/{auth-catchall-D6YH9v93.js → auth-catchall-BzI646tE.js} +1 -1
  65. package/dist/client/assets/{auth-entry-n3NnpIVo.js → auth-entry-BA2dv7O1.js} +1 -1
  66. package/dist/client/assets/{auth-split-layout-CabbHOl5.js → auth-split-layout-3t1_TKos.js} +1 -1
  67. package/dist/client/assets/{authenticate-and-persist-oauth-C_fCYd84.js → authenticate-and-persist-oauth-EuyAX3Gy.js} +1 -1
  68. package/dist/client/assets/{automation-list-row-BE7Mtfuu.js → automation-list-row-BK5XD6ZY.js} +1 -1
  69. package/dist/client/assets/{automation-runs-C__qlbXc.js → automation-runs-BekfbsHI.js} +1 -1
  70. package/dist/client/assets/{automations-BAFxOc2Y.js → automations-ocOVuWpR.js} +1 -1
  71. package/dist/client/assets/{autosend-BuzWxJ_9.js → autosend-BLYIlkXq.js} +1 -1
  72. package/dist/client/assets/{badge-CM9VoPn3.js → badge-9UZ-oy57.js} +1 -1
  73. package/dist/client/assets/{block-document-BlNqArtF.js → block-document-B5Xpou_B.js} +1 -1
  74. package/dist/client/assets/{blocks-preview-workspace-context-cN8B_PL1.js → blocks-preview-workspace-context-CGoI0EUn.js} +1 -1
  75. package/dist/client/assets/{blocks-tab-states-DhWZqku3.js → blocks-tab-states-CNkB95lx.js} +1 -1
  76. package/dist/client/assets/{blog-schema-CWB6DzeS.js → blog-schema-DMB79fe6.js} +1 -1
  77. package/dist/client/assets/{buckets-CtjG5O0U.js → buckets-C5e8GKB5.js} +1 -1
  78. package/dist/client/assets/{build-improve-prompt-doc-BscLA4ml.js → build-improve-prompt-doc-aExDV9Mz.js} +1 -1
  79. package/dist/client/assets/{calendar-ng2FQ19x.js → calendar-CKcdkgh5.js} +1 -1
  80. package/dist/client/assets/{capability-load-error-BlktRdv_.js → capability-load-error-D8AT7eAw.js} +1 -1
  81. package/dist/client/assets/{category-editor-BaahwiYp.js → category-editor-DDFXYf_d.js} +1 -1
  82. package/dist/client/assets/{chart-BWR8wMN7.js → chart-Ch4wXn1G.js} +1 -1
  83. package/dist/client/assets/{chat-context-CbLWEfcx.js → chat-context-tsaqCp6v.js} +1 -1
  84. package/dist/client/assets/{chat-draft-CqQowXE0.js → chat-draft-DeOYn8wH.js} +1 -1
  85. package/dist/client/assets/{checkbox-CLe06xtZ.js → checkbox-bO8ZnM7n.js} +1 -1
  86. package/dist/client/assets/{choose-editor-CNAJrAnR.js → choose-editor-B-1DX2pl.js} +1 -1
  87. package/dist/client/assets/{cli-auth-success-D6HLf98p.js → cli-auth-success-WUcj8Laj.js} +1 -1
  88. package/dist/client/assets/{client-icons-DYF7aeKo.js → client-icons-CJKwmsS5.js} +1 -1
  89. package/dist/client/assets/{cms-settings-editor-CBbwxc0o.js → cms-settings-editor-CL1HXF3j.js} +1 -1
  90. package/dist/client/assets/cms-store-drafts-C_ZG08jQ.js +1 -0
  91. package/dist/client/assets/{collapsible-t9cEILA0.js → collapsible-CehJ-xlR.js} +1 -1
  92. package/dist/client/assets/{collection-detail-ByZqmhXB.js → collection-detail-w7NYTWNb.js} +1 -1
  93. package/dist/client/assets/{collection-display-button-B7jvkHFb.js → collection-display-button-CVOVdzmi.js} +1 -1
  94. package/dist/client/assets/{collection-search-DVuo1pjJ.js → collection-search-Lm88VC-w.js} +1 -1
  95. package/dist/client/assets/{collection-table-wrapper-Cy5iDhCR.js → collection-table-wrapper-LUTykEyP.js} +1 -1
  96. package/dist/client/assets/{collection-tabs-DJVITgIT.js → collection-tabs-BW9NTpao.js} +1 -1
  97. package/dist/client/assets/{combobox-MSjb-buw.js → combobox-C8IS_aP5.js} +1 -1
  98. package/dist/client/assets/{command-3SMlch0Q.js → command-B42vqDSm.js} +1 -1
  99. package/dist/client/assets/{companion-mcps-section-be246Qaj.js → companion-mcps-section-gN7svOR8.js} +1 -1
  100. package/dist/client/assets/{config-DtxU1wmQ.js → config--cZAprAj.js} +1 -1
  101. package/dist/client/assets/{connect-e7sohufh.js → connect-BAZtz6qy.js} +1 -1
  102. package/dist/client/assets/{connect-layout-CYf0yreo.js → connect-layout-FGHNVpHc.js} +1 -1
  103. package/dist/client/assets/{connect-source-dialog-BT6gBx-j.js → connect-source-dialog-BlacChCY.js} +1 -1
  104. package/dist/client/assets/{connection-Bu1PnSek.js → connection-Brtus8mh.js} +1 -1
  105. package/dist/client/assets/{connection-card-twsNz0iZ.js → connection-card-CSkWTxJN.js} +1 -1
  106. package/dist/client/assets/{connection-detail-DzTu69ud.js → connection-detail-Dz92Js40.js} +1 -1
  107. package/dist/client/assets/{connection-form-helpers-B0xDJFtW.js → connection-form-helpers-CQaJSXmJ.js} +1 -1
  108. package/dist/client/assets/{connection-slug-CfDtYvgF.js → connection-slug-DREkgXeA.js} +1 -1
  109. package/dist/client/assets/{connections-DLef9v48.js → connections-BZUJ_roU.js} +1 -1
  110. package/dist/client/assets/{content-tab-BBa6VyOA.js → content-tab-Bc_Tg1a4.js} +3 -3
  111. package/dist/client/assets/{context-CUfU0IjI.js → context-2NK4t-Lg.js} +1 -1
  112. package/dist/client/assets/{context-menu-BsNBSqQT.js → context-menu-D-JkcRvL.js} +1 -1
  113. package/dist/client/assets/{context-shell-D4IkyI4F.js → context-shell-Bwve3xDx.js} +3 -3
  114. package/dist/client/assets/{core.esm-BWCUlskR.js → core.esm-ByTukYOF.js} +1 -1
  115. package/dist/client/assets/{create-organization-dialog-C-miI-DE.js → create-organization-dialog-BIe1f-Sz.js} +1 -1
  116. package/dist/client/assets/{device-hint-BAl-Wimj.js → device-hint-Djy4F7LR.js} +1 -1
  117. package/dist/client/assets/{discover-BkKaKiee.js → discover-D050EtE3.js} +1 -1
  118. package/dist/client/assets/{domain-settings-m3KQ6IUr.js → domain-settings-DPbJEdjs.js} +1 -1
  119. package/dist/client/assets/{drawer-D47Dw-K5.js → drawer-Dijofbhl.js} +1 -1
  120. package/dist/client/assets/{editor-BWpbvGUJ.js → editor-BODVgWYK.js} +1 -1
  121. package/dist/client/assets/{editor-classes-J2Hl0Yqy.js → editor-classes-BdpfcKyR.js} +1 -1
  122. package/dist/client/assets/{empty-state-CibwE54W.js → empty-state-CwfRxt_B.js} +1 -1
  123. package/dist/client/assets/{empty-state-Z2OuiQOQ.js → empty-state-Drt9QRbX.js} +1 -1
  124. package/dist/client/assets/{extract-connection-data-CY3M43Pj.js → extract-connection-data-Pe-Tip3g.js} +1 -1
  125. package/dist/client/assets/{feature-gate-DIw-mvZ7.js → feature-gate-2Z3FyCIy.js} +1 -1
  126. package/dist/client/assets/{feature-paywall-CFzfdEnd.js → feature-paywall-CpM-erQe.js} +1 -1
  127. package/dist/client/assets/{feedback-ACIX3HAK.js → feedback-DcWPFhR_.js} +1 -1
  128. package/dist/client/assets/{file-explorer-imOCcEy6.js → file-explorer-xWdf34ip.js} +1 -1
  129. package/dist/client/assets/{file-preview-DrvqFq0i.js → file-preview-Ca_4k6rv.js} +1 -1
  130. package/dist/client/assets/{file-share-button-Ck8dYa4c.js → file-share-button-DgOCZ5mM.js} +1 -1
  131. package/dist/client/assets/{file-type-icon-CpyvcXG2.js → file-type-icon-DiS0iV28.js} +1 -1
  132. package/dist/client/assets/{folder-icon-D2Q0oygq.js → folder-icon-swAD3bQU.js} +1 -1
  133. package/dist/client/assets/{form-Di6X4re-.js → form-CRja9i9j.js} +1 -1
  134. package/dist/client/assets/{general-B7NplQZY.js → general-C7SfdAAF.js} +1 -1
  135. package/dist/client/assets/{github-icon-CgGTVNey.js → github-icon-tpEVyIwD.js} +1 -1
  136. package/dist/client/assets/{home-jKie_yX3.js → home-DsrjQvGT.js} +1 -1
  137. package/dist/client/assets/{home-overview-B95RCjGn.js → home-overview-CMI03yPH.js} +1 -1
  138. package/dist/client/assets/{hosted-reconcile-DTemoIcy.js → hosted-reconcile-BnVn2LVL.js} +1 -1
  139. package/dist/client/assets/{icon-button-DNR19rRF.js → icon-button-BZ9f2Pt9.js} +1 -1
  140. package/dist/client/assets/{index-DmZ8PTrQ.js → index-68Cr2r1N.js} +1 -1
  141. package/dist/client/assets/{index-CDR02Ldc.js → index-B8Pa92mK.js} +1 -1
  142. package/dist/client/assets/{index-CAJzXKA5.js → index-BGom2FnM.js} +1 -1
  143. package/dist/client/assets/{index-DjbHauib.js → index-BW7-bbk0.js} +1 -1
  144. package/dist/client/assets/{index-C1J7wkkB.js → index-C2wTYLQr.js} +1 -1
  145. package/dist/client/assets/{index-wHHWd0G4.js → index-CZXPJi4-.js} +1 -1
  146. package/dist/client/assets/{index-KR4p316Z.js → index-CbuCRTrW.js} +1 -1
  147. package/dist/client/assets/{index-B80PkxJB.js → index-CcZq_9Fb.js} +1 -1
  148. package/dist/client/assets/{index-CoIqGnkT.js → index-Cvc22Qvh.js} +6 -6
  149. package/dist/client/assets/{index-RA-jAYZL.js → index-D-DRzVEB.js} +1 -1
  150. package/dist/client/assets/{index-NrdVW9bX.js → index-D0G5dFqT.js} +1 -1
  151. package/dist/client/assets/{index-Czbh2wlZ.js → index-DQAtcq3Z.js} +1 -1
  152. package/dist/client/assets/{index-CDNgDa9K.js → index-Dt7ZIwRY.js} +1 -1
  153. package/dist/client/assets/{index-C3pJvzEE.js → index-Dw1u8oXT.js} +1 -1
  154. package/dist/client/assets/{index-DQFlQUCO.js → index-LnWr599j.js} +1 -1
  155. package/dist/client/assets/{index-Z0F9sezb.js → index-Z8XjhDCo.js} +1 -1
  156. package/dist/client/assets/{index-redirect-DB9ebXs9.js → index-redirect-PbFd_QHU.js} +1 -1
  157. package/dist/client/assets/{infiniteQueryObserver-DAKXTyVS.js → infiniteQueryObserver-CmujZk55.js} +1 -1
  158. package/dist/client/assets/{infra-billing-Dn3vHYmi.js → infra-billing-BlZrBUYP.js} +1 -1
  159. package/dist/client/assets/{input-oiyfOdq_.js → input-C7_FCkgY.js} +3 -3
  160. package/dist/client/assets/{input-8jGMlXl7.js → input-D6ZRMHIB.js} +1 -1
  161. package/dist/client/assets/{integration-icon-DwBMZgrw.js → integration-icon-DMt85Vdd.js} +1 -1
  162. package/dist/client/assets/{jira-icon-IS61wuXe.js → jira-icon-C0C7R9Uf.js} +1 -1
  163. package/dist/client/assets/{label-Cz3ISXTG.js → label-RB5C5N6z.js} +1 -1
  164. package/dist/client/assets/{layout-CqB0N585.js → layout-CBfnb3CZ.js} +1 -1
  165. package/dist/client/assets/{legacy-agents-deep-CEAUs1Ab.js → legacy-agents-deep-zWqSTSjP.js} +1 -1
  166. package/dist/client/assets/{legacy-main-redirect-ByWdLVJx.js → legacy-main-redirect-BZlpoESe.js} +1 -1
  167. package/dist/client/assets/library-pMQg4GCR.js +1 -0
  168. package/dist/client/assets/{library-tab-BAPbFjTT.js → library-tab-C7gKe5iN.js} +1 -1
  169. package/dist/client/assets/{login-yJ2gJF93.js → login-D9zRzHBo.js} +1 -1
  170. package/dist/client/assets/{markdown-BzJtnofQ.js → markdown-HhU9_nSI.js} +1 -1
  171. package/dist/client/assets/{mcp-app-renderer-BrjPpO12.js → mcp-app-renderer-DeLjk14w.js} +1 -1
  172. package/dist/client/assets/{mcp-oauth-DseEuoup.js → mcp-oauth-C-i6IZ7F.js} +1 -1
  173. package/dist/client/assets/{mcp-oauth-O8kCHxpg.js → mcp-oauth-DLwsgkOm.js} +1 -1
  174. package/dist/client/assets/{members-3k5dxXet.js → members-DocomT72.js} +1 -1
  175. package/dist/client/assets/{memory-BamorpT0.js → memory-BP3-K3oo.js} +1 -1
  176. package/dist/client/assets/{mock-board-scAFzBl7.js → mock-board-CoWf0eSd.js} +3 -3
  177. package/dist/client/assets/{monaco-editor-DOFMDCyC.js → monaco-editor-oUmtqDLR.js} +1 -1
  178. package/dist/client/assets/{monitoring-DjJ3TtUM.js → monitoring-DKfNSCeR.js} +1 -1
  179. package/dist/client/assets/{monitoring-stats-row-BUfFJFpo.js → monitoring-stats-row-XSvwSWAi.js} +1 -1
  180. package/dist/client/assets/{multi-select-DfedcXqi.js → multi-select-CISJC82c.js} +1 -1
  181. package/dist/client/assets/{mustache-C2jWivSN.js → mustache-D4zVU9iA.js} +1 -1
  182. package/dist/client/assets/{named-rule-view-BKpXrbcs.js → named-rule-view-BTwHmZ5L.js} +1 -1
  183. package/dist/client/assets/{new-project-dialog-CYkZ_7Mu.js → new-project-dialog-BA0jmhgS.js} +1 -1
  184. package/dist/client/assets/{oauth-callback-YciRSKJB.js → oauth-callback-C1NevZMJ.js} +1 -1
  185. package/dist/client/assets/{oauth-callback-ai-provider-C-QzMEVu.js → oauth-callback-ai-provider-BJwoy8qA.js} +1 -1
  186. package/dist/client/assets/{oauth-consent-X72D0Xq8.js → oauth-consent-BTT41r6l.js} +1 -1
  187. package/dist/client/assets/{onboarding-DLH1z-Ha.js → onboarding-C2uIwwWY.js} +1 -1
  188. package/dist/client/assets/{openai-conversation-DUFicgp3.js → openai-conversation-pUSF1vof.js} +1 -1
  189. package/dist/client/assets/{optimistic-project-sidebar-views-BGyFPmWx.js → optimistic-project-sidebar-views-BnUNFsLR.js} +1 -1
  190. package/dist/client/assets/{order-monitor-day-BEhzJJLC.js → order-monitor-day-BzMajB7Y.js} +1 -1
  191. package/dist/client/assets/{organization-choice-sGtkKPK1.js → organization-choice-5ra3ZqkQ.js} +1 -1
  192. package/dist/client/assets/{orgs-DzNGZq3U.js → orgs-ZeqGcjOU.js} +1 -1
  193. package/dist/client/assets/{own-accounts-section-BpXuuW62.js → own-accounts-section-Dd8ELrvu.js} +1 -1
  194. package/dist/client/assets/{pair-DRdkhABe.js → pair-Bx1LbJmC.js} +1 -1
  195. package/dist/client/assets/{parse-sections-DpGddWrT.js → parse-sections-BTDQNPKy.js} +3 -3
  196. package/dist/client/assets/{plan-Cs7MSJD8.js → plan-bz8_rmrJ.js} +1 -1
  197. package/dist/client/assets/{plan-ladder-D5AQfuNm.js → plan-ladder-CZUMQESY.js} +1 -1
  198. package/dist/client/assets/{plan-usage-card-dKMEumDo.js → plan-usage-card-SygAb3OS.js} +1 -1
  199. package/dist/client/assets/{popover-C20V6lAt.js → popover-D5YX99Kp.js} +1 -1
  200. package/dist/client/assets/{post-calendar-bcG8oRix.js → post-calendar-BIBU13NF.js} +1 -1
  201. package/dist/client/assets/{post-editor-DzpUG7aB.js → post-editor-BAf1z147.js} +1 -1
  202. package/dist/client/assets/{preview-content-RCgFW_sl.js → preview-content-TDEad-bh.js} +1 -1
  203. package/dist/client/assets/{preview-dialog-rActp1mK.js → preview-dialog-BkHpQdXG.js} +1 -1
  204. package/dist/client/assets/{preview-panel-CRI13pwa.js → preview-panel-DduOnxXk.js} +1 -1
  205. package/dist/client/assets/{preview-tab-Cos61Cco.js → preview-tab-Cgfndmyh.js} +3 -3
  206. package/dist/client/assets/{product-picker-dialog-C2osTe5y.js → product-picker-dialog-DDkB9ByB.js} +1 -1
  207. package/dist/client/assets/{profile-CfiCAfn9.js → profile-DHJVxDvo.js} +1 -1
  208. package/dist/client/assets/{project-app-view-8qcY_2-I.js → project-app-view-BfcPf6du.js} +1 -1
  209. package/dist/client/assets/{project-apps-DedVk-Nz.js → project-apps-Bny6_T2A.js} +1 -1
  210. package/dist/client/assets/{project-icon-Uszb7VXV.js → project-icon-eZOGIGwj.js} +1 -1
  211. package/dist/client/assets/{project-index-DxnUyMmA.js → project-index-BSMjLbxc.js} +1 -1
  212. package/dist/client/assets/project-reports-BzA8d8hO.js +1 -0
  213. package/dist/client/assets/{project-sidebar-views-Deemwf6B.js → project-sidebar-views-CrRbPbLq.js} +1 -1
  214. package/dist/client/assets/project-tasks-BCE2SgoF.js +1 -0
  215. package/dist/client/assets/{projects-DgaT7j1o.js → projects-D7HB1QKY.js} +1 -1
  216. package/dist/client/assets/{projects-empty-state-B9m6wSpL.js → projects-empty-state-DBWek16Y.js} +1 -1
  217. package/dist/client/assets/{prompts-DRqjf0OJ.js → prompts-MMmII7eb.js} +1 -1
  218. package/dist/client/assets/record-editor-DVouiUmR.js +1 -0
  219. package/dist/client/assets/{redirect-editor-BlBkzrUB.js → redirect-editor-cm3-huyu.js} +1 -1
  220. package/dist/client/assets/reports-BHAVwnBG.js +1 -0
  221. package/dist/client/assets/{reports-BxHeWjsA.js → reports-D0VzI1C_.js} +1 -1
  222. package/dist/client/assets/{reports-onboarding-BF03h6Lz.js → reports-onboarding-DonafHiF.js} +1 -1
  223. package/dist/client/assets/{reports-tab-C8lpsYgo.js → reports-tab-Wl9IyKm6.js} +2 -2
  224. package/dist/client/assets/{repositories-vjVPQ6I9.js → repositories-9kTJbSW8.js} +1 -1
  225. package/dist/client/assets/repositories-bPxFm30V.js +1 -0
  226. package/dist/client/assets/{repository-binding-CyaIIWjt.js → repository-binding-B7A7NBUB.js} +1 -1
  227. package/dist/client/assets/{repository-picker-ERyaEscX.js → repository-picker-CI7xSsin.js} +1 -1
  228. package/dist/client/assets/{require-capability-DrZOeXFb.js → require-capability-BTBUQsVM.js} +1 -1
  229. package/dist/client/assets/{required-auth-layout-OBk7IzAK.js → required-auth-layout-ClYF4eFR.js} +1 -1
  230. package/dist/client/assets/{reset-password-DDidguVk.js → reset-password-Ah3K7D-l.js} +1 -1
  231. package/dist/client/assets/{resizable-CHAafS5W.js → resizable-DzzgKGKP.js} +1 -1
  232. package/dist/client/assets/{resolve-tab-icon-DwPVAW_f.js → resolve-tab-icon-DMbVCUvi.js} +1 -1
  233. package/dist/client/assets/{review-settings-bYHupYo-.js → review-settings-Fxdols3J.js} +1 -1
  234. package/dist/client/assets/{role-color-BSeNtGi1.js → role-color-CEkb11P4.js} +1 -1
  235. package/dist/client/assets/{roles-BJ9XswSj.js → roles-CqJ0hOtT.js} +1 -1
  236. package/dist/client/assets/route-BA7jjOjA.js +1 -0
  237. package/dist/client/assets/{route-D1kSARK4.js → route-DGCMYgfH.js} +1 -1
  238. package/dist/client/assets/route-DJbiUXJl.js +1 -0
  239. package/dist/client/assets/{sandbox-lifecycle-context-DPyi5-UY.js → sandbox-lifecycle-context-WaQV2LhH.js} +1 -1
  240. package/dist/client/assets/{schema-BR70Vo5Y.js → schema-BH82js-o.js} +1 -1
  241. package/dist/client/assets/{schema-y4LFWED4.js → schema-DHahXPsT.js} +1 -1
  242. package/dist/client/assets/{scroll-area-DbCNV5xq.js → scroll-area-BN87AboJ.js} +1 -1
  243. package/dist/client/assets/{search-input-Bx2x3uO8.js → search-input-BBYghT-z.js} +1 -1
  244. package/dist/client/assets/{search-toggle-NGIVu4q_.js → search-toggle-pLnMgrhP.js} +1 -1
  245. package/dist/client/assets/{secret-picker-DUPig2Xn.js → secret-picker-DWWFQJzg.js} +1 -1
  246. package/dist/client/assets/{secrets-BZFZm3tO.js → secrets-CM4b3_qA.js} +1 -1
  247. package/dist/client/assets/{sections-DP49hK6v.js → sections-CgO1w_IT.js} +1 -1
  248. package/dist/client/assets/{sections-editor-C4o9LGck.js → sections-editor-Uk83RbMN.js} +1 -1
  249. package/dist/client/assets/{select-DR3RwfpI.js → select-GzsOSPza.js} +1 -1
  250. package/dist/client/assets/{select-model-BfVgSLS5.js → select-model-BU2ssn1V.js} +1 -1
  251. package/dist/client/assets/{seo-editor-B0kA-535.js → seo-editor-dMXY0ofk.js} +1 -1
  252. package/dist/client/assets/{separator-DZpsLNey.js → separator-CuwdHpjW.js} +1 -1
  253. package/dist/client/assets/settings-tab-FvtSSyQC.js +1 -0
  254. package/dist/client/assets/{sheet-C0gthVwC.js → sheet-BIQm-3An.js} +1 -1
  255. package/dist/client/assets/{shell-layout-BN9dcRYV.js → shell-layout-CH0j9rog.js} +1 -1
  256. package/dist/client/assets/site-draft-view-C74WkBDm.js +3 -0
  257. package/dist/client/assets/site-editor-CazX9Ijc.js +1 -0
  258. package/dist/client/assets/{site-editor-toast-VaN8V1I2.js → site-editor-toast-DrW9VMK5.js} +1 -1
  259. package/dist/client/assets/{skills-CrNoAgQg.js → skills-C71x-yhC.js} +1 -1
  260. package/dist/client/assets/{slider-C-TEQZK0.js → slider-BTgIuWj6.js} +1 -1
  261. package/dist/client/assets/{sortable.esm-BYS1QaMo.js → sortable.esm-Dd1EVaQb.js} +1 -1
  262. package/dist/client/assets/{sso-BK4lPlbr.js → sso-BfwIPTh8.js} +1 -1
  263. package/dist/client/assets/{suggestion-BGsc91Hz.js → suggestion-CsEyXKDY.js} +1 -1
  264. package/dist/client/assets/{switch-CzTsDB3z.js → switch-BRZA_xq0.js} +1 -1
  265. package/dist/client/assets/{synced-repos-DBjP4HMv.js → synced-repos-Do7bESqI.js} +1 -1
  266. package/dist/client/assets/{tab-icon-glyph-DE2TUhh7.js → tab-icon-glyph-BsVyyg_A.js} +1 -1
  267. package/dist/client/assets/{table-B-mHKzHC.js → table-DJd8n4EY.js} +1 -1
  268. package/dist/client/assets/{tabs-W2tygsn9.js → tabs-D5AMuciq.js} +1 -1
  269. package/dist/client/assets/{task-board-dajPV_XW.js → task-board-DN88kD7h.js} +1 -1
  270. package/dist/client/assets/{task-route-GeZcjNWN.js → task-route-4C0M-4XY.js} +1 -1
  271. package/dist/client/assets/{task-status-TTxT6L0h.js → task-status-B2JNuBbQ.js} +1 -1
  272. package/dist/client/assets/{taskboard-analytics-pPV1Wqb4.js → taskboard-analytics-D_AXxVNg.js} +1 -1
  273. package/dist/client/assets/tasks-BlrmxtrG.js +1 -0
  274. package/dist/client/assets/{tasks-eMCDmtbp.js → tasks-dMEgvkta.js} +1 -1
  275. package/dist/client/assets/{textarea-DH4lLGjS.js → textarea-D7HQlMVo.js} +1 -1
  276. package/dist/client/assets/{thread-analytics-CfsCF0qC.js → thread-analytics-BQjHh_yV.js} +1 -1
  277. package/dist/client/assets/{thread-intent-DsvstIYH.js → thread-intent-Bs-Q7fma.js} +1 -1
  278. package/dist/client/assets/{thread-route-SXxESRM6.js → thread-route-B44higRI.js} +1 -1
  279. package/dist/client/assets/{thread-route-D2x3lEXe.js → thread-route-C-uX4C4C.js} +1 -1
  280. package/dist/client/assets/{thread-sheet-body-DJsgTtYx.js → thread-sheet-body-BNo76_XD.js} +1 -1
  281. package/dist/client/assets/{time-range-picker-CFjr88ku.js → time-range-picker-D4sglVBw.js} +1 -1
  282. package/dist/client/assets/{toggle-group-CtP6sNQ9.js → toggle-group-BBgjmF6C.js} +1 -1
  283. package/dist/client/assets/{tool-namespace-CNnPmHfP.js → tool-namespace-l4eN7YZ5.js} +1 -1
  284. package/dist/client/assets/{tool-set-selector-CnipdprK.js → tool-set-selector-Bi-Sw2KD.js} +1 -1
  285. package/dist/client/assets/{toolbar-icon-button-1M1cEETB.js → toolbar-icon-button-nrUHQe-I.js} +1 -1
  286. package/dist/client/assets/{tooltip-DycNDw2G.js → tooltip-C0GWPsi8.js} +1 -1
  287. package/dist/client/assets/{tooltipContext-BIhnjJZf.js → tooltipContext-DdEokZtY.js} +1 -1
  288. package/dist/client/assets/{track-BCTe4eN0.js → track-29FVOdFL.js} +1 -1
  289. package/dist/client/assets/{types-CUZBmViJ.js → types-DKuFfsqr.js} +1 -1
  290. package/dist/client/assets/{url-slug-DOp56bVw.js → url-slug-5t39ocbn.js} +1 -1
  291. package/dist/client/assets/{usage-stats-DZlhabNT.js → usage-stats-CHeI7dPd.js} +1 -1
  292. package/dist/client/assets/{use-ai-providers-CT41YQMU.js → use-ai-providers-BbVlPdZd.js} +1 -1
  293. package/dist/client/assets/{use-apply-named-rule-BBYkq507.js → use-apply-named-rule-CnOcORn0.js} +1 -1
  294. package/dist/client/assets/use-ask-in-chat-Cp_wqFIx.js +1 -0
  295. package/dist/client/assets/{use-automations-DW8dHpTW.js → use-automations-BoyfX_H0.js} +1 -1
  296. package/dist/client/assets/{use-autosave-Ckpm_M6m.js → use-autosave-CZD-Fkyk.js} +1 -1
  297. package/dist/client/assets/{use-chat-layout-state-PWVkseE_.js → use-chat-layout-state-BC5WrKKn.js} +1 -1
  298. package/dist/client/assets/{use-cms-publish-actions-D2RPgS1y.js → use-cms-publish-actions-BbDVRUuf.js} +1 -1
  299. package/dist/client/assets/{use-connect-companion-AM_jLP9g.js → use-connect-companion-DEAJWvqA.js} +1 -1
  300. package/dist/client/assets/{use-connection-Bc88fzeR.js → use-connection-Dqyf1wn8.js} +1 -1
  301. package/dist/client/assets/{use-content-sync-xOHgSIER.js → use-content-sync-vr73v2b2.js} +1 -1
  302. package/dist/client/assets/{use-copy-BR702L1I.js → use-copy-BGfQrJIh.js} +1 -1
  303. package/dist/client/assets/{use-date-fns-locale-SZQhS1cr.js → use-date-fns-locale-C4jbLuwI.js} +1 -1
  304. package/dist/client/assets/{use-debounced-autosave-DhCDTrxW.js → use-debounced-autosave-BrjHHNNB.js} +1 -1
  305. package/dist/client/assets/{use-debounced-value-DlRWnR28.js → use-debounced-value-BF84eZeF.js} +1 -1
  306. package/dist/client/assets/{use-deco-credits-BmrhY51W.js → use-deco-credits-MCc3vHir.js} +1 -1
  307. package/dist/client/assets/{use-decopilot-events-BHP9on7q.js → use-decopilot-events-uSeDcfUe.js} +1 -1
  308. package/dist/client/assets/{use-delete-connection-a41JhfA0.js → use-delete-connection-CLe-XFxn.js} +1 -1
  309. package/dist/client/assets/{use-deployment-admin-BhTKxM6k.js → use-deployment-admin-ShnoFTNr.js} +1 -1
  310. package/dist/client/assets/{use-entitlements-DU-An4VI.js → use-entitlements-wE65MYfi.js} +1 -1
  311. package/dist/client/assets/{use-fast-preview-draft-url-Bq8X4SK6.js → use-fast-preview-draft-url-BmUgrEyk.js} +1 -1
  312. package/dist/client/assets/{use-file-configs-CGfkm6PJ.js → use-file-configs-D9BR1kJU.js} +1 -1
  313. package/dist/client/assets/{use-id-selection-CMyoYtHh.js → use-id-selection-BcfcmGZl.js} +1 -1
  314. package/dist/client/assets/{use-inbox-feed-B0e0cq4F.js → use-inbox-feed-EYADn16y.js} +1 -1
  315. package/dist/client/assets/{use-infinite-scroll-Camm6qqR.js → use-infinite-scroll-Ds1Wd1cw.js} +1 -1
  316. package/dist/client/assets/{use-join-requests-BIAFYC5s.js → use-join-requests-CkWiAH0i.js} +1 -1
  317. package/dist/client/assets/{use-main-panel-tabs-Be64FM8O.js → use-main-panel-tabs-DTMcBtUc.js} +1 -1
  318. package/dist/client/assets/{use-mcp-auth-status-DBPe1KW6.js → use-mcp-auth-status-DhFx8XVQ.js} +1 -1
  319. package/dist/client/assets/{use-mcp-client-DuvY0YQh.js → use-mcp-client-BfCmeMHR.js} +1 -1
  320. package/dist/client/assets/{use-mcp-prompts-DGMojcFt.js → use-mcp-prompts-DoojBZhS.js} +1 -1
  321. package/dist/client/assets/{use-mcp-tools-Dt1w2efB.js → use-mcp-tools-DwTtnjNb.js} +1 -1
  322. package/dist/client/assets/{use-mobile-CQqLe5Fj.js → use-mobile-C1stVK0E.js} +1 -1
  323. package/dist/client/assets/{use-move-blocks-DavDm8qw.js → use-move-blocks-Bclcq-Qe.js} +1 -1
  324. package/dist/client/assets/{use-navigate-to-agent-BP-fuYpJ.js → use-navigate-to-agent-D2d0cpFU.js} +1 -1
  325. package/dist/client/assets/{use-org-fs-DwzY3jVQ.js → use-org-fs-DHnEDbF9.js} +1 -1
  326. package/dist/client/assets/{use-org-repo-syncs-CtTPlokI.js → use-org-repo-syncs-CcoLGdUP.js} +1 -1
  327. package/dist/client/assets/{use-org-sso-B3MWcxrY.js → use-org-sso-d82WgyRM.js} +1 -1
  328. package/dist/client/assets/{use-organization-settings-CZAS8Fwc.js → use-organization-settings-a6mUKPHv.js} +1 -1
  329. package/dist/client/assets/{use-project-scope-C2qD7yC0.js → use-project-scope-C0EKXyqg.js} +1 -1
  330. package/dist/client/assets/{use-recent-apps-D7w2xW8F.js → use-recent-apps-DEMyNf2W.js} +1 -1
  331. package/dist/client/assets/{use-reports-diagnostic-BH1du4EA.js → use-reports-diagnostic-rjeHGSYu.js} +1 -1
  332. package/dist/client/assets/{use-secrets-Cw3WgXHF.js → use-secrets-CifnNbah.js} +1 -1
  333. package/dist/client/assets/{use-section-preview-base-BHjsGtU7.js → use-section-preview-base-SkN8HQaB.js} +1 -1
  334. package/dist/client/assets/{use-sidebar-collapsed-Cx7HQy1d.js → use-sidebar-collapsed-DwcGl0-e.js} +1 -1
  335. package/dist/client/assets/{use-tags-qkt7D6HU.js → use-tags-CgXVAtG9.js} +1 -1
  336. package/dist/client/assets/{use-task-board-analytics-CBMwXJ9I.js → use-task-board-analytics-BTZNDNnK.js} +1 -1
  337. package/dist/client/assets/{use-task-board-events-B5PJHCY3.js → use-task-board-events-DCguN7A5.js} +1 -1
  338. package/dist/client/assets/{use-task-board-item-prs-CvmHZRRv.js → use-task-board-item-prs-CnqmEndd.js} +1 -1
  339. package/dist/client/assets/{use-task-board-items-e9YgnV6R.js → use-task-board-items-BmpaMZkF.js} +1 -1
  340. package/dist/client/assets/{use-task-board-prompts-jxu88jn3.js → use-task-board-prompts-DdSO4gLi.js} +1 -1
  341. package/dist/client/assets/{use-task-metadata-DmUyAx53.js → use-task-metadata-D3xqf4sH.js} +1 -1
  342. package/dist/client/assets/{use-thread-outputs-DiVqGaU9.js → use-thread-outputs-D6sQTVJo.js} +1 -1
  343. package/dist/client/assets/useInfiniteQuery-P9--kf7E.js +1 -0
  344. package/dist/client/assets/{useQueries-CiCIRDU-.js → useQueries-BuMODvFG.js} +1 -1
  345. package/dist/client/assets/useSuspenseInfiniteQuery-C2ZhOGvp.js +1 -0
  346. package/dist/client/assets/{users-juR-Mf-x.js → users-Ct3PwBMT.js} +1 -1
  347. package/dist/client/assets/{utils-DsMBpUcw.js → utils-DA49HMaO.js} +1 -1
  348. package/dist/client/assets/{variant-calendar-D0VBOg4q.js → variant-calendar-CPtUMCAS.js} +1 -1
  349. package/dist/client/assets/{variant-matcher-override-TIETIQ4W.js → variant-matcher-override-DnlLYEoa.js} +1 -1
  350. package/dist/client/assets/{view-header-BupmkwFn.js → view-header-CAO18iqy.js} +1 -1
  351. package/dist/client/assets/{virtual-mcp-DqDEHqCs.js → virtual-mcp-C4mAz3N8.js} +1 -1
  352. package/dist/client/assets/{watch-sse-pool-DwGCR27q.js → watch-sse-pool-BI4P-Lkx.js} +1 -1
  353. package/dist/client/index.html +1 -1
  354. package/dist/server/server.js +1 -1
  355. package/package.json +1 -1
  356. package/dist/client/assets/agent-app-B3LTC-z6.js +0 -1
  357. package/dist/client/assets/agent-calendar-CUj5ygBN.js +0 -1
  358. package/dist/client/assets/agent-deck-B2XAonlC.js +0 -1
  359. package/dist/client/assets/agent-library-CnjQ4-dS.js +0 -1
  360. package/dist/client/assets/agent-library-file-DORygQ2_.js +0 -1
  361. package/dist/client/assets/agent-overview--DJQfkWj.js +0 -1
  362. package/dist/client/assets/agent-settings-LC6lUh-Z.js +0 -1
  363. package/dist/client/assets/agent-site-editor-code-CLPv9-CF.js +0 -2
  364. package/dist/client/assets/agent-site-editor-content-DnCCavW0.js +0 -1
  365. package/dist/client/assets/agent-site-editor-preview-B7zbGUx6.js +0 -1
  366. package/dist/client/assets/agent-view-CAp5PQrn.js +0 -1
  367. package/dist/client/assets/api-keys-gr-XS1eV.js +0 -1
  368. package/dist/client/assets/branch-name-D4VItpp3.js +0 -1
  369. package/dist/client/assets/library-DRjhGmVa.js +0 -1
  370. package/dist/client/assets/project-reports-BiRpC0Ut.js +0 -1
  371. package/dist/client/assets/project-tasks-DNAB3dSd.js +0 -1
  372. package/dist/client/assets/record-editor-Dyz0HnM9.js +0 -1
  373. package/dist/client/assets/reports-Df12mzuV.js +0 -1
  374. package/dist/client/assets/repositories-BRECfYRM.js +0 -1
  375. package/dist/client/assets/route-CDiHNgIq.js +0 -1
  376. package/dist/client/assets/route-CJdkN5-r.js +0 -1
  377. package/dist/client/assets/settings-tab-CbWALbd6.js +0 -1
  378. package/dist/client/assets/site-draft-view-DACL5z9x.js +0 -3
  379. package/dist/client/assets/site-editor-BI3RzfpH.js +0 -1
  380. package/dist/client/assets/tasks-CdHhNSUE.js +0 -1
  381. package/dist/client/assets/use-ask-in-chat-CuTdZYOa.js +0 -1
  382. package/dist/client/assets/useInfiniteQuery-FqvtVI1A.js +0 -1
  383. package/dist/client/assets/useSuspenseInfiniteQuery-Bp4UXIRf.js +0 -1
@@ -1 +1 @@
1
- import{eP as P,eQ as S,c as $,q as ne,i as F,K as g,eR as Ne,aB as wn,aF as Sn,aG as yn,r as L,a as En,at as De,a5 as On,by as yt,eS as Dn,eT as kn,eU as Et,ar as _n,bo as Ot,bh as B,eV as In,eW as Tn,eX as Z,eY as Pn,eZ as Rn,e_ as ue,e$ as xn,f0 as Dt,f1 as kt,f2 as $n,f3 as Nn,a3 as jn,t as K,j as Y}from"./index-CoIqGnkT.js";import{a as _t}from"./input-oiyfOdq_.js";import{s as et}from"./thread-intent-DsvstIYH.js";import{u as je}from"./agent-capabilities-C_fHyyST.js";import{b as be}from"./sandbox-url-D3mC8qhT.js";import{s as Cn}from"./utils-DsMBpUcw.js";import{u as Ce}from"./repository-binding-CyaIIWjt.js";import{u as An}from"./chat-context-CbLWEfcx.js";import{i as Un,u as Mn}from"./index-RA-jAYZL.js";import{a as Ln}from"./sandbox-git-api-DcqI6XE4.js";const q="deco-content",ke={major:1},It=1;async function Fn(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const _e={major:ke.major,minor:It},Tt=`the endpoint speaks an older ${q} than this client needs (${_e.major}.${_e.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function re(e,t,n){const o={reason:t,required:{..._e}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new P(S.Unsupported,e,o)}function Pt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==q)throw re(`the endpoint speaks ${JSON.stringify(n)}, not ${q}`,"protocol",t);if(o?.major!==ke.major)throw re(`the endpoint speaks ${q} ${String(o?.major)}.x; this client speaks ${ke.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<It)throw re(Tt,"outdated",t);return e}function tt(e,t){return t.code===S.MethodNotFound&&e.startsWith("changes.")?re(Tt,"outdated"):P.from(t)}function Ae(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let l;try{l=await Fn(a)}catch{throw new P(S.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(l)&&l?.id===null){const c=l?.error;throw c?P.from(c):new P(S.Unavailable,`the endpoint answered HTTP ${a.status}`)}return l}const r=async(s,i)=>{const a=n++,l=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(l.error)throw tt(s,l.error);return l.result};return{call:r,describe:async()=>Pt(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((c,f)=>({jsonrpc:"2.0",id:i[f],method:c.method,params:c.params??{}}))),l=new Map(a.map(c=>[c.id,c]));return i.map((c,f)=>{const u=l.get(c);return u?u.error?{ok:!1,error:tt(s[f].method,u.error)}:{ok:!0,result:u.result}:{ok:!1,error:new P(S.InternalError,"no response for this call")}})}}}function Ue(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const nt=20,ot=5,rt=500;function Me(e){return e instanceof P?e.code===S.MethodNotFound?!0:e.code===S.Unsupported&&e.data?.reason==="outdated":!1}function fe(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function Qn(e,t,n){const o=g.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(Ue(r)),i=fe(r,s);if(i)return i;const a=await t.changesList({});return fe(void 0,a)}async function Rt(e,t){const n=[];for(let s=0;s<t.length;s+=nt)n.push(t.slice(s,s+nt));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=ot){const i=await e.batch(n.slice(s,s+ot).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const l=a.result;Object.assign(o,l.entries),r.push(...l.diagnostics)}}return{entries:o,diagnostics:r}}async function Qr(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=rt){const r=t.slice(o,o+rt),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Vr(e){return e instanceof P&&e.code===S.Conflict}function Le(e){return e?.kind==="protocol"?e:null}function Br(e,t,n){const o=$.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=ne();let a;o[2]!==e?(a=Le(e),o[2]=e,o[3]=a):a=o[3];const l=a,c=!!l&&!!t&&s.enabled!==!1;let f;o[4]!==t?(f=g.contentChanges(t??""),o[4]=t,o[5]=f):f=o[5];let u;o[6]!==t||o[7]!==c||o[8]!==l||o[9]!==i?(u=c?()=>Qn(i,l.client,t):Ne,o[6]=t,o[7]=c,o[8]=l,o[9]=i,o[10]=u):u=o[10];let d;return o[11]!==f||o[12]!==u?(d={queryKey:f,queryFn:u,staleTime:0},o[11]=f,o[12]=u,o[13]=d):d=o[13],F(d)}function Hr(e,t,n){const o=$.c(14);let r;o[0]!==e?(r=Le(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,l=!!s&&!!t&&!!n&&a.length>0;let c;o[4]!==t||o[5]!==n?.revision?(c=g.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=c):c=o[6];let f;o[7]!==l||o[8]!==a||o[9]!==s?(f=l?()=>Rt(s.client,a):Ne,o[7]=l,o[8]=a,o[9]=s,o[10]=f):f=o[10];let u;return o[11]!==c||o[12]!==f?(u={queryKey:c,queryFn:f,staleTime:Number.POSITIVE_INFINITY},o[11]=c,o[12]=f,o[13]=u):u=o[13],F(u)}function Jr(e,t,n){const o=$.c(16);let r;o[0]!==e?(r=Le(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i,a,l,c;if(o[2]!==t||o[3]!==n?.changes||o[4]!==s){const d=Object.entries(n?.changes??{}).filter(Wn).map(Jn).sort(Hn);a=d.map(Bn);const h=JSON.stringify(d.map(Vn));i=!!s&&!!t&&a.length>0,c=F,l=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=s,o[5]=i,o[6]=a,o[7]=l,o[8]=c}else i=o[5],a=o[6],l=o[7],c=o[8];let f;o[9]!==i||o[10]!==a||o[11]!==s?(f=i?async()=>{const d=await Rt(s.client,a),h=Object.create(null);for(const[p,v]of Object.entries(d.entries))h[p]=v.before&&typeof v.before=="object"?v.before:null;return h}:Ne,o[9]=i,o[10]=a,o[11]=s,o[12]=f):f=o[12];let u;return o[13]!==l||o[14]!==f?(u={queryKey:l,queryFn:f,staleTime:Number.POSITIVE_INFINITY,placeholderData:wn},o[13]=l,o[14]=f,o[15]=u):u=o[15],c(u)}function Vn(e){return[e.name,e.base]}function Bn(e){return e.name}function Hn(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function Jn(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function Wn(e){const[,t]=e;return t.kind==="delete"}function xt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function de(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const $t=Sn({endpoint:yn().max(2048).refine(e=>xt(e)&&new URL(e).pathname==="/rpc").transform(de)});function Wr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=$t.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function Nt(e){const t=$t.safeParse(e);return t.success?t.data:null}const jt="studio:deco-serve-last";function Gr(e){try{localStorage.setItem(jt,JSON.stringify(e))}catch{}}function Yr(){try{const e=localStorage.getItem(jt);return e?Nt(JSON.parse(e)):null}catch{return null}}function zr(e){try{return new URL(de(e)).host}catch{return e}}function Gn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Yn="http://localhost:4545/rpc";class Fe extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zn(e){if(e instanceof Fe)return{reason:"not-deco-serve"};if(!(e instanceof P))return{reason:"not-answering"};switch(e.code){case S.Unauthorized:case S.MethodNotFound:return{reason:"outdated"};case S.Unsupported:return Me(e)?{reason:"outdated"}:{reason:"version-mismatch"};case S.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function Xr(e,t){if(e)return[de(e.endpoint)];const n=[t?.endpoint,Yn].filter(o=>!!o).map(de);return[...new Set(n)]}const Ct=L.createContext(null);function Xn(e){const t=$.c(24),n=L.useContext(Ct),o=je(n?null:e),{data:r}=En.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?De.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[l,c]=it(a);let f;t[4]!==i||t[5]!==s||t[6]!==e?(f=i?De.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=f):f=t[7];const[u,d]=it(f);if(n)return n;let h;t[8]!==l||t[9]!==i||t[10]!==o?(h=i&&o?Nt(l):null,t[8]=l,t[9]=i,t[10]=o,t[11]=h):h=t[11];const p=h,v=i&&o&&typeof u=="string"?u:null;let w;t[12]!==d||t[13]!==c||t[14]!==i?(w=R=>{i&&(c(R),d(R.endpoint))},t[12]=d,t[13]=c,t[14]=i,t[15]=w):w=t[15];let _;t[16]!==c||t[17]!==i?(_=()=>{i&&c(null)},t[16]=c,t[17]=i,t[18]=_):_=t[18];let E;return t[19]!==p||t[20]!==v||t[21]!==w||t[22]!==_?(E={connection:p,lastEndpoint:v,set:w,clear:_},t[19]=p,t[20]=v,t[21]=w,t[22]=_,t[23]=E):E=t[23],E}function st(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function it(e){const t=$.c(17),n=ne(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?st(e):null,a=()=>e?st(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const l=!!e;let c;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==l?(c={queryKey:s,queryFn:i,initialData:a,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=l,t[9]=c):c=t[9];const{data:f}=F(c);let u;t[10]!==e||t[11]!==n||t[12]!==s?(u=v=>{if(e){try{v===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(v))}catch{}n.setQueryData(s,v)}},t[10]=e,t[11]=n,t[12]=s,t[13]=u):u=t[13];const d=u,h=e?f??null:null;let p;return t[14]!==d||t[15]!==h?(p=[h,d],t[14]=d,t[15]=h,t[16]=p):p=t[16],p}function Zr(e){return e.kind==="protocol"||e.kind==="unavailable"}function qr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Kr(e,t,n){return t!=="github"||!n?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function es(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&xt(t)?t:null}function ts(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function At(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function Zn(e){if(!e.hasProject)return"legacy";const t=At(e);if(t==="local")return"protocol-local";if(!e.v8)return"legacy";if(t==="sandbox"){const o=e.sandboxSite;return o==="ready"?"protocol-sandbox":o==="error"?"retrying-sandbox":"pending"}const n=e.githubSite;return n==="ready"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":"pending"}function qn(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function at(e){return e.isError||e.errorUpdateCount>0}function Kn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function eo(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}const Ut="__noSchema";function Mt(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[Ut]:!0}}function ns(e){return!!e&&e[Ut]===!0}function Qe(e){if(!e.ok)return e.error.code===S.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function to(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const no=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function os(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:to(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(no)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:ct(n.resolveType).localeCompare(ct(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function ct(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function lt(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=lt(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?lt(s[a],r,n):s[a];return i}return e}function rs(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class ut extends Error{}const Ve="site-not-owned";async function oo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function ro(e,t=n=>fetch(n)){const n=Ae({endpoint:e,fetch:async o=>{const r=await t(o);if(await oo(r))throw new ut;return r}});try{return await He(n)}catch(o){if(o instanceof ut)return Ve;throw o}}async function so(e,t,n){await t();const o=await ro(e,n);return o===Ve?o:{...o,hosted:Dn(e,n)}}const Be=5e3;function io(e){if(!e.site)throw new Error("this project names no site");return kn(e.site,e.branch)}function ao(e){return new URL(be(e,"rpc"),window.location.origin).href}async function He(e){const[t,n]=await e.batch([{method:"describe"},{method:"schema.get"}]);if(!t?.ok)throw t?.error??new Error("no describe");if(t.result?.protocol!==q)throw new Fe;const r=Pt(t.result);if(!n)throw new Error("no schema.get");if(Qe(n))return{client:e,describe:r,hasSchema:!1};if(n.ok)return{client:e,describe:r,hasSchema:!0};throw n.error}function co(e,t=n=>fetch(n)){return He(Ae({endpoint:e,fetch:t}))}function me(e,t){const n=$.c(50),{org:o}=On(),{connection:r}=Xn(e),{runtime:s}=_t(e),i=L.useContext(Ct),a=je(e),l=yt(Ce(e)?.metadata),c=At({hasServeConnection:!!r,runtime:s}),f=An()?.taskId??null,u=Un(Mn().lifecycle.phase),d=ne(),h=qn({mode:c,v8:a,workingTreeReady:u}),p=h.github&&!!o.slug&&!!e&&!!t,v=F({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>so(io({orgSlug:o.slug,site:l,branch:t}),()=>Et(l,t)),enabled:p,staleTime:Number.POSITIVE_INFINITY,...ft}),w=h.sandbox&&!!o.slug&&!!e&&!!t;let _;n[0]!==t||n[1]!==o.slug||n[2]!==f||n[3]!==e?(_=()=>co(ao({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:f})),n[0]=t,n[1]=o.slug,n[2]=f,n[3]=e,n[4]=_):_=n[4];const E=F({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",f??""),queryFn:_,enabled:w,staleTime:Number.POSITIVE_INFINITY,...ft}),R=!!r;let I;n[5]!==r?.endpoint||n[6]!==o.slug||n[7]!==e?(I=g.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[5]=r?.endpoint,n[6]=o.slug,n[7]=e,n[8]=I):I=n[8];let N;n[9]!==r?(N=()=>He(Ae({endpoint:r.endpoint})),n[9]=r,n[10]=N):N=n[10];let x;n[11]!==R||n[12]!==I||n[13]!==N?(x={queryKey:I,queryFn:N,enabled:R,staleTime:Number.POSITIVE_INFINITY,retry:fo,retryDelay:uo,refetchInterval:lo},n[11]=R,n[12]=I,n[13]=N,n[14]=x):x=n[14];const b=F(x);let U;n[15]!==r?.endpoint||n[16]!==o.slug||n[17]!==e?(U=g.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[15]=r?.endpoint,n[16]=o.slug,n[17]=e,n[18]=U):U=n[18];const D=U;let T;n[19]!==r?.endpoint||n[20]!==o.slug||n[21]!==e?(T=g.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[19]=r?.endpoint,n[20]=o.slug,n[21]=e,n[22]=T):T=n[22];let j;n[23]!==b.data||n[24]!==D||n[25]!==d?(j=async()=>{try{return await b.data.client.describe()}catch(m){const J=m;throw d.invalidateQueries({queryKey:D,exact:!0},{cancelRefetch:!1}),J}},n[23]=b.data,n[24]=D,n[25]=d,n[26]=j):j=n[26];const C=!!b.data&&!i;let O;n[27]!==T||n[28]!==j||n[29]!==C?(O={queryKey:T,queryFn:j,enabled:C,refetchInterval:Be,retry:!1},n[27]=T,n[28]=j,n[29]=C,n[30]=O):O=n[30];const A=F(O).data??b.data?.describe,k=Zn({hasProject:!!e,hasServeConnection:!!r,runtime:s,v8:a,githubSite:v.data===Ve?"not-owned":v.data?"ready":at(v)?"error":"loading",sandboxSite:ho({data:E.data,isError:at(E),workingTreeReady:u})});if(k==="pending"){let m;return n[31]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending"},n[31]=m):m=n[31],m}if(k==="retrying-sandbox"){let m;return n[32]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"sandbox"},n[32]=m):m=n[32],m}if(k==="legacy"){let m;return n[33]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"legacy"},n[33]=m):m=n[33],m}if(k==="protocol-github"){const m=v.data;let J;n[34]!==m?(J=Ie("github",m,""),n[34]=m,n[35]=J):J=n[35];let oe;return n[36]!==l||n[37]!==J?(oe={...J,site:l},n[36]=l,n[37]=J,n[38]=oe):oe=n[38],oe}if(k==="site-not-owned-github"){let m;return n[39]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github",siteNotOwned:!0},n[39]=m):m=n[39],m}if(k==="protocol-sandbox"){let m;return n[40]!==E.data?(m=Ie("sandbox",E.data,":sandbox"),n[40]=E.data,n[41]=m):m=n[41],m}if(k==="unavailable-github"){let m;return n[42]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github"},n[42]=m):m=n[42],m}const Q=b.error??b.failureReason,y=r?.endpoint??"";let V;return n[43]!==A||n[44]!==b.data||n[45]!==b.failureCount||n[46]!==b.isError||n[47]!==y||n[48]!==Q?(V=vo({probed:b.data,isError:b.isError,failureCount:b.failureCount,failure:Q,describe:A,endpoint:y}),n[43]=A,n[44]=b.data,n[45]=b.failureCount,n[46]=b.isError,n[47]=y,n[48]=Q,n[49]=V):V=n[49],V}function lo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Be:!1}function uo(e){return Gn(e+1)}function fo(e,t){return!(t instanceof P)&&!(t instanceof Fe)}function ho(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const go=3;function vo(e){const t=e.probed?Ie("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<go?t:{kind:"unavailable",source:"local",problem:zn(e.failure)}:t??{kind:"pending"}}const ft={retry:2,refetchInterval:e=>e.state.status==="error"?Be:!1};function Ie(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function Lt(e){const t=$.c(12);let n;t[0]!==e?(n=De.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=_n(o,null),i=je(e);let a;t[2]!==r||t[3]!==e?(a=e?et(r):null,t[2]=r,t[3]=e,t[4]=a):a=t[4];const c=i?null:a;let f,u;t[5]!==s?(f=h=>s(et(h)),u=()=>s(null),t[5]=s,t[6]=f,t[7]=u):(f=t[6],u=t[7]);let d;return t[8]!==c||t[9]!==f||t[10]!==u?(d={url:c,setUrl:f,clear:u},t[8]=c,t[9]=f,t[10]=u,t[11]=d):d=t[11],d}function po(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function dt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function we(e,t,n){return["decofile-write",e,t,n]}function bo(e,t,n){return{id:we(e,t,n).join(":")}}class Je extends Error{constructor(t,n,o=[],r=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=r,this.name="BlockConflictError"}blocks;fields;carriedStored}function We(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function Ge(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function mo(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function wo(e,t,n){e.setQueryData(g.decofileDraft(We(t)),n)}function So(e,t){return e.getQueryData(g.decofileDraft(We(t)))??null}async function yo(e,t){return(await fetch(Ge(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function ss(e){const t=$.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?We(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Eo,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r??null}async function Eo(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Oo(e,t){const n=await fetch(Ge(t),{cache:"no-store"});if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&wo(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function is(e,t){const n=await fetch(Ge(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new Je(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return mo(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Ft=3e3,Do=15e3,ko=2*6e4,Qt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function _o(e){return e<ko?Ft:Do}function Io(e,t=Qt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,_o(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:l,skip:c}=e();if(r||t.hidden()||c?.()){i();return}r=!0;let f;try{f=l()}catch{f=void 0}Promise.resolve(f).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const ht=()=>0;function To(e,t,n=Qt){const o=L.useRef(t);o.current=t;const[r]=L.useState(()=>({polling:()=>Io(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?r.polling:r.idle,ht,ht)}function Vt(e,t){return be(e,t)}function Po(e,t){return be(e,"preview-fetch",{path:t})}function as(e){return Vt(e,"preview-invoke")}function cs(e){return Vt(e,"catalog-invoke")}function Bt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function Ro(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&Bt(n))return n}return null}function xo(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Ro();return n&&Bt(n)?new URL(t,n).toString():Po(e,t)}function $o(e){return xo(e,"/.decofile")}function No(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function gt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function jo(e,t){const n=be(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=No(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:Cn(s.content)}}async function Co(e,t){const n=await jo(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function ls(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Ao(e){return Ce(e)?.metadata?.runtime?.path??null}class Ht extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function us(e){return e instanceof P&&e.code===S.Conflict}function Jt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class Ye extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class ze extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function fs(e,t){return(t instanceof Ye||t instanceof ze)&&(t.message=Wt(e,t,"github")),t}function Wt(e,t,n){if(t instanceof Ye)return e("siteEditor.save.draftUnread");if(t instanceof ze)return e("siteEditor.save.keptChanging");if(t instanceof Je)return t.message;if(n==="local")return Mo(e,t);if(t instanceof P)switch(t.code){case S.Conflict:return e("siteEditor.save.conflict");case S.ReadOnly:return e("siteEditor.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("siteEditor.save.invalid");case S.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function Uo(e,t){if(t==="local"||e instanceof Je||e instanceof Ye||e instanceof ze)return null;if(e instanceof P){const n=e.code===S.InvalidBlock||e.code===S.InvalidParams?Jt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Mo(e,t){if(t instanceof Ht)return e("decoServe.save.serverGone");if(t instanceof P)switch(t.code){case S.Conflict:return e("decoServe.save.conflict");case S.ReadOnly:return e("decoServe.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("decoServe.save.invalid",{detail:Jt(t)});case S.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Lo(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function Fo(e,t){const[n,o]=L.useState(e),r=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=Lo(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const Qo="decocms:content-writes",Te=new Set;let G;function Gt(){if(G!==void 0)return G;G=null;try{typeof BroadcastChannel=="function"&&(G=new BroadcastChannel(Qo),G.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Te])n(t)}))}catch{G=null}return G}function Vo(e){try{Gt()?.postMessage({cacheKey:e})}catch{}}function Bo(e){return Gt(),Te.add(e),()=>{Te.delete(e)}}const Yt="__at=",zt="__test=",Ho=/^[0-9a-f]{12}-[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function Jo(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function X(e){return typeof e=="string"&&Ho.test(e)}function vt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Wo(e){const t=e.tests??{};return[...e.at!==void 0?[Yt+vt(e.at)]:[],...Object.keys(t).map(n=>zt+vt(`${n}=${t[n]?"on":"off"}`))]}function pt(e,t){const o=[...e.split("&").filter(r=>r&&!r.startsWith(Yt)&&!r.startsWith(zt)),...t];return o.length>0?`?${o.join("&")}`:""}function he(e,t){const n=Wo(t),o=e.indexOf("?"),r=o===-1?e:e.slice(0,o);if(X(r))return r+pt(o===-1?"":e.slice(o+1),n);const s=e.lastIndexOf("@");if(s<=0)return e;const i=e.slice(0,s),a=i.indexOf("?"),l=a===-1?i:i.slice(0,a),c=a===-1?"":i.slice(a+1);return`${l}${pt(c,n)}${e.slice(s)}`}function ds(e,t,n){if(!Jo(t))return e;try{const o=new URL(e),r=o.searchParams.get("__draft");return r&&r!=="off"?(o.searchParams.set("__draft",he(r,t)),o.toString()):X(n)?(o.searchParams.set("__draft",he(n,t)),o.toString()):e}catch{return e}}function hs(e,t,n="/"){if(!e||!X(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function Xt(e){return btoa(encodeURIComponent(e))}function gs(e,t,n){const o=Go(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Go(e,t,n){const o=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return r.searchParams.set("path","/"),r.searchParams.set("pathTemplate","/"),r.searchParams.set("props",Xt(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),r}const Yo="__draft";function vs(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const zo="off";function Xo(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Yo,t),n.toString()}function ps(e){const t=e.pageBlock.__resolveType;if(typeof t!="string"||!t)return null;const n=new URL(e.previewBaseUrl).origin,o=new URL(`/live/previews/${encodeURIComponent(t)}`,n);o.searchParams.set("__decoFBT","0"),o.searchParams.set("__d",""),o.searchParams.set("path",e.path),o.searchParams.set("pathTemplate",e.pathTemplate);const{__resolveType:r,...s}=e.pageBlock,i=JSON.stringify({__props:s,__decofile:e.decofile});return{src:o.toString(),body:i}}function bs(e,t,n,o){const r=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,r);s.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),s.searchParams.set("props",Xt(JSON.stringify({sections:i}))),s.toString()}function ms(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const bt="__variant=";function Zt(e,t,n){return`${e}@${t}=${n}`}function ws(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[Zt(e,"sections",t.index)]}function Ss(e){const t=Array.isArray(e.mvObj.variants)?e.mvObj.variants:[];if(!e.pageKey||e.sectionIndex<0)return[];if(e.selectedVariantIndex<0||e.selectedVariantIndex>=t.length)return[];const o=`${e.page.multivariate?`sections.variants.${e.page.index}.value${e.page.lazyValues?".value":""}`:"sections"}.${e.sectionIndex}${e.sectionLazy?".section":""}`;return[Zt(e.pageKey,o,e.selectedVariantIndex)]}function ys(e,t){return[...t,...e]}function Zo(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Xe(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),r=o.indexOf("?"),s=r===-1?o:o.slice(0,r),a=[...r===-1?[]:o.slice(r+1).split("&").filter(c=>c&&!c.startsWith(bt)),...t.map(c=>bt+Zo(c))],l=a.length>0?`?${a.join("&")}`:"";return`${s}${l}${e.slice(n)}`}function Es(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),r=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return Xe(`${r}${o.pathname}@local`,t)}catch{return null}}function Os(e,t){if(t.length===0)return e;try{const n=new URL(e),o=n.searchParams.get("__draft");return!o||o==="off"?e:(n.searchParams.set("__draft",Xe(o,t)),n.toString())}catch{return e}}function qo(e){const{pointer:t}=e;if(!t||t===zo)return null;const n=t.indexOf("?");return X(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:X(e.heldRevision)&&e.forcedVariants.length===0?he(e.heldRevision,e.previewOptions):he(Xe(t,e.forcedVariants),e.previewOptions)}function Ko(e,t){if(!e||!t)return null;try{return Xo(e,t)}catch{return null}}function Ds(e,t,n){if(!e||!n)return null;try{return Ko(new URL(t,e).toString(),n)}catch{return null}}const ge={forcedVariants:[],previewOptions:{}},se=new Map,ie=new Map,Pe=new Map;function qt(e){for(const t of Pe.get(e)??[])t()}function Kt(e,t){const n=X(t)?t:null;(ie.get(e)??null)!==n&&(n?ie.set(e,n):ie.delete(e),qt(e))}function er(e){return ie.get(e)??null}function tr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ks(e,t){const n=se.get(e)??ge,o=t??ge;tr(n,o)||(t?se.set(e,o):se.delete(e),qt(e))}function nr(e){return se.get(e)??ge}function en(e,t){let n=Pe.get(e);return n||(n=new Set,Pe.set(e,n)),n.add(t),()=>{n.delete(t)}}function or(e){const t=$.c(3);let n,o;return t[0]!==e?(n=r=>en(e,r),o=()=>nr(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,rr)}function rr(){return ge}function sr(e){const t=$.c(3);let n,o;return t[0]!==e?(n=r=>e?en(e,r):ar,o=()=>e?er(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,ir)}function ir(){return null}function ar(){}function _s(e,t){const n=$.c(4),o=or(e),r=sr(e);let s;return n[0]!==o||n[1]!==r||n[2]!==t?(s=qo({pointer:t,heldRevision:r,...o}),n[0]=o,n[1]=r,n[2]=t,n[3]=s):s=n[3],s}const tn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},cr=15e3,ve=new Map;function z(e,t){return`${e}/${t}`}function H(e){let t=ve.get(e);return t||(t={state:tn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ve.set(e,t)),t}function W(e,t){const n=H(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Se(e){e.timer&&clearTimeout(e.timer),e.timer=null}function Ze(e){return ve.get(e)?.state??tn}function lr(e,t){const n=H(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Is(e){const t=H(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Se(t),W(e,{phase:"idle"}))}}function Ts(e){const t=ve.get(e);!t||t.state.phase!=="reloading"||(Se(t),W(e,{phase:"idle"}))}function nn(e){const t=H(e);Se(t),W(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ae(e,t){const n=H(e),o=Math.max(0,n.state.inFlight-1);if(o>0){W(e,{inFlight:o});return}if(!t.ok||n.previews===0){W(e,{phase:"idle",inFlight:o});return}on(e,t.navigates,o)}function on(e,t,n=0){const o=H(e);Se(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&W(e,{phase:"idle"})},cr),W(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function ur(e){return e?.kind==="protocol"&&e.source==="github"}async function ce(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,l=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await l,{navigates:!1};const c=s?g.protocolDraftRead(o,r,s):null,f=c?JSON.stringify(n.getQueryData(c)??null):null,u=l?[l]:[];if(a&&t.reread&&u.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&u.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),s&&i.source==="sandbox"&&u.push(n.invalidateQueries({queryKey:Ln(o,r,s)})),ur(i)&&c&&!t.adopted&&u.push(n.invalidateQueries({queryKey:c})),await Promise.all(u),t.kind!=="edit"){const p=z(o,r);W(p,{epoch:Ze(p).epoch+1})}const d=c?JSON.stringify(n.getQueryData(c)??null):null,h=f!==d;return h&&await new Promise(p=>Ot.schedule(p)),{navigates:h}}async function fr(e,t){return nn(z(e.orgSlug,e.virtualMcpId)),rn(e,t)}function mt(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function rn(e,t){const n=z(e.orgSlug,e.virtualMcpId),o=t.adopted?mt(e):null;let r;try{r=await t.write()}catch(i){throw ae(n,{ok:!1,navigates:!1}),t.refreshOnError&&ce(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&Vo(e.cacheKey),Kt(n,t.shownRevision?.(r)??null),t.adopted){const i=mt(e)!==o;return i&&await new Promise(a=>Ot.schedule(a)),ae(n,{ok:!0,navigates:i}),t.reread&&ce(e,t).catch(()=>{}),r}let s=!1;try{({navigates:s}=await ce(e,t))}catch{}finally{ae(n,{ok:!0,navigates:s})}return r}function Ps(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=z(o,r),a=new Set(t.blockKeys);for(const f of[...H(i).discardListeners])f(a);nn(i);let l=!1;const c=()=>(l=!0,rn(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:we(o,r,s),scope:bo(o,r,s),mutationFn:c}).execute(void 0).catch(f=>{throw l||ae(i,{ok:!1,navigates:!1}),f}):c()}function Rs(e,t,n){const o=$.c(8);let r;o[0]!==e||o[1]!==t?(r=z(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const l=H(s).discardListeners;return l.add(n),()=>{l.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],L.useEffect(i,a)}function sn(e){const t=z(e.orgSlug,e.virtualMcpId);Ze(t).inFlight>0||(Kt(t,null),ce(e,{kind:"external"}).then(({navigates:n})=>{const o=H(t);o.previews>0&&o.state.inFlight===0&&on(t,n)}).catch(()=>{}))}function dr(e,t){const n=$.c(7);let o;n[0]!==e||n[1]!==t?(o=z(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=c=>lr(r,c),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>Ze(r),n[5]=r,n[6]=a):a=n[6];const l=a;return L.useSyncExternalStore(i,l,l)}const hr=500;function xs(e,t){const{phase:n}=dr(e,t);return Fo(n!=="idle",hr)}function gr(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function an(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function $s(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Tn(i,n):vr(e,t,n)}const r=e.getQueryData(g.contentVersions(t));if(!r)return;if(Object.hasOwn(r,n))return r[n];const s=e.getQueryData(g.decofile(t));return s&&Object.hasOwn(s,n)?void 0:null}function ee(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=B(t),o=Object.keys(e.changes).find(r=>B(r)===n);return o===void 0?void 0:e.changes[o]}function vr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return cn(o,ye(e,t),n)}function cn(e,t,n){const o=ee(e,n);return o?.kind==="delete"?o.version??ue:o?o.version:t.has(B(n))?ue:null}function Ns(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const r=ee(o,n);return r?r.kind==="set"&&r.baseVersion===null:ye(e,t).has(B(n))}function js(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const r=ye(e,t);return{blocks:n,versionOf:s=>cn(o,r,s)}}function ye(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function pe(e,t,n,o){const r=B(n),s=ye(e,t);s.has(r)!==o&&(o?s.add(r):s.delete(r),Z(e),e.setQueryData(g.contentDraftTombstones(t),[...s]))}function ln(e,t,n,o){const r=o.revision,s=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([u,d])=>[u,d===ue?null:d]),a=e.getQueryData(g.contentChanges(n)),l=new Set(i.flatMap(([u])=>{const d=a?ee(a,u):void 0;return(d?d.baseVersion:s?.[u]??null)===null?[u]:[]})),c=new Set(i.flatMap(([u,d])=>d===null?[]:[B(u)]));e.setQueryData(g.contentChanges(n),u=>{if(!u)return u;const d={...u.changes};for(const[h,p]of i){const v=ee(u,h),w=v?v.baseVersion:s?.[h]??null;p!==null?d[h]={kind:"set",version:p,baseVersion:w}:w!==null?d[h]={kind:"delete",version:null,baseVersion:w}:delete d[h]}return{...u,changes:d,edited:!0}});for(const[u,d]of i)d!==null?pe(e,n,u,!1):!c.has(B(u))&&l.has(u)&&pe(e,n,u,!0);const f=o.revision;return f&&f!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),u=>u&&{...u,version:f}),r}function Ee(e,t,n){Z(e),e.setQueryData(g.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function un(e,t){const n=e.getMutationCache().findAll({mutationKey:we(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>eo(o.state.variables)))}function Re(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function te(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof P);throw t.source==="local"&&s?(Re(e,n),new Ht(r)):(t.source==="local"&&Me(r)&&Re(e,n),r)}}const le=new Map;function fn(e,t,n,o){const r=le.get(o);if(r)return r;const s=qe(e,t,n,o,!0);return le.set(o,s),s.finally(()=>le.delete(o))}const Oe=new Set;function pr(e,t,n){const o=$.c(8),r=ne(),s=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let l,c;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==s||o[4]!==r||o[5]!==i?(l=()=>{if(!e||!s||!i||!a)return;const f={orgSlug:s,virtualMcpId:i,branch:a};return Bo(u=>{u===n&&(Oe.has(n)||(Oe.add(n),mr(r,e,f,n).catch(br).finally(()=>Oe.delete(n))))})},c=[r,e,s,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=s,o[4]=r,o[5]=i,o[6]=l,o[7]=c):(l=o[6],c=o[7]),L.useEffect(l,c)}function br(){}async function mr(e,t,n,o){const r=le.get(o);return r&&await r.catch(()=>{}),fn(e,t,n,o)}async function qe(e,t,n,o,r){Z(e);const s=g.decofile(o),i=an(n,t),a=g.contentRevision(o),l=g.contentVersions(o),c=e.getQueryData(s),f=e.getQueryData(l),d=e.getQueryData(i),h=e.getQueryData(a)??void 0,p=r&&c&&f?h?.revision:void 0,v=r&&d?h?.schemaVersion:void 0,w=g.contentChanges(o),_=e.getQueryData(w);if(t.source==="github"&&t.hosted)return wr(e,t,t.hosted,n,o,{conditional:r,seen:h,currentMeta:d,schemaIfNoneMatch:v,seenChanges:_});const[E,R,I]=await te(e,t,n,()=>t.client.batch([{method:"blocks.list",params:p?{ifNoneMatch:p}:{}},{method:"schema.get",params:v?{ifNoneMatch:v}:{}},{method:"changes.list",params:Ue(_)}])),N=e.getQueryData(a)?.revision,x=N!==void 0&&N!==h?.revision;if(I?.ok){const O=x?null:fe(_,I.result);O&&e.setQueryData(w,O)}else I&&t.source==="local"&&Me(I.error)&&Re(e,n);if(!E?.ok)throw E?.error??new Error("no blocks.list");if(!R)throw new Error("no schema.get");const b=E.result,U=Qe(R),D=R.ok&&!U?R.result:null;if(b.notModified&&(!c||!f)||D?.notModified&&!d)return qe(e,t,n,o,!1);const T=b.notModified?new Set:un(e,n),j=b.notModified?c:Kn(b.blocks,c,T),C=U?Mt():D?D.notModified?d:D.schema:R.error;if(e.setQueryData(a,{revision:x?N:b.notModified?h?.revision:b.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(s,j),!b.notModified){const O=e.getQueryData(l),M={...b.versions};for(const A of T){const k=O?.[A];k!==void 0?M[A]=k:delete M[A]}e.setQueryData(l,M)}return C instanceof P||e.setQueryData(i,C),!x&&!b.notModified&&c&&h?.revision&&b.revision!==h.revision&&sn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:j,meta:C}}async function wr(e,t,n,o,r,s){const i=g.decofile(r),a=g.contentIndex(r),l=g.contentRevision(r),c=g.contentVersions(r),f=an(o,t),u=g.contentChanges(r),d=e.getQueryData(a),h=s.conditional&&d?s.seen?.revision:void 0,[p,v,w]=await te(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:s.schemaIfNoneMatch?{ifNoneMatch:s.schemaIfNoneMatch}:{}},{method:"changes.list",params:Ue(s.seenChanges)}])),_=e.getQueryData(a)??d,E=e.getQueryData(l)?.revision,R=E!==void 0&&E!==s.seen?.revision;if(w?.ok&&!R){const y=fe(s.seenChanges,w.result);y&&e.setQueryData(u,y)}if(!p?.ok)throw p?.error??new Error("no cms.index");if(!v)throw new Error("no schema.get");const I=p.result,N=Qe(v),x=v.ok&&!N?v.result:null;if(I.notModified&&!d||x?.notModified&&!s.currentMeta)return qe(e,t,o,r,!1);const b=N?Mt():x?x.notModified?s.currentMeta:x.schema:v.error;b instanceof P||e.setQueryData(f,b);const U=x?x.notModified?s.seen?.schemaVersion:x.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||R)return e.setQueryData(l,{revision:R?E:s.seen?.revision,schemaVersion:U}),e.setQueryData(i,D),{blocks:D,meta:b};const T={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,T);const j=!!s.seen?.revision&&T.revision!==s.seen.revision&&(!s.seen.revision.startsWith("s-")||!!d&&dn(d.draft,T.draft));j&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),y=>y&&{...y,version:T.revision}),e.setQueryData(l,{revision:T.revision,schemaVersion:U});const C=un(e,o),O=e.getQueryData(c)??{},M={},A={},k=[];for(const[y,V]of Object.entries(D)){const m=T.entries[y];!m&&!C.has(y)||(M[y]=V,O[y]!==void 0&&(A[y]=O[y]),m&&!C.has(y)&&O[y]!==m.version&&k.push(y))}return e.setQueryData(i,M),e.setQueryData(c,A),k.length>0&&await xn(e,n,r,k,C),_&&j&&Sr(_,T)&&sn({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:r}),{blocks:e.getQueryData(i)??M,meta:b}}function Sr(e,t){if(dn(e.draft,t.draft))return!0;const n=Object.keys(t.entries);return n.length!==Object.keys(e.entries).length?!0:n.some(o=>!Object.hasOwn(e.entries,o)||e.entries[o]?.version!==t.entries[o]?.version)}function dn(e,t){const n=Object.keys(t);return n.length!==Object.keys(e).length?!0:n.some(o=>!Object.hasOwn(e,o)||e[o]?.version!==t[o]?.version)}function yr(e,t){const n=[...Object.keys(t.set??{}),...t.delete??[]];return Object.fromEntries(n.filter(o=>Object.hasOwn(e,o)).map(o=>[o,e[o]]))}function wt(e){if(!(e instanceof P)||e.code!==S.Unavailable)return;const t=e.data?.landed;if(!(!t||typeof t!="object"||Array.isArray(t)))return Object.fromEntries(Object.entries(t).filter(n=>typeof n[1]=="string"))}function Er(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([r])=>!Object.hasOwn(t,r))),o=(e.delete??[]).filter(r=>!Object.hasOwn(t,r));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function St(e,t,n,o,r){Z(e),ln(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:r}),Ee(e,n,Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i===ue?null:i]))),Dt(e,n,r,o.set??{})}async function Cs(e,t,n,o,r,s){if(t.source==="github"){const a=[...Object.keys(r.set??{}),...r.delete??[]].filter(c=>!s||!Object.hasOwn(s,c));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const l=In(r.set);if(l.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${l.join(", ")})`)}return fr({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=f=>te(e,t,n,()=>t.client.blocksApply({set:f.set,delete:f.delete,...s?{ifMatch:yr(s,f)}:{}}));let a;try{a=await i(r)}catch(f){const u=t.source==="github"?wt(f):void 0;if(!u)throw f;const d=Er(r,u);Object.keys(u).length>0&&St(e,n,o,r,u);let h;try{h=await i(d)}catch(p){const v=wt(p);throw v&&Object.keys(v).length>0&&St(e,n,o,d,v),p}a={...h,versions:{...u,...h.versions}}}Z(e);const l=t.source==="github"?ln(e,n,o,a):a.revision;t.source==="github"&&Dt(e,o,a.versions??{},r.set??{}),e.setQueryData(g.contentRevision(o),f=>({...f,revision:l}));const c=a.versions??{};return Ee(e,o,c),{revision:l,versions:c}}})}function hn(e,t){if(!(e instanceof P))return;const n=e.data?.draft;if(!n||typeof n!="object"||!Object.hasOwn(n,t))return;const o=n[t];return o&&typeof o.version=="string"?o:void 0}function gn(e,t,n){if(!(n instanceof P))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[r,s]of Object.entries(o))s===null&&pe(e,t,r,!1)}function vn(e,t,n,o){Z(e),Pn(e,n,o);const r=o.block===null,s=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=i?ee(i,n):void 0,l=a?a.baseVersion:s?.[n]??null;if(i){const c=B(n),f=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(u)!==c));r?l!==null&&(f[n]={kind:"delete",version:null,baseVersion:l}):f[n]={kind:"set",version:o.version,baseVersion:l},e.setQueryData(g.contentChanges(t),{...i,changes:f,edited:!0})}pe(e,t,n,r&&l===null),e.setQueryData(g.decofile(t),c=>{const f={...c};return r?delete f[n]:f[n]=o.block,f}),Ee(e,t,{[n]:r?null:o.version}),Rn(e,t,n,o)}function As(e,t,n,o){if(t.source!=="github"||!(o instanceof P))return!1;gn(e,n,o);const r=o.data?.draft;if(!r||typeof r!="object")return!1;const s=Object.keys(r),i=s.map(a=>hn(o,a));return s.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),s.forEach((a,l)=>{vn(e,n,a,i[l])}),!0)}async function Us(e,t,n,o,r,s){t.source==="github"&&gn(e,o,s);const i=t.source==="github"?hn(s,r):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),vn(e,o,r,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const c=(await te(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(c&&c.after===null&&c.version!==null)return!1;a={value:c?.after??null,version:c?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),f=>{if(!f)return f;const u={...f.changes};return c?.kind?u[r]={kind:c.kind,version:c.version,baseVersion:c.baseVersion}:delete u[r],{...f,changes:u,edited:!0}})}catch{const l=await te(e,t,n,()=>t.client.blocksList({}));if(l.notModified)return!1;a={value:l.blocks[r]??null,version:l.versions[r]??null}}return e.setQueryData(g.decofile(o),l=>{const c={...l};return a.value===null?delete c[r]:c[r]=a.value,c}),Ee(e,o,{[r]:a.version}),!1}function Or(e){const t=$.c(17),n=Ce(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=yt(n),t[0]=n,t[1]=o):o=t[1];const r=o;let s;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(s=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=s):s=t[5];let i;t[6]!==e||t[7]!==r?(i=async()=>{const v=await Et(r,e.branch),w=v.pointer?.lastIndexOf("@")??-1;return{draft:v.pointer&&w>0?v.pointer.slice(0,w):null,version:v.pointer&&w>0?v.pointer.slice(w+1):v.etag}},t[6]=e,t[7]=r,t[8]=i):i=t[8];const a=!!e&&!!r;let l;t[9]!==s||t[10]!==i||t[11]!==a?(l={queryKey:s,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=s,t[10]=i,t[11]=a,t[12]=l):l=t[12];const{data:c,isPending:f,isError:u}=F(l),d=!!e&&!!r&&f&&!u;if(!e||!c?.draft||!c.version){let v;return t[13]!==d?(v={pointer:null,pending:d},t[13]=d,t[14]=v):v=t[14],v}const h=`${c.draft}@${c.version}`;let p;return t[15]!==h?(p={pointer:h,pending:!1},t[15]=h,t[16]=p):p=t[16],p}function Ms(e){return Or(e).pointer}function Ls(e){const t=$.c(4);let n;t[0]!==e?(n=g.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Dr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r?.revision}async function Dr(){throw new Error("content revisions are set by reads and writes")}function xe(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Fs(e,t){return xe({...e,protocolSuffix:t.cacheKeySuffix})}function Ke(e,t){const n=$.c(6),{url:o}=Lt(e?.virtualMcpId),r=me(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?xe({...e,protocolSuffix:r.cacheKeySuffix}):xe({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function Qs(e,t){const n=$.c(46),{url:o}=Lt(e?.virtualMcpId),r=!!o,s=me(e?.virtualMcpId,e?.branch),i=s.kind==="protocol"?s:null,a=Ke(e),l=t?.fetchEnabled??!0,c=Ao(e?.virtualMcpId),f=_t(e?.virtualMcpId).runtime==="cms",u=ne();let d;n[0]!==a?(d=g.decofile(a),n[0]=a,n[1]=d):d=n[1];const h=d;pr(i,i&&e?e:null,a);let p;n[2]!==e||n[3]!==u||n[4]!==h?(p=()=>{if(!e||u.isMutating({mutationKey:we(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const O=u.getQueryState(h);return O?.fetchStatus==="fetching"||Date.now()-(O?.dataUpdatedAt??0)<Ft/2},n[2]=e,n[3]=u,n[4]=h,n[5]=p):p=n[5];let v;n[6]!==f||n[7]!==r||n[8]!==e||n[9]!==i||n[10]!==u||n[11]!==h?(v=async()=>{if(e){if(!i&&f&&!r){const O=So(u,e)?.version;if(O&&!await yo(e,O))return}await u.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=f,n[7]=r,n[8]=e,n[9]=i,n[10]=u,n[11]=h,n[12]=v):v=n[12];let w;n[13]!==p||n[14]!==v?(w={skip:p,read:v},n[13]=p,n[14]=v,n[15]=w):w=n[15],To(!!t?.pollWhile&&!!e,w);const _=kt(i?.hosted?a:"");let E;n[16]!==s.kind||n[17]!==f||n[18]!==l||n[19]!==a||n[20]!==r||n[21]!==o||n[22]!==c||n[23]!==e||n[24]!==i||n[25]!==u?(E=async()=>{if(i)return(await fn(u,i,e,a)).blocks;if(s.kind==="unavailable")throw gr("decofile");if(r){const k=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Ir),Q=k?.ok?dt(await k.text()):null;if(Q)return Q;const y=new Error("decofile unavailable (local tunnel unreachable)");throw y.status=502,y}if(f)return Oo(u,e);const O=()=>Co(e,po(c,".deco/blocks.gen.json"));if(l){const k=await fetch($o(e),{cache:"no-store"}).catch(_r);if(k?.ok){const V=dt(await k.text());if(V)return V}const Q=await O();if(Q.kind==="data")return Q.data;const y=new Error(`Failed to fetch decofile: ${k?.status??"network error"}`);throw y.status=gt({liveOk:!!k?.ok,liveStatus:k?.status,committedAbsent:Q.kind==="absent"}),y}const M=await O();if(M.kind==="data")return M.data;const A=new Error("decofile unavailable (preview down, no committed snapshot)");throw A.status=gt({liveOk:!1,committedAbsent:M.kind==="absent"}),A},n[16]=s.kind,n[17]=f,n[18]=l,n[19]=a,n[20]=r,n[21]=o,n[22]=c,n[23]=e,n[24]=i,n[25]=u,n[26]=E):E=n[26];const R=!!e&&s.kind!=="pending",I=i?0:3e4,N=i?.describe.pollIntervalMs,x=i?"always":void 0;let b;n[27]!==f||n[28]!==r||n[29]!==i?(b=(O,M)=>{if(i||f||r)return O<3;const A=M.status;return A!==502&&A!==404&&O<2},n[27]=f,n[28]=r,n[29]=i,n[30]=b):b=n[30];let U;n[31]!==h||n[32]!==E||n[33]!==R||n[34]!==I||n[35]!==N||n[36]!==x||n[37]!==b?(U={queryKey:h,queryFn:E,enabled:R,staleTime:I,refetchInterval:N,refetchIntervalInBackground:!1,refetchOnWindowFocus:x,retry:b,retryDelay:kr},n[31]=h,n[32]=E,n[33]=R,n[34]=I,n[35]=N,n[36]=x,n[37]=b,n[38]=U):U=n[38];const D=F(U);let T;n[39]!==_||n[40]!==D?(T=_&&D.data?$n(_,D.data):void 0,n[39]=_,n[40]=D,n[41]=T):T=n[41];const j=T;let C;return n[42]!==j||n[43]!==i?.hosted||n[44]!==D?(C=i?.hosted&&j?{...D,data:j}:D,n[42]=j,n[43]=i?.hosted,n[44]=D,n[45]=C):C=n[45],C}function kr(e){return jn(5e3,1e3,e,2,0)}function _r(){return null}function Ir(){return null}function Vs(e,t,n){const o=me(e?.virtualMcpId,e?.branch),r=Ke(e),s=o.kind==="protocol"?o.hosted:void 0;return Nn(s,r,t,n)}function Bs(e,t){const n=$.c(3),o=me(e?.virtualMcpId,e?.branch),r=Ke(e),s=kt(o.kind==="protocol"&&o.hosted?r:"");let i;return n[0]!==s?.entries||n[1]!==t?(i=Object.entries(s?.entries??{}).filter(a=>{const[,l]=a;return t(l.meta?.type??"")}).map(Tr),n[0]=s?.entries,n[1]=t,n[2]=i):i=n[2],i}function Tr(e){const[t]=e;return t}const Pr="site-editor-save",pn={id:Pr,description:void 0,action:void 0,cancel:void 0},Hs="site-editor-undo",$e="site-editor-publish";function Rr(e){const t=$.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=Y.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=Y.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=Y.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function bn(e,t){return t?Y.jsx(Rr,{label:e("siteEditor.details"),detail:t}):void 0}function Js(e,t,n){K.error(Wt(e,t,n),{...pn,description:bn(e,Uo(t,n))})}function Ws(e,t,n=!1){K.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...pn,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const mn={action:void 0,duration:void 0};function Gs(e,t){K.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...mn,id:$e,description:void 0})}function Ys(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=bn(e,o??null);K[i](t,{id:$e,description:n&&a?Y.jsxs(Y.Fragment,{children:[Y.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:l=>{l.preventDefault(),K.loading(s??e("thread.publishPopover.publishing"),{...mn,id:$e,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function zs(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Fs as $,ms as A,xs as B,Kr as C,Or as D,Vs as E,z as F,sr as G,ks as H,Es as I,he as J,zo as K,Xo as L,ds as M,Os as N,gs as O,Ts as P,Is as Q,dr as R,Ke as S,Ct as T,Ls as U,ps as V,bo as W,we as X,fr as Y,jo as Z,mo as _,Xr as a,Br as a0,Jr as a1,Bs as a2,Ws as a3,Ns as a4,fs as a5,Je as a6,us as a7,mr as a8,Ye as a9,gr as aA,ls as aB,ze as aC,As as aD,$e as aE,mn as aF,Gs as aG,Ps as aH,Qr as aI,Vr as aJ,Me as aK,ss as aL,Ms as aM,vs as aN,X as aO,hs as aP,Ys as aQ,Hs as aR,pn as aS,un as aT,bs as aU,cs as aV,ws as aW,Ss as aX,ys as aY,Cs as aa,Us as ab,Js as ac,$s as ad,an as ae,wo as af,is as ag,Rs as ah,js as ai,qr as aj,os as ak,ct as al,lt as am,rs as an,xo as ao,ts as ap,Yn as aq,bn as ar,zs as as,Go as at,Hr as au,Qn as av,Rr as aw,_s as ax,Ds as ay,fn as az,Xn as b,Lt as c,Gn as d,zr as e,zn as f,He as g,Ae as h,xt as i,as as j,Po as k,Qs as l,Zr as m,ns as n,Ao as o,Wr as p,po as q,Yr as r,Gr as s,qo as t,me as u,Ko as v,Jo as w,Co as x,At as y,es as z};
1
+ import{eP as P,eQ as S,c as $,q as ne,i as F,K as g,eR as Ne,aB as wn,aF as Sn,aG as yn,r as L,a as En,at as De,a5 as On,by as yt,eS as Dn,eT as kn,eU as Et,ar as _n,bo as Ot,bh as B,eV as In,eW as Tn,eX as Z,eY as Pn,eZ as Rn,e_ as ue,e$ as xn,f0 as Dt,f1 as kt,f2 as $n,f3 as Nn,a3 as jn,t as K,j as Y}from"./index-Cvc22Qvh.js";import{a as _t}from"./input-C7_FCkgY.js";import{s as et}from"./thread-intent-Bs-Q7fma.js";import{u as je}from"./agent-capabilities-DKq2l6j_.js";import{b as be}from"./sandbox-url-D3mC8qhT.js";import{s as Cn}from"./utils-DA49HMaO.js";import{u as Ce}from"./repository-binding-B7A7NBUB.js";import{u as An}from"./chat-context-tsaqCp6v.js";import{i as Un,u as Mn}from"./index-D-DRzVEB.js";import{a as Ln}from"./sandbox-git-api-DcqI6XE4.js";const q="deco-content",ke={major:1},It=1;async function Fn(e){let t=new Uint8Array(await e.arrayBuffer());if(t[0]===31&&t[1]===139){const n=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));t=new Uint8Array(await new Response(n).arrayBuffer())}return JSON.parse(new TextDecoder().decode(t))}const _e={major:ke.major,minor:It},Tt=`the endpoint speaks an older ${q} than this client needs (${_e.major}.${_e.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function re(e,t,n){const o={reason:t,required:{..._e}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const r=n.server;typeof r?.name=="string"&&typeof r.version=="string"&&(o.server={name:r.name,version:r.version})}return new P(S.Unsupported,e,o)}function Pt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==q)throw re(`the endpoint speaks ${JSON.stringify(n)}, not ${q}`,"protocol",t);if(o?.major!==ke.major)throw re(`the endpoint speaks ${q} ${String(o?.major)}.x; this client speaks ${ke.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<It)throw re(Tt,"outdated",t);return e}function tt(e,t){return t.code===S.MethodNotFound&&e.startsWith("changes.")?re(Tt,"outdated"):P.from(t)}function Ae(e){const t=e.fetch??(s=>fetch(s));let n=1;async function o(s){const i={"content-type":"application/json",accept:"application/json",...e.headers},a=await t(new Request(e.endpoint,{method:"POST",headers:i,body:JSON.stringify(s)}));let l;try{l=await Fn(a)}catch{throw new P(S.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(l)&&l?.id===null){const c=l?.error;throw c?P.from(c):new P(S.Unavailable,`the endpoint answered HTTP ${a.status}`)}return l}const r=async(s,i)=>{const a=n++,l=await o({jsonrpc:"2.0",id:a,method:s,params:i??{}});if(l.error)throw tt(s,l.error);return l.result};return{call:r,describe:async()=>Pt(await r("describe")),schemaGet:s=>r("schema.get",s),blocksList:s=>r("blocks.list",s),blocksApply:s=>r("blocks.apply",s),changesList:s=>r("changes.list",s),changesGet:s=>r("changes.get",s),changesDiscard:s=>r("changes.discard",s),async batch(s){const i=s.map(()=>n++),a=await o(s.map((c,f)=>({jsonrpc:"2.0",id:i[f],method:c.method,params:c.params??{}}))),l=new Map(a.map(c=>[c.id,c]));return i.map((c,f)=>{const u=l.get(c);return u?u.error?{ok:!1,error:tt(s[f].method,u.error)}:{ok:!0,result:u.result}:{ok:!1,error:new P(S.InternalError,"no response for this call")}})}}}function Ue(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const nt=20,ot=5,rt=500;function Me(e){return e instanceof P?e.code===S.MethodNotFound?!0:e.code===S.Unsupported&&e.data?.reason==="outdated":!1}function fe(e,t){return t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function Qn(e,t,n){const o=g.contentChanges(n),r=e.getQueryData(o),s=await t.changesList(Ue(r)),i=fe(r,s);if(i)return i;const a=await t.changesList({});return fe(void 0,a)}async function Rt(e,t){const n=[];for(let s=0;s<t.length;s+=nt)n.push(t.slice(s,s+nt));const o=Object.create(null),r=[];for(let s=0;s<n.length;s+=ot){const i=await e.batch(n.slice(s,s+ot).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const l=a.result;Object.assign(o,l.entries),r.push(...l.diagnostics)}}return{entries:o,diagnostics:r}}async function Qr(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=rt){const r=t.slice(o,o+rt),s=await e.changesDiscard({names:r.map(i=>i.name),ifMatch:Object.fromEntries(r.map(i=>[i.name,i.version]))});n={revision:s.revision,versions:{...n.versions,...s.versions}}}return n}function Vr(e){return e instanceof P&&e.code===S.Conflict}function Le(e){return e?.kind==="protocol"?e:null}function Br(e,t,n){const o=$.c(14);let r;o[0]!==n?(r={},o[0]=n,o[1]=r):r=o[1];const s=r,i=ne();let a;o[2]!==e?(a=Le(e),o[2]=e,o[3]=a):a=o[3];const l=a,c=!!l&&!!t&&s.enabled!==!1;let f;o[4]!==t?(f=g.contentChanges(t??""),o[4]=t,o[5]=f):f=o[5];let u;o[6]!==t||o[7]!==c||o[8]!==l||o[9]!==i?(u=c?()=>Qn(i,l.client,t):Ne,o[6]=t,o[7]=c,o[8]=l,o[9]=i,o[10]=u):u=o[10];let d;return o[11]!==f||o[12]!==u?(d={queryKey:f,queryFn:u,staleTime:0},o[11]=f,o[12]=u,o[13]=d):d=o[13],F(d)}function Hr(e,t,n){const o=$.c(14);let r;o[0]!==e?(r=Le(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,l=!!s&&!!t&&!!n&&a.length>0;let c;o[4]!==t||o[5]!==n?.revision?(c=g.contentChangeSides(t??"",n?.revision??""),o[4]=t,o[5]=n?.revision,o[6]=c):c=o[6];let f;o[7]!==l||o[8]!==a||o[9]!==s?(f=l?()=>Rt(s.client,a):Ne,o[7]=l,o[8]=a,o[9]=s,o[10]=f):f=o[10];let u;return o[11]!==c||o[12]!==f?(u={queryKey:c,queryFn:f,staleTime:Number.POSITIVE_INFINITY},o[11]=c,o[12]=f,o[13]=u):u=o[13],F(u)}function Jr(e,t,n){const o=$.c(16);let r;o[0]!==e?(r=Le(e),o[0]=e,o[1]=r):r=o[1];const s=r;let i,a,l,c;if(o[2]!==t||o[3]!==n?.changes||o[4]!==s){const d=Object.entries(n?.changes??{}).filter(Wn).map(Jn).sort(Hn);a=d.map(Bn);const h=JSON.stringify(d.map(Vn));i=!!s&&!!t&&a.length>0,c=F,l=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=s,o[5]=i,o[6]=a,o[7]=l,o[8]=c}else i=o[5],a=o[6],l=o[7],c=o[8];let f;o[9]!==i||o[10]!==a||o[11]!==s?(f=i?async()=>{const d=await Rt(s.client,a),h=Object.create(null);for(const[p,v]of Object.entries(d.entries))h[p]=v.before&&typeof v.before=="object"?v.before:null;return h}:Ne,o[9]=i,o[10]=a,o[11]=s,o[12]=f):f=o[12];let u;return o[13]!==l||o[14]!==f?(u={queryKey:l,queryFn:f,staleTime:Number.POSITIVE_INFINITY,placeholderData:wn},o[13]=l,o[14]=f,o[15]=u):u=o[15],c(u)}function Vn(e){return[e.name,e.base]}function Bn(e){return e.name}function Hn(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function Jn(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function Wn(e){const[,t]=e;return t.kind==="delete"}function xt(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;const n=t.hostname.toLowerCase();return n==="127.0.0.1"||n==="[::1]"||n==="localhost"}catch{return!1}}function de(e){try{const t=new URL(e);return(t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&(t.hostname="localhost"),t.href}catch{return e}}const $t=Sn({endpoint:yn().max(2048).refine(e=>xt(e)&&new URL(e).pathname==="/rpc").transform(de)});function Wr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=$t.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function Nt(e){const t=$t.safeParse(e);return t.success?t.data:null}const jt="studio:deco-serve-last";function Gr(e){try{localStorage.setItem(jt,JSON.stringify(e))}catch{}}function Yr(){try{const e=localStorage.getItem(jt);return e?Nt(JSON.parse(e)):null}catch{return null}}function zr(e){try{return new URL(de(e)).host}catch{return e}}function Gn(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const Yn="http://localhost:4545/rpc";class Fe extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function zn(e){if(e instanceof Fe)return{reason:"not-deco-serve"};if(!(e instanceof P))return{reason:"not-answering"};switch(e.code){case S.Unauthorized:case S.MethodNotFound:return{reason:"outdated"};case S.Unsupported:return Me(e)?{reason:"outdated"}:{reason:"version-mismatch"};case S.Unavailable:return/^the endpoint answered HTTP/.test(e.message)?{reason:"not-deco-serve"}:{reason:"error",detail:e.message};default:return{reason:"error",detail:e.message}}}function Xr(e,t){if(e)return[de(e.endpoint)];const n=[t?.endpoint,Yn].filter(o=>!!o).map(de);return[...new Set(n)]}const Ct=L.createContext(null);function Xn(e){const t=$.c(24),n=L.useContext(Ct),o=je(n?null:e),{data:r}=En.useSession(),s=r?.user?.id??"",i=!!e&&!!s;let a;t[0]!==i||t[1]!==s||t[2]!==e?(a=i?De.decoServeConnection(s,e):null,t[0]=i,t[1]=s,t[2]=e,t[3]=a):a=t[3];const[l,c]=it(a);let f;t[4]!==i||t[5]!==s||t[6]!==e?(f=i?De.decoServeEndpoint(s,e):null,t[4]=i,t[5]=s,t[6]=e,t[7]=f):f=t[7];const[u,d]=it(f);if(n)return n;let h;t[8]!==l||t[9]!==i||t[10]!==o?(h=i&&o?Nt(l):null,t[8]=l,t[9]=i,t[10]=o,t[11]=h):h=t[11];const p=h,v=i&&o&&typeof u=="string"?u:null;let w;t[12]!==d||t[13]!==c||t[14]!==i?(w=R=>{i&&(c(R),d(R.endpoint))},t[12]=d,t[13]=c,t[14]=i,t[15]=w):w=t[15];let _;t[16]!==c||t[17]!==i?(_=()=>{i&&c(null)},t[16]=c,t[17]=i,t[18]=_):_=t[18];let E;return t[19]!==p||t[20]!==v||t[21]!==w||t[22]!==_?(E={connection:p,lastEndpoint:v,set:w,clear:_},t[19]=p,t[20]=v,t[21]=w,t[22]=_,t[23]=E):E=t[23],E}function st(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function it(e){const t=$.c(17),n=ne(),o=e??"";let r;t[0]!==o?(r=["localStorage",o],t[0]=o,t[1]=r):r=t[1];const s=r;let i,a;t[2]!==e?(i=()=>e?st(e):null,a=()=>e?st(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const l=!!e;let c;t[5]!==s||t[6]!==i||t[7]!==a||t[8]!==l?(c={queryKey:s,queryFn:i,initialData:a,enabled:l,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=s,t[6]=i,t[7]=a,t[8]=l,t[9]=c):c=t[9];const{data:f}=F(c);let u;t[10]!==e||t[11]!==n||t[12]!==s?(u=v=>{if(e){try{v===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(v))}catch{}n.setQueryData(s,v)}},t[10]=e,t[11]=n,t[12]=s,t[13]=u):u=t[13];const d=u,h=e?f??null:null;let p;return t[14]!==d||t[15]!==h?(p=[h,d],t[14]=d,t[15]=h,t[16]=p):p=t[16],p}function Zr(e){return e.kind==="protocol"||e.kind==="unavailable"}function qr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Kr(e,t,n){return t!=="github"||!n?!1:e.kind==="pending"?!0:e.kind==="unavailable"&&e.siteNotOwned?!1:(e.kind==="protocol"||e.kind==="unavailable")&&e.source==="github"}function es(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&xt(t)?t:null}function ts(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function At(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function Zn(e){if(!e.hasProject)return"legacy";const t=At(e);if(t==="local")return"protocol-local";if(!e.v8)return"legacy";if(t==="sandbox"){const o=e.sandboxSite;return o==="ready"?"protocol-sandbox":o==="error"?"retrying-sandbox":"pending"}const n=e.githubSite;return n==="ready"?"protocol-github":n==="not-owned"?"site-not-owned-github":n==="error"?"unavailable-github":"pending"}function qn(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function at(e){return e.isError||e.errorUpdateCount>0}function Kn(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const r of n)Object.hasOwn(t,r)?o[r]=t[r]:delete o[r];return o}function eo(e){if(!e||typeof e!="object")return[];const t=e,n=[];return typeof t.blockKey=="string"&&n.push(t.blockKey),t.writes&&typeof t.writes=="object"&&n.push(...Object.keys(t.writes)),Array.isArray(t.deletes)&&n.push(...t.deletes.filter(o=>typeof o=="string")),n}const Ut="__noSchema";function Mt(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[Ut]:!0}}function ns(e){return!!e&&e[Ut]===!0}function Qe(e){if(!e.ok)return e.error.code===S.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function to(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const no=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function os(e){const t=new Map;for(const[n,o]of Object.entries(e)){const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=typeof r.__resolveType=="string"?r.__resolveType:null,i=t.get(s)??[];i.push({key:n,label:to(n,r)}),t.set(s,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(no)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:ct(n.resolveType).localeCompare(ct(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function ct(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function lt(e,t,n){if(t.length===0)return n;const[o,...r]=t;if(Array.isArray(e)&&typeof o=="number"){const s=e.slice();return s[o]=lt(e[o],r,n),s}if(e&&typeof e=="object"&&typeof o=="string"){const s=e,i={};for(const a of Object.keys(s))i[a]=a===o?lt(s[a],r,n):s[a];return i}return e}function rs(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class ut extends Error{}const Ve="site-not-owned";async function oo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function ro(e,t=n=>fetch(n)){const n=Ae({endpoint:e,fetch:async o=>{const r=await t(o);if(await oo(r))throw new ut;return r}});try{return await He(n)}catch(o){if(o instanceof ut)return Ve;throw o}}async function so(e,t,n){await t();const o=await ro(e,n);return o===Ve?o:{...o,hosted:Dn(e,n)}}const Be=5e3;function io(e){if(!e.site)throw new Error("this project names no site");return kn(e.site,e.branch)}function ao(e){return new URL(be(e,"rpc"),window.location.origin).href}async function He(e){const[t,n]=await e.batch([{method:"describe"},{method:"schema.get"}]);if(!t?.ok)throw t?.error??new Error("no describe");if(t.result?.protocol!==q)throw new Fe;const r=Pt(t.result);if(!n)throw new Error("no schema.get");if(Qe(n))return{client:e,describe:r,hasSchema:!1};if(n.ok)return{client:e,describe:r,hasSchema:!0};throw n.error}function co(e,t=n=>fetch(n)){return He(Ae({endpoint:e,fetch:t}))}function me(e,t){const n=$.c(50),{org:o}=On(),{connection:r}=Xn(e),{runtime:s}=_t(e),i=L.useContext(Ct),a=je(e),l=yt(Ce(e)?.metadata),c=At({hasServeConnection:!!r,runtime:s}),f=An()?.taskId??null,u=Un(Mn().lifecycle.phase),d=ne(),h=qn({mode:c,v8:a,workingTreeReady:u}),p=h.github&&!!o.slug&&!!e&&!!t,v=F({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>so(io({orgSlug:o.slug,site:l,branch:t}),()=>Et(l,t)),enabled:p,staleTime:Number.POSITIVE_INFINITY,...ft}),w=h.sandbox&&!!o.slug&&!!e&&!!t;let _;n[0]!==t||n[1]!==o.slug||n[2]!==f||n[3]!==e?(_=()=>co(ao({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:f})),n[0]=t,n[1]=o.slug,n[2]=f,n[3]=e,n[4]=_):_=n[4];const E=F({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",f??""),queryFn:_,enabled:w,staleTime:Number.POSITIVE_INFINITY,...ft}),R=!!r;let I;n[5]!==r?.endpoint||n[6]!==o.slug||n[7]!==e?(I=g.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[5]=r?.endpoint,n[6]=o.slug,n[7]=e,n[8]=I):I=n[8];let N;n[9]!==r?(N=()=>He(Ae({endpoint:r.endpoint})),n[9]=r,n[10]=N):N=n[10];let x;n[11]!==R||n[12]!==I||n[13]!==N?(x={queryKey:I,queryFn:N,enabled:R,staleTime:Number.POSITIVE_INFINITY,retry:fo,retryDelay:uo,refetchInterval:lo},n[11]=R,n[12]=I,n[13]=N,n[14]=x):x=n[14];const b=F(x);let U;n[15]!==r?.endpoint||n[16]!==o.slug||n[17]!==e?(U=g.contentBackend(o.slug,e??"","local",r?.endpoint??""),n[15]=r?.endpoint,n[16]=o.slug,n[17]=e,n[18]=U):U=n[18];const D=U;let T;n[19]!==r?.endpoint||n[20]!==o.slug||n[21]!==e?(T=g.contentBackend(o.slug,e??"","local-describe",r?.endpoint??""),n[19]=r?.endpoint,n[20]=o.slug,n[21]=e,n[22]=T):T=n[22];let j;n[23]!==b.data||n[24]!==D||n[25]!==d?(j=async()=>{try{return await b.data.client.describe()}catch(m){const J=m;throw d.invalidateQueries({queryKey:D,exact:!0},{cancelRefetch:!1}),J}},n[23]=b.data,n[24]=D,n[25]=d,n[26]=j):j=n[26];const C=!!b.data&&!i;let O;n[27]!==T||n[28]!==j||n[29]!==C?(O={queryKey:T,queryFn:j,enabled:C,refetchInterval:Be,retry:!1},n[27]=T,n[28]=j,n[29]=C,n[30]=O):O=n[30];const A=F(O).data??b.data?.describe,k=Zn({hasProject:!!e,hasServeConnection:!!r,runtime:s,v8:a,githubSite:v.data===Ve?"not-owned":v.data?"ready":at(v)?"error":"loading",sandboxSite:ho({data:E.data,isError:at(E),workingTreeReady:u})});if(k==="pending"){let m;return n[31]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending"},n[31]=m):m=n[31],m}if(k==="retrying-sandbox"){let m;return n[32]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"pending",retrying:"sandbox"},n[32]=m):m=n[32],m}if(k==="legacy"){let m;return n[33]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"legacy"},n[33]=m):m=n[33],m}if(k==="protocol-github"){const m=v.data;let J;n[34]!==m?(J=Ie("github",m,""),n[34]=m,n[35]=J):J=n[35];let oe;return n[36]!==l||n[37]!==J?(oe={...J,site:l},n[36]=l,n[37]=J,n[38]=oe):oe=n[38],oe}if(k==="site-not-owned-github"){let m;return n[39]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github",siteNotOwned:!0},n[39]=m):m=n[39],m}if(k==="protocol-sandbox"){let m;return n[40]!==E.data?(m=Ie("sandbox",E.data,":sandbox"),n[40]=E.data,n[41]=m):m=n[41],m}if(k==="unavailable-github"){let m;return n[42]===Symbol.for("react.memo_cache_sentinel")?(m={kind:"unavailable",source:"github"},n[42]=m):m=n[42],m}const Q=b.error??b.failureReason,y=r?.endpoint??"";let V;return n[43]!==A||n[44]!==b.data||n[45]!==b.failureCount||n[46]!==b.isError||n[47]!==y||n[48]!==Q?(V=vo({probed:b.data,isError:b.isError,failureCount:b.failureCount,failure:Q,describe:A,endpoint:y}),n[43]=A,n[44]=b.data,n[45]=b.failureCount,n[46]=b.isError,n[47]=y,n[48]=Q,n[49]=V):V=n[49],V}function lo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Be:!1}function uo(e){return Gn(e+1)}function fo(e,t){return!(t instanceof P)&&!(t instanceof Fe)}function ho(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const go=3;function vo(e){const t=e.probed?Ie("local",{...e.probed,describe:e.describe??e.probed.describe},`:serve:${e.endpoint}`):null;return e.isError||e.failureCount>0?t?.kind==="protocol"&&!e.isError&&e.failureCount<go?t:{kind:"unavailable",source:"local",problem:zn(e.failure)}:t??{kind:"pending"}}const ft={retry:2,refetchInterval:e=>e.state.status==="error"?Be:!1};function Ie(e,t,n){return{kind:"protocol",source:e,client:t.client,describe:t.describe,cacheKeySuffix:n,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function Lt(e){const t=$.c(12);let n;t[0]!==e?(n=De.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[r,s]=_n(o,null),i=je(e);let a;t[2]!==r||t[3]!==e?(a=e?et(r):null,t[2]=r,t[3]=e,t[4]=a):a=t[4];const c=i?null:a;let f,u;t[5]!==s?(f=h=>s(et(h)),u=()=>s(null),t[5]=s,t[6]=f,t[7]=u):(f=t[6],u=t[7]);let d;return t[8]!==c||t[9]!==f||t[10]!==u?(d={url:c,setUrl:f,clear:u},t[8]=c,t[9]=f,t[10]=u,t[11]=d):d=t[11],d}function po(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function dt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function we(e,t,n){return["decofile-write",e,t,n]}function bo(e,t,n){return{id:we(e,t,n).join(":")}}class Je extends Error{constructor(t,n,o=[],r=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=r,this.name="BlockConflictError"}blocks;fields;carriedStored}function We(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function Ge(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function mo(e,t){const n=await e.json().catch(()=>({}));throw new Error(n.error??`${t} failed (${e.status})`)}function wo(e,t,n){e.setQueryData(g.decofileDraft(We(t)),n)}function So(e,t){return e.getQueryData(g.decofileDraft(We(t)))??null}async function yo(e,t){return(await fetch(Ge(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function ss(e){const t=$.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?We(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Eo,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r??null}async function Eo(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function Oo(e,t){const n=await fetch(Ge(t),{cache:"no-store"});if(!n.ok){const r=new Error(`Failed to fetch decofile: ${n.status}`);throw r.status=n.status,r}const o=await n.json();return o.token&&wo(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function is(e,t){const n=await fetch(Ge(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const r=await n.json().catch(()=>({}));throw r.code==="block-conflict"?new Je(r.blocks??[],r.error??"Block changed"):new Error(r.error??`Save failed (${n.status})`)}if(!n.ok)return mo(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const Ft=3e3,Do=15e3,ko=2*6e4,Qt={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function _o(e){return e<ko?Ft:Do}function Io(e,t=Qt){const n=t.now();let o=!1,r=!1,s=null;const i=()=>{o||(s=t.setTimeout(a,_o(t.now()-n)))},a=()=>{if(s=null,o)return;const{read:l,skip:c}=e();if(r||t.hidden()||c?.()){i();return}r=!0;let f;try{f=l()}catch{f=void 0}Promise.resolve(f).catch(()=>{}).finally(()=>{r=!1}),i()};return i(),()=>{o=!0,s!==null&&t.clearTimeout(s)}}const ht=()=>0;function To(e,t,n=Qt){const o=L.useRef(t);o.current=t;const[r]=L.useState(()=>({polling:()=>Io(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?r.polling:r.idle,ht,ht)}function Vt(e,t){return be(e,t)}function Po(e,t){return be(e,"preview-fetch",{path:t})}function as(e){return Vt(e,"preview-invoke")}function cs(e){return Vt(e,"catalog-invoke")}function Bt(e){try{const{hostname:t}=new URL(e);return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="::1"}catch{return!1}}function Ro(){if(typeof document>"u")return null;const e=Array.from(document.querySelectorAll("iframe"));for(const t of e){const n=t.getAttribute("src");if(n&&Bt(n))return n}return null}function xo(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Ro();return n&&Bt(n)?new URL(t,n).toString():Po(e,t)}function $o(e){return xo(e,"/.decofile")}function No(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function gt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function jo(e,t){const n=be(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),r=No(o.status);if(r==="absent")return{kind:"absent"};if(r==="unavailable")return{kind:"unavailable"};if(r==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const s=await o.json();return typeof s.content!="string"?{kind:"unavailable"}:{kind:"data",data:Cn(s.content)}}async function Co(e,t){const n=await jo(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function ls(e){const t=`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}/meta`,n=await fetch(t,{cache:"no-store"});if(n.status===404)return{kind:"absent"};if(!n.ok){const o=new Error(`Failed to read committed meta: ${n.status}`);throw o.status=n.status,o}try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Ao(e){return Ce(e)?.metadata?.runtime?.path??null}class Ht extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function us(e){return e instanceof P&&e.code===S.Conflict}function Jt(e){const t=e.data?.violations;return!Array.isArray(t)||t.length===0?e.message:t.slice(0,3).map(n=>n.message).join("; ")}class Ye extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class ze extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function fs(e,t){return(t instanceof Ye||t instanceof ze)&&(t.message=Wt(e,t,"github")),t}function Wt(e,t,n){if(t instanceof Ye)return e("siteEditor.save.draftUnread");if(t instanceof ze)return e("siteEditor.save.keptChanging");if(t instanceof Je)return t.message;if(n==="local")return Mo(e,t);if(t instanceof P)switch(t.code){case S.Conflict:return e("siteEditor.save.conflict");case S.ReadOnly:return e("siteEditor.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("siteEditor.save.invalid");case S.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function Uo(e,t){if(t==="local"||e instanceof Je||e instanceof Ye||e instanceof ze)return null;if(e instanceof P){const n=e.code===S.InvalidBlock||e.code===S.InvalidParams?Jt(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Mo(e,t){if(t instanceof Ht)return e("decoServe.save.serverGone");if(t instanceof P)switch(t.code){case S.Conflict:return e("decoServe.save.conflict");case S.ReadOnly:return e("decoServe.save.readOnly");case S.InvalidBlock:case S.InvalidParams:return e("decoServe.save.invalid",{detail:Jt(t)});case S.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Lo(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function Fo(e,t){const[n,o]=L.useState(e),r=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){r.current??=Date.now();return}if(!n)return;const s=()=>{r.current=null,o(!1)},i=Lo(r.current,Date.now(),t);if(i===0){s();return}const a=setTimeout(s,i);return()=>clearTimeout(a)},[e,n,t]),n}const Qo="decocms:content-writes",Te=new Set;let G;function Gt(){if(G!==void 0)return G;G=null;try{typeof BroadcastChannel=="function"&&(G=new BroadcastChannel(Qo),G.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Te])n(t)}))}catch{G=null}return G}function Vo(e){try{Gt()?.postMessage({cacheKey:e})}catch{}}function Bo(e){return Gt(),Te.add(e),()=>{Te.delete(e)}}const Yt="__at=",zt="__test=",Ho=/^[0-9a-f]{12}-[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function Jo(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function X(e){return typeof e=="string"&&Ho.test(e)}function vt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Wo(e){const t=e.tests??{};return[...e.at!==void 0?[Yt+vt(e.at)]:[],...Object.keys(t).map(n=>zt+vt(`${n}=${t[n]?"on":"off"}`))]}function pt(e,t){const o=[...e.split("&").filter(r=>r&&!r.startsWith(Yt)&&!r.startsWith(zt)),...t];return o.length>0?`?${o.join("&")}`:""}function he(e,t){const n=Wo(t),o=e.indexOf("?"),r=o===-1?e:e.slice(0,o);if(X(r))return r+pt(o===-1?"":e.slice(o+1),n);const s=e.lastIndexOf("@");if(s<=0)return e;const i=e.slice(0,s),a=i.indexOf("?"),l=a===-1?i:i.slice(0,a),c=a===-1?"":i.slice(a+1);return`${l}${pt(c,n)}${e.slice(s)}`}function ds(e,t,n){if(!Jo(t))return e;try{const o=new URL(e),r=o.searchParams.get("__draft");return r&&r!=="off"?(o.searchParams.set("__draft",he(r,t)),o.toString()):X(n)?(o.searchParams.set("__draft",he(n,t)),o.toString()):e}catch{return e}}function hs(e,t,n="/"){if(!e||!X(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function Xt(e){return btoa(encodeURIComponent(e))}function gs(e,t,n){const o=Go(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Go(e,t,n){const o=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return r.searchParams.set("path","/"),r.searchParams.set("pathTemplate","/"),r.searchParams.set("props",Xt(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),r}const Yo="__draft";function vs(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const zo="off";function Xo(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Yo,t),n.toString()}function ps(e){const t=e.pageBlock.__resolveType;if(typeof t!="string"||!t)return null;const n=new URL(e.previewBaseUrl).origin,o=new URL(`/live/previews/${encodeURIComponent(t)}`,n);o.searchParams.set("__decoFBT","0"),o.searchParams.set("__d",""),o.searchParams.set("path",e.path),o.searchParams.set("pathTemplate",e.pathTemplate);const{__resolveType:r,...s}=e.pageBlock,i=JSON.stringify({__props:s,__decofile:e.decofile});return{src:o.toString(),body:i}}function bs(e,t,n,o){const r=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,r);s.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),s.searchParams.set("props",Xt(JSON.stringify({sections:i}))),s.toString()}function ms(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const bt="__variant=";function Zt(e,t,n){return`${e}@${t}=${n}`}function ws(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[Zt(e,"sections",t.index)]}function Ss(e){const t=Array.isArray(e.mvObj.variants)?e.mvObj.variants:[];if(!e.pageKey||e.sectionIndex<0)return[];if(e.selectedVariantIndex<0||e.selectedVariantIndex>=t.length)return[];const o=`${e.page.multivariate?`sections.variants.${e.page.index}.value${e.page.lazyValues?".value":""}`:"sections"}.${e.sectionIndex}${e.sectionLazy?".section":""}`;return[Zt(e.pageKey,o,e.selectedVariantIndex)]}function ys(e,t){return[...t,...e]}function Zo(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Xe(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),r=o.indexOf("?"),s=r===-1?o:o.slice(0,r),a=[...r===-1?[]:o.slice(r+1).split("&").filter(c=>c&&!c.startsWith(bt)),...t.map(c=>bt+Zo(c))],l=a.length>0?`?${a.join("&")}`:"";return`${s}${l}${e.slice(n)}`}function Es(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),r=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return Xe(`${r}${o.pathname}@local`,t)}catch{return null}}function Os(e,t){if(t.length===0)return e;try{const n=new URL(e),o=n.searchParams.get("__draft");return!o||o==="off"?e:(n.searchParams.set("__draft",Xe(o,t)),n.toString())}catch{return e}}function qo(e){const{pointer:t}=e;if(!t||t===zo)return null;const n=t.indexOf("?");return X(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:X(e.heldRevision)&&e.forcedVariants.length===0?he(e.heldRevision,e.previewOptions):he(Xe(t,e.forcedVariants),e.previewOptions)}function Ko(e,t){if(!e||!t)return null;try{return Xo(e,t)}catch{return null}}function Ds(e,t,n){if(!e||!n)return null;try{return Ko(new URL(t,e).toString(),n)}catch{return null}}const ge={forcedVariants:[],previewOptions:{}},se=new Map,ie=new Map,Pe=new Map;function qt(e){for(const t of Pe.get(e)??[])t()}function Kt(e,t){const n=X(t)?t:null;(ie.get(e)??null)!==n&&(n?ie.set(e,n):ie.delete(e),qt(e))}function er(e){return ie.get(e)??null}function tr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ks(e,t){const n=se.get(e)??ge,o=t??ge;tr(n,o)||(t?se.set(e,o):se.delete(e),qt(e))}function nr(e){return se.get(e)??ge}function en(e,t){let n=Pe.get(e);return n||(n=new Set,Pe.set(e,n)),n.add(t),()=>{n.delete(t)}}function or(e){const t=$.c(3);let n,o;return t[0]!==e?(n=r=>en(e,r),o=()=>nr(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,rr)}function rr(){return ge}function sr(e){const t=$.c(3);let n,o;return t[0]!==e?(n=r=>e?en(e,r):ar,o=()=>e?er(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,ir)}function ir(){return null}function ar(){}function _s(e,t){const n=$.c(4),o=or(e),r=sr(e);let s;return n[0]!==o||n[1]!==r||n[2]!==t?(s=qo({pointer:t,heldRevision:r,...o}),n[0]=o,n[1]=r,n[2]=t,n[3]=s):s=n[3],s}const tn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},cr=15e3,ve=new Map;function z(e,t){return`${e}/${t}`}function H(e){let t=ve.get(e);return t||(t={state:tn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},ve.set(e,t)),t}function W(e,t){const n=H(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Se(e){e.timer&&clearTimeout(e.timer),e.timer=null}function Ze(e){return ve.get(e)?.state??tn}function lr(e,t){const n=H(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Is(e){const t=H(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Se(t),W(e,{phase:"idle"}))}}function Ts(e){const t=ve.get(e);!t||t.state.phase!=="reloading"||(Se(t),W(e,{phase:"idle"}))}function nn(e){const t=H(e);Se(t),W(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ae(e,t){const n=H(e),o=Math.max(0,n.state.inFlight-1);if(o>0){W(e,{inFlight:o});return}if(!t.ok||n.previews===0){W(e,{phase:"idle",inFlight:o});return}on(e,t.navigates,o)}function on(e,t,n=0){const o=H(e);Se(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&W(e,{phase:"idle"})},cr),W(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function ur(e){return e?.kind==="protocol"&&e.source==="github"}async function ce(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s,backend:i,cacheKey:a}=e,l=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,r)}):null;if(i?.kind!=="protocol")return await l,{navigates:!1};const c=s?g.protocolDraftRead(o,r,s):null,f=c?JSON.stringify(n.getQueryData(c)??null):null,u=l?[l]:[];if(a&&t.reread&&u.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&u.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),s&&i.source==="sandbox"&&u.push(n.invalidateQueries({queryKey:Ln(o,r,s)})),ur(i)&&c&&!t.adopted&&u.push(n.invalidateQueries({queryKey:c})),await Promise.all(u),t.kind!=="edit"){const p=z(o,r);W(p,{epoch:Ze(p).epoch+1})}const d=c?JSON.stringify(n.getQueryData(c)??null):null,h=f!==d;return h&&await new Promise(p=>Ot.schedule(p)),{navigates:h}}async function fr(e,t){return nn(z(e.orgSlug,e.virtualMcpId)),rn(e,t)}function mt(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function rn(e,t){const n=z(e.orgSlug,e.virtualMcpId),o=t.adopted?mt(e):null;let r;try{r=await t.write()}catch(i){throw ae(n,{ok:!1,navigates:!1}),t.refreshOnError&&ce(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&Vo(e.cacheKey),Kt(n,t.shownRevision?.(r)??null),t.adopted){const i=mt(e)!==o;return i&&await new Promise(a=>Ot.schedule(a)),ae(n,{ok:!0,navigates:i}),t.reread&&ce(e,t).catch(()=>{}),r}let s=!1;try{({navigates:s}=await ce(e,t))}catch{}finally{ae(n,{ok:!0,navigates:s})}return r}function Ps(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:r,branch:s}=e,i=z(o,r),a=new Set(t.blockKeys);for(const f of[...H(i).discardListeners])f(a);nn(i);let l=!1;const c=()=>(l=!0,rn(e,{kind:"discard",reread:!0,write:t.write}));return s?n.getMutationCache().build(n,{mutationKey:we(o,r,s),scope:bo(o,r,s),mutationFn:c}).execute(void 0).catch(f=>{throw l||ae(i,{ok:!1,navigates:!1}),f}):c()}function Rs(e,t,n){const o=$.c(8);let r;o[0]!==e||o[1]!==t?(r=z(e,t),o[0]=e,o[1]=t,o[2]=r):r=o[2];const s=r;let i;o[3]!==n||o[4]!==s?(i=()=>{const l=H(s).discardListeners;return l.add(n),()=>{l.delete(n)}},o[3]=n,o[4]=s,o[5]=i):i=o[5];let a;o[6]!==s?(a=[s],o[6]=s,o[7]=a):a=o[7],L.useEffect(i,a)}function sn(e){const t=z(e.orgSlug,e.virtualMcpId);Ze(t).inFlight>0||(Kt(t,null),ce(e,{kind:"external"}).then(({navigates:n})=>{const o=H(t);o.previews>0&&o.state.inFlight===0&&on(t,n)}).catch(()=>{}))}function dr(e,t){const n=$.c(7);let o;n[0]!==e||n[1]!==t?(o=z(e,t),n[0]=e,n[1]=t,n[2]=o):o=n[2];const r=o;let s;n[3]!==r?(s=c=>lr(r,c),n[3]=r,n[4]=s):s=n[4];const i=s;let a;n[5]!==r?(a=()=>Ze(r),n[5]=r,n[6]=a):a=n[6];const l=a;return L.useSyncExternalStore(i,l,l)}const hr=500;function xs(e,t){const{phase:n}=dr(e,t);return Fo(n!=="idle",hr)}function gr(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function an(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function $s(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Tn(i,n):vr(e,t,n)}const r=e.getQueryData(g.contentVersions(t));if(!r)return;if(Object.hasOwn(r,n))return r[n];const s=e.getQueryData(g.decofile(t));return s&&Object.hasOwn(s,n)?void 0:null}function ee(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=B(t),o=Object.keys(e.changes).find(r=>B(r)===n);return o===void 0?void 0:e.changes[o]}function vr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return cn(o,ye(e,t),n)}function cn(e,t,n){const o=ee(e,n);return o?.kind==="delete"?o.version??ue:o?o.version:t.has(B(n))?ue:null}function Ns(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const r=ee(o,n);return r?r.kind==="set"&&r.baseVersion===null:ye(e,t).has(B(n))}function js(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const r=ye(e,t);return{blocks:n,versionOf:s=>cn(o,r,s)}}function ye(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function pe(e,t,n,o){const r=B(n),s=ye(e,t);s.has(r)!==o&&(o?s.add(r):s.delete(r),Z(e),e.setQueryData(g.contentDraftTombstones(t),[...s]))}function ln(e,t,n,o){const r=o.revision,s=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([u,d])=>[u,d===ue?null:d]),a=e.getQueryData(g.contentChanges(n)),l=new Set(i.flatMap(([u])=>{const d=a?ee(a,u):void 0;return(d?d.baseVersion:s?.[u]??null)===null?[u]:[]})),c=new Set(i.flatMap(([u,d])=>d===null?[]:[B(u)]));e.setQueryData(g.contentChanges(n),u=>{if(!u)return u;const d={...u.changes};for(const[h,p]of i){const v=ee(u,h),w=v?v.baseVersion:s?.[h]??null;p!==null?d[h]={kind:"set",version:p,baseVersion:w}:w!==null?d[h]={kind:"delete",version:null,baseVersion:w}:delete d[h]}return{...u,changes:d,edited:!0}});for(const[u,d]of i)d!==null?pe(e,n,u,!1):!c.has(B(u))&&l.has(u)&&pe(e,n,u,!0);const f=o.revision;return f&&f!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),u=>u&&{...u,version:f}),r}function Ee(e,t,n){Z(e),e.setQueryData(g.contentVersions(t),o=>{const r={...o};for(const[s,i]of Object.entries(n))i===null?delete r[s]:r[s]=i;return r})}function un(e,t){const n=e.getMutationCache().findAll({mutationKey:we(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>eo(o.state.variables)))}function Re(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function te(e,t,n,o){try{return await o()}catch(r){const s=!(r instanceof P);throw t.source==="local"&&s?(Re(e,n),new Ht(r)):(t.source==="local"&&Me(r)&&Re(e,n),r)}}const le=new Map;function fn(e,t,n,o){const r=le.get(o);if(r)return r;const s=qe(e,t,n,o,!0);return le.set(o,s),s.finally(()=>le.delete(o))}const Oe=new Set;function pr(e,t,n){const o=$.c(8),r=ne(),s=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let l,c;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==s||o[4]!==r||o[5]!==i?(l=()=>{if(!e||!s||!i||!a)return;const f={orgSlug:s,virtualMcpId:i,branch:a};return Bo(u=>{u===n&&(Oe.has(n)||(Oe.add(n),mr(r,e,f,n).catch(br).finally(()=>Oe.delete(n))))})},c=[r,e,s,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=s,o[4]=r,o[5]=i,o[6]=l,o[7]=c):(l=o[6],c=o[7]),L.useEffect(l,c)}function br(){}async function mr(e,t,n,o){const r=le.get(o);return r&&await r.catch(()=>{}),fn(e,t,n,o)}async function qe(e,t,n,o,r){Z(e);const s=g.decofile(o),i=an(n,t),a=g.contentRevision(o),l=g.contentVersions(o),c=e.getQueryData(s),f=e.getQueryData(l),d=e.getQueryData(i),h=e.getQueryData(a)??void 0,p=r&&c&&f?h?.revision:void 0,v=r&&d?h?.schemaVersion:void 0,w=g.contentChanges(o),_=e.getQueryData(w);if(t.source==="github"&&t.hosted)return wr(e,t,t.hosted,n,o,{conditional:r,seen:h,currentMeta:d,schemaIfNoneMatch:v,seenChanges:_});const[E,R,I]=await te(e,t,n,()=>t.client.batch([{method:"blocks.list",params:p?{ifNoneMatch:p}:{}},{method:"schema.get",params:v?{ifNoneMatch:v}:{}},{method:"changes.list",params:Ue(_)}])),N=e.getQueryData(a)?.revision,x=N!==void 0&&N!==h?.revision;if(I?.ok){const O=x?null:fe(_,I.result);O&&e.setQueryData(w,O)}else I&&t.source==="local"&&Me(I.error)&&Re(e,n);if(!E?.ok)throw E?.error??new Error("no blocks.list");if(!R)throw new Error("no schema.get");const b=E.result,U=Qe(R),D=R.ok&&!U?R.result:null;if(b.notModified&&(!c||!f)||D?.notModified&&!d)return qe(e,t,n,o,!1);const T=b.notModified?new Set:un(e,n),j=b.notModified?c:Kn(b.blocks,c,T),C=U?Mt():D?D.notModified?d:D.schema:R.error;if(e.setQueryData(a,{revision:x?N:b.notModified?h?.revision:b.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(s,j),!b.notModified){const O=e.getQueryData(l),M={...b.versions};for(const A of T){const k=O?.[A];k!==void 0?M[A]=k:delete M[A]}e.setQueryData(l,M)}return C instanceof P||e.setQueryData(i,C),!x&&!b.notModified&&c&&h?.revision&&b.revision!==h.revision&&sn({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:j,meta:C}}async function wr(e,t,n,o,r,s){const i=g.decofile(r),a=g.contentIndex(r),l=g.contentRevision(r),c=g.contentVersions(r),f=an(o,t),u=g.contentChanges(r),d=e.getQueryData(a),h=s.conditional&&d?s.seen?.revision:void 0,[p,v,w]=await te(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:s.schemaIfNoneMatch?{ifNoneMatch:s.schemaIfNoneMatch}:{}},{method:"changes.list",params:Ue(s.seenChanges)}])),_=e.getQueryData(a)??d,E=e.getQueryData(l)?.revision,R=E!==void 0&&E!==s.seen?.revision;if(w?.ok&&!R){const y=fe(s.seenChanges,w.result);y&&e.setQueryData(u,y)}if(!p?.ok)throw p?.error??new Error("no cms.index");if(!v)throw new Error("no schema.get");const I=p.result,N=Qe(v),x=v.ok&&!N?v.result:null;if(I.notModified&&!d||x?.notModified&&!s.currentMeta)return qe(e,t,o,r,!1);const b=N?Mt():x?x.notModified?s.currentMeta:x.schema:v.error;b instanceof P||e.setQueryData(f,b);const U=x?x.notModified?s.seen?.schemaVersion:x.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||R)return e.setQueryData(l,{revision:R?E:s.seen?.revision,schemaVersion:U}),e.setQueryData(i,D),{blocks:D,meta:b};const T={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,T);const j=!!s.seen?.revision&&T.revision!==s.seen.revision&&(!s.seen.revision.startsWith("s-")||!!d&&dn(d.draft,T.draft));j&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),y=>y&&{...y,version:T.revision}),e.setQueryData(l,{revision:T.revision,schemaVersion:U});const C=un(e,o),O=e.getQueryData(c)??{},M={},A={},k=[];for(const[y,V]of Object.entries(D)){const m=T.entries[y];!m&&!C.has(y)||(M[y]=V,O[y]!==void 0&&(A[y]=O[y]),m&&!C.has(y)&&O[y]!==m.version&&k.push(y))}return e.setQueryData(i,M),e.setQueryData(c,A),k.length>0&&await xn(e,n,r,k,C),_&&j&&Sr(_,T)&&sn({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:r}),{blocks:e.getQueryData(i)??M,meta:b}}function Sr(e,t){if(dn(e.draft,t.draft))return!0;const n=Object.keys(t.entries);return n.length!==Object.keys(e.entries).length?!0:n.some(o=>!Object.hasOwn(e.entries,o)||e.entries[o]?.version!==t.entries[o]?.version)}function dn(e,t){const n=Object.keys(t);return n.length!==Object.keys(e).length?!0:n.some(o=>!Object.hasOwn(e,o)||e[o]?.version!==t[o]?.version)}function yr(e,t){const n=[...Object.keys(t.set??{}),...t.delete??[]];return Object.fromEntries(n.filter(o=>Object.hasOwn(e,o)).map(o=>[o,e[o]]))}function wt(e){if(!(e instanceof P)||e.code!==S.Unavailable)return;const t=e.data?.landed;if(!(!t||typeof t!="object"||Array.isArray(t)))return Object.fromEntries(Object.entries(t).filter(n=>typeof n[1]=="string"))}function Er(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([r])=>!Object.hasOwn(t,r))),o=(e.delete??[]).filter(r=>!Object.hasOwn(t,r));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function St(e,t,n,o,r){Z(e),ln(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:r}),Ee(e,n,Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i===ue?null:i]))),Dt(e,n,r,o.set??{})}async function Cs(e,t,n,o,r,s){if(t.source==="github"){const a=[...Object.keys(r.set??{}),...r.delete??[]].filter(c=>!s||!Object.hasOwn(s,c));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const l=In(r.set);if(l.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${l.join(", ")})`)}return fr({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o},{kind:"edit",adopted:t.source==="github",write:async()=>{const i=f=>te(e,t,n,()=>t.client.blocksApply({set:f.set,delete:f.delete,...s?{ifMatch:yr(s,f)}:{}}));let a;try{a=await i(r)}catch(f){const u=t.source==="github"?wt(f):void 0;if(!u)throw f;const d=Er(r,u);Object.keys(u).length>0&&St(e,n,o,r,u);let h;try{h=await i(d)}catch(p){const v=wt(p);throw v&&Object.keys(v).length>0&&St(e,n,o,d,v),p}a={...h,versions:{...u,...h.versions}}}Z(e);const l=t.source==="github"?ln(e,n,o,a):a.revision;t.source==="github"&&Dt(e,o,a.versions??{},r.set??{}),e.setQueryData(g.contentRevision(o),f=>({...f,revision:l}));const c=a.versions??{};return Ee(e,o,c),{revision:l,versions:c}}})}function hn(e,t){if(!(e instanceof P))return;const n=e.data?.draft;if(!n||typeof n!="object"||!Object.hasOwn(n,t))return;const o=n[t];return o&&typeof o.version=="string"?o:void 0}function gn(e,t,n){if(!(n instanceof P))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[r,s]of Object.entries(o))s===null&&pe(e,t,r,!1)}function vn(e,t,n,o){Z(e),Pn(e,n,o);const r=o.block===null,s=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=i?ee(i,n):void 0,l=a?a.baseVersion:s?.[n]??null;if(i){const c=B(n),f=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(u)!==c));r?l!==null&&(f[n]={kind:"delete",version:null,baseVersion:l}):f[n]={kind:"set",version:o.version,baseVersion:l},e.setQueryData(g.contentChanges(t),{...i,changes:f,edited:!0})}pe(e,t,n,r&&l===null),e.setQueryData(g.decofile(t),c=>{const f={...c};return r?delete f[n]:f[n]=o.block,f}),Ee(e,t,{[n]:r?null:o.version}),Rn(e,t,n,o)}function As(e,t,n,o){if(t.source!=="github"||!(o instanceof P))return!1;gn(e,n,o);const r=o.data?.draft;if(!r||typeof r!="object")return!1;const s=Object.keys(r),i=s.map(a=>hn(o,a));return s.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),s.forEach((a,l)=>{vn(e,n,a,i[l])}),!0)}async function Us(e,t,n,o,r,s){t.source==="github"&&gn(e,o,s);const i=t.source==="github"?hn(s,r):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),vn(e,o,r,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const c=(await te(e,t,n,()=>t.client.changesGet({names:[r]}))).entries[r];if(c&&c.after===null&&c.version!==null)return!1;a={value:c?.after??null,version:c?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),f=>{if(!f)return f;const u={...f.changes};return c?.kind?u[r]={kind:c.kind,version:c.version,baseVersion:c.baseVersion}:delete u[r],{...f,changes:u,edited:!0}})}catch{const l=await te(e,t,n,()=>t.client.blocksList({}));if(l.notModified)return!1;a={value:l.blocks[r]??null,version:l.versions[r]??null}}return e.setQueryData(g.decofile(o),l=>{const c={...l};return a.value===null?delete c[r]:c[r]=a.value,c}),Ee(e,o,{[r]:a.version}),!1}function Or(e){const t=$.c(17),n=Ce(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=yt(n),t[0]=n,t[1]=o):o=t[1];const r=o;let s;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(s=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=s):s=t[5];let i;t[6]!==e||t[7]!==r?(i=async()=>{const v=await Et(r,e.branch),w=v.pointer?.lastIndexOf("@")??-1;return{draft:v.pointer&&w>0?v.pointer.slice(0,w):null,version:v.pointer&&w>0?v.pointer.slice(w+1):v.etag}},t[6]=e,t[7]=r,t[8]=i):i=t[8];const a=!!e&&!!r;let l;t[9]!==s||t[10]!==i||t[11]!==a?(l={queryKey:s,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=s,t[10]=i,t[11]=a,t[12]=l):l=t[12];const{data:c,isPending:f,isError:u}=F(l),d=!!e&&!!r&&f&&!u;if(!e||!c?.draft||!c.version){let v;return t[13]!==d?(v={pointer:null,pending:d},t[13]=d,t[14]=v):v=t[14],v}const h=`${c.draft}@${c.version}`;let p;return t[15]!==h?(p={pointer:h,pending:!1},t[15]=h,t[16]=p):p=t[16],p}function Ms(e){return Or(e).pointer}function Ls(e){const t=$.c(4);let n;t[0]!==e?(n=g.contentRevision(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Dr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:r}=F(o);return r?.revision}async function Dr(){throw new Error("content revisions are set by reads and writes")}function xe(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function Fs(e,t){return xe({...e,protocolSuffix:t.cacheKeySuffix})}function Ke(e,t){const n=$.c(6),{url:o}=Lt(e?.virtualMcpId),r=me(e?.virtualMcpId,e?.branch);if(!e)return"";let s;return n[0]!==r.cacheKeySuffix||n[1]!==r.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(s=r.kind==="protocol"?xe({...e,protocolSuffix:r.cacheKeySuffix}):xe({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=r.cacheKeySuffix,n[1]=r.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=s):s=n[5],s}function Qs(e,t){const n=$.c(46),{url:o}=Lt(e?.virtualMcpId),r=!!o,s=me(e?.virtualMcpId,e?.branch),i=s.kind==="protocol"?s:null,a=Ke(e),l=t?.fetchEnabled??!0,c=Ao(e?.virtualMcpId),f=_t(e?.virtualMcpId).runtime==="cms",u=ne();let d;n[0]!==a?(d=g.decofile(a),n[0]=a,n[1]=d):d=n[1];const h=d;pr(i,i&&e?e:null,a);let p;n[2]!==e||n[3]!==u||n[4]!==h?(p=()=>{if(!e||u.isMutating({mutationKey:we(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const O=u.getQueryState(h);return O?.fetchStatus==="fetching"||Date.now()-(O?.dataUpdatedAt??0)<Ft/2},n[2]=e,n[3]=u,n[4]=h,n[5]=p):p=n[5];let v;n[6]!==f||n[7]!==r||n[8]!==e||n[9]!==i||n[10]!==u||n[11]!==h?(v=async()=>{if(e){if(!i&&f&&!r){const O=So(u,e)?.version;if(O&&!await yo(e,O))return}await u.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=f,n[7]=r,n[8]=e,n[9]=i,n[10]=u,n[11]=h,n[12]=v):v=n[12];let w;n[13]!==p||n[14]!==v?(w={skip:p,read:v},n[13]=p,n[14]=v,n[15]=w):w=n[15],To(!!t?.pollWhile&&!!e,w);const _=kt(i?.hosted?a:"");let E;n[16]!==s.kind||n[17]!==f||n[18]!==l||n[19]!==a||n[20]!==r||n[21]!==o||n[22]!==c||n[23]!==e||n[24]!==i||n[25]!==u?(E=async()=>{if(i)return(await fn(u,i,e,a)).blocks;if(s.kind==="unavailable")throw gr("decofile");if(r){const k=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Ir),Q=k?.ok?dt(await k.text()):null;if(Q)return Q;const y=new Error("decofile unavailable (local tunnel unreachable)");throw y.status=502,y}if(f)return Oo(u,e);const O=()=>Co(e,po(c,".deco/blocks.gen.json"));if(l){const k=await fetch($o(e),{cache:"no-store"}).catch(_r);if(k?.ok){const V=dt(await k.text());if(V)return V}const Q=await O();if(Q.kind==="data")return Q.data;const y=new Error(`Failed to fetch decofile: ${k?.status??"network error"}`);throw y.status=gt({liveOk:!!k?.ok,liveStatus:k?.status,committedAbsent:Q.kind==="absent"}),y}const M=await O();if(M.kind==="data")return M.data;const A=new Error("decofile unavailable (preview down, no committed snapshot)");throw A.status=gt({liveOk:!1,committedAbsent:M.kind==="absent"}),A},n[16]=s.kind,n[17]=f,n[18]=l,n[19]=a,n[20]=r,n[21]=o,n[22]=c,n[23]=e,n[24]=i,n[25]=u,n[26]=E):E=n[26];const R=!!e&&s.kind!=="pending",I=i?0:3e4,N=i?.describe.pollIntervalMs,x=i?"always":void 0;let b;n[27]!==f||n[28]!==r||n[29]!==i?(b=(O,M)=>{if(i||f||r)return O<3;const A=M.status;return A!==502&&A!==404&&O<2},n[27]=f,n[28]=r,n[29]=i,n[30]=b):b=n[30];let U;n[31]!==h||n[32]!==E||n[33]!==R||n[34]!==I||n[35]!==N||n[36]!==x||n[37]!==b?(U={queryKey:h,queryFn:E,enabled:R,staleTime:I,refetchInterval:N,refetchIntervalInBackground:!1,refetchOnWindowFocus:x,retry:b,retryDelay:kr},n[31]=h,n[32]=E,n[33]=R,n[34]=I,n[35]=N,n[36]=x,n[37]=b,n[38]=U):U=n[38];const D=F(U);let T;n[39]!==_||n[40]!==D?(T=_&&D.data?$n(_,D.data):void 0,n[39]=_,n[40]=D,n[41]=T):T=n[41];const j=T;let C;return n[42]!==j||n[43]!==i?.hosted||n[44]!==D?(C=i?.hosted&&j?{...D,data:j}:D,n[42]=j,n[43]=i?.hosted,n[44]=D,n[45]=C):C=n[45],C}function kr(e){return jn(5e3,1e3,e,2,0)}function _r(){return null}function Ir(){return null}function Vs(e,t,n){const o=me(e?.virtualMcpId,e?.branch),r=Ke(e),s=o.kind==="protocol"?o.hosted:void 0;return Nn(s,r,t,n)}function Bs(e,t){const n=$.c(3),o=me(e?.virtualMcpId,e?.branch),r=Ke(e),s=kt(o.kind==="protocol"&&o.hosted?r:"");let i;return n[0]!==s?.entries||n[1]!==t?(i=Object.entries(s?.entries??{}).filter(a=>{const[,l]=a;return t(l.meta?.type??"")}).map(Tr),n[0]=s?.entries,n[1]=t,n[2]=i):i=n[2],i}function Tr(e){const[t]=e;return t}const Pr="site-editor-save",pn={id:Pr,description:void 0,action:void 0,cancel:void 0},Hs="site-editor-undo",$e="site-editor-publish";function Rr(e){const t=$.c(7),{label:n,detail:o}=e;let r;t[0]!==n?(r=Y.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=r):r=t[1];let s;t[2]!==o?(s=Y.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=s):s=t[3];let i;return t[4]!==r||t[5]!==s?(i=Y.jsxs("details",{className:"mt-1 text-xs",children:[r,s]}),t[4]=r,t[5]=s,t[6]=i):i=t[6],i}function bn(e,t){return t?Y.jsx(Rr,{label:e("siteEditor.details"),detail:t}):void 0}function Js(e,t,n){K.error(Wt(e,t,n),{...pn,description:bn(e,Uo(t,n))})}function Ws(e,t,n=!1){K.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...pn,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const mn={action:void 0,duration:void 0};function Gs(e,t){K.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...mn,id:$e,description:void 0})}function Ys(e,{headline:t,body:n,detail:o,retry:r,pending:s,tone:i="error"}){const a=bn(e,o??null);K[i](t,{id:$e,description:n&&a?Y.jsxs(Y.Fragment,{children:[Y.jsx("p",{children:n}),a]}):n??a,action:r?{label:e("siteEditor.tryAgain"),onClick:l=>{l.preventDefault(),K.loading(s??e("thread.publishPopover.publishing"),{...mn,id:$e,description:void 0}),r()}}:void 0,duration:r?Number.POSITIVE_INFINITY:void 0})}function zs(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Fs as $,ms as A,xs as B,Kr as C,Or as D,Vs as E,z as F,sr as G,ks as H,Es as I,he as J,zo as K,Xo as L,ds as M,Os as N,gs as O,Ts as P,Is as Q,dr as R,Ke as S,Ct as T,Ls as U,ps as V,bo as W,we as X,fr as Y,jo as Z,mo as _,Xr as a,Br as a0,Jr as a1,Bs as a2,Ws as a3,Ns as a4,fs as a5,Je as a6,us as a7,mr as a8,Ye as a9,gr as aA,ls as aB,ze as aC,As as aD,$e as aE,mn as aF,Gs as aG,Ps as aH,Qr as aI,Vr as aJ,Me as aK,ss as aL,Ms as aM,vs as aN,X as aO,hs as aP,Ys as aQ,Hs as aR,pn as aS,un as aT,bs as aU,cs as aV,ws as aW,Ss as aX,ys as aY,Cs as aa,Us as ab,Js as ac,$s as ad,an as ae,wo as af,is as ag,Rs as ah,js as ai,qr as aj,os as ak,ct as al,lt as am,rs as an,xo as ao,ts as ap,Yn as aq,bn as ar,zs as as,Go as at,Hr as au,Qn as av,Rr as aw,_s as ax,Ds as ay,fn as az,Xn as b,Lt as c,Gn as d,zr as e,zn as f,He as g,Ae as h,xt as i,as as j,Po as k,Qs as l,Zr as m,ns as n,Ao as o,Wr as p,po as q,Yr as r,Gr as s,qo as t,me as u,Ko as v,Jo as w,Co as x,At as y,es as z};
@@ -1 +1 @@
1
- import{b as ee,a5 as te,q as ne,r as E,j as t,B as Q,n as _,bB as ae,a6 as ce,aN as me,aM as pe,aJ as de,aH as ue,aI as ge,aL as fe,aK as he,bj as xe,t as C,c6 as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as H,gw as Ce}from"./index-CoIqGnkT.js";import{a as we}from"./SwitchHorizontal01-AyEyHl5j.js";import{L as De}from"./agent-icon-qder0a6G.js";import{s as Ne}from"./Trash01-CLcCE4W6.js";import{i as Pe}from"./Upload01-CQ4MgovG.js";import{i as ie}from"./Zap-C1zrSwKR.js";import{S as Ae}from"./search-toggle-NGIVu4q_.js";import{E as Y}from"./empty-state-Z2OuiQOQ.js";import{C as Ee}from"./collection-tabs-DJVITgIT.js";import{S as Me,F as Oe}from"./folder-icon-D2Q0oygq.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-DwzY3jVQ.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-CbLWEfcx.js";import{c as Le}from"./context-shell-D4IkyI4F.js";import"./AlertCircle-DlXniLTL.js";import"./Tool01-D54u8MkG.js";import"./ArrowUp-Cy-4CLBm.js";import"./ArrowLeft-DIqRNJY3.js";import"./LinkBroken01-DuElxfIa.js";import"./ShoppingBag01-lKolYH3w.js";import"./Globe04-DgADHmww.js";import"./CheckCircle-DdQJ6K1s.js";import"./ChevronUp-0ZUNuXoh.js";import"./ChevronSelectorVertical-DJwn4vk3.js";import"./UserSquare-DorunsHP.js";import"./CreditCard01-BzR1cQHR.js";import"./Key01-BnGTLStV.js";import"./Minus-DKEGggSd.js";import"./Monitor01-RPmPp9yV.js";import"./Sun-CLH4DOsz.js";import"./Play-CCrxvWEX.js";import"./Plus-Dwl0ymG8.js";import"./SearchMd-Cf7uAP7Q.js";import"./Users01-mVHDEY41.js";import"./XClose-DJErxj2G.js";import"./icon-button-DNR19rRF.js";import"./tooltip-DycNDw2G.js";import"./index-DQFlQUCO.js";import"./badge-CM9VoPn3.js";import"./markdown-BzJtnofQ.js";import"./use-copy-BR702L1I.js";import"./use-mobile-CQqLe5Fj.js";import"./autosend-BuzWxJ_9.js";import"./thread-route-SXxESRM6.js";import"./use-project-scope-C2qD7yC0.js";import"./repository-binding-CyaIIWjt.js";import"./use-mcp-client-DuvY0YQh.js";import"./auth-DXM0rgLv.js";import"./task-board-dajPV_XW.js";import"./schema-BR70Vo5Y.js";import"./file-preview-DrvqFq0i.js";import"./utils-DsMBpUcw.js";import"./editor-BWpbvGUJ.js";import"./file-type-icon-CpyvcXG2.js";import"./useInfiniteQuery-FqvtVI1A.js";import"./infiniteQueryObserver-DAKXTyVS.js";import"./thread-intent-DsvstIYH.js";import"./delay-CnY5UFtP.js";import"./watch-sse-pool-DwGCR27q.js";import"./use-entitlements-DU-An4VI.js";import"./use-ai-providers-CT41YQMU.js";import"./use-decopilot-events-BHP9on7q.js";import"./use-organization-settings-CZAS8Fwc.js";import"./require-capability-DrZOeXFb.js";import"./access-gate-C2fRlAo_.js";import"./capability-load-error-BlktRdv_.js";import"./sections-DP49hK6v.js";import"./textarea-DH4lLGjS.js";import"./use-ask-in-chat-CuTdZYOa.js";import"./shell-layout-BN9dcRYV.js";import"./use-deployment-admin-BhTKxM6k.js";import"./admin-fetch-BhTJlAsX.js";import"./command-3SMlch0Q.js";import"./index-Czbh2wlZ.js";import"./integration-icon-DwBMZgrw.js";import"./project-icon-Uszb7VXV.js";import"./use-navigate-to-agent-BP-fuYpJ.js";import"./new-project-dialog-CYkZ_7Mu.js";import"./label-Cz3ISXTG.js";import"./repository-picker-ERyaEscX.js";import"./github-icon-CgGTVNey.js";import"./collection-search-DVuo1pjJ.js";import"./use-debounced-value-DlRWnR28.js";import"./required-auth-layout-OBk7IzAK.js";import"./use-org-sso-B3MWcxrY.js";const J=200,_e=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Fe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!_e.has(e))}function Be(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ke(s,e){const i=new Map;for(const o of s){const c=G(o).split("/");c.pop();const a=["skills",e,...c].join("/");i.set(a,[...i.get(a)??[],o])}return i}async function qe(s,e){const o=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(o)throw o.reason}function He(s,e){const i=Le(e),o=`skills/${s}`;return{id:`home/${o}`,name:i.name??s,description:i.description,disableModelInvocation:i.disableModelInvocation,source:"home",volume:Z,path:o,sandboxPath:`${ze}/${Z}/${o}`}}const F="*";function B(s){return s.volume==="home"}function re(s,e){const i=s.indexOf(":");return i===-1?{label:e,glyph:ie}:{label:s.slice(i+1),glyph:s.startsWith("repo:")?je:De}}function Qe(s){const e=se.c(48),{entry:i,pending:o,onOpen:c,onDelete:a}=s,n=ee(),{org:g}=te();let M;e[0]!==i.source||e[1]!==g.name?(M=re(i.source,g.name),e[0]=i.source,e[1]=g.name,e[2]=M):M=e[2];const{label:O,glyph:I}=M;let w;e[3]!==i?(w=B(i),e[3]=i,e[4]=w):w=e[4];const R=w,D=o?"opacity-60":"hover:bg-accent";let f;e[5]!==D?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",D),e[5]=D,e[6]=f):f=e[6];let m;e[7]!==i.name||e[8]!==c||e[9]!==o?(m=!o&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":i.name}),e[7]=i.name,e[8]=c,e[9]=o,e[10]=m):m=e[10];const N=R?"default":"system",z=!R;let h;e[11]!==I||e[12]!==N||e[13]!==z?(h=t.jsx(Oe,{glyph:I,tone:N,readOnly:z,className:"size-8 shrink-0"}),e[11]=I,e[12]=N,e[13]=z,e[14]=h):h=e[14];let x;e[15]!==a||e[16]!==n?(x=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ve,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"icon",children:t.jsx(we,{size:16})})}),t.jsx(Se,{align:"end",children:t.jsxs(be,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ne,{size:16}),n("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=n,e[17]=x):x=e[17];let j;e[18]!==h||e[19]!==x?(j=t.jsxs("div",{className:"flex items-start justify-between",children:[h,x]}),e[18]=h,e[19]=x,e[20]=j):j=e[20];let b;e[21]!==i.name?(b=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.name}),e[21]=i.name,e[22]=b):b=e[22];let k;e[23]!==i.description||e[24]!==n?(k=i.description||n("settings.skills.noDescription"),e[23]=i.description,e[24]=n,e[25]=k):k=e[25];let p;e[26]!==k?(p=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:k}),e[26]=k,e[27]=p):p=e[27];let v;e[28]!==b||e[29]!==p?(v=t.jsxs("div",{className:"flex flex-col gap-1",children:[b,p]}),e[28]=b,e[29]=p,e[30]=v):v=e[30];let d;e[31]!==j||e[32]!==v?(d=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[j,v]}),e[31]=j,e[32]=v,e[33]=d):d=e[33];let y;e[34]!==O||e[35]!==o||e[36]!==n?(y=o?n("settings.skills.importing"):O,e[34]=O,e[35]=o,e[36]=n,e[37]=y):y=e[37];let u;e[38]!==y?(u=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y})})}),e[38]=y,e[39]=u):u=e[39];let S;e[40]!==d||e[41]!==u?(S=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[d,u]}),e[40]=d,e[41]=u,e[42]=S):S=e[42];let T;return e[43]!==o||e[44]!==S||e[45]!==f||e[46]!==m?(T=t.jsxs(Ce,{size:"flush","aria-busy":o,className:f,children:[m,S]}),e[43]=o,e[44]=S,e[45]=f,e[46]=m,e[47]=T):T=e[47],T}function V(s){const e=se.c(2),{children:i}=s;let o;return e[0]!==i?(o=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:i}),e[0]=i,e[1]=o):o=e[1],o}function Ss(){const s=ee(),{org:e}=te(),i=Te(),{remove:o,upload:c}=Ie("home"),a=ne(),n=E.useRef(null),[g,M]=E.useState(""),[O,I]=E.useState(F),[w,R]=E.useState(!1),[D,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:H.slashSkills(e.id)}),a.invalidateQueries({queryKey:H.orgFsSkills(e.id)})},j=r=>a.setQueryData(H.slashSkills(e.id),l=>r(l??[]));async function b(r){const l=[...r??[]];if(n.current&&(n.current.value=""),l.length===0)return;const P=l[0]?.webkitRelativePath??"";if(!P){C.error(s("settings.skills.importNeedsFolder"));return}const q=P.split("/")[0]??"",L=l.filter(Fe),U=L.find(A=>G(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(L.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(L.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let W=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}W=!0;const A=He($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(L,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){W&&await o.mutateAsync(X).catch(()=>{}),C.error(A instanceof Error?A.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=g.toLowerCase(),p=(i.data??[]).filter(r=>r.name.toLowerCase().includes(k)||(r.description??"").toLowerCase().includes(k)).sort((r,l)=>Number(B(l))-Number(B(r))||r.name.localeCompare(l.name)),v=new Set((i.data??[]).map(r=>r.source)),d=new Map;for(const r of p)d.set(r.source,(d.get(r.source)??0)+1);const y=[{id:F,label:s("settings.skills.filterAll"),count:p.length},...[...v].map(r=>({id:r,label:re(r,e.name).label,count:d.get(r)??0}))],u=v.has(O)?O:F,S=u===F?p:p.filter(r=>r.source===u),T=r=>f($e(r.volume,r.path)),K=async()=>{if(!m)return;const{id:r,path:l}=m;N(null),j(P=>P.filter(q=>q.id!==r));try{await o.mutateAsync(l),C.success(s("settings.skills.deleteSuccess"))}catch(P){C.error(P instanceof Error?P.message:s("settings.skills.deleteError"))}finally{x()}},oe=t.jsxs(Q,{size:"sm",disabled:w,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(w?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(_,{children:[t.jsx(_.Content,{children:t.jsx(_.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(_.Actions,{secondary:t.jsx(Ae,{value:g,onChange:M,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:oe}),t.jsx("input",{ref:n,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:r=>{b(r.target.files)}}),y.length>2&&t.jsx(Ee,{placement:"page",tabs:y,activeTab:u,onTabChange:I}),i.isPending?t.jsx("div",{className:"@container",children:t.jsx(V,{children:Array.from({length:8},(r,l)=>t.jsx(ae,{className:"h-[168px] rounded-xl"},l))})}):i.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(ce,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:i.error instanceof Error?i.error.message:s("settings.skills.errorDescription"),actions:t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{i.refetch()},children:s("settings.skills.retry")})})}):S.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(ie,{size:48,className:"text-muted-foreground"}),title:s(g?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:g?s("settings.skills.noResultsDescription",{search:g}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(V,{children:S.map(r=>{const l=r.id===z;return t.jsx(Qe,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),D&&t.jsx(Me,{skillPath:D,onClose:()=>f(null)},D),t.jsx(me,{open:m!==null,onOpenChange:r=>!r&&N(null),children:t.jsxs(pe,{children:[t.jsxs(de,{children:[t.jsx(ue,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(ge,{children:s("settings.skills.deleteDialogDescription",{name:m?.name??""})})]}),t.jsxs(fe,{children:[t.jsx(he,{children:s("settings.skills.cancel")}),t.jsx(xe,{onClick:K,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{Ss as default};
1
+ import{b as ee,a5 as te,q as ne,r as E,j as t,B as Q,n as _,bB as ae,a6 as ce,aN as me,aM as pe,aJ as de,aH as ue,aI as ge,aL as fe,aK as he,bj as xe,t as C,c6 as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as H,gw as Ce}from"./index-Cvc22Qvh.js";import{a as we}from"./SwitchHorizontal01-Dghq_Bvd.js";import{L as De}from"./agent-icon-DD6O0sln.js";import{s as Ne}from"./Trash01-DhMVlpac.js";import{i as Pe}from"./Upload01-hsehoAUh.js";import{i as ie}from"./Zap-aTbgq59l.js";import{S as Ae}from"./search-toggle-pLnMgrhP.js";import{E as Y}from"./empty-state-Drt9QRbX.js";import{C as Ee}from"./collection-tabs-BW9NTpao.js";import{S as Me,F as Oe}from"./folder-icon-swAD3bQU.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-DHnEDbF9.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-tsaqCp6v.js";import{c as Le}from"./context-shell-Bwve3xDx.js";import"./AlertCircle-Cwj2JDLb.js";import"./Tool01-GdBdG6P_.js";import"./ArrowUp-zoWFBt83.js";import"./ArrowLeft-D6im8CSl.js";import"./LinkBroken01-CFo-1erV.js";import"./ShoppingBag01-DUpALglE.js";import"./Globe04-BLpPYUUd.js";import"./CheckCircle-Dycaqr3_.js";import"./ChevronUp-B0uKxpVg.js";import"./ChevronSelectorVertical-Cq__IjWt.js";import"./UserSquare-T5uOviXx.js";import"./CreditCard01-CMHPxKus.js";import"./Key01-KS2Cdqso.js";import"./Minus-CR14C6Ew.js";import"./Monitor01-PjSuNm4O.js";import"./Sun-x19ShBxe.js";import"./Play-DAD0wkps.js";import"./Plus-Caq968Zm.js";import"./SearchMd-BionSqTl.js";import"./Users01-DDaeVlhF.js";import"./XClose-NmocES7U.js";import"./icon-button-BZ9f2Pt9.js";import"./tooltip-C0GWPsi8.js";import"./index-LnWr599j.js";import"./badge-9UZ-oy57.js";import"./markdown-HhU9_nSI.js";import"./use-copy-BGfQrJIh.js";import"./use-mobile-C1stVK0E.js";import"./autosend-BLYIlkXq.js";import"./thread-route-B44higRI.js";import"./use-project-scope-C0EKXyqg.js";import"./repository-binding-B7A7NBUB.js";import"./use-mcp-client-BfCmeMHR.js";import"./auth-Dfx2bf9S.js";import"./task-board-DN88kD7h.js";import"./schema-BH82js-o.js";import"./file-preview-Ca_4k6rv.js";import"./utils-DA49HMaO.js";import"./editor-BODVgWYK.js";import"./file-type-icon-DiS0iV28.js";import"./useInfiniteQuery-P9--kf7E.js";import"./infiniteQueryObserver-CmujZk55.js";import"./thread-intent-Bs-Q7fma.js";import"./delay-CnY5UFtP.js";import"./watch-sse-pool-BI4P-Lkx.js";import"./use-entitlements-wE65MYfi.js";import"./use-ai-providers-BbVlPdZd.js";import"./use-decopilot-events-uSeDcfUe.js";import"./use-organization-settings-a6mUKPHv.js";import"./require-capability-BTBUQsVM.js";import"./access-gate-CpAtBb_h.js";import"./capability-load-error-D8AT7eAw.js";import"./sections-CgO1w_IT.js";import"./textarea-D7HQlMVo.js";import"./use-ask-in-chat-Cp_wqFIx.js";import"./shell-layout-CH0j9rog.js";import"./use-deployment-admin-ShnoFTNr.js";import"./admin-fetch-BhTJlAsX.js";import"./command-B42vqDSm.js";import"./index-DQAtcq3Z.js";import"./integration-icon-DMt85Vdd.js";import"./project-icon-eZOGIGwj.js";import"./use-navigate-to-agent-D2d0cpFU.js";import"./new-project-dialog-BA0jmhgS.js";import"./label-RB5C5N6z.js";import"./repository-picker-CI7xSsin.js";import"./github-icon-tpEVyIwD.js";import"./collection-search-Lm88VC-w.js";import"./use-debounced-value-BF84eZeF.js";import"./required-auth-layout-ClYF4eFR.js";import"./use-org-sso-d82WgyRM.js";const J=200,_e=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Fe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!_e.has(e))}function Be(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ke(s,e){const i=new Map;for(const o of s){const c=G(o).split("/");c.pop();const a=["skills",e,...c].join("/");i.set(a,[...i.get(a)??[],o])}return i}async function qe(s,e){const o=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(o)throw o.reason}function He(s,e){const i=Le(e),o=`skills/${s}`;return{id:`home/${o}`,name:i.name??s,description:i.description,disableModelInvocation:i.disableModelInvocation,source:"home",volume:Z,path:o,sandboxPath:`${ze}/${Z}/${o}`}}const F="*";function B(s){return s.volume==="home"}function re(s,e){const i=s.indexOf(":");return i===-1?{label:e,glyph:ie}:{label:s.slice(i+1),glyph:s.startsWith("repo:")?je:De}}function Qe(s){const e=se.c(48),{entry:i,pending:o,onOpen:c,onDelete:a}=s,n=ee(),{org:g}=te();let M;e[0]!==i.source||e[1]!==g.name?(M=re(i.source,g.name),e[0]=i.source,e[1]=g.name,e[2]=M):M=e[2];const{label:O,glyph:I}=M;let w;e[3]!==i?(w=B(i),e[3]=i,e[4]=w):w=e[4];const R=w,D=o?"opacity-60":"hover:bg-accent";let f;e[5]!==D?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",D),e[5]=D,e[6]=f):f=e[6];let m;e[7]!==i.name||e[8]!==c||e[9]!==o?(m=!o&&t.jsx("button",{type:"button",onClick:c,className:"absolute inset-0 z-0","aria-label":i.name}),e[7]=i.name,e[8]=c,e[9]=o,e[10]=m):m=e[10];const N=R?"default":"system",z=!R;let h;e[11]!==I||e[12]!==N||e[13]!==z?(h=t.jsx(Oe,{glyph:I,tone:N,readOnly:z,className:"size-8 shrink-0"}),e[11]=I,e[12]=N,e[13]=z,e[14]=h):h=e[14];let x;e[15]!==a||e[16]!==n?(x=a&&t.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:t.jsxs(ve,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(Q,{variant:"ghost",size:"icon",children:t.jsx(we,{size:16})})}),t.jsx(Se,{align:"end",children:t.jsxs(be,{variant:"destructive",onClick:K=>{K.stopPropagation(),a()},children:[t.jsx(Ne,{size:16}),n("settings.skills.deleteButton")]})})]})}),e[15]=a,e[16]=n,e[17]=x):x=e[17];let j;e[18]!==h||e[19]!==x?(j=t.jsxs("div",{className:"flex items-start justify-between",children:[h,x]}),e[18]=h,e[19]=x,e[20]=j):j=e[20];let b;e[21]!==i.name?(b=t.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.name}),e[21]=i.name,e[22]=b):b=e[22];let k;e[23]!==i.description||e[24]!==n?(k=i.description||n("settings.skills.noDescription"),e[23]=i.description,e[24]=n,e[25]=k):k=e[25];let p;e[26]!==k?(p=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:k}),e[26]=k,e[27]=p):p=e[27];let v;e[28]!==b||e[29]!==p?(v=t.jsxs("div",{className:"flex flex-col gap-1",children:[b,p]}),e[28]=b,e[29]=p,e[30]=v):v=e[30];let d;e[31]!==j||e[32]!==v?(d=t.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[j,v]}),e[31]=j,e[32]=v,e[33]=d):d=e[33];let y;e[34]!==O||e[35]!==o||e[36]!==n?(y=o?n("settings.skills.importing"):O,e[34]=O,e[35]=o,e[36]=n,e[37]=y):y=e[37];let u;e[38]!==y?(u=t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:"h-10 flex items-center px-4.5",children:t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y})})}),e[38]=y,e[39]=u):u=e[39];let S;e[40]!==d||e[41]!==u?(S=t.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[d,u]}),e[40]=d,e[41]=u,e[42]=S):S=e[42];let T;return e[43]!==o||e[44]!==S||e[45]!==f||e[46]!==m?(T=t.jsxs(Ce,{size:"flush","aria-busy":o,className:f,children:[m,S]}),e[43]=o,e[44]=S,e[45]=f,e[46]=m,e[47]=T):T=e[47],T}function V(s){const e=se.c(2),{children:i}=s;let o;return e[0]!==i?(o=t.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:i}),e[0]=i,e[1]=o):o=e[1],o}function Ss(){const s=ee(),{org:e}=te(),i=Te(),{remove:o,upload:c}=Ie("home"),a=ne(),n=E.useRef(null),[g,M]=E.useState(""),[O,I]=E.useState(F),[w,R]=E.useState(!1),[D,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:H.slashSkills(e.id)}),a.invalidateQueries({queryKey:H.orgFsSkills(e.id)})},j=r=>a.setQueryData(H.slashSkills(e.id),l=>r(l??[]));async function b(r){const l=[...r??[]];if(n.current&&(n.current.value=""),l.length===0)return;const P=l[0]?.webkitRelativePath??"";if(!P){C.error(s("settings.skills.importNeedsFolder"));return}const q=P.split("/")[0]??"",L=l.filter(Fe),U=L.find(A=>G(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(L.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(L.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let W=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}W=!0;const A=He($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(L,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){W&&await o.mutateAsync(X).catch(()=>{}),C.error(A instanceof Error?A.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=g.toLowerCase(),p=(i.data??[]).filter(r=>r.name.toLowerCase().includes(k)||(r.description??"").toLowerCase().includes(k)).sort((r,l)=>Number(B(l))-Number(B(r))||r.name.localeCompare(l.name)),v=new Set((i.data??[]).map(r=>r.source)),d=new Map;for(const r of p)d.set(r.source,(d.get(r.source)??0)+1);const y=[{id:F,label:s("settings.skills.filterAll"),count:p.length},...[...v].map(r=>({id:r,label:re(r,e.name).label,count:d.get(r)??0}))],u=v.has(O)?O:F,S=u===F?p:p.filter(r=>r.source===u),T=r=>f($e(r.volume,r.path)),K=async()=>{if(!m)return;const{id:r,path:l}=m;N(null),j(P=>P.filter(q=>q.id!==r));try{await o.mutateAsync(l),C.success(s("settings.skills.deleteSuccess"))}catch(P){C.error(P instanceof Error?P.message:s("settings.skills.deleteError"))}finally{x()}},oe=t.jsxs(Q,{size:"sm",disabled:w,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(w?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(_,{children:[t.jsx(_.Content,{children:t.jsx(_.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(_.Actions,{secondary:t.jsx(Ae,{value:g,onChange:M,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:oe}),t.jsx("input",{ref:n,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:r=>{b(r.target.files)}}),y.length>2&&t.jsx(Ee,{placement:"page",tabs:y,activeTab:u,onTabChange:I}),i.isPending?t.jsx("div",{className:"@container",children:t.jsx(V,{children:Array.from({length:8},(r,l)=>t.jsx(ae,{className:"h-[168px] rounded-xl"},l))})}):i.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(ce,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:i.error instanceof Error?i.error.message:s("settings.skills.errorDescription"),actions:t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{i.refetch()},children:s("settings.skills.retry")})})}):S.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Y,{image:t.jsx(ie,{size:48,className:"text-muted-foreground"}),title:s(g?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:g?s("settings.skills.noResultsDescription",{search:g}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(V,{children:S.map(r=>{const l=r.id===z;return t.jsx(Qe,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),D&&t.jsx(Me,{skillPath:D,onClose:()=>f(null)},D),t.jsx(me,{open:m!==null,onOpenChange:r=>!r&&N(null),children:t.jsxs(pe,{children:[t.jsxs(de,{children:[t.jsx(ue,{children:s("settings.skills.deleteDialogTitle")}),t.jsx(ge,{children:s("settings.skills.deleteDialogDescription",{name:m?.name??""})})]}),t.jsxs(fe,{children:[t.jsx(he,{children:s("settings.skills.cancel")}),t.jsx(xe,{onClick:K,variant:"destructive",children:s("settings.skills.deleteButton")})]})]})})]})}export{Ss as default};
@@ -1 +1 @@
1
- import{c as _,m as N,j}from"./index-CoIqGnkT.js";import{T as k,R as z,a as D,b as S}from"./index-DjbHauib.js";function V(T){const e=_.c(41);let i,t,n,s,c,b,g,o,r,a;e[0]!==T?({className:i,defaultValue:t,value:a,min:b,max:g,onPointerDown:s,onKeyDown:n,thumbLabel:o,thumbValueText:r,...c}=T,e[0]=T,e[1]=i,e[2]=t,e[3]=n,e[4]=s,e[5]=c,e[6]=b,e[7]=g,e[8]=o,e[9]=r,e[10]=a):(i=e[1],t=e[2],n=e[3],s=e[4],c=e[5],b=e[6],g=e[7],o=e[8],r=e[9],a=e[10]);const d=b===void 0?0:b,u=g===void 0?100:g;let p;e[11]!==t||e[12]!==u||e[13]!==d||e[14]!==a?(p=Array.isArray(a)?a:Array.isArray(t)?t:[d,u],e[11]=t,e[12]=u,e[13]=d,e[14]=a,e[15]=p):p=e[15];const A=p;let f;e[16]!==i?(f=N("relative flex w-full touch-none items-center py-2 select-none data-[disabled]:opacity-50 data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",i),e[16]=i,e[17]=f):f=e[17];let m;e[18]!==s?(m=l=>{l.currentTarget.dataset.pointer="",s?.(l)},e[18]=s,e[19]=m):m=e[19];let h;e[20]!==n?(h=l=>{delete l.currentTarget.dataset.pointer,n?.(l)},e[20]=n,e[21]=h):h=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=N("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1"),e[22]=x):x=e[22];let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=j.jsx(k,{"data-slot":"slider-track",className:x,children:j.jsx(z,{"data-slot":"slider-range",className:N("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[23]=w):w=e[23];let v;if(e[24]!==A.length||e[25]!==o||e[26]!==r){let l;e[28]!==o||e[29]!==r?(l=(E,R)=>j.jsx(S,{"data-slot":"slider-thumb",...o!==void 0?{"aria-label":o}:{},...r!==void 0?{"aria-valuetext":r}:{},className:"relative block size-4 shrink-0 cursor-grab rounded-full bg-white shadow-edge transition-transform duration-150 after:absolute after:-inset-3 after:rounded-full after:content-[''] hover:scale-110 focus-ring in-data-pointer:outline-none! active:scale-110 active:cursor-grabbing disabled:pointer-events-none motion-reduce:transition-none"},R),e[28]=o,e[29]=r,e[30]=l):l=e[30],v=Array.from({length:A.length},l),e[24]=A.length,e[25]=o,e[26]=r,e[27]=v}else v=e[27];let y;return e[31]!==t||e[32]!==u||e[33]!==d||e[34]!==c||e[35]!==f||e[36]!==m||e[37]!==h||e[38]!==v||e[39]!==a?(y=j.jsxs(D,{"data-slot":"slider",defaultValue:t,value:a,min:d,max:u,className:f,...c,onPointerDown:m,onKeyDown:h,children:[w,v]}),e[31]=t,e[32]=u,e[33]=d,e[34]=c,e[35]=f,e[36]=m,e[37]=h,e[38]=v,e[39]=a,e[40]=y):y=e[40],y}export{V as S};
1
+ import{c as _,m as N,j}from"./index-Cvc22Qvh.js";import{T as k,R as z,a as D,b as S}from"./index-BW7-bbk0.js";function V(T){const e=_.c(41);let i,t,n,s,c,b,g,o,r,a;e[0]!==T?({className:i,defaultValue:t,value:a,min:b,max:g,onPointerDown:s,onKeyDown:n,thumbLabel:o,thumbValueText:r,...c}=T,e[0]=T,e[1]=i,e[2]=t,e[3]=n,e[4]=s,e[5]=c,e[6]=b,e[7]=g,e[8]=o,e[9]=r,e[10]=a):(i=e[1],t=e[2],n=e[3],s=e[4],c=e[5],b=e[6],g=e[7],o=e[8],r=e[9],a=e[10]);const d=b===void 0?0:b,u=g===void 0?100:g;let p;e[11]!==t||e[12]!==u||e[13]!==d||e[14]!==a?(p=Array.isArray(a)?a:Array.isArray(t)?t:[d,u],e[11]=t,e[12]=u,e[13]=d,e[14]=a,e[15]=p):p=e[15];const A=p;let f;e[16]!==i?(f=N("relative flex w-full touch-none items-center py-2 select-none data-[disabled]:opacity-50 data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",i),e[16]=i,e[17]=f):f=e[17];let m;e[18]!==s?(m=l=>{l.currentTarget.dataset.pointer="",s?.(l)},e[18]=s,e[19]=m):m=e[19];let h;e[20]!==n?(h=l=>{delete l.currentTarget.dataset.pointer,n?.(l)},e[20]=n,e[21]=h):h=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=N("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1"),e[22]=x):x=e[22];let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=j.jsx(k,{"data-slot":"slider-track",className:x,children:j.jsx(z,{"data-slot":"slider-range",className:N("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),e[23]=w):w=e[23];let v;if(e[24]!==A.length||e[25]!==o||e[26]!==r){let l;e[28]!==o||e[29]!==r?(l=(E,R)=>j.jsx(S,{"data-slot":"slider-thumb",...o!==void 0?{"aria-label":o}:{},...r!==void 0?{"aria-valuetext":r}:{},className:"relative block size-4 shrink-0 cursor-grab rounded-full bg-white shadow-edge transition-transform duration-150 after:absolute after:-inset-3 after:rounded-full after:content-[''] hover:scale-110 focus-ring in-data-pointer:outline-none! active:scale-110 active:cursor-grabbing disabled:pointer-events-none motion-reduce:transition-none"},R),e[28]=o,e[29]=r,e[30]=l):l=e[30],v=Array.from({length:A.length},l),e[24]=A.length,e[25]=o,e[26]=r,e[27]=v}else v=e[27];let y;return e[31]!==t||e[32]!==u||e[33]!==d||e[34]!==c||e[35]!==f||e[36]!==m||e[37]!==h||e[38]!==v||e[39]!==a?(y=j.jsxs(D,{"data-slot":"slider",defaultValue:t,value:a,min:d,max:u,className:f,...c,onPointerDown:m,onKeyDown:h,children:[w,v]}),e[31]=t,e[32]=u,e[33]=d,e[34]=c,e[35]=f,e[36]=m,e[37]=h,e[38]=v,e[39]=a,e[40]=y):y=e[40],y}export{V as S};
@@ -1 +1 @@
1
- import{r as v,fk as K}from"./index-CoIqGnkT.js";import{d as de,e as fe,f as U,g as ge,h as pe,i as be,j as ve,C as Y,k as he,l as y,m as me,n as xe,o as Ie,s as ye}from"./core.esm-BWCUlskR.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Re(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Xe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=K.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function _e(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),R=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&R&&i(g)},[x,g,R,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:Re(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return K.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function je(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:R,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:P}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:X,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(P,X),S=!!T,_=S&&!R&&O(d)&&O(h),j=!w&&M,F=j&&_?oe:null,ie=_?F??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,G=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!G,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:P,setDraggableNodeRef:X,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(j&&!ve(Z)||!u)&&(S||G))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[y.Down,y.Right,y.Up,y.Left],Fe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case y.Down:r.top<d.top&&f.push(l);break;case y.Up:r.top>d.top&&f.push(l);break;case y.Left:r.left>d.left&&f.push(l);break;case y.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,R=d?.node.current;if(R&&g&&l&&d){const h=Ie(R).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:ye(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{_e as S,q as a,B as r,Fe as s,je as u,Xe as v};
1
+ import{r as v,fk as K}from"./index-Cvc22Qvh.js";import{d as de,e as fe,f as U,g as ge,h as pe,i as be,j as ve,C as Y,k as he,l as y,m as me,n as xe,o as Ie,s as ye}from"./core.esm-ByTukYOF.js";function q(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Re(e,t){return e.reduce((n,r,s)=>{const a=t.get(r);return a&&(n[s]=a),n},Array(e.length))}function O(e){return e!==null&&e>=0}function Ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function we(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const B=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const a=q(t,r,n),o=t[s],c=a[s];return!c||!o?null:{x:c.left-o.left,y:c.top-o.top,scaleX:c.width/o.width,scaleY:c.height/o.height}},L={scaleX:1,scaleY:1},Xe=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:a,overIndex:o}=e;const c=(t=a[n])!=null?t:r;if(!c)return null;if(s===n){const u=a[o];return u?{x:0,y:n<o?u.top+u.height-(c.top+c.height):u.top-c.top,...L}:null}const f=De(a,s,n);return s>n&&s<=o?{x:0,y:-c.height-f,...L}:s<n&&s>=o?{x:0,y:c.height+f,...L}:{x:0,y:0,...L}};function De(e,t,n){const r=e[t],s=e[t-1],a=e[t+1];return r?n<t?s?r.top-(s.top+s.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const H="Sortable",V=K.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function _e(e){let{children:t,id:n,items:r,strategy:s=B,disabled:a=!1}=e;const{active:o,dragOverlay:c,droppableRects:f,over:u,measureDroppableContainers:i}=de(),l=fe(H,n),d=c.rect!==null,g=v.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),R=o!=null,C=o?g.indexOf(o.id):-1,h=u?g.indexOf(u.id):-1,w=v.useRef(g),x=!Ce(g,w.current),m=h!==-1&&C===-1||x,b=we(a);U(()=>{x&&R&&i(g)},[x,g,R,i]),v.useEffect(()=>{w.current=g},[g]);const D=v.useMemo(()=>({activeIndex:C,containerId:l,disabled:b,disableTransforms:m,items:g,overIndex:h,useDragOverlay:d,sortedRects:Re(g,f),strategy:s}),[C,l,b.draggable,b.droppable,m,g,h,f,d,s]);return K.createElement(V.Provider,{value:D},t)}const Se=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return q(n,r,s).indexOf(t)},Ae=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:a,newIndex:o,previousItems:c,previousContainerId:f,transition:u}=e;return!u||!r||c!==a&&s===o?!1:n?!0:o!==s&&t===f},Te={duration:200,easing:"ease"},J="transform",Ee=Y.Transition.toString({property:J,duration:0,easing:"linear"}),Ne={roleDescription:"sortable"};function Oe(e){let{disabled:t,index:n,node:r,rect:s}=e;const[a,o]=v.useState(null),c=v.useRef(n);return U(()=>{if(!t&&n!==c.current&&r.current){const f=s.current;if(f){const u=he(r.current,{ignoreTransform:!0}),i={x:f.left-u.left,y:f.top-u.top,scaleX:f.width/u.width,scaleY:f.height/u.height};(i.x||i.y)&&o(i)}}n!==c.current&&(c.current=n)},[t,n,r,s]),v.useEffect(()=>{a&&o(null)},[a]),a}function je(e){let{animateLayoutChanges:t=Ae,attributes:n,disabled:r,data:s,getNewIndex:a=Se,id:o,strategy:c,resizeObserverConfig:f,transition:u=Te}=e;const{items:i,containerId:l,activeIndex:d,disabled:g,disableTransforms:R,sortedRects:C,overIndex:h,useDragOverlay:w,strategy:x}=v.useContext(V),m=Le(r,g),b=i.indexOf(o),D=v.useMemo(()=>({sortable:{containerId:l,index:b,items:i},...s}),[l,s,b,i]),I=v.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:N,node:z,isOver:W,setNodeRef:P}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:X,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(P,X),S=!!T,_=S&&!R&&O(d)&&O(h),j=!w&&M,F=j&&_?oe:null,ie=_?F??(c??x)({rects:C,activeNodeRect:ee,activeIndex:d,overIndex:h,index:b}):null,E=O(d)&&O(h)?a({id:o,items:i,activeIndex:d,overIndex:h}):b,A=T?.id,p=v.useRef({activeId:A,items:i,newIndex:E,containerId:l}),ce=i!==p.current.items,G=t({active:T,containerId:l,isDragging:M,isSorting:S,id:o,index:b,items:i,newIndex:p.current.newIndex,previousItems:p.current.items,previousContainerId:p.current.containerId,transition:u,wasDragging:p.current.activeId!=null}),$=Oe({disabled:!G,index:b,node:z,rect:N});return v.useEffect(()=>{S&&p.current.newIndex!==E&&(p.current.newIndex=E),l!==p.current.containerId&&(p.current.containerId=l),i!==p.current.items&&(p.current.items=i)},[S,E,l,i]),v.useEffect(()=>{if(A===p.current.activeId)return;if(A!=null&&p.current.activeId==null){p.current.activeId=A;return}const ue=setTimeout(()=>{p.current.activeId=A},50);return()=>clearTimeout(ue)},[A]),{active:T,activeIndex:d,attributes:te,data:D,rect:N,index:b,newIndex:E,items:i,isOver:W,isSorting:S,isDragging:M,listeners:re,node:z,overIndex:h,over:ne,setNodeRef:ae,setActivatorNodeRef:se,setDroppableNodeRef:P,setDraggableNodeRef:X,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(j&&!ve(Z)||!u)&&(S||G))return Y.Transition.toString({...u,property:J})}}function Le(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function k(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ke=[y.Down,y.Right,y.Up,y.Left],Fe=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:a,over:o,scrollableAncestors:c}}=t;if(ke.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];a.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const d=s.get(l.id);if(d)switch(e.code){case y.Down:r.top<d.top&&f.push(l);break;case y.Up:r.top>d.top&&f.push(l);break;case y.Left:r.left>d.left&&f.push(l);break;case y.Right:r.left<d.left&&f.push(l);break}});const u=me({collisionRect:r,droppableRects:s,droppableContainers:f});let i=xe(u,"id");if(i===o?.id&&u.length>1&&(i=u[1].id),i!=null){const l=a.get(n.id),d=a.get(i),g=d?s.get(d.id):null,R=d?.node.current;if(R&&g&&l&&d){const h=Ie(R).some((I,N)=>c[N]!==I),w=Q(l,d),x=Me(l,d),m=h||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},b={x:g.left,y:g.top};return m.x&&m.y?b:ye(b,m)}}}};function Q(e,t){return!k(e)||!k(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Me(e,t){return!k(e)||!k(t)||!Q(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{_e as S,q as a,B as r,Fe as s,je as u,Xe as v};
@@ -1 +1 @@
1
- import{b as A,a5 as B,r as v,j as e,n as x,hj as k,gM as b,g1 as y,g2 as a,h_ as D,B as m,I as g,aN as z,aM as T,aJ as O,aH as R,aL as M,aK as F,bj as q,E as C,t as c,c as U}from"./index-CoIqGnkT.js";import{D as H}from"./domain-settings-m3KQ6IUr.js";import{S as $}from"./switch-CzTsDB3z.js";import{a as J,b as K,c as G,d as Q}from"./use-org-sso-B3MWcxrY.js";import{s as V}from"./Trash01-CLcCE4W6.js";import{R as W}from"./require-capability-DrZOeXFb.js";import"./badge-CM9VoPn3.js";import"./select-DR3RwfpI.js";import"./index-BdQq_4o_.js";import"./index-DQFlQUCO.js";import"./ChevronUp-0ZUNuXoh.js";import"./access-gate-C2fRlAo_.js";import"./capability-load-error-BlktRdv_.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=J(o.id,o.slug),f=K(o.id,o.slug),S=G(o.id,o.slug),E=Q(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[d,p]=v.useState(!1),[P,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,_=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},N=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!u&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(u?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},w=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},L=async t=>{try{await E.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx(H,{}),I?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!d&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx($,{checked:n.enforced,onCheckedChange:L,disabled:E.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(V,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:_,children:s("settings.orgSso.editConfigButton")})]})]})}),(!u||d)&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(g,{id:"sso-issuer",placeholder:s("settings.orgSso.issuerUrlPlaceholder"),value:i.issuer,onChange:t=>l(r=>({...r,issuer:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx(g,{id:"sso-client-id",placeholder:s("settings.orgSso.clientIdPlaceholder"),value:i.clientId,onChange:t=>l(r=>({...r,clientId:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientSecretLabel"),description:d&&u?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(g,{id:"sso-client-secret",type:"password",placeholder:s("settings.orgSso.clientSecretPlaceholder"),value:i.clientSecret,onChange:t=>l(r=>({...r,clientSecret:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.emailDomainLabel"),description:s("settings.orgSso.emailDomainDescription"),action:e.jsx(g,{id:"sso-domain",placeholder:s("settings.orgSso.emailDomainPlaceholder"),value:i.domain,onChange:t=>l(r=>({...r,domain:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx(g,{id:"sso-scopes",placeholder:s("settings.orgSso.scopesPlaceholder"),value:i.scopes,onChange:t=>l(r=>({...r,scopes:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.discoveryEndpointLabel"),description:s("settings.orgSso.discoveryEndpointDescription"),action:e.jsx(g,{id:"sso-discovery",placeholder:s("settings.orgSso.discoveryEndpointPlaceholder"),value:i.discoveryEndpoint,onChange:t=>l(r=>({...r,discoveryEndpoint:t.target.value})),className:"w-[280px]"})}),e.jsxs(D,{children:[d&&e.jsx(m,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(m,{onClick:N,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(d?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(z,{open:P,onOpenChange:j,children:e.jsxs(T,{children:[e.jsx(O,{children:e.jsx(R,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(M,{children:[e.jsx(F,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx(q,{onClick:w,disabled:S.isPending,variant:"destructive",children:s("settings.orgSso.removeButton")})]})]})})]})}function de(){const s=U.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(W,{capability:"org:manage",area:"security",children:e.jsx(X,{})}),s[0]=o):o=s[0],o}export{de as default};
1
+ import{b as A,a5 as B,r as v,j as e,n as x,hj as k,gM as b,g1 as y,g2 as a,h_ as D,B as m,I as g,aN as z,aM as T,aJ as O,aH as R,aL as M,aK as F,bj as q,E as C,t as c,c as U}from"./index-Cvc22Qvh.js";import{D as H}from"./domain-settings-DPbJEdjs.js";import{S as $}from"./switch-BRZA_xq0.js";import{a as J,b as K,c as G,d as Q}from"./use-org-sso-d82WgyRM.js";import{s as V}from"./Trash01-DhMVlpac.js";import{R as W}from"./require-capability-BTBUQsVM.js";import"./badge-9UZ-oy57.js";import"./select-GzsOSPza.js";import"./index-BdQq_4o_.js";import"./index-LnWr599j.js";import"./ChevronUp-B0uKxpVg.js";import"./access-gate-CpAtBb_h.js";import"./capability-load-error-D8AT7eAw.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=J(o.id,o.slug),f=K(o.id,o.slug),S=G(o.id,o.slug),E=Q(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[d,p]=v.useState(!1),[P,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,_=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},N=async()=>{if(!i.issuer||!i.clientId||!i.domain){c.error(s("settings.orgSso.requiredFieldsError"));return}if(!u&&!i.clientSecret){c.error(s("settings.orgSso.clientSecretRequiredError"));return}try{await f.mutateAsync({issuer:i.issuer,clientId:i.clientId,clientSecret:i.clientSecret,discoveryEndpoint:i.discoveryEndpoint||void 0,scopes:i.scopes.split(/\s+/).filter(Boolean),domain:i.domain,enforced:n?.enforced??!1}),C(u?"sso_config_updated":"sso_configured",{organization_id:o.id,email_domain:i.domain}),c.success(s("settings.orgSso.configurationSavedSuccess")),p(!1)}catch(t){c.error(t instanceof Error?t.message:s("settings.orgSso.saveSsoConfigError"))}},w=async()=>{try{await S.mutateAsync(),C("sso_config_removed",{organization_id:o.id}),c.success(s("settings.orgSso.configurationRemovedSuccess")),p(!1),j(!1)}catch{c.error(s("settings.orgSso.removeSsoConfigError"))}},L=async t=>{try{await E.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx(H,{}),I?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!d&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx($,{checked:n.enforced,onCheckedChange:L,disabled:E.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(V,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:_,children:s("settings.orgSso.editConfigButton")})]})]})}),(!u||d)&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.issuerUrlLabel"),description:s("settings.orgSso.issuerUrlDescription"),action:e.jsx(g,{id:"sso-issuer",placeholder:s("settings.orgSso.issuerUrlPlaceholder"),value:i.issuer,onChange:t=>l(r=>({...r,issuer:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx(g,{id:"sso-client-id",placeholder:s("settings.orgSso.clientIdPlaceholder"),value:i.clientId,onChange:t=>l(r=>({...r,clientId:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.clientSecretLabel"),description:d&&u?s("settings.orgSso.clientSecretEditDescription"):void 0,action:e.jsx(g,{id:"sso-client-secret",type:"password",placeholder:s("settings.orgSso.clientSecretPlaceholder"),value:i.clientSecret,onChange:t=>l(r=>({...r,clientSecret:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.emailDomainLabel"),description:s("settings.orgSso.emailDomainDescription"),action:e.jsx(g,{id:"sso-domain",placeholder:s("settings.orgSso.emailDomainPlaceholder"),value:i.domain,onChange:t=>l(r=>({...r,domain:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx(g,{id:"sso-scopes",placeholder:s("settings.orgSso.scopesPlaceholder"),value:i.scopes,onChange:t=>l(r=>({...r,scopes:t.target.value})),className:"w-[280px]"})}),e.jsx(a,{title:s("settings.orgSso.discoveryEndpointLabel"),description:s("settings.orgSso.discoveryEndpointDescription"),action:e.jsx(g,{id:"sso-discovery",placeholder:s("settings.orgSso.discoveryEndpointPlaceholder"),value:i.discoveryEndpoint,onChange:t=>l(r=>({...r,discoveryEndpoint:t.target.value})),className:"w-[280px]"})}),e.jsxs(D,{children:[d&&e.jsx(m,{variant:"outline",size:"sm",onClick:()=>p(!1),children:s("settings.orgSso.cancelButton")}),e.jsx(m,{onClick:N,disabled:f.isPending,size:"sm",children:f.isPending?s("settings.orgSso.savingButton"):s(d?"settings.orgSso.updateButton":"settings.orgSso.configureSsoButton")})]})]})})]})]})})}),e.jsx(z,{open:P,onOpenChange:j,children:e.jsxs(T,{children:[e.jsx(O,{children:e.jsx(R,{children:s("settings.orgSso.removeConfirmation")})}),e.jsxs(M,{children:[e.jsx(F,{disabled:S.isPending,children:s("settings.orgSso.cancelButton")}),e.jsx(q,{onClick:w,disabled:S.isPending,variant:"destructive",children:s("settings.orgSso.removeButton")})]})]})})]})}function de(){const s=U.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(W,{capability:"org:manage",area:"security",children:e.jsx(X,{})}),s[0]=o):o=s[0],o}export{de as default};