decocms 4.578.1 → 4.579.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (409) hide show
  1. package/dist/client/assets/{AlertCircle-BttmH_EW.js → AlertCircle-GXBIxFcm.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BeQ7O-oz.js → AreaChart-BliO7z1O.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-C_GHEWeK.js → ArrowLeft-BbqwGy0e.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-51wIoVbi.js → ArrowUp-DBkhb8Yz.js} +1 -1
  5. package/dist/client/assets/{BookOpen01-CDYle7oQ.js → BookOpen01-1fjc61Mm.js} +1 -1
  6. package/dist/client/assets/{CartesianChart-Ydd3fzeG.js → CartesianChart-D_ikhSur.js} +1 -1
  7. package/dist/client/assets/{CategoricalChart-DeS4pERs.js → CategoricalChart-DFr--lUX.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-C3-mSikS.js → CheckCircle-B_eEhqJR.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-B417CqKz.js → ChevronSelectorVertical-D-7E5GYT.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-EmQwLtzg.js → ChevronUp-FDrusEQ7.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-DANJ2Q0i.js → CreditCard01-KjySk-5G.js} +1 -1
  12. package/dist/client/assets/{Globe04-Cuhejf9G.js → Globe04-CYg8V2eL.js} +1 -1
  13. package/dist/client/assets/{Key01-qpabI11H.js → Key01-DY2gyLvd.js} +1 -1
  14. package/dist/client/assets/{LinkBroken01-CrTBWjs0.js → LinkBroken01-CzDrAWsX.js} +1 -1
  15. package/dist/client/assets/{Minus-CzyQFk6M.js → Minus-CMxaDSgl.js} +1 -1
  16. package/dist/client/assets/{Monitor01-CuxWk6vM.js → Monitor01-3IwLMf0Q.js} +1 -1
  17. package/dist/client/assets/{Play-s__3_cku.js → Play-BOARoASB.js} +1 -1
  18. package/dist/client/assets/{Plus-niUoy_uM.js → Plus-D452i-ki.js} +1 -1
  19. package/dist/client/assets/{ReferenceLine-D7fZO7Od.js → ReferenceLine-BCPouREj.js} +1 -1
  20. package/dist/client/assets/{SearchMd-DcWhidrm.js → SearchMd-D9VvymBK.js} +1 -1
  21. package/dist/client/assets/{ShoppingBag01-CiAvRXvs.js → ShoppingBag01-DrNjYHL1.js} +1 -1
  22. package/dist/client/assets/{Sun-CB2w_c2y.js → Sun-BvPiksd_.js} +1 -1
  23. package/dist/client/assets/{SwitchHorizontal01-D4s0wqq6.js → SwitchHorizontal01-BzX5npS9.js} +1 -1
  24. package/dist/client/assets/{Tool01-DRAEzq3d.js → Tool01-DoE3EsIZ.js} +1 -1
  25. package/dist/client/assets/{Tooltip-CPqx6foD.js → Tooltip-z7WiBKoc.js} +1 -1
  26. package/dist/client/assets/{Trash01-B0DFZIg9.js → Trash01-_1ewPMOO.js} +1 -1
  27. package/dist/client/assets/{Upload01-CF32qbWU.js → Upload01-D11ZXRKj.js} +1 -1
  28. package/dist/client/assets/{UserSquare-C01-Jxv6.js → UserSquare-DHrzs2xN.js} +1 -1
  29. package/dist/client/assets/{Users01-BnjH2fbf.js → Users01-DdipP4E2.js} +1 -1
  30. package/dist/client/assets/{XClose-CznGRv9E.js → XClose-CR92HpkN.js} +1 -1
  31. package/dist/client/assets/{Zap-DRZwAN9E.js → Zap-D5X_AlHR.js} +1 -1
  32. package/dist/client/assets/{access-gate-DKCp0oSn.js → access-gate-CpF5setC.js} +1 -1
  33. package/dist/client/assets/{add-connection-dialog-DNldeOcj.js → add-connection-dialog-DB2eDzSO.js} +1 -1
  34. package/dist/client/assets/agent-app-FoPCQlJh.js +1 -0
  35. package/dist/client/assets/{agent-assets-DZ2i3aIp.js → agent-assets-CynthE6_.js} +1 -1
  36. package/dist/client/assets/{agent-automation-DM5au--P.js → agent-automation-1MlsXRHC.js} +3 -3
  37. package/dist/client/assets/{agent-automations-BgMKlEKo.js → agent-automations-Dol9sHiV.js} +1 -1
  38. package/dist/client/assets/{agent-blog-DRawqCX5.js → agent-blog-Db3MOHTb.js} +2 -2
  39. package/dist/client/assets/{agent-blog-post-4Yzlewwc.js → agent-blog-post-BWxagJWC.js} +2 -2
  40. package/dist/client/assets/{agent-calendar-C9NotvdT.js → agent-calendar-DgGhw5pC.js} +1 -1
  41. package/dist/client/assets/{agent-capabilities-jT-VtqUC.js → agent-capabilities-CtbwhlqH.js} +1 -1
  42. package/dist/client/assets/{agent-connect-sources-CrnDKgE0.js → agent-connect-sources-ByKpOl5Z.js} +1 -1
  43. package/dist/client/assets/agent-deck-CYqAnEDO.js +1 -0
  44. package/dist/client/assets/{agent-e2e-mvh6F0Be.js → agent-e2e-CmmnhpPI.js} +1 -1
  45. package/dist/client/assets/agent-experiments-C0HV4Igp.js +1 -0
  46. package/dist/client/assets/agent-file-BwXd7p-8.js +1 -0
  47. package/dist/client/assets/{agent-hosting-BC9PAjNJ.js → agent-hosting-FxuGCE-9.js} +1 -1
  48. package/dist/client/assets/{agent-icon-Clk7SRdQ.js → agent-icon-DPgCnEV1.js} +1 -1
  49. package/dist/client/assets/agent-library-CZViQovH.js +1 -0
  50. package/dist/client/assets/agent-library-file-DC-34Ulj.js +1 -0
  51. package/dist/client/assets/agent-overview-DIMIEsnS.js +1 -0
  52. package/dist/client/assets/{agent-releases-BV2KNppz.js → agent-releases-CkbrqRyS.js} +1 -1
  53. package/dist/client/assets/agent-settings-Ct-2qeci.js +1 -0
  54. package/dist/client/assets/{agent-site-editor-Bow7ioXm.js → agent-site-editor-ClFcVY3S.js} +1 -1
  55. package/dist/client/assets/agent-site-editor-code-B_iiio_B.js +2 -0
  56. package/dist/client/assets/agent-site-editor-content-XnR2gN3f.js +1 -0
  57. package/dist/client/assets/agent-site-editor-preview-DuB0qtlm.js +1 -0
  58. package/dist/client/assets/agent-view-B8ACan0R.js +1 -0
  59. package/dist/client/assets/{agent-view-guard-D7RNQw3n.js → agent-view-guard-BCiwIORn.js} +1 -1
  60. package/dist/client/assets/{ai-providers-C10gOn1c.js → ai-providers-bDAV58Mn.js} +1 -1
  61. package/dist/client/assets/{alert-C40ffdTq.js → alert-DXhGyLVy.js} +1 -1
  62. package/dist/client/assets/{analytics-sections-C8V0d1eU.js → analytics-sections-DBGqAepm.js} +1 -1
  63. package/dist/client/assets/api-keys-BHoBmIeA.js +1 -0
  64. package/dist/client/assets/{api-keys-Cr8tyjtC.js → api-keys-BNfyNQ7I.js} +1 -1
  65. package/dist/client/assets/{app-editor-ByystBM6.js → app-editor-BiIR6cEw.js} +1 -1
  66. package/dist/client/assets/{asset-utils-D4HWdZ_7.js → asset-utils-C4P9UMw5.js} +1 -1
  67. package/dist/client/assets/{auth-D_w34xQ-.js → auth-DET1t4rk.js} +1 -1
  68. package/dist/client/assets/{auth-catchall-gVavleR3.js → auth-catchall-Ds0jCVCs.js} +1 -1
  69. package/dist/client/assets/{auth-entry-Bhy_H_Rg.js → auth-entry-CcoroHhc.js} +1 -1
  70. package/dist/client/assets/{auth-split-layout-Dlt5Y9Yo.js → auth-split-layout-DyPur8S6.js} +1 -1
  71. package/dist/client/assets/{authenticate-and-persist-oauth-jwCoKgM4.js → authenticate-and-persist-oauth-BcQblp8z.js} +1 -1
  72. package/dist/client/assets/{automation-list-row-CJf3Hfci.js → automation-list-row-CUs_NzLP.js} +1 -1
  73. package/dist/client/assets/{automation-runs-DFAxj_hn.js → automation-runs-CwfQCxx5.js} +1 -1
  74. package/dist/client/assets/{automations-Bnx6noDz.js → automations-aHGSwKcI.js} +1 -1
  75. package/dist/client/assets/{badge-Bec4Z79_.js → badge-CPdAi539.js} +1 -1
  76. package/dist/client/assets/{block-document-3uCBlgZI.js → block-document-Bbw2FP3P.js} +3 -3
  77. package/dist/client/assets/{blocks-preview-workspace-context-CFT39hTK.js → blocks-preview-workspace-context-CZpRdqcZ.js} +1 -1
  78. package/dist/client/assets/{blocks-tab-states-DgLrbRiD.js → blocks-tab-states-B3rnTo7L.js} +1 -1
  79. package/dist/client/assets/{blog-preview-url-DiFMPgbV.js → blog-preview-url-D9nceA8-.js} +1 -1
  80. package/dist/client/assets/{blog-schema-BS2v2MSK.js → blog-schema-CxC8Q-yf.js} +1 -1
  81. package/dist/client/assets/{blog-source-gate-CwZXRzP6.js → blog-source-gate-SOnwSY-u.js} +1 -1
  82. package/dist/client/assets/{blog-view-gate-hTnrbFjq.js → blog-view-gate-CbpRy_w3.js} +1 -1
  83. package/dist/client/assets/{buckets-DRTwHO8z.js → buckets-sxg53sM-.js} +1 -1
  84. package/dist/client/assets/{build-improve-prompt-doc-DDEce0zc.js → build-improve-prompt-doc-D_rPYtI9.js} +1 -1
  85. package/dist/client/assets/{calendar-BHxqLYB2.js → calendar-HFJ5axO1.js} +1 -1
  86. package/dist/client/assets/{capability-load-error-Cg21B6QM.js → capability-load-error-BCoAaz36.js} +1 -1
  87. package/dist/client/assets/{category-editor-DrwVl4Sl.js → category-editor-BIsXNtK9.js} +1 -1
  88. package/dist/client/assets/{category-tree-CgP369CP.js → category-tree-BwBGBNEZ.js} +1 -1
  89. package/dist/client/assets/{chart-Cz95W4qb.js → chart-_XV_ZGbS.js} +1 -1
  90. package/dist/client/assets/{chat-context-2_7VL2Se.js → chat-context-DmIaWG0i.js} +1 -1
  91. package/dist/client/assets/{chat-draft-BH8Etp5p.js → chat-draft-D5guZJ-Z.js} +1 -1
  92. package/dist/client/assets/{checkbox-DcSwaw9N.js → checkbox-C6L9-jtU.js} +1 -1
  93. package/dist/client/assets/{choose-editor-C4LsHc8P.js → choose-editor-D-ClYTuz.js} +1 -1
  94. package/dist/client/assets/{cli-auth-success-Dg6G0C4J.js → cli-auth-success-CMqt_C6d.js} +1 -1
  95. package/dist/client/assets/{client-icons-ohal0kIt.js → client-icons-BrNyP8bx.js} +1 -1
  96. package/dist/client/assets/{cms-settings-editor-_WpAeDPl.js → cms-settings-editor-Cm7lJgYR.js} +1 -1
  97. package/dist/client/assets/{cms-store-drafts-DXYwm7p9.js → cms-store-drafts-CTNFCbln.js} +1 -1
  98. package/dist/client/assets/{collapsible-C0DaEqwH.js → collapsible-SBMmc8E3.js} +1 -1
  99. package/dist/client/assets/{collection-detail-DqPGF8Zk.js → collection-detail-VM7vyobJ.js} +1 -1
  100. package/dist/client/assets/{collection-display-button-BYPP-sV7.js → collection-display-button-DNT54OXz.js} +1 -1
  101. package/dist/client/assets/{collection-search-n_O3WZGN.js → collection-search-DXnQxUGL.js} +1 -1
  102. package/dist/client/assets/{collection-table-wrapper-nXT01FCH.js → collection-table-wrapper-BtWWhOUa.js} +1 -1
  103. package/dist/client/assets/{collection-tabs-Bj6L8MsE.js → collection-tabs-BPEGrrum.js} +1 -1
  104. package/dist/client/assets/{combobox-CgNU2tMt.js → combobox-B8oSfLQg.js} +1 -1
  105. package/dist/client/assets/{command-BtcP4IBQ.js → command-ARXYIBtk.js} +1 -1
  106. package/dist/client/assets/{companion-mcps-section-CPNG8Vx3.js → companion-mcps-section-CrDXFS6p.js} +1 -1
  107. package/dist/client/assets/{config-C9iB0RU8.js → config-FNjB2KQg.js} +1 -1
  108. package/dist/client/assets/{connect-D3tjGmEi.js → connect-D7SeHA4r.js} +3 -3
  109. package/dist/client/assets/{connect-layout-eEBnzEV_.js → connect-layout-ByVGILi-.js} +1 -1
  110. package/dist/client/assets/{connect-source-dialog-_DXcUm0Y.js → connect-source-dialog-Di53RqvY.js} +1 -1
  111. package/dist/client/assets/{connection-BKTcYZml.js → connection-BTlRsp1B.js} +1 -1
  112. package/dist/client/assets/{connection-card-COLQiOkG.js → connection-card-DFMJTK3o.js} +1 -1
  113. package/dist/client/assets/{connection-detail-DzBabz1S.js → connection-detail-C-BChkKr.js} +1 -1
  114. package/dist/client/assets/{connection-form-helpers-9_MGiUYQ.js → connection-form-helpers-B9Yi82ri.js} +1 -1
  115. package/dist/client/assets/{connection-slug-DXuQYZmG.js → connection-slug-COimMHkq.js} +1 -1
  116. package/dist/client/assets/{connections-CLDKZJVw.js → connections-fJDsaPLw.js} +1 -1
  117. package/dist/client/assets/content-tab-BV39A4DC.js +19 -0
  118. package/dist/client/assets/{context-f8fDVtNj.js → context-DHTHUOqh.js} +1 -1
  119. package/dist/client/assets/{context-menu-Dsw1Ex34.js → context-menu-B-hlKiE1.js} +1 -1
  120. package/dist/client/assets/{context-shell-DpQEYO74.js → context-shell-BGKkeMCB.js} +3 -3
  121. package/dist/client/assets/{core.esm-rweyZtAP.js → core.esm-Hiw5xlkT.js} +1 -1
  122. package/dist/client/assets/{create-organization-dialog-DUk4B45U.js → create-organization-dialog-EtzNyw9E.js} +1 -1
  123. package/dist/client/assets/{delete-copy-DZE-3KQB.js → delete-copy-Bt51Emir.js} +1 -1
  124. package/dist/client/assets/{device-hint-CQX1G1PE.js → device-hint-DcULIlAN.js} +1 -1
  125. package/dist/client/assets/{discover-uwdyIAIK.js → discover-B7EzX3Z4.js} +1 -1
  126. package/dist/client/assets/{domain-settings-Ba1MIa2U.js → domain-settings-CYdry1vA.js} +1 -1
  127. package/dist/client/assets/{drawer-XRqK1CkH.js → drawer-BUu3Urhv.js} +1 -1
  128. package/dist/client/assets/{editor-CBAsUN_D.js → editor-Dc6skLlO.js} +1 -1
  129. package/dist/client/assets/{editor-classes-DJG-Wj7v.js → editor-classes-BRb8pzNp.js} +1 -1
  130. package/dist/client/assets/{empty-message-DgtU67aA.js → empty-message-uyJw_GDm.js} +2 -2
  131. package/dist/client/assets/{empty-state-BVQ9VzOU.js → empty-state-CQ-naxDO.js} +1 -1
  132. package/dist/client/assets/{empty-state-CfzBgpuZ.js → empty-state-yinauESn.js} +1 -1
  133. package/dist/client/assets/{experiments-tab-choice-DuLgqqx_.js → experiments-tab-choice-n7UpEKSe.js} +1 -1
  134. package/dist/client/assets/{extract-connection-data-EIjdoFBg.js → extract-connection-data-UTX_3j8w.js} +1 -1
  135. package/dist/client/assets/{feature-gate-Bsh6-M6w.js → feature-gate-Caiq88-a.js} +1 -1
  136. package/dist/client/assets/{feature-paywall-DGSKlw9o.js → feature-paywall-CgY8XcJe.js} +1 -1
  137. package/dist/client/assets/{file-explorer-DnoVcCFG.js → file-explorer-Dt28l_Zt.js} +1 -1
  138. package/dist/client/assets/{file-preview-D_0IU7PB.js → file-preview-B_OweD07.js} +1 -1
  139. package/dist/client/assets/{file-share-button-B1Fk0nBQ.js → file-share-button-GtMerxGo.js} +2 -2
  140. package/dist/client/assets/{file-type-icon-DED9IxiZ.js → file-type-icon-5sEsvuio.js} +1 -1
  141. package/dist/client/assets/{folder-icon-Detn5ugB.js → folder-icon-BkVkbSXN.js} +1 -1
  142. package/dist/client/assets/{form-CxSSvRAm.js → form-DQshgY6C.js} +1 -1
  143. package/dist/client/assets/{frame-navigation-MwhFGymR.js → frame-navigation-DCO55Sf7.js} +1 -1
  144. package/dist/client/assets/{general-DEU4SDIa.js → general-BaBNqFUU.js} +1 -1
  145. package/dist/client/assets/{github-icon-N9MEN1MZ.js → github-icon-CsOyvsM3.js} +1 -1
  146. package/dist/client/assets/{held-block-view-D_87TUke.js → held-block-view-CZDHkd7I.js} +1 -1
  147. package/dist/client/assets/{home-6nU3ZamX.js → home-Csg3jJI1.js} +1 -1
  148. package/dist/client/assets/{home-overview-C3Zj8fkv.js → home-overview-BWPQ5B3f.js} +1 -1
  149. package/dist/client/assets/{hosted-reconcile-f9zR8ohF.js → hosted-reconcile-BVY_PuHB.js} +1 -1
  150. package/dist/client/assets/{icon-button-DUjjoGv_.js → icon-button-DTP_l7w5.js} +1 -1
  151. package/dist/client/assets/{index-CpQGG70q.js → index--NX8xaba.js} +1 -1
  152. package/dist/client/assets/{index-BRMdzLQF.js → index-BUzNTivf.js} +1 -1
  153. package/dist/client/assets/{index-BhtDSp6y.js → index-B_-7lo18.js} +6 -6
  154. package/dist/client/assets/{index-BX-xETn9.js → index-BtBKqC_9.js} +1 -1
  155. package/dist/client/assets/{index-D2WZClU1.js → index-BxZUC_i-.js} +1 -1
  156. package/dist/client/assets/{index-Dsc22z2E.js → index-COp-j3NW.js} +1 -1
  157. package/dist/client/assets/{index-DK-8s7Az.js → index-Chdoy1DO.js} +1 -1
  158. package/dist/client/assets/{index-DIeS-zcI.js → index-CoDU2Q4W.js} +1 -1
  159. package/dist/client/assets/{index-DKvQA4se.js → index-Cwblfb1K.js} +1 -1
  160. package/dist/client/assets/{index-Rlc6g0eH.js → index-D8htcGU7.js} +1 -1
  161. package/dist/client/assets/{index-B3ab16ZV.js → index-D9OoYQHh.js} +1 -1
  162. package/dist/client/assets/{index-Dn1sSLiR.js → index-DThhcUFE.js} +3 -3
  163. package/dist/client/assets/{index-CAJpA_Gg.js → index-DpynbW7T.js} +1 -1
  164. package/dist/client/assets/{index-DkcRNYY4.js → index-PfzOl7J6.js} +7 -7
  165. package/dist/client/assets/{index-1TeON1d1.js → index-TayDSkqp.js} +1 -1
  166. package/dist/client/assets/{index-redirect-xsDNsYua.js → index-redirect-BkFuXXfk.js} +1 -1
  167. package/dist/client/assets/{index-DyJk9i7m.js → index-xX6vrZ6Z.js} +1 -1
  168. package/dist/client/assets/{index-DoI9gwtY.js → index-yk7iwtzd.js} +1 -1
  169. package/dist/client/assets/{infiniteQueryObserver-Bitq8wqo.js → infiniteQueryObserver-BSITs4kU.js} +1 -1
  170. package/dist/client/assets/{infra-billing-Bq7lICUo.js → infra-billing-BoDxU99n.js} +1 -1
  171. package/dist/client/assets/{input-cZnIeAU-.js → input-CHXvb5rt.js} +3 -3
  172. package/dist/client/assets/{input-Z8vNy904.js → input-D81euCkI.js} +1 -1
  173. package/dist/client/assets/{integration-icon-D_f17Dc0.js → integration-icon-Cypf7ART.js} +1 -1
  174. package/dist/client/assets/item-actions-8EnEtcgh.js +1 -0
  175. package/dist/client/assets/{jira-icon-B_i3CvQt.js → jira-icon-QIwPAzLK.js} +1 -1
  176. package/dist/client/assets/{label-Dn3Jp5Ws.js → label-C3bFtEDk.js} +1 -1
  177. package/dist/client/assets/{layout-Uu1mBCHM.js → layout-BQNYAbQM.js} +1 -1
  178. package/dist/client/assets/{legacy-admin-welcome-dialog-BZv5i7Tg.js → legacy-admin-welcome-dialog-BndvejSa.js} +1 -1
  179. package/dist/client/assets/{legacy-agents-deep-DP_-DfVk.js → legacy-agents-deep-Dl3vADCo.js} +1 -1
  180. package/dist/client/assets/{legacy-main-redirect-BUWLccLo.js → legacy-main-redirect-ChiwiSS2.js} +1 -1
  181. package/dist/client/assets/library-BRiige9x.js +1 -0
  182. package/dist/client/assets/{library-tab-BFNRWK_p.js → library-tab-CrYnUaco.js} +1 -1
  183. package/dist/client/assets/{login-bQ_A0WZT.js → login-rcDgqa7Z.js} +1 -1
  184. package/dist/client/assets/{markdown-b_kJoSST.js → markdown-sfCsYKJ3.js} +1 -1
  185. package/dist/client/assets/{mcp-app-renderer-DnzeUjpd.js → mcp-app-renderer-D149puyc.js} +1 -1
  186. package/dist/client/assets/{mcp-oauth-DtWQzykq.js → mcp-oauth-CSBTsyXo.js} +1 -1
  187. package/dist/client/assets/{mcp-oauth-DFR30m4O.js → mcp-oauth-jwlMSPw2.js} +1 -1
  188. package/dist/client/assets/{members-D0Lz_KgP.js → members-CelJ91W8.js} +1 -1
  189. package/dist/client/assets/{memory-BoBRHeM6.js → memory-78oDfUbY.js} +1 -1
  190. package/dist/client/assets/{mock-board-DHgHCl4G.js → mock-board-1wwE7bgl.js} +3 -3
  191. package/dist/client/assets/{monaco-editor-UZynMXqx.js → monaco-editor-CdzTj7u7.js} +1 -1
  192. package/dist/client/assets/{monitoring-DxDbj9fw.js → monitoring-CMxjfhWD.js} +1 -1
  193. package/dist/client/assets/{monitoring-stats-row-Cuheh0jS.js → monitoring-stats-row-DQq79-Av.js} +1 -1
  194. package/dist/client/assets/{multi-select-DME84cUe.js → multi-select-DuhSvGkq.js} +1 -1
  195. package/dist/client/assets/{mustache-y-ZQsp_m.js → mustache-7iPTegv4.js} +1 -1
  196. package/dist/client/assets/{named-rule-step-DN_fLt7U.js → named-rule-step-osjl7ntJ.js} +1 -1
  197. package/dist/client/assets/{named-rule-view-DZEGURWO.js → named-rule-view-BLodRfDS.js} +1 -1
  198. package/dist/client/assets/{new-project-dialog-woRLqi3-.js → new-project-dialog-ddGWO7oU.js} +1 -1
  199. package/dist/client/assets/{oauth-callback-BgK3JUto.js → oauth-callback-O0HaoPhW.js} +1 -1
  200. package/dist/client/assets/{oauth-callback-ai-provider-DIdeF5L_.js → oauth-callback-ai-provider-lqjcXm4x.js} +1 -1
  201. package/dist/client/assets/{oauth-consent-DeoVyPXJ.js → oauth-consent-N41ISlqj.js} +1 -1
  202. package/dist/client/assets/{onboarding-CrBz7CJY.js → onboarding-5wyvG1ND.js} +1 -1
  203. package/dist/client/assets/{openai-conversation-Cv54h2Lp.js → openai-conversation-CHwDAykX.js} +1 -1
  204. package/dist/client/assets/{optimistic-project-sidebar-views-BZ1sAhod.js → optimistic-project-sidebar-views-1aPoGedf.js} +1 -1
  205. package/dist/client/assets/{order-monitor-day-HVJjPS8X.js → order-monitor-day-BETRE7hY.js} +1 -1
  206. package/dist/client/assets/{organization-choice-DiOY09h_.js → organization-choice-xEY1ZwIn.js} +1 -1
  207. package/dist/client/assets/{orgs-CDazo1cx.js → orgs-BV4-A9Pr.js} +1 -1
  208. package/dist/client/assets/{own-accounts-section-DFgMqqFp.js → own-accounts-section-DY9RNK5U.js} +1 -1
  209. package/dist/client/assets/{pair-BV9OnQjN.js → pair-4_jIXzEz.js} +1 -1
  210. package/dist/client/assets/{parse-sections-DRVKTg0R.js → parse-sections-Crm8e-1O.js} +2 -2
  211. package/dist/client/assets/{plan-Cts1Yk_E.js → plan-TSt9lDnY.js} +1 -1
  212. package/dist/client/assets/{plan-ladder-KbWc-Or1.js → plan-ladder-6lanq0kZ.js} +1 -1
  213. package/dist/client/assets/{plan-usage-card-CN7VFizA.js → plan-usage-card-qPS6Eqeb.js} +1 -1
  214. package/dist/client/assets/{popover-DGUQnbhk.js → popover-BBhzRgR6.js} +1 -1
  215. package/dist/client/assets/{post-calendar-CqQDC3t2.js → post-calendar-XeIGYeqg.js} +1 -1
  216. package/dist/client/assets/{post-editor-D5cDZX8g.js → post-editor-Cuw86g74.js} +2 -2
  217. package/dist/client/assets/{preview-content-5E4VEVNy.js → preview-content-CdaarV-M.js} +1 -1
  218. package/dist/client/assets/{preview-dialog-CW0UxxZH.js → preview-dialog-eUjd7KAO.js} +1 -1
  219. package/dist/client/assets/{preview-panel-X9Db-uFN.js → preview-panel-DOASEmB8.js} +1 -1
  220. package/dist/client/assets/{preview-tab-D3OqBk4l.js → preview-tab-DHUmCnt8.js} +3 -3
  221. package/dist/client/assets/{product-picker-dialog-WEdrqBYL.js → product-picker-dialog-z_7jLJp3.js} +1 -1
  222. package/dist/client/assets/{profile-Dr7jNljC.js → profile-Q_Uil_2O.js} +1 -1
  223. package/dist/client/assets/{project-app-view-BlutJfNT.js → project-app-view-B_pnPMK9.js} +1 -1
  224. package/dist/client/assets/{project-apps-I71-E6Qd.js → project-apps-DOmYqPIW.js} +1 -1
  225. package/dist/client/assets/{project-icon-DwgAxTAv.js → project-icon-DdcX-1Cu.js} +1 -1
  226. package/dist/client/assets/{project-index-iv5dTkyZ.js → project-index-CvnWioTG.js} +1 -1
  227. package/dist/client/assets/project-reports-CjkBj3OZ.js +1 -0
  228. package/dist/client/assets/project-tasks-BR7DB76X.js +1 -0
  229. package/dist/client/assets/{projects-gSmj9ecH.js → projects-BnupWVNC.js} +1 -1
  230. package/dist/client/assets/{projects-empty-state-CupYJqrY.js → projects-empty-state-BBAZx24q.js} +1 -1
  231. package/dist/client/assets/{prompts-CBaHiUu4.js → prompts-CtCcnkuf.js} +1 -1
  232. package/dist/client/assets/{record-editor-Dhg3qN0D.js → record-editor-kAlyd6wn.js} +1 -1
  233. package/dist/client/assets/{redirect-editor-P9JRSoek.js → redirect-editor-G5HzKFY7.js} +1 -1
  234. package/dist/client/assets/reports-BZMzVdGj.js +1 -0
  235. package/dist/client/assets/{reports-DcvRbz_i.js → reports-CCeLAtH1.js} +1 -1
  236. package/dist/client/assets/{reports-onboarding-CNToIJAM.js → reports-onboarding-CihuSs_4.js} +1 -1
  237. package/dist/client/assets/{reports-tab-BZqA8TQ_.js → reports-tab-CxCo6ljz.js} +2 -2
  238. package/dist/client/assets/{repositories-Ccur-dYQ.js → repositories-Cr0Vmqsy.js} +1 -1
  239. package/dist/client/assets/repositories-xVxXVGUl.js +1 -0
  240. package/dist/client/assets/{repository-binding-BLl1r28B.js → repository-binding-BjyWZpYn.js} +1 -1
  241. package/dist/client/assets/{repository-picker-BOvn8tow.js → repository-picker-BQKFq3La.js} +1 -1
  242. package/dist/client/assets/{require-capability-CbgooziO.js → require-capability-Ca04y4iT.js} +1 -1
  243. package/dist/client/assets/{required-auth-layout-Du4rT7sh.js → required-auth-layout-rj346c5-.js} +1 -1
  244. package/dist/client/assets/{reset-password-BWHhQAiH.js → reset-password-CJ8Ib39J.js} +1 -1
  245. package/dist/client/assets/{resizable-vWMGfcV5.js → resizable-BWGQtKDK.js} +1 -1
  246. package/dist/client/assets/{resolve-tab-icon-CyktvCbJ.js → resolve-tab-icon--gm9VDQf.js} +1 -1
  247. package/dist/client/assets/{review-settings-BYvflnLC.js → review-settings-DKHV4WWw.js} +1 -1
  248. package/dist/client/assets/{role-color-DXKobZxk.js → role-color-h7pbmUj8.js} +1 -1
  249. package/dist/client/assets/{roles-DtM-OJk0.js → roles-33JtztJp.js} +1 -1
  250. package/dist/client/assets/{route-DYywXwGr.js → route-B2mhSQ66.js} +1 -1
  251. package/dist/client/assets/route-L9WJSo8Z.js +1 -0
  252. package/dist/client/assets/{route-C8tElGsM.js → route-esSEnbHB.js} +1 -1
  253. package/dist/client/assets/{sandbox-lifecycle-context-CVRjjAk0.js → sandbox-lifecycle-context-ciVvS_mf.js} +1 -1
  254. package/dist/client/assets/{save-status-DnvkIbvY.js → save-status-YxsSW2Rs.js} +1 -1
  255. package/dist/client/assets/{schema-CAleC_3r.js → schema-CWJkmqKK.js} +1 -1
  256. package/dist/client/assets/{schema-C2C3qx85.js → schema-MF7uKk3F.js} +1 -1
  257. package/dist/client/assets/{scroll-area-DMASCzA7.js → scroll-area-D0b5TYGa.js} +1 -1
  258. package/dist/client/assets/{search-input-BzsoblR3.js → search-input-CfjxHAmm.js} +1 -1
  259. package/dist/client/assets/{search-toggle-C8mpkT93.js → search-toggle-CvrrivM1.js} +1 -1
  260. package/dist/client/assets/{secret-picker-1TYTZlJ-.js → secret-picker-Bh-9Okys.js} +1 -1
  261. package/dist/client/assets/{secrets-D8N8c2eG.js → secrets-BpaSArcv.js} +1 -1
  262. package/dist/client/assets/{section-array-field-CBlVxN-e.js → section-array-field-YpT7n9vG.js} +1 -1
  263. package/dist/client/assets/{sections-D5nPXiNR.js → sections-BDOnV4mD.js} +1 -1
  264. package/dist/client/assets/{sections-editor-DDwn5ekg.js → sections-editor-e-APM9PR.js} +1 -1
  265. package/dist/client/assets/{select-DVeciAl9.js → select-DbxUTGle.js} +1 -1
  266. package/dist/client/assets/{select-model-BNTO0fSE.js → select-model-B_SYZDlx.js} +1 -1
  267. package/dist/client/assets/{seo-editor-BZPpMR_G.js → seo-editor-BAb4_SVN.js} +1 -1
  268. package/dist/client/assets/{separator-4lVFkBOm.js → separator-C0AfeS3O.js} +1 -1
  269. package/dist/client/assets/settings-tab-BdJ07iEH.js +1 -0
  270. package/dist/client/assets/{sheet-DgqpeU2r.js → sheet-BeOc3FAs.js} +1 -1
  271. package/dist/client/assets/{shell-layout-Dqg0y9U5.js → shell-layout-QlUCYlok.js} +1 -1
  272. package/dist/client/assets/{site-draft-actions-BU5wxMfk.js → site-draft-actions-BsBc3-Kf.js} +1 -1
  273. package/dist/client/assets/{site-draft-view-0GYco8RC.js → site-draft-view-B2Uxv1of.js} +1 -1
  274. package/dist/client/assets/site-editor-CkLwv4jN.js +1 -0
  275. package/dist/client/assets/{site-editor-toast-DHWingRQ.js → site-editor-toast-Bw0qMl-K.js} +1 -1
  276. package/dist/client/assets/{skills-QMeBFjVZ.js → skills-DK12dTU3.js} +1 -1
  277. package/dist/client/assets/{slider-DkvAjMqC.js → slider-DWOCTsGO.js} +1 -1
  278. package/dist/client/assets/{sortable.esm-D1XbpNQK.js → sortable.esm-Bcfqg7Xt.js} +1 -1
  279. package/dist/client/assets/{sso-CA2di6VE.js → sso-BK-CwpIa.js} +1 -1
  280. package/dist/client/assets/{suggestion-DKq9tnks.js → suggestion-DpDJqics.js} +1 -1
  281. package/dist/client/assets/{super-agent-icon-Des3Gzt2.js → super-agent-icon-DSWf_C0v.js} +1 -1
  282. package/dist/client/assets/{switch-D_fyZtAR.js → switch-CdoFqihq.js} +1 -1
  283. package/dist/client/assets/{synced-repos-q-9Pq41U.js → synced-repos-BBp6YhqW.js} +1 -1
  284. package/dist/client/assets/{tab-icon-glyph-CnCjm5vj.js → tab-icon-glyph-BA-Ya2gQ.js} +1 -1
  285. package/dist/client/assets/{table-B6gmAyVe.js → table-DBeLX30i.js} +1 -1
  286. package/dist/client/assets/{tabs-C3-glM5w.js → tabs-BwIUi1Ro.js} +1 -1
  287. package/dist/client/assets/{task-board-F0C1flaU.js → task-board-Dt94BxWj.js} +1 -1
  288. package/dist/client/assets/{task-route-CgJ6kEGQ.js → task-route-BLTj-Kt_.js} +1 -1
  289. package/dist/client/assets/{task-status-DtZHG42q.js → task-status-COZT_U35.js} +1 -1
  290. package/dist/client/assets/{taskboard-analytics-DhB06IEO.js → taskboard-analytics-DTwKCUBR.js} +1 -1
  291. package/dist/client/assets/{tasks-BjEh1sq-.js → tasks-BSIA3XNt.js} +1 -1
  292. package/dist/client/assets/tasks-CbzokKrd.js +1 -0
  293. package/dist/client/assets/{textarea-BcNUedZJ.js → textarea-0zeG6rdh.js} +1 -1
  294. package/dist/client/assets/{thread-analytics-CHIWrhgS.js → thread-analytics-e-DAlOc7.js} +1 -1
  295. package/dist/client/assets/{thread-intent-BBtcC3eO.js → thread-intent-k_EWWvIp.js} +1 -1
  296. package/dist/client/assets/{thread-route-B-8pwMl6.js → thread-route-T4ycKium.js} +1 -1
  297. package/dist/client/assets/{thread-route-BDEM9uAG.js → thread-route-bIv-22ov.js} +1 -1
  298. package/dist/client/assets/{thread-sheet-body-XQutdGAn.js → thread-sheet-body-D5ENmZN2.js} +1 -1
  299. package/dist/client/assets/{time-range-picker-DIndNk54.js → time-range-picker-l-A1yfsB.js} +1 -1
  300. package/dist/client/assets/{toggle-group-BJvueItv.js → toggle-group-BR3YjLpg.js} +1 -1
  301. package/dist/client/assets/{tool-namespace-8W3F8hsl.js → tool-namespace-nlvRAMHv.js} +1 -1
  302. package/dist/client/assets/{tool-set-selector-HD2rc5mb.js → tool-set-selector-iLTKI2dh.js} +1 -1
  303. package/dist/client/assets/{toolbar-icon-button-DqwBIL-q.js → toolbar-icon-button-C1sAn-5j.js} +1 -1
  304. package/dist/client/assets/{tooltip-CcU7DhuT.js → tooltip-7oUFzrc9.js} +1 -1
  305. package/dist/client/assets/{tooltipContext-qk98CIlc.js → tooltipContext-BnluVbPZ.js} +1 -1
  306. package/dist/client/assets/{track-DQBd80xZ.js → track-ClTfqB2h.js} +1 -1
  307. package/dist/client/assets/{types-CBXbXFqf.js → types-CT2b_f_n.js} +1 -1
  308. package/dist/client/assets/{url-slug-D48mGvuH.js → url-slug-DlwXWMoY.js} +1 -1
  309. package/dist/client/assets/{usage-stats-D6OFaO8E.js → usage-stats-DXQh2ym6.js} +1 -1
  310. package/dist/client/assets/{use-ai-providers-BJ7TKB-_.js → use-ai-providers-BV-M-wTR.js} +1 -1
  311. package/dist/client/assets/{use-apply-named-rule-BDDeFxUe.js → use-apply-named-rule-DVA8503u.js} +1 -1
  312. package/dist/client/assets/use-ask-in-chat-BNelLcsB.js +1 -0
  313. package/dist/client/assets/{use-automations-DGdQY13E.js → use-automations-CkOHisGI.js} +1 -1
  314. package/dist/client/assets/{use-autosave-yYU_ezVq.js → use-autosave-CMjKQ8gr.js} +1 -1
  315. package/dist/client/assets/use-blocks-v8-project-DwFetary.js +1 -0
  316. package/dist/client/assets/{use-chat-layout-state-7fLexK-W.js → use-chat-layout-state-DYxnWGXI.js} +1 -1
  317. package/dist/client/assets/{use-cms-publish-actions-Di7RH3ic.js → use-cms-publish-actions-BRuQD-xn.js} +1 -1
  318. package/dist/client/assets/{use-connect-companion-Ddgl8MAG.js → use-connect-companion-Bz03TbqD.js} +1 -1
  319. package/dist/client/assets/{use-connection-8PrHxvAI.js → use-connection-b1ZFdIKu.js} +1 -1
  320. package/dist/client/assets/{use-content-sync-8KVw9tn9.js → use-content-sync-J1DOMeIV.js} +1 -1
  321. package/dist/client/assets/{use-copy-F5Ataqy3.js → use-copy-MGOjhapZ.js} +1 -1
  322. package/dist/client/assets/{use-date-fns-locale-D8L_b1Z0.js → use-date-fns-locale-Db1-0fqy.js} +1 -1
  323. package/dist/client/assets/{use-debounced-autosave-D2pTqcG8.js → use-debounced-autosave-0ckPn95E.js} +1 -1
  324. package/dist/client/assets/{use-debounced-value-CbdraSYQ.js → use-debounced-value-L8Mvr3Qf.js} +1 -1
  325. package/dist/client/assets/{use-deco-credits-D5BjRSSa.js → use-deco-credits-CXHEdY4g.js} +1 -1
  326. package/dist/client/assets/{use-decopilot-events-CoAHF-ln.js → use-decopilot-events-CExfz_YN.js} +1 -1
  327. package/dist/client/assets/{use-delete-block-B_3TZ6oj.js → use-delete-block-C4Fd-0fO.js} +1 -1
  328. package/dist/client/assets/{use-delete-connection-BiAYYkr3.js → use-delete-connection-CiHyt6_e.js} +1 -1
  329. package/dist/client/assets/{use-deployment-admin-glI5z0S-.js → use-deployment-admin-D6ysmdql.js} +1 -1
  330. package/dist/client/assets/{use-entitlements-C7UoqTI0.js → use-entitlements-DKzKnO7t.js} +1 -1
  331. package/dist/client/assets/{use-fast-preview-draft-url-BK4D_Y49.js → use-fast-preview-draft-url-Rhzecu_l.js} +1 -1
  332. package/dist/client/assets/{use-file-configs-C0B0PjW_.js → use-file-configs-FzJwNbFB.js} +1 -1
  333. package/dist/client/assets/{use-id-selection-CTG-YWBc.js → use-id-selection-DV-7Zfn_.js} +1 -1
  334. package/dist/client/assets/{use-inbox-feed-Br6iChGF.js → use-inbox-feed-P-dmKrll.js} +1 -1
  335. package/dist/client/assets/{use-infinite-scroll-Ca25srcJ.js → use-infinite-scroll-D4cD1T3_.js} +1 -1
  336. package/dist/client/assets/{use-join-requests-Dfcdd55y.js → use-join-requests-BZyMQ0xJ.js} +1 -1
  337. package/dist/client/assets/{use-main-panel-tabs-HePCt0jA.js → use-main-panel-tabs-DTyQot8D.js} +1 -1
  338. package/dist/client/assets/use-mcp-auth-status-BzTNOh9a.js +1 -0
  339. package/dist/client/assets/{use-mcp-client-DFeSZL8q.js → use-mcp-client-CVGnTbnR.js} +1 -1
  340. package/dist/client/assets/{use-mcp-prompts-BTRRV8Ft.js → use-mcp-prompts-C72FS5ih.js} +1 -1
  341. package/dist/client/assets/{use-mcp-tools-TDs-I0b1.js → use-mcp-tools-DQ6qPp-q.js} +1 -1
  342. package/dist/client/assets/{use-mobile-BnBdDTHN.js → use-mobile-Box5tF93.js} +1 -1
  343. package/dist/client/assets/{use-move-blocks-CckOr-lB.js → use-move-blocks-D_Vs6N9H.js} +1 -1
  344. package/dist/client/assets/{use-navigate-to-agent-D12paxCm.js → use-navigate-to-agent-BFXAaVqR.js} +1 -1
  345. package/dist/client/assets/{use-never-published-DFEsFGpN.js → use-never-published-D5jr8ByQ.js} +1 -1
  346. package/dist/client/assets/{use-org-fs-BVX55_QU.js → use-org-fs-DhEmmAqR.js} +1 -1
  347. package/dist/client/assets/{use-org-repo-syncs-ZSOjbeOM.js → use-org-repo-syncs-D4_eFcdp.js} +1 -1
  348. package/dist/client/assets/{use-org-sso-BjEvyyup.js → use-org-sso-PK2UdKUD.js} +1 -1
  349. package/dist/client/assets/{use-organization-settings-Bp5pncRd.js → use-organization-settings-1gniuS7P.js} +1 -1
  350. package/dist/client/assets/{use-project-native-view-presence-BygogdOC.js → use-project-native-view-presence-CWUPdvlx.js} +1 -1
  351. package/dist/client/assets/{use-project-scope-DOHE3bKU.js → use-project-scope-RvpHL0s_.js} +1 -1
  352. package/dist/client/assets/{use-recent-apps-DP2oLcqz.js → use-recent-apps-B7zKTjxf.js} +1 -1
  353. package/dist/client/assets/{use-reports-diagnostic-DpDAVu1I.js → use-reports-diagnostic-Df9ZgP2V.js} +1 -1
  354. package/dist/client/assets/{use-sandbox-events-EhUTp4km.js → use-sandbox-events-BV2Y1Vu8.js} +1 -1
  355. package/dist/client/assets/{use-secrets-CxjuCsrh.js → use-secrets-DE7J5I_l.js} +1 -1
  356. package/dist/client/assets/{use-section-preview-base-cdgVeEAb.js → use-section-preview-base-BJE9UobB.js} +1 -1
  357. package/dist/client/assets/{use-sidebar-collapsed-BIEPyypZ.js → use-sidebar-collapsed-BFQg4qhu.js} +1 -1
  358. package/dist/client/assets/{use-tags-C3U-POZn.js → use-tags-CV-rF5OD.js} +1 -1
  359. package/dist/client/assets/{use-task-board-analytics-C3VZMz7B.js → use-task-board-analytics-BFgtA0eR.js} +1 -1
  360. package/dist/client/assets/{use-task-board-events-DbjmwIOB.js → use-task-board-events-DMey0obH.js} +1 -1
  361. package/dist/client/assets/{use-task-board-item-prs-EqF0sY_y.js → use-task-board-item-prs-B52UpU_u.js} +1 -1
  362. package/dist/client/assets/{use-task-board-items-qkbAWHCl.js → use-task-board-items-BxTPwb-L.js} +1 -1
  363. package/dist/client/assets/{use-task-board-prompts-Rl7l1WO8.js → use-task-board-prompts-BRQWf9Pf.js} +1 -1
  364. package/dist/client/assets/{use-task-metadata-Cd0VDdAR.js → use-task-metadata-CX5mjd3k.js} +1 -1
  365. package/dist/client/assets/{use-thread-outputs-BVOJLuSg.js → use-thread-outputs-NzO2uf9T.js} +1 -1
  366. package/dist/client/assets/{use-view-draft-kind-CLUDIePm.js → use-view-draft-kind-Czb3VJ2z.js} +1 -1
  367. package/dist/client/assets/{use-voice-input-Bl7eFiVx.js → use-voice-input-CJwxrnH4.js} +1 -1
  368. package/dist/client/assets/useInfiniteQuery-BVraOGoC.js +1 -0
  369. package/dist/client/assets/{useQueries-BoFvlKGQ.js → useQueries-BTKHF006.js} +1 -1
  370. package/dist/client/assets/useSuspenseInfiniteQuery-Ta5X_y4e.js +1 -0
  371. package/dist/client/assets/{users-CNjQRe0O.js → users-C1cmyiHr.js} +1 -1
  372. package/dist/client/assets/{utils-BQSMlXSP.js → utils-dLgjLO-5.js} +2 -2
  373. package/dist/client/assets/{variant-calendar-NNYJdzAI.js → variant-calendar-BFvdqyOs.js} +1 -1
  374. package/dist/client/assets/{variant-matcher-override-DT5fklqI.js → variant-matcher-override-uOKZ9bIk.js} +1 -1
  375. package/dist/client/assets/{view-header-tpv-7x2O.js → view-header-g_I-xUvY.js} +1 -1
  376. package/dist/client/assets/{virtual-mcp-MVkHUb3W.js → virtual-mcp-CIFm7Ktp.js} +1 -1
  377. package/dist/client/assets/{watch-sse-pool-Dj-biyb-.js → watch-sse-pool-Cs81gduQ.js} +1 -1
  378. package/dist/client/index.html +1 -1
  379. package/dist/server/server.js +1 -1
  380. package/package.json +1 -1
  381. package/dist/client/assets/agent-app-B-urmXmZ.js +0 -1
  382. package/dist/client/assets/agent-deck-BBmqDT35.js +0 -1
  383. package/dist/client/assets/agent-experiments-tJkf5zEV.js +0 -1
  384. package/dist/client/assets/agent-file-BO8UjxRg.js +0 -1
  385. package/dist/client/assets/agent-library-BKkTVzrq.js +0 -1
  386. package/dist/client/assets/agent-library-file-BrZYdHRW.js +0 -1
  387. package/dist/client/assets/agent-overview-B1REPbfy.js +0 -1
  388. package/dist/client/assets/agent-settings-DbGtVJ2w.js +0 -1
  389. package/dist/client/assets/agent-site-editor-code-BJ6yQoLJ.js +0 -2
  390. package/dist/client/assets/agent-site-editor-content-Cg8Mk6hH.js +0 -1
  391. package/dist/client/assets/agent-site-editor-preview-CqN3vC1Y.js +0 -1
  392. package/dist/client/assets/agent-view-DV1ov_VY.js +0 -1
  393. package/dist/client/assets/api-keys-DxmWJBFA.js +0 -1
  394. package/dist/client/assets/content-tab-DHk7zASR.js +0 -19
  395. package/dist/client/assets/item-actions-tUfJogkL.js +0 -1
  396. package/dist/client/assets/library-CEXxPUaa.js +0 -1
  397. package/dist/client/assets/project-reports-D_a4jtSV.js +0 -1
  398. package/dist/client/assets/project-tasks-BCzd3AL6.js +0 -1
  399. package/dist/client/assets/reports-DehFoQ2c.js +0 -1
  400. package/dist/client/assets/repositories-DPEF306T.js +0 -1
  401. package/dist/client/assets/route-ptA81iuF.js +0 -1
  402. package/dist/client/assets/settings-tab-DNW19Zfd.js +0 -1
  403. package/dist/client/assets/site-editor-Bb1utT9X.js +0 -1
  404. package/dist/client/assets/tasks-rVWKpPqZ.js +0 -1
  405. package/dist/client/assets/use-ask-in-chat-BqR7YrFk.js +0 -1
  406. package/dist/client/assets/use-blocks-v8-project-fuQSIOiU.js +0 -1
  407. package/dist/client/assets/use-mcp-auth-status-BZvjXleK.js +0 -1
  408. package/dist/client/assets/useInfiniteQuery-DAeB0Xdz.js +0 -1
  409. package/dist/client/assets/useSuspenseInfiniteQuery-D8216v2q.js +0 -1
@@ -0,0 +1 @@
1
+ import{c as u,r as g,j as n,J as G,a0 as F,a as E,l as O,b as P,n as y,L as H}from"./index-PfzOl7J6.js";import{C as M}from"./chat-context-DmIaWG0i.js";import{C as x}from"./index-BtBKqC_9.js";import{L}from"./index-yk7iwtzd.js";import{B as V}from"./blocks-preview-workspace-context-CZpRdqcZ.js";import{e as T,p as J,s as K,a as W,r as U,T as $,u as R,b as z}from"./site-editor-toast-Bw0qMl-K.js";import{u as q,L as B,P as Q,S as X}from"./preview-tab-DHUmCnt8.js";import{C as Y}from"./content-tab-BV39A4DC.js";import{T as Z}from"./tab-icon-glyph-BA-Ya2gQ.js";import{r as tt}from"./resolve-tab-icon--gm9VDQf.js";import ot from"./agent-site-editor-ClFcVY3S.js";import"./use-view-draft-kind-Czb3VJ2z.js";import"./thread-route-T4ycKium.js";import"./use-project-scope-RvpHL0s_.js";import"./repository-binding-BjyWZpYn.js";import"./use-mcp-client-CVGnTbnR.js";import"./auth-DET1t4rk.js";import"./use-organization-settings-1gniuS7P.js";import"./schema-MF7uKk3F.js";import"./task-board-Dt94BxWj.js";import"./thread-intent-k_EWWvIp.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-Cs81gduQ.js";import"./use-entitlements-DKzKnO7t.js";import"./use-ai-providers-BV-M-wTR.js";import"./use-decopilot-events-CExfz_YN.js";import"./use-mobile-Box5tF93.js";import"./use-sidebar-collapsed-BFQg4qhu.js";import"./use-chat-layout-state-DYxnWGXI.js";import"./agent-icon-DPgCnEV1.js";import"./AlertCircle-GXBIxFcm.js";import"./Tool01-DoE3EsIZ.js";import"./ArrowUp-DBkhb8Yz.js";import"./ArrowLeft-BbqwGy0e.js";import"./LinkBroken01-CzDrAWsX.js";import"./BookOpen01-1fjc61Mm.js";import"./Globe04-CYg8V2eL.js";import"./CheckCircle-B_eEhqJR.js";import"./ChevronUp-FDrusEQ7.js";import"./ChevronSelectorVertical-D-7E5GYT.js";import"./UserSquare-DHrzs2xN.js";import"./CreditCard01-KjySk-5G.js";import"./SwitchHorizontal01-BzX5npS9.js";import"./Key01-DY2gyLvd.js";import"./Minus-CMxaDSgl.js";import"./Monitor01-3IwLMf0Q.js";import"./Sun-BvPiksd_.js";import"./Play-BOARoASB.js";import"./Plus-D452i-ki.js";import"./SearchMd-D9VvymBK.js";import"./ShoppingBag01-DrNjYHL1.js";import"./Trash01-_1ewPMOO.js";import"./Upload01-D11ZXRKj.js";import"./Users01-DdipP4E2.js";import"./XClose-CR92HpkN.js";import"./Zap-D5X_AlHR.js";import"./tooltip-7oUFzrc9.js";import"./index-Chdoy1DO.js";import"./toolbar-icon-button-C1sAn-5j.js";import"./shell-layout-QlUCYlok.js";import"./use-deployment-admin-D6ysmdql.js";import"./admin-fetch-BhTJlAsX.js";import"./command-ARXYIBtk.js";import"./index-Cwblfb1K.js";import"./integration-icon-Cypf7ART.js";import"./project-icon-DdcX-1Cu.js";import"./use-navigate-to-agent-BFXAaVqR.js";import"./use-debounced-value-L8Mvr3Qf.js";import"./new-project-dialog-ddGWO7oU.js";import"./label-C3bFtEDk.js";import"./repository-picker-BQKFq3La.js";import"./github-icon-CsOyvsM3.js";import"./useInfiniteQuery-BVraOGoC.js";import"./infiniteQueryObserver-BSITs4kU.js";import"./collection-search-DXnQxUGL.js";import"./legacy-admin-welcome-dialog-BndvejSa.js";import"./drawer-BUu3Urhv.js";import"./required-auth-layout-rj346c5-.js";import"./use-org-sso-PK2UdKUD.js";import"./sheet-BeOc3FAs.js";import"./resizable-BWGQtKDK.js";import"./core.esm-Hiw5xlkT.js";import"./sortable.esm-Bcfqg7Xt.js";import"./context-menu-B-hlKiE1.js";import"./create-organization-dialog-EtzNyw9E.js";import"./form-DQshgY6C.js";import"./project-apps-DOmYqPIW.js";import"./use-recent-apps-B7zKTjxf.js";import"./feedback-BqoIMOg7.js";import"./textarea-0zeG6rdh.js";import"./sandbox-url-D3mC8qhT.js";import"./use-sandbox-events-BV2Y1Vu8.js";import"./use-blocks-v8-project-DwFetary.js";import"./use-voice-input-CJwxrnH4.js";import"./popover-BBhzRgR6.js";import"./index-D9OoYQHh.js";import"./checkbox-C6L9-jtU.js";import"./select-DbxUTGle.js";import"./index-BdQq_4o_.js";import"./ai-providers-logos-DD3qZ33J.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./utils-dLgjLO-5.js";import"./sandbox-git-api-DcqI6XE4.js";import"./save-status-YxsSW2Rs.js";import"./use-never-published-D5jr8ByQ.js";import"./hosted-reconcile-BVY_PuHB.js";import"./blocks-tab-states-B3rnTo7L.js";import"./empty-state-CQ-naxDO.js";import"./search-input-CfjxHAmm.js";import"./tabs-BwIUi1Ro.js";import"./active-indicator-CCMhAsc_.js";import"./use-file-configs-FzJwNbFB.js";import"./asset-utils-C4P9UMw5.js";import"./usage-stats-DXQh2ym6.js";import"./tool-namespace-nlvRAMHv.js";import"./utils-CVEq3hMx.js";import"./markdown-sfCsYKJ3.js";import"./use-copy-MGOjhapZ.js";import"./switch-CdoFqihq.js";import"./toggle-group-BR3YjLpg.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./sandbox-lifecycle-context-ciVvS_mf.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./frame-navigation-DCO55Sf7.js";import"./variant-matcher-override-uOKZ9bIk.js";import"./section-array-field-YpT7n9vG.js";import"./use-fast-preview-draft-url-Rhzecu_l.js";import"./parse-sections-Crm8e-1O.js";import"./held-block-view-CZDHkd7I.js";import"./calendar-HFJ5axO1.js";import"./editor-classes-BRb8pzNp.js";import"./empty-message-uyJw_GDm.js";import"./pair-4_jIXzEz.js";import"./collapsible-SBMmc8E3.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-D149puyc.js";import"./types-CT2b_f_n.js";import"./omit-server-managed-metadata-L5IhjRZB.js";import"./use-connection-b1ZFdIKu.js";import"./use-mcp-prompts-C72FS5ih.js";import"./use-thread-outputs-NzO2uf9T.js";import"./file-type-icon-5sEsvuio.js";import"./named-rule-step-osjl7ntJ.js";import"./slider-DWOCTsGO.js";import"./index-CoDU2Q4W.js";import"./tooltipContext-BnluVbPZ.js";import"./CategoricalChart-DFr--lUX.js";import"./index-DpynbW7T.js";import"./combobox-B8oSfLQg.js";import"./scroll-area-D0b5TYGa.js";import"./monaco-editor-CdzTj7u7.js";import"./editor-Dc6skLlO.js";import"./useQueries-BTKHF006.js";import"./device-hint-DcULIlAN.js";import"./alert-DXhGyLVy.js";import"./virtual-mcp-CIFm7Ktp.js";import"./url-slug-DlwXWMoY.js";import"./app-preview-url-9Od4s8Sz.js";import"./agent-capabilities-CtbwhlqH.js";import"./preview-source-BsRLGWUP.js";import"./use-task-metadata-CX5mjd3k.js";import"./delete-copy-Bt51Emir.js";import"./category-tree-BwBGBNEZ.js";import"./use-move-blocks-D_Vs6N9H.js";import"./index-BxZUC_i-.js";import"./view-header-g_I-xUvY.js";import"./use-cms-publish-actions-BRuQD-xn.js";import"./use-content-sync-J1DOMeIV.js";import"./use-delete-block-C4Fd-0fO.js";import"./item-actions-8EnEtcgh.js";import"./date-utils-CrvIKg-s.js";import"./badge-CPdAi539.js";import"./empty-state-yinauESn.js";import"./mustache-7iPTegv4.js";import"./collection-table-wrapper-BtWWhOUa.js";import"./table-DBeLX30i.js";import"./site-draft-actions-BsBc3-Kf.js";import"./separator-C0AfeS3O.js";import"./cms-store-drafts-CTNFCbln.js";import"./serial-task-queue-CGOeQgpr.js";import"./index-xX6vrZ6Z.js";import"./input-CHXvb5rt.js";import"./icon-button-DTP_l7w5.js";import"./chat-draft-D5guZJ-Z.js";import"./use-deco-credits-CXHEdY4g.js";import"./input-D81euCkI.js";import"./suggestion-DpDJqics.js";import"./use-org-fs-DhEmmAqR.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-CgY8XcJe.js";import"./plan-ladder-6lanq0kZ.js";import"./add-connection-dialog-DB2eDzSO.js";import"./extract-connection-data-UTX_3j8w.js";import"./metadata-D72DunRR.js";import"./connection-BTlRsp1B.js";import"./connection-card-DFMJTK3o.js";import"./connection-slug-COimMHkq.js";import"./schema-CWJkmqKK.js";import"./connection-form-helpers-B9Yi82ri.js";import"./authenticate-and-persist-oauth-BcQblp8z.js";import"./mcp-oauth-CSBTsyXo.js";import"./mcp-oauth-jwlMSPw2.js";import"./collection-tabs-BPEGrrum.js";import"./use-infinite-scroll-D4cD1T3_.js";import"./useSuspenseInfiniteQuery-Ta5X_y4e.js";import"./use-task-board-events-DMey0obH.js";import"./save-changes-debug-nBi-n9eV.js";import"./site-draft-view-B2Uxv1of.js";import"./blog-view-gate-CbpRy_w3.js";function I(o){return o.kind==="unavailable"&&o.source==="local"&&(o.problem?.reason??"not-answering")==="not-answering"}const et=o=>o;function it(o){const t=u.c(10),{candidates:e,invalidLink:c,shell:m,editor:i}=o,r=c===void 0?!1:c,s=m===void 0?et:m,[p,l]=g.useState(null);if(p){let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>l(null),t[0]=f):f=t[0];let h;return t[1]!==p||t[2]!==i?(h=i(p,f),t[1]=p,t[2]=i,t[3]=h):h=t[3],h}let a;t[4]!==e||t[5]!==r?(a=n.jsx(rt,{candidates:e,invalidLink:r,onConnect:l}),t[4]=e,t[5]=r,t[6]=a):a=t[6];let d;return t[7]!==s||t[8]!==a?(d=s(a),t[7]=s,t[8]=a,t[9]=d):d=t[9],d}function rt(o){const t=u.c(17),{candidates:e,invalidLink:c,onConnect:m}=o,i=c===void 0?!1:c,[r]=G(),{language:s}=r;let p;t[0]!==m?(p=N=>m({endpoint:N}),t[0]=m,t[1]=p):p=t[1];let l;t[2]!==e||t[3]!==p?(l={candidates:e,onFound:p},t[2]=e,t[3]=p,t[4]=l):l=t[4];const a=q(l),{state:d,access:f,needsGesture:h}=a;let k;t[5]!==e||t[6]!==s?(k=new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(e.map(T)),t[5]=e,t[6]=s,t[7]=k):k=t[7];const C=k;let S;t[8]!==f||t[9]!==a.start||t[10]!==h||t[11]!==d?(S=f==="denied"?{kind:"denied"}:h?{kind:"needs-gesture",onStart:a.start}:d.problem?{kind:"problem",problem:d.problem,host:T(d.problem.endpoint)}:{kind:"looking",paused:d.status==="paused"},t[8]=f,t[9]=a.start,t[10]=h,t[11]=d,t[12]=S):S=t[12];const _=S;let j;return t[13]!==C||t[14]!==i||t[15]!==_?(j=n.jsx(B,{wait:_,hosts:C,invalidLink:i}),t[13]=C,t[14]=i,t[15]=_,t[16]=j):j=t[16],j}const v="deco-serve",w="working-tree",nt={id:"",slug:"",name:"",logo:null},st={id:v,slug:v},mt={virtualMcpId:v,taskId:null,openTask:()=>{},createTask:()=>"",createTaskWithMessage:()=>{},activeTask:null,isThreadLocked:!1,lockedHarness:null,lockedBranch:null,currentBranch:w,setCurrentTaskBranch:()=>{}};function pt(){const o=window.location.hash,t=new URLSearchParams(o.replace(/^#/,"")).has("endpoint"),e=t?J(o):null;return t&&window.history.replaceState(null,"",window.location.pathname+window.location.search),e&&K(e),{candidates:W(e,U()),invalidLink:t&&!e}}const at=[{id:"site-editor",to:"/site-editor",label:"preview"},{id:"content",to:"/site-editor/content",label:"content"}];function ct(){const o=u.c(6),t=P();let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={select:lt},o[0]=e):e=o[0];const c=O(e);let m;o[1]!==t||o[2]!==c?(m=at.map(r=>n.jsx(y.Tab,{asChild:!0,active:c==="content"==(r.id==="content"),children:n.jsxs(H,{to:r.to,activeOptions:{exact:!0},children:[n.jsx("span",{"aria-hidden":"true",className:"flex size-4 shrink-0 items-center justify-center",children:n.jsx(Z,{icon:tt({tabId:r.id,kind:"system",connections:[]})})}),t(`common.mainPanelTabs.${r.label}`)]})},r.id)),o[1]=t,o[2]=c,o[3]=m):m=o[3];let i;return o[4]!==m?(i=n.jsx(y.Tabs,{children:m}),o[4]=m,o[5]=i):i=o[5],i}function lt(o){return o.matches.at(-1)?.staticData.siteEditorView}function A(o){const t=u.c(14),{children:e}=o,c=P(),{connection:m}=z(v),i=R(v,w);let r,s;if(t[0]!==i||t[1]!==e||t[2]!==m||t[3]!==c){s=Symbol.for("react.early_return_sentinel");t:{if(r=m?T(m.endpoint):"",i.kind==="protocol"){s=e;break t}if(i.kind!=="unavailable"||I(i)){s=n.jsx(X,{headingLevel:2,waiting:!0,title:c("decoServe.connect.reaching",{host:r})});break t}}t[0]=i,t[1]=e,t[2]=m,t[3]=c,t[4]=r,t[5]=s}else r=t[4],s=t[5];if(s!==Symbol.for("react.early_return_sentinel"))return s;let p;t[6]!==i.problem?(p=i.problem??{reason:"not-answering"},t[6]=i.problem,t[7]=p):p=t[7];let l;t[8]!==r||t[9]!==p?(l={kind:"problem",problem:p,host:r},t[8]=r,t[9]=p,t[10]=l):l=t[10];let a;return t[11]!==r||t[12]!==l?(a=n.jsx(B,{wait:l,hosts:r}),t[11]=r,t[12]=l,t[13]=a):a=t[13],a}function dt(o){const t=u.c(6),{onLost:e}=o,c=R(v,w);let m;t[0]!==c?(m=I(c),t[0]=c,t[1]=m):m=t[1];const i=m;let r,s;return t[2]!==i||t[3]!==e?(r=()=>{i&&e()},s=[i,e],t[2]=i,t[3]=e,t[4]=r,t[5]=s):(r=t[4],s=t[5]),g.useEffect(r,s),null}const D={threadOpen:!1,contentOpen:!0,threadVisibilityExplicit:!1,toggleThread:()=>{},toggleContent:()=>{}};function ut(){const o=u.c(11),{data:t}=E.useSession();let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={select:ft},o[0]=e):e=o[0];const c=O(e),m=!!t?.user;let i;o[1]!==m?(i={rail:m},o[1]=m,o[2]=i):i=o[2];const r=c??"preview";let s,p,l;o[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(ct,{}),p=n.jsx(x.Thread,{children:null}),l=n.jsx(ot,{}),o[3]=s,o[4]=p,o[5]=l):(s=o[3],p=o[4],l=o[5]);let a;o[6]!==r?(a=n.jsx(L.Content,{children:n.jsxs(x,{...D,threadless:!0,contentKey:r,contentNavigation:s,children:[p,l]})}),o[6]=r,o[7]=a):a=o[7];let d;return o[8]!==i||o[9]!==a?(d=n.jsx(L,{outsideOrg:i,children:a}),o[8]=i,o[9]=a,o[10]=d):d=o[10],d}function ft(o){return o.matches.at(-1)?.staticData.siteEditorView}function ht(o){const t=u.c(8),{children:e}=o,{data:c}=E.useSession(),m=!!c?.user;let i;t[0]!==m?(i={rail:m},t[0]=m,t[1]=i):i=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(x.Thread,{children:null}),t[2]=r):r=t[2];let s;t[3]!==e?(s=n.jsx(L.Content,{children:n.jsxs(x,{...D,threadless:!0,contentKey:"guide",children:[r,n.jsx(x.Content,{children:e})]})}),t[3]=e,t[4]=s):s=t[4];let p;return t[5]!==i||t[6]!==s?(p=n.jsx(L,{outsideOrg:i,children:s}),t[5]=i,t[6]=s,t[7]=p):p=t[7],p}const b=()=>{},vt={connection:null,set:b,clear:b};function fr(){const o=u.c(3),[t]=g.useState(pt);let e;return o[0]!==t.candidates||o[1]!==t.invalidLink?(e=n.jsx(F,{org:nt,project:st,children:n.jsx(it,{candidates:t.candidates,invalidLink:t.invalidLink,shell:kt,editor:xt})}),o[0]=t.candidates,o[1]=t.invalidLink,o[2]=e):e=o[2],e}function xt(o,t){return n.jsxs($.Provider,{value:{connection:o,set:b,clear:b},children:[n.jsx(dt,{onLost:t}),n.jsx(M,{value:mt,children:n.jsx(V,{children:n.jsx(ut,{})})})]})}function kt(o){return n.jsx($.Provider,{value:vt,children:n.jsx(ht,{children:o})})}function hr(){const o=u.c(1);let t;return o[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(A,{children:n.jsx(Q,{virtualMcpId:v})}),o[0]=t):t=o[0],t}function vr(){const o=u.c(1);let t;return o[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(A,{children:n.jsx(Y,{virtualMcpId:v})}),o[0]=t):t=o[0],t}export{vr as SiteEditorContent,hr as SiteEditorPreview,fr as default};
@@ -1 +1 @@
1
- import{c as N,q as G,i as C,K as g,er as Qe,cs as Bn,aF as Lt,aG as K,bl as Ce,bt as Fn,dA as Ie,dy as Vn,es as ye,et as Hn,eu as Jn,r as L,ev as Wn,ew as Y,ex as Z,bz as Gn,a as Yn,at as Te,a4 as zn,bv as Ut,ey as Xn,ez as Qt,ar as Zn,bp as B,ea as Ct,eA as qn,eB as Kn,eC as eo,t as ne,j as X}from"./index-DkcRNYY4.js";import{u as Be}from"./repository-binding-BLl1r28B.js";import{e as Bt}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as to}from"./chat-context-2_7VL2Se.js";import{i as no,u as oo}from"./use-sandbox-events-EhUTp4km.js";import{u as Fe}from"./use-blocks-v8-project-fuQSIOiU.js";import{u as Ft}from"./use-voice-input-Bl7eFiVx.js";import{s as ft}from"./thread-intent-BBtcC3eO.js";import{s as so}from"./utils-BQSMlXSP.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 y 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 y(t.code,t.message,t.data)}}const te="deco-content",Re={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 xe={major:Re.major,minor:Vt},Ht=`the endpoint speaks an older ${te} than this client needs (${xe.major}.${xe.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:{...xe}};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 y(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!==Re.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Re.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"):y.from(t)}function Ve(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 y(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?y.from(l):new y(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 y(w.InternalError,"no response for this call")}})}}}function He(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ht=20,gt=5,vt=500;function Je(e){return e instanceof y?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(He(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 y(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 y&&e.code===w.Conflict}function We(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=G();let a;o[2]!==e?(a=We(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):Qe,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=We(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):Qe,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=We(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}:Qe,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:Bn},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 Br(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function Fr(){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 Ge extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function po(e){if(e instanceof Ge)return{reason:"not-deco-serve"};if(!(e instanceof y))return{reason:"not-answering"};switch(e.code){case w.Unauthorized:case w.MethodNotFound:return{reason:"outdated"};case w.Unsupported:return Je(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 mo=Lt({blocks:Ie(K(),Ie(K(),Vn()).refine(Ce)),versions:Ie(K(),K().min(1)),missing:Fn(K())});function wo(e,t){const n=mo.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&&Ce(e.blocks[t])&&e.versions[t]===n.version}function yo(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 So(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,pt=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:ye(),body:JSON.stringify(o.map((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new y(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:y.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new y(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 Ye(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Pe(e,t){if(Array.isArray(e)){for(const n of e)Pe(n,t);return}if(Ye(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):Pe(o,t)}function Zt(e,t){if(!Ye(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;Pe(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){Y(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===Z){delete r[c],i[c]={operation:"delete",version:Z,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 mt=new WeakMap;async function ze(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new y(w.Unavailable,"The CMS index is not loaded yet");let i=mt.get(e);i||(i=new Map,mt.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)||Ce(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 y(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 Ye(i)&&!Gn(i)?i:void 0}await ze(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+=pt){const a=r.slice(i,i+pt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new y(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=yo(s,f,d);if(Y(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 y(w.Unavailable,"The CMS index changed while loading blocks; try again")}}}function Xe(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 yt=3e4;function xo(e){if(!(e instanceof y))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=G(),i=Xe(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 m of n)for(const E of Eo(i,m))f.add(E);const h=[...f].filter(m=>!!i?.entries[m]).sort(),v={index:i,blocks:c??{},versions:u??{}},b=h.some(m=>!oe(v,m)),p=JSON.stringify(h.map(m=>[m,i?.entries[m]?.version,oe(v,m)])),[R,k]=L.useState(null),[$,I]=L.useState(0),_=R?.key===p?R:null;L.useEffect(()=>{if(!e||!p)return;let m=!0;const E=JSON.parse(p).map($o);return ze(r,e,t,E).then(()=>{m&&k(j=>j?.key===p?null:j)},j=>{m&&k(U=>({key:p,count:(U?.key===p?U.count:0)+1,retryAfterMs:xo(j)}))}),()=>{m=!1}},[e,r,t,p,$]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const m=Math.min(yt,_.retryAfterMs??Bt(yt,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(jo),m);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let S;s[7]!==_?(S=[_],s[7]=_,s[8]=S):S=s[8],L.useEffect(T,S);const O=!e||So(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?Te.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?Te.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 p;t[12]!==f||t[13]!==l||t[14]!==i?(p=$=>{i&&(l($),f($.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=p):p=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]!==p||t[22]!==R?(k={connection:v,lastEndpoint:b,set:p,clear:R},t[19]=v,t[20]=b,t[21]=p,t[22]=R,t[23]=k):k=t[23],k}function St(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=G(),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?St(e):null,a=()=>e?St(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 Ze(e){if(!e.ok)return e.error.code===w.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Bo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Fo=(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:Bo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Fo)})).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 qe="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=Ve({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:ye(o.signal)}));if(await Vo(s))throw new It;return s}});try{return await et(n)}catch(o){if(o instanceof It)return qe;throw o}}async function Jo(e,t,n){await t();const o=await Ho(e,n);return o===qe?o:{...o,hosted:ko(e,n)}}const Ke=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 et(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 Ge;const s=Jt(t.result);if(!n)throw new Error("no schema.get");if(Ze(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 et(Ve({endpoint:e,fetch:n=>t(new Request(n,{signal:ye(n.signal)}))}))}function re(e,t){const n=N.c(40),{org:o}=zn(),{connection:s}=Ao(e),{runtime:r}=Ft(e),i=L.useContext(Kt),a=Fe(e),c=Ut(Be(e)?.metadata),l=tn({hasServeConnection:!!s,runtime:r}),u=en(l,s?.endpoint??""),d=to()?.taskId??null,f=no(oo().lifecycle.phase),h=G(),v=Uo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,p=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 S;n[11]!==I||n[12]!==_||n[13]!==T?(S={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]=S):S=n[14];const O=C(S);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 m;n[23]!==O.data||n[24]!==x||n[25]!==h?(m=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]=m):m=n[26];const E=!!O.data&&!i;let j;n[27]!==A||n[28]!==m||n[29]!==E?(j={queryKey:A,queryFn:m,enabled:E,refetchInterval:Ke,retry:!1},n[27]=A,n[28]=m,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:p.data===qe?"not-owned":p.data?"ready":Ot(p)?"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{...Ne(u,p.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Ne(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,H=s?.endpoint??"";let J;return n[33]!==M||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==H||n[38]!==P?(J=es({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:M,endpoint:H}),n[33]=M,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=H,n[38]=P,n[39]=J):J=n[39],J}function zo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Ke:!1}function Xo(e){return vo(e+1)}function Zo(e,t){return!(t instanceof y)&&!(t instanceof Ge)}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?Ne(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:po(e.failure)}:n??{kind:"pending",...t}}const _t={retry:2,refetchInterval:e=>e.state.status==="error"?Ke:!1};function Ne(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 et(Ve({endpoint:e,fetch:n=>fetch(n,{signal:ye(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function je(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 je({...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=G(),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 p=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...p==="local"?["local"]:[e.branch,p])})},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=Te.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=Bt(5e3,1e3,e,2,0);return t instanceof rn&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function tt(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 ke(e,t,n){return["decofile-write",e,t,n]}function us(e,t,n){return{id:ke(e,t,n).join(":")}}class nt 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 ot(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function st(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function fs(e,t){return tt(e,t)}function ds(e,t,n){e.setQueryData(g.decofileDraft(ot(t)),n)}function hs(e,t){return e.getQueryData(g.decofileDraft(ot(t)))??null}async function gs(e,t){return(await fetch(st(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?ot(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(st(t),{cache:"no-store"});if(!n.ok)return tt(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(st(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 nt(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,ps=15e3,ms=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<ms?an:ps}function ys(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 Ss(e,t,n=cn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>ys(()=>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 tt(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Rs(e){return Be(e)?.metadata?.runtime?.path??null}function $e(e,t,n,o){const s=B(e),r=Object.keys(n?.changes??{}).find(a=>B(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>B(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>B(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 y&&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 rt extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class it extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ri(e,t){return(t instanceof rt||t instanceof it)&&(t.message=hn(e,t,"github")),t}function hn(e,t,n){if(t instanceof rt)return e("siteEditor.save.draftUnread");if(t instanceof it)return e("siteEditor.save.keptChanging");if(t instanceof nt)return t.message;if(n==="local")return Ps(e,t);if(t instanceof y)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 nt||e instanceof rt||e instanceof it)return null;if(e instanceof y){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 y)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",Ae=new Set;let z;function gn(){if(z!==void 0)return z;z=null;try{typeof BroadcastChannel=="function"&&(z=new BroadcastChannel($s),z.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Ae])n(t)}))}catch{z=null}return z}function As(e){try{gn()?.postMessage({cacheKey:e})}catch{}}function Ms(e){return gn(),Ae.add(e),()=>{Ae.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 pn(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",pn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Bs="__draft";function li(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Fs="off";function Vs(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Bs,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",pn(JSON.stringify({sections:i}))),r.toString()}function di(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function mn(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?[]:[mn(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[mn(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 at(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 at(`${s}${o.pathname}@local`,t)}catch{return null}}function pi(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",at(o,t)),n.toString())}catch{return e}}function Js(e){const{pointer:t}=e;if(!t||t===Fs)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(at(t,e.forcedVariants),e.previewOptions)}function Ws(e,t){if(!e||!t)return null;try{return Vs(e,t)}catch{return null}}function mi(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,Me=new Map;function wn(e){for(const t of Me.get(e)??[])t()}function yn(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 Sn(e,t){let n=Me.get(e);return n||(n=new Set,Me.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=>Sn(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?Sn(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 yi(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,pe=new Map;function W(e,t){return`${e}/${t}`}function V(e){let t=pe.get(e);return t||(t={state:kn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},pe.set(e,t)),t}function F(e,t){const n=V(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Oe(e){e.timer&&clearTimeout(e.timer),e.timer=null}function me(e){return pe.get(e)?.state??kn}function nr(e,t){const n=V(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Si(e){const t=V(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Oe(t),F(e,{phase:"idle"}))}}function ki(e){const t=pe.get(e);!t||t.state.phase!=="reloading"||(Oe(t),F(e,{phase:"idle"}))}function On(e){const t=V(e);Oe(t),F(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=V(e),o=Math.max(0,n.state.inFlight-1);if(o>0){F(e,{inFlight:o});return}if(!t.ok||n.previews===0){F(e,{phase:"idle",inFlight:o});return}En(e,t.navigates,o)}function En(e,t,n=0){const o=V(e);Oe(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&F(e,{phase:"idle"})},tr),F(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"){const v=a&&t.reread?n.invalidateQueries({queryKey:g.decofile(a)}):null;if(await Promise.all([c,v]),v&&t.kind!=="edit"){const b=W(o,s);F(b,{epoch:me(b).epoch+1})}return{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=W(o,s);F(v,{epoch:me(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(W(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=W(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),yn(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=W(o,s),a=new Set(t.blockKeys);for(const u of[...V(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:ke(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=W(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=V(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=W(e.orgSlug,e.virtualMcpId);me(t).inFlight>0||(yn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=V(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=W(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=()=>me(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=B(t),o=Object.keys(e.changes).find(s=>B(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,Ee(e,t),n)}function Rn(e,t,n){const o=Tn(e,n);return o?.kind==="delete"?o.version??Z:o?o.version:t.has(B(n))?Z: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:Ee(e,t).has(B(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=Ee(e,t);return{blocks:n,versionOf:r=>Rn(o,s,r)}}function Ee(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function we(e,t,n,o){const s=B(n),r=Ee(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),Y(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===Z?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>$e(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[B(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const p=$e(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:p}:p!==null?h[v]={kind:"delete",version:null,baseVersion:p}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?we(e,n,f,!1):!u.has(B(f))&&l.has(f)&&we(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 De(e,t,n){Y(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:ke(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Co(o.state.variables)))}function Le(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 y);throw t.source==="local"&&r?(Le(e,n),new fn(s)):(t.source==="local"&&Je(s)&&Le(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=G(),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){Y(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,p=g.contentChanges(o),R=e.getQueryData(p);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:He(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(p,E)}else I&&t.source==="local"&&Je(I.error)&&Le(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const S=k.result,O=Ze($),D=$.ok&&!O?$.result:null;if(S.notModified&&(!l||!u)||D?.notModified&&!f)return lt(e,t,n,o,!1);const x=S.notModified?new Set:Pn(e,n),A=S.notModified?l:Qo(S.blocks,l,x),m=O?on():D?D.notModified?f:D.schema:$.error;if(e.setQueryData(a,{revision:T?_:S.notModified?h?.revision:S.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,A),!S.notModified){const E=e.getQueryData(c),j={...S.versions};for(const U of x){const M=E?.[U];M!==void 0?j[U]=M:delete j[U]}e.setQueryData(c,j)}return m instanceof y||e.setQueryData(i,m),!T&&!S.notModified&&l&&h?.revision&&S.revision!==h.revision&&In({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:m}}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,p]=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:He(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,$=k!==void 0&&k!==r.seen?.revision;if(p?.ok&&!$){const P=de(r.seenChanges,p.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,_=Ze(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return lt(e,t,o,s,!1);const S=_?on():T?T.notModified?r.currentMeta:T.schema:b.error;S instanceof y||e.setQueryData(u,S);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:S};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 m=Pn(e,o),E=e.getQueryData(l)??{},j={},U={},M=[];for(const[P,H]of Object.entries(D)){const J=x.entries[P];!J&&!m.has(P)||(j[P]=H,E[P]!==void 0&&(U[P]=E[P]),J&&!m.has(P)&&E[P]!==J.version&&M.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),M.length>0&&await ze(e,n,s,M,m),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:S}}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 _e(e){if(!(e instanceof y)||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 y)||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)?Z: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){Y(e),xn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),De(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===Z?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"?_e(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=_e(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const p=await vr(v,f);if(!p)throw v;ie(e,n,o,f,p);try{h=await i(f,{...r,...p})}catch(R){const k=_e(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}Y(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 De(e,o,l),{revision:c,versions:l}}})}function $n(e,t){if(!(e instanceof y))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 y))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&we(e,t,s,!1)}function Mn(e,t,n,o){Y(e),Kn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=$e(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=B(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(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})}we(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}),De(e,t,{[n]:s?null:o.version}),Io(e,t,n,o)}function xi(e,t,n,o){if(t.source!=="github"||!(o instanceof y))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}),De(e,o,{[s]:a.version}),!1}function pr(e){const t=N.c(17),n=Be(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),p=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&p>0?b.pointer.slice(0,p):null,version:b.pointer&&p>0?b.pointer.slice(p+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 pr(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:mr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function mr(){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?je({...e,protocolSuffix:s.cacheKeySuffix}):je({...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=Ft(e?.virtualMcpId).runtime==="cms",d=G();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:ke(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 p;n[13]!==v||n[14]!==b?(p={skip:v,read:b},n[13]=v,n[14]=b,n[15]=p):p=n[15],Ss(!!t?.pollWhile&&!!e,p);const R=Xe(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(yr),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 H=Rt(await M.text());if(H)return H}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 S;n[27]!==u||n[28]!==s||n[29]!==i?(S=(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]=S):S=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==$||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==S?(O={queryKey:h,queryFn:k,enabled:$,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:S,retryDelay:cs},n[31]=h,n[32]=k,n[33]=$,n[34]=I,n[35]=_,n[36]=T,n[37]=S,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 m;return n[42]!==A||n[43]!==i?.hosted||n[44]!==D?(m=i?.hosted&&A?{...D,data:A}:D,n[42]=A,n[43]=i?.hosted,n[44]=D,n[45]=m):m=n[45],m}function wr(){return null}function yr(){return null}function Ai(e,t,n){return rs(e,t,n)}function Mi(e){const t=N.c(4),n=G(),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=Xe(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(Sr),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function Sr(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",Ue="site-editor-publish";function Or(e){const t=N.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=X.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=X.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=X.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?X.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 Bi(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Qn,id:Ue,description:void 0})}function Fi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Un(e,o??null);ne[i](t,{id:Ue,description:n&&a?X.jsxs(X.Fragment,{children:[X.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:Ue,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{fs as $,Ws as A,Us as B,Ts as C,tn as D,di as E,Gr as F,pr as G,W as H,qs as I,wi as J,bi as K,ve as L,Fs as M,Vs as N,ii as O,pi as P,ci as Q,ki as R,Si as S,Kt as T,rr as U,ji as V,ui as W,us as X,ke as Y,sr as Z,_s as _,Hr as a,fi as a$,Mo as a0,ns as a1,Lr as a2,Qr as a3,Zr as a4,Et as a5,Dt as a6,qr as a7,Wr as a8,zr as a9,nt as aA,si as aB,fr as aC,rt as aD,Ri as aE,Pi as aF,Qi as aG,Ii as aH,ds as aI,ei as aJ,Ei as aK,Ti as aL,it as aM,Kr as aN,Ni as aO,li as aP,xi as aQ,ee as aR,ai as aS,Fi as aT,Ui as aU,Ln as aV,y as aW,w as aX,ze as aY,Pn as aZ,Oo as a_,bo as aa,Un as ab,Vi as ac,Cs as ad,Ur as ae,_n as af,ao as ag,Or as ah,yi as ai,mi as aj,rs as ak,Es as al,Nn as am,ar as an,cs as ao,oi as ap,Ue as aq,Qn as ar,Bi as as,Oi as at,Ar as au,Mr as av,Je as aw,Ci as ax,_i as ay,ri as az,Ao as b,ni as b0,hi as b1,gi as b2,vi as b3,sn as c,Mi as d,Vr as e,Li as f,Di as g,Yr as h,Jr as i,$i as j,Ai as k,vo as l,po as m,Gt as n,ts as o,Cr as p,ti as q,Fr as r,Br as s,ks as t,re as u,ut as v,Xr as w,Rs as x,ls as y,Js as z};
1
+ import{c as N,q as G,i as C,K as g,er as Qe,cs as Bn,aF as Lt,aG as K,bl as Ce,bt as Fn,dA as Ie,dy as Vn,es as ye,et as Hn,eu as Jn,r as L,ev as Wn,ew as Y,ex as Z,bz as Gn,a as Yn,at as Te,a4 as zn,bv as Ut,ey as Xn,ez as Qt,ar as Zn,bp as B,ea as Ct,eA as qn,eB as Kn,eC as eo,t as ne,j as X}from"./index-PfzOl7J6.js";import{u as Be}from"./repository-binding-BjyWZpYn.js";import{e as Bt}from"./backoff-CrEUbyZT.js";import{b as Se}from"./sandbox-url-D3mC8qhT.js";import{u as to}from"./chat-context-DmIaWG0i.js";import{i as no,u as oo}from"./use-sandbox-events-BV2Y1Vu8.js";import{u as Fe}from"./use-blocks-v8-project-DwFetary.js";import{u as Ft}from"./use-voice-input-CJwxrnH4.js";import{s as ft}from"./thread-intent-k_EWWvIp.js";import{s as so}from"./utils-dLgjLO-5.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 y 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 y(t.code,t.message,t.data)}}const te="deco-content",Re={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 xe={major:Re.major,minor:Vt},Ht=`the endpoint speaks an older ${te} than this client needs (${xe.major}.${xe.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:{...xe}};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 y(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!==Re.major)throw ae(`the endpoint speaks ${te} ${String(o?.major)}.x; this client speaks ${Re.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"):y.from(t)}function Ve(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 y(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?y.from(l):new y(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 y(w.InternalError,"no response for this call")}})}}}function He(e){return e&&!e.edited?{ifNoneMatch:e.revision}:{}}const ht=20,gt=5,vt=500;function Je(e){return e instanceof y?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(He(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 y(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 y&&e.code===w.Conflict}function We(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=G();let a;o[2]!==e?(a=We(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):Qe,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=We(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):Qe,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=We(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}:Qe,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:Bn},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 Br(e){try{localStorage.setItem(Xt,JSON.stringify(e))}catch{}}function Fr(){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 Ge extends Error{constructor(t="the endpoint isn't deco serve"){super(t),this.name="NotDecoServeError"}}function po(e){if(e instanceof Ge)return{reason:"not-deco-serve"};if(!(e instanceof y))return{reason:"not-answering"};switch(e.code){case w.Unauthorized:case w.MethodNotFound:return{reason:"outdated"};case w.Unsupported:return Je(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 mo=Lt({blocks:Ie(K(),Ie(K(),Vn()).refine(Ce)),versions:Ie(K(),K().min(1)),missing:Fn(K())});function wo(e,t){const n=mo.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&&Ce(e.blocks[t])&&e.versions[t]===n.version}function yo(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 So(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,pt=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:ye(),body:JSON.stringify(o.map((c,l)=>({jsonrpc:"2.0",id:s[l],method:c.method,params:c.params??{}})))}));if(!r.ok)throw new y(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:y.from(l.error)}:{ok:!0,result:l.result}:{ok:!1,error:new y(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 Ye(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Pe(e,t){if(Array.isArray(e)){for(const n of e)Pe(n,t);return}if(Ye(e))for(const[n,o]of Object.entries(e))n==="__resolveType"&&typeof o=="string"?t.add(o):Pe(o,t)}function Zt(e,t){if(!Ye(e))return;const n={};typeof e.__resolveType=="string"&&(n.type=e.__resolveType),typeof e.path=="string"&&(n.path=e.path);const o=new Set;Pe(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){Y(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===Z){delete r[c],i[c]={operation:"delete",version:Z,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 mt=new WeakMap;async function ze(e,t,n,o,s=new Set){const r=e.getQueryData(g.contentIndex(n));if(!r)throw new y(w.Unavailable,"The CMS index is not loaded yet");let i=mt.get(e);i||(i=new Map,mt.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)||Ce(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 y(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 Ye(i)&&!Gn(i)?i:void 0}await ze(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+=pt){const a=r.slice(i,i+pt),c=await t.batch(a.map(l=>({method:"cms.blocks",params:{names:l}})));if(c.length!==a.length)throw new y(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=yo(s,f,d);if(Y(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 y(w.Unavailable,"The CMS index changed while loading blocks; try again")}}}function Xe(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 yt=3e4;function xo(e){if(!(e instanceof y))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=G(),i=Xe(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 m of n)for(const E of Eo(i,m))f.add(E);const h=[...f].filter(m=>!!i?.entries[m]).sort(),v={index:i,blocks:c??{},versions:u??{}},b=h.some(m=>!oe(v,m)),p=JSON.stringify(h.map(m=>[m,i?.entries[m]?.version,oe(v,m)])),[R,k]=L.useState(null),[$,I]=L.useState(0),_=R?.key===p?R:null;L.useEffect(()=>{if(!e||!p)return;let m=!0;const E=JSON.parse(p).map($o);return ze(r,e,t,E).then(()=>{m&&k(j=>j?.key===p?null:j)},j=>{m&&k(U=>({key:p,count:(U?.key===p?U.count:0)+1,retryAfterMs:xo(j)}))}),()=>{m=!1}},[e,r,t,p,$]);let T;s[4]!==_||s[5]!==I?(T=()=>{if(!_)return;const m=Math.min(yt,_.retryAfterMs??Bt(yt,1e3,_.count-1,2,.5)),E=setTimeout(()=>I(jo),m);return()=>clearTimeout(E)},s[4]=_,s[5]=I,s[6]=T):T=s[6];let S;s[7]!==_?(S=[_],s[7]=_,s[8]=S):S=s[8],L.useEffect(T,S);const O=!e||So(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?Te.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?Te.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 p;t[12]!==f||t[13]!==l||t[14]!==i?(p=$=>{i&&(l($),f($.endpoint))},t[12]=f,t[13]=l,t[14]=i,t[15]=p):p=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]!==p||t[22]!==R?(k={connection:v,lastEndpoint:b,set:p,clear:R},t[19]=v,t[20]=b,t[21]=p,t[22]=R,t[23]=k):k=t[23],k}function St(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=G(),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?St(e):null,a=()=>e?St(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 Ze(e){if(!e.ok)return e.error.code===w.NotFound;const t=e.result;return t.notModified===!1&&t.schema===null}function Bo(e,t){return(typeof t.name=="string"?t.name.trim():"")||e}const Fo=(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:Bo(n,s)}),t.set(r,i)}return[...t.entries()].map(([n,o])=>({resolveType:n,blocks:o.sort(Fo)})).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 qe="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=Ve({endpoint:e,fetch:async o=>{const s=await t(new Request(o,{signal:ye(o.signal)}));if(await Vo(s))throw new It;return s}});try{return await et(n)}catch(o){if(o instanceof It)return qe;throw o}}async function Jo(e,t,n){await t();const o=await Ho(e,n);return o===qe?o:{...o,hosted:ko(e,n)}}const Ke=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 et(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 Ge;const s=Jt(t.result);if(!n)throw new Error("no schema.get");if(Ze(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 et(Ve({endpoint:e,fetch:n=>t(new Request(n,{signal:ye(n.signal)}))}))}function re(e,t){const n=N.c(40),{org:o}=zn(),{connection:s}=Ao(e),{runtime:r}=Ft(e),i=L.useContext(Kt),a=Fe(e),c=Ut(Be(e)?.metadata),l=tn({hasServeConnection:!!s,runtime:r}),u=en(l,s?.endpoint??""),d=to()?.taskId??null,f=no(oo().lifecycle.phase),h=G(),v=Uo({mode:l,v8:a,workingTreeReady:f}),b=v.github&&!!o.slug&&!!e&&!!t,p=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 S;n[11]!==I||n[12]!==_||n[13]!==T?(S={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]=S):S=n[14];const O=C(S);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 m;n[23]!==O.data||n[24]!==x||n[25]!==h?(m=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]=m):m=n[26];const E=!!O.data&&!i;let j;n[27]!==A||n[28]!==m||n[29]!==E?(j={queryKey:A,queryFn:m,enabled:E,refetchInterval:Ke,retry:!1},n[27]=A,n[28]=m,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:p.data===qe?"not-owned":p.data?"ready":Ot(p)?"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{...Ne(u,p.data),site:c};if(Q==="site-not-owned-github")return{kind:"unavailable",...u,siteNotOwned:!0};if(Q==="protocol-sandbox")return Ne(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,H=s?.endpoint??"";let J;return n[33]!==M||n[34]!==O.data||n[35]!==O.failureCount||n[36]!==O.isError||n[37]!==H||n[38]!==P?(J=es({probed:O.data,isError:O.isError,failureCount:O.failureCount,failure:P,describe:M,endpoint:H}),n[33]=M,n[34]=O.data,n[35]=O.failureCount,n[36]=O.isError,n[37]=H,n[38]=P,n[39]=J):J=n[39],J}function zo(e){return e.state.status==="error"||e.state.data?.hasSchema===!1?Ke:!1}function Xo(e){return vo(e+1)}function Zo(e,t){return!(t instanceof y)&&!(t instanceof Ge)}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?Ne(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:po(e.failure)}:n??{kind:"pending",...t}}const _t={retry:2,refetchInterval:e=>e.state.status==="error"?Ke:!1};function Ne(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 et(Ve({endpoint:e,fetch:n=>fetch(n,{signal:ye(t?AbortSignal.any([t,n.signal]):n.signal)})}))}function je(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 je({...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=G(),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 p=r.source;s.resetQueries({queryKey:g.contentBackend(e.orgSlug,e.virtualMcpId,...p==="local"?["local"]:[e.branch,p])})},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=Te.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=Bt(5e3,1e3,e,2,0);return t instanceof rn&&t.retryAt!==null?Math.max(o,t.retryAt-n):o}async function tt(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 ke(e,t,n){return["decofile-write",e,t,n]}function us(e,t,n){return{id:ke(e,t,n).join(":")}}class nt 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 ot(e){return`${e.orgSlug}/${e.virtualMcpId}/${e.branch}`}function st(e){return`/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}`}async function fs(e,t){return tt(e,t)}function ds(e,t,n){e.setQueryData(g.decofileDraft(ot(t)),n)}function hs(e,t){return e.getQueryData(g.decofileDraft(ot(t)))??null}async function gs(e,t){return(await fetch(st(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?ot(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(st(t),{cache:"no-store"});if(!n.ok)return tt(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(st(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 nt(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,ps=15e3,ms=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<ms?an:ps}function ys(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 Ss(e,t,n=cn){const o=L.useRef(t);o.current=t;const[s]=L.useState(()=>({polling:()=>ys(()=>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 tt(n,"Read committed meta");try{return{kind:"data",data:await n.json()}}catch{return{kind:"unavailable"}}}function Rs(e){return Be(e)?.metadata?.runtime?.path??null}function $e(e,t,n,o){const s=B(e),r=Object.keys(n?.changes??{}).find(a=>B(a)===s);if(r!==void 0&&n)return n.changes[r].baseVersion;const i=Object.keys(t?.draft??{}).some(a=>B(a)===s);if(t&&!i){const a=Object.keys(t.entries).find(c=>B(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 y&&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 rt extends Error{constructor(){super("The draft's changes couldn't be read"),this.name="HostedDraftUnreadError"}}class it extends Error{constructor(){super("The blocks kept changing while the change was saved"),this.name="HostedKeptChangingError"}}function ri(e,t){return(t instanceof rt||t instanceof it)&&(t.message=hn(e,t,"github")),t}function hn(e,t,n){if(t instanceof rt)return e("siteEditor.save.draftUnread");if(t instanceof it)return e("siteEditor.save.keptChanging");if(t instanceof nt)return t.message;if(n==="local")return Ps(e,t);if(t instanceof y)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 nt||e instanceof rt||e instanceof it)return null;if(e instanceof y){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 y)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",Ae=new Set;let z;function gn(){if(z!==void 0)return z;z=null;try{typeof BroadcastChannel=="function"&&(z=new BroadcastChannel($s),z.addEventListener("message",e=>{const t=e.data?.cacheKey;if(typeof t=="string")for(const n of[...Ae])n(t)}))}catch{z=null}return z}function As(e){try{gn()?.postMessage({cacheKey:e})}catch{}}function Ms(e){return gn(),Ae.add(e),()=>{Ae.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 pn(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",pn(JSON.stringify({path:"/",sections:[{__resolveType:n}]}))),s}const Bs="__draft";function li(e){return`${`${e.apiHost}/api/${e.orgSlug}/decofile/${encodeURIComponent(e.virtualMcpId)}/${encodeURIComponent(e.branch)}?token=${e.token}`}@${e.version}`}const Fs="off";function Vs(e,t){if(!t)return e;const n=new URL(e);return n.searchParams.set(Bs,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",pn(JSON.stringify({sections:i}))),r.toString()}function di(e){return e.fastPreviewActive&&e.previewServerUrl?e.previewServerUrl:e.sandboxUrl??null}const $t="__variant=";function mn(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?[]:[mn(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[mn(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 at(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 at(`${s}${o.pathname}@local`,t)}catch{return null}}function pi(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",at(o,t)),n.toString())}catch{return e}}function Js(e){const{pointer:t}=e;if(!t||t===Fs)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(at(t,e.forcedVariants),e.previewOptions)}function Ws(e,t){if(!e||!t)return null;try{return Vs(e,t)}catch{return null}}function mi(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,Me=new Map;function wn(e){for(const t of Me.get(e)??[])t()}function yn(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 Sn(e,t){let n=Me.get(e);return n||(n=new Set,Me.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=>Sn(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?Sn(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 yi(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,pe=new Map;function W(e,t){return`${e}/${t}`}function V(e){let t=pe.get(e);return t||(t={state:kn,listeners:new Set,previews:0,timer:null,discardListeners:new Set},pe.set(e,t)),t}function F(e,t){const n=V(e);n.state={...n.state,...t};for(const o of n.listeners)o()}function Oe(e){e.timer&&clearTimeout(e.timer),e.timer=null}function me(e){return pe.get(e)?.state??kn}function nr(e,t){const n=V(e);return n.listeners.add(t),()=>{n.listeners.delete(t)}}function Si(e){const t=V(e);return t.previews++,()=>{t.previews--,t.previews===0&&t.state.phase==="reloading"&&(Oe(t),F(e,{phase:"idle"}))}}function ki(e){const t=pe.get(e);!t||t.state.phase!=="reloading"||(Oe(t),F(e,{phase:"idle"}))}function On(e){const t=V(e);Oe(t),F(e,{phase:"saving",inFlight:t.state.inFlight+1})}function ue(e,t){const n=V(e),o=Math.max(0,n.state.inFlight-1);if(o>0){F(e,{inFlight:o});return}if(!t.ok||n.previews===0){F(e,{phase:"idle",inFlight:o});return}En(e,t.navigates,o)}function En(e,t,n=0){const o=V(e);Oe(o),o.timer=setTimeout(()=>{o.timer=null,o.state.phase==="reloading"&&F(e,{phase:"idle"})},tr),F(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"){const v=a&&t.reread?n.invalidateQueries({queryKey:g.decofile(a)}):null;if(await Promise.all([c,v]),v&&t.kind!=="edit"){const b=W(o,s);F(b,{epoch:me(b).epoch+1})}return{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=W(o,s);F(v,{epoch:me(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(W(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=W(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),yn(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=W(o,s),a=new Set(t.blockKeys);for(const u of[...V(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:ke(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=W(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=V(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=W(e.orgSlug,e.virtualMcpId);me(t).inFlight>0||(yn(t,null),fe(e,{kind:"external"}).then(({navigates:n})=>{const o=V(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=W(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=()=>me(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=B(t),o=Object.keys(e.changes).find(s=>B(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,Ee(e,t),n)}function Rn(e,t,n){const o=Tn(e,n);return o?.kind==="delete"?o.version??Z:o?o.version:t.has(B(n))?Z: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:Ee(e,t).has(B(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=Ee(e,t);return{blocks:n,versionOf:r=>Rn(o,s,r)}}function Ee(e,t){return new Set(e.getQueryData(g.contentDraftTombstones(t)))}function we(e,t,n,o){const s=B(n),r=Ee(e,t);r.has(s)!==o&&(o?r.add(s):r.delete(s),Y(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===Z?null:h]),a=e.getQueryData(g.contentChanges(n)),c=e.getQueryData(g.contentIndex(n)),l=new Set(i.flatMap(([f])=>$e(f,c,a,r)===null?[f]:[])),u=new Set(i.flatMap(([f,h])=>h===null?[]:[B(f)]));e.setQueryData(g.contentChanges(n),f=>{if(!f)return f;const h={...f.changes};for(const[v,b]of i){const p=$e(v,c,f,r);b!==null?h[v]={kind:"set",version:b,baseVersion:p}:p!==null?h[v]={kind:"delete",version:null,baseVersion:p}:delete h[v]}return{...f,changes:h,edited:!0}});for(const[f,h]of i)h!==null?we(e,n,f,!1):!u.has(B(f))&&l.has(f)&&we(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 De(e,t,n){Y(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:ke(t.orgSlug,t.virtualMcpId,t.branch),status:"pending"});return new Set(n.flatMap(o=>Co(o.state.variables)))}function Le(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 y);throw t.source==="local"&&r?(Le(e,n),new fn(s)):(t.source==="local"&&Je(s)&&Le(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=G(),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){Y(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,p=g.contentChanges(o),R=e.getQueryData(p);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:He(R)}])),_=e.getQueryData(a)?.revision,T=_!==void 0&&_!==h?.revision;if(I?.ok){const E=T?null:de(R,I.result);E&&e.setQueryData(p,E)}else I&&t.source==="local"&&Je(I.error)&&Le(e,n);if(!k?.ok)throw k?.error??new Error("no blocks.list");if(!$)throw new Error("no schema.get");const S=k.result,O=Ze($),D=$.ok&&!O?$.result:null;if(S.notModified&&(!l||!u)||D?.notModified&&!f)return lt(e,t,n,o,!1);const x=S.notModified?new Set:Pn(e,n),A=S.notModified?l:Qo(S.blocks,l,x),m=O?on():D?D.notModified?f:D.schema:$.error;if(e.setQueryData(a,{revision:T?_:S.notModified?h?.revision:S.revision,schemaVersion:D?D.notModified?h?.schemaVersion:D.version??void 0:void 0}),e.setQueryData(r,A),!S.notModified){const E=e.getQueryData(c),j={...S.versions};for(const U of x){const M=E?.[U];M!==void 0?j[U]=M:delete j[U]}e.setQueryData(c,j)}return m instanceof y||e.setQueryData(i,m),!T&&!S.notModified&&l&&h?.revision&&S.revision!==h.revision&&In({queryClient:e,orgSlug:n.orgSlug,virtualMcpId:n.virtualMcpId,branch:n.branch,backend:t,cacheKey:o}),{blocks:A,meta:m}}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,p]=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:He(r.seenChanges)}])),R=e.getQueryData(a)??f,k=e.getQueryData(c)?.revision,$=k!==void 0&&k!==r.seen?.revision;if(p?.ok&&!$){const P=de(r.seenChanges,p.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,_=Ze(b),T=b.ok&&!_?b.result:null;if(I.notModified&&!f||T?.notModified&&!r.currentMeta)return lt(e,t,o,s,!1);const S=_?on():T?T.notModified?r.currentMeta:T.schema:b.error;S instanceof y||e.setQueryData(u,S);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:S};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 m=Pn(e,o),E=e.getQueryData(l)??{},j={},U={},M=[];for(const[P,H]of Object.entries(D)){const J=x.entries[P];!J&&!m.has(P)||(j[P]=H,E[P]!==void 0&&(U[P]=E[P]),J&&!m.has(P)&&E[P]!==J.version&&M.push(P))}return e.setQueryData(i,j),e.setQueryData(l,U),M.length>0&&await ze(e,n,s,M,m),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:S}}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 _e(e){if(!(e instanceof y)||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 y)||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)?Z: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){Y(e),xn(e,t,n,{revision:e.getQueryData(g.contentRevision(n))?.revision??"",versions:s}),De(e,n,Object.fromEntries(Object.entries(s).map(([r,i])=>[r,i===Z?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"?_e(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=_e(v);b&&Object.keys(b).length>0&&ie(e,n,o,f,b);const p=await vr(v,f);if(!p)throw v;ie(e,n,o,f,p);try{h=await i(f,{...r,...p})}catch(R){const k=_e(R);throw k&&Object.keys(k).length>0&&ie(e,n,o,f,k),R}}a={...h,versions:{...d,...h.versions}}}Y(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 De(e,o,l),{revision:c,versions:l}}})}function $n(e,t){if(!(e instanceof y))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 y))return;const o=n.data?.draft;if(!(!o||typeof o!="object"))for(const[s,r]of Object.entries(o))r===null&&we(e,t,s,!1)}function Mn(e,t,n,o){Y(e),Kn(e,n,o);const s=o.block===null,r=e.getQueryData(g.contentVersions(t)),i=e.getQueryData(g.contentChanges(t)),a=$e(n,e.getQueryData(g.contentIndex(t)),i,r);if(i){const c=B(n),l=Object.fromEntries(Object.entries(i.changes).filter(([u])=>B(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})}we(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}),De(e,t,{[n]:s?null:o.version}),Io(e,t,n,o)}function xi(e,t,n,o){if(t.source!=="github"||!(o instanceof y))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}),De(e,o,{[s]:a.version}),!1}function pr(e){const t=N.c(17),n=Be(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),p=b.pointer?.lastIndexOf("@")??-1;return{draft:b.pointer&&p>0?b.pointer.slice(0,p):null,version:b.pointer&&p>0?b.pointer.slice(p+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 pr(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:mr,staleTime:Number.POSITIVE_INFINITY},t[2]=n,t[3]=o):o=t[3];const{data:s}=C(o);return s?.revision}async function mr(){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?je({...e,protocolSuffix:s.cacheKeySuffix}):je({...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=Ft(e?.virtualMcpId).runtime==="cms",d=G();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:ke(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 p;n[13]!==v||n[14]!==b?(p={skip:v,read:b},n[13]=v,n[14]=b,n[15]=p):p=n[15],Ss(!!t?.pollWhile&&!!e,p);const R=Xe(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(yr),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 H=Rt(await M.text());if(H)return H}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 S;n[27]!==u||n[28]!==s||n[29]!==i?(S=(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]=S):S=n[30];let O;n[31]!==h||n[32]!==k||n[33]!==$||n[34]!==I||n[35]!==_||n[36]!==T||n[37]!==S?(O={queryKey:h,queryFn:k,enabled:$,staleTime:I,refetchInterval:_,refetchIntervalInBackground:!1,refetchOnWindowFocus:T,retry:S,retryDelay:cs},n[31]=h,n[32]=k,n[33]=$,n[34]=I,n[35]=_,n[36]=T,n[37]=S,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 m;return n[42]!==A||n[43]!==i?.hosted||n[44]!==D?(m=i?.hosted&&A?{...D,data:A}:D,n[42]=A,n[43]=i?.hosted,n[44]=D,n[45]=m):m=n[45],m}function wr(){return null}function yr(){return null}function Ai(e,t,n){return rs(e,t,n)}function Mi(e){const t=N.c(4),n=G(),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=Xe(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(Sr),n[0]=r?.entries,n[1]=t,n[2]=i):i=n[2],i}function Sr(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",Ue="site-editor-publish";function Or(e){const t=N.c(7),{label:n,detail:o}=e;let s;t[0]!==n?(s=X.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=X.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=X.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?X.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 Bi(e,t){ne.success(t?e("siteEditor.publish.publishedOn",{host:t}):e("siteEditor.publish.published"),{...Qn,id:Ue,description:void 0})}function Fi(e,{headline:t,body:n,detail:o,retry:s,pending:r,tone:i="error"}){const a=Un(e,o??null);ne[i](t,{id:Ue,description:n&&a?X.jsxs(X.Fragment,{children:[X.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:Ue,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{fs as $,Ws as A,Us as B,Ts as C,tn as D,di as E,Gr as F,pr as G,W as H,qs as I,wi as J,bi as K,ve as L,Fs as M,Vs as N,ii as O,pi as P,ci as Q,ki as R,Si as S,Kt as T,rr as U,ji as V,ui as W,us as X,ke as Y,sr as Z,_s as _,Hr as a,fi as a$,Mo as a0,ns as a1,Lr as a2,Qr as a3,Zr as a4,Et as a5,Dt as a6,qr as a7,Wr as a8,zr as a9,nt as aA,si as aB,fr as aC,rt as aD,Ri as aE,Pi as aF,Qi as aG,Ii as aH,ds as aI,ei as aJ,Ei as aK,Ti as aL,it as aM,Kr as aN,Ni as aO,li as aP,xi as aQ,ee as aR,ai as aS,Fi as aT,Ui as aU,Ln as aV,y as aW,w as aX,ze as aY,Pn as aZ,Oo as a_,bo as aa,Un as ab,Vi as ac,Cs as ad,Ur as ae,_n as af,ao as ag,Or as ah,yi as ai,mi as aj,rs as ak,Es as al,Nn as am,ar as an,cs as ao,oi as ap,Ue as aq,Qn as ar,Bi as as,Oi as at,Ar as au,Mr as av,Je as aw,Ci as ax,_i as ay,ri as az,Ao as b,ni as b0,hi as b1,gi as b2,vi as b3,sn as c,Mi as d,Vr as e,Li as f,Di as g,Yr as h,Jr as i,$i as j,Ai as k,vo as l,po as m,Gt as n,ts as o,Cr as p,ti as q,Fr as r,Br as s,ks as t,re as u,ut as v,Xr as w,Rs as x,ls as y,Js as z};
@@ -1 +1 @@
1
- import{b as ee,a4 as te,q as ne,r as E,j as t,B as Q,n as _,dY as ae,a5 as ce,aN as me,aM as pe,aJ as de,aH as ue,aI as ge,aL as fe,aK as he,b5 as xe,t as C,dL as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as H,gD as Ce}from"./index-DkcRNYY4.js";import{a as De}from"./SwitchHorizontal01-D4s0wqq6.js";import{N as we}from"./agent-icon-Clk7SRdQ.js";import{s as Ne}from"./Trash01-B0DFZIg9.js";import{i as Pe}from"./Upload01-CF32qbWU.js";import{i as ie}from"./Zap-DRZwAN9E.js";import{S as Ae}from"./search-toggle-C8mpkT93.js";import{E as W}from"./empty-state-BVQ9VzOU.js";import{C as Ee}from"./collection-tabs-Bj6L8MsE.js";import{S as Me,F as Oe}from"./folder-icon-Detn5ugB.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-BVX55_QU.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-2_7VL2Se.js";import{c as Le}from"./context-shell-DpQEYO74.js";import"./AlertCircle-BttmH_EW.js";import"./Tool01-DRAEzq3d.js";import"./ArrowUp-51wIoVbi.js";import"./ArrowLeft-C_GHEWeK.js";import"./LinkBroken01-CrTBWjs0.js";import"./BookOpen01-CDYle7oQ.js";import"./Globe04-Cuhejf9G.js";import"./CheckCircle-C3-mSikS.js";import"./ChevronUp-EmQwLtzg.js";import"./ChevronSelectorVertical-B417CqKz.js";import"./UserSquare-C01-Jxv6.js";import"./CreditCard01-DANJ2Q0i.js";import"./Key01-qpabI11H.js";import"./Minus-CzyQFk6M.js";import"./Monitor01-CuxWk6vM.js";import"./Sun-CB2w_c2y.js";import"./Play-s__3_cku.js";import"./Plus-niUoy_uM.js";import"./SearchMd-DcWhidrm.js";import"./ShoppingBag01-CiAvRXvs.js";import"./Users01-BnjH2fbf.js";import"./XClose-CznGRv9E.js";import"./icon-button-DUjjoGv_.js";import"./tooltip-CcU7DhuT.js";import"./index-DK-8s7Az.js";import"./badge-Bec4Z79_.js";import"./markdown-b_kJoSST.js";import"./use-copy-F5Ataqy3.js";import"./use-mobile-BnBdDTHN.js";import"./use-view-draft-kind-CLUDIePm.js";import"./thread-route-B-8pwMl6.js";import"./use-project-scope-DOHE3bKU.js";import"./repository-binding-BLl1r28B.js";import"./use-mcp-client-DFeSZL8q.js";import"./auth-D_w34xQ-.js";import"./use-organization-settings-Bp5pncRd.js";import"./schema-C2C3qx85.js";import"./task-board-F0C1flaU.js";import"./thread-intent-BBtcC3eO.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-Dj-biyb-.js";import"./file-preview-D_0IU7PB.js";import"./utils-BQSMlXSP.js";import"./editor-CBAsUN_D.js";import"./file-type-icon-DED9IxiZ.js";import"./useInfiniteQuery-DAeB0Xdz.js";import"./infiniteQueryObserver-Bitq8wqo.js";import"./use-entitlements-C7UoqTI0.js";import"./use-ai-providers-BJ7TKB-_.js";import"./use-decopilot-events-CoAHF-ln.js";import"./require-capability-CbgooziO.js";import"./access-gate-DKCp0oSn.js";import"./capability-load-error-Cg21B6QM.js";import"./sections-D5nPXiNR.js";import"./textarea-BcNUedZJ.js";import"./use-ask-in-chat-BqR7YrFk.js";import"./shell-layout-Dqg0y9U5.js";import"./use-deployment-admin-glI5z0S-.js";import"./admin-fetch-BhTJlAsX.js";import"./command-BtcP4IBQ.js";import"./index-DKvQA4se.js";import"./integration-icon-D_f17Dc0.js";import"./project-icon-DwgAxTAv.js";import"./use-navigate-to-agent-D12paxCm.js";import"./use-debounced-value-CbdraSYQ.js";import"./new-project-dialog-woRLqi3-.js";import"./label-Dn3Jp5Ws.js";import"./repository-picker-BOvn8tow.js";import"./github-icon-N9MEN1MZ.js";import"./collection-search-n_O3WZGN.js";import"./legacy-admin-welcome-dialog-BZv5i7Tg.js";import"./drawer-XRqK1CkH.js";import"./required-auth-layout-Du4rT7sh.js";import"./use-org-sso-BjEvyyup.js";const J=200,_e=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Fe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!_e.has(e))}function Be(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ke(s,e){const i=new Map;for(const o of s){const c=G(o).split("/");c.pop();const a=["skills",e,...c].join("/");i.set(a,[...i.get(a)??[],o])}return i}async function qe(s,e){const o=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(o)throw o.reason}function He(s,e){const i=Le(e),o=`skills/${s}`;return{id:`home/${o}`,name:i.name??s,description:i.description,disableModelInvocation:i.disableModelInvocation,source:"home",volume:Z,path:o,sandboxPath:`${ze}/${Z}/${o}`}}const F="*";function B(s){return s.volume==="home"}function re(s,e){const i=s.indexOf(":");return i===-1?{label:e,glyph:ie}:{label:s.slice(i+1),glyph:s.startsWith("repo:")?je:we}}function Qe(s){const e=se.c(48),{entry:i,pending:o,onOpen:c,onDelete:a}=s,n=ee(),{org:g}=te();let M;e[0]!==i.source||e[1]!==g.name?(M=re(i.source,g.name),e[0]=i.source,e[1]=g.name,e[2]=M):M=e[2];const{label:O,glyph:I}=M;let 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(Q,{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 ws(){const s=ee(),{org:e}=te(),i=Te(),{remove:o,upload:c}=Ie("home"),a=ne(),n=E.useRef(null),[g,M]=E.useState(""),[O,I]=E.useState(F),[D,R]=E.useState(!1),[w,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:H.slashSkills(e.id)}),a.invalidateQueries({queryKey:H.orgFsSkills(e.id)})},j=r=>a.setQueryData(H.slashSkills(e.id),l=>r(l??[]));async function b(r){const l=[...r??[]];if(n.current&&(n.current.value=""),l.length===0)return;const P=l[0]?.webkitRelativePath??"";if(!P){C.error(s("settings.skills.importNeedsFolder"));return}const q=P.split("/")[0]??"",L=l.filter(Fe),U=L.find(A=>G(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(L.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(L.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let Y=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}Y=!0;const A=He($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(L,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){Y&&await o.mutateAsync(X).catch(()=>{}),C.error(A instanceof Error?A.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=g.toLowerCase(),p=(i.data??[]).filter(r=>r.name.toLowerCase().includes(k)||(r.description??"").toLowerCase().includes(k)).sort((r,l)=>Number(B(l))-Number(B(r))||r.name.localeCompare(l.name)),v=new Set((i.data??[]).map(r=>r.source)),d=new Map;for(const r of p)d.set(r.source,(d.get(r.source)??0)+1);const y=[{id:F,label:s("settings.skills.filterAll"),count:p.length},...[...v].map(r=>({id:r,label:re(r,e.name).label,count:d.get(r)??0}))],u=v.has(O)?O:F,S=u===F?p:p.filter(r=>r.source===u),T=r=>f($e(r.volume,r.path)),K=async()=>{if(!m)return;const{id:r,path:l}=m;N(null),j(P=>P.filter(q=>q.id!==r));try{await o.mutateAsync(l),C.success(s("settings.skills.deleteSuccess"))}catch(P){C.error(P instanceof Error?P.message:s("settings.skills.deleteError"))}finally{x()}},oe=t.jsxs(Q,{size:"sm",disabled:D,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(D?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(_,{children:[t.jsx(_.Content,{children:t.jsx(_.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(_.Actions,{secondary:t.jsx(Ae,{value:g,onChange:M,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:oe}),t.jsx("input",{ref:n,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:r=>{b(r.target.files)}}),y.length>2&&t.jsx(Ee,{placement:"page",tabs:y,activeTab:u,onTabChange:I}),i.isPending?t.jsx("div",{className:"@container",children:t.jsx(V,{children:Array.from({length:8},(r,l)=>t.jsx(ae,{className:"h-[168px] rounded-xl"},l))})}):i.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(W,{image:t.jsx(ce,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:i.error instanceof Error?i.error.message:s("settings.skills.errorDescription"),actions:t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{i.refetch()},children:s("settings.skills.retry")})})}):S.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(W,{image:t.jsx(ie,{size:48,className:"text-muted-foreground"}),title:s(g?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:g?s("settings.skills.noResultsDescription",{search:g}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(V,{children:S.map(r=>{const l=r.id===z;return t.jsx(Qe,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),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{ws as default};
1
+ import{b as ee,a4 as te,q as ne,r as E,j as t,B as Q,n as _,dY as ae,a5 as ce,aN as me,aM as pe,aJ as de,aH as ue,aI as ge,aL as fe,aK as he,b5 as xe,t as C,dL as je,c as se,m as ke,_ as ve,X as ye,Z as Se,Y as be,K as H,gD as Ce}from"./index-PfzOl7J6.js";import{a as De}from"./SwitchHorizontal01-BzX5npS9.js";import{N as we}from"./agent-icon-DPgCnEV1.js";import{s as Ne}from"./Trash01-_1ewPMOO.js";import{i as Pe}from"./Upload01-D11ZXRKj.js";import{i as ie}from"./Zap-D5X_AlHR.js";import{S as Ae}from"./search-toggle-CvrrivM1.js";import{E as W}from"./empty-state-CQ-naxDO.js";import{C as Ee}from"./collection-tabs-BPEGrrum.js";import{S as Me,F as Oe}from"./folder-icon-BkVkbSXN.js";import{j as Te,k as Ie,n as Re}from"./use-org-fs-DhEmmAqR.js";import{a7 as ze,R as Z,Z as $e}from"./chat-context-DmIaWG0i.js";import{c as Le}from"./context-shell-BGKkeMCB.js";import"./AlertCircle-GXBIxFcm.js";import"./Tool01-DoE3EsIZ.js";import"./ArrowUp-DBkhb8Yz.js";import"./ArrowLeft-BbqwGy0e.js";import"./LinkBroken01-CzDrAWsX.js";import"./BookOpen01-1fjc61Mm.js";import"./Globe04-CYg8V2eL.js";import"./CheckCircle-B_eEhqJR.js";import"./ChevronUp-FDrusEQ7.js";import"./ChevronSelectorVertical-D-7E5GYT.js";import"./UserSquare-DHrzs2xN.js";import"./CreditCard01-KjySk-5G.js";import"./Key01-DY2gyLvd.js";import"./Minus-CMxaDSgl.js";import"./Monitor01-3IwLMf0Q.js";import"./Sun-BvPiksd_.js";import"./Play-BOARoASB.js";import"./Plus-D452i-ki.js";import"./SearchMd-D9VvymBK.js";import"./ShoppingBag01-DrNjYHL1.js";import"./Users01-DdipP4E2.js";import"./XClose-CR92HpkN.js";import"./icon-button-DTP_l7w5.js";import"./tooltip-7oUFzrc9.js";import"./index-Chdoy1DO.js";import"./badge-CPdAi539.js";import"./markdown-sfCsYKJ3.js";import"./use-copy-MGOjhapZ.js";import"./use-mobile-Box5tF93.js";import"./use-view-draft-kind-Czb3VJ2z.js";import"./thread-route-T4ycKium.js";import"./use-project-scope-RvpHL0s_.js";import"./repository-binding-BjyWZpYn.js";import"./use-mcp-client-CVGnTbnR.js";import"./auth-DET1t4rk.js";import"./use-organization-settings-1gniuS7P.js";import"./schema-MF7uKk3F.js";import"./task-board-Dt94BxWj.js";import"./thread-intent-k_EWWvIp.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-Cs81gduQ.js";import"./file-preview-B_OweD07.js";import"./utils-dLgjLO-5.js";import"./editor-Dc6skLlO.js";import"./file-type-icon-5sEsvuio.js";import"./useInfiniteQuery-BVraOGoC.js";import"./infiniteQueryObserver-BSITs4kU.js";import"./use-entitlements-DKzKnO7t.js";import"./use-ai-providers-BV-M-wTR.js";import"./use-decopilot-events-CExfz_YN.js";import"./require-capability-Ca04y4iT.js";import"./access-gate-CpF5setC.js";import"./capability-load-error-BCoAaz36.js";import"./sections-BDOnV4mD.js";import"./textarea-0zeG6rdh.js";import"./use-ask-in-chat-BNelLcsB.js";import"./shell-layout-QlUCYlok.js";import"./use-deployment-admin-D6ysmdql.js";import"./admin-fetch-BhTJlAsX.js";import"./command-ARXYIBtk.js";import"./index-Cwblfb1K.js";import"./integration-icon-Cypf7ART.js";import"./project-icon-DdcX-1Cu.js";import"./use-navigate-to-agent-BFXAaVqR.js";import"./use-debounced-value-L8Mvr3Qf.js";import"./new-project-dialog-ddGWO7oU.js";import"./label-C3bFtEDk.js";import"./repository-picker-BQKFq3La.js";import"./github-icon-CsOyvsM3.js";import"./collection-search-DXnQxUGL.js";import"./legacy-admin-welcome-dialog-BndvejSa.js";import"./drawer-BUu3Urhv.js";import"./required-auth-layout-rj346c5-.js";import"./use-org-sso-PK2UdKUD.js";const J=200,_e=new Set(["node_modules","__pycache__"]);function G(s){const[,...e]=s.webkitRelativePath.split("/");return e.length>0?e.join("/"):s.name}function Fe(s){return G(s).split("/").every(e=>!e.startsWith(".")&&!_e.has(e))}function Be(s){return s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"skill"}function Ke(s,e){const i=new Map;for(const o of s){const c=G(o).split("/");c.pop();const a=["skills",e,...c].join("/");i.set(a,[...i.get(a)??[],o])}return i}async function qe(s,e){const o=(await Promise.allSettled([...s].map(([c,a])=>e({dir:c,files:a})))).find(c=>c.status==="rejected");if(o)throw o.reason}function He(s,e){const i=Le(e),o=`skills/${s}`;return{id:`home/${o}`,name:i.name??s,description:i.description,disableModelInvocation:i.disableModelInvocation,source:"home",volume:Z,path:o,sandboxPath:`${ze}/${Z}/${o}`}}const F="*";function B(s){return s.volume==="home"}function re(s,e){const i=s.indexOf(":");return i===-1?{label:e,glyph:ie}:{label:s.slice(i+1),glyph:s.startsWith("repo:")?je:we}}function Qe(s){const e=se.c(48),{entry:i,pending:o,onOpen:c,onDelete:a}=s,n=ee(),{org:g}=te();let M;e[0]!==i.source||e[1]!==g.name?(M=re(i.source,g.name),e[0]=i.source,e[1]=g.name,e[2]=M):M=e[2];const{label:O,glyph:I}=M;let 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(Q,{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 ws(){const s=ee(),{org:e}=te(),i=Te(),{remove:o,upload:c}=Ie("home"),a=ne(),n=E.useRef(null),[g,M]=E.useState(""),[O,I]=E.useState(F),[D,R]=E.useState(!1),[w,f]=E.useState(null),[m,N]=E.useState(null),[z,h]=E.useState(null),x=()=>{a.invalidateQueries({queryKey:H.slashSkills(e.id)}),a.invalidateQueries({queryKey:H.orgFsSkills(e.id)})},j=r=>a.setQueryData(H.slashSkills(e.id),l=>r(l??[]));async function b(r){const l=[...r??[]];if(n.current&&(n.current.value=""),l.length===0)return;const P=l[0]?.webkitRelativePath??"";if(!P){C.error(s("settings.skills.importNeedsFolder"));return}const q=P.split("/")[0]??"",L=l.filter(Fe),U=L.find(A=>G(A)==="SKILL.md");if(!U){C.error(s("settings.skills.importMissingSkillMd"));return}if(L.length>J){C.error(s("settings.skills.importTooManyFiles",{count:String(L.length),max:String(J)}));return}const $=Be(q),X=`skills/${$}`;let Y=!1;R(!0);try{if(await Re(e.slug,"home",X)){C.error(s("settings.skills.importSlugTaken",{slug:$}));return}Y=!0;const A=He($,await U.text());j(le=>[A,...le]),h(A.id),await qe(Ke(L,$),c.mutateAsync),C.success(s("settings.skills.importSuccess",{name:$}))}catch(A){Y&&await o.mutateAsync(X).catch(()=>{}),C.error(A instanceof Error?A.message:s("settings.skills.importError"))}finally{h(null),x(),R(!1)}}const k=g.toLowerCase(),p=(i.data??[]).filter(r=>r.name.toLowerCase().includes(k)||(r.description??"").toLowerCase().includes(k)).sort((r,l)=>Number(B(l))-Number(B(r))||r.name.localeCompare(l.name)),v=new Set((i.data??[]).map(r=>r.source)),d=new Map;for(const r of p)d.set(r.source,(d.get(r.source)??0)+1);const y=[{id:F,label:s("settings.skills.filterAll"),count:p.length},...[...v].map(r=>({id:r,label:re(r,e.name).label,count:d.get(r)??0}))],u=v.has(O)?O:F,S=u===F?p:p.filter(r=>r.source===u),T=r=>f($e(r.volume,r.path)),K=async()=>{if(!m)return;const{id:r,path:l}=m;N(null),j(P=>P.filter(q=>q.id!==r));try{await o.mutateAsync(l),C.success(s("settings.skills.deleteSuccess"))}catch(P){C.error(P instanceof Error?P.message:s("settings.skills.deleteError"))}finally{x()}},oe=t.jsxs(Q,{size:"sm",disabled:D,onClick:()=>n.current?.click(),children:[t.jsx(Pe,{size:14}),s(D?"settings.skills.importing":"settings.skills.importButton")]});return t.jsxs(_,{children:[t.jsx(_.Content,{children:t.jsx(_.Container,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(_.Actions,{secondary:t.jsx(Ae,{value:g,onChange:M,label:s("library.context.search"),placeholder:s("settings.skills.searchPlaceholder"),clearLabel:s("library.library.clearSearch")}),children:oe}),t.jsx("input",{ref:n,type:"file",multiple:!0,webkitdirectory:"",className:"hidden",onChange:r=>{b(r.target.files)}}),y.length>2&&t.jsx(Ee,{placement:"page",tabs:y,activeTab:u,onTabChange:I}),i.isPending?t.jsx("div",{className:"@container",children:t.jsx(V,{children:Array.from({length:8},(r,l)=>t.jsx(ae,{className:"h-[168px] rounded-xl"},l))})}):i.isError?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(W,{image:t.jsx(ce,{size:48,className:"text-muted-foreground"}),title:s("settings.skills.errorTitle"),description:i.error instanceof Error?i.error.message:s("settings.skills.errorDescription"),actions:t.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{i.refetch()},children:s("settings.skills.retry")})})}):S.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(W,{image:t.jsx(ie,{size:48,className:"text-muted-foreground"}),title:s(g?"settings.skills.noResultsTitle":"settings.skills.emptyTitle"),description:g?s("settings.skills.noResultsDescription",{search:g}):s("settings.skills.emptyDescription"),actions:!1})}):t.jsx("div",{className:"@container",children:t.jsx(V,{children:S.map(r=>{const l=r.id===z;return t.jsx(Qe,{entry:r,pending:l,onOpen:()=>T(r),onDelete:B(r)&&!l?()=>N(r):void 0},r.id)})})})]})})}),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{ws as default};
@@ -1 +1 @@
1
- import{c as _,m as N,j}from"./index-DkcRNYY4.js";import{T as k,R as z,a as D,b as S}from"./index-DIeS-zcI.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-PfzOl7J6.js";import{T as k,R as z,a as D,b as S}from"./index-CoDU2Q4W.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,eQ as G}from"./index-DkcRNYY4.js";import{b as de,d as fe,e as U,f as ge,g as pe,h as be,i as ve,C as Y,j as he,K as y,k as me,l as xe,m as Ie,s as ye}from"./core.esm-rweyZtAP.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},Pe=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=G.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function Xe(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 G.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"},Q="transform",Ee=Y.Transition.toString({property:Q,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 _e(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:K}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:P,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(K,P),S=!!T,X=S&&!R&&O(d)&&O(h),_=!w&&M,j=_&&X?oe:null,ie=X?j??(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,F=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:!F,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:K,setDraggableNodeRef:P,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(_&&!ve(Z)||!u)&&(S||F))return Y.Transition.toString({...u,property:Q})}}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],je=(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=J(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 J(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)||!J(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{Xe as S,q as a,B as r,je as s,_e as u,Pe as v};
1
+ import{r as v,eQ as G}from"./index-PfzOl7J6.js";import{b as de,d as fe,e as U,f as ge,g as pe,h as be,i as ve,C as Y,j as he,K as y,k as me,l as xe,m as Ie,s as ye}from"./core.esm-Hiw5xlkT.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},Pe=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=G.createContext({activeIndex:-1,containerId:H,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:B,disabled:{draggable:!1,droppable:!1}});function Xe(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 G.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"},Q="transform",Ee=Y.Transition.toString({property:Q,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 _e(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:K}=ge({id:o,data:D,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...f}}),{active:T,activatorEvent:Z,activeNodeRect:ee,attributes:te,setNodeRef:P,listeners:re,isDragging:M,over:ne,setActivatorNodeRef:se,transform:oe}=pe({id:o,data:D,attributes:{...Ne,...n},disabled:m.draggable}),ae=be(K,P),S=!!T,X=S&&!R&&O(d)&&O(h),_=!w&&M,j=_&&X?oe:null,ie=X?j??(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,F=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:!F,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:K,setDraggableNodeRef:P,transform:$??ie,transition:le()};function le(){if($||ce&&p.current.newIndex===b)return Ee;if(!(_&&!ve(Z)||!u)&&(S||F))return Y.Transition.toString({...u,property:Q})}}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],je=(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=J(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 J(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)||!J(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{Xe as S,q as a,B as r,je as s,_e as u,Pe as v};
@@ -1 +1 @@
1
- import{b as A,a4 as B,r as v,j as e,n as x,hr as k,gT as b,ge as y,gf as a,i7 as D,B as m,I as g,aN as z,aM as T,aJ as O,aH as R,aL as F,aK as M,b5 as q,E as C,t as c,c as U}from"./index-DkcRNYY4.js";import{D as H}from"./domain-settings-Ba1MIa2U.js";import{S as $}from"./switch-D_fyZtAR.js";import{a as J,b as K,c as G,d as Q}from"./use-org-sso-BjEvyyup.js";import{s as V}from"./Trash01-B0DFZIg9.js";import{R as W}from"./require-capability-CbgooziO.js";import"./badge-Bec4Z79_.js";import"./select-DVeciAl9.js";import"./index-BdQq_4o_.js";import"./index-DK-8s7Az.js";import"./ChevronUp-EmQwLtzg.js";import"./access-gate-DKCp0oSn.js";import"./capability-load-error-Cg21B6QM.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=J(o.id,o.slug),f=K(o.id,o.slug),S=G(o.id,o.slug),E=Q(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[d,p]=v.useState(!1),[P,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,N=()=>{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"))}},L=async t=>{try{await E.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx(H,{}),I?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!d&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx($,{checked:n.enforced,onCheckedChange:L,disabled:E.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(V,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:N,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,hr as k,gT as b,ge as y,gf as a,i7 as D,B as m,I as g,aN as z,aM as T,aJ as O,aH as R,aL as F,aK as M,b5 as q,E as C,t as c,c as U}from"./index-PfzOl7J6.js";import{D as H}from"./domain-settings-CYdry1vA.js";import{S as $}from"./switch-CdoFqihq.js";import{a as J,b as K,c as G,d as Q}from"./use-org-sso-PK2UdKUD.js";import{s as V}from"./Trash01-_1ewPMOO.js";import{R as W}from"./require-capability-Ca04y4iT.js";import"./badge-CPdAi539.js";import"./select-DbxUTGle.js";import"./index-BdQq_4o_.js";import"./index-Chdoy1DO.js";import"./ChevronUp-FDrusEQ7.js";import"./access-gate-CpF5setC.js";import"./capability-load-error-BCoAaz36.js";function X(){const s=A(),{org:o}=B(),{data:h,isLoading:I}=J(o.id,o.slug),f=K(o.id,o.slug),S=G(o.id,o.slug),E=Q(o.id,o.slug),[i,l]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[d,p]=v.useState(!1),[P,j]=v.useState(!1),u=h?.configured&&h.config,n=h?.config,N=()=>{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"))}},L=async t=>{try{await E.mutateAsync(t),C("sso_enforcement_toggled",{organization_id:o.id,enforced:t}),c.success(s(t?"settings.orgSso.enforcementEnabledSuccess":"settings.orgSso.enforcementDisabledSuccess"))}catch{c.error(s("settings.orgSso.toggleEnforcementError"))}};return e.jsxs(x,{children:[e.jsx(x.Content,{children:e.jsx(x.Container,{children:e.jsxs(k,{children:[e.jsx(x.Title,{children:s("settings.orgSso.securityTitle")}),e.jsx(H,{}),I?e.jsx("div",{className:"text-sm text-muted-foreground",children:s("settings.orgSso.loading")}):e.jsxs(e.Fragment,{children:[u&&!d&&e.jsx(b,{title:s("settings.orgSso.sectionTitle"),children:e.jsxs(y,{children:[e.jsx(a,{title:s("settings.orgSso.providerLabel"),action:e.jsx("span",{className:"font-medium",children:n.issuer})}),e.jsx(a,{title:s("settings.orgSso.clientIdLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.clientId})}),e.jsx(a,{title:s("settings.orgSso.domainLabel"),action:e.jsx("span",{className:"font-medium",children:n.domain})}),e.jsx(a,{title:s("settings.orgSso.scopesLabel"),action:e.jsx("span",{className:"font-mono text-xs",children:n.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(a,{title:s("settings.orgSso.enforceSsoLabel"),description:s("settings.orgSso.enforceSsoDescription"),action:e.jsx($,{checked:n.enforced,onCheckedChange:L,disabled:E.isPending})}),e.jsxs(D,{children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>j(!0),disabled:S.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(V,{size:14}),s("settings.orgSso.removeButton")]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${o.slug}/sso/authorize`,"_blank")},children:s("settings.orgSso.testSsoButton")}),e.jsx(m,{variant:"outline",size:"sm",onClick:N,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};