decocms 4.576.2 → 4.576.4

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 (392) hide show
  1. package/dist/client/assets/{AlertCircle-CQW1P7_R.js → AlertCircle-CsPTcN_S.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BEgOgZZj.js → AreaChart-CPcUCL9A.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-sSY9Zm-O.js → ArrowLeft-BYhfnAa5.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-VZphHDPw.js → ArrowUp-Cv1SmuzD.js} +1 -1
  5. package/dist/client/assets/{CartesianChart-Bku6CBeN.js → CartesianChart-1SsRQdZi.js} +1 -1
  6. package/dist/client/assets/{CategoricalChart-CI96Ht0A.js → CategoricalChart-B9nv4p9e.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-BAqlx5xq.js → CheckCircle-LO8Q7KlB.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-CAw9AQRt.js → ChevronSelectorVertical-Bo1EsiyQ.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-RQuomTlc.js → ChevronUp-Dh24Sq_k.js} +1 -1
  10. package/dist/client/assets/{CreditCard01-uW1Nq0L7.js → CreditCard01-B0xYA-L3.js} +1 -1
  11. package/dist/client/assets/{Globe04-1JEh9zst.js → Globe04-ceJSWDa3.js} +1 -1
  12. package/dist/client/assets/{Key01-B-MK6puk.js → Key01-D9P3FMiY.js} +1 -1
  13. package/dist/client/assets/{LinkBroken01-ArAKWl5D.js → LinkBroken01-B3rPhu7D.js} +1 -1
  14. package/dist/client/assets/{Minus-y3rEkH4O.js → Minus-BP4M5eUu.js} +1 -1
  15. package/dist/client/assets/{Monitor01-DkdtFPE6.js → Monitor01-BIy7Jnq0.js} +1 -1
  16. package/dist/client/assets/{Play-BtmesR9D.js → Play-C4cdDhC3.js} +1 -1
  17. package/dist/client/assets/{Plus-BhSB1FAc.js → Plus-Bcl7avNA.js} +1 -1
  18. package/dist/client/assets/{ReferenceLine-CguuPF_F.js → ReferenceLine-CZfceFos.js} +1 -1
  19. package/dist/client/assets/{SearchMd-CTCaP47C.js → SearchMd-DRs-Ld4Z.js} +1 -1
  20. package/dist/client/assets/{ShoppingBag01-DEtqIAKG.js → ShoppingBag01-BcBJW8Ry.js} +1 -1
  21. package/dist/client/assets/{Sun-DhrY2nq7.js → Sun-oVWnfq_E.js} +1 -1
  22. package/dist/client/assets/{SwitchHorizontal01-DTDSJnjG.js → SwitchHorizontal01-BTdsV_bI.js} +1 -1
  23. package/dist/client/assets/{Tool01-CE4RsL2T.js → Tool01-BWMOxR8v.js} +1 -1
  24. package/dist/client/assets/{Tooltip-DzoIZZA-.js → Tooltip-DHjHeuys.js} +1 -1
  25. package/dist/client/assets/{Trash01-DQCE9WJt.js → Trash01-CgWosjFE.js} +1 -1
  26. package/dist/client/assets/{Upload01-C8pH3Rp-.js → Upload01-DAMBCMxP.js} +1 -1
  27. package/dist/client/assets/{UserSquare-DfCEdLMW.js → UserSquare-BjqAifU8.js} +1 -1
  28. package/dist/client/assets/{Users01-RbJbPNL4.js → Users01-Bt0rcyOL.js} +1 -1
  29. package/dist/client/assets/{XClose-B9seet19.js → XClose-TMdj_yIm.js} +1 -1
  30. package/dist/client/assets/{Zap-B2TeJ3jk.js → Zap-BJ5eCR1y.js} +1 -1
  31. package/dist/client/assets/{access-gate-B3-8eUAT.js → access-gate-DbqD_EAv.js} +1 -1
  32. package/dist/client/assets/{add-connection-dialog-BZazlImL.js → add-connection-dialog-DigMA6Jw.js} +1 -1
  33. package/dist/client/assets/agent-app-z2dEAE0c.js +1 -0
  34. package/dist/client/assets/{agent-assets-D6n5n_j9.js → agent-assets-B50PlEch.js} +1 -1
  35. package/dist/client/assets/{agent-automation-BDFDUDqF.js → agent-automation-ZC5pUe0X.js} +1 -1
  36. package/dist/client/assets/{agent-automations-CTb19iEo.js → agent-automations-BqJwcAQY.js} +1 -1
  37. package/dist/client/assets/{agent-calendar-dOBBocaZ.js → agent-calendar-6cFcqsTq.js} +1 -1
  38. package/dist/client/assets/{agent-capabilities-D8RyEQle.js → agent-capabilities-DODsAfWG.js} +1 -1
  39. package/dist/client/assets/{agent-connect-sources-Cv_HfEov.js → agent-connect-sources-BMcGkScg.js} +1 -1
  40. package/dist/client/assets/agent-deck-oSNNh6Oq.js +1 -0
  41. package/dist/client/assets/{agent-e2e-UuVTzQty.js → agent-e2e-qon8RqKT.js} +1 -1
  42. package/dist/client/assets/agent-experiments-DSDO0e_Q.js +1 -0
  43. package/dist/client/assets/{agent-file-BxTgqKD4.js → agent-file-BDrgchCG.js} +1 -1
  44. package/dist/client/assets/{agent-hosting-SFnhs_AJ.js → agent-hosting-lyen0G2R.js} +1 -1
  45. package/dist/client/assets/{agent-icon-DmYd33Zd.js → agent-icon-CMiKlX_f.js} +1 -1
  46. package/dist/client/assets/agent-library-BL3gqRVT.js +1 -0
  47. package/dist/client/assets/agent-library-file-qyRRAu7t.js +1 -0
  48. package/dist/client/assets/agent-overview-D-M__QCC.js +1 -0
  49. package/dist/client/assets/{agent-releases-Nv7L0dpy.js → agent-releases-CDlgQRKx.js} +1 -1
  50. package/dist/client/assets/agent-settings-J3n5UPp_.js +1 -0
  51. package/dist/client/assets/{agent-site-editor-DLrFF0Rn.js → agent-site-editor-Z6rBuS35.js} +1 -1
  52. package/dist/client/assets/agent-site-editor-code-BaufV44m.js +2 -0
  53. package/dist/client/assets/agent-site-editor-content-BZesN91A.js +1 -0
  54. package/dist/client/assets/agent-site-editor-preview-n4h_ozj2.js +1 -0
  55. package/dist/client/assets/{agent-view-guard-D0qWi85T.js → agent-view-guard-DGsM3j-h.js} +1 -1
  56. package/dist/client/assets/agent-view-xa9IiygI.js +1 -0
  57. package/dist/client/assets/{ai-providers-CjPCR-pK.js → ai-providers-CAe-vRzr.js} +1 -1
  58. package/dist/client/assets/{alert-C5FPaAXQ.js → alert-TFdEDT2O.js} +1 -1
  59. package/dist/client/assets/{analytics-sections-BGMxhZwl.js → analytics-sections-CopwZcAF.js} +1 -1
  60. package/dist/client/assets/api-keys-B7PbIf1K.js +1 -0
  61. package/dist/client/assets/{api-keys-p6Xw6r8B.js → api-keys-BRzjuZvx.js} +1 -1
  62. package/dist/client/assets/{app-editor-DQwdeZHJ.js → app-editor-CUySEecw.js} +1 -1
  63. package/dist/client/assets/{asset-utils-BW1FTT9q.js → asset-utils-B4QYhZxH.js} +1 -1
  64. package/dist/client/assets/{auth-DeNsOsKX.js → auth-TL5_hJeY.js} +1 -1
  65. package/dist/client/assets/{auth-catchall-C3auT4P_.js → auth-catchall-na7siRgx.js} +1 -1
  66. package/dist/client/assets/{auth-entry-BBIyDdU5.js → auth-entry-BGo8_cbu.js} +1 -1
  67. package/dist/client/assets/{auth-split-layout-CpPst90z.js → auth-split-layout-BISVCxy2.js} +1 -1
  68. package/dist/client/assets/{authenticate-and-persist-oauth-Ca1G6bWy.js → authenticate-and-persist-oauth-CUE7ik09.js} +1 -1
  69. package/dist/client/assets/{automation-list-row-GTaw28qY.js → automation-list-row-DpSl9UM5.js} +1 -1
  70. package/dist/client/assets/{automation-runs-e7UMBmIy.js → automation-runs-BfKHSay9.js} +1 -1
  71. package/dist/client/assets/{automations-DVHIEzYX.js → automations-Dg2lSOc5.js} +1 -1
  72. package/dist/client/assets/{autosend-0p4cszrD.js → autosend-CGJPJD3U.js} +1 -1
  73. package/dist/client/assets/{badge-fJOJmdQG.js → badge-D7MkXlu5.js} +1 -1
  74. package/dist/client/assets/{block-document-D6lQw_Sn.js → block-document-BAvIRwEs.js} +1 -1
  75. package/dist/client/assets/{blocks-preview-workspace-context-CevYm8XG.js → blocks-preview-workspace-context-DFEoJmhw.js} +1 -1
  76. package/dist/client/assets/blocks-tab-states-DASlUdvo.js +1 -0
  77. package/dist/client/assets/{blog-schema-CW6OwOTr.js → blog-schema-D7LUSvhR.js} +1 -1
  78. package/dist/client/assets/{buckets-DJjTeJ67.js → buckets-DWZ0uMIH.js} +1 -1
  79. package/dist/client/assets/{build-improve-prompt-doc-Bz_NuW8p.js → build-improve-prompt-doc-Cp4dU57k.js} +1 -1
  80. package/dist/client/assets/{calendar-BN8LK6az.js → calendar-J9rCuEM0.js} +1 -1
  81. package/dist/client/assets/{capability-load-error-BwSdaWc5.js → capability-load-error-cDMC87PI.js} +1 -1
  82. package/dist/client/assets/{category-editor-B2fU3l2-.js → category-editor-B6mXBz4W.js} +1 -1
  83. package/dist/client/assets/{chart-TbvRqjuj.js → chart-sO-wf7w_.js} +1 -1
  84. package/dist/client/assets/{chat-context-BwoQSegQ.js → chat-context-DgCR75CY.js} +1 -1
  85. package/dist/client/assets/{chat-draft-DH581p83.js → chat-draft-B_pQlOo7.js} +1 -1
  86. package/dist/client/assets/{checkbox-BYltfk17.js → checkbox-CDdGUfxj.js} +1 -1
  87. package/dist/client/assets/{choose-editor-CF8pbtbx.js → choose-editor-DOwdvoLE.js} +1 -1
  88. package/dist/client/assets/{cli-auth-success-8VRhz3fQ.js → cli-auth-success-BAsObd7a.js} +1 -1
  89. package/dist/client/assets/{client-icons-azPimjhr.js → client-icons-Bp0n81sC.js} +1 -1
  90. package/dist/client/assets/{cms-settings-editor-Dh2cgMIJ.js → cms-settings-editor-B6ALhYaf.js} +1 -1
  91. package/dist/client/assets/cms-store-drafts-CZfXb7jx.js +1 -0
  92. package/dist/client/assets/{collapsible-DMIxs55h.js → collapsible-BF7fiKEY.js} +1 -1
  93. package/dist/client/assets/{collection-detail-BNTXyqsr.js → collection-detail-DHIJx408.js} +1 -1
  94. package/dist/client/assets/{collection-display-button-DlPhjc6E.js → collection-display-button-D3cSy-rU.js} +1 -1
  95. package/dist/client/assets/{collection-search-DFoNgd1T.js → collection-search-DmyrNuWr.js} +1 -1
  96. package/dist/client/assets/{collection-table-wrapper-OwJoF9HU.js → collection-table-wrapper-BVBFYCyq.js} +1 -1
  97. package/dist/client/assets/{collection-tabs-DTr38V1c.js → collection-tabs-CzJgsFmP.js} +1 -1
  98. package/dist/client/assets/{combobox-B8pIOucr.js → combobox-Cy1ac_Va.js} +1 -1
  99. package/dist/client/assets/{command-8eo7blzl.js → command-Bh995x5J.js} +1 -1
  100. package/dist/client/assets/{companion-mcps-section-OBc1XSiN.js → companion-mcps-section-DHnNnyh5.js} +1 -1
  101. package/dist/client/assets/{config-CZxXYayZ.js → config-C1KKnNPa.js} +1 -1
  102. package/dist/client/assets/{connect-BDnlsqF3.js → connect-DN6GB1WI.js} +1 -1
  103. package/dist/client/assets/{connect-layout-f8wmYpiF.js → connect-layout-DllpY2qm.js} +1 -1
  104. package/dist/client/assets/{connect-source-dialog-BnoBKHvg.js → connect-source-dialog-C4jdSJZP.js} +1 -1
  105. package/dist/client/assets/{connection-B4VgNpkK.js → connection-S1Y-z6Ze.js} +1 -1
  106. package/dist/client/assets/{connection-card-Cp7AJMDR.js → connection-card-GbDbFKHX.js} +1 -1
  107. package/dist/client/assets/{connection-detail-BYR-qeWG.js → connection-detail-Bt9fqrdv.js} +1 -1
  108. package/dist/client/assets/{connection-form-helpers-DqULERyx.js → connection-form-helpers-DwQM2AXJ.js} +1 -1
  109. package/dist/client/assets/{connection-slug-CK9E8VRg.js → connection-slug-CQeaB-ii.js} +1 -1
  110. package/dist/client/assets/{connections-D1yKPCTH.js → connections-023t3K8C.js} +1 -1
  111. package/dist/client/assets/{content-tab-D-PBLIve.js → content-tab-DnZUk0R_.js} +3 -3
  112. package/dist/client/assets/{context-Ciehk0ao.js → context-BviRKxpu.js} +1 -1
  113. package/dist/client/assets/{context-menu-SmukJNMU.js → context-menu-_4SjkJP2.js} +1 -1
  114. package/dist/client/assets/{context-shell-CO4fTNNJ.js → context-shell-2FHUOtQh.js} +3 -3
  115. package/dist/client/assets/{core.esm-B_Pr2KZA.js → core.esm-Cx2tI-v0.js} +1 -1
  116. package/dist/client/assets/{create-organization-dialog-8e7uLr8k.js → create-organization-dialog-DztBZJfG.js} +1 -1
  117. package/dist/client/assets/{device-hint-_3UpNo1y.js → device-hint-DiJItdVl.js} +1 -1
  118. package/dist/client/assets/{discover-j-WmLzAr.js → discover-CZ-mJztz.js} +1 -1
  119. package/dist/client/assets/{domain-settings-nzh2Xqh2.js → domain-settings-DEAsOpnU.js} +1 -1
  120. package/dist/client/assets/{drawer-BiZQd3jF.js → drawer-BcaULeep.js} +1 -1
  121. package/dist/client/assets/{editor-B5BFg8L4.js → editor-DXF9rwVo.js} +1 -1
  122. package/dist/client/assets/{editor-classes-DxfrzHp8.js → editor-classes-DEwbN0MI.js} +1 -1
  123. package/dist/client/assets/{empty-state-CPhGFwFG.js → empty-state-Ccl8OC-j.js} +1 -1
  124. package/dist/client/assets/{empty-state-D5FGRI4e.js → empty-state-Cfajk5TO.js} +1 -1
  125. package/dist/client/assets/{experiments-tab-choice-5NNTmJRW.js → experiments-tab-choice-BVL1j6B7.js} +1 -1
  126. package/dist/client/assets/{extract-connection-data-lBAlP3pz.js → extract-connection-data-biKUq-5E.js} +1 -1
  127. package/dist/client/assets/{feature-gate-Djob_jbU.js → feature-gate-TKaLsYFc.js} +1 -1
  128. package/dist/client/assets/{feature-paywall-DWnzqDkt.js → feature-paywall-DasxziSs.js} +1 -1
  129. package/dist/client/assets/{file-explorer-B7HqI107.js → file-explorer-DgzFCGgU.js} +1 -1
  130. package/dist/client/assets/{file-preview-CVLvq53I.js → file-preview-Dmy5YhII.js} +1 -1
  131. package/dist/client/assets/{file-share-button-Ug-zwu4d.js → file-share-button-Cl-IgS5x.js} +1 -1
  132. package/dist/client/assets/{file-type-icon-BZTtX6EK.js → file-type-icon-D75nksOt.js} +1 -1
  133. package/dist/client/assets/{folder-icon-C2EzD8if.js → folder-icon-C5I9OzDM.js} +1 -1
  134. package/dist/client/assets/{form-Bhgzwnyp.js → form-CIThj_T9.js} +1 -1
  135. package/dist/client/assets/{general-CPLHJuRp.js → general-Cz8UZeQh.js} +1 -1
  136. package/dist/client/assets/{github-icon-Buu0H1v4.js → github-icon--dnMj3-y.js} +1 -1
  137. package/dist/client/assets/{home-BCYh-a3a.js → home-Dxjl17s5.js} +1 -1
  138. package/dist/client/assets/{home-overview-DTtXcEkG.js → home-overview-g3rcNgW7.js} +1 -1
  139. package/dist/client/assets/{hosted-reconcile-BdwyWhOE.js → hosted-reconcile-D236FadC.js} +1 -1
  140. package/dist/client/assets/{icon-button-Dls6AzVP.js → icon-button-CyNmKrzV.js} +1 -1
  141. package/dist/client/assets/{index-DJy_S3Mn.js → index-B57dAAxD.js} +1 -1
  142. package/dist/client/assets/{index-CQIKg7tc.js → index-BCZy-897.js} +1 -1
  143. package/dist/client/assets/{index-CJKJ4WN3.js → index-BF9ePDqU.js} +1 -1
  144. package/dist/client/assets/{index-CMl-YIkn.js → index-BVHbGN5c.js} +1 -1
  145. package/dist/client/assets/{index-D_HCIUjf.js → index-B_wKEr5f.js} +1 -1
  146. package/dist/client/assets/{index-B6eHz5VS.js → index-BrihqSoi.js} +1 -1
  147. package/dist/client/assets/{index-B4tnBHnb.js → index-BtqPZIqH.js} +1 -1
  148. package/dist/client/assets/{index-0xCVweSM.js → index-CRog5tFp.js} +1 -1
  149. package/dist/client/assets/{index-BJqMJFEL.js → index-CXMGhRs4.js} +1 -1
  150. package/dist/client/assets/{index-CtJa8hR9.js → index-DJZmV4c9.js} +1 -1
  151. package/dist/client/assets/{index-XdUWZF5g.js → index-Dd5hidCj.js} +3 -3
  152. package/dist/client/assets/{index-C8i-vHCI.js → index-DgYBSkMj.js} +1 -1
  153. package/dist/client/assets/{index-CKuu5BgI.js → index-DjpHvK_4.js} +1 -1
  154. package/dist/client/assets/{index-DAFka6tK.js → index-DrqsNFYR.js} +1 -1
  155. package/dist/client/assets/{index-B3BrFVGB.js → index-_nd_1JQz.js} +1 -1
  156. package/dist/client/assets/{index-BJrkqMqs.js → index-nO2S2V0T.js} +1 -1
  157. package/dist/client/assets/{index-UxIaE43S.js → index-ozu548h3.js} +1 -1
  158. package/dist/client/assets/{index-redirect-ZoX0Nmet.js → index-redirect-DUi7z5TL.js} +1 -1
  159. package/dist/client/assets/{infiniteQueryObserver-DgQQHW6Y.js → infiniteQueryObserver-C1uWfhgO.js} +1 -1
  160. package/dist/client/assets/{infra-billing-CbpAOQ7f.js → infra-billing-DWMi-9eg.js} +1 -1
  161. package/dist/client/assets/{input-BneF5n5F.js → input-B-TiyPUk.js} +3 -3
  162. package/dist/client/assets/{input-BBwM3ir1.js → input-DKlZJGf0.js} +1 -1
  163. package/dist/client/assets/{integration-icon-DpoZYM7e.js → integration-icon-DHvbSqTM.js} +1 -1
  164. package/dist/client/assets/{jira-icon-CfXcnbRW.js → jira-icon-CUlCkXDM.js} +1 -1
  165. package/dist/client/assets/{label-CUqIqnOS.js → label-BZoCdZa0.js} +1 -1
  166. package/dist/client/assets/{layout-CZKu8-AR.js → layout-C4bx239O.js} +1 -1
  167. package/dist/client/assets/{legacy-admin-welcome-dialog-D12aat8e.js → legacy-admin-welcome-dialog-BgMnIQY9.js} +1 -1
  168. package/dist/client/assets/{legacy-agents-deep-C46PUrrS.js → legacy-agents-deep-BELlTHpx.js} +1 -1
  169. package/dist/client/assets/{legacy-main-redirect-si54JTxO.js → legacy-main-redirect-CxAuaPrB.js} +1 -1
  170. package/dist/client/assets/library-D_ryD5pc.js +1 -0
  171. package/dist/client/assets/{library-tab-EiyuBjPa.js → library-tab-CnjcP9yb.js} +1 -1
  172. package/dist/client/assets/{login-D0eYUue3.js → login-CA5_HXz3.js} +1 -1
  173. package/dist/client/assets/{markdown-A06Oe1_p.js → markdown-ZlzKtNkL.js} +1 -1
  174. package/dist/client/assets/{mcp-app-renderer-Dkj1yLIG.js → mcp-app-renderer-CRFiwN6n.js} +1 -1
  175. package/dist/client/assets/{mcp-oauth-L4CbK4hz.js → mcp-oauth-Cq-Z82WC.js} +1 -1
  176. package/dist/client/assets/{mcp-oauth-u5RBmpff.js → mcp-oauth-VaMDOw7T.js} +1 -1
  177. package/dist/client/assets/{members-D2W9FUHb.js → members-CHUd-Ol1.js} +1 -1
  178. package/dist/client/assets/{memory-nZuh_3HW.js → memory-CltSbzPH.js} +1 -1
  179. package/dist/client/assets/{mock-board-DkI2cfk-.js → mock-board-TQVQrJy0.js} +3 -3
  180. package/dist/client/assets/{monaco-editor-DoTBOc-e.js → monaco-editor-BZNPSifL.js} +1 -1
  181. package/dist/client/assets/{monitoring-DZ1uqyFT.js → monitoring-D-eHzsjl.js} +1 -1
  182. package/dist/client/assets/{monitoring-stats-row-Be_-YMn8.js → monitoring-stats-row-C7sD_prp.js} +1 -1
  183. package/dist/client/assets/{multi-select-CzoYfyvg.js → multi-select-DL8hrKQv.js} +1 -1
  184. package/dist/client/assets/{mustache-BctGjQ5L.js → mustache-DZix8TV9.js} +1 -1
  185. package/dist/client/assets/{named-rule-view-DUsv8g0V.js → named-rule-view-xs5Ukf19.js} +1 -1
  186. package/dist/client/assets/{new-project-dialog-151PED_m.js → new-project-dialog-BDUp1HsF.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-DrwI5ATg.js → oauth-callback-D-Igsrh7.js} +1 -1
  188. package/dist/client/assets/{oauth-callback-ai-provider-D9pLn0-_.js → oauth-callback-ai-provider-Yifk_dmU.js} +1 -1
  189. package/dist/client/assets/{oauth-consent-o6k0sIQ6.js → oauth-consent-DlsvLpih.js} +1 -1
  190. package/dist/client/assets/{onboarding-BMQJZ4PX.js → onboarding-CyvbU-47.js} +1 -1
  191. package/dist/client/assets/{openai-conversation-CWam_Ql8.js → openai-conversation-CKtOG2f6.js} +1 -1
  192. package/dist/client/assets/{optimistic-project-sidebar-views-Dx-3KOhR.js → optimistic-project-sidebar-views-DMLee7lV.js} +1 -1
  193. package/dist/client/assets/{order-monitor-day-DGR3iDef.js → order-monitor-day-D_UJY8n7.js} +1 -1
  194. package/dist/client/assets/{organization-choice-1Lr2hM9B.js → organization-choice-11vPd3Oe.js} +1 -1
  195. package/dist/client/assets/{orgs-CbmN-Uo3.js → orgs-CO5mj27b.js} +1 -1
  196. package/dist/client/assets/{own-accounts-section-DPfUOm23.js → own-accounts-section-VOVPBP5x.js} +1 -1
  197. package/dist/client/assets/{pair-BCJ5sFP0.js → pair-D5jYRLOi.js} +1 -1
  198. package/dist/client/assets/{parse-sections-DxG18Udv.js → parse-sections-BqIle9mt.js} +3 -3
  199. package/dist/client/assets/{plan-BaYlHrHs.js → plan-BkqYlxrI.js} +1 -1
  200. package/dist/client/assets/{plan-ladder-LKl9l3TA.js → plan-ladder-42sSWoBs.js} +1 -1
  201. package/dist/client/assets/{plan-usage-card-wDWYSVHD.js → plan-usage-card-DawnbwSf.js} +1 -1
  202. package/dist/client/assets/{popover-DmqBIPKi.js → popover-4z9eDM-9.js} +1 -1
  203. package/dist/client/assets/{post-calendar-C4TZhDJz.js → post-calendar-DXSJQozg.js} +1 -1
  204. package/dist/client/assets/{post-editor-DGrj-qXP.js → post-editor-BOGWSxB3.js} +1 -1
  205. package/dist/client/assets/{preview-content-8R1QUim7.js → preview-content-DAApomFo.js} +1 -1
  206. package/dist/client/assets/{preview-dialog-ZNHmoyI1.js → preview-dialog-BYfDupos.js} +1 -1
  207. package/dist/client/assets/{preview-panel-DbX8A-HE.js → preview-panel-BnTSUu1W.js} +1 -1
  208. package/dist/client/assets/{preview-tab-DglGrCFS.js → preview-tab-DoF3705n.js} +3 -3
  209. package/dist/client/assets/{product-picker-dialog-B84p2GNz.js → product-picker-dialog-CtVVJBu_.js} +1 -1
  210. package/dist/client/assets/{profile-Bhqnq92W.js → profile-Cespz5EQ.js} +1 -1
  211. package/dist/client/assets/{project-app-view-BH2u01TO.js → project-app-view-BZhEHrBD.js} +1 -1
  212. package/dist/client/assets/{project-apps-CTuZm-1a.js → project-apps-C1L1P3Il.js} +1 -1
  213. package/dist/client/assets/{project-icon-BhWIi9DN.js → project-icon-BC5BTHqT.js} +1 -1
  214. package/dist/client/assets/{project-index-_-BCnGMR.js → project-index-Cov2uCEL.js} +1 -1
  215. package/dist/client/assets/project-reports-C2rrdScO.js +1 -0
  216. package/dist/client/assets/project-tasks-BIUh6BbU.js +1 -0
  217. package/dist/client/assets/{projects-CbLcC2Cm.js → projects-Dp44Mtfj.js} +1 -1
  218. package/dist/client/assets/{projects-empty-state-DgeHjyWl.js → projects-empty-state-BKHYkH3g.js} +1 -1
  219. package/dist/client/assets/{prompts-CIAk1CWx.js → prompts-Bf1h2RZu.js} +1 -1
  220. package/dist/client/assets/{record-editor-Cqt0X6zj.js → record-editor-Du-SgLkC.js} +1 -1
  221. package/dist/client/assets/{redirect-editor-DrfUg_M2.js → redirect-editor-Diqw7Nkh.js} +1 -1
  222. package/dist/client/assets/{reports-BqGiKAfm.js → reports-DRRYJcxd.js} +1 -1
  223. package/dist/client/assets/{reports-onboarding-LZjQ8G8T.js → reports-onboarding-C4BoLN-j.js} +1 -1
  224. package/dist/client/assets/reports-qs02DwnV.js +1 -0
  225. package/dist/client/assets/{reports-tab-B55dyiL7.js → reports-tab-Cr_0nAF2.js} +2 -2
  226. package/dist/client/assets/{repositories-0RznNRUX.js → repositories-B4lUSmlm.js} +1 -1
  227. package/dist/client/assets/repositories-CHJClbl6.js +1 -0
  228. package/dist/client/assets/{repository-binding-Cfy_YQIZ.js → repository-binding-DV3kkbZ_.js} +1 -1
  229. package/dist/client/assets/{repository-picker-BKWo-jhF.js → repository-picker-DhcwcPzc.js} +1 -1
  230. package/dist/client/assets/{require-capability-Bpnmr0un.js → require-capability-Dlaolf-u.js} +1 -1
  231. package/dist/client/assets/{required-auth-layout-CRKzQVpv.js → required-auth-layout-lVrZieBu.js} +1 -1
  232. package/dist/client/assets/{reset-password-DVKc7osA.js → reset-password-H302zhc9.js} +1 -1
  233. package/dist/client/assets/{resizable-w4diu4pE.js → resizable-D6Bvwzfl.js} +1 -1
  234. package/dist/client/assets/{resolve-tab-icon-DY3vlmxg.js → resolve-tab-icon-JhqhoNvw.js} +1 -1
  235. package/dist/client/assets/{review-settings-D7Ld59mb.js → review-settings-D1OJYsDt.js} +1 -1
  236. package/dist/client/assets/{role-color-DfOmE7Fu.js → role-color-CxM5Kzh7.js} +1 -1
  237. package/dist/client/assets/{roles-RQS02DUg.js → roles-C3sEk6Ey.js} +1 -1
  238. package/dist/client/assets/{route-BRvX0p-n.js → route-AzUNCIcU.js} +1 -1
  239. package/dist/client/assets/{route-B-HA2s4_.js → route-CKIi5OR7.js} +1 -1
  240. package/dist/client/assets/route-xJV1Kwll.js +1 -0
  241. package/dist/client/assets/{sandbox-lifecycle-context-D-PaTa6M.js → sandbox-lifecycle-context-2RE5Jlvg.js} +1 -1
  242. package/dist/client/assets/{schema-Dq7led26.js → schema-CINYRcKK.js} +1 -1
  243. package/dist/client/assets/{schema-CJ9UcSNs.js → schema-paIXrOCY.js} +1 -1
  244. package/dist/client/assets/{scroll-area-PZSCT0ow.js → scroll-area-BwaclrCR.js} +1 -1
  245. package/dist/client/assets/{search-input-DO66exG7.js → search-input-BG8rdrCe.js} +1 -1
  246. package/dist/client/assets/{search-toggle-DaBbNP1T.js → search-toggle-CShA1wOK.js} +1 -1
  247. package/dist/client/assets/{secret-picker-bljsK2mV.js → secret-picker-C6s_jvhV.js} +1 -1
  248. package/dist/client/assets/{secrets-CBAb9cvk.js → secrets-Bz4L84Vo.js} +1 -1
  249. package/dist/client/assets/{section-array-field-CPrkBgr3.js → section-array-field-B8BsNXRT.js} +1 -1
  250. package/dist/client/assets/{sections-T2vi-zI4.js → sections-CnLSarWD.js} +1 -1
  251. package/dist/client/assets/{sections-editor-DQwNUlLv.js → sections-editor-2QTriBkM.js} +1 -1
  252. package/dist/client/assets/{select-BABowMoY.js → select-iwVnUZSM.js} +1 -1
  253. package/dist/client/assets/{select-model-CbEyJ33x.js → select-model-DhxdeY5p.js} +1 -1
  254. package/dist/client/assets/{seo-editor-C9V4Y_YB.js → seo-editor-BPqT6KgW.js} +1 -1
  255. package/dist/client/assets/{separator-CM0d_WPE.js → separator-C1bonuaY.js} +1 -1
  256. package/dist/client/assets/settings-tab-S0xeJTM-.js +1 -0
  257. package/dist/client/assets/{sheet-BSCF-nmk.js → sheet-DUtlbS4K.js} +1 -1
  258. package/dist/client/assets/{shell-layout-d2Ief2ja.js → shell-layout-Dcfsytx-.js} +1 -1
  259. package/dist/client/assets/site-draft-actions-B5A2QjjI.js +3 -0
  260. package/dist/client/assets/{site-draft-view-CbKyFhEM.js → site-draft-view-DsHq6hEs.js} +1 -1
  261. package/dist/client/assets/site-editor-BUp_Zz62.js +1 -0
  262. package/dist/client/assets/{site-editor-toast-CluWI-yZ.js → site-editor-toast-DL4aC3pF.js} +1 -1
  263. package/dist/client/assets/{skills-BOpgUaHZ.js → skills-5rkbKVfD.js} +1 -1
  264. package/dist/client/assets/{slider-QcqvUsSI.js → slider-Cmkjh66S.js} +1 -1
  265. package/dist/client/assets/{sortable.esm-0yomt8g2.js → sortable.esm-C7rI9jHM.js} +1 -1
  266. package/dist/client/assets/{sso-CbSeZ9e5.js → sso-BEfIFSWt.js} +1 -1
  267. package/dist/client/assets/{suggestion-C9bDFuOo.js → suggestion-DGz7gtzE.js} +1 -1
  268. package/dist/client/assets/{super-agent-icon-DMm0_lmO.js → super-agent-icon-Dq4U-BQv.js} +1 -1
  269. package/dist/client/assets/{switch-CRe3xUPs.js → switch-BZMVD_xA.js} +1 -1
  270. package/dist/client/assets/{synced-repos-D900mhEv.js → synced-repos-MBV_b16M.js} +1 -1
  271. package/dist/client/assets/{tab-icon-glyph-D5lXXFkj.js → tab-icon-glyph-CeBm3H92.js} +1 -1
  272. package/dist/client/assets/{table-C-Iqqanf.js → table-C9boQ5tZ.js} +1 -1
  273. package/dist/client/assets/{tabs-CPwYT_wy.js → tabs-CFdE2LmD.js} +1 -1
  274. package/dist/client/assets/{task-board-B-Jl-DnQ.js → task-board-BZ6FZl9j.js} +1 -1
  275. package/dist/client/assets/{task-route-C-boE7jG.js → task-route-WWLMyAp6.js} +1 -1
  276. package/dist/client/assets/{task-status-Dg7JusRR.js → task-status-CLkNYnsS.js} +1 -1
  277. package/dist/client/assets/{taskboard-analytics-DwDfRDQC.js → taskboard-analytics-WayyDOd5.js} +1 -1
  278. package/dist/client/assets/tasks-B6kmgmmz.js +1 -0
  279. package/dist/client/assets/{tasks-ElocVpWd.js → tasks-DOLkXzI6.js} +1 -1
  280. package/dist/client/assets/{textarea-DSiKrnTK.js → textarea-hEv7rKyL.js} +1 -1
  281. package/dist/client/assets/{thread-analytics-BtdCUFGw.js → thread-analytics-CM8gvu0V.js} +1 -1
  282. package/dist/client/assets/{thread-intent-DnduoWYb.js → thread-intent-DMhB2sy4.js} +1 -1
  283. package/dist/client/assets/{thread-route-DSQLBJ4Y.js → thread-route-B_swkleJ.js} +1 -1
  284. package/dist/client/assets/{thread-route-D0P3i7B7.js → thread-route-Ce3yplCj.js} +1 -1
  285. package/dist/client/assets/{thread-sheet-body-BHjT7Rlx.js → thread-sheet-body-DTCZxxw9.js} +1 -1
  286. package/dist/client/assets/{time-range-picker-B0Xtja-D.js → time-range-picker-VzZM-nq4.js} +1 -1
  287. package/dist/client/assets/{toggle-group-CO1s8gR-.js → toggle-group-DDk8xPXe.js} +1 -1
  288. package/dist/client/assets/{tool-namespace-BskMFdfX.js → tool-namespace-EVeG8Fs5.js} +1 -1
  289. package/dist/client/assets/{tool-set-selector-DbHsII-W.js → tool-set-selector-DuVmSXqq.js} +1 -1
  290. package/dist/client/assets/{toolbar-icon-button-DQHnJFhG.js → toolbar-icon-button-99r2aG4V.js} +1 -1
  291. package/dist/client/assets/{tooltip-C1oPRuFg.js → tooltip-Dyh2h0NV.js} +1 -1
  292. package/dist/client/assets/{tooltipContext-Dk4Jh8sf.js → tooltipContext-CQdoW9wa.js} +1 -1
  293. package/dist/client/assets/{track-DQNlgsAd.js → track-B5m4mxJj.js} +1 -1
  294. package/dist/client/assets/{types-sVhbGxrT.js → types-Mb9DEKKQ.js} +1 -1
  295. package/dist/client/assets/{url-slug-kny4-Gd8.js → url-slug-Cli-NAkj.js} +1 -1
  296. package/dist/client/assets/{usage-stats-CkprzoQA.js → usage-stats-iRJ2oM0y.js} +1 -1
  297. package/dist/client/assets/{use-ai-providers-BmwnG2L7.js → use-ai-providers-DQAzIwY2.js} +1 -1
  298. package/dist/client/assets/{use-apply-named-rule-QQXumPyC.js → use-apply-named-rule-qGNe9B-Q.js} +1 -1
  299. package/dist/client/assets/use-ask-in-chat-4DqUxBJG.js +1 -0
  300. package/dist/client/assets/{use-automations-pGpYlQfd.js → use-automations-akR-tcRi.js} +1 -1
  301. package/dist/client/assets/{use-autosave-C1VLdEbv.js → use-autosave-ClND9MZU.js} +1 -1
  302. package/dist/client/assets/use-blocks-v8-project-DHH8umJ9.js +1 -0
  303. package/dist/client/assets/{use-chat-layout-state-Ep7OkPup.js → use-chat-layout-state-BsOGOEOo.js} +1 -1
  304. package/dist/client/assets/{use-cms-publish-actions-Cls9mAWe.js → use-cms-publish-actions-CntIxbra.js} +1 -1
  305. package/dist/client/assets/{use-connect-companion-B0uthGiU.js → use-connect-companion-FU7Yjyv3.js} +1 -1
  306. package/dist/client/assets/{use-connection-DFsrW4Mv.js → use-connection-e-hq9vT7.js} +1 -1
  307. package/dist/client/assets/{use-content-sync-BYcD8LZk.js → use-content-sync-tJgGPJpi.js} +1 -1
  308. package/dist/client/assets/{use-copy-9wHvlEmg.js → use-copy-DJs5balG.js} +1 -1
  309. package/dist/client/assets/{use-date-fns-locale-CfiWZhP7.js → use-date-fns-locale-DytcjJ4v.js} +1 -1
  310. package/dist/client/assets/{use-debounced-autosave-CK8e7jku.js → use-debounced-autosave-CY6fvvGj.js} +1 -1
  311. package/dist/client/assets/{use-debounced-value-Cs49dczG.js → use-debounced-value-CezJqVSj.js} +1 -1
  312. package/dist/client/assets/{use-deco-credits-ChuCrYAR.js → use-deco-credits-CHRRrI8G.js} +1 -1
  313. package/dist/client/assets/{use-decopilot-events-CR7NJgme.js → use-decopilot-events-CtnAXgLl.js} +1 -1
  314. package/dist/client/assets/{use-delete-connection-Dq2UKTpz.js → use-delete-connection-Cbnv8IDj.js} +1 -1
  315. package/dist/client/assets/{use-deployment-admin-CALPlo_8.js → use-deployment-admin-mLJFncG4.js} +1 -1
  316. package/dist/client/assets/{use-entitlements-DzfUP8ON.js → use-entitlements-mX8bg5XG.js} +1 -1
  317. package/dist/client/assets/{use-fast-preview-draft-url-B0ysxeQy.js → use-fast-preview-draft-url-DrTS3dt5.js} +1 -1
  318. package/dist/client/assets/{use-file-configs-CfNCrD6y.js → use-file-configs-z22DUi0c.js} +1 -1
  319. package/dist/client/assets/{use-id-selection-BeGsI2-X.js → use-id-selection-Bg3vd8Ma.js} +1 -1
  320. package/dist/client/assets/{use-inbox-feed-HViitByF.js → use-inbox-feed-r_crN8AB.js} +1 -1
  321. package/dist/client/assets/{use-infinite-scroll-DdKcODzJ.js → use-infinite-scroll-CvgjtV8K.js} +1 -1
  322. package/dist/client/assets/{use-join-requests-Dg5vHh8i.js → use-join-requests-DQ56VmKG.js} +1 -1
  323. package/dist/client/assets/{use-main-panel-tabs-DZH6Z-sf.js → use-main-panel-tabs-BzQUBql-.js} +1 -1
  324. package/dist/client/assets/{use-mcp-auth-status-C13HkQ9w.js → use-mcp-auth-status-D0LzrG1g.js} +1 -1
  325. package/dist/client/assets/{use-mcp-client-B9_8tfCL.js → use-mcp-client-CNXpOf52.js} +1 -1
  326. package/dist/client/assets/{use-mcp-prompts-NcFGfyZU.js → use-mcp-prompts-COb2l8gW.js} +1 -1
  327. package/dist/client/assets/{use-mcp-tools-wrSWiD0P.js → use-mcp-tools-fDABrIOV.js} +1 -1
  328. package/dist/client/assets/{use-mobile-DSmr8Fj3.js → use-mobile-DDy9Znlf.js} +1 -1
  329. package/dist/client/assets/{use-move-blocks-gne4gzCh.js → use-move-blocks-D7WfYgve.js} +1 -1
  330. package/dist/client/assets/{use-navigate-to-agent-ycEqYJX7.js → use-navigate-to-agent-B-iTaYhm.js} +1 -1
  331. package/dist/client/assets/{use-org-fs-C57fsXyq.js → use-org-fs-8086pm93.js} +1 -1
  332. package/dist/client/assets/{use-org-repo-syncs-BcOvlKwo.js → use-org-repo-syncs-BqoQhBbI.js} +1 -1
  333. package/dist/client/assets/{use-org-sso-B5c0saDF.js → use-org-sso-DNEWwtoA.js} +1 -1
  334. package/dist/client/assets/{use-organization-settings-B0lt5dXR.js → use-organization-settings-488vpN0c.js} +1 -1
  335. package/dist/client/assets/{use-project-native-view-presence-BBRyl28q.js → use-project-native-view-presence-C27ltBxd.js} +1 -1
  336. package/dist/client/assets/{use-project-scope-C1eT4xwT.js → use-project-scope-Dqnjf5Fg.js} +1 -1
  337. package/dist/client/assets/{use-recent-apps-CU27r377.js → use-recent-apps-2cMLzs_u.js} +1 -1
  338. package/dist/client/assets/{use-reports-diagnostic-QLTyI1c7.js → use-reports-diagnostic-JXB8tUrM.js} +1 -1
  339. package/dist/client/assets/{use-sandbox-events-BNcBCK9X.js → use-sandbox-events-D9uSNLH2.js} +1 -1
  340. package/dist/client/assets/{use-secrets-Dh7bZZgD.js → use-secrets-Bj9oVJrr.js} +1 -1
  341. package/dist/client/assets/{use-section-preview-base-53RIdpth.js → use-section-preview-base-DoOLobhv.js} +1 -1
  342. package/dist/client/assets/{use-sidebar-collapsed-XX5WdYs3.js → use-sidebar-collapsed-CSXlwHC3.js} +1 -1
  343. package/dist/client/assets/{use-tags-Cbxwh1yu.js → use-tags-CZ8FU88Q.js} +1 -1
  344. package/dist/client/assets/{use-task-board-analytics-BseFgQx7.js → use-task-board-analytics-S9D-SUGj.js} +1 -1
  345. package/dist/client/assets/{use-task-board-events-CMb3Vjy2.js → use-task-board-events-CuH-inlF.js} +1 -1
  346. package/dist/client/assets/{use-task-board-item-prs-2_-y1IH5.js → use-task-board-item-prs-DuTkhVPp.js} +1 -1
  347. package/dist/client/assets/{use-task-board-items-CnG0LR-k.js → use-task-board-items-BNRTDOsU.js} +1 -1
  348. package/dist/client/assets/{use-task-board-prompts-DschKVPr.js → use-task-board-prompts-CTcrXcvj.js} +1 -1
  349. package/dist/client/assets/{use-task-metadata-KJjG2-5j.js → use-task-metadata-BvTVrzAT.js} +1 -1
  350. package/dist/client/assets/{use-thread-outputs-B6Mbzgsq.js → use-thread-outputs-COaP8znq.js} +1 -1
  351. package/dist/client/assets/{use-voice-input-BVeAO01v.js → use-voice-input-miWnQR-2.js} +1 -1
  352. package/dist/client/assets/useInfiniteQuery-DqQNqcJl.js +1 -0
  353. package/dist/client/assets/{useQueries-COskgQPI.js → useQueries-BYTcJkC-.js} +1 -1
  354. package/dist/client/assets/useSuspenseInfiniteQuery-0A6saVT8.js +1 -0
  355. package/dist/client/assets/{users-D9U38Uiq.js → users-CkCjBxij.js} +1 -1
  356. package/dist/client/assets/{utils-C07I_8BL.js → utils-Cugj1NVM.js} +1 -1
  357. package/dist/client/assets/{variant-calendar-B1xF-pvj.js → variant-calendar-CumR4poM.js} +1 -1
  358. package/dist/client/assets/{variant-matcher-override-O46bQvi2.js → variant-matcher-override-CA2qg3Y9.js} +1 -1
  359. package/dist/client/assets/{view-header-CB8g9i8I.js → view-header-CNnF9Sbv.js} +1 -1
  360. package/dist/client/assets/{virtual-mcp-DkEy_7-s.js → virtual-mcp-NII7Lu6q.js} +1 -1
  361. package/dist/client/assets/{watch-sse-pool-BUtg06cI.js → watch-sse-pool-2U2aYEEI.js} +1 -1
  362. package/dist/client/index.html +1 -1
  363. package/dist/server/server.js +643 -643
  364. package/package.json +1 -1
  365. package/dist/client/assets/agent-app-S0Wudwb2.js +0 -1
  366. package/dist/client/assets/agent-deck-Cp4W6NYg.js +0 -1
  367. package/dist/client/assets/agent-experiments-DqEDCkUD.js +0 -1
  368. package/dist/client/assets/agent-library-D-dnSVJn.js +0 -1
  369. package/dist/client/assets/agent-library-file-S8fMrNmL.js +0 -1
  370. package/dist/client/assets/agent-overview-DTBRMEQ0.js +0 -1
  371. package/dist/client/assets/agent-settings-BiadK6yu.js +0 -1
  372. package/dist/client/assets/agent-site-editor-code-CYv63Bju.js +0 -2
  373. package/dist/client/assets/agent-site-editor-content-hqsSwJg4.js +0 -1
  374. package/dist/client/assets/agent-site-editor-preview-YV7jDYx1.js +0 -1
  375. package/dist/client/assets/agent-view-X2daaOWI.js +0 -1
  376. package/dist/client/assets/api-keys-D-r93aBn.js +0 -1
  377. package/dist/client/assets/blocks-tab-states-BLBUtwwS.js +0 -1
  378. package/dist/client/assets/cms-store-drafts-DOqjCS5l.js +0 -1
  379. package/dist/client/assets/library-bWgDO9u6.js +0 -1
  380. package/dist/client/assets/project-reports-yDx2KIN5.js +0 -1
  381. package/dist/client/assets/project-tasks-CZ24XPn7.js +0 -1
  382. package/dist/client/assets/reports-BeqJdfY-.js +0 -1
  383. package/dist/client/assets/repositories-BoB8X409.js +0 -1
  384. package/dist/client/assets/route-59M5FlvK.js +0 -1
  385. package/dist/client/assets/settings-tab-DUqPlhAE.js +0 -1
  386. package/dist/client/assets/site-draft-actions-CH7jTGTc.js +0 -3
  387. package/dist/client/assets/site-editor-CX53l3C_.js +0 -1
  388. package/dist/client/assets/tasks-DMBPC4PI.js +0 -1
  389. package/dist/client/assets/use-ask-in-chat-C56CHpt0.js +0 -1
  390. package/dist/client/assets/use-blocks-v8-project-DSiCCdEB.js +0 -1
  391. package/dist/client/assets/useInfiniteQuery-BvhkDMwv.js +0 -1
  392. package/dist/client/assets/useSuspenseInfiniteQuery-CHeSvNyF.js +0 -1
@@ -1 +1 @@
1
- import{c as N,q as W,i as C,K as g,eW as Ue,d2 as Fn,aE as Lt,aF as K,b9 as Qe,ba as Bn,e8 as De,e6 as Vn,bV as we,eX as Hn,eY as Jn,r as L,eZ as Wn,e_ as G,e$ as X,bA as Gn,a as Yn,as as _e,a4 as zn,bz as Ut,f0 as Xn,f1 as Qt,aq as Zn,bh as F,bo as Ct,f2 as qn,f3 as Kn,f4 as eo,t as ne,j as z}from"./index-XdUWZF5g.js";import{u as Ce}from"./repository-binding-Cfy_YQIZ.js";import{e as Ft}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as to}from"./chat-context-BwoQSegQ.js";import{i as no,u as oo}from"./use-sandbox-events-BNcBCK9X.js";import{u as Fe}from"./use-blocks-v8-project-DSiCCdEB.js";import{u as Bt}from"./use-voice-input-BVeAO01v.js";import{s as ft}from"./thread-intent-DnduoWYb.js";import{s as so}from"./utils-C07I_8BL.js";import{a as ro}from"./sandbox-git-api-DcqI6XE4.js";const w={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class S extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new S(t.code,t.message,t.data)}}const te="deco-content",Te={major:1},Vt=1;async function io(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 Re={major:Te.major,minor:Vt},Ht=`the endpoint speaks an older ${te} than this client needs (${Re.major}.${Re.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ae(e,t,n){const o={reason:t,required:{...Re}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const s=n.server;typeof s?.name=="string"&&typeof s.version=="string"&&(o.server={name:s.name,version:s.version})}return new S(w.Unsupported,e,o)}function Jt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==te)throw ae(`the endpoint speaks ${JSON.stringify(n)}, not ${te}`,"protocol",t);if(o?.major!==Te.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Te.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<Vt)throw ae(Ht,"outdated",t);return e}function dt(e,t){return t.code===w.MethodNotFound&&e.startsWith("changes.")?ae(Ht,"outdated"):S.from(t)}function Be(e){const t=e.fetch??(r=>fetch(r));let n=1;async function o(r){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(r)}));let c;try{c=await io(a)}catch{throw new S(w.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(c)&&c?.id===null){const l=c?.error;throw l?S.from(l):new S(w.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const s=async(r,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:r,params:i??{}});if(c.error)throw dt(r,c.error);return c.result};return{call:s,describe:async()=>Jt(await s("describe")),schemaGet:r=>s("schema.get",r),blocksList:r=>s("blocks.list",r),blocksApply:r=>s("blocks.apply",r),changesList:r=>s("changes.list",r),changesGet:r=>s("changes.get",r),changesDiscard:r=>s("changes.discard",r),async batch(r){const i=r.map(()=>n++),a=await o(r.map((l,u)=>({jsonrpc:"2.0",id:i[u],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,u)=>{const d=c.get(l);return d?d.error?{ok:!1,error:dt(r[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new S(w.InternalError,"no response for this call")}})}}}function Ve(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ht=20,gt=5,vt=500;function He(e){return e instanceof S?e.code===w.MethodNotFound?!0:e.code===w.Unsupported&&e.data?.reason==="outdated":!1}function de(e,t,n=e){return n&&n!==e?n:t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function ao(e,t,n){const o=g.contentChanges(n),s=e.getQueryData(o),r=await t.changesList(Ve(s)),i=de(s,r,e.getQueryData(o));if(i)return i;const a=await t.changesList({}),c=de(void 0,a,e.getQueryData(o));if(!c)throw new S(w.InternalError,"changes.list returned notModified without a cached list");return c}async function Wt(e,t){const n=[];for(let r=0;r<t.length;r+=ht)n.push(t.slice(r,r+ht));const o=Object.create(null),s=[];for(let r=0;r<n.length;r+=gt){const i=await e.batch(n.slice(r,r+gt).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),s.push(...c.diagnostics)}}return{entries:o,diagnostics:s}}async function Ar(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=vt){const s=t.slice(o,o+vt),r=await e.changesDiscard({names:s.map(i=>i.name),ifMatch:Object.fromEntries(s.map(i=>[i.name,i.version]))});n={revision:r.revision,versions:{...n.versions,...r.versions}}}return n}function Mr(e){return e instanceof S&&e.code===w.Conflict}function Je(e){return e?.kind==="protocol"?e:null}function Lr(e,t,n){const o=N.c(14);let s;o[0]!==n?(s={},o[0]=n,o[1]=s):s=o[1];const r=s,i=W();let a;o[2]!==e?(a=Je(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&r.enabled!==!1;let u;o[4]!==t?(u=g.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let d;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(d=l?()=>ao(i,c.client,t):Ue,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=d):d=o[10];let f;return o[11]!==u||o[12]!==d?(f={queryKey:u,queryFn:d,staleTime:0},o[11]=u,o[12]=d,o[13]=f):f=o[13],C(f)}function co(e){if(!e)return"";const t=Object.entries(e.changes).sort(([n],[o])=>n<o?-1:n>o?1:0).map(([n,o])=>[n,o.kind,o.version,o.baseVersion]);return JSON.stringify([e.revision,e.base.revision,e.base.resolvedRef,t])}function Ur(e,t,n){const o=N.c(14);let s;o[0]!==e?(s=Je(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!r&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?(l=g.contentChangeSides(t??"",co(n)),o[4]=t,o[5]=n,o[6]=l):l=o[6];let u;o[7]!==c||o[8]!==a||o[9]!==r?(u=c?()=>Wt(r.client,a):Ue,o[7]=c,o[8]=a,o[9]=r,o[10]=u):u=o[10];let d;return o[11]!==l||o[12]!==u?(d={queryKey:l,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=u,o[13]=d):d=o[13],C(d)}function Qr(e,t,n){const o=N.c(16);let s;o[0]!==e?(s=Je(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==r){const f=Object.entries(n?.changes??{}).filter(go).map(ho).sort(fo);a=f.map(uo);const h=JSON.stringify(f.map(lo));i=!!r&&!!t&&a.length>0,l=C,c=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=r,o[5]=i,o[6]=a,o[7]=c,o[8]=l}else i=o[5],a=o[6],c=o[7],l=o[8];let u;o[9]!==i||o[10]!==a||o[11]!==r?(u=i?async()=>{const f=await Wt(r.client,a),h=Object.create(null);for(const[v,b]of Object.entries(f.entries))h[v]=b.before&&typeof b.before=="object"?b.before:null;return h}:Ue,o[9]=i,o[10]=a,o[11]=r,o[12]=u):u=o[12];let d;return o[13]!==c||o[14]!==u?(d={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY,placeholderData:Fn},o[13]=c,o[14]=u,o[15]=d):d=o[15],l(d)}function lo(e){return[e.name,e.base]}function uo(e){return e.name}function fo(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function ho(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function go(e){const[,t]=e;return t.kind==="delete"}function Gt(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 he(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 Yt=Lt({endpoint:K().max(2048).refine(e=>Gt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Cr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=Yt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function zt(e){const t=Yt.safeParse(e);return t.success?t.data:null}const Xt="studio:deco-serve-last";function Fr(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function Br(){try{const e=localStorage.getItem(Xt);return e?zt(JSON.parse(e)):null}catch{return null}}function Vr(e){try{return new URL(he(e)).host}catch{return e}}function vo(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const bo="http://localhost:4545/rpc";class We extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function mo(e){if(e instanceof We)return{reason:"not-deco-serve"};if(!(e instanceof S))return{reason:"not-answering"};switch(e.code){case w.Unauthorized:case w.MethodNotFound:return{reason:"outdated"};case w.Unsupported:return He(e)?{reason:"outdated"}:{reason:"version-mismatch"};case w.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 Hr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,bo].filter(o=>!!o).map(he);return[...new Set(n)]}const po=Lt({blocks:De(K(),De(K(),Vn()).refine(Qe)),versions:De(K(),K().min(1)),missing:Bn(K())});function wo(e,t){const n=po.parse(e),o=Object.keys(n.blocks),s=Object.keys(n.versions),r=[...o,...n.missing],i=new Set(t);if(s.length!==o.length||o.some(a=>!Object.hasOwn(n.versions,a))||r.length!==i.size||new Set(r).size!==r.length||r.some(a=>!i.has(a)))throw new Error("The CMS block response did not account for the requested names");return n}function oe(e,t){const n=e.index?.entries[t];return!!n&&Qe(e.blocks[t])&&e.versions[t]===n.version}function So(e,t,n){const o=new Map;let s=!1;for(const[r,i]of Object.entries(n.blocks)){const a=t.index?.entries[r];if(a){if(n.versions[r]!==a.version){s||=a.version===e.index?.entries[r]?.version;continue}t.blocks[r]!==e.blocks[r]||t.versions[r]!==e.versions[r]||o.set(r,i)}}return s||=n.missing.some(r=>!!t.index?.entries[r]),{blocks:o.size?{...t.blocks,...Object.fromEntries(o)}:t.blocks,versions:o.size?{...t.versions,...Object.fromEntries([...o.keys()].map(r=>[r,n.versions[r]]))}:t.versions,refreshIndex:s}}function yo(e,t,n){return!!e.index&&t.every(o=>e.index?.entries[o]?oe(e,o)&&(!n||n[o]===e.blocks[o]):!n||n[o]===void 0)}const bt=50,mt=10;function ko(e,t=n=>fetch(n)){let n=1;return{async batch(o){const s=o.map(()=>n++),r=await t(new Request(e,{method:"POST",headers:{"content-type":"application/json"},credentials:"include",signal:we(),body:JSON.stringify(o.map((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new S(w.Unavailable,`the hosted CMS answered ${r.status}`);const i=await r.json(),a=new Map((Array.isArray(i)?i:[]).map(c=>[c.id,c]));return s.map(c=>{const l=a.get(c);return l?l.error?{ok:!1,error:S.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new S(w.InternalError,"no response for this call")}})}}}function Oo(e,t){if(!e)return t??{};const n={};for(const[o,s]of Object.entries(e.entries)){if(t&&Object.hasOwn(t,o)){n[o]=t[o];continue}n[o]={[Jn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Hn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function Eo(e,t){return e?.entries[t]?.meta?.refs??[]}function Do(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Ge(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function xe(e,t){if(Array.isArray(e)){for(const n of e)xe(n,t);return}if(Ge(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):xe(o,t)}function Zt(e,t){if(!Ge(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;xe(e,o);const s=[...o].filter(r=>t.has(r)).sort();return s.length>0&&(n.refs=s),Object.keys(n).length>0?n:void 0}function qt(e,t,n,o){G(e),e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.entries},i={...s.draft},a=new Set([...Object.keys(r),...Object.keys(o)]);for(const[c,l]of Object.entries(n)){const u=i[c]?.editor??null;if(l===null||l===X){delete r[c],i[c]={operation:"delete",version:X,editor:u};continue}const d=Zt(o[c],a);r[c]={version:l,...d?{meta:d}:{}},i[c]={operation:"set",version:l,editor:u}}return{...s,entries:r,draft:i}})}function Io(e,t,n,o){e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.draft},i={...s.entries};if(o===null)delete r[n];else if(r[n]={operation:o.block===null?"delete":"set",version:o.version,editor:r[n]?.editor??null},o.block===null)delete i[n];else{const a=new Set([...Object.keys(i),n]),c=Zt(o.block,a);i[n]={version:o.version,...c?{meta:c}:{}}}return{...s,entries:i,draft:r}})}const pt=new WeakMap;async function Ye(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new S(w.Unavailable,"The CMS index is not loaded yet");let i=pt.get(e);i||(i=new Map,pt.set(e,i));const a=e.getQueryData(g.decofile(n))??{},c=e.getQueryData(g.contentVersions(n))??{},l=[],u=[];for(const f of new Set(o)){const h=r.entries[f];if(!h||s.has(f)||Qe(a[f])&&c[f]===h.version)continue;const v=i.get(`${n}\0${f}`);v?l.push(v):u.push(f)}if(u.length>0){const f=To(e,t,n,u);for(const h of u){const v=`${n}\0${h}`;i.set(v,f),f.catch(()=>{}).finally(()=>{i.get(v)===f&&i.delete(v)})}l.push(f)}await Promise.all(l);const d=ge(e,n);if(o.some(f=>d.index?.entries[f]&&!s.has(f)&&!oe(d,f)))throw new S(w.Unavailable,"A CMS block changed while loading; try again")}async function _o(e,t,n,o,s){if(!t){const i=o?.[s];return Ge(i)&&!Gn(i)?i:void 0}await Ye(e,t,n,[s]);const r=ge(e,n);return r.index?.entries[s]&&oe(r,s)?r.blocks[s]:void 0}function ge(e,t){return{index:e.getQueryData(g.contentIndex(t)),blocks:e.getQueryData(g.decofile(t))??{},versions:e.getQueryData(g.contentVersions(t))??{}}}async function To(e,t,n,o){const s=ge(e,n),r=[];for(let i=0;i<o.length;i+=bt)r.push(o.slice(i,i+bt));for(let i=0;i<r.length;i+=mt){const a=r.slice(i,i+mt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new S(w.InternalError,"Incomplete CMS batch response");for(const[l,u]of c.entries()){if(!u.ok)throw u.error;const d=wo(u.result,a[l]),f=ge(e,n),h=So(s,f,d);if(G(e),h.blocks!==f.blocks&&e.setQueryData(g.decofile(n),h.blocks),h.versions!==f.versions&&e.setQueryData(g.contentVersions(n),h.versions),h.refreshIndex)throw e.invalidateQueries({queryKey:g.decofile(n),exact:!0},{cancelRefetch:!1}),new S(w.Unavailable,"The CMS index changed while loading blocks; try again")}}}function ze(e){const t=N.c(4);let n;t[0]!==e?(n=g.contentIndex(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Ro,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s}async function Ro(){throw new Error("the content index is set by the poll")}function wt(e,t){const n=N.c(8);let o;n[0]!==t?(o=Wn(t),n[0]=t,n[1]=o):o=n[1];const s=o;let r;n[2]!==e||n[3]!==s?(r=a=>e.getQueryCache().subscribe(c=>{c.query.queryHash===s&&a()}),n[2]=e,n[3]=s,n[4]=r):r=n[4];let i;return n[5]!==e||n[6]!==t?(i=()=>e.getQueryData(t),n[5]=e,n[6]=t,n[7]=i):i=n[7],L.useSyncExternalStore(r,i)}const St=3e4;function xo(e){if(!(e instanceof S))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function Po(e,t,n,o){const s=N.c(15),r=W(),i=ze(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const c=wt(r,a);let l;s[2]!==t?(l=g.contentVersions(t),s[2]=t,s[3]=l):l=s[3];const u=wt(r,l),d=o?.withRefs??!1,f=new Set(n);if(d)for(const p of n)for(const E of Eo(i,p))f.add(E);const h=[...f].filter(p=>!!i?.entries[p]).sort(),v={index:i,blocks:c??{},versions:u??{}},b=h.some(p=>!oe(v,p)),m=JSON.stringify(h.map(p=>[p,i?.entries[p]?.version,oe(v,p)])),[R,k]=L.useState(null),[$,I]=L.useState(0),_=R?.key===m?R:null;L.useEffect(()=>{if(!e||!m)return;let p=!0;const E=JSON.parse(m).map($o);return Ye(r,e,t,E).then(()=>{p&&k(j=>j?.key===m?null:j)},j=>{p&&k(U=>({key:m,count:(U?.key===m?U.count:0)+1,retryAfterMs:xo(j)}))}),()=>{p=!1}},[e,r,t,m,$]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const p=Math.min(St,_.retryAfterMs??Ft(St,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(jo),p);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let y;s[7]!==_?(y=[_],s[7]=_,s[8]=y):y=s[8],L.useEffect(T,y);const O=!e||yo(v,[...f],o?.listing),D=!!e&&b&&_!==null;let x;s[9]!==I?(x=()=>I(No),s[9]=I,s[10]=x):x=s[10];let A;return s[11]!==O||s[12]!==D||s[13]!==x?(A={ready:O,failed:D,retry:x},s[11]=O,s[12]=D,s[13]=x,s[14]=A):A=s[14],A}function No(e){return e+1}function jo(e){return e+1}function $o(e){const[t]=e;return t}const Kt=L.createContext(null);function Ao(e){const t=N.c(24),n=L.useContext(Kt),o=Fe(n?null:e),{data:s}=Yn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?_e.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[c,l]=kt(a);let u;t[4]!==i||t[5]!==r||t[6]!==e?(u=i?_e.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=u):u=t[7];const[d,f]=kt(u);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?zt(c):null,t[8]=c,t[9]=i,t[10]=o,t[11]=h):h=t[11];const v=h,b=i&&o&&typeof d=="string"?d:null;let m;t[12]!==f||t[13]!==l||t[14]!==i?(m=$=>{i&&(l($),f($.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=m):m=t[15];let R;t[16]!==l||t[17]!==i?(R=()=>{i&&l(null)},t[16]=l,t[17]=i,t[18]=R):R=t[18];let k;return t[19]!==v||t[20]!==b||t[21]!==m||t[22]!==R?(k={connection:v,lastEndpoint:b,set:m,clear:R},t[19]=v,t[20]=b,t[21]=m,t[22]=R,t[23]=k):k=t[23],k}function yt(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function kt(e){const t=N.c(17),n=W(),o=e??"";let s;t[0]!==o?(s=["localStorage",o],t[0]=o,t[1]=s):s=t[1];const r=s;let i,a;t[2]!==e?(i=()=>e?yt(e):null,a=()=>e?yt(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==r||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:r,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=r,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:u}=C(l);let d;t[10]!==e||t[11]!==n||t[12]!==r?(d=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(r,b)}},t[10]=e,t[11]=n,t[12]=r,t[13]=d):d=t[13];const f=d,h=e?u??null:null;let v;return t[14]!==f||t[15]!==h?(v=[h,f],t[14]=f,t[15]=h,t[16]=v):v=t[16],v}function en(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function Mo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function Jr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Wr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Gr(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 Yr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Gt(t)?t:null}function zr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function tn(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function Lo(e){if(!e.hasProject)return"legacy";const t=tn(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 Uo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function Ot(e){return e.isError||e.errorUpdateCount>0}function Qo(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const s of n)Object.hasOwn(t,s)?o[s]=t[s]:delete o[s];return o}function Co(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 nn="__noSchema";function on(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[nn]:!0}}function Xr(e){return!!e&&e[nn]===!0}function Xe(e){if(!e.ok)return e.error.code===w.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Fo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Bo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Zr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},r=typeof s.__resolveType=="string"?s.__resolveType:null,i=t.get(r)??[];i.push({key:n,label:Fo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Bo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Et(n.resolveType).localeCompare(Et(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Et(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Dt(e,t,n){if(t.length===0)return n;const[o,...s]=t;if(Array.isArray(e)&&typeof o=="number"){const r=e.slice();return r[o]=Dt(e[o],s,n),r}if(e&&typeof e=="object"&&typeof o=="string"){const r=e,i={};for(const a of Object.keys(r))i[a]=a===o?Dt(r[a],s,n):r[a];return i}return e}function qr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class It extends Error{}const Ze="site-not-owned";async function Vo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Ho(e,t=n=>fetch(n)){const n=Be({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:we(o.signal)}));if(await Vo(s))throw new It;return s}});try{return await Ke(n)}catch(o){if(o instanceof It)return Ze;throw o}}async function Jo(e,t,n){await t();const o=await Ho(e,n);return o===Ze?o:{...o,hosted:ko(e,n)}}const qe=5e3;function Wo(e){if(!e.site)throw new Error("this project names no site");return Xn(e.site,e.branch)}function Go(e){return new URL(Se(e,"rpc"),window.location.origin).href}async function Ke(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!==te)throw new We;const s=Jt(t.result);if(!n)throw new Error("no schema.get");if(Xe(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function Yo(e,t=n=>fetch(n)){return Ke(Be({endpoint:e,fetch:n=>t(new Request(n,{signal:we(n.signal)}))}))}function re(e,t){const n=N.c(40),{org:o}=zn(),{connection:s}=Ao(e),{runtime:r}=Bt(e),i=L.useContext(Kt),a=Fe(e),c=Ut(Ce(e)?.metadata),l=tn({hasServeConnection:!!s,runtime:r}),u=en(l,s?.endpoint??""),d=to()?.taskId??null,f=no(oo().lifecycle.phase),h=W(),v=Uo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,m=C({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Jo(Wo({orgSlug:o.slug,site:c,branch:t}),()=>Qt(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,..._t}),R=v.sandbox&&!!o.slug&&!!e&&!!t;let k;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(k=()=>Yo(Go({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:d})),n[0]=t,n[1]=o.slug,n[2]=d,n[3]=e,n[4]=k):k=n[4];const $=C({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:k,enabled:R,staleTime:Number.POSITIVE_INFINITY,..._t}),I=!!s;let _;n[5]!==s?.endpoint||n[6]!==o.slug||n[7]!==e?(_=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[5]=s?.endpoint,n[6]=o.slug,n[7]=e,n[8]=_):_=n[8];let T;n[9]!==s?(T=()=>ts(s.endpoint),n[9]=s,n[10]=T):T=n[10];let y;n[11]!==I||n[12]!==_||n[13]!==T?(y={queryKey:_,queryFn:T,enabled:I,staleTime:Number.POSITIVE_INFINITY,retry:Zo,retryDelay:Xo,refetchInterval:zo},n[11]=I,n[12]=_,n[13]=T,n[14]=y):y=n[14];const O=C(y);let D;n[15]!==s?.endpoint||n[16]!==o.slug||n[17]!==e?(D=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[15]=s?.endpoint,n[16]=o.slug,n[17]=e,n[18]=D):D=n[18];const x=D;let A;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(A=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=A):A=n[22];let p;n[23]!==O.data||n[24]!==x||n[25]!==h?(p=async()=>{try{return await O.data.client.describe()}catch(q){const Cn=q;throw h.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),Cn}},n[23]=O.data,n[24]=x,n[25]=h,n[26]=p):p=n[26];const E=!!O.data&&!i;let j;n[27]!==A||n[28]!==p||n[29]!==E?(j={queryKey:A,queryFn:p,enabled:E,refetchInterval:qe,retry:!1},n[27]=A,n[28]=p,n[29]=E,n[30]=j):j=n[30];const M=C(j).data??O.data?.describe,Q=Lo({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:m.data===Ze?"not-owned":m.data?"ready":Ot(m)?"error":"loading",sandboxSite:qo({data:$.data,isError:Ot($),workingTreeReady:f})});if(Q==="pending")return{kind:"pending",...u};if(Q==="retrying-sandbox")return{kind:"pending",retrying:"sandbox",...u};if(Q==="legacy")return{kind:"legacy"};if(Q==="protocol-github")return{...Pe(u,m.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Pe(u,$.data);if(Q==="unavailable-github"){let q;return n[31]!==u?(q={kind:"unavailable",...u},n[31]=u,n[32]=q):q=n[32],q}const P=O.error??O.failureReason,V=s?.endpoint??"";let H;return n[33]!==M||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==V||n[38]!==P?(H=es({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:M,endpoint:V}),n[33]=M,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=V,n[38]=P,n[39]=H):H=n[39],H}function zo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?qe:!1}function Xo(e){return vo(e+1)}function Zo(e,t){return!(t instanceof S)&&!(t instanceof We)}function qo(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Ko=3;function es(e){const t=en("local",e.endpoint),n=e.probed?Pe(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<Ko?n:{kind:"unavailable",...t,problem:mo(e.failure)}:n??{kind:"pending",...t}}const _t={retry:2,refetchInterval:e=>e.state.status==="error"?qe:!1};function Pe(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function ts(e,t){return Ke(Be({endpoint:e,fetch:n=>fetch(n,{signal:we(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function Ne(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ns(e,t){return Ne({...e,protocolSuffix:t.cacheKeySuffix})}function os(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function ss(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,Mo(t)])}function rs(e,t,n){const o=N.c(21),s=W(),r=re(e?.virtualMcpId,e?.branch),i=e&&r.kind==="protocol"&&r.hosted?r:null;let a;o[0]!==i||o[1]!==e?(a=i&&e?ns(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const c=Po(i?.hosted,a,t,n),l=e!==null;let u;o[3]!==r.kind||o[4]!==c||o[5]!==l?(u=os(l,r.kind,c),o[3]=r.kind,o[4]=c,o[5]=l,o[6]=u):u=o[6];const d=u,f=r.kind!=="legacy";let h;o[7]!==r||o[8]!==e?(h=ss(e,r),o[7]=r,o[8]=e,o[9]=h):h=o[9];let v;o[10]!==r.kind||o[11]!==r.source||o[12]!==c||o[13]!==s||o[14]!==e?(v=()=>{if(c.retry(),!e||r.kind!=="unavailable")return;const m=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...m==="local"?["local"]:[e.branch,m])})},o[10]=r.kind,o[11]=r.source,o[12]=c,o[13]=s,o[14]=e,o[15]=v):v=o[15];let b;return o[16]!==d||o[17]!==f||o[18]!==h||o[19]!==v?(b={...d,v8:f,scopeKey:h,retry:v},o[16]=d,o[17]=f,o[18]=h,o[19]=v,o[20]=b):b=o[20],b}function sn(e){const t=N.c(12);let n;t[0]!==e?(n=_e.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Zn(o,null),i=Fe(e);let a;t[2]!==s||t[3]!==e?(a=e?ft(s):null,t[2]=s,t[3]=e,t[4]=a):a=t[4];const l=i?null:a;let u,d;t[5]!==r?(u=h=>r(ft(h)),d=()=>r(null),t[5]=r,t[6]=u,t[7]=d):(u=t[6],d=t[7]);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f={url:l,setUrl:u,clear:d},t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}const Tt=6e4,is=2147483647;function as(e,t){if(e===null||e.trim()==="")return Tt;const n=e.trim(),o=/^\d+(?:\.\d+)?$/.test(n)?Number(n)*1e3:/^[A-Za-z]{3}, /.test(n)?Math.max(0,Date.parse(n)-t):Number.NaN;return Number.isFinite(o)&&o>=0&&o<=is?o:Tt}class rn extends Error{constructor(t,n,o,s=Date.now()){super(t),this.status=n,this.name="ContentResponseError",this.retryAt=n===429?s+as(o,s):null}status;retryAt}function cs(e,t,n=Date.now()){const o=Ft(5e3,1e3,e,2,0);return t instanceof rn&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function et(e,t){const n=await e.json().catch(()=>null),o=n!==null&&typeof n=="object"&&"error"in n&&typeof n.error=="string"?n.error:`${t} failed (${e.status})`;throw new rn(o,e.status,e.headers.get("retry-after"))}function ls(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Rt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function ye(e,t,n){return["decofile-write",e,t,n]}function us(e,t,n){return{id:ye(e,t,n).join(":")}}class tt extends Error{constructor(t,n,o=[],s=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=s,this.name="BlockConflictError"}blocks;fields;carriedStored}function nt(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function ot(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function fs(e,t){return et(e,t)}function ds(e,t,n){e.setQueryData(g.decofileDraft(nt(t)),n)}function hs(e,t){return e.getQueryData(g.decofileDraft(nt(t)))??null}async function gs(e,t){return(await fetch(ot(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function Kr(e){const t=N.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?nt(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:vs,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s??null}async function vs(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function bs(e,t){const n=await fetch(ot(t),{cache:"no-store"});if(!n.ok)return et(n,"Read decofile");const o=await n.json();return o.token&&ds(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function ei(e,t){const n=await fetch(ot(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const s=await n.json().catch(()=>({}));throw s.code==="block-conflict"?new tt(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return fs(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const an=3e3,ms=15e3,ps=2*6e4,cn={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function ws(e){return e<ps?an:ms}function Ss(e,t=cn){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,ws(t.now()-n)))},a=()=>{if(r=null,o)return;const{read:c,skip:l}=e();if(s||t.hidden()||l?.()){i();return}s=!0;let u;try{u=c()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{s=!1}),i()};return i(),()=>{o=!0,r!==null&&t.clearTimeout(r)}}const xt=()=>0;function ys(e,t,n=cn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>Ss(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,xt,xt)}function ln(e,t){return Se(e,t)}function ks(e,t){return Se(e,"preview-fetch",{path:t})}function ti(e){return ln(e,"preview-invoke")}function ni(e){return ln(e,"catalog-invoke")}function un(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 Os(){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&&un(n))return n}return null}function Es(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Os();return n&&un(n)?new URL(t,n).toString():ks(e,t)}function Ds(e){return Es(e,"/.decofile")}function Is(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function Pt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function _s(e,t){const n=Se(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),s=Is(o.status);if(s==="absent")return{kind:"absent"};if(s==="unavailable")return{kind:"unavailable"};if(s==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const r=await o.json();return typeof r.content!="string"?{kind:"unavailable"}:{kind:"data",data:so(r.content)}}async function Ts(e,t){const n=await _s(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function oi(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)return et(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Rs(e){return Ce(e)?.metadata?.runtime?.path??null}function je(e,t,n,o){const s=F(e),r=Object.keys(n?.changes??{}).find(a=>F(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>F(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>F(c)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class fn extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function si(e){return e instanceof S&&e.code===w.Conflict}function dn(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 st extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class rt extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ri(e,t){return(t instanceof st||t instanceof rt)&&(t.message=hn(e,t,"github")),t}function hn(e,t,n){if(t instanceof st)return e("siteEditor.save.draftUnread");if(t instanceof rt)return e("siteEditor.save.keptChanging");if(t instanceof tt)return t.message;if(n==="local")return Ps(e,t);if(t instanceof S)switch(t.code){case w.Conflict:return e("siteEditor.save.conflict");case w.ReadOnly:return e("siteEditor.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("siteEditor.save.invalid");case w.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function xs(e,t){if(t==="local"||e instanceof tt||e instanceof st||e instanceof rt)return null;if(e instanceof S){const n=e.code===w.InvalidBlock||e.code===w.InvalidParams?dn(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Ps(e,t){if(t instanceof fn)return e("decoServe.save.serverGone");if(t instanceof S)switch(t.code){case w.Conflict:return e("decoServe.save.conflict");case w.ReadOnly:return e("decoServe.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("decoServe.save.invalid",{detail:dn(t)});case w.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Ns(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function js(e,t){const[n,o]=L.useState(e),s=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){s.current??=Date.now();return}if(!n)return;const r=()=>{s.current=null,o(!1)},i=Ns(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const $s="decocms:content-writes",$e=new Set;let Y;function gn(){if(Y!==void 0)return Y;Y=null;try{typeof BroadcastChannel=="function"&&(Y=new BroadcastChannel($s),Y.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...$e])n(t)}))}catch{Y=null}return Y}function As(e){try{gn()?.postMessage({cacheKey:e})}catch{}}function Ms(e){return gn(),$e.add(e),()=>{$e.delete(e)}}const vn="__at=",bn="__test=",Ls=/^[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 Us(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&Ls.test(e)}function Nt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Qs(e){const t=e.tests??{};return[...e.at!==void 0?[vn+Nt(e.at)]:[],...Object.keys(t).map(n=>bn+Nt(`${n}=${t[n]?"on":"off"}`))]}function jt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(vn)&&!s.startsWith(bn)),...t];return o.length>0?`?${o.join("&")}`:""}function ve(e,t){const n=Qs(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+jt(o===-1?"":e.slice(o+1),n);const r=e.lastIndexOf("@");if(r<=0)return e;const i=e.slice(0,r),a=i.indexOf("?"),c=a===-1?i:i.slice(0,a),l=a===-1?"":i.slice(a+1);return`${c}${jt(l,n)}${e.slice(r)}`}function ii(e,t,n){if(!Us(t))return e;try{const o=new URL(e),s=o.searchParams.get("__draft");return s&&s!=="off"?(o.searchParams.set("__draft",ve(s,t)),o.toString()):ee(n)?(o.searchParams.set("__draft",ve(n,t)),o.toString()):e}catch{return e}}function ai(e,t,n="/"){if(!e||!ee(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function mn(e){return btoa(encodeURIComponent(e))}function ci(e,t,n){const o=Cs(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Cs(e,t,n){const o=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return s.searchParams.set("path","/"),s.searchParams.set("pathTemplate","/"),s.searchParams.set("props",mn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Fs="__draft";function li(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Bs="off";function Vs(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Fs,t),n.toString()}function ui(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:s,...r}=e.pageBlock,i=JSON.stringify({__props:r,__decofile:e.decofile});return{src:o.toString(),body:i}}function fi(e,t,n,o){const s=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,s);r.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),r.searchParams.set("props",mn(JSON.stringify({sections:i}))),r.toString()}function di(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function pn(e,t,n){return`${e}@${t}=${n}`}function hi(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[pn(e,"sections",t.index)]}function gi(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[pn(e.pageKey,o,e.selectedVariantIndex)]}function vi(e,t){return[...t,...e]}function Hs(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function it(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),s=o.indexOf("?"),r=s===-1?o:o.slice(0,s),a=[...s===-1?[]:o.slice(s+1).split("&").filter(l=>l&&!l.startsWith($t)),...t.map(l=>$t+Hs(l))],c=a.length>0?`?${a.join("&")}`:"";return`${r}${c}${e.slice(n)}`}function bi(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),s=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return it(`${s}${o.pathname}@local`,t)}catch{return null}}function mi(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",it(o,t)),n.toString())}catch{return e}}function Js(e){const{pointer:t}=e;if(!t||t===Bs)return null;const n=t.indexOf("?");return ee(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:ee(e.heldRevision)&&e.forcedVariants.length===0?ve(e.heldRevision,e.previewOptions):ve(it(t,e.forcedVariants),e.previewOptions)}function Ws(e,t){if(!e||!t)return null;try{return Vs(e,t)}catch{return null}}function pi(e,t,n){if(!e||!n)return null;try{return Ws(new URL(t,e).toString(),n)}catch{return null}}const be={forcedVariants:[],previewOptions:{}},ce=new Map,le=new Map,Ae=new Map;function wn(e){for(const t of Ae.get(e)??[])t()}function Sn(e,t){const n=ee(t)?t:null;(le.get(e)??null)!==n&&(n?le.set(e,n):le.delete(e),wn(e))}function Gs(e){return le.get(e)??null}function Ys(e,t){return JSON.stringify(e)===JSON.stringify(t)}function wi(e,t){const n=ce.get(e)??be,o=t??be;Ys(n,o)||(t?ce.set(e,o):ce.delete(e),wn(e))}function zs(e){return ce.get(e)??be}function yn(e,t){let n=Ae.get(e);return n||(n=new Set,Ae.set(e,n)),n.add(t),()=>{n.delete(t)}}function Xs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>yn(e,s),o=()=>zs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Zs)}function Zs(){return be}function qs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>e?yn(e,s):er,o=()=>e?Gs(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Ks)}function Ks(){return null}function er(){}function Si(e,t){const n=N.c(4),o=Xs(e),s=qs(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Js({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const kn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},tr=15e3,me=new Map;function Z(e,t){return`${e}/${t}`}function B(e){let t=me.get(e);return t||(t={state:kn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},me.set(e,t)),t}function J(e,t){const n=B(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function ke(e){e.timer&&clearTimeout(e.timer),e.timer=null}function at(e){return me.get(e)?.state??kn}function nr(e,t){const n=B(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function yi(e){const t=B(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(ke(t),J(e,{phase:"idle"}))}}function ki(e){const t=me.get(e);!t||t.state.phase!=="reloading"||(ke(t),J(e,{phase:"idle"}))}function On(e){const t=B(e);ke(t),J(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=B(e),o=Math.max(0,n.state.inFlight-1);if(o>0){J(e,{inFlight:o});return}if(!t.ok||n.previews===0){J(e,{phase:"idle",inFlight:o});return}En(e,t.navigates,o)}function En(e,t,n=0){const o=B(e);ke(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&J(e,{phase:"idle"})},tr),J(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function or(e){return e?.kind==="protocol"&&e.source==="github"}async function fe(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,s)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=r?g.protocolDraftRead(o,s,r):null,u=l?JSON.stringify(n.getQueryData(l)??null):null,d=c?[c]:[];if(a&&t.reread&&d.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&d.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),r&&i.source==="sandbox"&&d.push(n.invalidateQueries({queryKey:ro(o,s,r)})),or(i)&&l&&!t.adopted&&d.push(n.invalidateQueries({queryKey:l})),await Promise.all(d),t.kind!=="edit"){const v=Z(o,s);J(v,{epoch:at(v).epoch+1})}const f=l?JSON.stringify(n.getQueryData(l)??null):null,h=u!==f;return h&&await new Promise(v=>Ct.schedule(v)),{navigates:h}}async function sr(e,t){return On(Z(e.orgSlug,e.virtualMcpId)),Dn(e,t)}function At(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Dn(e,t){const n=Z(e.orgSlug,e.virtualMcpId),o=t.adopted?At(e):null;let s;try{s=await t.write()}catch(i){throw ue(n,{ok:!1,navigates:!1}),t.refreshOnError&&fe(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&As(e.cacheKey),Sn(n,t.shownRevision?.(s)??null),t.adopted){const i=At(e)!==o;return i&&await new Promise(a=>Ct.schedule(a)),ue(n,{ok:!0,navigates:i}),t.reread&&fe(e,t).catch(()=>{}),s}let r=!1;try{({navigates:r}=await fe(e,t))}catch{}finally{ue(n,{ok:!0,navigates:r})}return s}function Oi(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=Z(o,s),a=new Set(t.blockKeys);for(const u of[...B(i).discardListeners])u(a);On(i);let c=!1;const l=()=>(c=!0,Dn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:ye(o,s,r),scope:us(o,s,r),mutationFn:l}).execute(void 0).catch(u=>{throw c||ue(i,{ok:!1,navigates:!1}),u}):l()}function Ei(e,t,n){const o=N.c(8);let s;o[0]!==e||o[1]!==t?(s=Z(e,t),o[0]=e,o[1]=t,o[2]=s):s=o[2];const r=s;let i;o[3]!==n||o[4]!==r?(i=()=>{const c=B(r).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=r,o[5]=i):i=o[5];let a;o[6]!==r?(a=[r],o[6]=r,o[7]=a):a=o[7],L.useEffect(i,a)}function In(e){const t=Z(e.orgSlug,e.virtualMcpId);at(t).inFlight>0||(Sn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=B(t);o.previews>0&&o.state.inFlight===0&&En(t,n)}).catch(()=>{}))}function rr(e,t){const n=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 s=o;let r;n[3]!==s?(r=l=>nr(s,l),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>at(s),n[5]=s,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const ir=500;function Di(e,t){const{phase:n}=rr(e,t);return js(n!=="idle",ir)}function ar(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function _n(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Ii(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Do(i,n):cr(e,t,n)}const s=e.getQueryData(g.contentVersions(t));if(!s)return;if(Object.hasOwn(s,n))return s[n];const r=e.getQueryData(g.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function Tn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(s=>F(s)===n);return o===void 0?void 0:e.changes[o]}function cr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return Rn(o,Oe(e,t),n)}function Rn(e,t,n){const o=Tn(e,n);return o?.kind==="delete"?o.version??X:o?o.version:t.has(F(n))?X:null}function _i(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=Tn(o,n);return s?s.kind==="set"&&s.baseVersion===null:Oe(e,t).has(F(n))}function Ti(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=Oe(e,t);return{blocks:n,versionOf:r=>Rn(o,s,r)}}function Oe(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function pe(e,t,n,o){const s=F(n),r=Oe(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),G(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function xn(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([f,h])=>[f,h===X?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>je(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[F(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const m=je(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:m}:m!==null?h[v]={kind:"delete",version:null,baseVersion:m}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?pe(e,n,f,!1):!u.has(F(f))&&l.has(f)&&pe(e,n,f,!0);const d=o.revision;return d&&d!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),f=>f&&{...f,version:d}),s}function Ee(e,t,n){G(e),e.setQueryData(g.contentVersions(t),o=>{const s={...o};for(const[r,i]of Object.entries(n))i===null?delete s[r]:s[r]=i;return s})}function Pn(e,t){const n=e.getMutationCache().findAll({mutationKey:ye(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Co(o.state.variables)))}function Me(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function se(e,t,n,o){try{return await o()}catch(s){const r=!(s instanceof S);throw t.source==="local"&&r?(Me(e,n),new fn(s)):(t.source==="local"&&He(s)&&Me(e,n),s)}}const Mt=new WeakMap;function ct(e){let t=Mt.get(e);return t||(t={inFlight:new Map,rereading:new Set},Mt.set(e,t)),t}function Nn(e,t,n,o){const{inFlight:s}=ct(e),r=s.get(o);if(r)return r;const i=lt(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function lr(e,t,n){const o=N.c(8),s=W(),r=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==r||o[4]!==s||o[5]!==i?(c=()=>{if(!e||!r||!i||!a)return;const u={orgSlug:r,virtualMcpId:i,branch:a},{rereading:d}=ct(s);return Ms(f=>{f===n&&(d.has(n)||(d.add(n),fr(s,e,u,n).catch(ur).finally(()=>d.delete(n))))})},l=[s,e,r,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=r,o[4]=s,o[5]=i,o[6]=c,o[7]=l):(c=o[6],l=o[7]),L.useEffect(c,l)}function ur(){}async function fr(e,t,n,o){const s=ct(e).inFlight.get(o);return s&&await s.catch(()=>{}),Nn(e,t,n,o)}async function lt(e,t,n,o,s){G(e);const r=g.decofile(o),i=_n(n,t),a=g.contentRevision(o),c=g.contentVersions(o),l=e.getQueryData(r),u=e.getQueryData(c),f=e.getQueryData(i),h=e.getQueryData(a)??void 0,v=s&&l&&u?h?.revision:void 0,b=s&&f?h?.schemaVersion:void 0,m=g.contentChanges(o),R=e.getQueryData(m);if(t.source==="github"&&t.hosted)return dr(e,t,t.hosted,n,o,{conditional:s,seen:h,currentMeta:f,schemaIfNoneMatch:b,seenChanges:R});const[k,$,I]=await se(e,t,n,()=>t.client.batch([{method:"blocks.list",params:v?{ifNoneMatch:v}:{}},{method:"schema.get",params:b?{ifNoneMatch:b}:{}},{method:"changes.list",params:Ve(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(m,E)}else I&&t.source==="local"&&He(I.error)&&Me(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const y=k.result,O=Xe($),D=$.ok&&!O?$.result:null;if(y.notModified&&(!l||!u)||D?.notModified&&!f)return lt(e,t,n,o,!1);const x=y.notModified?new Set:Pn(e,n),A=y.notModified?l:Qo(y.blocks,l,x),p=O?on():D?D.notModified?f:D.schema:$.error;if(e.setQueryData(a,{revision:T?_:y.notModified?h?.revision:y.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,A),!y.notModified){const E=e.getQueryData(c),j={...y.versions};for(const U of x){const M=E?.[U];M!==void 0?j[U]=M:delete j[U]}e.setQueryData(c,j)}return p instanceof S||e.setQueryData(i,p),!T&&!y.notModified&&l&&h?.revision&&y.revision!==h.revision&&In({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:p}}async function dr(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),c=g.contentRevision(s),l=g.contentVersions(s),u=_n(o,t),d=g.contentChanges(s),f=e.getQueryData(a),h=r.conditional&&f?r.seen?.revision:void 0,[v,b,m]=await se(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:r.schemaIfNoneMatch?{ifNoneMatch:r.schemaIfNoneMatch}:{}},{method:"changes.list",params:Ve(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,$=k!==void 0&&k!==r.seen?.revision;if(m?.ok&&!$){const P=de(r.seenChanges,m.result);P&&e.setQueryData(d,P)}if(!v?.ok)throw v?.error??new Error("no cms.index");if(!b)throw new Error("no schema.get");const I=v.result,_=Xe(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return lt(e,t,o,s,!1);const y=_?on():T?T.notModified?r.currentMeta:T.schema:b.error;y instanceof S||e.setQueryData(u,y);const O=T?T.notModified?r.seen?.schemaVersion:T.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||$)return e.setQueryData(c,{revision:$?k:r.seen?.revision,schemaVersion:O}),e.setQueryData(i,D),{blocks:D,meta:y};const x={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,x);const A=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!f&&jn(f.draft,x.draft));A&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),P=>P&&{...P,version:x.revision}),e.setQueryData(c,{revision:x.revision,schemaVersion:O});const p=Pn(e,o),E=e.getQueryData(l)??{},j={},U={},M=[];for(const[P,V]of Object.entries(D)){const H=x.entries[P];!H&&!p.has(P)||(j[P]=V,E[P]!==void 0&&(U[P]=E[P]),H&&!p.has(P)&&E[P]!==H.version&&M.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),M.length>0&&await Ye(e,n,s,M,p),R&&A&&hr(R,x)&&In({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??j,meta:y}}function hr(e,t){if(jn(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 jn(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 gr(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 Ie(e){if(!(e instanceof S)||e.code!==w.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"))}async function vr(e,t){if(!(e instanceof S)||e.code!==w.Conflict)return;const n=e.data?.entries;if(!n||typeof n!="object")return;const o=Object.entries(n);if(o.length===0)return;const s=t.set??{},r=new Set(t.delete??[]),i={};for(const[a,c]of o){const l=c?.actual;if(typeof l!="string"||(Object.hasOwn(s,a)?await eo(s[a]):r.has(a)?X:void 0)!==l)return;i[a]=l}return i}function br(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([s])=>!Object.hasOwn(t,s))),o=(e.delete??[]).filter(s=>!Object.hasOwn(t,s));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function ie(e,t,n,o,s){G(e),xn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),Ee(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===X?null:i]))),qt(e,n,s,o.set??{})}async function Ri(e,t,n,o,s,r){if(t.source==="github"){const a=[...Object.keys(s.set??{}),...s.delete??[]].filter(l=>!r||!Object.hasOwn(r,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const c=qn(s.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return sr({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=(u,d=r)=>se(e,t,n,()=>t.client.blocksApply({set:u.set,delete:u.delete,...d?{ifMatch:gr(d,u)}:{}}));let a;try{a=await i(s)}catch(u){const d=t.source==="github"?Ie(u):void 0;if(!d)throw u;const f=br(s,d);Object.keys(d).length>0&&ie(e,n,o,s,d);let h;try{h=await i(f)}catch(v){const b=Ie(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const m=await vr(v,f);if(!m)throw v;ie(e,n,o,f,m);try{h=await i(f,{...r,...m})}catch(R){const k=Ie(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}G(e);const c=t.source==="github"?xn(e,n,o,a):a.revision;t.source==="github"&&qt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),u=>({...u,revision:c}));const l=a.versions??{};return Ee(e,o,l),{revision:c,versions:l}}})}function $n(e,t){if(!(e instanceof S))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 An(e,t,n){if(!(n instanceof S))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&pe(e,t,s,!1)}function Mn(e,t,n,o){G(e),Kn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=je(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=F(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>F(u)!==c));s?a!==null&&(l[n]={kind:"delete",version:null,baseVersion:a}):l[n]={kind:"set",version:o.version,baseVersion:a},e.setQueryData(g.contentChanges(t),{...i,changes:l,edited:!0})}pe(e,t,n,s&&a===null),e.setQueryData(g.decofile(t),c=>{const l={...c};return s?delete l[n]:l[n]=o.block,l}),Ee(e,t,{[n]:s?null:o.version}),Io(e,t,n,o)}function xi(e,t,n,o){if(t.source!=="github"||!(o instanceof S))return!1;An(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>$n(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,c)=>{Mn(e,n,a,i[c])}),!0)}async function Pi(e,t,n,o,s,r){t.source==="github"&&An(e,o,r);const i=t.source==="github"?$n(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),Mn(e,o,s,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const l=(await se(e,t,n,()=>t.client.changesGet({names:[s]}))).entries[s];if(l&&l.after===null&&l.version!==null)return!1;a={value:l?.after??null,version:l?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),u=>{if(!u)return u;const d={...u.changes};return l?.kind?d[s]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete d[s],{...u,changes:d,edited:!0}})}catch{const c=await se(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[s]??null,version:c.versions[s]??null}}return e.setQueryData(g.decofile(o),c=>{const l={...c};return a.value===null?delete l[s]:l[s]=a.value,l}),Ee(e,o,{[s]:a.version}),!1}function mr(e){const t=N.c(17),n=Ce(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=Ut(n),t[0]=n,t[1]=o):o=t[1];const s=o;let r;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(r=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=r):r=t[5];let i;t[6]!==e||t[7]!==s?(i=async()=>{const b=await Qt(s,e.branch),m=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&m>0?b.pointer.slice(0,m):null,version:b.pointer&&m>0?b.pointer.slice(m+1):b.etag}},t[6]=e,t[7]=s,t[8]=i):i=t[8];const a=!!e&&!!s;let c;t[9]!==r||t[10]!==i||t[11]!==a?(c={queryKey:r,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=r,t[10]=i,t[11]=a,t[12]=c):c=t[12];const{data:l,isPending:u,isError:d}=C(c),f=!!e&&!!s&&u&&!d;if(!e||!l?.draft||!l.version){let b;return t[13]!==f?(b={pointer:null,pending:f},t[13]=f,t[14]=b):b=t[14],b}const h=`${l.draft}@${l.version}`;let v;return t[15]!==h?(v={pointer:h,pending:!1},t[15]=h,t[16]=v):v=t[16],v}function Ni(e){return mr(e).pointer}function ji(e){const t=N.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:pr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function pr(){throw new Error("content revisions are set by reads and writes")}function ut(e,t){const n=N.c(6),{url:o}=sn(e?.virtualMcpId),s=re(e?.virtualMcpId,e?.branch);if(!e)return"";let r;return n[0]!==s.cacheKeySuffix||n[1]!==s.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(r=s.kind!=="legacy"&&s.cacheKeySuffix!==void 0?Ne({...e,protocolSuffix:s.cacheKeySuffix}):Ne({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=s.cacheKeySuffix,n[1]=s.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=r):r=n[5],r}function $i(e,t){const n=N.c(46),{url:o}=sn(e?.virtualMcpId),s=!!o,r=re(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=ut(e),c=t?.fetchEnabled??!0,l=Rs(e?.virtualMcpId),u=Bt(e?.virtualMcpId).runtime==="cms",d=W();let f;n[0]!==a?(f=g.decofile(a),n[0]=a,n[1]=f):f=n[1];const h=f;lr(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==d||n[4]!==h?(v=()=>{if(!e||d.isMutating({mutationKey:ye(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const E=d.getQueryState(h);return E?.fetchStatus==="fetching"||Date.now()-(E?.dataUpdatedAt??0)<an/2},n[2]=e,n[3]=d,n[4]=h,n[5]=v):v=n[5];let b;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==i||n[10]!==d||n[11]!==h?(b=async()=>{if(e){if(!i&&u&&!s){const E=hs(d,e)?.version;if(E&&!await gs(e,E))return}await d.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=i,n[10]=d,n[11]=h,n[12]=b):b=n[12];let m;n[13]!==v||n[14]!==b?(m={skip:v,read:b},n[13]=v,n[14]=b,n[15]=m):m=n[15],ys(!!t?.pollWhile&&!!e,m);const R=ze(i?.hosted?a:"");let k;n[16]!==r.kind||n[17]!==u||n[18]!==c||n[19]!==a||n[20]!==s||n[21]!==o||n[22]!==l||n[23]!==e||n[24]!==i||n[25]!==d?(k=async()=>{if(i)return(await Nn(d,i,e,a)).blocks;if(r.kind==="unavailable")throw ar("decofile");if(s){const M=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Sr),Q=M?.ok?Rt(await M.text()):null;if(Q)return Q;const P=new Error("decofile unavailable (local tunnel unreachable)");throw P.status=502,P}if(u)return bs(d,e);const E=()=>Ts(e,ls(l,".deco/blocks.gen.json"));if(c){const M=await fetch(Ds(e),{cache:"no-store"}).catch(wr);if(M?.ok){const V=Rt(await M.text());if(V)return V}const Q=await E();if(Q.kind==="data")return Q.data;const P=new Error(`Failed to fetch decofile: ${M?.status??"network error"}`);throw P.status=Pt({liveOk:!!M?.ok,liveStatus:M?.status,committedAbsent:Q.kind==="absent"}),P}const j=await E();if(j.kind==="data")return j.data;const U=new Error("decofile unavailable (preview down, no committed snapshot)");throw U.status=Pt({liveOk:!1,committedAbsent:j.kind==="absent"}),U},n[16]=r.kind,n[17]=u,n[18]=c,n[19]=a,n[20]=s,n[21]=o,n[22]=l,n[23]=e,n[24]=i,n[25]=d,n[26]=k):k=n[26];const $=!!e&&r.kind!=="pending",I=i?0:3e4,_=i?.describe.pollIntervalMs,T=i?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==i?(y=(E,j)=>{if(i||u||s)return E<3;const U=j.status;return U!==502&&U!==404&&E<2},n[27]=u,n[28]=s,n[29]=i,n[30]=y):y=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==$||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==y?(O={queryKey:h,queryFn:k,enabled:$,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:y,retryDelay:cs},n[31]=h,n[32]=k,n[33]=$,n[34]=I,n[35]=_,n[36]=T,n[37]=y,n[38]=O):O=n[38];const D=C(O);let x;n[39]!==R||n[40]!==D?(x=R&&D.data?Oo(R,D.data):void 0,n[39]=R,n[40]=D,n[41]=x):x=n[41];const A=x;let p;return n[42]!==A||n[43]!==i?.hosted||n[44]!==D?(p=i?.hosted&&A?{...D,data:A}:D,n[42]=A,n[43]=i?.hosted,n[44]=D,n[45]=p):p=n[45],p}function wr(){return null}function Sr(){return null}function Ai(e,t,n){return rs(e,t,n)}function Mi(e){const t=N.c(4),n=W(),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,c)=>_o(n,r,s,a,c),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function Li(e,t){const n=N.c(3),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=ze(o.kind==="protocol"&&o.hosted?s:"");let i;return n[0]!==r?.entries||n[1]!==t?(i=Object.entries(r?.entries??{}).filter(a=>{const[,c]=a;return t(c.meta?.type??"")}).map(yr),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function yr(e){const[t]=e;return t}const kr="site-editor-save",Ln={id:kr,description:void 0,action:void 0,cancel:void 0},Ui="site-editor-undo",Le="site-editor-publish";function Or(e){const t=N.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=z.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=s):s=t[1];let r;t[2]!==o?(r=z.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=r):r=t[3];let i;return t[4]!==s||t[5]!==r?(i=z.jsxs("details",{className:"mt-1 text-xs",children:[s,r]}),t[4]=s,t[5]=r,t[6]=i):i=t[6],i}function Un(e,t){return t?z.jsx(Or,{label:e("siteEditor.details"),detail:t}):void 0}function Qi(e,t,n){ne.error(hn(e,t,n),{...Ln,description:Un(e,xs(t,n))})}function Ci(e,t,n=!1){ne.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Ln,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Qn={action:void 0,duration:void 0};function Fi(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Qn,id:Le,description:void 0})}function Bi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Un(e,o??null);ne[i](t,{id:Le,description:n&&a?z.jsxs(z.Fragment,{children:[z.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ne.loading(r??e("thread.publishPopover.publishing"),{...Qn,id:Le,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function Vi(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Mo as $,Yr as A,di as B,Mi as C,Di as D,Gr as E,mr as F,Z as G,qs as H,wi as I,bi as J,ve as K,Bs as L,Vs as M,ii as N,mi as O,ci as P,ki as Q,yi as R,rr as S,Kt as T,ji as U,ui as V,us as W,ye as X,sr as Y,_s as Z,fs as _,Hr as a,fi as a$,ns as a0,Lr as a1,Qr as a2,Li as a3,rs as a4,Ci as a5,_i as a6,ri as a7,tt as a8,si as a9,Si as aA,pi as aB,rt as aC,xi as aD,Nn as aE,cs as aF,oi as aG,Le as aH,Qn as aI,Fi as aJ,Oi as aK,Ar as aL,Mr as aM,He as aN,Kr as aO,Ni as aP,li as aQ,ee as aR,ai as aS,Bi as aT,Ui as aU,Ln as aV,S as aW,w as aX,Ye as aY,Pn as aZ,Oo as a_,ar as aa,fr as ab,st as ac,Ri as ad,Pi as ae,Qi as af,Ii as ag,_n as ah,ds as ai,ei as aj,Ei as ak,Ti as al,Wr as am,Zr as an,Et as ao,Dt as ap,qr as aq,Es as ar,zr as as,bo as at,Un as au,Vi as av,Cs as aw,Ur as ax,ao as ay,Or as az,Ao as b,ni as b0,hi as b1,gi as b2,vi as b3,sn as c,vo as d,Vr as e,mo as f,ts as g,ti as h,Gt as i,ks as j,$i as k,ut as l,Jr as m,Xr as n,Rs as o,Cr as p,ls as q,Br as r,Fr as s,Ai as t,re as u,Js as v,Ws as w,Us as x,Ts as y,tn as z};
1
+ import{c as N,q as W,i as C,K as g,eW as Ue,d2 as Fn,aE as Lt,aF as K,b9 as Qe,ba as Bn,e8 as De,e6 as Vn,bV as we,eX as Hn,eY as Jn,r as L,eZ as Wn,e_ as G,e$ as X,bA as Gn,a as Yn,as as _e,a4 as zn,bz as Ut,f0 as Xn,f1 as Qt,aq as Zn,bh as F,bo as Ct,f2 as qn,f3 as Kn,f4 as eo,t as ne,j as z}from"./index-Dd5hidCj.js";import{u as Ce}from"./repository-binding-DV3kkbZ_.js";import{e as Ft}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as to}from"./chat-context-DgCR75CY.js";import{i as no,u as oo}from"./use-sandbox-events-D9uSNLH2.js";import{u as Fe}from"./use-blocks-v8-project-DHH8umJ9.js";import{u as Bt}from"./use-voice-input-miWnQR-2.js";import{s as ft}from"./thread-intent-DMhB2sy4.js";import{s as so}from"./utils-Cugj1NVM.js";import{a as ro}from"./sandbox-git-api-DcqI6XE4.js";const w={MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,NotFound:-32001,Conflict:-32002,InvalidBlock:-32003,ReadOnly:-32005,Unsupported:-32006,LimitExceeded:-32007,Unavailable:-32008,Unauthorized:-32010};class S extends Error{code;data;constructor(t,n,o){super(n),this.name="ContentProtocolError",this.code=t,this.data=o}toJSON(){return this.data===void 0?{code:this.code,message:this.message}:{code:this.code,message:this.message,data:this.data}}static from(t){return new S(t.code,t.message,t.data)}}const te="deco-content",Te={major:1},Vt=1;async function io(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 Re={major:Te.major,minor:Vt},Ht=`the endpoint speaks an older ${te} than this client needs (${Re.major}.${Re.minor} or newer): update @decocms/blocks in the site (8.2.0 or newer) and start deco serve again`;function ae(e,t,n){const o={reason:t,required:{...Re}};if(n){o.actual={protocol:n.protocol,major:n.version?.major,minor:n.version?.minor};const s=n.server;typeof s?.name=="string"&&typeof s.version=="string"&&(o.server={name:s.name,version:s.version})}return new S(w.Unsupported,e,o)}function Jt(e){const t=e??{},{protocol:n,version:o}=t;if(n!==te)throw ae(`the endpoint speaks ${JSON.stringify(n)}, not ${te}`,"protocol",t);if(o?.major!==Te.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Te.major}.x`,"major",t);if(typeof o.minor!="number"||o.minor<Vt)throw ae(Ht,"outdated",t);return e}function dt(e,t){return t.code===w.MethodNotFound&&e.startsWith("changes.")?ae(Ht,"outdated"):S.from(t)}function Be(e){const t=e.fetch??(r=>fetch(r));let n=1;async function o(r){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(r)}));let c;try{c=await io(a)}catch{throw new S(w.Unavailable,`the endpoint answered HTTP ${a.status} without a JSON-RPC body`)}if(!a.ok||!Array.isArray(c)&&c?.id===null){const l=c?.error;throw l?S.from(l):new S(w.Unavailable,`the endpoint answered HTTP ${a.status}`)}return c}const s=async(r,i)=>{const a=n++,c=await o({jsonrpc:"2.0",id:a,method:r,params:i??{}});if(c.error)throw dt(r,c.error);return c.result};return{call:s,describe:async()=>Jt(await s("describe")),schemaGet:r=>s("schema.get",r),blocksList:r=>s("blocks.list",r),blocksApply:r=>s("blocks.apply",r),changesList:r=>s("changes.list",r),changesGet:r=>s("changes.get",r),changesDiscard:r=>s("changes.discard",r),async batch(r){const i=r.map(()=>n++),a=await o(r.map((l,u)=>({jsonrpc:"2.0",id:i[u],method:l.method,params:l.params??{}}))),c=new Map(a.map(l=>[l.id,l]));return i.map((l,u)=>{const d=c.get(l);return d?d.error?{ok:!1,error:dt(r[u].method,d.error)}:{ok:!0,result:d.result}:{ok:!1,error:new S(w.InternalError,"no response for this call")}})}}}function Ve(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ht=20,gt=5,vt=500;function He(e){return e instanceof S?e.code===w.MethodNotFound?!0:e.code===w.Unsupported&&e.data?.reason==="outdated":!1}function de(e,t,n=e){return n&&n!==e?n:t.notModified?e?{...e,base:t.base}:null:{revision:t.revision,base:t.base,changes:t.changes}}async function ao(e,t,n){const o=g.contentChanges(n),s=e.getQueryData(o),r=await t.changesList(Ve(s)),i=de(s,r,e.getQueryData(o));if(i)return i;const a=await t.changesList({}),c=de(void 0,a,e.getQueryData(o));if(!c)throw new S(w.InternalError,"changes.list returned notModified without a cached list");return c}async function Wt(e,t){const n=[];for(let r=0;r<t.length;r+=ht)n.push(t.slice(r,r+ht));const o=Object.create(null),s=[];for(let r=0;r<n.length;r+=gt){const i=await e.batch(n.slice(r,r+gt).map(a=>({method:"changes.get",params:{names:a}})));for(const a of i){if(!a.ok)throw a.error;const c=a.result;Object.assign(o,c.entries),s.push(...c.diagnostics)}}return{entries:o,diagnostics:s}}async function Ar(e,t){let n={revision:"",versions:{}};for(let o=0;o<t.length;o+=vt){const s=t.slice(o,o+vt),r=await e.changesDiscard({names:s.map(i=>i.name),ifMatch:Object.fromEntries(s.map(i=>[i.name,i.version]))});n={revision:r.revision,versions:{...n.versions,...r.versions}}}return n}function Mr(e){return e instanceof S&&e.code===w.Conflict}function Je(e){return e?.kind==="protocol"?e:null}function Lr(e,t,n){const o=N.c(14);let s;o[0]!==n?(s={},o[0]=n,o[1]=s):s=o[1];const r=s,i=W();let a;o[2]!==e?(a=Je(e),o[2]=e,o[3]=a):a=o[3];const c=a,l=!!c&&!!t&&r.enabled!==!1;let u;o[4]!==t?(u=g.contentChanges(t??""),o[4]=t,o[5]=u):u=o[5];let d;o[6]!==t||o[7]!==l||o[8]!==c||o[9]!==i?(d=l?()=>ao(i,c.client,t):Ue,o[6]=t,o[7]=l,o[8]=c,o[9]=i,o[10]=d):d=o[10];let f;return o[11]!==u||o[12]!==d?(f={queryKey:u,queryFn:d,staleTime:0},o[11]=u,o[12]=d,o[13]=f):f=o[13],C(f)}function co(e){if(!e)return"";const t=Object.entries(e.changes).sort(([n],[o])=>n<o?-1:n>o?1:0).map(([n,o])=>[n,o.kind,o.version,o.baseVersion]);return JSON.stringify([e.revision,e.base.revision,e.base.resolvedRef,t])}function Ur(e,t,n){const o=N.c(14);let s;o[0]!==e?(s=Je(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i;o[2]!==n?(i=n?Object.keys(n.changes):[],o[2]=n,o[3]=i):i=o[3];const a=i,c=!!r&&!!t&&!!n&&a.length>0;let l;o[4]!==t||o[5]!==n?(l=g.contentChangeSides(t??"",co(n)),o[4]=t,o[5]=n,o[6]=l):l=o[6];let u;o[7]!==c||o[8]!==a||o[9]!==r?(u=c?()=>Wt(r.client,a):Ue,o[7]=c,o[8]=a,o[9]=r,o[10]=u):u=o[10];let d;return o[11]!==l||o[12]!==u?(d={queryKey:l,queryFn:u,staleTime:Number.POSITIVE_INFINITY},o[11]=l,o[12]=u,o[13]=d):d=o[13],C(d)}function Qr(e,t,n){const o=N.c(16);let s;o[0]!==e?(s=Je(e),o[0]=e,o[1]=s):s=o[1];const r=s;let i,a,c,l;if(o[2]!==t||o[3]!==n?.changes||o[4]!==r){const f=Object.entries(n?.changes??{}).filter(go).map(ho).sort(fo);a=f.map(uo);const h=JSON.stringify(f.map(lo));i=!!r&&!!t&&a.length>0,l=C,c=g.contentDeletedCopies(t??"",h),o[2]=t,o[3]=n?.changes,o[4]=r,o[5]=i,o[6]=a,o[7]=c,o[8]=l}else i=o[5],a=o[6],c=o[7],l=o[8];let u;o[9]!==i||o[10]!==a||o[11]!==r?(u=i?async()=>{const f=await Wt(r.client,a),h=Object.create(null);for(const[v,b]of Object.entries(f.entries))h[v]=b.before&&typeof b.before=="object"?b.before:null;return h}:Ue,o[9]=i,o[10]=a,o[11]=r,o[12]=u):u=o[12];let d;return o[13]!==c||o[14]!==u?(d={queryKey:c,queryFn:u,staleTime:Number.POSITIVE_INFINITY,placeholderData:Fn},o[13]=c,o[14]=u,o[15]=d):d=o[15],l(d)}function lo(e){return[e.name,e.base]}function uo(e){return e.name}function fo(e,t){return e.name<t.name?-1:e.name>t.name?1:0}function ho(e){const[t,n]=e;return{name:t,base:n.baseVersion??""}}function go(e){const[,t]=e;return t.kind==="delete"}function Gt(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 he(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 Yt=Lt({endpoint:K().max(2048).refine(e=>Gt(e)&&new URL(e).pathname==="/rpc").transform(he)});function Cr(e){const t=new URLSearchParams(e.replace(/^#/,"")),n=Yt.safeParse({endpoint:t.get("endpoint")??""});return n.success?n.data:null}function zt(e){const t=Yt.safeParse(e);return t.success?t.data:null}const Xt="studio:deco-serve-last";function Fr(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function Br(){try{const e=localStorage.getItem(Xt);return e?zt(JSON.parse(e)):null}catch{return null}}function Vr(e){try{return new URL(he(e)).host}catch{return e}}function vo(e,t=1e4){return Math.min(1e3*2**Math.max(0,e-1),t)}const bo="http://localhost:4545/rpc";class We extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function mo(e){if(e instanceof We)return{reason:"not-deco-serve"};if(!(e instanceof S))return{reason:"not-answering"};switch(e.code){case w.Unauthorized:case w.MethodNotFound:return{reason:"outdated"};case w.Unsupported:return He(e)?{reason:"outdated"}:{reason:"version-mismatch"};case w.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 Hr(e,t){if(e)return[he(e.endpoint)];const n=[t?.endpoint,bo].filter(o=>!!o).map(he);return[...new Set(n)]}const po=Lt({blocks:De(K(),De(K(),Vn()).refine(Qe)),versions:De(K(),K().min(1)),missing:Bn(K())});function wo(e,t){const n=po.parse(e),o=Object.keys(n.blocks),s=Object.keys(n.versions),r=[...o,...n.missing],i=new Set(t);if(s.length!==o.length||o.some(a=>!Object.hasOwn(n.versions,a))||r.length!==i.size||new Set(r).size!==r.length||r.some(a=>!i.has(a)))throw new Error("The CMS block response did not account for the requested names");return n}function oe(e,t){const n=e.index?.entries[t];return!!n&&Qe(e.blocks[t])&&e.versions[t]===n.version}function So(e,t,n){const o=new Map;let s=!1;for(const[r,i]of Object.entries(n.blocks)){const a=t.index?.entries[r];if(a){if(n.versions[r]!==a.version){s||=a.version===e.index?.entries[r]?.version;continue}t.blocks[r]!==e.blocks[r]||t.versions[r]!==e.versions[r]||o.set(r,i)}}return s||=n.missing.some(r=>!!t.index?.entries[r]),{blocks:o.size?{...t.blocks,...Object.fromEntries(o)}:t.blocks,versions:o.size?{...t.versions,...Object.fromEntries([...o.keys()].map(r=>[r,n.versions[r]]))}:t.versions,refreshIndex:s}}function yo(e,t,n){return!!e.index&&t.every(o=>e.index?.entries[o]?oe(e,o)&&(!n||n[o]===e.blocks[o]):!n||n[o]===void 0)}const bt=50,mt=10;function ko(e,t=n=>fetch(n)){let n=1;return{async batch(o){const s=o.map(()=>n++),r=await t(new Request(e,{method:"POST",headers:{"content-type":"application/json"},credentials:"include",signal:we(),body:JSON.stringify(o.map((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new S(w.Unavailable,`the hosted CMS answered ${r.status}`);const i=await r.json(),a=new Map((Array.isArray(i)?i:[]).map(c=>[c.id,c]));return s.map(c=>{const l=a.get(c);return l?l.error?{ok:!1,error:S.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new S(w.InternalError,"no response for this call")}})}}}function Oo(e,t){if(!e)return t??{};const n={};for(const[o,s]of Object.entries(e.entries)){if(t&&Object.hasOwn(t,o)){n[o]=t[o];continue}n[o]={[Jn]:!0,...s.meta?.type?{__resolveType:s.meta.type}:{},...s.meta?.path!==void 0?{path:s.meta.path}:{},...s.meta?.refs?.length?{[Hn]:s.meta.refs}:{}}}for(const[o,s]of Object.entries(t??{}))Object.hasOwn(n,o)||(n[o]=s);return n}function Eo(e,t){return e?.entries[t]?.meta?.refs??[]}function Do(e,t){return Object.hasOwn(e.draft,t)?e.draft[t]?.version??null:null}function Ge(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function xe(e,t){if(Array.isArray(e)){for(const n of e)xe(n,t);return}if(Ge(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):xe(o,t)}function Zt(e,t){if(!Ge(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;xe(e,o);const s=[...o].filter(r=>t.has(r)).sort();return s.length>0&&(n.refs=s),Object.keys(n).length>0?n:void 0}function qt(e,t,n,o){G(e),e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.entries},i={...s.draft},a=new Set([...Object.keys(r),...Object.keys(o)]);for(const[c,l]of Object.entries(n)){const u=i[c]?.editor??null;if(l===null||l===X){delete r[c],i[c]={operation:"delete",version:X,editor:u};continue}const d=Zt(o[c],a);r[c]={version:l,...d?{meta:d}:{}},i[c]={operation:"set",version:l,editor:u}}return{...s,entries:r,draft:i}})}function Io(e,t,n,o){e.setQueryData(g.contentIndex(t),s=>{if(!s)return s;const r={...s.draft},i={...s.entries};if(o===null)delete r[n];else if(r[n]={operation:o.block===null?"delete":"set",version:o.version,editor:r[n]?.editor??null},o.block===null)delete i[n];else{const a=new Set([...Object.keys(i),n]),c=Zt(o.block,a);i[n]={version:o.version,...c?{meta:c}:{}}}return{...s,entries:i,draft:r}})}const pt=new WeakMap;async function Ye(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new S(w.Unavailable,"The CMS index is not loaded yet");let i=pt.get(e);i||(i=new Map,pt.set(e,i));const a=e.getQueryData(g.decofile(n))??{},c=e.getQueryData(g.contentVersions(n))??{},l=[],u=[];for(const f of new Set(o)){const h=r.entries[f];if(!h||s.has(f)||Qe(a[f])&&c[f]===h.version)continue;const v=i.get(`${n}\0${f}`);v?l.push(v):u.push(f)}if(u.length>0){const f=To(e,t,n,u);for(const h of u){const v=`${n}\0${h}`;i.set(v,f),f.catch(()=>{}).finally(()=>{i.get(v)===f&&i.delete(v)})}l.push(f)}await Promise.all(l);const d=ge(e,n);if(o.some(f=>d.index?.entries[f]&&!s.has(f)&&!oe(d,f)))throw new S(w.Unavailable,"A CMS block changed while loading; try again")}async function _o(e,t,n,o,s){if(!t){const i=o?.[s];return Ge(i)&&!Gn(i)?i:void 0}await Ye(e,t,n,[s]);const r=ge(e,n);return r.index?.entries[s]&&oe(r,s)?r.blocks[s]:void 0}function ge(e,t){return{index:e.getQueryData(g.contentIndex(t)),blocks:e.getQueryData(g.decofile(t))??{},versions:e.getQueryData(g.contentVersions(t))??{}}}async function To(e,t,n,o){const s=ge(e,n),r=[];for(let i=0;i<o.length;i+=bt)r.push(o.slice(i,i+bt));for(let i=0;i<r.length;i+=mt){const a=r.slice(i,i+mt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new S(w.InternalError,"Incomplete CMS batch response");for(const[l,u]of c.entries()){if(!u.ok)throw u.error;const d=wo(u.result,a[l]),f=ge(e,n),h=So(s,f,d);if(G(e),h.blocks!==f.blocks&&e.setQueryData(g.decofile(n),h.blocks),h.versions!==f.versions&&e.setQueryData(g.contentVersions(n),h.versions),h.refreshIndex)throw e.invalidateQueries({queryKey:g.decofile(n),exact:!0},{cancelRefetch:!1}),new S(w.Unavailable,"The CMS index changed while loading blocks; try again")}}}function ze(e){const t=N.c(4);let n;t[0]!==e?(n=g.contentIndex(e),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:Ro,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s}async function Ro(){throw new Error("the content index is set by the poll")}function wt(e,t){const n=N.c(8);let o;n[0]!==t?(o=Wn(t),n[0]=t,n[1]=o):o=n[1];const s=o;let r;n[2]!==e||n[3]!==s?(r=a=>e.getQueryCache().subscribe(c=>{c.query.queryHash===s&&a()}),n[2]=e,n[3]=s,n[4]=r):r=n[4];let i;return n[5]!==e||n[6]!==t?(i=()=>e.getQueryData(t),n[5]=e,n[6]=t,n[7]=i):i=n[7],L.useSyncExternalStore(r,i)}const St=3e4;function xo(e){if(!(e instanceof S))return;const t=e.data?.retryAfterMs;return typeof t=="number"&&t>0?t:void 0}function Po(e,t,n,o){const s=N.c(15),r=W(),i=ze(t);let a;s[0]!==t?(a=g.decofile(t),s[0]=t,s[1]=a):a=s[1];const c=wt(r,a);let l;s[2]!==t?(l=g.contentVersions(t),s[2]=t,s[3]=l):l=s[3];const u=wt(r,l),d=o?.withRefs??!1,f=new Set(n);if(d)for(const p of n)for(const E of Eo(i,p))f.add(E);const h=[...f].filter(p=>!!i?.entries[p]).sort(),v={index:i,blocks:c??{},versions:u??{}},b=h.some(p=>!oe(v,p)),m=JSON.stringify(h.map(p=>[p,i?.entries[p]?.version,oe(v,p)])),[R,k]=L.useState(null),[$,I]=L.useState(0),_=R?.key===m?R:null;L.useEffect(()=>{if(!e||!m)return;let p=!0;const E=JSON.parse(m).map($o);return Ye(r,e,t,E).then(()=>{p&&k(j=>j?.key===m?null:j)},j=>{p&&k(U=>({key:m,count:(U?.key===m?U.count:0)+1,retryAfterMs:xo(j)}))}),()=>{p=!1}},[e,r,t,m,$]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const p=Math.min(St,_.retryAfterMs??Ft(St,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(jo),p);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let y;s[7]!==_?(y=[_],s[7]=_,s[8]=y):y=s[8],L.useEffect(T,y);const O=!e||yo(v,[...f],o?.listing),D=!!e&&b&&_!==null;let x;s[9]!==I?(x=()=>I(No),s[9]=I,s[10]=x):x=s[10];let A;return s[11]!==O||s[12]!==D||s[13]!==x?(A={ready:O,failed:D,retry:x},s[11]=O,s[12]=D,s[13]=x,s[14]=A):A=s[14],A}function No(e){return e+1}function jo(e){return e+1}function $o(e){const[t]=e;return t}const Kt=L.createContext(null);function Ao(e){const t=N.c(24),n=L.useContext(Kt),o=Fe(n?null:e),{data:s}=Yn.useSession(),r=s?.user?.id??"",i=!!e&&!!r;let a;t[0]!==i||t[1]!==r||t[2]!==e?(a=i?_e.decoServeConnection(r,e):null,t[0]=i,t[1]=r,t[2]=e,t[3]=a):a=t[3];const[c,l]=kt(a);let u;t[4]!==i||t[5]!==r||t[6]!==e?(u=i?_e.decoServeEndpoint(r,e):null,t[4]=i,t[5]=r,t[6]=e,t[7]=u):u=t[7];const[d,f]=kt(u);if(n)return n;let h;t[8]!==c||t[9]!==i||t[10]!==o?(h=i&&o?zt(c):null,t[8]=c,t[9]=i,t[10]=o,t[11]=h):h=t[11];const v=h,b=i&&o&&typeof d=="string"?d:null;let m;t[12]!==f||t[13]!==l||t[14]!==i?(m=$=>{i&&(l($),f($.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=m):m=t[15];let R;t[16]!==l||t[17]!==i?(R=()=>{i&&l(null)},t[16]=l,t[17]=i,t[18]=R):R=t[18];let k;return t[19]!==v||t[20]!==b||t[21]!==m||t[22]!==R?(k={connection:v,lastEndpoint:b,set:m,clear:R},t[19]=v,t[20]=b,t[21]=m,t[22]=R,t[23]=k):k=t[23],k}function yt(e){try{const t=localStorage.getItem(e);return t===null?null:JSON.parse(t)}catch{return null}}function kt(e){const t=N.c(17),n=W(),o=e??"";let s;t[0]!==o?(s=["localStorage",o],t[0]=o,t[1]=s):s=t[1];const r=s;let i,a;t[2]!==e?(i=()=>e?yt(e):null,a=()=>e?yt(e):null,t[2]=e,t[3]=i,t[4]=a):(i=t[3],a=t[4]);const c=!!e;let l;t[5]!==r||t[6]!==i||t[7]!==a||t[8]!==c?(l={queryKey:r,queryFn:i,initialData:a,enabled:c,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[5]=r,t[6]=i,t[7]=a,t[8]=c,t[9]=l):l=t[9];const{data:u}=C(l);let d;t[10]!==e||t[11]!==n||t[12]!==r?(d=b=>{if(e){try{b===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(b))}catch{}n.setQueryData(r,b)}},t[10]=e,t[11]=n,t[12]=r,t[13]=d):d=t[13];const f=d,h=e?u??null:null;let v;return t[14]!==f||t[15]!==h?(v=[h,f],t[14]=f,t[15]=h,t[16]=v):v=t[16],v}function en(e,t=""){return{source:e,cacheKeySuffix:e==="github"?"":e==="sandbox"?":sandbox":`:serve:${t}`}}function Mo(e){return JSON.stringify([e.kind==="legacy"?"legacy":"protocol",e.source,e.cacheKeySuffix])}function Jr(e){return e.kind==="protocol"||e.kind==="unavailable"}function Wr(e){const t=e.hasOrg?e.orgFlag:!1,{backend:n}=e;return n===null||n==="legacy"?t:!0}function Gr(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 Yr(e){if(e.kind!=="protocol"||e.source!=="local")return null;const t=e.describe.preview?.url;return t&&Gt(t)?t:null}function zr(e,t){return e.kind!=="protocol"||e.source!=="local"||!e.describe.assets||!t?null:new URL(t.endpoint).origin}function tn(e){return e.hasServeConnection?"local":e.runtime==="sandbox"?"sandbox":"github"}function Lo(e){if(!e.hasProject)return"legacy";const t=tn(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 Uo(e){return{github:e.v8&&e.mode==="github",sandbox:e.v8&&e.mode==="sandbox"&&e.workingTreeReady}}function Ot(e){return e.isError||e.errorUpdateCount>0}function Qo(e,t,n){if(!t||n.size===0)return e;const o={...e};for(const s of n)Object.hasOwn(t,s)?o[s]=t[s]:delete o[s];return o}function Co(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 nn="__noSchema";function on(){return{manifest:{blocks:{}},schema:{definitions:{},root:{}},[nn]:!0}}function Xr(e){return!!e&&e[nn]===!0}function Xe(e){if(!e.ok)return e.error.code===w.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Fo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Bo=(e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key);function Zr(e){const t=new Map;for(const[n,o]of Object.entries(e)){const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},r=typeof s.__resolveType=="string"?s.__resolveType:null,i=t.get(r)??[];i.push({key:n,label:Fo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Bo)})).sort((n,o)=>n.resolveType===null?1:o.resolveType===null?-1:Et(n.resolveType).localeCompare(Et(o.resolveType))||n.resolveType.localeCompare(o.resolveType))}function Et(e){return(e.split("/").filter(Boolean).at(-1)??e).replace(/\.(tsx?|jsx?)$/,"")||e}function Dt(e,t,n){if(t.length===0)return n;const[o,...s]=t;if(Array.isArray(e)&&typeof o=="number"){const r=e.slice();return r[o]=Dt(e[o],s,n),r}if(e&&typeof e=="object"&&typeof o=="string"){const r=e,i={};for(const a of Object.keys(r))i[a]=a===o?Dt(r[a],s,n):r[a];return i}return e}function qr(e){if(e.trim()==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}class It extends Error{}const Ze="site-not-owned";async function Vo(e){return e.status!==409?!1:(await e.clone().json().catch(()=>null))?.code==="site_not_owned"}async function Ho(e,t=n=>fetch(n)){const n=Be({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:we(o.signal)}));if(await Vo(s))throw new It;return s}});try{return await Ke(n)}catch(o){if(o instanceof It)return Ze;throw o}}async function Jo(e,t,n){await t();const o=await Ho(e,n);return o===Ze?o:{...o,hosted:ko(e,n)}}const qe=5e3;function Wo(e){if(!e.site)throw new Error("this project names no site");return Xn(e.site,e.branch)}function Go(e){return new URL(Se(e,"rpc"),window.location.origin).href}async function Ke(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!==te)throw new We;const s=Jt(t.result);if(!n)throw new Error("no schema.get");if(Xe(n))return{client:e,describe:s,hasSchema:!1};if(n.ok)return{client:e,describe:s,hasSchema:!0};throw n.error}function Yo(e,t=n=>fetch(n)){return Ke(Be({endpoint:e,fetch:n=>t(new Request(n,{signal:we(n.signal)}))}))}function re(e,t){const n=N.c(40),{org:o}=zn(),{connection:s}=Ao(e),{runtime:r}=Bt(e),i=L.useContext(Kt),a=Fe(e),c=Ut(Ce(e)?.metadata),l=tn({hasServeConnection:!!s,runtime:r}),u=en(l,s?.endpoint??""),d=to()?.taskId??null,f=no(oo().lifecycle.phase),h=W(),v=Uo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,m=C({queryKey:g.contentBackend(o.slug,e??"",t??"","github"),queryFn:()=>Jo(Wo({orgSlug:o.slug,site:c,branch:t}),()=>Qt(c,t)),enabled:b,staleTime:Number.POSITIVE_INFINITY,..._t}),R=v.sandbox&&!!o.slug&&!!e&&!!t;let k;n[0]!==t||n[1]!==o.slug||n[2]!==d||n[3]!==e?(k=()=>Yo(Go({orgSlug:o.slug,virtualMcpId:e,branch:t,threadId:d})),n[0]=t,n[1]=o.slug,n[2]=d,n[3]=e,n[4]=k):k=n[4];const $=C({queryKey:g.contentBackend(o.slug,e??"",t??"","sandbox",d??""),queryFn:k,enabled:R,staleTime:Number.POSITIVE_INFINITY,..._t}),I=!!s;let _;n[5]!==s?.endpoint||n[6]!==o.slug||n[7]!==e?(_=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[5]=s?.endpoint,n[6]=o.slug,n[7]=e,n[8]=_):_=n[8];let T;n[9]!==s?(T=()=>ts(s.endpoint),n[9]=s,n[10]=T):T=n[10];let y;n[11]!==I||n[12]!==_||n[13]!==T?(y={queryKey:_,queryFn:T,enabled:I,staleTime:Number.POSITIVE_INFINITY,retry:Zo,retryDelay:Xo,refetchInterval:zo},n[11]=I,n[12]=_,n[13]=T,n[14]=y):y=n[14];const O=C(y);let D;n[15]!==s?.endpoint||n[16]!==o.slug||n[17]!==e?(D=g.contentBackend(o.slug,e??"","local",s?.endpoint??""),n[15]=s?.endpoint,n[16]=o.slug,n[17]=e,n[18]=D):D=n[18];const x=D;let A;n[19]!==s?.endpoint||n[20]!==o.slug||n[21]!==e?(A=g.contentBackend(o.slug,e??"","local-describe",s?.endpoint??""),n[19]=s?.endpoint,n[20]=o.slug,n[21]=e,n[22]=A):A=n[22];let p;n[23]!==O.data||n[24]!==x||n[25]!==h?(p=async()=>{try{return await O.data.client.describe()}catch(q){const Cn=q;throw h.invalidateQueries({queryKey:x,exact:!0},{cancelRefetch:!1}),Cn}},n[23]=O.data,n[24]=x,n[25]=h,n[26]=p):p=n[26];const E=!!O.data&&!i;let j;n[27]!==A||n[28]!==p||n[29]!==E?(j={queryKey:A,queryFn:p,enabled:E,refetchInterval:qe,retry:!1},n[27]=A,n[28]=p,n[29]=E,n[30]=j):j=n[30];const M=C(j).data??O.data?.describe,Q=Lo({hasProject:!!e,hasServeConnection:!!s,runtime:r,v8:a,githubSite:m.data===Ze?"not-owned":m.data?"ready":Ot(m)?"error":"loading",sandboxSite:qo({data:$.data,isError:Ot($),workingTreeReady:f})});if(Q==="pending")return{kind:"pending",...u};if(Q==="retrying-sandbox")return{kind:"pending",retrying:"sandbox",...u};if(Q==="legacy")return{kind:"legacy"};if(Q==="protocol-github")return{...Pe(u,m.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Pe(u,$.data);if(Q==="unavailable-github"){let q;return n[31]!==u?(q={kind:"unavailable",...u},n[31]=u,n[32]=q):q=n[32],q}const P=O.error??O.failureReason,V=s?.endpoint??"";let H;return n[33]!==M||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==V||n[38]!==P?(H=es({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:M,endpoint:V}),n[33]=M,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=V,n[38]=P,n[39]=H):H=n[39],H}function zo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?qe:!1}function Xo(e){return vo(e+1)}function Zo(e,t){return!(t instanceof S)&&!(t instanceof We)}function qo(e){return e.data!==void 0?"ready":e.workingTreeReady?e.isError?"error":"loading":"unavailable"}const Ko=3;function es(e){const t=en("local",e.endpoint),n=e.probed?Pe(t,{...e.probed,describe:e.describe??e.probed.describe}):null;return e.isError||e.failureCount>0?n?.kind==="protocol"&&!e.isError&&e.failureCount<Ko?n:{kind:"unavailable",...t,problem:mo(e.failure)}:n??{kind:"pending",...t}}const _t={retry:2,refetchInterval:e=>e.state.status==="error"?qe:!1};function Pe(e,t){return{kind:"protocol",...e,client:t.client,describe:t.describe,hasSchema:t.hasSchema,...t.hosted?{hosted:t.hosted}:{}}}function ts(e,t){return Ke(Be({endpoint:e,fetch:n=>fetch(n,{signal:we(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function Ne(e){const t=`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`;return e.protocolSuffix?`${t}${e.protocolSuffix}`:e.localPreviewUrl?`${t}:local:${e.localPreviewUrl}`:t}function ns(e,t){return Ne({...e,protocolSuffix:t.cacheKeySuffix})}function os(e,t,n){return e?t==="pending"?{ready:!1,failed:!1}:t==="unavailable"?{ready:!1,failed:!0}:n:{ready:!0,failed:!1}}function ss(e,t){return JSON.stringify([e?.orgSlug,e?.virtualMcpId,e?.branch,Mo(t)])}function rs(e,t,n){const o=N.c(21),s=W(),r=re(e?.virtualMcpId,e?.branch),i=e&&r.kind==="protocol"&&r.hosted?r:null;let a;o[0]!==i||o[1]!==e?(a=i&&e?ns(e,i):"",o[0]=i,o[1]=e,o[2]=a):a=o[2];const c=Po(i?.hosted,a,t,n),l=e!==null;let u;o[3]!==r.kind||o[4]!==c||o[5]!==l?(u=os(l,r.kind,c),o[3]=r.kind,o[4]=c,o[5]=l,o[6]=u):u=o[6];const d=u,f=r.kind!=="legacy";let h;o[7]!==r||o[8]!==e?(h=ss(e,r),o[7]=r,o[8]=e,o[9]=h):h=o[9];let v;o[10]!==r.kind||o[11]!==r.source||o[12]!==c||o[13]!==s||o[14]!==e?(v=()=>{if(c.retry(),!e||r.kind!=="unavailable")return;const m=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...m==="local"?["local"]:[e.branch,m])})},o[10]=r.kind,o[11]=r.source,o[12]=c,o[13]=s,o[14]=e,o[15]=v):v=o[15];let b;return o[16]!==d||o[17]!==f||o[18]!==h||o[19]!==v?(b={...d,v8:f,scopeKey:h,retry:v},o[16]=d,o[17]=f,o[18]=h,o[19]=v,o[20]=b):b=o[20],b}function sn(e){const t=N.c(12);let n;t[0]!==e?(n=_e.localPreviewUrl(e??""),t[0]=e,t[1]=n):n=t[1];const o=n,[s,r]=Zn(o,null),i=Fe(e);let a;t[2]!==s||t[3]!==e?(a=e?ft(s):null,t[2]=s,t[3]=e,t[4]=a):a=t[4];const l=i?null:a;let u,d;t[5]!==r?(u=h=>r(ft(h)),d=()=>r(null),t[5]=r,t[6]=u,t[7]=d):(u=t[6],d=t[7]);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f={url:l,setUrl:u,clear:d},t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}const Tt=6e4,is=2147483647;function as(e,t){if(e===null||e.trim()==="")return Tt;const n=e.trim(),o=/^\d+(?:\.\d+)?$/.test(n)?Number(n)*1e3:/^[A-Za-z]{3}, /.test(n)?Math.max(0,Date.parse(n)-t):Number.NaN;return Number.isFinite(o)&&o>=0&&o<=is?o:Tt}class rn extends Error{constructor(t,n,o,s=Date.now()){super(t),this.status=n,this.name="ContentResponseError",this.retryAt=n===429?s+as(o,s):null}status;retryAt}function cs(e,t,n=Date.now()){const o=Ft(5e3,1e3,e,2,0);return t instanceof rn&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function et(e,t){const n=await e.json().catch(()=>null),o=n!==null&&typeof n=="object"&&"error"in n&&typeof n.error=="string"?n.error:`${t} failed (${e.status})`;throw new rn(o,e.status,e.headers.get("retry-after"))}function ls(e,t){const n=(e??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${t}`:t}function Rt(e){let t;try{t=JSON.parse(e)}catch{return null}return typeof t!="object"||t===null||Array.isArray(t)?null:t}function ye(e,t,n){return["decofile-write",e,t,n]}function us(e,t,n){return{id:ye(e,t,n).join(":")}}class tt extends Error{constructor(t,n,o=[],s=!1){super(n),this.blocks=t,this.fields=o,this.carriedStored=s,this.name="BlockConflictError"}blocks;fields;carriedStored}function nt(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function ot(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function fs(e,t){return et(e,t)}function ds(e,t,n){e.setQueryData(g.decofileDraft(nt(t)),n)}function hs(e,t){return e.getQueryData(g.decofileDraft(nt(t)))??null}async function gs(e,t){return(await fetch(ot(e),{cache:"no-store",headers:{"if-none-match":`"${t}"`}}).catch(()=>null))?.status===200}function Kr(e){const t=N.c(4);let n;t[0]!==e?(n=g.decofileDraft(e?nt(e):""),t[0]=e,t[1]=n):n=t[1];let o;t[2]!==n?(o={queryKey:n,enabled:!1,queryFn:vs,staleTime:Number.POSITIVE_INFINITY,gcTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s??null}async function vs(){throw new Error("decofileDraft is populated by reads/writes, not fetched")}async function bs(e,t){const n=await fetch(ot(t),{cache:"no-store"});if(!n.ok)return et(n,"Read decofile");const o=await n.json();return o.token&&ds(e,t,{version:o.version,token:o.token,apiHost:o.apiHost??window.location.host}),o.decofile}async function ei(e,t){const n=await fetch(ot(e),{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.status===409){const s=await n.json().catch(()=>({}));throw s.code==="block-conflict"?new tt(s.blocks??[],s.error??"Block changed"):new Error(s.error??`Save failed (${n.status})`)}if(!n.ok)return fs(n,"Save");const o=await n.json();return{...o,apiHost:o.apiHost??window.location.host}}const an=3e3,ms=15e3,ps=2*6e4,cn={now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),hidden:()=>typeof document<"u"&&document.visibilityState==="hidden"};function ws(e){return e<ps?an:ms}function Ss(e,t=cn){const n=t.now();let o=!1,s=!1,r=null;const i=()=>{o||(r=t.setTimeout(a,ws(t.now()-n)))},a=()=>{if(r=null,o)return;const{read:c,skip:l}=e();if(s||t.hidden()||l?.()){i();return}s=!0;let u;try{u=c()}catch{u=void 0}Promise.resolve(u).catch(()=>{}).finally(()=>{s=!1}),i()};return i(),()=>{o=!0,r!==null&&t.clearTimeout(r)}}const xt=()=>0;function ys(e,t,n=cn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>Ss(()=>o.current,n),idle:()=>()=>{}}));L.useSyncExternalStore(e?s.polling:s.idle,xt,xt)}function ln(e,t){return Se(e,t)}function ks(e,t){return Se(e,"preview-fetch",{path:t})}function ti(e){return ln(e,"preview-invoke")}function ni(e){return ln(e,"catalog-invoke")}function un(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 Os(){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&&un(n))return n}return null}function Es(e,t){const n=e.previewUrl??e.getFallbackPreviewUrl?.()??Os();return n&&un(n)?new URL(t,n).toString():ks(e,t)}function Ds(e){return Es(e,"/.decofile")}function Is(e){return e===400?"absent":e===404?"unavailable":e>=200&&e<300?"ok":"error"}function Pt(e){return e.liveOk||e.committedAbsent?404:e.liveStatus??502}async function _s(e,t){const n=Se(e,"read"),o=await fetch(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:t,full:!0})}),s=Is(o.status);if(s==="absent")return{kind:"absent"};if(s==="unavailable")return{kind:"unavailable"};if(s==="error"){const i=new Error(`Failed to read ${t}: ${o.status}`);throw i.status=o.status,i}const r=await o.json();return typeof r.content!="string"?{kind:"unavailable"}:{kind:"data",data:so(r.content)}}async function Ts(e,t){const n=await _s(e,t);if(n.kind!=="data")return n;try{return{kind:"data",data:JSON.parse(n.data)}}catch{return{kind:"unavailable"}}}async function oi(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)return et(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Rs(e){return Ce(e)?.metadata?.runtime?.path??null}function je(e,t,n,o){const s=F(e),r=Object.keys(n?.changes??{}).find(a=>F(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>F(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>F(c)===s);return a===void 0?null:t.entries[a].version}return o?.[e]??null}class fn extends Error{constructor(t){super(t instanceof Error?t.message:String(t),{cause:t}),this.name="ServeLostError"}}function si(e){return e instanceof S&&e.code===w.Conflict}function dn(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 st extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class rt extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ri(e,t){return(t instanceof st||t instanceof rt)&&(t.message=hn(e,t,"github")),t}function hn(e,t,n){if(t instanceof st)return e("siteEditor.save.draftUnread");if(t instanceof rt)return e("siteEditor.save.keptChanging");if(t instanceof tt)return t.message;if(n==="local")return Ps(e,t);if(t instanceof S)switch(t.code){case w.Conflict:return e("siteEditor.save.conflict");case w.ReadOnly:return e("siteEditor.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("siteEditor.save.invalid");case w.LimitExceeded:return e("siteEditor.save.tooLarge")}return e("siteEditor.save.failed")}function xs(e,t){if(t==="local"||e instanceof tt||e instanceof st||e instanceof rt)return null;if(e instanceof S){const n=e.code===w.InvalidBlock||e.code===w.InvalidParams?dn(e):e.message;return n?`${e.code}: ${n}`:null}return e.message||null}function Ps(e,t){if(t instanceof fn)return e("decoServe.save.serverGone");if(t instanceof S)switch(t.code){case w.Conflict:return e("decoServe.save.conflict");case w.ReadOnly:return e("decoServe.save.readOnly");case w.InvalidBlock:case w.InvalidParams:return e("decoServe.save.invalid",{detail:dn(t)});case w.LimitExceeded:return e("decoServe.save.tooLarge")}return e("sectionsEditor.sectionsEditor.saveFailed",{error:t.message})}function Ns(e,t,n){return e===null?0:Math.max(0,n-Math.max(0,t-e))}function js(e,t){const[n,o]=L.useState(e),s=L.useRef(null);return e&&!n&&o(!0),L.useEffect(()=>{if(e){s.current??=Date.now();return}if(!n)return;const r=()=>{s.current=null,o(!1)},i=Ns(s.current,Date.now(),t);if(i===0){r();return}const a=setTimeout(r,i);return()=>clearTimeout(a)},[e,n,t]),n}const $s="decocms:content-writes",$e=new Set;let Y;function gn(){if(Y!==void 0)return Y;Y=null;try{typeof BroadcastChannel=="function"&&(Y=new BroadcastChannel($s),Y.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...$e])n(t)}))}catch{Y=null}return Y}function As(e){try{gn()?.postMessage({cacheKey:e})}catch{}}function Ms(e){return gn(),$e.add(e),()=>{$e.delete(e)}}const vn="__at=",bn="__test=",Ls=/^[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 Us(e){return e.at!==void 0||Object.keys(e.tests??{}).length>0}function ee(e){return typeof e=="string"&&Ls.test(e)}function Nt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function Qs(e){const t=e.tests??{};return[...e.at!==void 0?[vn+Nt(e.at)]:[],...Object.keys(t).map(n=>bn+Nt(`${n}=${t[n]?"on":"off"}`))]}function jt(e,t){const o=[...e.split("&").filter(s=>s&&!s.startsWith(vn)&&!s.startsWith(bn)),...t];return o.length>0?`?${o.join("&")}`:""}function ve(e,t){const n=Qs(t),o=e.indexOf("?"),s=o===-1?e:e.slice(0,o);if(ee(s))return s+jt(o===-1?"":e.slice(o+1),n);const r=e.lastIndexOf("@");if(r<=0)return e;const i=e.slice(0,r),a=i.indexOf("?"),c=a===-1?i:i.slice(0,a),l=a===-1?"":i.slice(a+1);return`${c}${jt(l,n)}${e.slice(r)}`}function ii(e,t,n){if(!Us(t))return e;try{const o=new URL(e),s=o.searchParams.get("__draft");return s&&s!=="off"?(o.searchParams.set("__draft",ve(s,t)),o.toString()):ee(n)?(o.searchParams.set("__draft",ve(n,t)),o.toString()):e}catch{return e}}function ai(e,t,n="/"){if(!e||!ee(t))return null;try{const o=new URL(n,e);return o.searchParams.set("__draft",t),o.toString()}catch{return null}}function mn(e){return btoa(encodeURIComponent(e))}function ci(e,t,n){const o=Cs(e,t,n);return o.searchParams.set("__cb",crypto.randomUUID()),o.toString()}function Cs(e,t,n){const o=new URL(e).origin,s=new URL(`/live/previews/${encodeURIComponent(t)}`,o);return s.searchParams.set("path","/"),s.searchParams.set("pathTemplate","/"),s.searchParams.set("props",mn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Fs="__draft";function li(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Bs="off";function Vs(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Fs,t),n.toString()}function ui(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:s,...r}=e.pageBlock,i=JSON.stringify({__props:r,__decofile:e.decofile});return{src:o.toString(),body:i}}function fi(e,t,n,o){const s=new URL(e).origin,r=new URL(`/live/previews/${encodeURIComponent(t)}`,s);r.searchParams.set("__d","");const i=[{__resolveType:"preview",block:n}];return o&&i.push(o),r.searchParams.set("props",mn(JSON.stringify({sections:i}))),r.toString()}function di(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function pn(e,t,n){return`${e}@${t}=${n}`}function hi(e,t){return!e||!t.multivariate||t.variants.length<=1?[]:t.index<0||t.index>=t.variants.length?[]:[pn(e,"sections",t.index)]}function gi(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[pn(e.pageKey,o,e.selectedVariantIndex)]}function vi(e,t){return[...t,...e]}function Hs(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function it(e,t){const n=e.lastIndexOf("@");if(n<=0)return e;const o=e.slice(0,n),s=o.indexOf("?"),r=s===-1?o:o.slice(0,s),a=[...s===-1?[]:o.slice(s+1).split("&").filter(l=>l&&!l.startsWith($t)),...t.map(l=>$t+Hs(l))],c=a.length>0?`?${a.join("&")}`:"";return`${r}${c}${e.slice(n)}`}function bi(e,t,n=!1){if(t.length===0&&!n)return null;try{const o=new URL(e),s=o.hostname==="[::1]"?`localhost${o.port?`:${o.port}`:""}`:o.host;return it(`${s}${o.pathname}@local`,t)}catch{return null}}function mi(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",it(o,t)),n.toString())}catch{return e}}function Js(e){const{pointer:t}=e;if(!t||t===Bs)return null;const n=t.indexOf("?");return ee(n===-1?t:t.slice(0,n))||t.lastIndexOf("@")<=0?null:ee(e.heldRevision)&&e.forcedVariants.length===0?ve(e.heldRevision,e.previewOptions):ve(it(t,e.forcedVariants),e.previewOptions)}function Ws(e,t){if(!e||!t)return null;try{return Vs(e,t)}catch{return null}}function pi(e,t,n){if(!e||!n)return null;try{return Ws(new URL(t,e).toString(),n)}catch{return null}}const be={forcedVariants:[],previewOptions:{}},ce=new Map,le=new Map,Ae=new Map;function wn(e){for(const t of Ae.get(e)??[])t()}function Sn(e,t){const n=ee(t)?t:null;(le.get(e)??null)!==n&&(n?le.set(e,n):le.delete(e),wn(e))}function Gs(e){return le.get(e)??null}function Ys(e,t){return JSON.stringify(e)===JSON.stringify(t)}function wi(e,t){const n=ce.get(e)??be,o=t??be;Ys(n,o)||(t?ce.set(e,o):ce.delete(e),wn(e))}function zs(e){return ce.get(e)??be}function yn(e,t){let n=Ae.get(e);return n||(n=new Set,Ae.set(e,n)),n.add(t),()=>{n.delete(t)}}function Xs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>yn(e,s),o=()=>zs(e),t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Zs)}function Zs(){return be}function qs(e){const t=N.c(3);let n,o;return t[0]!==e?(n=s=>e?yn(e,s):er,o=()=>e?Gs(e):null,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),L.useSyncExternalStore(n,o,Ks)}function Ks(){return null}function er(){}function Si(e,t){const n=N.c(4),o=Xs(e),s=qs(e);let r;return n[0]!==o||n[1]!==s||n[2]!==t?(r=Js({pointer:t,heldRevision:s,...o}),n[0]=o,n[1]=s,n[2]=t,n[3]=r):r=n[3],r}const kn={phase:"idle",inFlight:0,reload:{seq:0,navigates:!1},epoch:0},tr=15e3,me=new Map;function Z(e,t){return`${e}/${t}`}function B(e){let t=me.get(e);return t||(t={state:kn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},me.set(e,t)),t}function J(e,t){const n=B(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function ke(e){e.timer&&clearTimeout(e.timer),e.timer=null}function at(e){return me.get(e)?.state??kn}function nr(e,t){const n=B(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function yi(e){const t=B(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(ke(t),J(e,{phase:"idle"}))}}function ki(e){const t=me.get(e);!t||t.state.phase!=="reloading"||(ke(t),J(e,{phase:"idle"}))}function On(e){const t=B(e);ke(t),J(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=B(e),o=Math.max(0,n.state.inFlight-1);if(o>0){J(e,{inFlight:o});return}if(!t.ok||n.previews===0){J(e,{phase:"idle",inFlight:o});return}En(e,t.navigates,o)}function En(e,t,n=0){const o=B(e);ke(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&J(e,{phase:"idle"})},tr),J(e,{phase:"reloading",inFlight:n,reload:{seq:o.state.reload.seq+1,navigates:t}})}function or(e){return e?.kind==="protocol"&&e.source==="github"}async function fe(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r,backend:i,cacheKey:a}=e,c=t.kind==="publish"||t.kind==="reapply"?n.invalidateQueries({queryKey:g.hostedReleases(o,s)}):null;if(i?.kind!=="protocol")return await c,{navigates:!1};const l=r?g.protocolDraftRead(o,s,r):null,u=l?JSON.stringify(n.getQueryData(l)??null):null,d=c?[c]:[];if(a&&t.reread&&d.push(n.invalidateQueries({queryKey:g.decofile(a)})),a&&!t.adopted&&d.push(n.invalidateQueries({queryKey:g.contentChanges(a)})),r&&i.source==="sandbox"&&d.push(n.invalidateQueries({queryKey:ro(o,s,r)})),or(i)&&l&&!t.adopted&&d.push(n.invalidateQueries({queryKey:l})),await Promise.all(d),t.kind!=="edit"){const v=Z(o,s);J(v,{epoch:at(v).epoch+1})}const f=l?JSON.stringify(n.getQueryData(l)??null):null,h=u!==f;return h&&await new Promise(v=>Ct.schedule(v)),{navigates:h}}async function sr(e,t){return On(Z(e.orgSlug,e.virtualMcpId)),Dn(e,t)}function At(e){return e.branch?JSON.stringify(e.queryClient.getQueryData(g.protocolDraftRead(e.orgSlug,e.virtualMcpId,e.branch))??null):null}async function Dn(e,t){const n=Z(e.orgSlug,e.virtualMcpId),o=t.adopted?At(e):null;let s;try{s=await t.write()}catch(i){throw ue(n,{ok:!1,navigates:!1}),t.refreshOnError&&fe(e,{kind:t.kind,reread:!0}).catch(()=>{}),i}if(e.backend?.kind==="protocol"&&e.cacheKey&&As(e.cacheKey),Sn(n,t.shownRevision?.(s)??null),t.adopted){const i=At(e)!==o;return i&&await new Promise(a=>Ct.schedule(a)),ue(n,{ok:!0,navigates:i}),t.reread&&fe(e,t).catch(()=>{}),s}let r=!1;try{({navigates:r}=await fe(e,t))}catch{}finally{ue(n,{ok:!0,navigates:r})}return s}function Oi(e,t){const{queryClient:n,orgSlug:o,virtualMcpId:s,branch:r}=e,i=Z(o,s),a=new Set(t.blockKeys);for(const u of[...B(i).discardListeners])u(a);On(i);let c=!1;const l=()=>(c=!0,Dn(e,{kind:"discard",reread:!0,write:t.write}));return r?n.getMutationCache().build(n,{mutationKey:ye(o,s,r),scope:us(o,s,r),mutationFn:l}).execute(void 0).catch(u=>{throw c||ue(i,{ok:!1,navigates:!1}),u}):l()}function Ei(e,t,n){const o=N.c(8);let s;o[0]!==e||o[1]!==t?(s=Z(e,t),o[0]=e,o[1]=t,o[2]=s):s=o[2];const r=s;let i;o[3]!==n||o[4]!==r?(i=()=>{const c=B(r).discardListeners;return c.add(n),()=>{c.delete(n)}},o[3]=n,o[4]=r,o[5]=i):i=o[5];let a;o[6]!==r?(a=[r],o[6]=r,o[7]=a):a=o[7],L.useEffect(i,a)}function In(e){const t=Z(e.orgSlug,e.virtualMcpId);at(t).inFlight>0||(Sn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=B(t);o.previews>0&&o.state.inFlight===0&&En(t,n)}).catch(()=>{}))}function rr(e,t){const n=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 s=o;let r;n[3]!==s?(r=l=>nr(s,l),n[3]=s,n[4]=r):r=n[4];const i=r;let a;n[5]!==s?(a=()=>at(s),n[5]=s,n[6]=a):a=n[6];const c=a;return L.useSyncExternalStore(i,c,c)}const ir=500;function Di(e,t){const{phase:n}=rr(e,t);return js(n!=="idle",ir)}function ar(e){const t=new Error(`${e} unavailable (content server unreachable)`);return t.status=502,t}function _n(e,t){return g.liveMeta(e.orgSlug,e.virtualMcpId,e.branch,`protocol${t.cacheKeySuffix}`,"")}function Ii(e,t,n,o){if(o?.source==="github"){const i=e.getQueryData(g.contentIndex(t));return i?Do(i,n):cr(e,t,n)}const s=e.getQueryData(g.contentVersions(t));if(!s)return;if(Object.hasOwn(s,n))return s[n];const r=e.getQueryData(g.decofile(t));return r&&Object.hasOwn(r,n)?void 0:null}function Tn(e,t){if(Object.hasOwn(e.changes,t))return e.changes[t];const n=F(t),o=Object.keys(e.changes).find(s=>F(s)===n);return o===void 0?void 0:e.changes[o]}function cr(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(o)return Rn(o,Oe(e,t),n)}function Rn(e,t,n){const o=Tn(e,n);return o?.kind==="delete"?o.version??X:o?o.version:t.has(F(n))?X:null}function _i(e,t,n){const o=e.getQueryData(g.contentChanges(t));if(!o)return!1;const s=Tn(o,n);return s?s.kind==="set"&&s.baseVersion===null:Oe(e,t).has(F(n))}function Ti(e,t){const n=e.getQueryData(g.decofile(t)),o=e.getQueryData(g.contentChanges(t));if(!n||!o)return null;const s=Oe(e,t);return{blocks:n,versionOf:r=>Rn(o,s,r)}}function Oe(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function pe(e,t,n,o){const s=F(n),r=Oe(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),G(e),e.setQueryData(g.contentDraftTombstones(t),[...r]))}function xn(e,t,n,o){const s=o.revision,r=e.getQueryData(g.contentVersions(n)),i=Object.entries(o.versions??{}).map(([f,h])=>[f,h===X?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>je(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[F(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const m=je(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:m}:m!==null?h[v]={kind:"delete",version:null,baseVersion:m}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?pe(e,n,f,!1):!u.has(F(f))&&l.has(f)&&pe(e,n,f,!0);const d=o.revision;return d&&d!=="none"&&e.setQueryData(g.protocolDraftRead(t.orgSlug,t.virtualMcpId,t.branch),f=>f&&{...f,version:d}),s}function Ee(e,t,n){G(e),e.setQueryData(g.contentVersions(t),o=>{const s={...o};for(const[r,i]of Object.entries(n))i===null?delete s[r]:s[r]=i;return s})}function Pn(e,t){const n=e.getMutationCache().findAll({mutationKey:ye(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Co(o.state.variables)))}function Me(e,t){e.resetQueries({queryKey:g.contentBackend(t.orgSlug,t.virtualMcpId,"local")})}async function se(e,t,n,o){try{return await o()}catch(s){const r=!(s instanceof S);throw t.source==="local"&&r?(Me(e,n),new fn(s)):(t.source==="local"&&He(s)&&Me(e,n),s)}}const Mt=new WeakMap;function ct(e){let t=Mt.get(e);return t||(t={inFlight:new Map,rereading:new Set},Mt.set(e,t)),t}function Nn(e,t,n,o){const{inFlight:s}=ct(e),r=s.get(o);if(r)return r;const i=lt(e,t,n,o,!0);return s.set(o,i),i.finally(()=>{s.get(o)===i&&s.delete(o)})}function lr(e,t,n){const o=N.c(8),s=W(),r=t?.orgSlug,i=t?.virtualMcpId,a=t?.branch;let c,l;o[0]!==e||o[1]!==a||o[2]!==n||o[3]!==r||o[4]!==s||o[5]!==i?(c=()=>{if(!e||!r||!i||!a)return;const u={orgSlug:r,virtualMcpId:i,branch:a},{rereading:d}=ct(s);return Ms(f=>{f===n&&(d.has(n)||(d.add(n),fr(s,e,u,n).catch(ur).finally(()=>d.delete(n))))})},l=[s,e,r,i,a,n],o[0]=e,o[1]=a,o[2]=n,o[3]=r,o[4]=s,o[5]=i,o[6]=c,o[7]=l):(c=o[6],l=o[7]),L.useEffect(c,l)}function ur(){}async function fr(e,t,n,o){const s=ct(e).inFlight.get(o);return s&&await s.catch(()=>{}),Nn(e,t,n,o)}async function lt(e,t,n,o,s){G(e);const r=g.decofile(o),i=_n(n,t),a=g.contentRevision(o),c=g.contentVersions(o),l=e.getQueryData(r),u=e.getQueryData(c),f=e.getQueryData(i),h=e.getQueryData(a)??void 0,v=s&&l&&u?h?.revision:void 0,b=s&&f?h?.schemaVersion:void 0,m=g.contentChanges(o),R=e.getQueryData(m);if(t.source==="github"&&t.hosted)return dr(e,t,t.hosted,n,o,{conditional:s,seen:h,currentMeta:f,schemaIfNoneMatch:b,seenChanges:R});const[k,$,I]=await se(e,t,n,()=>t.client.batch([{method:"blocks.list",params:v?{ifNoneMatch:v}:{}},{method:"schema.get",params:b?{ifNoneMatch:b}:{}},{method:"changes.list",params:Ve(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(m,E)}else I&&t.source==="local"&&He(I.error)&&Me(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const y=k.result,O=Xe($),D=$.ok&&!O?$.result:null;if(y.notModified&&(!l||!u)||D?.notModified&&!f)return lt(e,t,n,o,!1);const x=y.notModified?new Set:Pn(e,n),A=y.notModified?l:Qo(y.blocks,l,x),p=O?on():D?D.notModified?f:D.schema:$.error;if(e.setQueryData(a,{revision:T?_:y.notModified?h?.revision:y.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,A),!y.notModified){const E=e.getQueryData(c),j={...y.versions};for(const U of x){const M=E?.[U];M!==void 0?j[U]=M:delete j[U]}e.setQueryData(c,j)}return p instanceof S||e.setQueryData(i,p),!T&&!y.notModified&&l&&h?.revision&&y.revision!==h.revision&&In({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:p}}async function dr(e,t,n,o,s,r){const i=g.decofile(s),a=g.contentIndex(s),c=g.contentRevision(s),l=g.contentVersions(s),u=_n(o,t),d=g.contentChanges(s),f=e.getQueryData(a),h=r.conditional&&f?r.seen?.revision:void 0,[v,b,m]=await se(e,t,o,()=>n.batch([{method:"cms.index",params:h?{ifNoneMatch:h}:{}},{method:"schema.get",params:r.schemaIfNoneMatch?{ifNoneMatch:r.schemaIfNoneMatch}:{}},{method:"changes.list",params:Ve(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,$=k!==void 0&&k!==r.seen?.revision;if(m?.ok&&!$){const P=de(r.seenChanges,m.result);P&&e.setQueryData(d,P)}if(!v?.ok)throw v?.error??new Error("no cms.index");if(!b)throw new Error("no schema.get");const I=v.result,_=Xe(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return lt(e,t,o,s,!1);const y=_?on():T?T.notModified?r.currentMeta:T.schema:b.error;y instanceof S||e.setQueryData(u,y);const O=T?T.notModified?r.seen?.schemaVersion:T.version??void 0:void 0,D=e.getQueryData(i)??{};if(I.notModified||$)return e.setQueryData(c,{revision:$?k:r.seen?.revision,schemaVersion:O}),e.setQueryData(i,D),{blocks:D,meta:y};const x={revision:I.revision,resolvedRef:I.resolvedRef,sequence:I.sequence,entries:I.entries,draft:I.draft};e.setQueryData(a,x);const A=!!r.seen?.revision&&x.revision!==r.seen.revision&&(!r.seen.revision.startsWith("s-")||!!f&&jn(f.draft,x.draft));A&&e.setQueryData(g.protocolDraftRead(o.orgSlug,o.virtualMcpId,o.branch),P=>P&&{...P,version:x.revision}),e.setQueryData(c,{revision:x.revision,schemaVersion:O});const p=Pn(e,o),E=e.getQueryData(l)??{},j={},U={},M=[];for(const[P,V]of Object.entries(D)){const H=x.entries[P];!H&&!p.has(P)||(j[P]=V,E[P]!==void 0&&(U[P]=E[P]),H&&!p.has(P)&&E[P]!==H.version&&M.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),M.length>0&&await Ye(e,n,s,M,p),R&&A&&hr(R,x)&&In({queryClient:e,orgSlug:o.orgSlug,virtualMcpId:o.virtualMcpId,branch:o.branch,backend:t,cacheKey:s}),{blocks:e.getQueryData(i)??j,meta:y}}function hr(e,t){if(jn(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 jn(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 gr(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 Ie(e){if(!(e instanceof S)||e.code!==w.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"))}async function vr(e,t){if(!(e instanceof S)||e.code!==w.Conflict)return;const n=e.data?.entries;if(!n||typeof n!="object")return;const o=Object.entries(n);if(o.length===0)return;const s=t.set??{},r=new Set(t.delete??[]),i={};for(const[a,c]of o){const l=c?.actual;if(typeof l!="string"||(Object.hasOwn(s,a)?await eo(s[a]):r.has(a)?X:void 0)!==l)return;i[a]=l}return i}function br(e,t){const n=Object.fromEntries(Object.entries(e.set??{}).filter(([s])=>!Object.hasOwn(t,s))),o=(e.delete??[]).filter(s=>!Object.hasOwn(t,s));return{...Object.keys(n).length>0?{set:n}:{},...o.length>0?{delete:o}:{}}}function ie(e,t,n,o,s){G(e),xn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),Ee(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===X?null:i]))),qt(e,n,s,o.set??{})}async function Ri(e,t,n,o,s,r){if(t.source==="github"){const a=[...Object.keys(s.set??{}),...s.delete??[]].filter(l=>!r||!Object.hasOwn(r,l));if(a.length>0)throw new Error(`A hosted save needs a precondition for every block it touches (missing: ${a.join(", ")})`);const c=qn(s.set);if(c.length>0)throw new Error(`A hosted save can't write a block that isn't loaded (${c.join(", ")})`)}return sr({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=(u,d=r)=>se(e,t,n,()=>t.client.blocksApply({set:u.set,delete:u.delete,...d?{ifMatch:gr(d,u)}:{}}));let a;try{a=await i(s)}catch(u){const d=t.source==="github"?Ie(u):void 0;if(!d)throw u;const f=br(s,d);Object.keys(d).length>0&&ie(e,n,o,s,d);let h;try{h=await i(f)}catch(v){const b=Ie(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const m=await vr(v,f);if(!m)throw v;ie(e,n,o,f,m);try{h=await i(f,{...r,...m})}catch(R){const k=Ie(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}G(e);const c=t.source==="github"?xn(e,n,o,a):a.revision;t.source==="github"&&qt(e,o,a.versions??{},s.set??{}),e.setQueryData(g.contentRevision(o),u=>({...u,revision:c}));const l=a.versions??{};return Ee(e,o,l),{revision:c,versions:l}}})}function $n(e,t){if(!(e instanceof S))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 An(e,t,n){if(!(n instanceof S))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&pe(e,t,s,!1)}function Mn(e,t,n,o){G(e),Kn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=je(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=F(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>F(u)!==c));s?a!==null&&(l[n]={kind:"delete",version:null,baseVersion:a}):l[n]={kind:"set",version:o.version,baseVersion:a},e.setQueryData(g.contentChanges(t),{...i,changes:l,edited:!0})}pe(e,t,n,s&&a===null),e.setQueryData(g.decofile(t),c=>{const l={...c};return s?delete l[n]:l[n]=o.block,l}),Ee(e,t,{[n]:s?null:o.version}),Io(e,t,n,o)}function xi(e,t,n,o){if(t.source!=="github"||!(o instanceof S))return!1;An(e,n,o);const s=o.data?.draft;if(!s||typeof s!="object")return!1;const r=Object.keys(s),i=r.map(a=>$n(o,a));return r.length===0||i.some(a=>a===void 0)?!1:(e.cancelQueries({queryKey:g.decofile(n)}),r.forEach((a,c)=>{Mn(e,n,a,i[c])}),!0)}async function Pi(e,t,n,o,s,r){t.source==="github"&&An(e,o,r);const i=t.source==="github"?$n(r,s):void 0;if(i)return e.cancelQueries({queryKey:g.decofile(o)}),Mn(e,o,s,i),!0;await e.invalidateQueries({queryKey:g.decofile(o)});let a;try{const l=(await se(e,t,n,()=>t.client.changesGet({names:[s]}))).entries[s];if(l&&l.after===null&&l.version!==null)return!1;a={value:l?.after??null,version:l?.version??null},t.source==="github"&&e.setQueryData(g.contentChanges(o),u=>{if(!u)return u;const d={...u.changes};return l?.kind?d[s]={kind:l.kind,version:l.version,baseVersion:l.baseVersion}:delete d[s],{...u,changes:d,edited:!0}})}catch{const c=await se(e,t,n,()=>t.client.blocksList({}));if(c.notModified)return!1;a={value:c.blocks[s]??null,version:c.versions[s]??null}}return e.setQueryData(g.decofile(o),c=>{const l={...c};return a.value===null?delete l[s]:l[s]=a.value,l}),Ee(e,o,{[s]:a.version}),!1}function mr(e){const t=N.c(17),n=Ce(e?.virtualMcpId)?.metadata;let o;t[0]!==n?(o=Ut(n),t[0]=n,t[1]=o):o=t[1];const s=o;let r;t[2]!==e?.branch||t[3]!==e?.orgSlug||t[4]!==e?.virtualMcpId?(r=g.protocolDraftRead(e?.orgSlug??"",e?.virtualMcpId??"",e?.branch??""),t[2]=e?.branch,t[3]=e?.orgSlug,t[4]=e?.virtualMcpId,t[5]=r):r=t[5];let i;t[6]!==e||t[7]!==s?(i=async()=>{const b=await Qt(s,e.branch),m=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&m>0?b.pointer.slice(0,m):null,version:b.pointer&&m>0?b.pointer.slice(m+1):b.etag}},t[6]=e,t[7]=s,t[8]=i):i=t[8];const a=!!e&&!!s;let c;t[9]!==r||t[10]!==i||t[11]!==a?(c={queryKey:r,queryFn:i,enabled:a,staleTime:Number.POSITIVE_INFINITY},t[9]=r,t[10]=i,t[11]=a,t[12]=c):c=t[12];const{data:l,isPending:u,isError:d}=C(c),f=!!e&&!!s&&u&&!d;if(!e||!l?.draft||!l.version){let b;return t[13]!==f?(b={pointer:null,pending:f},t[13]=f,t[14]=b):b=t[14],b}const h=`${l.draft}@${l.version}`;let v;return t[15]!==h?(v={pointer:h,pending:!1},t[15]=h,t[16]=v):v=t[16],v}function Ni(e){return mr(e).pointer}function ji(e){const t=N.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:pr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function pr(){throw new Error("content revisions are set by reads and writes")}function ut(e,t){const n=N.c(6),{url:o}=sn(e?.virtualMcpId),s=re(e?.virtualMcpId,e?.branch);if(!e)return"";let r;return n[0]!==s.cacheKeySuffix||n[1]!==s.kind||n[2]!==o||n[3]!==t?.tunnel||n[4]!==e?(r=s.kind!=="legacy"&&s.cacheKeySuffix!==void 0?Ne({...e,protocolSuffix:s.cacheKeySuffix}):Ne({...e,localPreviewUrl:t?.tunnel===!1?null:o}),n[0]=s.cacheKeySuffix,n[1]=s.kind,n[2]=o,n[3]=t?.tunnel,n[4]=e,n[5]=r):r=n[5],r}function $i(e,t){const n=N.c(46),{url:o}=sn(e?.virtualMcpId),s=!!o,r=re(e?.virtualMcpId,e?.branch),i=r.kind==="protocol"?r:null,a=ut(e),c=t?.fetchEnabled??!0,l=Rs(e?.virtualMcpId),u=Bt(e?.virtualMcpId).runtime==="cms",d=W();let f;n[0]!==a?(f=g.decofile(a),n[0]=a,n[1]=f):f=n[1];const h=f;lr(i,i&&e?e:null,a);let v;n[2]!==e||n[3]!==d||n[4]!==h?(v=()=>{if(!e||d.isMutating({mutationKey:ye(e.orgSlug,e.virtualMcpId,e.branch)})>0)return!0;const E=d.getQueryState(h);return E?.fetchStatus==="fetching"||Date.now()-(E?.dataUpdatedAt??0)<an/2},n[2]=e,n[3]=d,n[4]=h,n[5]=v):v=n[5];let b;n[6]!==u||n[7]!==s||n[8]!==e||n[9]!==i||n[10]!==d||n[11]!==h?(b=async()=>{if(e){if(!i&&u&&!s){const E=hs(d,e)?.version;if(E&&!await gs(e,E))return}await d.refetchQueries({queryKey:h,exact:!0},{cancelRefetch:!1})}},n[6]=u,n[7]=s,n[8]=e,n[9]=i,n[10]=d,n[11]=h,n[12]=b):b=n[12];let m;n[13]!==v||n[14]!==b?(m={skip:v,read:b},n[13]=v,n[14]=b,n[15]=m):m=n[15],ys(!!t?.pollWhile&&!!e,m);const R=ze(i?.hosted?a:"");let k;n[16]!==r.kind||n[17]!==u||n[18]!==c||n[19]!==a||n[20]!==s||n[21]!==o||n[22]!==l||n[23]!==e||n[24]!==i||n[25]!==d?(k=async()=>{if(i)return(await Nn(d,i,e,a)).blocks;if(r.kind==="unavailable")throw ar("decofile");if(s){const M=await fetch(new URL("/.decofile",o).toString(),{cache:"no-store"}).catch(Sr),Q=M?.ok?Rt(await M.text()):null;if(Q)return Q;const P=new Error("decofile unavailable (local tunnel unreachable)");throw P.status=502,P}if(u)return bs(d,e);const E=()=>Ts(e,ls(l,".deco/blocks.gen.json"));if(c){const M=await fetch(Ds(e),{cache:"no-store"}).catch(wr);if(M?.ok){const V=Rt(await M.text());if(V)return V}const Q=await E();if(Q.kind==="data")return Q.data;const P=new Error(`Failed to fetch decofile: ${M?.status??"network error"}`);throw P.status=Pt({liveOk:!!M?.ok,liveStatus:M?.status,committedAbsent:Q.kind==="absent"}),P}const j=await E();if(j.kind==="data")return j.data;const U=new Error("decofile unavailable (preview down, no committed snapshot)");throw U.status=Pt({liveOk:!1,committedAbsent:j.kind==="absent"}),U},n[16]=r.kind,n[17]=u,n[18]=c,n[19]=a,n[20]=s,n[21]=o,n[22]=l,n[23]=e,n[24]=i,n[25]=d,n[26]=k):k=n[26];const $=!!e&&r.kind!=="pending",I=i?0:3e4,_=i?.describe.pollIntervalMs,T=i?"always":void 0;let y;n[27]!==u||n[28]!==s||n[29]!==i?(y=(E,j)=>{if(i||u||s)return E<3;const U=j.status;return U!==502&&U!==404&&E<2},n[27]=u,n[28]=s,n[29]=i,n[30]=y):y=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==$||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==y?(O={queryKey:h,queryFn:k,enabled:$,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:y,retryDelay:cs},n[31]=h,n[32]=k,n[33]=$,n[34]=I,n[35]=_,n[36]=T,n[37]=y,n[38]=O):O=n[38];const D=C(O);let x;n[39]!==R||n[40]!==D?(x=R&&D.data?Oo(R,D.data):void 0,n[39]=R,n[40]=D,n[41]=x):x=n[41];const A=x;let p;return n[42]!==A||n[43]!==i?.hosted||n[44]!==D?(p=i?.hosted&&A?{...D,data:A}:D,n[42]=A,n[43]=i?.hosted,n[44]=D,n[45]=p):p=n[45],p}function wr(){return null}function Sr(){return null}function Ai(e,t,n){return rs(e,t,n)}function Mi(e){const t=N.c(4),n=W(),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=o.kind==="protocol"?o.hosted:void 0;let i;return t[0]!==s||t[1]!==n||t[2]!==r?(i=(a,c)=>_o(n,r,s,a,c),t[0]=s,t[1]=n,t[2]=r,t[3]=i):i=t[3],i}function Li(e,t){const n=N.c(3),o=re(e?.virtualMcpId,e?.branch),s=ut(e),r=ze(o.kind==="protocol"&&o.hosted?s:"");let i;return n[0]!==r?.entries||n[1]!==t?(i=Object.entries(r?.entries??{}).filter(a=>{const[,c]=a;return t(c.meta?.type??"")}).map(yr),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function yr(e){const[t]=e;return t}const kr="site-editor-save",Ln={id:kr,description:void 0,action:void 0,cancel:void 0},Ui="site-editor-undo",Le="site-editor-publish";function Or(e){const t=N.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=z.jsx("summary",{className:"cursor-pointer select-none text-muted-foreground",children:n}),t[0]=n,t[1]=s):s=t[1];let r;t[2]!==o?(r=z.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-muted-foreground",children:o}),t[2]=o,t[3]=r):r=t[3];let i;return t[4]!==s||t[5]!==r?(i=z.jsxs("details",{className:"mt-1 text-xs",children:[s,r]}),t[4]=s,t[5]=r,t[6]=i):i=t[6],i}function Un(e,t){return t?z.jsx(Or,{label:e("siteEditor.details"),detail:t}):void 0}function Qi(e,t,n){ne.error(hn(e,t,n),{...Ln,description:Un(e,xs(t,n))})}function Ci(e,t,n=!1){ne.info(e(t?"sectionsEditor.reconcile.leftDeleted":"sectionsEditor.reconcile.keptTheirs"),{...Ln,description:e(t?n?"sectionsEditor.reconcile.leftDeletedNeverPublishedHint":"sectionsEditor.reconcile.leftDeletedHint":"sectionsEditor.reconcile.keptTheirsHint")})}const Qn={action:void 0,duration:void 0};function Fi(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Qn,id:Le,description:void 0})}function Bi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Un(e,o??null);ne[i](t,{id:Le,description:n&&a?z.jsxs(z.Fragment,{children:[z.jsx("p",{children:n}),a]}):n??a,action:s?{label:e("siteEditor.tryAgain"),onClick:c=>{c.preventDefault(),ne.loading(r??e("thread.publishPopover.publishing"),{...Qn,id:Le,description:void 0}),s()}}:void 0,duration:s?Number.POSITIVE_INFINITY:void 0})}function Vi(e){return e instanceof Error?e.message||null:e==null?null:String(e)}export{Mo as $,Yr as A,di as B,Mi as C,Di as D,Gr as E,mr as F,Z as G,qs as H,wi as I,bi as J,ve as K,Bs as L,Vs as M,ii as N,mi as O,ci as P,ki as Q,yi as R,rr as S,Kt as T,ji as U,ui as V,us as W,ye as X,sr as Y,_s as Z,fs as _,Hr as a,fi as a$,ns as a0,Lr as a1,Qr as a2,Li as a3,rs as a4,Ci as a5,_i as a6,ri as a7,tt as a8,si as a9,Si as aA,pi as aB,rt as aC,xi as aD,Nn as aE,cs as aF,oi as aG,Le as aH,Qn as aI,Fi as aJ,Oi as aK,Ar as aL,Mr as aM,He as aN,Kr as aO,Ni as aP,li as aQ,ee as aR,ai as aS,Bi as aT,Ui as aU,Ln as aV,S as aW,w as aX,Ye as aY,Pn as aZ,Oo as a_,ar as aa,fr as ab,st as ac,Ri as ad,Pi as ae,Qi as af,Ii as ag,_n as ah,ds as ai,ei as aj,Ei as ak,Ti as al,Wr as am,Zr as an,Et as ao,Dt as ap,qr as aq,Es as ar,zr as as,bo as at,Un as au,Vi as av,Cs as aw,Ur as ax,ao as ay,Or as az,Ao as b,ni as b0,hi as b1,gi as b2,vi as b3,sn as c,vo as d,Vr as e,mo as f,ts as g,ti as h,Gt as i,ks as j,$i as k,ut as l,Jr as m,Xr as n,Rs as o,Cr as p,ls as q,Br as r,Fr as s,Ai as t,re as u,Js as v,Ws as w,Us as x,Ts as y,tn as z};
@@ -1 +1 @@
1
- import{b as ee,a4 as te,q as ne,r as E,j as t,B as H,n as F,bC as ae,a5 as ce,aM as me,aL as pe,aI as de,aG as ue,aH as ge,aK as fe,aJ as he,bj as xe,t as C,c8 as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as G,gv as Ce}from"./index-XdUWZF5g.js";import{a as De}from"./SwitchHorizontal01-DTDSJnjG.js";import{N as we}from"./agent-icon-DmYd33Zd.js";import{s as Ne}from"./Trash01-DQCE9WJt.js";import{i as Pe}from"./Upload01-C8pH3Rp-.js";import{i as ie}from"./Zap-B2TeJ3jk.js";import{S as Ae}from"./search-toggle-DaBbNP1T.js";import{E as Y}from"./empty-state-D5FGRI4e.js";import{C as Ee}from"./collection-tabs-DTr38V1c.js";import{S as Me,F as Oe}from"./folder-icon-C2EzD8if.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-C57fsXyq.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-BwoQSegQ.js";import{c as _e}from"./context-shell-CO4fTNNJ.js";import"./AlertCircle-CQW1P7_R.js";import"./Tool01-CE4RsL2T.js";import"./ArrowUp-VZphHDPw.js";import"./ArrowLeft-sSY9Zm-O.js";import"./LinkBroken01-ArAKWl5D.js";import"./ShoppingBag01-DEtqIAKG.js";import"./Globe04-1JEh9zst.js";import"./CheckCircle-BAqlx5xq.js";import"./ChevronUp-RQuomTlc.js";import"./ChevronSelectorVertical-CAw9AQRt.js";import"./UserSquare-DfCEdLMW.js";import"./CreditCard01-uW1Nq0L7.js";import"./Key01-B-MK6puk.js";import"./Minus-y3rEkH4O.js";import"./Monitor01-DkdtFPE6.js";import"./Sun-DhrY2nq7.js";import"./Play-BtmesR9D.js";import"./Plus-BhSB1FAc.js";import"./SearchMd-CTCaP47C.js";import"./Users01-RbJbPNL4.js";import"./XClose-B9seet19.js";import"./icon-button-Dls6AzVP.js";import"./tooltip-C1oPRuFg.js";import"./index-DJy_S3Mn.js";import"./badge-fJOJmdQG.js";import"./markdown-A06Oe1_p.js";import"./use-copy-9wHvlEmg.js";import"./use-mobile-DSmr8Fj3.js";import"./autosend-0p4cszrD.js";import"./thread-route-DSQLBJ4Y.js";import"./use-project-scope-C1eT4xwT.js";import"./repository-binding-Cfy_YQIZ.js";import"./use-mcp-client-B9_8tfCL.js";import"./auth-DeNsOsKX.js";import"./task-board-B-Jl-DnQ.js";import"./schema-CJ9UcSNs.js";import"./file-preview-CVLvq53I.js";import"./utils-C07I_8BL.js";import"./editor-B5BFg8L4.js";import"./file-type-icon-BZTtX6EK.js";import"./useInfiniteQuery-BvhkDMwv.js";import"./infiniteQueryObserver-DgQQHW6Y.js";import"./thread-intent-DnduoWYb.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-BUtg06cI.js";import"./use-entitlements-DzfUP8ON.js";import"./use-ai-providers-BmwnG2L7.js";import"./use-decopilot-events-CR7NJgme.js";import"./use-organization-settings-B0lt5dXR.js";import"./require-capability-Bpnmr0un.js";import"./access-gate-B3-8eUAT.js";import"./capability-load-error-BwSdaWc5.js";import"./sections-T2vi-zI4.js";import"./textarea-DSiKrnTK.js";import"./use-ask-in-chat-C56CHpt0.js";import"./shell-layout-d2Ief2ja.js";import"./use-deployment-admin-CALPlo_8.js";import"./admin-fetch-BhTJlAsX.js";import"./command-8eo7blzl.js";import"./index-CKuu5BgI.js";import"./integration-icon-DpoZYM7e.js";import"./project-icon-BhWIi9DN.js";import"./use-navigate-to-agent-ycEqYJX7.js";import"./use-debounced-value-Cs49dczG.js";import"./new-project-dialog-151PED_m.js";import"./label-CUqIqnOS.js";import"./repository-picker-BKWo-jhF.js";import"./github-icon-Buu0H1v4.js";import"./collection-search-DFoNgd1T.js";import"./legacy-admin-welcome-dialog-D12aat8e.js";import"./drawer-BiZQd3jF.js";import"./required-auth-layout-CRKzQVpv.js";import"./use-org-sso-B5c0saDF.js";const J=200,Fe=new Set(["node_modules","__pycache__"]);function Q(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Le(s){return Q(s).split("/").every(e=>!e.startsWith(".")&&!Fe.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=Q(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 Ge(s,e){const i=_e(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 L="*";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:we}}function He(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 D;e[3]!==i?(D=B(i),e[3]=i,e[4]=D):D=e[4];const R=D,w=o?"opacity-60":"hover:bg-accent";let f;e[5]!==w?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",w),e[5]=w,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(H,{variant:"ghost",size:"icon",children:t.jsx(De,{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 Ds(){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(L),[D,R]=E.useState(!1),[w,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:G.slashSkills(e.id)}),a.invalidateQueries({queryKey:G.orgFsSkills(e.id)})},j=r=>a.setQueryData(G.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.filter(Le),U=_.find(A=>Q(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(_.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=Ge($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(_,$),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:L,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:L,S=u===L?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(H,{size:"sm",disabled:D,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(D?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(F,{children:[t.jsx(F.Content,{children:t.jsx(F.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(F.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(H,{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(He,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),w&&t.jsx(Me,{skillPath:w,onClose:()=>f(null)},w),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{Ds as default};
1
+ import{b as ee,a4 as te,q as ne,r as E,j as t,B as H,n as F,bC as ae,a5 as ce,aM as me,aL as pe,aI as de,aG as ue,aH as ge,aK as fe,aJ as he,bj as xe,t as C,c8 as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as G,gv as Ce}from"./index-Dd5hidCj.js";import{a as De}from"./SwitchHorizontal01-BTdsV_bI.js";import{N as we}from"./agent-icon-CMiKlX_f.js";import{s as Ne}from"./Trash01-CgWosjFE.js";import{i as Pe}from"./Upload01-DAMBCMxP.js";import{i as ie}from"./Zap-BJ5eCR1y.js";import{S as Ae}from"./search-toggle-CShA1wOK.js";import{E as Y}from"./empty-state-Cfajk5TO.js";import{C as Ee}from"./collection-tabs-CzJgsFmP.js";import{S as Me,F as Oe}from"./folder-icon-C5I9OzDM.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-8086pm93.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-DgCR75CY.js";import{c as _e}from"./context-shell-2FHUOtQh.js";import"./AlertCircle-CsPTcN_S.js";import"./Tool01-BWMOxR8v.js";import"./ArrowUp-Cv1SmuzD.js";import"./ArrowLeft-BYhfnAa5.js";import"./LinkBroken01-B3rPhu7D.js";import"./ShoppingBag01-BcBJW8Ry.js";import"./Globe04-ceJSWDa3.js";import"./CheckCircle-LO8Q7KlB.js";import"./ChevronUp-Dh24Sq_k.js";import"./ChevronSelectorVertical-Bo1EsiyQ.js";import"./UserSquare-BjqAifU8.js";import"./CreditCard01-B0xYA-L3.js";import"./Key01-D9P3FMiY.js";import"./Minus-BP4M5eUu.js";import"./Monitor01-BIy7Jnq0.js";import"./Sun-oVWnfq_E.js";import"./Play-C4cdDhC3.js";import"./Plus-Bcl7avNA.js";import"./SearchMd-DRs-Ld4Z.js";import"./Users01-Bt0rcyOL.js";import"./XClose-TMdj_yIm.js";import"./icon-button-CyNmKrzV.js";import"./tooltip-Dyh2h0NV.js";import"./index-B57dAAxD.js";import"./badge-D7MkXlu5.js";import"./markdown-ZlzKtNkL.js";import"./use-copy-DJs5balG.js";import"./use-mobile-DDy9Znlf.js";import"./autosend-CGJPJD3U.js";import"./thread-route-B_swkleJ.js";import"./use-project-scope-Dqnjf5Fg.js";import"./repository-binding-DV3kkbZ_.js";import"./use-mcp-client-CNXpOf52.js";import"./auth-TL5_hJeY.js";import"./task-board-BZ6FZl9j.js";import"./schema-paIXrOCY.js";import"./file-preview-Dmy5YhII.js";import"./utils-Cugj1NVM.js";import"./editor-DXF9rwVo.js";import"./file-type-icon-D75nksOt.js";import"./useInfiniteQuery-DqQNqcJl.js";import"./infiniteQueryObserver-C1uWfhgO.js";import"./thread-intent-DMhB2sy4.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-2U2aYEEI.js";import"./use-entitlements-mX8bg5XG.js";import"./use-ai-providers-DQAzIwY2.js";import"./use-decopilot-events-CtnAXgLl.js";import"./use-organization-settings-488vpN0c.js";import"./require-capability-Dlaolf-u.js";import"./access-gate-DbqD_EAv.js";import"./capability-load-error-cDMC87PI.js";import"./sections-CnLSarWD.js";import"./textarea-hEv7rKyL.js";import"./use-ask-in-chat-4DqUxBJG.js";import"./shell-layout-Dcfsytx-.js";import"./use-deployment-admin-mLJFncG4.js";import"./admin-fetch-BhTJlAsX.js";import"./command-Bh995x5J.js";import"./index-DjpHvK_4.js";import"./integration-icon-DHvbSqTM.js";import"./project-icon-BC5BTHqT.js";import"./use-navigate-to-agent-B-iTaYhm.js";import"./use-debounced-value-CezJqVSj.js";import"./new-project-dialog-BDUp1HsF.js";import"./label-BZoCdZa0.js";import"./repository-picker-DhcwcPzc.js";import"./github-icon--dnMj3-y.js";import"./collection-search-DmyrNuWr.js";import"./legacy-admin-welcome-dialog-BgMnIQY9.js";import"./drawer-BcaULeep.js";import"./required-auth-layout-lVrZieBu.js";import"./use-org-sso-DNEWwtoA.js";const J=200,Fe=new Set(["node_modules","__pycache__"]);function Q(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Le(s){return Q(s).split("/").every(e=>!e.startsWith(".")&&!Fe.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=Q(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 Ge(s,e){const i=_e(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 L="*";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:we}}function He(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 D;e[3]!==i?(D=B(i),e[3]=i,e[4]=D):D=e[4];const R=D,w=o?"opacity-60":"hover:bg-accent";let f;e[5]!==w?(f=ke("relative transition-colors group overflow-hidden flex flex-col h-full",w),e[5]=w,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(H,{variant:"ghost",size:"icon",children:t.jsx(De,{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 Ds(){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(L),[D,R]=E.useState(!1),[w,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:G.slashSkills(e.id)}),a.invalidateQueries({queryKey:G.orgFsSkills(e.id)})},j=r=>a.setQueryData(G.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.filter(Le),U=_.find(A=>Q(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(_.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(_.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=Ge($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(_,$),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:L,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:L,S=u===L?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(H,{size:"sm",disabled:D,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(D?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(F,{children:[t.jsx(F.Content,{children:t.jsx(F.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(F.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(H,{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(He,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),w&&t.jsx(Me,{skillPath:w,onClose:()=>f(null)},w),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{Ds as default};
@@ -1 +1 @@
1
- import{c as _,m as N,j}from"./index-XdUWZF5g.js";import{T as k,R as z,a as D,b as S}from"./index-UxIaE43S.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-Dd5hidCj.js";import{T as k,R as z,a as D,b as S}from"./index-ozu548h3.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,fh as K}from"./index-XdUWZF5g.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-B_Pr2KZA.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,fh as K}from"./index-Dd5hidCj.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-Cx2tI-v0.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,a4 as B,r as v,j as e,n as x,hi as k,gL as b,g6 as y,g7 as a,h$ as D,B as m,I as g,aM as z,aL as T,aI as O,aG as R,aK as F,aJ as M,bj as q,E as C,t as c,c as U}from"./index-XdUWZF5g.js";import{D as $}from"./domain-settings-nzh2Xqh2.js";import{S as G}from"./switch-CRe3xUPs.js";import{a as H,b as J,c as K,d as Q}from"./use-org-sso-B5c0saDF.js";import{s as V}from"./Trash01-DQCE9WJt.js";import{R as W}from"./require-capability-Bpnmr0un.js";import"./badge-fJOJmdQG.js";import"./select-BABowMoY.js";import"./index-BdQq_4o_.js";import"./index-DJy_S3Mn.js";import"./ChevronUp-RQuomTlc.js";import"./access-gate-B3-8eUAT.js";import"./capability-load-error-BwSdaWc5.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=H(o.id,o.slug),f=J(o.id,o.slug),S=K(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,L=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},_=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"))}},N=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($,{}),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(G,{checked:n.enforced,onCheckedChange:N,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:L,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:_,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(F,{children:[e.jsx(M,{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,a4 as B,r as v,j as e,n as x,hi as k,gL as b,g6 as y,g7 as a,h$ as D,B as m,I as g,aM as z,aL as T,aI as O,aG as R,aK as F,aJ as M,bj as q,E as C,t as c,c as U}from"./index-Dd5hidCj.js";import{D as $}from"./domain-settings-DEAsOpnU.js";import{S as G}from"./switch-BZMVD_xA.js";import{a as H,b as J,c as K,d as Q}from"./use-org-sso-DNEWwtoA.js";import{s as V}from"./Trash01-CgWosjFE.js";import{R as W}from"./require-capability-Dlaolf-u.js";import"./badge-D7MkXlu5.js";import"./select-iwVnUZSM.js";import"./index-BdQq_4o_.js";import"./index-B57dAAxD.js";import"./ChevronUp-Dh24Sq_k.js";import"./access-gate-DbqD_EAv.js";import"./capability-load-error-cDMC87PI.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=H(o.id,o.slug),f=J(o.id,o.slug),S=K(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,L=()=>{n&&l({issuer:n.issuer,clientId:n.clientId,clientSecret:"",discoveryEndpoint:n.discoveryEndpoint??"",domain:n.domain,scopes:n.scopes.join(" ")}),p(!0)},_=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"))}},N=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($,{}),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(G,{checked:n.enforced,onCheckedChange:N,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:L,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:_,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(F,{children:[e.jsx(M,{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};