decocms 4.414.0 → 4.415.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 (463) hide show
  1. package/dist/client/assets/{AlertCircle-DaJjYzK7.js → AlertCircle-CvaSOOO8.js} +1 -1
  2. package/dist/client/assets/AreaChart-C1zWMN3A.js +1 -0
  3. package/dist/client/assets/{ArrowLeft-CwZA6hhm.js → ArrowLeft-BsqlBCdi.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-DlEEL0oL.js → ArrowRight-B6VZdTtP.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-BVYCIIGM.js → ArrowUp-C1c3cSMN.js} +1 -1
  6. package/dist/client/assets/CartesianChart-DT33HVeq.js +6 -0
  7. package/dist/client/assets/{Check-OcoBiXmm.js → Check-ClKm876e.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-Dd90iqND.js → CheckCircle-B38I9lsp.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CD5mSK7Y.js → ChevronUp-BBBSFlle.js} +1 -1
  10. package/dist/client/assets/{Copy01-BJqw8z9b.js → Copy01-kb1901QR.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-BWWARSB9.js → CreditCard01-DkYuXaNf.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-Chnn0E-M.js → DotsVertical-OXZ2C8qE.js} +1 -1
  13. package/dist/client/assets/{ErrorBarContext-CWEL9dCO.js → ErrorBarContext-CSFQ9ttu.js} +1 -1
  14. package/dist/client/assets/Image01-xbxm22_Y.js +1 -0
  15. package/dist/client/assets/{Key01-CD0lgLSw.js → Key01-ZIYydTtn.js} +1 -1
  16. package/dist/client/assets/{Line-Bg6fTk0a.js → Line-C_txxRhK.js} +1 -1
  17. package/dist/client/assets/{Link01-CDLS3D8E.js → Link01-cXYRJQde.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-ClZInLaB.js → LinkExternal01-UxTfoueY.js} +1 -1
  19. package/dist/client/assets/{Monitor01-BdQ0e4n3.js → Monitor01-CINH3FWT.js} +1 -1
  20. package/dist/client/assets/{Globe04-BrBw0Avb.js → Palette-C2svjF4J.js} +1 -1
  21. package/dist/client/assets/{Plus-Du1X0BSn.js → Plus-Bv10xzXZ.js} +1 -1
  22. package/dist/client/assets/{SearchMd-BhrVtQgO.js → SearchMd-DRAIsS0-.js} +1 -1
  23. package/dist/client/assets/{Sector-qDv_EV21.js → Sector-TihpQ2pX.js} +5 -5
  24. package/dist/client/assets/{ShoppingBag01-DTuXZ14Y.js → ShoppingBag01-DsBku-zP.js} +1 -1
  25. package/dist/client/assets/{Sun-BOBnFu4U.js → Sun-CJOAGa8i.js} +1 -1
  26. package/dist/client/assets/{Tool01-B1l7rMbN.js → Tool01-gY-gdMF4.js} +1 -1
  27. package/dist/client/assets/{Trash01-5dU05cxX.js → Trash01-DUhLvzYZ.js} +1 -1
  28. package/dist/client/assets/{Upload01-HggPmwVR.js → Upload01-BsdejHE0.js} +1 -1
  29. package/dist/client/assets/{User01-DCaSZH6y.js → User01-B4dCU7oy.js} +1 -1
  30. package/dist/client/assets/{UserSquare-oitDkmCz.js → UserSquare-BA1qsXhU.js} +1 -1
  31. package/dist/client/assets/{Users01-C5KisUmx.js → Users01-BLSNtVXz.js} +1 -1
  32. package/dist/client/assets/{X-C_n07v-r.js → X-BTpPaU7c.js} +1 -1
  33. package/dist/client/assets/XAxis-Cj_1oR4W.js +1 -0
  34. package/dist/client/assets/{XClose-CH7JGbnX.js → XClose-DnZUIdlK.js} +1 -1
  35. package/dist/client/assets/{ZoomOut-CE1oJlBX.js → ZoomOut-DvQpsf4w.js} +1 -1
  36. package/dist/client/assets/{access-gate-djSuo48h.js → access-gate-BYf0rE33.js} +1 -1
  37. package/dist/client/assets/{add-connection-dialog-ks_Gm8LK.js → add-connection-dialog-BdXnmDrQ.js} +1 -1
  38. package/dist/client/assets/agent-analytics-DQZgiL7L.js +2 -0
  39. package/dist/client/assets/agent-app-C7k2151J.js +1 -0
  40. package/dist/client/assets/agent-assets-B-r7ioGn.js +1 -0
  41. package/dist/client/assets/agent-automation-BkxL2BIZ.js +20 -0
  42. package/dist/client/assets/agent-automations-pf_bDZZ5.js +1 -0
  43. package/dist/client/assets/agent-connect-sources-Do412j4U.js +1 -0
  44. package/dist/client/assets/agent-deck-CYuHMzf-.js +1 -0
  45. package/dist/client/assets/agent-e2e-Db1tY-Py.js +1 -0
  46. package/dist/client/assets/agent-experiments-a-194CZ0.js +1 -0
  47. package/dist/client/assets/agent-file-DcPThm01.js +1 -0
  48. package/dist/client/assets/{agent-git-BTa_DVHj.js → agent-git-I5DAbFxV.js} +2 -2
  49. package/dist/client/assets/agent-hosting-8wURqYK1.js +1 -0
  50. package/dist/client/assets/agent-icon-BvDKYGuI.js +1 -0
  51. package/dist/client/assets/agent-library-DP9jULfe.js +1 -0
  52. package/dist/client/assets/agent-library-file-C2CuO8zG.js +1 -0
  53. package/dist/client/assets/agent-monitor-DU5E9xAR.js +1 -0
  54. package/dist/client/assets/agent-overview-BBH7XkKk.js +1 -0
  55. package/dist/client/assets/agent-settings-DBkRHp58.js +1 -0
  56. package/dist/client/assets/{agent-site-editor-CHHHOnLg.js → agent-site-editor-DSbFppgh.js} +4 -4
  57. package/dist/client/assets/agent-site-editor-code-CGBlhTFD.js +2 -0
  58. package/dist/client/assets/{agent-site-editor-content-D7eFLsTa.js → agent-site-editor-content-C6CyUicz.js} +6 -6
  59. package/dist/client/assets/{agent-site-editor-preview-CU4mKdzV.js → agent-site-editor-preview-Bm6vi5GO.js} +3 -3
  60. package/dist/client/assets/{agent-view-guard-Dc-tIwiR.js → agent-view-guard-BHFZQ084.js} +1 -1
  61. package/dist/client/assets/agent-view-iS5vUDqd.js +1 -0
  62. package/dist/client/assets/agents-list-BmcrOH9K.js +1 -0
  63. package/dist/client/assets/{ai-providers-dlDhTyuB.js → ai-providers-D07lihCf.js} +2 -2
  64. package/dist/client/assets/{alert-CwBw9dro.js → alert-CbVRyYdn.js} +1 -1
  65. package/dist/client/assets/{alert-dialog-DIB7QD28.js → alert-dialog-D5AYweb7.js} +1 -1
  66. package/dist/client/assets/analytics-sections-C7kQuinp.js +1 -0
  67. package/dist/client/assets/{api-keys-3zmZWwRN.js → api-keys-CRcL5tuf.js} +1 -1
  68. package/dist/client/assets/api-keys-DrGX-MFg.js +1 -0
  69. package/dist/client/assets/app-editor-BH13ZfO_.js +1 -0
  70. package/dist/client/assets/{asset-utils-DwWjXWho.js → asset-utils-DxlUH6fM.js} +1 -1
  71. package/dist/client/assets/{auth-D5I2s61A.js → auth-DqmsEfIB.js} +1 -1
  72. package/dist/client/assets/{auth-catchall-WSWKM_Gq.js → auth-catchall-BMmDsnzK.js} +1 -1
  73. package/dist/client/assets/auth-entry-B26Aq39u.js +1 -0
  74. package/dist/client/assets/{auth-split-layout-DWTgZBat.js → auth-split-layout-D5nNb-G8.js} +1 -1
  75. package/dist/client/assets/{authenticate-and-persist-oauth-hhMpxZ3e.js → authenticate-and-persist-oauth-CtghXoSr.js} +1 -1
  76. package/dist/client/assets/{automation-list-row-DdEGsJ2i.js → automation-list-row-CkyFpQMb.js} +1 -1
  77. package/dist/client/assets/automation-runs-CoqjOPyS.js +1 -0
  78. package/dist/client/assets/automations-2UeJll3f.js +1 -0
  79. package/dist/client/assets/{autosend-Cxmy5f7O.js → autosend-D__v3v-c.js} +1 -1
  80. package/dist/client/assets/{avatar-foon9v7B.js → avatar-JoRElFKl.js} +1 -1
  81. package/dist/client/assets/badge-B0yp_bFb.js +1 -0
  82. package/dist/client/assets/{block-document-B8Nfg62J.js → block-document-iObAvspI.js} +1 -1
  83. package/dist/client/assets/{blocks-preview-workspace-context-BaVmSFTq.js → blocks-preview-workspace-context-CroMcTkl.js} +1 -1
  84. package/dist/client/assets/{buckets-CUx3pPZV.js → buckets-CdF9xMMp.js} +1 -1
  85. package/dist/client/assets/{build-improve-prompt-doc-BygXIWi2.js → build-improve-prompt-doc-CXnpM7kh.js} +1 -1
  86. package/dist/client/assets/{calendar-G6mILgu2.js → calendar-_lAvk6Nt.js} +1 -1
  87. package/dist/client/assets/{capability-load-error-CO1VC4nF.js → capability-load-error-8qZRldzC.js} +1 -1
  88. package/dist/client/assets/category-editor-fWmRfYwN.js +1 -0
  89. package/dist/client/assets/{chart-oCBL-j7a.js → chart-B8A_E9YA.js} +5 -5
  90. package/dist/client/assets/{chat-context-Cugy5hDa.js → chat-context-DCpRbJmR.js} +5 -5
  91. package/dist/client/assets/{chat-draft-BdIaAbi7.js → chat-draft-BiPOqsxD.js} +1 -1
  92. package/dist/client/assets/{checkbox-Catn0jym.js → checkbox-DYn5BX_y.js} +1 -1
  93. package/dist/client/assets/choose-editor-9psJgCK3.js +1 -0
  94. package/dist/client/assets/{claim-phase-copy-BQxiL9ur.js → claim-phase-copy-CaNBNXR7.js} +1 -1
  95. package/dist/client/assets/{cli-auth-success-C8L7TKTw.js → cli-auth-success-B-HmvL0Z.js} +1 -1
  96. package/dist/client/assets/{client-icons-wx82VsS4.js → client-icons-DRAmgBv8.js} +1 -1
  97. package/dist/client/assets/{collapsible-BW-qIR3J.js → collapsible-Bg1MAa8S.js} +1 -1
  98. package/dist/client/assets/collection-detail-CzcE81KP.js +1 -0
  99. package/dist/client/assets/{collection-display-button-C7gBvlDS.js → collection-display-button-BbOo6z7N.js} +1 -1
  100. package/dist/client/assets/{collection-search-Bq1nxKvP.js → collection-search-EssCGlF9.js} +1 -1
  101. package/dist/client/assets/{collection-table-wrapper-DVdtt0cC.js → collection-table-wrapper-BktaVXNL.js} +1 -1
  102. package/dist/client/assets/{collection-tabs-C36RG4Vf.js → collection-tabs-C2dMZ-Yz.js} +1 -1
  103. package/dist/client/assets/{combobox-DCIUJ1uY.js → combobox-DnOhf0WD.js} +1 -1
  104. package/dist/client/assets/command-DljL6hzf.js +1 -0
  105. package/dist/client/assets/{companion-mcps-section-DWDTtMpt.js → companion-mcps-section-DHfjmvo2.js} +1 -1
  106. package/dist/client/assets/config-BRt8XM2Q.js +1 -0
  107. package/dist/client/assets/{connect-jOPX0XiI.js → connect-COAAkNAe.js} +2 -2
  108. package/dist/client/assets/{connect-layout-CyFIUESs.js → connect-layout-D_XB9JJD.js} +1 -1
  109. package/dist/client/assets/{connection-CPFeF6nm.js → connection-DZucsf0o.js} +1 -1
  110. package/dist/client/assets/{connection-card-CTMJB3fp.js → connection-card-DrvsNBSo.js} +1 -1
  111. package/dist/client/assets/connection-detail-DELb5RqN.js +1 -0
  112. package/dist/client/assets/{connection-form-helpers-C5t2ERoW.js → connection-form-helpers-BOYwqVWG.js} +1 -1
  113. package/dist/client/assets/connections-BTjmigpS.js +1 -0
  114. package/dist/client/assets/context-t3HzYqzN.js +1 -0
  115. package/dist/client/assets/{create-organization-dialog-CZ1lcSy0.js → create-organization-dialog-BCIcZ5Ce.js} +1 -1
  116. package/dist/client/assets/{decopilot-BbmoQjBz.js → decopilot-BbS9GPYA.js} +2 -2
  117. package/dist/client/assets/{dialog-D5ye6U_D.js → dialog-CfIoHDlJ.js} +1 -1
  118. package/dist/client/assets/discover-C6NL6AwE.js +1 -0
  119. package/dist/client/assets/{domain-settings-BzTmzHwn.js → domain-settings-I8HFU1tc.js} +1 -1
  120. package/dist/client/assets/download-app-dialog-bvP5yIID.js +1 -0
  121. package/dist/client/assets/{drawer-CgCvwNdV.js → drawer-gbdrTv3r.js} +1 -1
  122. package/dist/client/assets/{editor-DCI3ZH5o.js → editor-CUtbeyZe.js} +1 -1
  123. package/dist/client/assets/{empty-state-DSA1rktW.js → empty-state-B7JCSTCX.js} +1 -1
  124. package/dist/client/assets/{empty-state-BpRvqX3b.js → empty-state-B_xAVz84.js} +1 -1
  125. package/dist/client/assets/{extract-connection-data-DIQFM_Rl.js → extract-connection-data-CHpjURut.js} +1 -1
  126. package/dist/client/assets/feature-gate-CSCbG-02.js +1 -0
  127. package/dist/client/assets/feature-paywall-BK6fjPbO.js +1 -0
  128. package/dist/client/assets/file-explorer-BEA-kxcu.js +2 -0
  129. package/dist/client/assets/file-preview-Bk7_4BhT.js +1 -0
  130. package/dist/client/assets/file-share-button-CtEMEEnP.js +3 -0
  131. package/dist/client/assets/{file-type-icon-w64MSOpN.js → file-type-icon-C_2K-vjQ.js} +1 -1
  132. package/dist/client/assets/flat-project-Bp2uxu0m.js +1 -0
  133. package/dist/client/assets/folder-icon-D2srQ6r8.js +1 -0
  134. package/dist/client/assets/{form-F3knQ3ef.js → form-Bw-12Nua.js} +1 -1
  135. package/dist/client/assets/format-time-CjIPQhCN.js +1 -0
  136. package/dist/client/assets/{gateway-client-BkDoJc3i.js → gateway-client-DDRZPNgE.js} +1 -1
  137. package/dist/client/assets/{general-DRrG1HLu.js → general-DFurEwpf.js} +1 -1
  138. package/dist/client/assets/github-repo-22x8y8Tm.js +1 -0
  139. package/dist/client/assets/home-BEfet_Bo.js +1 -0
  140. package/dist/client/assets/{index-D9Qjyoct.js → index-B1gW_UZi.js} +12 -12
  141. package/dist/client/assets/index-BADnYX4j.css +1 -0
  142. package/dist/client/assets/{index-1xlnSxuL.js → index-BBClJhS5.js} +1 -1
  143. package/dist/client/assets/{index-B_6_b10B.js → index-BBn8QmOY.js} +1 -1
  144. package/dist/client/assets/{index-PWbqH2G3.js → index-BGw3HTPr.js} +1 -1
  145. package/dist/client/assets/index-C23QqnY4.js +1 -0
  146. package/dist/client/assets/{index-C1LXcrdL.js → index-CBJQH72Z.js} +1 -1
  147. package/dist/client/assets/{index-CQTi57zC.js → index-CP9MPNu2.js} +2 -2
  148. package/dist/client/assets/{index-DwGlegEL.js → index-Cc_Zqhkn.js} +1 -1
  149. package/dist/client/assets/{index-799YT1X7.js → index-Ccktnu9A.js} +1 -1
  150. package/dist/client/assets/index-CdYIy8eY.js +1 -0
  151. package/dist/client/assets/index-DRvgWruv.js +1 -0
  152. package/dist/client/assets/{index-BxbJS58j.js → index-DTVMnS9R.js} +1 -1
  153. package/dist/client/assets/{index-DXncJrGS.js → index-TvCpAFy_.js} +15 -15
  154. package/dist/client/assets/index-Ty5Jzwnf.js +10 -0
  155. package/dist/client/assets/{index-DUhG4tsR.js → index-oPco2Z7Q.js} +36 -36
  156. package/dist/client/assets/{index-redirect-W-CDsNw_.js → index-redirect-D8rObEfr.js} +1 -1
  157. package/dist/client/assets/{infiniteQueryObserver-CnSA8MF_.js → infiniteQueryObserver-BiKAGWol.js} +1 -1
  158. package/dist/client/assets/infra-billing-DM30eRIB.js +1 -0
  159. package/dist/client/assets/{input-DY62oxPZ.js → input-Dk8ExXFi.js} +1 -1
  160. package/dist/client/assets/{input-DaUsOzcS.js → input-MYwET4H0.js} +1 -1
  161. package/dist/client/assets/input-ZcuegaFq.js +1 -0
  162. package/dist/client/assets/{integration-icon-Didv4P2d.js → integration-icon-cSotbhTg.js} +1 -1
  163. package/dist/client/assets/{label-BypgdEhS.js → label-9S9F78nK.js} +1 -1
  164. package/dist/client/assets/{last-preview-page-BGLkyqI1.js → last-preview-page-BqZ-yKjx.js} +1 -1
  165. package/dist/client/assets/{layout-CPzExRWR.js → layout-XmYuHyUp.js} +1 -1
  166. package/dist/client/assets/{legacy-agents-deep-GQn_HHLF.js → legacy-agents-deep-Cos55l5T.js} +1 -1
  167. package/dist/client/assets/legacy-main-redirect-SvbBzQfx.js +1 -0
  168. package/dist/client/assets/library-DwuPF4v9.js +1 -0
  169. package/dist/client/assets/library-tab-jc2e6zcQ.js +168 -0
  170. package/dist/client/assets/location-DBePU4bz.js +1 -0
  171. package/dist/client/assets/{login-BRrTc0gG.js → login-Dk9tmaQV.js} +1 -1
  172. package/dist/client/assets/{markdown-Bc3TbOnL.js → markdown-D8NZ8Hcx.js} +1 -1
  173. package/dist/client/assets/{mcp-app-renderer-x41adwrD.js → mcp-app-renderer-CMM_xZGY.js} +1 -1
  174. package/dist/client/assets/{mcp-oauth-jFxfSUra.js → mcp-oauth-Rwm2gO51.js} +1 -1
  175. package/dist/client/assets/members-C7CWAgRC.js +1 -0
  176. package/dist/client/assets/{message-templates-nlH50gJ2.js → message-templates-LZ9bQOkh.js} +1 -1
  177. package/dist/client/assets/{mini-report-page-CxePAPTE.js → mini-report-page-Djd5YLq-.js} +1 -1
  178. package/dist/client/assets/mock-board-wLpRW8bx.js +1 -0
  179. package/dist/client/assets/{monaco-editor-D8GdrnPh.js → monaco-editor-gMJT6cpK.js} +2 -2
  180. package/dist/client/assets/monitoring-stats-row-DGiOnVB-.js +1 -0
  181. package/dist/client/assets/{multi-select-DhVdXTHb.js → multi-select-CgJiEc6d.js} +1 -1
  182. package/dist/client/assets/{mustache-Da5_vbMS.js → mustache-C_QlIzWy.js} +1 -1
  183. package/dist/client/assets/new-project-dialog-BaZdnvse.js +1 -0
  184. package/dist/client/assets/{oauth-callback-DTAJ88cJ.js → oauth-callback-DKlgv_Gu.js} +1 -1
  185. package/dist/client/assets/{oauth-callback-ai-provider-zQxL0ybs.js → oauth-callback-ai-provider-bpHWEFSR.js} +1 -1
  186. package/dist/client/assets/onboarding-BCfoU2BS.js +1 -0
  187. package/dist/client/assets/optimistic-project-sidebar-views-CmwJxzI1.js +1 -0
  188. package/dist/client/assets/{org-file-open-context-CRfULtcz.js → org-file-open-context-Bv73tl5K.js} +1 -1
  189. package/dist/client/assets/{organization-choice-DrNVkNJX.js → organization-choice-1eorpCYU.js} +1 -1
  190. package/dist/client/assets/{orgs-CRvqTOkY.js → orgs-zhbMCzP-.js} +1 -1
  191. package/dist/client/assets/{page-seo-form-VepXUh7G.js → page-seo-form-CshajZtl.js} +1 -1
  192. package/dist/client/assets/{pair-CIPjczyu.js → pair-C-k8zr2J.js} +7 -7
  193. package/dist/client/assets/plan-ladder-BlKhVXlg.js +1 -0
  194. package/dist/client/assets/{popover-CLlJmv-M.js → popover-BgkxtrX7.js} +1 -1
  195. package/dist/client/assets/post-calendar-B-WdFfky.js +1 -0
  196. package/dist/client/assets/post-editor-CsDksmyM.js +2 -0
  197. package/dist/client/assets/preview-content-C6mifSrd.js +1 -0
  198. package/dist/client/assets/{preview-dialog-oInIOpgo.js → preview-dialog-CIYvMHEx.js} +1 -1
  199. package/dist/client/assets/profile-C0w8Yfz5.js +1 -0
  200. package/dist/client/assets/project-app-view-Sevz3SK2.js +1 -0
  201. package/dist/client/assets/project-feed-BMtZcRjf.js +1 -0
  202. package/dist/client/assets/{project-icon-BzJ0b0Ay.js → project-icon-C29pLjaM.js} +1 -1
  203. package/dist/client/assets/project-profile-B8BUGXs3.js +1 -0
  204. package/dist/client/assets/project-reports-DLR8Px_E.js +1 -0
  205. package/dist/client/assets/project-tasks-BpKda9bF.js +1 -0
  206. package/dist/client/assets/projects-B_9wM2AG.js +1 -0
  207. package/dist/client/assets/projects-empty-state-D2roHEQS.js +1 -0
  208. package/dist/client/assets/{prompts-DDV76PD8.js → prompts-SqPXo2ej.js} +1 -1
  209. package/dist/client/assets/record-editor-DwoOuklP.js +1 -0
  210. package/dist/client/assets/redirect-editor-BROySec3.js +1 -0
  211. package/dist/client/assets/reports-7388ESEV.js +1 -0
  212. package/dist/client/assets/{reports-x7ZW7jY1.js → reports-BAoHRlcZ.js} +1 -1
  213. package/dist/client/assets/reports-onboarding-DuXWRm1J.js +1 -0
  214. package/dist/client/assets/reports-tab-BTG8fjPp.js +2 -0
  215. package/dist/client/assets/repositories-dyiTYnan.js +1 -0
  216. package/dist/client/assets/{repository-import-picker-DdC8LWMV.js → repository-import-picker-OR5DGZp9.js} +1 -1
  217. package/dist/client/assets/repository-picker-BSwi4b8i.js +1 -0
  218. package/dist/client/assets/require-capability-Bqc8OMTK.js +1 -0
  219. package/dist/client/assets/{required-auth-layout-BeA6YeYQ.js → required-auth-layout-Byop8Zzr.js} +1 -1
  220. package/dist/client/assets/{reset-password-CZB-h_dr.js → reset-password-BJ7ek2C_.js} +1 -1
  221. package/dist/client/assets/{resizable-ChG3qNIS.js → resizable-3VTCAPsm.js} +1 -1
  222. package/dist/client/assets/resolve-tab-icon-CmlW-pVX.js +1 -0
  223. package/dist/client/assets/{review-settings-1_C-_b80.js → review-settings-DV0Kgix-.js} +1 -1
  224. package/dist/client/assets/{rich-text-link-control-B4JFOCzI.js → rich-text-link-control-DHguSqou.js} +2 -2
  225. package/dist/client/assets/roles-BddVa5rc.js +1 -0
  226. package/dist/client/assets/route-BTyvu5tm.js +1 -0
  227. package/dist/client/assets/route-Dv07Kl62.js +1 -0
  228. package/dist/client/assets/route-wKh3eUlH.js +1 -0
  229. package/dist/client/assets/{runnable-block-editor-DZC0Baz4.js → runnable-block-editor-Do2tVSLe.js} +4 -4
  230. package/dist/client/assets/{sandbox-lifecycle-context-BonuevCJ.js → sandbox-lifecycle-context-DqykpNrC.js} +1 -1
  231. package/dist/client/assets/{schema-GqB2SNE_.js → schema-DN-s_HG6.js} +1 -1
  232. package/dist/client/assets/{scroll-area-9EhbhV4n.js → scroll-area--yTJQfnp.js} +1 -1
  233. package/dist/client/assets/{search-input-B84gMTxu.js → search-input-BNUWPEYj.js} +1 -1
  234. package/dist/client/assets/search-toggle-QxOnD3UE.js +1 -0
  235. package/dist/client/assets/{secret-picker-FZs_qkUu.js → secret-picker-B-IAzUKw.js} +1 -1
  236. package/dist/client/assets/{secrets-DQnlXKqx.js → secrets-BfsxO5FG.js} +1 -1
  237. package/dist/client/assets/sections-editor-BSMpRRaP.js +1 -0
  238. package/dist/client/assets/{select-CcGyx8ty.js → select-BSSRUEpK.js} +1 -1
  239. package/dist/client/assets/{select-model-BXKVjHOx.js → select-model-BpoA_wtD.js} +1 -1
  240. package/dist/client/assets/seo-editor-BLMg-jAb.js +1 -0
  241. package/dist/client/assets/{separator-CIgATGUR.js → separator-B-ZEExAQ.js} +1 -1
  242. package/dist/client/assets/settings-tab-Bjk0NW75.js +5 -0
  243. package/dist/client/assets/{sheet-HsqEW5k_.js → sheet--8zhfSHm.js} +1 -1
  244. package/dist/client/assets/shell-layout-DE5WStxe.js +1 -0
  245. package/dist/client/assets/skills-5oEukgyq.js +1 -0
  246. package/dist/client/assets/{sso-w-CGny8A.js → sso-p_1To1BG.js} +1 -1
  247. package/dist/client/assets/{suggestion-YJaAoX7G.js → suggestion-tikPUWB4.js} +1 -1
  248. package/dist/client/assets/{switch-BVaVIxoj.js → switch-XXcZ9CO9.js} +1 -1
  249. package/dist/client/assets/synced-repos-6N09TwCW.js +1 -0
  250. package/dist/client/assets/{tab-icon-glyph-D7xp64UN.js → tab-icon-glyph-Cg30pNjq.js} +1 -1
  251. package/dist/client/assets/{table-C4wC7jcA.js → table-UDk1rGCz.js} +1 -1
  252. package/dist/client/assets/{tabs-CtBDwYTw.js → tabs-DddEqGpk.js} +1 -1
  253. package/dist/client/assets/{task-board-DTEg_hTj.js → task-board-BQC0qjBI.js} +1 -1
  254. package/dist/client/assets/task-route-BIVpLzI_.js +1 -0
  255. package/dist/client/assets/{task-status-yZrVtsEU.js → task-status-5qx4S30L.js} +1 -1
  256. package/dist/client/assets/taskboard-analytics-BUkhCXum.js +1 -0
  257. package/dist/client/assets/{tasks-Ay-mjiXF.js → tasks-B2IZJpCB.js} +2 -2
  258. package/dist/client/assets/tasks-JL_Q5QmF.js +1 -0
  259. package/dist/client/assets/{textarea-Bd9BZaa2.js → textarea-mkcrN5g-.js} +1 -1
  260. package/dist/client/assets/thread-analytics-BL_w94D4.js +1 -0
  261. package/dist/client/assets/thread-button-DwWAsFW7.js +1 -0
  262. package/dist/client/assets/{hooks-C-YaiNLT.js → thread-intent-1MB6k5b2.js} +6 -6
  263. package/dist/client/assets/thread-route-BCeXxLYH.js +1 -0
  264. package/dist/client/assets/{thread-route-BfqlgN7w.js → thread-route-CRhZ1osu.js} +1 -1
  265. package/dist/client/assets/{thread-sheet-body-C8gQ6cXL.js → thread-sheet-body-Bo7LPBv_.js} +1 -1
  266. package/dist/client/assets/{toggle-group-BgFCagKD.js → toggle-group-Cz7RSOBM.js} +1 -1
  267. package/dist/client/assets/{toolbar-icon-button-CFttHyWN.js → toolbar-icon-button-CiJmHymh.js} +1 -1
  268. package/dist/client/assets/{tooltip-CGhrZMes.js → tooltip-CF6AcK-h.js} +1 -1
  269. package/dist/client/assets/{track-ZExbUuzl.js → track-OWWDrnQ-.js} +1 -1
  270. package/dist/client/assets/{types-pZX4k5UI.js → types-C-gwtfMH.js} +2 -2
  271. package/dist/client/assets/usage-stats-CBSbrOk_.js +1 -0
  272. package/dist/client/assets/{use-ai-providers-CFjUtZPr.js → use-ai-providers-B1JZFVlj.js} +1 -1
  273. package/dist/client/assets/{use-automations-C8WXPSJY.js → use-automations-D_9NQm3c.js} +1 -1
  274. package/dist/client/assets/{use-autosave-vgysQ9m_.js → use-autosave-DlgDe-Tc.js} +1 -1
  275. package/dist/client/assets/use-chat-layout-state-D4JUtDU_.js +1 -0
  276. package/dist/client/assets/use-connect-companion-DeEhFjbg.js +1 -0
  277. package/dist/client/assets/{use-connection-mxLfDMRW.js → use-connection-BSRKwy2j.js} +1 -1
  278. package/dist/client/assets/{use-copy-DUJ6ltm0.js → use-copy-BOgEqZMm.js} +1 -1
  279. package/dist/client/assets/use-create-virtual-mcp-zRgZOr46.js +1 -0
  280. package/dist/client/assets/{use-date-fns-locale-DyxqZQPj.js → use-date-fns-locale-DLQqaR-J.js} +1 -1
  281. package/dist/client/assets/{use-debounced-autosave-DuPXl9wb.js → use-debounced-autosave-D_28bChm.js} +1 -1
  282. package/dist/client/assets/{use-debounced-value-BUDe5Br2.js → use-debounced-value-DD9mnPT_.js} +1 -1
  283. package/dist/client/assets/{use-deco-credits-xeUqHdn1.js → use-deco-credits-BVTpTeQe.js} +1 -1
  284. package/dist/client/assets/use-decopilot-events-DrrVrYNR.js +1 -0
  285. package/dist/client/assets/{use-delete-connection-CATogPT_.js → use-delete-connection-XxANt-J1.js} +1 -1
  286. package/dist/client/assets/{use-deployment-admin-BDkUFo0H.js → use-deployment-admin-2URfC53G.js} +1 -1
  287. package/dist/client/assets/{use-fast-preview-draft-url-DPJWXzMA.js → use-fast-preview-draft-url-DEazNknV.js} +1 -1
  288. package/dist/client/assets/{use-file-configs-CaiCm4YC.js → use-file-configs-CoaidzsY.js} +1 -1
  289. package/dist/client/assets/{use-infinite-scroll-CaPw6C-5.js → use-infinite-scroll-BPqj-R_X.js} +1 -1
  290. package/dist/client/assets/{use-join-requests-Dpz06WqH.js → use-join-requests-Drw7IeW0.js} +1 -1
  291. package/dist/client/assets/use-main-panel-tabs-qFkwsuao.js +1 -0
  292. package/dist/client/assets/use-mcp-auth-status-CZ-0Pvu1.js +1 -0
  293. package/dist/client/assets/{use-mcp-client-Bax4L87A.js → use-mcp-client-DDH2Tr05.js} +1 -1
  294. package/dist/client/assets/{use-mcp-prompts-DjwM3Aih.js → use-mcp-prompts-CogjK1bQ.js} +1 -1
  295. package/dist/client/assets/{use-mcp-tools-CbB7jVMv.js → use-mcp-tools-B7MXLlq3.js} +1 -1
  296. package/dist/client/assets/{use-members-D9drExEq.js → use-members-BLvVhz4X.js} +1 -1
  297. package/dist/client/assets/{use-mobile-BkNVLn-e.js → use-mobile-BCSnRACa.js} +1 -1
  298. package/dist/client/assets/use-navigate-to-agent-DYNDpstL.js +1 -0
  299. package/dist/client/assets/use-new-blocks-editor-DGdBBbiW.js +1 -0
  300. package/dist/client/assets/{use-open-billing-url-YekIfrRD.js → use-open-billing-url-Dq7moyEm.js} +1 -1
  301. package/dist/client/assets/{use-org-auth-client-BFMVTZYa.js → use-org-auth-client-BaoVl8Zl.js} +1 -1
  302. package/dist/client/assets/use-org-fs-gM-Wauv_.js +1 -0
  303. package/dist/client/assets/use-org-repo-syncs-DFgGELdf.js +1 -0
  304. package/dist/client/assets/{use-org-sso-TEOX56yY.js → use-org-sso-GwZiS-qS.js} +1 -1
  305. package/dist/client/assets/{use-organization-roles-C2hucAQ7.js → use-organization-roles-CqvDOd51.js} +1 -1
  306. package/dist/client/assets/{use-organization-settings-3QYUfCpW.js → use-organization-settings-mKOaKHuY.js} +1 -1
  307. package/dist/client/assets/{use-panel-navigate-KvJ_j5rh.js → use-panel-navigate-CQHE_TAW.js} +1 -1
  308. package/dist/client/assets/use-project-native-view-presence-CjADt2wx.js +1 -0
  309. package/dist/client/assets/use-project-scope-UozAP0t-.js +1 -0
  310. package/dist/client/assets/use-releases-D-iqlxR6.js +1 -0
  311. package/dist/client/assets/{use-reports-diagnostic-B7R_a5Kv.js → use-reports-diagnostic-CknaDfb_.js} +1 -1
  312. package/dist/client/assets/{use-secrets-CNuvKS59.js → use-secrets-Bl8vA-cD.js} +1 -1
  313. package/dist/client/assets/use-section-preview-base-BqbdcWw1.js +1 -0
  314. package/dist/client/assets/use-session-runtime-B5XfJc8H.js +1 -0
  315. package/dist/client/assets/{use-tags-DSm1Zgi6.js → use-tags-C0g04rDb.js} +1 -1
  316. package/dist/client/assets/{use-task-board-analytics-Bt0Ix7m9.js → use-task-board-analytics-DQMIr-R3.js} +1 -1
  317. package/dist/client/assets/use-task-metadata--2QUxhiK.js +1 -0
  318. package/dist/client/assets/use-thread-analytics-CVoZDp6i.js +1 -0
  319. package/dist/client/assets/{use-thread-outputs-C38ocjxH.js → use-thread-outputs-CYriWIIs.js} +1 -1
  320. package/dist/client/assets/useInfiniteQuery-U12d5VJc.js +1 -0
  321. package/dist/client/assets/{useQueries-CLsJAj_M.js → useQueries-tUSXojRG.js} +1 -1
  322. package/dist/client/assets/useSuspenseInfiniteQuery-B912YJiX.js +1 -0
  323. package/dist/client/assets/{users-Db27IK-5.js → users-DFvmfIoV.js} +1 -1
  324. package/dist/client/assets/{utils-CwpmExkA.js → utils-BaPwSBi2.js} +1 -1
  325. package/dist/client/assets/variant-calendar-sxqpD_Oi.js +1 -0
  326. package/dist/client/assets/{variant-matcher-override-szW3kzoV.js → variant-matcher-override-C-94qzoj.js} +1 -1
  327. package/dist/client/assets/{view-mode-toggle-BBcGKlDx.js → view-mode-toggle-DrlZskFH.js} +1 -1
  328. package/dist/client/assets/{virtual-mcp-COzLXyrd.js → virtual-mcp-DBFF2brO.js} +1 -1
  329. package/dist/client/index.html +2 -2
  330. package/dist/server/cli.js +1 -1
  331. package/dist/server/server.js +1 -1
  332. package/package.json +1 -1
  333. package/dist/client/assets/AreaChart-C8Vo_8Ig.js +0 -1
  334. package/dist/client/assets/CartesianChart-l7Ajhkvs.js +0 -6
  335. package/dist/client/assets/Eye-DR1l_Pl4.js +0 -1
  336. package/dist/client/assets/Image01-DMj_7b2c.js +0 -1
  337. package/dist/client/assets/LayoutLeft-7YdGH3zt.js +0 -1
  338. package/dist/client/assets/Palette-CJ_H2Ji8.js +0 -1
  339. package/dist/client/assets/Share07-3t9nqqkD.js +0 -1
  340. package/dist/client/assets/Zap-D3wZltKp.js +0 -1
  341. package/dist/client/assets/agent-analytics-By50bpU5.js +0 -2
  342. package/dist/client/assets/agent-app-CcBru_Dc.js +0 -1
  343. package/dist/client/assets/agent-assets-CoBq8gk-.js +0 -1
  344. package/dist/client/assets/agent-automation-YwmQKN06.js +0 -20
  345. package/dist/client/assets/agent-automations-Cq5KP2f5.js +0 -1
  346. package/dist/client/assets/agent-connect-sources-DxRi8BCM.js +0 -1
  347. package/dist/client/assets/agent-deck-DVLEuDhA.js +0 -1
  348. package/dist/client/assets/agent-e2e-5IoZIrla.js +0 -1
  349. package/dist/client/assets/agent-experiments-Int37iX5.js +0 -1
  350. package/dist/client/assets/agent-file-Ch99Gr0p.js +0 -1
  351. package/dist/client/assets/agent-hosting-DELLHkBv.js +0 -1
  352. package/dist/client/assets/agent-icon-CJ1up34I.js +0 -1
  353. package/dist/client/assets/agent-library-file-CS1rjRRh.js +0 -1
  354. package/dist/client/assets/agent-monitor-Ciy1E_-Q.js +0 -1
  355. package/dist/client/assets/agent-overview-BC_RAnEB.js +0 -1
  356. package/dist/client/assets/agent-settings-DTx-4cAY.js +0 -1
  357. package/dist/client/assets/agent-site-editor-code-DMrXO_8H.js +0 -2
  358. package/dist/client/assets/agent-view-CorDejXP.js +0 -1
  359. package/dist/client/assets/agents-list-CfDIHVDD.js +0 -1
  360. package/dist/client/assets/analytics-sections-C5_87xUx.js +0 -1
  361. package/dist/client/assets/api-keys-DmjbbAZ9.js +0 -1
  362. package/dist/client/assets/app-editor-Dk5jSXjv.js +0 -1
  363. package/dist/client/assets/auth-entry-BJ1WxKvH.js +0 -1
  364. package/dist/client/assets/automation-runs-CRr7g14c.js +0 -1
  365. package/dist/client/assets/automations-PMz-u3eU.js +0 -1
  366. package/dist/client/assets/badge-B8dizlCT.js +0 -1
  367. package/dist/client/assets/cards-ByVpaFgO.js +0 -8
  368. package/dist/client/assets/category-editor-BVzm0zUq.js +0 -1
  369. package/dist/client/assets/choose-editor-DwovNL0Y.js +0 -1
  370. package/dist/client/assets/collection-detail-Djse0DNa.js +0 -1
  371. package/dist/client/assets/command-DBqQ-b8W.js +0 -1
  372. package/dist/client/assets/config-9m7obEVv.js +0 -1
  373. package/dist/client/assets/connection-detail-CtFxBJog.js +0 -1
  374. package/dist/client/assets/connections-DYm-50T2.js +0 -1
  375. package/dist/client/assets/context-Cen00PJ2.js +0 -1
  376. package/dist/client/assets/discover-f-IlJYkY.js +0 -1
  377. package/dist/client/assets/download-app-dialog-CK-GvdAK.js +0 -1
  378. package/dist/client/assets/feature-gate-CEAThaDY.js +0 -1
  379. package/dist/client/assets/feature-paywall-DCqda5W4.js +0 -1
  380. package/dist/client/assets/file-explorer-IsG6Ynrb.js +0 -2
  381. package/dist/client/assets/file-preview-DkTtYjnK.js +0 -1
  382. package/dist/client/assets/file-share-button-BhqfoTyo.js +0 -3
  383. package/dist/client/assets/folder-icon-0KKPDvC_.js +0 -1
  384. package/dist/client/assets/format-time-BtXRrtv4.js +0 -1
  385. package/dist/client/assets/github-icon-BPkd3ouG.js +0 -1
  386. package/dist/client/assets/github-repo-B15wwZ1g.js +0 -1
  387. package/dist/client/assets/home-WT_7dde5.js +0 -1
  388. package/dist/client/assets/icon-button-C4M15Chh.js +0 -1
  389. package/dist/client/assets/index-B7QeXpyw.css +0 -1
  390. package/dist/client/assets/index-BlluJU8T.js +0 -1
  391. package/dist/client/assets/index-BvEM-dvH.js +0 -1
  392. package/dist/client/assets/index-CKALiP-j.js +0 -1
  393. package/dist/client/assets/infra-billing-IOD9NeWW.js +0 -1
  394. package/dist/client/assets/input-BM0pNmJR.js +0 -1
  395. package/dist/client/assets/legacy-main-redirect-Btysr0GK.js +0 -1
  396. package/dist/client/assets/library-BS4jnPds.js +0 -161
  397. package/dist/client/assets/location-oTTXFrSF.js +0 -1
  398. package/dist/client/assets/members-BkUMEbBZ.js +0 -1
  399. package/dist/client/assets/mock-board-CxZ6IfnT.js +0 -10
  400. package/dist/client/assets/monitoring-stats-row-B4HKQfEd.js +0 -1
  401. package/dist/client/assets/onboarding-C-Uu6LDz.js +0 -1
  402. package/dist/client/assets/optimistic-project-sidebar-views-QwaUX4Nu.js +0 -1
  403. package/dist/client/assets/plan-ladder-Io6vIIsL.js +0 -1
  404. package/dist/client/assets/post-calendar-DTivbJGd.js +0 -1
  405. package/dist/client/assets/post-editor-hRUF_q7o.js +0 -2
  406. package/dist/client/assets/preview-content-qYsw7P88.js +0 -1
  407. package/dist/client/assets/profile-DKiSx-md.js +0 -1
  408. package/dist/client/assets/project-app-view-BXbadkka.js +0 -1
  409. package/dist/client/assets/project-feed-CWlgSYJd.js +0 -1
  410. package/dist/client/assets/project-reports-D27FVZrO.js +0 -1
  411. package/dist/client/assets/project-tasks-BlwINbrD.js +0 -1
  412. package/dist/client/assets/record-editor-D0FEEilz.js +0 -1
  413. package/dist/client/assets/redirect-editor-8U0kYp-L.js +0 -1
  414. package/dist/client/assets/reports-SHBoIX6T.js +0 -1
  415. package/dist/client/assets/reports-onboarding-lz-YekBw.js +0 -1
  416. package/dist/client/assets/reports-tab-CQsFI9AI.js +0 -2
  417. package/dist/client/assets/repositories-B78A5I4U.js +0 -1
  418. package/dist/client/assets/repository-picker-DiXvXP64.js +0 -1
  419. package/dist/client/assets/require-capability-D3lYzq6i.js +0 -1
  420. package/dist/client/assets/resolve-tab-icon-H5U8-G1F.js +0 -1
  421. package/dist/client/assets/roles-BaCjCp-z.js +0 -1
  422. package/dist/client/assets/route-CkeTHcT5.js +0 -1
  423. package/dist/client/assets/route-D4LTJlBf.js +0 -1
  424. package/dist/client/assets/route-RUwqIRQf.js +0 -1
  425. package/dist/client/assets/route-page-header-BvgE0q5Z.js +0 -1
  426. package/dist/client/assets/search-toggle-Dllmt4oB.js +0 -1
  427. package/dist/client/assets/sections-editor-IVuj1qGO.js +0 -1
  428. package/dist/client/assets/seo-editor-DWMKmSd9.js +0 -1
  429. package/dist/client/assets/settings-tab-qIGPe64v.js +0 -5
  430. package/dist/client/assets/shell-layout-PsOcpnj-.js +0 -1
  431. package/dist/client/assets/skill-preview-DDuXNYxe.js +0 -1
  432. package/dist/client/assets/skills-C9zl4SYU.js +0 -1
  433. package/dist/client/assets/synced-repos-OeYTgI30.js +0 -1
  434. package/dist/client/assets/task-route-D8AxgdXG.js +0 -1
  435. package/dist/client/assets/taskboard-analytics-SldboJtr.js +0 -1
  436. package/dist/client/assets/tasks-B2JqGigR.js +0 -1
  437. package/dist/client/assets/thread-analytics-JrMutHmT.js +0 -1
  438. package/dist/client/assets/thread-button-CjEacYmJ.js +0 -1
  439. package/dist/client/assets/thread-intent-CNQdM8Ho.js +0 -1
  440. package/dist/client/assets/thread-route-CSSVlTLS.js +0 -1
  441. package/dist/client/assets/usage-stats-ClwItUaQ.js +0 -1
  442. package/dist/client/assets/use-chat-layout-state-Dr584zB8.js +0 -1
  443. package/dist/client/assets/use-connect-companion-Cgv0bZBV.js +0 -1
  444. package/dist/client/assets/use-create-virtual-mcp-ZvRac8CV.js +0 -1
  445. package/dist/client/assets/use-decopilot-events-Dy5N8Y9f.js +0 -1
  446. package/dist/client/assets/use-entitlements-CLVdcWhS.js +0 -1
  447. package/dist/client/assets/use-in-settings-Bi1UGPlh.js +0 -1
  448. package/dist/client/assets/use-main-panel-tabs-D0Ib6HQf.js +0 -1
  449. package/dist/client/assets/use-mcp-auth-status-DHVKLIQk.js +0 -1
  450. package/dist/client/assets/use-navigate-to-agent-DWCyMlYN.js +0 -1
  451. package/dist/client/assets/use-new-blocks-editor-CCZwmfNr.js +0 -1
  452. package/dist/client/assets/use-org-fs-tnSIwx8e.js +0 -1
  453. package/dist/client/assets/use-project-native-view-presence-CWXr40Pf.js +0 -1
  454. package/dist/client/assets/use-project-scope-DhGOPpT1.js +0 -1
  455. package/dist/client/assets/use-releases-DDoVPY5_.js +0 -1
  456. package/dist/client/assets/use-section-preview-base-VmECEpeP.js +0 -1
  457. package/dist/client/assets/use-session-runtime-CiLk98Je.js +0 -1
  458. package/dist/client/assets/use-task-metadata-DsWPSHLO.js +0 -1
  459. package/dist/client/assets/use-thread-analytics-CNx40-hY.js +0 -1
  460. package/dist/client/assets/use-virtual-mcp-C2m1pRHH.js +0 -1
  461. package/dist/client/assets/useInfiniteQuery-rQtGLM3y.js +0 -1
  462. package/dist/client/assets/useSuspenseInfiniteQuery-DPJ-gshr.js +0 -1
  463. package/dist/client/assets/variant-calendar-ZscKzDf5.js +0 -1
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-editor-Dk5jSXjv.js","assets/index-DUhG4tsR.js","assets/index-B7QeXpyw.css","assets/chat-context-Cugy5hDa.js","assets/use-panel-navigate-KvJ_j5rh.js","assets/thread-route-BfqlgN7w.js","assets/use-project-scope-DhGOPpT1.js","assets/use-virtual-mcp-C2m1pRHH.js","assets/use-mcp-client-Bax4L87A.js","assets/auth-D5I2s61A.js","assets/github-repo-B15wwZ1g.js","assets/autosend-Cxmy5f7O.js","assets/thread-intent-CNQdM8Ho.js","assets/slugify-CEUa2lfQ.js","assets/hooks-C-YaiNLT.js","assets/backoff-8mStPHYB.js","assets/task-board-DTEg_hTj.js","assets/schema-GqB2SNE_.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-entitlements-CLVdcWhS.js","assets/use-ai-providers-CFjUtZPr.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-Dy5N8Y9f.js","assets/use-organization-settings-3QYUfCpW.js","assets/scroll-area-9EhbhV4n.js","assets/select-CcGyx8ty.js","assets/index-1xlnSxuL.js","assets/Check-OcoBiXmm.js","assets/ChevronUp-CD5mSK7Y.js","assets/use-section-preview-base-VmECEpeP.js","assets/UserSquare-oitDkmCz.js","assets/Share07-3t9nqqkD.js","assets/SearchMd-BhrVtQgO.js","assets/dialog-D5ye6U_D.js","assets/X-C_n07v-r.js","assets/input-DaUsOzcS.js","assets/use-new-blocks-editor-CCZwmfNr.js","assets/claim-phase-copy-BQxiL9ur.js","assets/section-preview-url-Csj0_ZDg.js","assets/use-session-runtime-CiLk98Je.js","assets/runnable-block-editor-DZC0Baz4.js","assets/agent-icon-CJ1up34I.js","assets/AlertCircle-DaJjYzK7.js","assets/Tool01-B1l7rMbN.js","assets/ArrowUp-BVYCIIGM.js","assets/ArrowLeft-CwZA6hhm.js","assets/ArrowRight-DlEEL0oL.js","assets/ShoppingBag01-DTuXZ14Y.js","assets/ZoomOut-CE1oJlBX.js","assets/Globe04-BrBw0Avb.js","assets/CheckCircle-Dd90iqND.js","assets/Copy01-BJqw8z9b.js","assets/CreditCard01-BWWARSB9.js","assets/DotsVertical-Chnn0E-M.js","assets/Eye-DR1l_Pl4.js","assets/XClose-CH7JGbnX.js","assets/Image01-DMj_7b2c.js","assets/Key01-CD0lgLSw.js","assets/LayoutLeft-7YdGH3zt.js","assets/Link01-CDLS3D8E.js","assets/LinkExternal01-ClZInLaB.js","assets/Monitor01-BdQ0e4n3.js","assets/Sun-BOBnFu4U.js","assets/Palette-CJ_H2Ji8.js","assets/Plus-Du1X0BSn.js","assets/Trash01-5dU05cxX.js","assets/Upload01-HggPmwVR.js","assets/User01-DCaSZH6y.js","assets/Users01-C5KisUmx.js","assets/Zap-D3wZltKp.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/pair-CIPjczyu.js","assets/format-time-BtXRrtv4.js","assets/differenceInSeconds-C3x8sHUj.js","assets/collapsible-BW-qIR3J.js","assets/use-copy-DUJ6ltm0.js","assets/usage-stats-ClwItUaQ.js","assets/markdown-Bc3TbOnL.js","assets/org-file-open-context-CRfULtcz.js","assets/use-mobile-BkNVLn-e.js","assets/tooltip-CGhrZMes.js","assets/shell-layout-PsOcpnj-.js","assets/avatar-foon9v7B.js","assets/download-app-dialog-CK-GvdAK.js","assets/command-DBqQ-b8W.js","assets/index-BxbJS58j.js","assets/integration-icon-Didv4P2d.js","assets/project-icon-BzJ0b0Ay.js","assets/required-auth-layout-BeA6YeYQ.js","assets/use-org-sso-TEOX56yY.js","assets/shell-layout-CE2Eihra.css","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-x41adwrD.js","assets/types-pZX4k5UI.js","assets/omit-sandbox-map-jj4lCB2U.js","assets/gateway-client-BkDoJc3i.js","assets/tool-namespace-DmnQIdtF.js","assets/utils-CVEq3hMx.js","assets/sheet-HsqEW5k_.js","assets/use-connection-mxLfDMRW.js","assets/use-navigate-to-agent-DWCyMlYN.js","assets/use-mcp-prompts-DjwM3Aih.js","assets/index-B_6_b10B.js","assets/form-F3knQ3ef.js","assets/label-BypgdEhS.js","assets/use-thread-outputs-C38ocjxH.js","assets/file-type-icon-w64MSOpN.js","assets/popover-CLlJmv-M.js","assets/utils-CwpmExkA.js","assets/monaco-editor-D8GdrnPh.js","assets/editor-DCI3ZH5o.js","assets/calendar-G6mILgu2.js","assets/textarea-Bd9BZaa2.js","assets/rich-text-link-control-B4JFOCzI.js","assets/switch-BVaVIxoj.js","assets/combobox-DCIUJ1uY.js","assets/alert-dialog-DIB7QD28.js","assets/sandbox-url-D3mC8qhT.js","assets/search-input-B84gMTxu.js","assets/tabs-CtBDwYTw.js","assets/use-debounced-value-BUDe5Br2.js","assets/use-file-configs-CaiCm4YC.js","assets/asset-utils-DwWjXWho.js","assets/useInfiniteQuery-rQtGLM3y.js","assets/infiniteQueryObserver-CnSA8MF_.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/toggle-group-BgFCagKD.js","assets/sandbox-git-api-B1R0585s.js","assets/agent-view-guard-Dc-tIwiR.js","assets/use-main-panel-tabs-D0Ib6HQf.js","assets/use-chat-layout-state-Dr584zB8.js","assets/use-mcp-tools-CbB7jVMv.js","assets/index-BlluJU8T.js","assets/drawer-CgCvwNdV.js","assets/collection-search-Bq1nxKvP.js","assets/input-DY62oxPZ.js","assets/chat-draft-BdIaAbi7.js","assets/use-deco-credits-xeUqHdn1.js","assets/use-open-billing-url-YekIfrRD.js","assets/decopilot-BbmoQjBz.js","assets/checkbox-Catn0jym.js","assets/ai-providers-logos-DD3qZ33J.js","assets/index-799YT1X7.js","assets/input-BM0pNmJR.js","assets/suggestion-YJaAoX7G.js","assets/use-org-fs-tnSIwx8e.js","assets/question-004-sINsf4GQ.js","assets/use-members-D9drExEq.js","assets/use-org-auth-client-BFMVTZYa.js","assets/feature-paywall-DCqda5W4.js","assets/plan-ladder-Io6vIIsL.js","assets/add-connection-dialog-ks_Gm8LK.js","assets/extract-connection-data-DIQFM_Rl.js","assets/metadata-D72DunRR.js","assets/connection-CPFeF6nm.js","assets/connection-card-CTMJB3fp.js","assets/connection-slug-CITJ0kGN.js","assets/connection-form-helpers-C5t2ERoW.js","assets/authenticate-and-persist-oauth-hhMpxZ3e.js","assets/mcp-oauth-jFxfSUra.js","assets/collection-tabs-C36RG4Vf.js","assets/badge-B8dizlCT.js","assets/use-infinite-scroll-CaPw6C-5.js","assets/useSuspenseInfiniteQuery-DPJ-gshr.js","assets/input-CSk0sNdn.css","assets/sandbox-lifecycle-context-BonuevCJ.js","assets/resolve-tab-icon-H5U8-G1F.js","assets/use-task-metadata-DsWPSHLO.js","assets/use-project-native-view-presence-CWXr40Pf.js","assets/site-slug-DebpOoQq.js","assets/virtual-mcp-COzLXyrd.js","assets/feature-gate-CEAThaDY.js","assets/mustache-Da5_vbMS.js","assets/empty-state-DSA1rktW.js","assets/empty-state-BpRvqX3b.js","assets/github-icon-BPkd3ouG.js","assets/repository-import-picker-DdC8LWMV.js","assets/repository-picker-DiXvXP64.js","assets/post-editor-hRUF_q7o.js","assets/multi-select-DhVdXTHb.js","assets/block-document-B8Nfg62J.js","assets/index-DwGlegEL.js","assets/use-fast-preview-draft-url-DPJWXzMA.js","assets/use-autosave-vgysQ9m_.js","assets/record-editor-D0FEEilz.js","assets/context-Cen00PJ2.js","assets/index-D9Qjyoct.js","assets/get-initials-D-f_fDFw.js","assets/category-editor-BVzm0zUq.js","assets/sections-editor-IVuj1qGO.js","assets/page-seo-form-VepXUh7G.js","assets/variant-matcher-override-szW3kzoV.js","assets/seo-editor-DWMKmSd9.js","assets/variant-calendar-ZscKzDf5.js","assets/view-mode-toggle-BBcGKlDx.js","assets/post-calendar-DTivbJGd.js","assets/alert-CwBw9dro.js","assets/redirect-editor-8U0kYp-L.js"])))=>i.map(i=>d[i]);
2
- import{c as ae,b as Ne,j as n,m as gs,K as Bt,l as xe,r as $,h as rt,B as Be,o as Co,e as Po,t as me,a3 as js,ay as Nt,aH as vt,F as Ft,az as Rs,H as Kt,I as zt,at as To,U as Bo,V as Eo,G as We,ak as Et,aI as ds,aJ as Do,X as _o,u as jn,aF as Je}from"./index-DUhG4tsR.js";import{A as Ao}from"./agent-view-guard-Dc-tIwiR.js";import{F as $o}from"./feature-gate-CEAThaDY.js";import{u as Dt,b as kn}from"./chat-context-Cugy5hDa.js";import{i as Qt}from"./AlertCircle-DaJjYzK7.js";import{N as Lo,O as Sn,P as tt,Q as wn,R as ks,S as Oo,T as Nn,U as Io,I as Cn,V as Ro,W as Fo,X as Ct,Y as Ko,Z as zo,n as Mo,_ as Vo,$ as Pn,a0 as Go,a1 as Uo,a2 as Ho,a3 as Jo,C as Tn}from"./agent-icon-CJ1up34I.js";import{i as Bn,a as En,d as Fs}from"./UserSquare-oitDkmCz.js";import{i as Dn}from"./ZoomOut-CE1oJlBX.js";import{i as Mt,a as Ks}from"./Share07-3t9nqqkD.js";import{c as _n,i as qo}from"./XClose-CH7JGbnX.js";import{s as Ss}from"./Plus-Du1X0BSn.js";import{t as An}from"./Users01-C5KisUmx.js";import{f as Wo,e as Yo,b as Qo,A as Xo,a as Zo,d as ea,c as ta,g as sa}from"./alert-dialog-DIB7QD28.js";import{S as Xt}from"./scroll-area-9EhbhV4n.js";import{T as Ye,a as Qe,c as Xe}from"./tooltip-CGhrZMes.js";import{B as ot}from"./badge-B8dizlCT.js";import{S as us,n as na,c as oa,g as $n,B as ms,P as aa,h as Ln,o as la,i as xs,s as ia,u as Zt,l as ra,q as ca,R as da,t as On,r as ua,v as ma,d as In,w as fa,x as pa,y as Rn,z as ha,M as ga,j as xa,A as ba,p as ya,C as va,D as ja,e as ka,f as Sa,E as zs,F as Fn,k as wa,G as Na}from"./runnable-block-editor-DZC0Baz4.js";import{r as ws,S as Ca,m as Ns,i as Pa,o as Ta,q as Ba,n as It,v as Ea,R as Kn,t as Da,l as _a,w as Aa,x as $a,y as Ms,G as Cs,g as La,z as Oa,e as Vs,A as Ia,d as Ra,B as Fa,D as Gs,h as Ka,E as za,F as Ma}from"./claim-phase-copy-BQxiL9ur.js";import{u as zn,P as Va}from"./mustache-Da5_vbMS.js";import{n as Mn}from"./ShoppingBag01-DTuXZ14Y.js";import{t as ht}from"./ChevronUp-CD5mSK7Y.js";import{i as Vn}from"./Zap-D3wZltKp.js";import{C as Ga,a as Ua,b as Ha}from"./collapsible-BW-qIR3J.js";import{c as Ja,d as qa}from"./sandbox-lifecycle-context-BonuevCJ.js";import{u as Gn}from"./use-session-runtime-CiLk98Je.js";import{c as gt,d as ct,e as xt,b as dt,D as ut,h as Vt,a as Wa}from"./dialog-D5ye6U_D.js";import{I as Ze}from"./input-DaUsOzcS.js";import{C as es}from"./checkbox-Catn0jym.js";import{L as ze}from"./label-BypgdEhS.js";import{c as Ya,b as Qa,a as Xa,d as Za,S as el}from"./select-CcGyx8ty.js";import{o as tl}from"./sandbox-git-api-B1R0585s.js";import{a as Us}from"./utils-CwpmExkA.js";import{i as sl}from"./CheckCircle-Dd90iqND.js";import{s as Ps}from"./Trash01-5dU05cxX.js";import{i as fs}from"./Upload01-HggPmwVR.js";import{E as nl}from"./empty-state-DSA1rktW.js";import{T as Rt}from"./textarea-Bd9BZaa2.js";import{u as ol}from"./use-ai-providers-CFjUtZPr.js";import{M as Un}from"./monaco-editor-D8GdrnPh.js";import{i as Ts}from"./X-C_n07v-r.js";import{d as Hn,a as al}from"./use-virtual-mcp-C2m1pRHH.js";import"./rich-text-link-control-B4JFOCzI.js";import{a as ll}from"./Copy01-BJqw8z9b.js";import{b as il}from"./Tool01-B1l7rMbN.js";import{b as Hs}from"./use-project-scope-DhGOPpT1.js";import{E as rl}from"./empty-state-BpRvqX3b.js";import{G as Js}from"./github-icon-BPkd3ouG.js";import{R as cl}from"./repository-import-picker-DdC8LWMV.js";import{b as dl}from"./thread-route-BfqlgN7w.js";function ul(t){const e=ae.c(18),{title:s,description:o,children:a}=t,l=Ne();let i;e[0]!==a?(i=n.jsx("div",{"aria-hidden":"true",inert:!0,className:"pointer-events-none h-full select-none overflow-hidden",children:a}),e[0]=a,e[1]=i):i=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Lo,{}),e[2]=c):c=e[2];let r;e[3]!==l?(r=l("common.soon"),e[3]=l,e[4]=r):r=e[4];let d;e[5]!==r?(d=n.jsxs(ot,{variant:"secondary",children:[c,r]}),e[5]=r,e[6]=d):d=e[6];let p;e[7]!==s?(p=n.jsx("p",{className:"text-base font-semibold text-foreground",children:s}),e[7]=s,e[8]=p):p=e[8];let m;e[9]!==o?(m=o&&n.jsx("p",{className:"text-sm text-muted-foreground",children:o}),e[9]=o,e[10]=m):m=e[10];let h;e[11]!==d||e[12]!==p||e[13]!==m?(h=n.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-6 backdrop-blur-sm",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3 rounded-2xl border bg-card px-8 py-6 text-center shadow-lg",children:[d,p,m]})}),e[11]=d,e[12]=p,e[13]=m,e[14]=h):h=e[14];let u;return e[15]!==i||e[16]!==h?(u=n.jsxs("div",{className:"relative h-full min-h-0",children:[i,h]}),e[15]=i,e[16]=h,e[17]=u):u=e[17],u}function ml(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([o])=>!e.includes(o)));return Object.keys(s).length>0?{...t,properties:s}:t}function fl(t,e,s){return typeof t!="string"?null:ml(ws(t,e),s)}function Jn(t,e,s){if(!e||typeof t!="string")return!1;const o=fl(t,e,s);return!!o&&Object.keys(o.properties??{}).length>0}function jt(t){const e=ae.c(6),{hasItems:s,emptyLabel:o,emptyHint:a}=t;let l;e[0]!==a||e[1]!==o||e[2]!==s?(l=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:o}),n.jsx("div",{className:"mt-1 text-muted-foreground/80",children:a})]}),e[0]=a,e[1]=o,e[2]=s,e[3]=l):l=e[3];let i;return e[4]!==l?(i=n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=i):i=e[5],i}function ts(t,e){return`${t}-${e}`}function qn(t,e){return`site/apps/${t}/${e}.ts`}function Wn(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function pl(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function hl(t){return t==="local"?"Custom":"Installed"}function Yn(t,e,s){const o=new Set([ts(t,e),e].map(l=>l.toLowerCase())),a=qn(t,e);for(const[l,i]of Object.entries(s)){if(l.includes("/")||!i||typeof i!="object"||Array.isArray(i))continue;const c=i;if(o.has(l.toLowerCase())||c.__resolveType===a)return l}return null}function gl(t,e){const s=t.vendor.alias,o=t.name,a=Yn(s,o,e);return{id:ts(s,o),app:o,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:qn(s,o),blockKey:a,installed:a!==null}}function xl(t,e,s){if(t===Ca)return null;const o=Wn(t);if(!o)return null;const{vendor:a,app:l}=o,i=Yn(a,l,s),c=Ns(t,e);return{id:ts(a,l),app:l,vendor:a,title:c.title??l,description:c.description??"",category:"Others",logo:c.logo??c.icon,resolveType:t,blockKey:i,installed:i!==null}}function bl(t,e,s){const o=e.__resolveType;if(typeof o!="string"||Pa(t,e)||!Ta(o))return null;const a=Wn(o)??pl(t);if(!a)return null;const l=Ns(o,s),{vendor:i,app:c}=a;return{id:ts(i,c),app:c,vendor:i,title:l.title??Ba(t,e,s),description:l.description??"",category:hl(i),logo:l.logo??l.icon,resolveType:o,blockKey:t,installed:!0}}function yl(t,e,s){const o=new Map;for(const l of t){const i=gl(l,s);o.set(i.id,i)}const a=e.manifest?.blocks?.apps??{};for(const l of Object.keys(a)){const i=xl(l,e,s);!i||o.has(i.id)||o.set(i.id,i)}for(const[l,i]of Object.entries(s)){if(l.includes("/")||!i||typeof i!="object"||Array.isArray(i))continue;const c=bl(l,i,e);!c||o.has(c.id)||o.set(c.id,c)}return[...o.values()].sort(vl)}function vl(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function jl(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function kl(t,e,s){const o=ae.c(12),a=s?.enabled??!0;let l;o[0]===Symbol.for("react.memo_cache_sentinel")?(l=Bt.decoApps(),o[0]=l):l=o[0];let i;o[1]!==a?(i={queryKey:l,queryFn:jl,staleTime:3e5,retry:1,enabled:a},o[1]=a,o[2]=i):i=o[2];const c=gs(i);let r;o[3]!==e||o[4]!==t||o[5]!==c.data?(r=t&&e?yl(c.data??[],t,e):[],o[3]=e,o[4]=t,o[5]=c.data,o[6]=r):r=o[6];const d=r,p=c.isLoading&&!c.isError;let m;return o[7]!==d||o[8]!==c.isError||o[9]!==c.refetch||o[10]!==p?(m={catalog:d,isLoading:p,isError:c.isError,refetch:c.refetch},o[7]=d,o[8]=c.isError,o[9]=c.refetch,o[10]=p,o[11]=m):m=o[11],m}const Sl=["sections","apps","loaders","actions"];function wl(t){const e=ae.c(59),{active:s,counts:o,showBlog:a,onSelect:l}=t,i=Ne();let c;e[0]!==i?(c=i("sandbox.collectionsSidebar.content"),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==c?(r=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children:c})}),e[2]=c,e[3]=r):r=e[3];let d;e[4]!==i?(d=i("sandbox.collectionsSidebar.pages"),e[4]=i,e[5]=d):d=e[5];const p=s==="pages";let m;e[6]!==o.pages||e[7]!==l||e[8]!==d||e[9]!==p?(m=n.jsx(Fe,{id:"pages",icon:Bn,label:d,count:o.pages,active:p,onSelect:l}),e[6]=o.pages,e[7]=l,e[8]=d,e[9]=p,e[10]=m):m=e[10];let h;e[11]!==i?(h=i("sandbox.collectionsSidebar.redirects"),e[11]=i,e[12]=h):h=e[12];const u=s==="redirects";let f;e[13]!==o.redirects||e[14]!==l||e[15]!==h||e[16]!==u?(f=n.jsx(Fe,{id:"redirects",icon:Sn,label:h,count:o.redirects,active:u,onSelect:l}),e[13]=o.redirects,e[14]=l,e[15]=h,e[16]=u,e[17]=f):f=e[17];let x;e[18]!==i?(x=i("sandbox.collectionsSidebar.site"),e[18]=i,e[19]=x):x=e[19];const g=s==="site";let y;e[20]!==l||e[21]!==g||e[22]!==x?(y=n.jsx(Fe,{id:"site",icon:Oo,label:x,active:g,onSelect:l}),e[20]=l,e[21]=g,e[22]=x,e[23]=y):y=e[23];let v;e[24]!==i?(v=i("sandbox.collectionsSidebar.seo"),e[24]=i,e[25]=v):v=e[25];const j=s==="seo";let w;e[26]!==l||e[27]!==v||e[28]!==j?(w=n.jsx(Fe,{id:"seo",icon:Nn,label:v,active:j,onSelect:l}),e[26]=l,e[27]=v,e[28]=j,e[29]=w):w=e[29];let C;e[30]!==i?(C=i("sandbox.collectionsSidebar.calendar"),e[30]=i,e[31]=C):C=e[31];const E=s==="calendar";let B;e[32]!==l||e[33]!==C||e[34]!==E?(B=n.jsx(Fe,{id:"calendar",icon:Io,label:C,active:E,onSelect:l}),e[32]=l,e[33]=C,e[34]=E,e[35]=B):B=e[35];let k;e[36]!==s||e[37]!==o||e[38]!==l?(k=n.jsx(Nl,{active:s,counts:o,onSelect:l}),e[36]=s,e[37]=o,e[38]=l,e[39]=k):k=e[39];let _;e[40]!==s||e[41]!==o.authors||e[42]!==o.categories||e[43]!==o.posts||e[44]!==l||e[45]!==a||e[46]!==i?(_=a&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[n.jsx(Mn,{size:13,className:"shrink-0"}),i("sandbox.collectionsSidebar.blog")]}),n.jsx(Fe,{id:"context",icon:tt,label:i("sandbox.collectionsSidebar.context"),active:s==="context",onSelect:l}),n.jsx(Fe,{id:"posts",icon:Dn,label:i("sandbox.collectionsSidebar.posts"),count:o.posts,active:s==="posts",onSelect:l}),n.jsx(Fe,{id:"authors",icon:An,label:i("sandbox.collectionsSidebar.authors"),count:o.authors,active:s==="authors",onSelect:l}),n.jsx(Fe,{id:"categories",icon:wn,label:i("sandbox.collectionsSidebar.categories"),count:o.categories,active:s==="categories",onSelect:l}),n.jsx(Fe,{id:"post-schedule",icon:ks,label:i("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:l})]}),e[40]=s,e[41]=o.authors,e[42]=o.categories,e[43]=o.posts,e[44]=l,e[45]=a,e[46]=i,e[47]=_):_=e[47];let O;e[48]!==y||e[49]!==w||e[50]!==B||e[51]!==k||e[52]!==_||e[53]!==m||e[54]!==f?(O=n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[m,f,y,w,B,k,_]}),e[48]=y,e[49]=w,e[50]=B,e[51]=k,e[52]=_,e[53]=m,e[54]=f,e[55]=O):O=e[55];let L;return e[56]!==r||e[57]!==O?(L=n.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[r,O]}),e[56]=r,e[57]=O,e[58]=L):L=e[58],L}function Nl(t){const e=ae.c(52),{active:s,counts:o,onSelect:a}=t,l=Ne();let i;e[0]!==s?(i=Sl.includes(s),e[0]=s,e[1]=i):i=e[1];const c=i,[r,d]=$.useState(!1),p=r||c;let m,h;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=xe("flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer","text-muted-foreground hover:bg-muted hover:text-foreground"),h=n.jsx(Ro,{size:16,className:"shrink-0"}),e[2]=m,e[3]=h):(m=e[2],h=e[3]);let u;e[4]!==l?(u=l("sandbox.collectionsSidebar.advanced"),e[4]=l,e[5]=u):u=e[5];let f;e[6]!==u?(f=n.jsx("span",{className:"flex-1 truncate",children:u}),e[6]=u,e[7]=f):f=e[7];const x=p&&"rotate-180";let g;e[8]!==x?(g=xe("shrink-0 text-muted-foreground/70 transition-transform",x),e[8]=x,e[9]=g):g=e[9];let y;e[10]!==g?(y=n.jsx(ht,{size:16,className:g}),e[10]=g,e[11]=y):y=e[11];let v;e[12]!==f||e[13]!==y?(v=n.jsxs(Ga,{className:m,children:[h,f,y]}),e[12]=f,e[13]=y,e[14]=v):v=e[14];let j;e[15]!==l?(j=l("sandbox.collectionsSidebar.sections"),e[15]=l,e[16]=j):j=e[16];const w=s==="sections";let C;e[17]!==o.sections||e[18]!==a||e[19]!==j||e[20]!==w?(C=n.jsx(Fe,{id:"sections",icon:Mt,label:j,count:o.sections,active:w,onSelect:a,indent:!0}),e[17]=o.sections,e[18]=a,e[19]=j,e[20]=w,e[21]=C):C=e[21];let E;e[22]!==l?(E=l("sandbox.collectionsSidebar.apps"),e[22]=l,e[23]=E):E=e[23];const B=s==="apps";let k;e[24]!==o.apps||e[25]!==a||e[26]!==E||e[27]!==B?(k=n.jsx(Fe,{id:"apps",icon:_n,label:E,count:o.apps,active:B,onSelect:a,indent:!0}),e[24]=o.apps,e[25]=a,e[26]=E,e[27]=B,e[28]=k):k=e[28];let _;e[29]!==l?(_=l("sandbox.collectionsSidebar.loaders"),e[29]=l,e[30]=_):_=e[30];const O=s==="loaders";let L;e[31]!==o.loaders||e[32]!==a||e[33]!==_||e[34]!==O?(L=n.jsx(Fe,{id:"loaders",icon:Cn,label:_,count:o.loaders,active:O,onSelect:a,indent:!0}),e[31]=o.loaders,e[32]=a,e[33]=_,e[34]=O,e[35]=L):L=e[35];let K;e[36]!==l?(K=l("sandbox.collectionsSidebar.actions"),e[36]=l,e[37]=K):K=e[37];const F=s==="actions";let D;e[38]!==o.actions||e[39]!==a||e[40]!==K||e[41]!==F?(D=n.jsx(Fe,{id:"actions",icon:Vn,label:K,count:o.actions,active:F,onSelect:a,indent:!0}),e[38]=o.actions,e[39]=a,e[40]=K,e[41]=F,e[42]=D):D=e[42];let A;e[43]!==C||e[44]!==k||e[45]!==L||e[46]!==D?(A=n.jsxs(Ua,{className:"flex flex-col gap-0.5 pt-0.5",children:[C,k,L,D]}),e[43]=C,e[44]=k,e[45]=L,e[46]=D,e[47]=A):A=e[47];let I;return e[48]!==p||e[49]!==A||e[50]!==v?(I=n.jsxs(Ha,{open:p,onOpenChange:d,children:[v,A]}),e[48]=p,e[49]=A,e[50]=v,e[51]=I):I=e[51],I}function Fe(t){const e=ae.c(19),{id:s,icon:o,label:a,count:l,active:i,onSelect:c,indent:r}=t;let d;e[0]!==s||e[1]!==c?(d=()=>c(s),e[0]=s,e[1]=c,e[2]=d):d=e[2];const p=r&&"pl-6",m=i?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let h;e[3]!==p||e[4]!==m?(h=xe("flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",p,m),e[3]=p,e[4]=m,e[5]=h):h=e[5];let u;e[6]!==o?(u=n.jsx(o,{size:16,className:"shrink-0"}),e[6]=o,e[7]=u):u=e[7];let f;e[8]!==a?(f=n.jsx("span",{className:"flex-1 truncate",children:a}),e[8]=a,e[9]=f):f=e[9];let x;e[10]!==i||e[11]!==l?(x=l!==void 0&&n.jsx("span",{className:xe("shrink-0 text-xs tabular-nums",i?"text-accent-foreground/70":"text-muted-foreground/70"),children:l}),e[10]=i,e[11]=l,e[12]=x):x=e[12];let g;return e[13]!==d||e[14]!==h||e[15]!==u||e[16]!==f||e[17]!==x?(g=n.jsxs("button",{type:"button",onClick:d,className:h,children:[u,f,x]}),e[13]=d,e[14]=h,e[15]=u,e[16]=f,e[17]=x,e[18]=g):g=e[18],g}function Cl(t){const e=ae.c(12),{state:s,claimPhase:o,lifecycle:a,onStart:l,connectionsHref:i}=t;switch(s.kind){case"starting":{let c;e[0]!==o||e[1]!==a?(c=na({claimPhase:o,lifecycle:a}),e[0]=o,e[1]=a,e[2]=c):c=e[2];let r;return e[3]!==o||e[4]!==c?(r=n.jsx(us,{kind:"starting",progress:c,claimPhase:o}),e[3]=o,e[4]=c,e[5]=r):r=e[5],r}case"suspended":{let c;return e[6]!==l?(c=n.jsx(us,{kind:"suspended",onResume:l}),e[6]=l,e[7]=c):c=e[7],c}case"errored":{let c;return e[8]!==i||e[9]!==l||e[10]!==s.error?(c=n.jsx(us,{kind:"errored",error:s.error,onRetry:l,connectionsHref:i}),e[8]=i,e[9]=l,e[10]=s.error,e[11]=c):c=e[11],c}}}const Pl=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Tl(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Pl.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function qs(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),o=`${s} (copy)`;if(!t.has(o))return o;for(let a=2;a<1e3;a++){const l=`${s} (copy ${a})`;if(!t.has(l))return l}return`${s} (copy ${Date.now()})`}function Bl(t,e){const s=It,o=e.replace(/-copy(?:-\d+)?$/,""),a=`${o}-copy`;if(!t.has(s(a)))return a;for(let l=2;l<1e3;l++){const i=`${o}-copy-${l}`;if(!t.has(s(i)))return i}return`${o}-copy-${Date.now()}`}function El(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),o=`${s}_copy`;if(!Object.hasOwn(t,o))return o;for(let a=2;a<1e3;a++){const l=`${s}_copy_${a}`;if(!Object.hasOwn(t,l))return l}return`${s}_copy_${Date.now()}`}function Dl(t){const e=$n(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function _l(t,e){return oa(t,e)}const Al=1e3;function $l(t,e){for(let s=0;s<Al;s++){const o=$n(e);if(!Object.hasOwn(t,o))return o}throw new Error("Could not generate a unique page block key")}const Ll={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Ol={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Il={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Rl(t){const e=ae.c(88),{open:s,mode:o,initialName:a,initialPath:l,isPending:i,error:c,templates:r,validate:d,onSubmit:p,onOpenChange:m}=t,h=i===void 0?!1:i,u=Ne(),[f,x]=$.useState(a),[g,y]=$.useState(l),[v,j]=$.useState(ms),[w,C]=$.useState(null),[E,B]=$.useState(s);s!==E&&(B(s),s&&(x(a),y(l),j(ms),C(null)));const k=o==="create"&&!!r?.length;let _;e[0]!==h||e[1]!==m?(_=pe=>{!pe&&!h&&(C(null),m(!1))},e[0]=h,e[1]=m,e[2]=_):_=e[2];const O=_;let L;e[3]!==h||e[4]!==f||e[5]!==p||e[6]!==g||e[7]!==k||e[8]!==v||e[9]!==d?(L=async pe=>{pe.preventDefault();const ke=f.trim(),he=g.trim();if(!ke||!he||h)return;const je=Ea(he);if(je){C(je);return}const Se=d?.({name:ke,path:he});if(Se){C(Se);return}C(null),await p({name:ke,path:he,templateKey:k&&v!==ms?v:null})},e[3]=h,e[4]=f,e[5]=p,e[6]=g,e[7]=k,e[8]=v,e[9]=d,e[10]=L):L=e[10];const K=L,F=w??c,D=Ll[o];let A;e[11]!==u||e[12]!==D?(A=u(D),e[11]=u,e[12]=D,e[13]=A):A=e[13];let I;e[14]!==A?(I=n.jsx(gt,{children:n.jsx(ct,{children:A})}),e[14]=A,e[15]=I):I=e[15];let R;e[16]!==h||e[17]!==k||e[18]!==u||e[19]!==v||e[20]!==r?(R=k&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:u("sandbox.pageFormDialog.labelTemplate")}),n.jsx(aa,{id:"page-form-template",value:v,onChange:j,templates:r??[],disabled:h})]}),e[16]=h,e[17]=k,e[18]=u,e[19]=v,e[20]=r,e[21]=R):R=e[21];let V;e[22]!==u?(V=u("sandbox.pageFormDialog.labelName"),e[22]=u,e[23]=V):V=e[23];let z;e[24]!==V?(z=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:V}),e[24]=V,e[25]=z):z=e[25];let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=pe=>x(pe.target.value),e[26]=W):W=e[26];let P;e[27]!==u?(P=u("sandbox.pageFormDialog.placeholderName"),e[27]=u,e[28]=P):P=e[28];let U;e[29]!==h||e[30]!==f||e[31]!==P?(U=n.jsx(Ze,{id:"page-form-name",value:f,onChange:W,placeholder:P,autoFocus:!0,disabled:h}),e[29]=h,e[30]=f,e[31]=P,e[32]=U):U=e[32];let Y;e[33]!==U||e[34]!==z?(Y=n.jsxs("div",{className:"space-y-1.5",children:[z,U]}),e[33]=U,e[34]=z,e[35]=Y):Y=e[35];let J;e[36]!==u?(J=u("sandbox.pageFormDialog.labelPath"),e[36]=u,e[37]=J):J=e[37];let X;e[38]!==J?(X=n.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:J}),e[38]=J,e[39]=X):X=e[39];let ce;e[40]===Symbol.for("react.memo_cache_sentinel")?(ce=pe=>y(pe.target.value),e[40]=ce):ce=e[40];let ne;e[41]!==u?(ne=u("sandbox.pageFormDialog.placeholderPath"),e[41]=u,e[42]=ne):ne=e[42];let de;e[43]!==h||e[44]!==g||e[45]!==ne?(de=n.jsx(Ze,{id:"page-form-path",value:g,onChange:ce,placeholder:ne,disabled:h}),e[43]=h,e[44]=g,e[45]=ne,e[46]=de):de=e[46];let te;e[47]!==X||e[48]!==de?(te=n.jsxs("div",{className:"space-y-1.5",children:[X,de]}),e[47]=X,e[48]=de,e[49]=te):te=e[49];let re;e[50]!==F?(re=F&&n.jsx("p",{className:"text-xs text-destructive",children:F}),e[50]=F,e[51]=re):re=e[51];let le;e[52]!==Y||e[53]!==te||e[54]!==re||e[55]!==R?(le=n.jsxs("div",{className:"space-y-4 py-4",children:[R,Y,te,re]}),e[52]=Y,e[53]=te,e[54]=re,e[55]=R,e[56]=le):le=e[56];let N;e[57]!==m?(N=()=>m(!1),e[57]=m,e[58]=N):N=e[58];let q;e[59]!==u?(q=u("sandbox.pageFormDialog.buttonCancel"),e[59]=u,e[60]=q):q=e[60];let Z;e[61]!==h||e[62]!==N||e[63]!==q?(Z=n.jsx(Be,{type:"button",variant:"outline",onClick:N,disabled:h,children:q}),e[61]=h,e[62]=N,e[63]=q,e[64]=Z):Z=e[64];let oe;e[65]!==h||e[66]!==f||e[67]!==g?(oe=!f.trim()||!g.trim()||h,e[65]=h,e[66]=f,e[67]=g,e[68]=oe):oe=e[68];let S;e[69]!==h||e[70]!==o||e[71]!==u?(S=h?n.jsxs(n.Fragment,{children:[n.jsx(rt,{className:"size-3.5"}),u(Il[o])]}):u(Ol[o]),e[69]=h,e[70]=o,e[71]=u,e[72]=S):S=e[72];let se;e[73]!==oe||e[74]!==S?(se=n.jsx(Be,{type:"submit",disabled:oe,children:S}),e[73]=oe,e[74]=S,e[75]=se):se=e[75];let H;e[76]!==Z||e[77]!==se?(H=n.jsxs(xt,{children:[Z,se]}),e[76]=Z,e[77]=se,e[78]=H):H=e[78];let ie;e[79]!==K||e[80]!==le||e[81]!==H||e[82]!==I?(ie=n.jsx(dt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:K,children:[I,le,H]})}),e[79]=K,e[80]=le,e[81]=H,e[82]=I,e[83]=ie):ie=e[83];let ye;return e[84]!==O||e[85]!==s||e[86]!==ie?(ye=n.jsx(ut,{open:s,onOpenChange:O,children:ie}),e[84]=O,e[85]=s,e[86]=ie,e[87]=ye):ye=e[87],ye}const Fl=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],Ws={from:"",to:"",type:"temporary",discardQueryParameters:!1};function Kl(t){const e=ae.c(111),{open:s,isPending:o,error:a,onSubmit:l,onOpenChange:i}=t,c=o===void 0?!1:o,r=Ne(),[d,p]=$.useState(Ws),[m,h]=$.useState(null),[u,f]=$.useState(s);s!==u&&(f(s),s&&(p(Ws),h(null)));let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=ge=>p($e=>({...$e,...ge})),e[0]=x):x=e[0];const g=x;let y;e[1]!==c||e[2]!==i?(y=ge=>{!ge&&!c&&(h(null),i(!1))},e[1]=c,e[2]=i,e[3]=y):y=e[3];const v=y;let j;e[4]!==c||e[5]!==l||e[6]!==d||e[7]!==r?(j=async ge=>{ge.preventDefault();const $e=d.from.trim(),Le=d.to.trim();if(!$e||!Le||c){h(r("sandbox.redirectFormDialog.errorRequired"));return}h(null),await l({...d,from:$e,to:Le})},e[4]=c,e[5]=l,e[6]=d,e[7]=r,e[8]=j):j=e[8];const w=j,C=m??a;let E;e[9]!==c||e[10]!==d.from||e[11]!==d.to?(E=!!d.from.trim()&&!!d.to.trim()&&!c,e[9]=c,e[10]=d.from,e[11]=d.to,e[12]=E):E=e[12];const B=E;let k;e[13]!==r?(k=r("sandbox.redirectFormDialog.title"),e[13]=r,e[14]=k):k=e[14];let _;e[15]!==k?(_=n.jsx(gt,{children:n.jsx(ct,{children:k})}),e[15]=k,e[16]=_):_=e[16];let O;e[17]!==r?(O=r("sandbox.redirectEditor.fromLabel"),e[17]=r,e[18]=O):O=e[18];let L;e[19]!==O?(L=n.jsx(ze,{htmlFor:"redirect-form-from",children:O}),e[19]=O,e[20]=L):L=e[20];const K=d.from;let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F=ge=>g({from:ge.target.value}),e[21]=F):F=e[21];let D;e[22]!==r?(D=r("sandbox.redirectEditor.fromPlaceholder"),e[22]=r,e[23]=D):D=e[23];let A;e[24]!==c||e[25]!==d.from||e[26]!==D?(A=n.jsx(Ze,{id:"redirect-form-from",value:K,onChange:F,placeholder:D,autoFocus:!0,disabled:c}),e[24]=c,e[25]=d.from,e[26]=D,e[27]=A):A=e[27];let I;e[28]!==A||e[29]!==L?(I=n.jsxs("div",{className:"space-y-1.5",children:[L,A]}),e[28]=A,e[29]=L,e[30]=I):I=e[30];let R;e[31]!==r?(R=r("sandbox.redirectEditor.toLabel"),e[31]=r,e[32]=R):R=e[32];let V;e[33]!==R?(V=n.jsx(ze,{htmlFor:"redirect-form-to",children:R}),e[33]=R,e[34]=V):V=e[34];const z=d.to;let W;e[35]===Symbol.for("react.memo_cache_sentinel")?(W=ge=>g({to:ge.target.value}),e[35]=W):W=e[35];let P;e[36]!==r?(P=r("sandbox.redirectEditor.toPlaceholder"),e[36]=r,e[37]=P):P=e[37];let U;e[38]!==c||e[39]!==d.to||e[40]!==P?(U=n.jsx(Ze,{id:"redirect-form-to",value:z,onChange:W,placeholder:P,disabled:c}),e[38]=c,e[39]=d.to,e[40]=P,e[41]=U):U=e[41];let Y;e[42]!==V||e[43]!==U?(Y=n.jsxs("div",{className:"space-y-1.5",children:[V,U]}),e[42]=V,e[43]=U,e[44]=Y):Y=e[44];let J;e[45]!==r?(J=r("sandbox.redirectEditor.typeLabel"),e[45]=r,e[46]=J):J=e[46];let X;e[47]!==J?(X=n.jsx(ze,{htmlFor:"redirect-form-type",children:J}),e[47]=J,e[48]=X):X=e[48];const ce=d.type;let ne;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=ge=>g({type:ge}),e[49]=ne):ne=e[49];let de;e[50]!==r?(de=r("sandbox.redirectEditor.typePlaceholder"),e[50]=r,e[51]=de):de=e[51];let te;e[52]!==de?(te=n.jsx(Qa,{id:"redirect-form-type",className:"w-full",children:n.jsx(Xa,{placeholder:de})}),e[52]=de,e[53]=te):te=e[53];let re;e[54]!==r?(re=Fl.map(ge=>n.jsx(Ya,{value:ge.value,children:r(ge.labelKey,{status:Kn[ge.value]})},ge.value)),e[54]=r,e[55]=re):re=e[55];let le;e[56]!==re?(le=n.jsx(Za,{children:re}),e[56]=re,e[57]=le):le=e[57];let N;e[58]!==c||e[59]!==d.type||e[60]!==te||e[61]!==le?(N=n.jsxs(el,{value:ce,onValueChange:ne,disabled:c,children:[te,le]}),e[58]=c,e[59]=d.type,e[60]=te,e[61]=le,e[62]=N):N=e[62];let q;e[63]!==X||e[64]!==N?(q=n.jsxs("div",{className:"space-y-1.5",children:[X,N]}),e[63]=X,e[64]=N,e[65]=q):q=e[65];let Z;e[66]===Symbol.for("react.memo_cache_sentinel")?(Z=ge=>g({discardQueryParameters:ge===!0}),e[66]=Z):Z=e[66];let oe;e[67]!==c||e[68]!==d.discardQueryParameters?(oe=n.jsx(es,{checked:d.discardQueryParameters,disabled:c,onCheckedChange:Z}),e[67]=c,e[68]=d.discardQueryParameters,e[69]=oe):oe=e[69];let S;e[70]!==r?(S=r("sandbox.redirectEditor.discardQueryParameters"),e[70]=r,e[71]=S):S=e[71];let se;e[72]!==S?(se=n.jsx("span",{className:"text-sm",children:S}),e[72]=S,e[73]=se):se=e[73];let H;e[74]!==oe||e[75]!==se?(H=n.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[oe,se]}),e[74]=oe,e[75]=se,e[76]=H):H=e[76];let ie;e[77]!==C?(ie=C&&n.jsx("p",{className:"text-xs text-destructive",children:C}),e[77]=C,e[78]=ie):ie=e[78];let ye;e[79]!==I||e[80]!==Y||e[81]!==q||e[82]!==H||e[83]!==ie?(ye=n.jsxs("div",{className:"space-y-4 py-4",children:[I,Y,q,H,ie]}),e[79]=I,e[80]=Y,e[81]=q,e[82]=H,e[83]=ie,e[84]=ye):ye=e[84];let pe;e[85]!==i?(pe=()=>i(!1),e[85]=i,e[86]=pe):pe=e[86];let ke;e[87]!==r?(ke=r("sandbox.redirectFormDialog.cancel"),e[87]=r,e[88]=ke):ke=e[88];let he;e[89]!==c||e[90]!==pe||e[91]!==ke?(he=n.jsx(Be,{type:"button",variant:"outline",onClick:pe,disabled:c,children:ke}),e[89]=c,e[90]=pe,e[91]=ke,e[92]=he):he=e[92];const je=!B;let Se;e[93]!==c||e[94]!==r?(Se=c?n.jsxs(n.Fragment,{children:[n.jsx(rt,{className:"size-3.5"}),r("sandbox.redirectFormDialog.pending")]}):r("sandbox.redirectFormDialog.submit"),e[93]=c,e[94]=r,e[95]=Se):Se=e[95];let Ae;e[96]!==je||e[97]!==Se?(Ae=n.jsx(Be,{type:"submit",disabled:je,children:Se}),e[96]=je,e[97]=Se,e[98]=Ae):Ae=e[98];let Ce;e[99]!==he||e[100]!==Ae?(Ce=n.jsxs(xt,{children:[he,Ae]}),e[99]=he,e[100]=Ae,e[101]=Ce):Ce=e[101];let Pe;e[102]!==w||e[103]!==ye||e[104]!==Ce||e[105]!==_?(Pe=n.jsx(dt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[_,ye,Ce]})}),e[102]=w,e[103]=ye,e[104]=Ce,e[105]=_,e[106]=Pe):Pe=e[106];let _e;return e[107]!==v||e[108]!==s||e[109]!==Pe?(_e=n.jsx(ut,{open:s,onOpenChange:v,children:Pe}),e[107]=v,e[108]=s,e[109]=Pe,e[110]=_e):_e=e[110],_e}function zl(t){const e=ae.c(70),{open:s,blockKey:o,initialName:a,isPending:l,onSubmit:i,onOpenChange:c}=t,r=l===void 0?!1:l,d=Ne(),[p,m]=$.useState(a),[h,u]=$.useState(s);s!==h&&(u(s),s&&m(a));let f;e[0]!==r||e[1]!==c?(f=ce=>{!ce&&!r&&c(!1)},e[0]=r,e[1]=c,e[2]=f):f=e[2];const x=f;let g;e[3]!==r||e[4]!==p||e[5]!==i?(g=async ce=>{ce.preventDefault();const ne=p.trim();!ne||r||await i(ne)},e[3]=r,e[4]=p,e[5]=i,e[6]=g):g=e[6];const y=g;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let j;e[9]!==v?(j=n.jsx(ct,{children:v}),e[9]=v,e[10]=j):j=e[10];let w;e[11]!==d?(w=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=w):w=e[12];let C;e[13]!==w?(C=n.jsx(Vt,{children:w}),e[13]=w,e[14]=C):C=e[14];let E;e[15]!==j||e[16]!==C?(E=n.jsxs(gt,{children:[j,C]}),e[15]=j,e[16]=C,e[17]=E):E=e[17];let B;e[18]!==d?(B=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=B):B=e[19];let k;e[20]!==B?(k=n.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:B}),e[20]=B,e[21]=k):k=e[21];let _;e[22]===Symbol.for("react.memo_cache_sentinel")?(_=ce=>m(ce.target.value),e[22]=_):_=e[22];let O;e[23]!==r||e[24]!==p?(O=n.jsx(Ze,{id:"section-rename-name",value:p,onChange:_,autoFocus:!0,disabled:r}),e[23]=r,e[24]=p,e[25]=O):O=e[25];let L;e[26]!==k||e[27]!==O?(L=n.jsxs("div",{className:"space-y-1.5",children:[k,O]}),e[26]=k,e[27]=O,e[28]=L):L=e[28];let K;e[29]!==d?(K=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=K):K=e[30];let F;e[31]!==K?(F=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:K}),e[31]=K,e[32]=F):F=e[32];let D;e[33]!==o?(D=n.jsx(Ze,{value:o,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=o,e[34]=D):D=e[34];let A;e[35]!==F||e[36]!==D?(A=n.jsxs("div",{className:"space-y-1.5",children:[F,D]}),e[35]=F,e[36]=D,e[37]=A):A=e[37];let I;e[38]!==L||e[39]!==A?(I=n.jsxs("div",{className:"space-y-4 py-4",children:[L,A]}),e[38]=L,e[39]=A,e[40]=I):I=e[40];let R;e[41]!==c?(R=()=>c(!1),e[41]=c,e[42]=R):R=e[42];let V;e[43]!==d?(V=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=V):V=e[44];let z;e[45]!==r||e[46]!==R||e[47]!==V?(z=n.jsx(Be,{type:"button",variant:"outline",onClick:R,disabled:r,children:V}),e[45]=r,e[46]=R,e[47]=V,e[48]=z):z=e[48];let W;e[49]!==r||e[50]!==p?(W=!p.trim()||r,e[49]=r,e[50]=p,e[51]=W):W=e[51];let P;e[52]!==r||e[53]!==d?(P=r?n.jsxs(n.Fragment,{children:[n.jsx(rt,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=r,e[53]=d,e[54]=P):P=e[54];let U;e[55]!==W||e[56]!==P?(U=n.jsx(Be,{type:"submit",disabled:W,children:P}),e[55]=W,e[56]=P,e[57]=U):U=e[57];let Y;e[58]!==z||e[59]!==U?(Y=n.jsxs(xt,{children:[z,U]}),e[58]=z,e[59]=U,e[60]=Y):Y=e[60];let J;e[61]!==y||e[62]!==I||e[63]!==Y||e[64]!==E?(J=n.jsx(dt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:y,children:[E,I,Y]})}),e[61]=y,e[62]=I,e[63]=Y,e[64]=E,e[65]=J):J=e[65];let X;return e[66]!==x||e[67]!==s||e[68]!==J?(X=n.jsx(ut,{open:s,onOpenChange:x,children:J}),e[66]=x,e[67]=s,e[68]=J,e[69]=X):X=e[69],X}function Ml(t){const e=ae.c(7),{type:s}=t,o=Kn[s];let a;e[0]!==o?(a=n.jsx(Ye,{asChild:!0,children:n.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:o})}),e[0]=o,e[1]=a):a=e[1];const l=s==="permanent"?"Permanent":"Temporary";let i;e[2]!==l?(i=n.jsx(Qe,{side:"left",children:l}),e[2]=l,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=n.jsxs(Xe,{children:[a,i]}),e[4]=a,e[5]=i,e[6]=c):c=e[6],c}const Vl=60,ps={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Bs=["posts","authors","categories"],Pt={posts:"post",authors:"author",categories:"category"};function lt(t){return Bs.includes(t)}const ss={posts:"post",authors:"author",categories:"category"},Qn={posts:ps.post,authors:ps.author,categories:ps.category},Gl=Object.fromEntries(Object.entries(Qn).map(([t,e])=>[e,t]));function Ul(t){return typeof t=="string"?Gl[t]??null:null}function Re(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ee(t){return typeof t=="string"?t:""}function Hl(t,e){switch(t){case"posts":return{label:ee(e.title)||"Untitled post",subtitle:ee(e.slug)};case"authors":return{label:ee(e.name)||"Unnamed author",subtitle:ee(e.email)};case"categories":return{label:ee(e.name)||"Unnamed category",subtitle:ee(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Xn(t){const e={posts:[],authors:[],categories:[]};for(const[s,o]of Object.entries(t)){const a=Re(o);if(!a)continue;const l=Ul(a.__resolveType);if(!l)continue;const i=Re(a[ss[l]])??{},{label:c,subtitle:r}=Hl(l,i);e[l].push({key:s,kind:l,label:c,subtitle:r})}for(const s of Bs)e[s].sort((o,a)=>o.label.localeCompare(a.label));return e}function Jl(t,e){return Xn(t)[e]}function Ge(t,e){return Jl(t,e).map(s=>({key:s.key,payload:mt(Re(t[s.key])??void 0,e)}))}const Ys=Object.freeze({});function mt(t,e){return t?Re(t[ss[e]])??Ys:Ys}function it(t,e,s){return{name:t,__resolveType:Qn[e],[ss[e]]:s}}function dd({records:t,selected:e,valueField:s,toRef:o}){const a=Array.isArray(e)?e:[],l=h=>typeof h=="string"?h:ee(Re(h)?.[s]),i=h=>typeof h=="string"?h:ee(Re(h)?.name),c=h=>{const u=l(h),f=u?t.find(({payload:g})=>ee(g[s])===u):void 0;if(f)return f;const x=i(h);return x?t.find(({payload:g})=>ee(g.name)===x):void 0},r=t.map(({key:h,payload:u})=>({value:h,label:ee(u.name)||ee(u[s])||h})),d=new Map,p=[];return a.forEach((h,u)=>{const f=c(h);if(f){p.includes(f.key)||p.push(f.key);return}const x=`unresolved:${u}`;d.set(x,h),p.push(x),r.push({value:x,label:i(h)||l(h)||"Unknown"})}),{options:r,selectedValues:p,refsForValues:h=>h.map(u=>{const f=t.find(x=>x.key===u);return f?o(f.payload):d.get(u)}).filter(u=>u!==void 0)}}function et(t){return Array.isArray(t)?t:[]}function nt(t){if(typeof t=="string")return t;const e=Re(t);return e?ee(e.slug):""}function Zn(t){if(typeof t=="string")return t;const e=Re(t);return e?ee(e.email):""}function Es(t){const e=[];return ee(t.title).trim()||e.push("Title"),ee(t.slug).trim()||e.push("Slug"),et(t.categories).map(nt).filter(Boolean).length===0&&e.push("Category"),ee(t.excerpt).trim()||e.push("Excerpt"),ee(t.image).trim()||e.push("Cover image"),e}const Ds=["draft","generating","awaiting_review","scheduled","published","archived"],eo=8;function _t(t){switch(ee(t.status)){case"draft":case"idea":return"draft";case"generating":return"generating";case"awaiting_review":case"in_review":return"awaiting_review";case"scheduled":return"scheduled";case"published":return"published";case"archived":return"archived";case"":return"published";default:return"awaiting_review"}}function ql(t,e){return e!=="published"&&e!=="scheduled"||_t(t)===e?!1:Es(t).length>0}function Wl(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,eo).toISOString()}function Gt(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const o=ee(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(o).getTime())?Wl(s):o}}function to(t){return Ge(t,"posts").map(({key:e,payload:s})=>({key:e,title:ee(s.title)||"Untitled post",slug:ee(s.slug),date:ee(s.date),scheduledDatetime:ee(s.scheduledDatetime),categorySlugs:et(s.categories).map(nt).filter(Boolean),authorEmails:et(s.authors).map(Zn).filter(Boolean),missing:Es(s),status:_t(s),form:"live"}))}const so="blog-manager/posts/";function no(t){return t.startsWith(so)}function Tt(t){return t.split("/").pop()??t}function Ut(t){return`${so}${t}`}function Yl(t){return`collections/blog/posts/${t}`}function bs(){return bt(12)}function Ql(t){const e=Re(t.planning)??{},s=Re(e.format);return{ideaKey:ee(e.ideaKey)||void 0,pillarKey:ee(e.pillarKey)||void 0,pillarTitle:ee(e.pillarTitle)||void 0,format:s?{name:ee(s.name),value:ee(s.value)}:void 0,brief:ee(e.brief)||void 0}}function oo(t){return{title:t.title,slug:"",excerpt:"",date:t.now.toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[],status:"draft",planning:t.planning??{}}}function ft(t,e){return{name:t,[ss.posts]:e}}function ud(t,e){return no(t)?ft(t,e):it(t,"posts",e)}function Xl(t){const e=[];for(const[s,o]of Object.entries(t)){if(!no(s))continue;const a=Re(o);a&&e.push({key:s,payload:mt(a,"posts")})}return e}function Zl(t){return[...Xl(t).map(({key:s,payload:o})=>({key:s,title:ee(o.title)||"Untitled post",slug:ee(o.slug),date:ee(o.date),scheduledDatetime:ee(o.scheduledDatetime),categorySlugs:et(o.categories).map(nt).filter(Boolean),authorEmails:et(o.authors).map(Zn).filter(Boolean),missing:Es(o),status:_t(o),form:"planning"})),...to(t)]}function ei(t,e,s){const o=Gt(t.payload,e,s),a=Tt(t.key),l=e==="scheduled"||e==="published"?"live":"planning",i=l==="live"?Yl(a):Ut(a),c=l==="live"?it(i,"posts",o):ft(i,o);return{writes:{[i]:c},deletes:i===t.key?[]:[t.key]}}function md(t,e,s){const o=et(t.categories);if(!o.some(c=>nt(c)===e))return t;const a=o.map(c=>{const r=nt(c);return r===e||r===s.slug?{name:s.name,slug:s.slug}:c}),l=new Set,i=a.filter(c=>{const r=nt(c);return r?l.has(r)?!1:(l.add(r),!0):!0});return{...t,categories:i}}function ti(t,e){const s=et(t.categories);return s.some(o=>nt(o)===e)?{...t,categories:s.filter(o=>nt(o)!==e)}:t}function si(t){const e=ee(t.status),s=e==="idea"||e==="in_review"?{status:_t(t)}:{};return{...t,...s,dateModified:new Date().toISOString()}}function bt(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function hs(t,e){const s=`collections/blog/${e}/${bt(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function ao(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${bt(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${bt(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const ni={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},Qs="Box";function oi(t){return t.startsWith("site/")?"site":"app"}function ai(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function kt(...t){for(const e of t)if(e!==void 0)return e}function Xs(t){if(t&&!(t.includes("/")||/\.(tsx?|jsx?)$/.test(t)))return t}function li(t){const e=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():t}function lo(t){const e=new Set,s=[],o=t.manifest?.blocks??{};for(const a of Object.values(o))for(const l of Object.keys(a)){if(!ri(l)||e.has(l))continue;e.add(l);const i=Ns(l,t),c=ns(l),r=ni[c],d=oi(l),p=Xs(i.title),m=Xs(i.description),h=(d==="site"?kt(p,r?.title):kt(r?.title,p))??li(c),u=d==="site"?kt(m,r?.description):kt(r?.description,m),f=d==="site"?i.icon:void 0,x=f&&ai(f)?f:void 0,g=x!==void 0?r?.iconName??Qs:kt(f,r?.iconName)??Qs;s.push({resolveType:l,title:h,description:u,iconName:g,iconUrl:x,source:d})}return s.sort((a,l)=>a.title.localeCompare(l.title))}function ns(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const ii=["blog/sections/blocks/","site/sections/Blog/Post/"];function ri(t){return ii.some(e=>t.startsWith(e))}const _s="blog-manager-brand";function Ke(t){if(!Array.isArray(t))return[];const e=[];for(const s of t){if(typeof s=="string"){s.trim()&&e.push({name:s,value:""});continue}const o=Re(s);o&&e.push({name:ee(o.name),value:ee(o.value)})}return e}function Me(t){return t.filter(e=>e.name.trim()||e.value.trim())}const ci=6e4,di=4e3;function ui(t){const e=[],s=new Set,o=(a,l)=>{if(typeof a=="string"){if(!a.includes(" ")||a.length<4||/^(https?:)?\/\//.test(a)||/^data:/.test(a))return;const i=`${l}: ${a.trim()}`;if(s.has(i))return;s.add(i),e.push(i);return}if(Array.isArray(a)){for(const i of a)o(i,l);return}if(a&&typeof a=="object")for(const[i,c]of Object.entries(a))i!=="__resolveType"&&o(c,i)};return o(t,"block"),e.join(`
3
- `)}function fd(t,e){const s=new Map,o=d=>{const p=s.get(d);if(p!==void 0)return p;const m=ui(t[d]).slice(0,di);return s.set(d,m),m},a=(d,p)=>o(p).length-o(d).length,l=[...Ge(t,"posts").map(d=>d.key).sort(a),...Ge(t,"categories").map(d=>d.key),...[...e].sort(a)],i=[],c=new Set;let r=ci;for(const d of l){if(i.length>=Vl)break;if(c.has(d)||!t[d])continue;c.add(d);const p=o(d);if(p.length>r)break;i.push({key:d,content:p}),r-=p.length}return i}const io="blog-manager/themes/";function mi(){return`${io}${crypto.randomUUID()}`}function fi(t,e){return{name:t,title:e.title,body:e.body,pillarKey:e.pillarKey??"",createdAt:e.createdAt}}function ro(t){const e=[];for(const[s,o]of Object.entries(t)){if(!s.startsWith(io))continue;const a=Re(o);a&&e.push({key:s,title:ee(a.title),body:ee(a.body),pillarKey:ee(a.pillarKey)||void 0,createdAt:ee(a.createdAt)})}return e.sort((s,o)=>o.createdAt.localeCompare(s.createdAt)||s.title.localeCompare(o.title))}const co="blog-manager/pillars/";function pd(){return`${co}${crypto.randomUUID()}`}function uo(t){const e=[];for(const[s,o]of Object.entries(t)){if(!s.startsWith(co))continue;const a=Re(o);a&&e.push({key:s,title:ee(a.title),body:ee(a.body),createdAt:ee(a.createdAt),formats:et(a.formats).map(l=>ee(l)).filter(Boolean)})}return e.sort((s,o)=>o.createdAt.localeCompare(s.createdAt)||s.title.localeCompare(o.title))}const mo="blog-manager-formats",pi=40;function hd(t){return Ge(t,"posts").slice(0,pi).map(({key:e,payload:s})=>({key:e,title:ee(s.title),sections:et(s.sections).map(o=>ee(Re(o)?.__resolveType)).filter(Boolean).map(ns)}))}function hi(t){const e=new Map;for(const s of lo(t)){const o=ns(s.resolveType);e.has(o)||e.set(o,{name:o,title:s.title,description:s.description})}return[...e.values()]}function gi(t){const e=new Set;for(const s of t.matchAll(/(?:^|[\s([{>])@([A-Za-z][\w-]*)/g))s[1]&&e.add(s[1]);return[...e]}function gd(t,e){const s=new Set(e);return gi(t).filter(o=>!s.has(o))}const xi=["Heading","Paragraph","BlockImage","List","Cta"];function xd(t){const e=new Set(t);return xi.filter(s=>e.has(s))}function Zs(t){return t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().replace(/\s+/g," ").trim()}function bi(t,e){const s=new Set(t.map(Zs)),o=[];for(const a of e){const l=Zs(a.title);!l||s.has(l)||(s.add(l),o.push(a))}return o}const yi=["companyName","language","description","tone","targetAudience"];function vi(t){const e=Re(t)??{},s=[];for(const o of yi)ee(e[o]).trim()||s.push(o);return Me(Ke(e.dos)).length===0&&s.push("dos"),Me(Ke(e.avoid)).length===0&&s.push("avoid"),s}function fo(t){const e={};for(const s of lo(t)){const o=ns(s.resolveType);o in e||(e[o]=s.resolveType)}return e}function ji(t,e){const s=[];for(const o of t){const a=e[o.type];if(a)switch(o.type){case"Heading":s.push({__resolveType:a,text:ee(o.text),level:o.level??"2"});break;case"Paragraph":s.push({__resolveType:a,html:ee(o.html)});break;case"List":s.push({__resolveType:a,items:(o.items??[]).join(`
4
- `),style:o.style??"unordered"});break;case"Quote":s.push({__resolveType:a,quote:ee(o.quote)});break;case"Callout":s.push({__resolveType:a,title:ee(o.title),body:ee(o.body),variant:o.variant??"info"});break;case"Cta":s.push({__resolveType:a,text:ee(o.text),href:ee(o.href)});break;case"Divider":s.push({__resolveType:a});break}}return s}function po(t){return t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function ho(t,e){const s=po(t)||`post-${bt(6)}`,o=new Set(e);if(!o.has(s))return s;for(let a=2;a<100;a++){const l=`${s}-${a}`;if(!o.has(l))return l}return`${s}-${bt(4)}`}function ki({draft:t,resolveTypes:e,categories:s,authors:o,planning:a,takenSlugs:l,now:i}){const c=new Set(t.categorySlugs),r=new Set(t.authorEmails),d={title:t.title,slug:ho(t.title,l),date:i.toISOString().slice(0,10),excerpt:t.excerpt,image:"",alt:"",authors:o.filter(p=>r.has(p.email)),categories:s.filter(p=>c.has(p.slug)),seo:{title:t.seo.title,description:t.seo.description,image:""},sections:ji(t.sections,e),planning:a??{}};return Gt(d,"awaiting_review",i)}const bd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],yd=["January","February","March","April","May","June","July","August","September","October","November","December"],go=1440*60*1e3;function pt(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function vd(t){return new Date(t.getFullYear(),t.getMonth(),1)}function jd(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Ht(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function ys(t,e){return Math.round((pt(t).getTime()-pt(e).getTime())/go)}function Si(t){const e=(t.getTime()-pt(t).getTime())/go;return Math.min(Math.max(e,0),1)}function en(t,e){return ys(t,e)+Si(t)}function kd(t){const e=Ht(t,-t.getDay()),s=[];for(let o=0;o<6;o++){const a=[];for(let l=0;l<7;l++)a.push(Ht(e,o*7+l));s.push(a)}for(;s.length>0&&s[s.length-1].every(o=>o.getMonth()!==t.getMonth());)s.pop();return s}function Sd(t,e){const s=pt(t[0]),o=Ht(s,7),a=s.getTime(),l=o.getTime(),i=[];for(const d of e){const p=pt(d.start),m=pt(d.end);if(m.getTime()<s.getTime()||p.getTime()>=o.getTime())continue;const h=p.getTime()<s.getTime()?s:p,u=m.getTime()>=o.getTime()?Ht(o,-1):m,f=ys(h,s),x=ys(u,h)+1;if(x<=0)continue;const g=Math.max(d.start.getTime(),a),y=Math.min(d.end.getTime(),l),v=en(new Date(g),s),j=Math.max(en(new Date(y),s)-v,0);j<=0||i.push({variant:d,startCol:f,span:x,leftUnits:v,widthUnits:j})}i.sort((d,p)=>d.startCol-p.startCol||p.span-d.span||d.variant.blockKey.localeCompare(p.variant.blockKey));const c=[],r=[];for(const d of i){let p=c.findIndex(m=>m<=d.startCol);p===-1&&(p=c.length,c.push(0)),c[p]=d.startCol+d.span,r.push({...d,lane:p})}return r}function Jt(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const xo=/^(\d{4})-(\d{2})-(\d{2})$/;function qt(t){const e=t.trim();if(!e)return null;const s=xo.exec(e);if(s){const a=Number(s[1]),l=Number(s[2])-1,i=Number(s[3]),c=new Date(a,l,i);return c.getMonth()===l&&c.getDate()===i?c:null}const o=new Date(e);return Number.isNaN(o.getTime())?null:pt(o)}function wi(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),eo);return{...ao("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Jt(t)}}function Ni(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(xo.test(e))return qt(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Ci(t,e){const s=Ni(t.scheduledDatetime);if(!s)return null;const o=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),a={...t,scheduledDatetime:o.toISOString()};return(typeof t.date=="string"?t.date:"")===Jt(s)&&(a.date=Jt(o)),a}function Pi(t){return qt(t.scheduledDatetime)??qt(t.date)}function wd(t){const e=new Map,s=[];for(const a of t){const l={post:a,scheduled:qt(a.scheduledDatetime)!==null},i=Pi(a);if(!i){s.push(l);continue}const c=Jt(i),r=e.get(c);r?r.push(l):e.set(c,[l])}const o=(a,l)=>Number(l.scheduled)-Number(a.scheduled)||a.post.title.localeCompare(l.post.title);for(const a of e.values())a.sort(o);return s.sort(o),{byDay:e,undated:s}}const Ti="0.161.0",Bi="0.162.0",tn="7.53.0",Ei="@decocms/apps-blog";function sn(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function nn(t,e){const s=sn(t),o=sn(e);if(!s||!o)return 0;for(let a=0;a<3;a++){const l=s[a]-o[a];if(l!==0)return l}return 0}const bo=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Di(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const o=bo.exec(s)?.[1];if(o)return o}return null}function _i(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const o=s?.title;if(typeof o!="string")continue;const a=bo.exec(o)?.[1];if(a)return a}return null}function Ai(t){return vs(t?.schema?.definitions,"scheduledDatetime")}function vs(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t))return t.some(o=>vs(o,e));const s=t.properties;return s&&typeof s=="object"&&e in s?!0:Object.values(t).some(o=>vs(o,e))}function $i(t){const e=t;for(const s of[e?.dependencies,e?.devDependencies]){if(!s||typeof s!="object")continue;const o=s[Ei];if(typeof o=="string")return o}return null}function Li(t){const e=/^[\^~]?v?(\d+\.\d+\.\d+)$/.exec(t.trim());return e?e[1]:null}function Oi(t){const e=t?.packageManager,s=typeof e=="string"?e.split("@")[0]?.trim():null;return s==="pnpm"||s==="yarn"||s==="bun"?s:"npm"}function yo(t){return t==="deno"?[Ti,Bi]:[tn,tn]}function on(t,e){const[s,o]=yo(t);return!e||nn(e,s)<0?{kind:"outdated",packageManager:t,version:e}:nn(e,o)<0?{kind:"publish-only",packageManager:t,version:e}:{kind:"full",version:e}}function Ii(t){const e=_i(t.meta);if(t.denoJson.kind==="data"||e){const o=t.denoJson.kind==="data"?Di(t.denoJson.data):null;return on("deno",o??e)}if(t.packageJson.kind==="data"){const o=$i(t.packageJson.data);return o===null?{kind:"unsupported-runtime"}:on(Oi(t.packageJson.data),Li(o))}return Ai(t.meta)?{kind:"full",version:null}:t.denoJson.kind==="unavailable"||t.packageJson.kind==="unavailable"?{kind:"unknown"}:{kind:"unsupported-runtime"}}function Ri(t){return t==="deno"?"deno task update":`npx npm-check-updates -u "@decocms/*" && ${t} install`}function Fi(t){return t.kind==="publish-only"||t.kind==="full"}function Nd(t){return t.kind==="full"}function vo(t,e){if(t.kind==="full"||e!=="scheduled"&&e!=="published"||e==="published"&&Fi(t))return null;if(t.kind==="unknown")return{reason:"unknown"};if(t.kind==="unsupported-runtime")return{reason:"no-app"};const[s,o]=yo(t.packageManager);return{reason:"outdated",required:e==="scheduled"?o:s,version:t.version,command:Ri(t.packageManager)}}const an={kind:"unavailable"};function Ki(t){const e=ae.c(26),s=Ln(t.virtualMcpId),o=Dt()?.taskId??null;let a;e[0]!==s||e[1]!==t||e[2]!==o?(a=y=>({queryFn:()=>la({...t,threadId:o},xs(s,y)),staleTime:3e5}),e[0]=s,e[1]=t,e[2]=o,e[3]=a):a=e[3];const l=a;let i;e[4]!==t.branch||e[5]!==t.orgSlug||e[6]!==t.virtualMcpId?(i=Bt.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[4]=t.branch,e[5]=t.orgSlug,e[6]=t.virtualMcpId,e[7]=i):i=e[7];let c;e[8]!==l?(c=l("deno.json"),e[8]=l,e[9]=c):c=e[9];let r;e[10]!==i||e[11]!==c?(r={queryKey:i,...c},e[10]=i,e[11]=c,e[12]=r):r=e[12];const{data:d}=gs(r);let p;e[13]!==t.branch||e[14]!==t.orgSlug||e[15]!==t.virtualMcpId?(p=Bt.packageJson(t.orgSlug,t.virtualMcpId,t.branch),e[13]=t.branch,e[14]=t.orgSlug,e[15]=t.virtualMcpId,e[16]=p):p=e[16];let m;e[17]!==l?(m=l("package.json"),e[17]=l,e[18]=m):m=e[18];let h;e[19]!==p||e[20]!==m?(h={queryKey:p,...m},e[19]=p,e[20]=m,e[21]=h):h=e[21];const{data:u}=gs(h),f=d??an,x=u??an;let g;return e[22]!==t.meta||e[23]!==f||e[24]!==x?(g=Ii({denoJson:f,packageJson:x,meta:t.meta}),e[22]=t.meta,e[23]=f,e[24]=x,e[25]=g):g=e[25],g}function zi(t){const e=ae.c(37),{orgSlug:s,virtualMcpId:o,branch:a}=t,l=Co(),i=Dt()?.taskId??null,c=Ln(o),r=Gn(o).runtime==="cms";let d;e[0]!==a||e[1]!==s||e[2]!==o?(d=Bt.decofile(`${s}/${o}/${a}`),e[0]=a,e[1]=s,e[2]=o,e[3]=d):d=e[3];const p=d;let m;e[4]!==a||e[5]!==s||e[6]!==o?(m=_a(s,o,a),e[4]=a,e[5]=s,e[6]=o,e[7]=m):m=e[7];let h;e[8]!==a||e[9]!==s||e[10]!==o?(h=Da(s,o,a),e[8]=a,e[9]=s,e[10]=o,e[11]=h):h=e[11];let u;e[12]!==a||e[13]!==r||e[14]!==s||e[15]!==c||e[16]!==l||e[17]!==i||e[18]!==o?(u=async w=>{const{writes:C,deletes:E}=w,B=ia(C);if(r){const _=await Aa({orgSlug:s,virtualMcpId:o,branch:a},{set:B,delete:E});return $a(l,{orgSlug:s,virtualMcpId:o,branch:a},_),await l.invalidateQueries({queryKey:tl({orgSlug:s,virtualMcpId:o,branch:a,threadId:i})}),_}const k=`/api/${s}/sandbox/${encodeURIComponent(o)}/${encodeURIComponent(a)}`;for(const[_,O]of Object.entries(B)){const L=await fetch(`${k}/write`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:xs(c,Us(_)),content:JSON.stringify(O,null,2)})});if(!L.ok)return Ms(L,"Write")}for(const _ of E){const O=await fetch(`${k}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:xs(c,Us(_))})});if(!O.ok)return Ms(O,"Delete")}return{ok:!0}},e[12]=a,e[13]=r,e[14]=s,e[15]=c,e[16]=l,e[17]=i,e[18]=o,e[19]=u):u=e[19];let f;e[20]!==a||e[21]!==s||e[22]!==l||e[23]!==o?(f=()=>{l.invalidateQueries({queryKey:Bt.liveMeta(s,o,a)})},e[20]=a,e[21]=s,e[22]=l,e[23]=o,e[24]=f):f=e[24];let x;e[25]!==m||e[26]!==h||e[27]!==u||e[28]!==f?(x={mutationKey:m,scope:h,mutationFn:u,onSuccess:f},e[25]=m,e[26]=h,e[27]=u,e[28]=f,e[29]=x):x=e[29];const g=Po(x);let y;e[30]!==g||e[31]!==l||e[32]!==p?(y=async w=>{const C=[...Object.keys(w.writes),...w.deletes],E=l.getQueryData(p),B=new Map;for(const k of C)E&&k in E&&B.set(k,E[k]);l.setQueryData(p,k=>Mi(k,w)),l.cancelQueries({queryKey:p});try{return await g.mutateAsync(w)}catch(k){const _=k;throw l.setQueryData(p,O=>{if(!O)return O;const L={...O};for(const K of C)B.has(K)?L[K]=B.get(K):delete L[K];return L}),_}},e[30]=g,e[31]=l,e[32]=p,e[33]=y):y=e[33];const v=y;let j;return e[34]!==v||e[35]!==g.isPending?(j={move:v,isPending:g.isPending},e[34]=v,e[35]=g.isPending,e[36]=j):j=e[36],j}function Mi(t,{writes:e,deletes:s}){const o={...t??{},...e};for(const a of s)a in e||delete o[a];return o}const Wt={draft:"sandbox.postBoard.laneDraft",generating:"sandbox.postBoard.laneGenerating",awaiting_review:"sandbox.postBoard.laneAwaitingReview",scheduled:"sandbox.postBoard.laneScheduled",published:"sandbox.postBoard.lanePublished",archived:"sandbox.postBoard.laneArchived"};function jo(t,e){switch(e.reason){case"unknown":return t("sandbox.postBoard.moveUnknownApp");case"no-app":return t("sandbox.postBoard.moveNoBlogApp");case"outdated":return t("sandbox.postBoard.moveUnsupported",{required:e.required,command:e.command})}}function Vi({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,support:a,onMoved:l}){const i=Ne(),c=zi({orgSlug:t,virtualMcpId:e,branch:s}),[r,d]=$.useState(new Set),p=f=>mt(o[f],"posts"),m=(f,x,g=p(f))=>{if(x==="generating")return{kind:"not-a-target"};if(r.has(Tt(f)))return{kind:"in-flight"};const y=vo(a,x);return y?{kind:"unsupported",...y}:ql(g,x)?{kind:"incomplete"}:null},h=f=>{switch(f.kind){case"unsupported":return jo(i,f);case"incomplete":return i("sandbox.postBoard.moveBlocked");case"in-flight":return i("sandbox.postBoard.moveInFlight");case"not-a-target":return i("sandbox.postBoard.moveNotATarget");default:return String(f)}};return{apply:async(f,x,g)=>{const y=g??p(f);if(_t(y)===x)return null;const v=m(f,x,y);if(v)return v.kind!=="in-flight"&&me.error(h(v)),null;const j=Tt(f);d(E=>new Set(E).add(j));const w=ei({key:f,payload:y},x,new Date),C=Object.keys(w.writes)[0]??f;C!==f&&l?.(f,C);try{return await c.move(w),C}catch(E){return C!==f&&l?.(C,f),me.error(E instanceof Error?E.message:i("sandbox.postBoard.moveFailed")),null}finally{d(E=>{const B=new Set(E);return B.delete(j),B})}},refuse:m,reasonText:h,isMoving:f=>r.has(Tt(f))}}function Gi(t){const e=ae.c(14),{value:s,onChange:o,placeholder:a,className:l,onFocus:i,onBlur:c,onKeyDown:r,spellCheck:d,inputRef:p}=t,m=d===void 0?!0:d;let h;e[0]!==o?(h=x=>o(x.target.value),e[0]=o,e[1]=h):h=e[1];let u;e[2]!==l?(u=xe("w-full resize-none border-0 bg-transparent p-0 outline-none [field-sizing:content] placeholder:text-muted-foreground/50 focus:ring-0",l),e[2]=l,e[3]=u):u=e[3];let f;return e[4]!==p||e[5]!==c||e[6]!==i||e[7]!==r||e[8]!==a||e[9]!==m||e[10]!==h||e[11]!==u||e[12]!==s?(f=n.jsx("textarea",{ref:p,value:s,onChange:h,onInput:Ui,onFocus:i,onBlur:c,onKeyDown:r,placeholder:a,spellCheck:m,rows:1,className:u}),e[4]=p,e[5]=c,e[6]=i,e[7]=r,e[8]=a,e[9]=m,e[10]=h,e[11]=u,e[12]=s,e[13]=f):f=e[13],f}function Ui(t){const e=t.currentTarget;e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function be(t){return typeof t=="string"?t:""}function Cd(t){const e=ae.c(11);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let a;e[3]!==s?(a=xe(s,"pr-9"),e[3]=s,e[4]=a):a=e[4];let l;e[5]!==o||e[6]!==a?(l=n.jsx(Gi,{...o,className:a}),e[5]=o,e[6]=a,e[7]=l):l=e[7];let i;e[8]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Fo,{size:18,"aria-hidden":!0,className:"pointer-events-none absolute right-2 top-3 text-muted-foreground/40 transition-opacity group-hover/editable:text-muted-foreground group-focus-within/editable:text-muted-foreground"}),e[8]=i):i=e[8];let c;return e[9]!==l?(c=n.jsxs("div",{className:"group/editable relative -mx-2 rounded-md px-2 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",children:[l,i]}),e[9]=l,e[10]=c):c=e[10],c}function Pd(t){const e=ae.c(5),{label:s,onClick:o,disabled:a}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Ss,{size:13}),e[0]=l):l=e[0];let i;return e[1]!==a||e[2]!==s||e[3]!==o?(i=n.jsxs("button",{type:"button",onClick:o,disabled:a,className:"flex items-center gap-1.5 rounded-lg border border-dashed px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:border-foreground/30 hover:text-foreground disabled:opacity-40 disabled:hover:border-dashed disabled:hover:text-muted-foreground cursor-pointer",children:[l,s]}),e[1]=a,e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function Td(t){const e=ae.c(4),{label:s,onClick:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ps,{size:13}),e[0]=a):a=e[0];let l;return e[1]!==s||e[2]!==o?(l=n.jsx("button",{type:"button","aria-label":s,onClick:o,className:"flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground/60 opacity-0 transition-opacity hover:text-destructive group-hover/item:opacity-100 cursor-pointer rounded-lg",children:a}),e[1]=s,e[2]=o,e[3]=l):l=e[3],l}function Bd(t){const e=ae.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"absolute -top-9 left-0 z-10 flex items-center gap-0.5 rounded-md border bg-popover p-0.5 shadow-md",children:s}),e[0]=s,e[1]=o):o=e[1],o}function Ed(t){const e=ae.c(8),{active:s,label:o,onClick:a,children:l}=t,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let c;e[0]!==i?(c=xe("flex h-7 min-w-7 items-center justify-center px-1.5 text-sm transition-colors cursor-pointer rounded-lg",i),e[0]=i,e[1]=c):c=e[1];let r;return e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==a||e[6]!==c?(r=n.jsx("button",{type:"button","aria-label":o,"aria-pressed":s,onMouseDown:Hi,onClick:a,className:c,children:l}),e[2]=s,e[3]=l,e[4]=o,e[5]=a,e[6]=c,e[7]=r):r=e[7],r}function Hi(t){return t.preventDefault()}function Dd(t){if(Array.isArray(t))return t;if(typeof t!="string"||t.trim()==="")return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}function wt(t){const e=ae.c(14),{options:s,value:o,emptyLabel:a,onChange:l}=t;let i;e[0]!==a||e[1]!==l||e[2]!==o?(i=a&&n.jsx(ln,{active:!o,onClick:()=>l(""),children:a}),e[0]=a,e[1]=l,e[2]=o,e[3]=i):i=e[3];let c;if(e[4]!==l||e[5]!==s||e[6]!==o){let d;e[8]!==l||e[9]!==o?(d=p=>n.jsx(ln,{active:p===o,onClick:()=>l(p),children:p},p),e[8]=l,e[9]=o,e[10]=d):d=e[10],c=s.filter(Boolean).map(d),e[4]=l,e[5]=s,e[6]=o,e[7]=c}else c=e[7];let r;return e[11]!==i||e[12]!==c?(r=n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i,c]}),e[11]=i,e[12]=c,e[13]=r):r=e[13],r}function ln(t){const e=ae.c(7),{active:s,onClick:o,children:a}=t,l=s?"border-primary bg-primary text-primary-foreground":"bg-card hover:bg-muted";let i;e[0]!==l?(i=xe("cursor-pointer rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",l),e[0]=l,e[1]=i):i=e[1];let c;return e[2]!==s||e[3]!==a||e[4]!==o||e[5]!==i?(c=n.jsx("button",{type:"button","aria-pressed":s,onClick:o,className:i,children:a}),e[2]=s,e[3]=a,e[4]=o,e[5]=i,e[6]=c):c=e[6],c}function _d(t,e=[]){return typeof t=="string"?t:JSON.stringify(t??e)}const rn=[{id:"idea",label:"sandbox.generatePost.stepIdea"},{id:"format",label:"sandbox.generatePost.stepFormat"},{id:"extra",label:"sandbox.generatePost.stepExtra"}],Ji={companyName:"sandbox.blogBrand.companyNameLabel",language:"sandbox.blogBrand.languageLabel",description:"sandbox.blogBrand.descriptionLabel",tone:"sandbox.blogBrand.toneLabel",targetAudience:"sandbox.blogBrand.audienceLabel",dos:"sandbox.blogBrand.tabDos",avoid:"sandbox.blogBrand.tabGuardrails"};function qi({open:t,onOpenChange:e,decofile:s,hasAi:o,seed:a,onGenerate:l}){const i=Ne(),c=js(),[r,d]=$.useState(a?"format":"idea"),[p,m]=$.useState(a?.key??""),[h,u]=$.useState(a?.title??""),[f,x]=$.useState(a?.body??""),[g,y]=$.useState([]),[v,j]=$.useState(""),[w,C]=$.useState(""),[E,B]=$.useState(""),[k,_]=$.useState(""),[O,L]=$.useState(""),[K,F]=$.useState(!1),D=s[_s],A=vi(D),I={companyName:be(D?.companyName),description:be(D?.description),language:be(D?.language),tone:be(D?.tone),targetAudience:be(D?.targetAudience),values:Me(Ke(D?.values)),dos:Me(Ke(D?.dos)),avoid:Me(Ke(D?.avoid))},R=ro(s),V=R.find(N=>N.key===p),z=uo(s).find(N=>N.key===V?.pillarKey),W=s[mo],P=Me(Ke(W?.formats)),U=Ge(s,"categories").map(({payload:N})=>({name:be(N.name),slug:be(N.slug)})).filter(N=>N.slug),Y=Ge(s,"authors").map(({payload:N})=>({name:be(N.name),email:be(N.email)})).filter(N=>N.email),J=()=>{d(a?"format":"idea"),m(a?.key??""),u(a?.title??""),x(a?.body??""),y([]),j(""),C(""),B(""),_(""),L("")},X=N=>{e(N),N||J()},ce=async()=>{F(!0);try{const N=await c.call("BLOG_THEME_SUGGEST",{brand:I,existingTitles:[],formats:P.map(q=>q.name).filter(Boolean),guidance:z?`Every idea must be one angle inside the pillar "${z.title}": ${z.body}`:void 0,count:4});y(N.themes)}catch(N){me.error(N instanceof Error?N.message:i("sandbox.generatePost.suggestFailed"))}finally{F(!1)}},ne=a?rn.filter(N=>N.id!=="idea"):rn,de=ne.findIndex(N=>N.id===r),te=r==="idea"?h.trim().length>0:r==="format"?v.trim().length>0&&w.trim().length>0:!0,re=r==="extra",le=()=>{l({idea:{key:p||void 0,title:h.trim(),body:f.trim()},pillar:z?{key:z.key,title:z.title,body:z.body}:void 0,format:{name:v.trim(),value:w.trim()},category:U.find(N=>N.slug===E),author:Y.find(N=>N.email===k),extraInstructions:O.trim()||void 0}),X(!1)};return n.jsx(ut,{open:t,onOpenChange:X,children:n.jsxs(dt,{className:"flex max-h-[85vh] flex-col sm:max-w-2xl",children:[n.jsxs(gt,{children:[n.jsx(ct,{children:i("sandbox.generatePost.title")}),n.jsx(Vt,{children:i("sandbox.generatePost.subtitle")})]}),A.length>0?n.jsx("p",{className:"text-sm text-muted-foreground",children:i("sandbox.generatePost.blockedBrand",{fields:A.map(N=>i(Ji[N])).join(", ")})}):n.jsxs(n.Fragment,{children:[n.jsx("ol",{className:"flex shrink-0 items-center gap-1.5 text-xs",children:ne.map((N,q)=>n.jsx("li",{className:xe("rounded-md px-2 py-1",q===de?"bg-primary text-primary-foreground":q<de?"text-foreground":"text-muted-foreground"),children:i(N.label)},N.id))}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto py-1",children:[r==="idea"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:z?i("sandbox.generatePost.ideaHintInPillar",{pillar:z.title}):i("sandbox.generatePost.ideaHint")}),R.length>0&&n.jsx(wt,{options:R.map(N=>N.title).filter(Boolean),value:V?.title??"",emptyLabel:i("sandbox.generatePost.writeAnIdea"),onChange:N=>{const q=R.find(Z=>Z.title===N);m(q?.key??""),u(q?.title??""),x(q?.body??"")}}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-idea-title",children:i("sandbox.generatePost.ideaTitleLabel")}),n.jsx(Ze,{id:"generate-idea-title",value:h,onChange:N=>{m(""),u(N.target.value)},placeholder:i("sandbox.generatePost.ideaTitlePlaceholder")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-idea-body",children:i("sandbox.generatePost.ideaBodyLabel")}),n.jsx(Rt,{id:"generate-idea-body",value:f,onChange:N=>x(N.target.value),placeholder:i("sandbox.generatePost.ideaBodyPlaceholder"),rows:3})]}),n.jsx(Wi,{label:i("sandbox.generatePost.suggestIdeas"),hint:i("sandbox.generatePost.suggestIdeasHint"),disabled:!o||K,busy:K,onSuggest:ce}),n.jsx(Yi,{suggestions:g,onPick:N=>{u(N.title),x(N.body)}})]}),r==="format"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.generatePost.formatHint")}),n.jsx(wt,{options:P.map(N=>N.name),value:v,onChange:N=>{j(N),C(P.find(q=>q.name===N)?.value??"")}}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-format-name",children:i("sandbox.generatePost.formatNameLabel")}),n.jsx(Ze,{id:"generate-format-name",value:v,onChange:N=>j(N.target.value),placeholder:i("sandbox.generatePost.formatNamePlaceholder")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-format-value",children:i("sandbox.generatePost.formatValueLabel")}),n.jsx(Rt,{id:"generate-format-value",value:w,onChange:N=>C(N.target.value),placeholder:i("sandbox.generatePost.formatValuePlaceholder"),rows:4})]})]}),r==="extra"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-category",children:i("sandbox.generatePost.categoryLabel")}),n.jsx(wt,{options:U.map(N=>N.name),value:U.find(N=>N.slug===E)?.name??"",emptyLabel:i("sandbox.generatePost.inferIt"),onChange:N=>B(U.find(q=>q.name===N)?.slug??"")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-author",children:i("sandbox.generatePost.authorLabel")}),n.jsx(wt,{options:Y.map(N=>N.name),value:Y.find(N=>N.email===k)?.name??"",emptyLabel:i("sandbox.generatePost.inferIt"),onChange:N=>_(Y.find(q=>q.name===N)?.email??"")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-extra",children:i("sandbox.generatePost.extraLabel")}),n.jsx(Rt,{id:"generate-extra",value:O,onChange:N=>L(N.target.value),placeholder:i("sandbox.generatePost.extraPlaceholder"),rows:3})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.generatePost.inferHint")})]})]}),n.jsxs(xt,{className:"shrink-0 sm:justify-between",children:[n.jsx(Be,{type:"button",variant:"outline",disabled:de===0,onClick:()=>d(ne[de-1].id),children:i("sandbox.generatePost.back")}),re?n.jsxs(Be,{type:"button",disabled:!o,onClick:le,children:[n.jsx(tt,{size:14}),i("sandbox.generatePost.generate")]}):n.jsx(Be,{type:"button",disabled:!te,onClick:()=>d(ne[de+1].id),children:i("sandbox.generatePost.next")})]})]})]})})}function Wi(t){const e=ae.c(12),{label:s,hint:o,disabled:a,busy:l,onSuggest:i}=t;let c;e[0]!==o?(c=n.jsx("p",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=c):c=e[1];let r;e[2]!==l?(r=l?n.jsx(Ct,{size:14,className:"animate-spin"}):n.jsx(tt,{size:14}),e[2]=l,e[3]=r):r=e[3];let d;e[4]!==a||e[5]!==s||e[6]!==i||e[7]!==r?(d=n.jsxs(Be,{type:"button",variant:"outline",size:"sm",disabled:a,onClick:i,children:[r,s]}),e[4]=a,e[5]=s,e[6]=i,e[7]=r,e[8]=d):d=e[8];let p;return e[9]!==c||e[10]!==d?(p=n.jsxs("div",{className:"flex items-center justify-between gap-3 border-t pt-3",children:[c,d]}),e[9]=c,e[10]=d,e[11]=p):p=e[11],p}function Yi(t){const e=ae.c(7),{suggestions:s,onPick:o}=t;if(s.length===0)return null;let a;if(e[0]!==o||e[1]!==s){let i;e[3]!==o?(i=c=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>o(c),className:"w-full cursor-pointer rounded-lg border bg-card p-2.5 text-left transition-colors hover:border-primary/40",children:[n.jsx("p",{className:"text-sm font-medium",children:c.title}),n.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:c.body})]})},c.title),e[3]=o,e[4]=i):i=e[4],a=s.map(i),e[0]=o,e[1]=s,e[2]=a}else a=e[2];let l;return e[5]!==a?(l=n.jsx("ul",{className:"space-y-1.5",children:a}),e[5]=a,e[6]=l):l=e[6],l}const Qi=["Heading","Paragraph","List","Quote","Callout","Cta","Divider"];function Xi(t){return Qi.includes(t)}function Zi({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:a,onStarted:l}){const i=Ne(),c=js(),r=Zt({orgSlug:t,virtualMcpId:e,branch:s});return async d=>{const p=Ut(bs()),m={ideaKey:d.idea.key,pillarKey:d.pillar?.key,pillarTitle:d.pillar?.title,format:d.format,brief:d.idea.body},h=Gt(oo({title:d.idea.title,planning:m,now:new Date}),"generating",new Date);await r.mutateAsync({blockKey:p,data:ft(p,h)}),l?.(p);const u=o[_s],f=d.category?[d.category]:Ge(o,"categories").map(({payload:g})=>({name:be(g.name),slug:be(g.slug)})).filter(g=>g.slug),x=d.author?[d.author]:Ge(o,"authors").map(({payload:g})=>({name:be(g.name),email:be(g.email)})).filter(g=>g.email);try{const g=await c.call("BLOG_POST_DRAFT",{brand:{companyName:be(u?.companyName),description:be(u?.description),language:be(u?.language),tone:be(u?.tone),targetAudience:be(u?.targetAudience),values:Me(Ke(u?.values)),dos:Me(Ke(u?.dos)),avoid:Me(Ke(u?.avoid))},pillar:d.pillar?{title:d.pillar.title,body:d.pillar.body}:void 0,theme:{title:d.idea.title,body:d.idea.body},format:d.format,sections:hi(a).filter(v=>Xi(v.name)).map(v=>({type:v.name,purpose:v.description})),categories:f,authors:x,extraInstructions:d.extraInstructions?.trim()||void 0}),y=ki({draft:g,resolveTypes:fo(a),categories:f,authors:x,planning:m,takenSlugs:to(o).map(v=>v.slug),now:new Date});await r.mutateAsync({blockKey:p,data:ft(p,y)}),me.success(i("sandbox.generatePost.done",{title:g.title}))}catch(g){await r.mutateAsync({blockKey:p,data:ft(p,Gt(h,"draft",new Date))}),me.error(g instanceof Error?g.message:i("sandbox.generatePost.failed"))}}}const er=/<(h[1-6]|p|ul|ol|div|img|br|blockquote|section|article|figure)\b|<\/[a-z]/i;function ko(t){return er.test(t)}function tr(t){const e=t.trim();return e?ko(e)?cr(e):ur(e):{title:"",sections:[]}}function As(t){return t.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#0?39;|&apos;/gi,"'").replace(/&amp;/gi,"&")}function St(t){let e=t,s;do s=e,e=e.replace(/<[^>]+>/g,"");while(e!==s);return As(e).replace(/\s+/g," ").trim()}function sr(t){let e=t,s;do s=e,e=e.replace(/<!--[\s\S]*?-->/g,"");while(e!==s);return e}function nr(t){let e=t,s;do s=e,e=e.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/gi,"");while(e!==s);return e}function So(t){let e=t,s;do s=e,e=nr(sr(e));while(e!==s);return e}const or=/^(a|b|strong|i|em|u|s|code|br|span|sub|sup)$/;function Yt(t){let e="";for(const s of t)s.charCodeAt(0)>31&&(e+=s);return e=e.trim(),!/^[a-z][a-z0-9+.-]*:/i.test(e)||/^(https?|mailto|tel):/i.test(e)}function ar(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const lr=/^<\/?([a-z][a-z0-9]*)\b([^>]*)>/i;function ir(t,e,s){const o=e.toLowerCase();if(!or.test(o))return"";if(t.startsWith("</"))return`</${o}>`;if(o!=="a")return`<${o}>`;const a=As(s.match(/href\s*=\s*"([^"]*)"/i)?.[1]??"");return Yt(a)&&a?`<a href="${ar(a)}">`:"<a>"}function wo(t){const e=So(t);let s="",o=0;for(;o<e.length;){const a=e.indexOf("<",o);if(a===-1){s+=e.slice(o);break}s+=e.slice(o,a);const l=lr.exec(e.slice(a));if(!l){s+="&lt;",o=a+1;continue}s+=ir(l[0],l[1]??"",l[2]??""),o=a+l[0].length}return s}function $t(t,e){const s=t.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));return s?.[1]?As(s[1]):""}const rr=/<(h[1-6]|p|ul|ol|blockquote|figure)\b[^>]*>([\s\S]*?)<\/\1\s*>|<hr\b[^>]*\/?>|<img\b[^>]*>/gi;function cr(t){const e=So(t);let s="";const o=[];for(const a of e.matchAll(rr)){const l=a[1]?.toLowerCase(),i=a[2]??"",c=a[0];if(!l){if(/^<img/i.test(c)){const r=$t(c,"src");r&&Yt(r)&&o.push({kind:"image",url:r,alt:$t(c,"alt"),caption:""})}else o.push({kind:"divider"});continue}if(/^h[1-6]$/.test(l)){const r=St(i);if(!r)continue;if(l==="h1"&&!s){s=r;continue}o.push({kind:"heading",text:r,level:l.slice(1)})}else if(l==="p"){const r=wo(i.trim());St(r)&&o.push({kind:"paragraph",html:r})}else if(l==="ul"||l==="ol"){const r=[...i.matchAll(/<li\b[^>]*>([\s\S]*?)<\/li\s*>/gi)].map(d=>St(d[1]??"")).filter(Boolean);r.length&&o.push({kind:"list",items:r,ordered:l==="ol"})}else if(l==="blockquote"){const r=St(i);r&&o.push({kind:"quote",text:r})}else if(l==="figure"){const r=i.match(/<img\b[^>]*>/i)?.[0],d=r?$t(r,"src"):"",p=St(i.match(/<figcaption\b[^>]*>([\s\S]*?)<\/figcaption\s*>/i)?.[1]??"");d&&Yt(d)&&o.push({kind:"image",url:d,alt:r?$t(r,"alt"):"",caption:p})}}return{title:s,sections:o}}function dr(t){return t.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,'<a href="$2">$1</a>').replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*])\*([^*]+)\*/g,"$1<em>$2</em>").replace(/`([^`]+)`/g,"<code>$1</code>")}function ur(t){const e=t.replace(/\r\n?/g,`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-editor-BH13ZfO_.js","assets/index-oPco2Z7Q.js","assets/index-BADnYX4j.css","assets/chat-context-DCpRbJmR.js","assets/use-panel-navigate-CQHE_TAW.js","assets/thread-route-CRhZ1osu.js","assets/use-project-scope-UozAP0t-.js","assets/github-repo-22x8y8Tm.js","assets/use-mcp-client-DDH2Tr05.js","assets/auth-DqmsEfIB.js","assets/autosend-D__v3v-c.js","assets/thread-intent-1MB6k5b2.js","assets/backoff-8mStPHYB.js","assets/task-board-BQC0qjBI.js","assets/schema-DN-s_HG6.js","assets/slugify-CEUa2lfQ.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-decopilot-events-DrrVrYNR.js","assets/use-ai-providers-B1JZFVlj.js","assets/location-DBePU4bz.js","assets/use-organization-settings-mKOaKHuY.js","assets/scroll-area--yTJQfnp.js","assets/select-BSSRUEpK.js","assets/index-BBClJhS5.js","assets/Check-ClKm876e.js","assets/ChevronUp-BBBSFlle.js","assets/use-section-preview-base-BqbdcWw1.js","assets/UserSquare-BA1qsXhU.js","assets/agent-icon-BvDKYGuI.js","assets/AlertCircle-CvaSOOO8.js","assets/Tool01-gY-gdMF4.js","assets/ArrowUp-C1c3cSMN.js","assets/ArrowLeft-BsqlBCdi.js","assets/ArrowRight-B6VZdTtP.js","assets/ShoppingBag01-DsBku-zP.js","assets/ZoomOut-DvQpsf4w.js","assets/Palette-C2svjF4J.js","assets/CheckCircle-B38I9lsp.js","assets/Copy01-kb1901QR.js","assets/CreditCard01-DkYuXaNf.js","assets/DotsVertical-OXZ2C8qE.js","assets/Image01-xbxm22_Y.js","assets/XClose-DnZUIdlK.js","assets/Key01-ZIYydTtn.js","assets/Link01-cXYRJQde.js","assets/LinkExternal01-UxTfoueY.js","assets/Monitor01-CINH3FWT.js","assets/Sun-CJOAGa8i.js","assets/Plus-Bv10xzXZ.js","assets/SearchMd-DRAIsS0-.js","assets/Trash01-DUhLvzYZ.js","assets/Upload01-BsdejHE0.js","assets/User01-B4dCU7oy.js","assets/Users01-BLSNtVXz.js","assets/X-BTpPaU7c.js","assets/dialog-CfIoHDlJ.js","assets/input-MYwET4H0.js","assets/use-new-blocks-editor-DGdBBbiW.js","assets/claim-phase-copy-CaNBNXR7.js","assets/section-preview-url-Csj0_ZDg.js","assets/use-session-runtime-B5XfJc8H.js","assets/runnable-block-editor-Do2tVSLe.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/pair-C-k8zr2J.js","assets/format-time-CjIPQhCN.js","assets/differenceInSeconds-C3x8sHUj.js","assets/collapsible-Bg1MAa8S.js","assets/use-copy-BOgEqZMm.js","assets/usage-stats-CBSbrOk_.js","assets/markdown-D8NZ8Hcx.js","assets/org-file-open-context-Bv73tl5K.js","assets/use-mobile-BCSnRACa.js","assets/tooltip-CF6AcK-h.js","assets/shell-layout-DE5WStxe.js","assets/avatar-JoRElFKl.js","assets/download-app-dialog-bvP5yIID.js","assets/command-DljL6hzf.js","assets/index-DTVMnS9R.js","assets/integration-icon-cSotbhTg.js","assets/project-icon-C29pLjaM.js","assets/new-project-dialog-BaZdnvse.js","assets/label-9S9F78nK.js","assets/repository-import-picker-OR5DGZp9.js","assets/use-navigate-to-agent-DYNDpstL.js","assets/repository-picker-BSwi4b8i.js","assets/useInfiniteQuery-U12d5VJc.js","assets/infiniteQueryObserver-BiKAGWol.js","assets/collection-search-EssCGlF9.js","assets/use-debounced-value-DD9mnPT_.js","assets/required-auth-layout-Byop8Zzr.js","assets/use-org-sso-GwZiS-qS.js","assets/shell-layout-CE2Eihra.css","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-CMM_xZGY.js","assets/types-C-gwtfMH.js","assets/omit-sandbox-map-jj4lCB2U.js","assets/gateway-client-DDRZPNgE.js","assets/tool-namespace-DmnQIdtF.js","assets/utils-CVEq3hMx.js","assets/sheet--8zhfSHm.js","assets/use-connection-BSRKwy2j.js","assets/use-mcp-prompts-CogjK1bQ.js","assets/index-BBn8QmOY.js","assets/form-Bw-12Nua.js","assets/use-thread-outputs-CYriWIIs.js","assets/file-type-icon-C_2K-vjQ.js","assets/popover-BgkxtrX7.js","assets/utils-BaPwSBi2.js","assets/monaco-editor-gMJT6cpK.js","assets/editor-CUtbeyZe.js","assets/calendar-_lAvk6Nt.js","assets/textarea-mkcrN5g-.js","assets/rich-text-link-control-DHguSqou.js","assets/switch-XXcZ9CO9.js","assets/combobox-DnOhf0WD.js","assets/alert-dialog-D5AYweb7.js","assets/sandbox-url-D3mC8qhT.js","assets/search-input-BNUWPEYj.js","assets/tabs-DddEqGpk.js","assets/use-file-configs-CoaidzsY.js","assets/asset-utils-DxlUH6fM.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/toggle-group-Cz7RSOBM.js","assets/sandbox-git-api-B1R0585s.js","assets/agent-view-guard-BHFZQ084.js","assets/use-main-panel-tabs-qFkwsuao.js","assets/use-chat-layout-state-D4JUtDU_.js","assets/use-mcp-tools-B7MXLlq3.js","assets/index-CdYIy8eY.js","assets/drawer-gbdrTv3r.js","assets/input-Dk8ExXFi.js","assets/chat-draft-BiPOqsxD.js","assets/use-deco-credits-BVTpTeQe.js","assets/use-open-billing-url-Dq7moyEm.js","assets/decopilot-BbS9GPYA.js","assets/checkbox-DYn5BX_y.js","assets/ai-providers-logos-DD3qZ33J.js","assets/index-Ccktnu9A.js","assets/input-ZcuegaFq.js","assets/suggestion-tikPUWB4.js","assets/use-org-fs-gM-Wauv_.js","assets/question-004-sINsf4GQ.js","assets/use-members-BLvVhz4X.js","assets/use-org-auth-client-BaoVl8Zl.js","assets/feature-paywall-BK6fjPbO.js","assets/plan-ladder-BlKhVXlg.js","assets/add-connection-dialog-BdXnmDrQ.js","assets/extract-connection-data-CHpjURut.js","assets/metadata-D72DunRR.js","assets/connection-DZucsf0o.js","assets/connection-card-DrvsNBSo.js","assets/connection-slug-CITJ0kGN.js","assets/connection-form-helpers-BOYwqVWG.js","assets/authenticate-and-persist-oauth-CtghXoSr.js","assets/mcp-oauth-Rwm2gO51.js","assets/collection-tabs-C2dMZ-Yz.js","assets/badge-B0yp_bFb.js","assets/use-infinite-scroll-BPqj-R_X.js","assets/useSuspenseInfiniteQuery-B912YJiX.js","assets/input-CSk0sNdn.css","assets/sandbox-lifecycle-context-DqykpNrC.js","assets/resolve-tab-icon-CmlW-pVX.js","assets/use-task-metadata--2QUxhiK.js","assets/use-project-native-view-presence-CjADt2wx.js","assets/site-slug-DebpOoQq.js","assets/virtual-mcp-DBFF2brO.js","assets/feature-gate-CSCbG-02.js","assets/mustache-C_QlIzWy.js","assets/empty-state-B7JCSTCX.js","assets/empty-state-B_xAVz84.js","assets/post-editor-CsDksmyM.js","assets/multi-select-CgJiEc6d.js","assets/block-document-iObAvspI.js","assets/index-Cc_Zqhkn.js","assets/use-fast-preview-draft-url-DEazNknV.js","assets/use-autosave-DlgDe-Tc.js","assets/record-editor-DwoOuklP.js","assets/context-t3HzYqzN.js","assets/index-B1gW_UZi.js","assets/get-initials-D-f_fDFw.js","assets/category-editor-fWmRfYwN.js","assets/sections-editor-BSMpRRaP.js","assets/page-seo-form-CshajZtl.js","assets/variant-matcher-override-C-94qzoj.js","assets/seo-editor-BLMg-jAb.js","assets/variant-calendar-sxqpD_Oi.js","assets/view-mode-toggle-DrlZskFH.js","assets/post-calendar-B-WdFfky.js","assets/alert-CbVRyYdn.js","assets/redirect-editor-BROySec3.js"])))=>i.map(i=>d[i]);
2
+ import{c as ae,b as Ne,j as n,m as gs,K as Bt,l as xe,r as $,h as rt,B as Be,o as Co,e as Po,t as me,a2 as js,az as Nt,aI as vt,F as Ft,aA as Rs,H as Kt,I as zt,au as To,U as Bo,V as Eo,G as We,af as Et,aJ as ds,aK as Do,X as _o,u as jn,aG as Je}from"./index-oPco2Z7Q.js";import{A as Ao}from"./agent-view-guard-BHFZQ084.js";import{F as $o}from"./feature-gate-CSCbG-02.js";import{u as Dt,b as kn}from"./chat-context-DCpRbJmR.js";import{i as Qt}from"./AlertCircle-CvaSOOO8.js";import{H as Lo,S as Sn,T as tt,U as wn,V as ks,W as Oo,X as Nn,Y as Io,b as Mt,N as Cn,Z as Ro,_ as Fo,$ as Ct,a0 as Ko,a1 as zo,n as Mo,a2 as Vo,a3 as Pn,a4 as Go,a5 as Uo,a6 as Ho,l as Fs,a7 as Jo,F as Tn}from"./agent-icon-BvDKYGuI.js";import{a as Bn,i as En,d as Ks}from"./UserSquare-BA1qsXhU.js";import{b as Dn,i as _n}from"./ZoomOut-DvQpsf4w.js";import{c as An,i as qo}from"./XClose-DnZUIdlK.js";import{s as Ss}from"./Plus-Bv10xzXZ.js";import{t as $n}from"./Users01-BLSNtVXz.js";import{f as Wo,e as Yo,b as Qo,A as Xo,a as Zo,d as ea,c as ta,g as sa}from"./alert-dialog-D5AYweb7.js";import{S as Xt}from"./scroll-area--yTJQfnp.js";import{T as Ye,a as Qe,b as Xe}from"./tooltip-CF6AcK-h.js";import{B as ot}from"./badge-B0yp_bFb.js";import{S as us,n as na,c as oa,g as Ln,B as ms,P as aa,h as On,o as la,i as xs,s as ia,u as Zt,l as ra,q as ca,R as da,t as In,r as ua,v as ma,d as Rn,w as fa,x as pa,y as Fn,z as ha,M as ga,j as xa,A as ba,p as ya,C as va,D as ja,e as ka,f as Sa,E as zs,F as Kn,k as wa,G as Na}from"./runnable-block-editor-Do2tVSLe.js";import{r as ws,S as Ca,m as Ns,i as Pa,o as Ta,q as Ba,n as It,v as Ea,R as zn,t as Da,l as _a,w as Aa,x as $a,y as Ms,G as Cs,g as La,z as Oa,e as Vs,A as Ia,d as Ra,B as Fa,D as Gs,h as Ka,E as za,F as Ma}from"./claim-phase-copy-CaNBNXR7.js";import{u as Mn,P as Va}from"./mustache-C_QlIzWy.js";import{n as Vn}from"./ShoppingBag01-DsBku-zP.js";import{t as ht}from"./ChevronUp-BBBSFlle.js";import{C as Ga,a as Ua,b as Ha}from"./collapsible-Bg1MAa8S.js";import{c as Ja,d as qa}from"./sandbox-lifecycle-context-DqykpNrC.js";import{u as Gn}from"./use-session-runtime-B5XfJc8H.js";import{c as gt,d as ct,e as xt,b as dt,D as ut,h as Vt,a as Wa}from"./dialog-CfIoHDlJ.js";import{I as Ze}from"./input-MYwET4H0.js";import{C as es}from"./checkbox-DYn5BX_y.js";import{L as ze}from"./label-9S9F78nK.js";import{c as Ya,b as Qa,a as Xa,d as Za,S as el}from"./select-BSSRUEpK.js";import{o as tl}from"./sandbox-git-api-B1R0585s.js";import{a as Us}from"./utils-BaPwSBi2.js";import{i as sl}from"./CheckCircle-B38I9lsp.js";import{s as Ps}from"./Trash01-DUhLvzYZ.js";import{i as fs}from"./Upload01-BsdejHE0.js";import{E as nl}from"./empty-state-B7JCSTCX.js";import{T as Rt}from"./textarea-mkcrN5g-.js";import{u as ol}from"./use-ai-providers-B1JZFVlj.js";import{M as Un}from"./monaco-editor-gMJT6cpK.js";import{i as Ts}from"./X-BTpPaU7c.js";import{f as Hn,a as al}from"./github-repo-22x8y8Tm.js";import"./rich-text-link-control-DHguSqou.js";import{a as ll}from"./Copy01-kb1901QR.js";import{b as il}from"./Tool01-gY-gdMF4.js";import{b as Hs}from"./use-project-scope-UozAP0t-.js";import{E as rl}from"./empty-state-B_xAVz84.js";import{G as Js}from"./repository-picker-BSwi4b8i.js";import{R as cl}from"./repository-import-picker-OR5DGZp9.js";import{b as dl}from"./thread-route-CRhZ1osu.js";function ul(t){const e=ae.c(18),{title:s,description:o,children:a}=t,l=Ne();let i;e[0]!==a?(i=n.jsx("div",{"aria-hidden":"true",inert:!0,className:"pointer-events-none h-full select-none overflow-hidden",children:a}),e[0]=a,e[1]=i):i=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Lo,{}),e[2]=c):c=e[2];let r;e[3]!==l?(r=l("common.soon"),e[3]=l,e[4]=r):r=e[4];let d;e[5]!==r?(d=n.jsxs(ot,{variant:"secondary",children:[c,r]}),e[5]=r,e[6]=d):d=e[6];let p;e[7]!==s?(p=n.jsx("p",{className:"text-base font-semibold text-foreground",children:s}),e[7]=s,e[8]=p):p=e[8];let m;e[9]!==o?(m=o&&n.jsx("p",{className:"text-sm text-muted-foreground",children:o}),e[9]=o,e[10]=m):m=e[10];let h;e[11]!==d||e[12]!==p||e[13]!==m?(h=n.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-6 backdrop-blur-sm",children:n.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3 rounded-2xl border bg-card px-8 py-6 text-center shadow-lg",children:[d,p,m]})}),e[11]=d,e[12]=p,e[13]=m,e[14]=h):h=e[14];let u;return e[15]!==i||e[16]!==h?(u=n.jsxs("div",{className:"relative h-full min-h-0",children:[i,h]}),e[15]=i,e[16]=h,e[17]=u):u=e[17],u}function ml(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([o])=>!e.includes(o)));return Object.keys(s).length>0?{...t,properties:s}:t}function fl(t,e,s){return typeof t!="string"?null:ml(ws(t,e),s)}function Jn(t,e,s){if(!e||typeof t!="string")return!1;const o=fl(t,e,s);return!!o&&Object.keys(o.properties??{}).length>0}function jt(t){const e=ae.c(6),{hasItems:s,emptyLabel:o,emptyHint:a}=t;let l;e[0]!==a||e[1]!==o||e[2]!==s?(l=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:o}),n.jsx("div",{className:"mt-1 text-muted-foreground/80",children:a})]}),e[0]=a,e[1]=o,e[2]=s,e[3]=l):l=e[3];let i;return e[4]!==l?(i=n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=i):i=e[5],i}function ts(t,e){return`${t}-${e}`}function qn(t,e){return`site/apps/${t}/${e}.ts`}function Wn(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function pl(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function hl(t){return t==="local"?"Custom":"Installed"}function Yn(t,e,s){const o=new Set([ts(t,e),e].map(l=>l.toLowerCase())),a=qn(t,e);for(const[l,i]of Object.entries(s)){if(l.includes("/")||!i||typeof i!="object"||Array.isArray(i))continue;const c=i;if(o.has(l.toLowerCase())||c.__resolveType===a)return l}return null}function gl(t,e){const s=t.vendor.alias,o=t.name,a=Yn(s,o,e);return{id:ts(s,o),app:o,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:qn(s,o),blockKey:a,installed:a!==null}}function xl(t,e,s){if(t===Ca)return null;const o=Wn(t);if(!o)return null;const{vendor:a,app:l}=o,i=Yn(a,l,s),c=Ns(t,e);return{id:ts(a,l),app:l,vendor:a,title:c.title??l,description:c.description??"",category:"Others",logo:c.logo??c.icon,resolveType:t,blockKey:i,installed:i!==null}}function bl(t,e,s){const o=e.__resolveType;if(typeof o!="string"||Pa(t,e)||!Ta(o))return null;const a=Wn(o)??pl(t);if(!a)return null;const l=Ns(o,s),{vendor:i,app:c}=a;return{id:ts(i,c),app:c,vendor:i,title:l.title??Ba(t,e,s),description:l.description??"",category:hl(i),logo:l.logo??l.icon,resolveType:o,blockKey:t,installed:!0}}function yl(t,e,s){const o=new Map;for(const l of t){const i=gl(l,s);o.set(i.id,i)}const a=e.manifest?.blocks?.apps??{};for(const l of Object.keys(a)){const i=xl(l,e,s);!i||o.has(i.id)||o.set(i.id,i)}for(const[l,i]of Object.entries(s)){if(l.includes("/")||!i||typeof i!="object"||Array.isArray(i))continue;const c=bl(l,i,e);!c||o.has(c.id)||o.set(c.id,c)}return[...o.values()].sort(vl)}function vl(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function jl(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function kl(t,e,s){const o=ae.c(12),a=s?.enabled??!0;let l;o[0]===Symbol.for("react.memo_cache_sentinel")?(l=Bt.decoApps(),o[0]=l):l=o[0];let i;o[1]!==a?(i={queryKey:l,queryFn:jl,staleTime:3e5,retry:1,enabled:a},o[1]=a,o[2]=i):i=o[2];const c=gs(i);let r;o[3]!==e||o[4]!==t||o[5]!==c.data?(r=t&&e?yl(c.data??[],t,e):[],o[3]=e,o[4]=t,o[5]=c.data,o[6]=r):r=o[6];const d=r,p=c.isLoading&&!c.isError;let m;return o[7]!==d||o[8]!==c.isError||o[9]!==c.refetch||o[10]!==p?(m={catalog:d,isLoading:p,isError:c.isError,refetch:c.refetch},o[7]=d,o[8]=c.isError,o[9]=c.refetch,o[10]=p,o[11]=m):m=o[11],m}const Sl=["sections","apps","loaders","actions"];function wl(t){const e=ae.c(59),{active:s,counts:o,showBlog:a,onSelect:l}=t,i=Ne();let c;e[0]!==i?(c=i("sandbox.collectionsSidebar.content"),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==c?(r=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children:c})}),e[2]=c,e[3]=r):r=e[3];let d;e[4]!==i?(d=i("sandbox.collectionsSidebar.pages"),e[4]=i,e[5]=d):d=e[5];const p=s==="pages";let m;e[6]!==o.pages||e[7]!==l||e[8]!==d||e[9]!==p?(m=n.jsx(Fe,{id:"pages",icon:Bn,label:d,count:o.pages,active:p,onSelect:l}),e[6]=o.pages,e[7]=l,e[8]=d,e[9]=p,e[10]=m):m=e[10];let h;e[11]!==i?(h=i("sandbox.collectionsSidebar.redirects"),e[11]=i,e[12]=h):h=e[12];const u=s==="redirects";let f;e[13]!==o.redirects||e[14]!==l||e[15]!==h||e[16]!==u?(f=n.jsx(Fe,{id:"redirects",icon:Sn,label:h,count:o.redirects,active:u,onSelect:l}),e[13]=o.redirects,e[14]=l,e[15]=h,e[16]=u,e[17]=f):f=e[17];let x;e[18]!==i?(x=i("sandbox.collectionsSidebar.site"),e[18]=i,e[19]=x):x=e[19];const g=s==="site";let y;e[20]!==l||e[21]!==g||e[22]!==x?(y=n.jsx(Fe,{id:"site",icon:Oo,label:x,active:g,onSelect:l}),e[20]=l,e[21]=g,e[22]=x,e[23]=y):y=e[23];let v;e[24]!==i?(v=i("sandbox.collectionsSidebar.seo"),e[24]=i,e[25]=v):v=e[25];const j=s==="seo";let w;e[26]!==l||e[27]!==v||e[28]!==j?(w=n.jsx(Fe,{id:"seo",icon:Nn,label:v,active:j,onSelect:l}),e[26]=l,e[27]=v,e[28]=j,e[29]=w):w=e[29];let C;e[30]!==i?(C=i("sandbox.collectionsSidebar.calendar"),e[30]=i,e[31]=C):C=e[31];const E=s==="calendar";let B;e[32]!==l||e[33]!==C||e[34]!==E?(B=n.jsx(Fe,{id:"calendar",icon:Io,label:C,active:E,onSelect:l}),e[32]=l,e[33]=C,e[34]=E,e[35]=B):B=e[35];let k;e[36]!==s||e[37]!==o||e[38]!==l?(k=n.jsx(Nl,{active:s,counts:o,onSelect:l}),e[36]=s,e[37]=o,e[38]=l,e[39]=k):k=e[39];let _;e[40]!==s||e[41]!==o.authors||e[42]!==o.categories||e[43]!==o.posts||e[44]!==l||e[45]!==a||e[46]!==i?(_=a&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[n.jsx(Vn,{size:13,className:"shrink-0"}),i("sandbox.collectionsSidebar.blog")]}),n.jsx(Fe,{id:"context",icon:tt,label:i("sandbox.collectionsSidebar.context"),active:s==="context",onSelect:l}),n.jsx(Fe,{id:"posts",icon:Dn,label:i("sandbox.collectionsSidebar.posts"),count:o.posts,active:s==="posts",onSelect:l}),n.jsx(Fe,{id:"authors",icon:$n,label:i("sandbox.collectionsSidebar.authors"),count:o.authors,active:s==="authors",onSelect:l}),n.jsx(Fe,{id:"categories",icon:wn,label:i("sandbox.collectionsSidebar.categories"),count:o.categories,active:s==="categories",onSelect:l}),n.jsx(Fe,{id:"post-schedule",icon:ks,label:i("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:l})]}),e[40]=s,e[41]=o.authors,e[42]=o.categories,e[43]=o.posts,e[44]=l,e[45]=a,e[46]=i,e[47]=_):_=e[47];let O;e[48]!==y||e[49]!==w||e[50]!==B||e[51]!==k||e[52]!==_||e[53]!==m||e[54]!==f?(O=n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[m,f,y,w,B,k,_]}),e[48]=y,e[49]=w,e[50]=B,e[51]=k,e[52]=_,e[53]=m,e[54]=f,e[55]=O):O=e[55];let L;return e[56]!==r||e[57]!==O?(L=n.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[r,O]}),e[56]=r,e[57]=O,e[58]=L):L=e[58],L}function Nl(t){const e=ae.c(52),{active:s,counts:o,onSelect:a}=t,l=Ne();let i;e[0]!==s?(i=Sl.includes(s),e[0]=s,e[1]=i):i=e[1];const c=i,[r,d]=$.useState(!1),p=r||c;let m,h;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=xe("flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer","text-muted-foreground hover:bg-muted hover:text-foreground"),h=n.jsx(Ro,{size:16,className:"shrink-0"}),e[2]=m,e[3]=h):(m=e[2],h=e[3]);let u;e[4]!==l?(u=l("sandbox.collectionsSidebar.advanced"),e[4]=l,e[5]=u):u=e[5];let f;e[6]!==u?(f=n.jsx("span",{className:"flex-1 truncate",children:u}),e[6]=u,e[7]=f):f=e[7];const x=p&&"rotate-180";let g;e[8]!==x?(g=xe("shrink-0 text-muted-foreground/70 transition-transform",x),e[8]=x,e[9]=g):g=e[9];let y;e[10]!==g?(y=n.jsx(ht,{size:16,className:g}),e[10]=g,e[11]=y):y=e[11];let v;e[12]!==f||e[13]!==y?(v=n.jsxs(Ga,{className:m,children:[h,f,y]}),e[12]=f,e[13]=y,e[14]=v):v=e[14];let j;e[15]!==l?(j=l("sandbox.collectionsSidebar.sections"),e[15]=l,e[16]=j):j=e[16];const w=s==="sections";let C;e[17]!==o.sections||e[18]!==a||e[19]!==j||e[20]!==w?(C=n.jsx(Fe,{id:"sections",icon:Mt,label:j,count:o.sections,active:w,onSelect:a,indent:!0}),e[17]=o.sections,e[18]=a,e[19]=j,e[20]=w,e[21]=C):C=e[21];let E;e[22]!==l?(E=l("sandbox.collectionsSidebar.apps"),e[22]=l,e[23]=E):E=e[23];const B=s==="apps";let k;e[24]!==o.apps||e[25]!==a||e[26]!==E||e[27]!==B?(k=n.jsx(Fe,{id:"apps",icon:An,label:E,count:o.apps,active:B,onSelect:a,indent:!0}),e[24]=o.apps,e[25]=a,e[26]=E,e[27]=B,e[28]=k):k=e[28];let _;e[29]!==l?(_=l("sandbox.collectionsSidebar.loaders"),e[29]=l,e[30]=_):_=e[30];const O=s==="loaders";let L;e[31]!==o.loaders||e[32]!==a||e[33]!==_||e[34]!==O?(L=n.jsx(Fe,{id:"loaders",icon:Cn,label:_,count:o.loaders,active:O,onSelect:a,indent:!0}),e[31]=o.loaders,e[32]=a,e[33]=_,e[34]=O,e[35]=L):L=e[35];let K;e[36]!==l?(K=l("sandbox.collectionsSidebar.actions"),e[36]=l,e[37]=K):K=e[37];const F=s==="actions";let D;e[38]!==o.actions||e[39]!==a||e[40]!==K||e[41]!==F?(D=n.jsx(Fe,{id:"actions",icon:_n,label:K,count:o.actions,active:F,onSelect:a,indent:!0}),e[38]=o.actions,e[39]=a,e[40]=K,e[41]=F,e[42]=D):D=e[42];let A;e[43]!==C||e[44]!==k||e[45]!==L||e[46]!==D?(A=n.jsxs(Ua,{className:"flex flex-col gap-0.5 pt-0.5",children:[C,k,L,D]}),e[43]=C,e[44]=k,e[45]=L,e[46]=D,e[47]=A):A=e[47];let I;return e[48]!==p||e[49]!==A||e[50]!==v?(I=n.jsxs(Ha,{open:p,onOpenChange:d,children:[v,A]}),e[48]=p,e[49]=A,e[50]=v,e[51]=I):I=e[51],I}function Fe(t){const e=ae.c(19),{id:s,icon:o,label:a,count:l,active:i,onSelect:c,indent:r}=t;let d;e[0]!==s||e[1]!==c?(d=()=>c(s),e[0]=s,e[1]=c,e[2]=d):d=e[2];const p=r&&"pl-6",m=i?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let h;e[3]!==p||e[4]!==m?(h=xe("flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",p,m),e[3]=p,e[4]=m,e[5]=h):h=e[5];let u;e[6]!==o?(u=n.jsx(o,{size:16,className:"shrink-0"}),e[6]=o,e[7]=u):u=e[7];let f;e[8]!==a?(f=n.jsx("span",{className:"flex-1 truncate",children:a}),e[8]=a,e[9]=f):f=e[9];let x;e[10]!==i||e[11]!==l?(x=l!==void 0&&n.jsx("span",{className:xe("shrink-0 text-xs tabular-nums",i?"text-accent-foreground/70":"text-muted-foreground/70"),children:l}),e[10]=i,e[11]=l,e[12]=x):x=e[12];let g;return e[13]!==d||e[14]!==h||e[15]!==u||e[16]!==f||e[17]!==x?(g=n.jsxs("button",{type:"button",onClick:d,className:h,children:[u,f,x]}),e[13]=d,e[14]=h,e[15]=u,e[16]=f,e[17]=x,e[18]=g):g=e[18],g}function Cl(t){const e=ae.c(12),{state:s,claimPhase:o,lifecycle:a,onStart:l,connectionsHref:i}=t;switch(s.kind){case"starting":{let c;e[0]!==o||e[1]!==a?(c=na({claimPhase:o,lifecycle:a}),e[0]=o,e[1]=a,e[2]=c):c=e[2];let r;return e[3]!==o||e[4]!==c?(r=n.jsx(us,{kind:"starting",progress:c,claimPhase:o}),e[3]=o,e[4]=c,e[5]=r):r=e[5],r}case"suspended":{let c;return e[6]!==l?(c=n.jsx(us,{kind:"suspended",onResume:l}),e[6]=l,e[7]=c):c=e[7],c}case"errored":{let c;return e[8]!==i||e[9]!==l||e[10]!==s.error?(c=n.jsx(us,{kind:"errored",error:s.error,onRetry:l,connectionsHref:i}),e[8]=i,e[9]=l,e[10]=s.error,e[11]=c):c=e[11],c}}}const Pl=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Tl(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Pl.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function qs(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),o=`${s} (copy)`;if(!t.has(o))return o;for(let a=2;a<1e3;a++){const l=`${s} (copy ${a})`;if(!t.has(l))return l}return`${s} (copy ${Date.now()})`}function Bl(t,e){const s=It,o=e.replace(/-copy(?:-\d+)?$/,""),a=`${o}-copy`;if(!t.has(s(a)))return a;for(let l=2;l<1e3;l++){const i=`${o}-copy-${l}`;if(!t.has(s(i)))return i}return`${o}-copy-${Date.now()}`}function El(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),o=`${s}_copy`;if(!Object.hasOwn(t,o))return o;for(let a=2;a<1e3;a++){const l=`${s}_copy_${a}`;if(!Object.hasOwn(t,l))return l}return`${s}_copy_${Date.now()}`}function Dl(t){const e=Ln(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function _l(t,e){return oa(t,e)}const Al=1e3;function $l(t,e){for(let s=0;s<Al;s++){const o=Ln(e);if(!Object.hasOwn(t,o))return o}throw new Error("Could not generate a unique page block key")}const Ll={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Ol={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Il={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Rl(t){const e=ae.c(88),{open:s,mode:o,initialName:a,initialPath:l,isPending:i,error:c,templates:r,validate:d,onSubmit:p,onOpenChange:m}=t,h=i===void 0?!1:i,u=Ne(),[f,x]=$.useState(a),[g,y]=$.useState(l),[v,j]=$.useState(ms),[w,C]=$.useState(null),[E,B]=$.useState(s);s!==E&&(B(s),s&&(x(a),y(l),j(ms),C(null)));const k=o==="create"&&!!r?.length;let _;e[0]!==h||e[1]!==m?(_=pe=>{!pe&&!h&&(C(null),m(!1))},e[0]=h,e[1]=m,e[2]=_):_=e[2];const O=_;let L;e[3]!==h||e[4]!==f||e[5]!==p||e[6]!==g||e[7]!==k||e[8]!==v||e[9]!==d?(L=async pe=>{pe.preventDefault();const ke=f.trim(),he=g.trim();if(!ke||!he||h)return;const je=Ea(he);if(je){C(je);return}const Se=d?.({name:ke,path:he});if(Se){C(Se);return}C(null),await p({name:ke,path:he,templateKey:k&&v!==ms?v:null})},e[3]=h,e[4]=f,e[5]=p,e[6]=g,e[7]=k,e[8]=v,e[9]=d,e[10]=L):L=e[10];const K=L,F=w??c,D=Ll[o];let A;e[11]!==u||e[12]!==D?(A=u(D),e[11]=u,e[12]=D,e[13]=A):A=e[13];let I;e[14]!==A?(I=n.jsx(gt,{children:n.jsx(ct,{children:A})}),e[14]=A,e[15]=I):I=e[15];let R;e[16]!==h||e[17]!==k||e[18]!==u||e[19]!==v||e[20]!==r?(R=k&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:u("sandbox.pageFormDialog.labelTemplate")}),n.jsx(aa,{id:"page-form-template",value:v,onChange:j,templates:r??[],disabled:h})]}),e[16]=h,e[17]=k,e[18]=u,e[19]=v,e[20]=r,e[21]=R):R=e[21];let V;e[22]!==u?(V=u("sandbox.pageFormDialog.labelName"),e[22]=u,e[23]=V):V=e[23];let z;e[24]!==V?(z=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:V}),e[24]=V,e[25]=z):z=e[25];let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=pe=>x(pe.target.value),e[26]=W):W=e[26];let P;e[27]!==u?(P=u("sandbox.pageFormDialog.placeholderName"),e[27]=u,e[28]=P):P=e[28];let U;e[29]!==h||e[30]!==f||e[31]!==P?(U=n.jsx(Ze,{id:"page-form-name",value:f,onChange:W,placeholder:P,autoFocus:!0,disabled:h}),e[29]=h,e[30]=f,e[31]=P,e[32]=U):U=e[32];let Y;e[33]!==U||e[34]!==z?(Y=n.jsxs("div",{className:"space-y-1.5",children:[z,U]}),e[33]=U,e[34]=z,e[35]=Y):Y=e[35];let J;e[36]!==u?(J=u("sandbox.pageFormDialog.labelPath"),e[36]=u,e[37]=J):J=e[37];let X;e[38]!==J?(X=n.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:J}),e[38]=J,e[39]=X):X=e[39];let ce;e[40]===Symbol.for("react.memo_cache_sentinel")?(ce=pe=>y(pe.target.value),e[40]=ce):ce=e[40];let ne;e[41]!==u?(ne=u("sandbox.pageFormDialog.placeholderPath"),e[41]=u,e[42]=ne):ne=e[42];let de;e[43]!==h||e[44]!==g||e[45]!==ne?(de=n.jsx(Ze,{id:"page-form-path",value:g,onChange:ce,placeholder:ne,disabled:h}),e[43]=h,e[44]=g,e[45]=ne,e[46]=de):de=e[46];let te;e[47]!==X||e[48]!==de?(te=n.jsxs("div",{className:"space-y-1.5",children:[X,de]}),e[47]=X,e[48]=de,e[49]=te):te=e[49];let re;e[50]!==F?(re=F&&n.jsx("p",{className:"text-xs text-destructive",children:F}),e[50]=F,e[51]=re):re=e[51];let le;e[52]!==Y||e[53]!==te||e[54]!==re||e[55]!==R?(le=n.jsxs("div",{className:"space-y-4 py-4",children:[R,Y,te,re]}),e[52]=Y,e[53]=te,e[54]=re,e[55]=R,e[56]=le):le=e[56];let N;e[57]!==m?(N=()=>m(!1),e[57]=m,e[58]=N):N=e[58];let q;e[59]!==u?(q=u("sandbox.pageFormDialog.buttonCancel"),e[59]=u,e[60]=q):q=e[60];let Z;e[61]!==h||e[62]!==N||e[63]!==q?(Z=n.jsx(Be,{type:"button",variant:"outline",onClick:N,disabled:h,children:q}),e[61]=h,e[62]=N,e[63]=q,e[64]=Z):Z=e[64];let oe;e[65]!==h||e[66]!==f||e[67]!==g?(oe=!f.trim()||!g.trim()||h,e[65]=h,e[66]=f,e[67]=g,e[68]=oe):oe=e[68];let S;e[69]!==h||e[70]!==o||e[71]!==u?(S=h?n.jsxs(n.Fragment,{children:[n.jsx(rt,{className:"size-3.5"}),u(Il[o])]}):u(Ol[o]),e[69]=h,e[70]=o,e[71]=u,e[72]=S):S=e[72];let se;e[73]!==oe||e[74]!==S?(se=n.jsx(Be,{type:"submit",disabled:oe,children:S}),e[73]=oe,e[74]=S,e[75]=se):se=e[75];let H;e[76]!==Z||e[77]!==se?(H=n.jsxs(xt,{children:[Z,se]}),e[76]=Z,e[77]=se,e[78]=H):H=e[78];let ie;e[79]!==K||e[80]!==le||e[81]!==H||e[82]!==I?(ie=n.jsx(dt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:K,children:[I,le,H]})}),e[79]=K,e[80]=le,e[81]=H,e[82]=I,e[83]=ie):ie=e[83];let ye;return e[84]!==O||e[85]!==s||e[86]!==ie?(ye=n.jsx(ut,{open:s,onOpenChange:O,children:ie}),e[84]=O,e[85]=s,e[86]=ie,e[87]=ye):ye=e[87],ye}const Fl=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],Ws={from:"",to:"",type:"temporary",discardQueryParameters:!1};function Kl(t){const e=ae.c(111),{open:s,isPending:o,error:a,onSubmit:l,onOpenChange:i}=t,c=o===void 0?!1:o,r=Ne(),[d,p]=$.useState(Ws),[m,h]=$.useState(null),[u,f]=$.useState(s);s!==u&&(f(s),s&&(p(Ws),h(null)));let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=ge=>p($e=>({...$e,...ge})),e[0]=x):x=e[0];const g=x;let y;e[1]!==c||e[2]!==i?(y=ge=>{!ge&&!c&&(h(null),i(!1))},e[1]=c,e[2]=i,e[3]=y):y=e[3];const v=y;let j;e[4]!==c||e[5]!==l||e[6]!==d||e[7]!==r?(j=async ge=>{ge.preventDefault();const $e=d.from.trim(),Le=d.to.trim();if(!$e||!Le||c){h(r("sandbox.redirectFormDialog.errorRequired"));return}h(null),await l({...d,from:$e,to:Le})},e[4]=c,e[5]=l,e[6]=d,e[7]=r,e[8]=j):j=e[8];const w=j,C=m??a;let E;e[9]!==c||e[10]!==d.from||e[11]!==d.to?(E=!!d.from.trim()&&!!d.to.trim()&&!c,e[9]=c,e[10]=d.from,e[11]=d.to,e[12]=E):E=e[12];const B=E;let k;e[13]!==r?(k=r("sandbox.redirectFormDialog.title"),e[13]=r,e[14]=k):k=e[14];let _;e[15]!==k?(_=n.jsx(gt,{children:n.jsx(ct,{children:k})}),e[15]=k,e[16]=_):_=e[16];let O;e[17]!==r?(O=r("sandbox.redirectEditor.fromLabel"),e[17]=r,e[18]=O):O=e[18];let L;e[19]!==O?(L=n.jsx(ze,{htmlFor:"redirect-form-from",children:O}),e[19]=O,e[20]=L):L=e[20];const K=d.from;let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F=ge=>g({from:ge.target.value}),e[21]=F):F=e[21];let D;e[22]!==r?(D=r("sandbox.redirectEditor.fromPlaceholder"),e[22]=r,e[23]=D):D=e[23];let A;e[24]!==c||e[25]!==d.from||e[26]!==D?(A=n.jsx(Ze,{id:"redirect-form-from",value:K,onChange:F,placeholder:D,autoFocus:!0,disabled:c}),e[24]=c,e[25]=d.from,e[26]=D,e[27]=A):A=e[27];let I;e[28]!==A||e[29]!==L?(I=n.jsxs("div",{className:"space-y-1.5",children:[L,A]}),e[28]=A,e[29]=L,e[30]=I):I=e[30];let R;e[31]!==r?(R=r("sandbox.redirectEditor.toLabel"),e[31]=r,e[32]=R):R=e[32];let V;e[33]!==R?(V=n.jsx(ze,{htmlFor:"redirect-form-to",children:R}),e[33]=R,e[34]=V):V=e[34];const z=d.to;let W;e[35]===Symbol.for("react.memo_cache_sentinel")?(W=ge=>g({to:ge.target.value}),e[35]=W):W=e[35];let P;e[36]!==r?(P=r("sandbox.redirectEditor.toPlaceholder"),e[36]=r,e[37]=P):P=e[37];let U;e[38]!==c||e[39]!==d.to||e[40]!==P?(U=n.jsx(Ze,{id:"redirect-form-to",value:z,onChange:W,placeholder:P,disabled:c}),e[38]=c,e[39]=d.to,e[40]=P,e[41]=U):U=e[41];let Y;e[42]!==V||e[43]!==U?(Y=n.jsxs("div",{className:"space-y-1.5",children:[V,U]}),e[42]=V,e[43]=U,e[44]=Y):Y=e[44];let J;e[45]!==r?(J=r("sandbox.redirectEditor.typeLabel"),e[45]=r,e[46]=J):J=e[46];let X;e[47]!==J?(X=n.jsx(ze,{htmlFor:"redirect-form-type",children:J}),e[47]=J,e[48]=X):X=e[48];const ce=d.type;let ne;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=ge=>g({type:ge}),e[49]=ne):ne=e[49];let de;e[50]!==r?(de=r("sandbox.redirectEditor.typePlaceholder"),e[50]=r,e[51]=de):de=e[51];let te;e[52]!==de?(te=n.jsx(Qa,{id:"redirect-form-type",className:"w-full",children:n.jsx(Xa,{placeholder:de})}),e[52]=de,e[53]=te):te=e[53];let re;e[54]!==r?(re=Fl.map(ge=>n.jsx(Ya,{value:ge.value,children:r(ge.labelKey,{status:zn[ge.value]})},ge.value)),e[54]=r,e[55]=re):re=e[55];let le;e[56]!==re?(le=n.jsx(Za,{children:re}),e[56]=re,e[57]=le):le=e[57];let N;e[58]!==c||e[59]!==d.type||e[60]!==te||e[61]!==le?(N=n.jsxs(el,{value:ce,onValueChange:ne,disabled:c,children:[te,le]}),e[58]=c,e[59]=d.type,e[60]=te,e[61]=le,e[62]=N):N=e[62];let q;e[63]!==X||e[64]!==N?(q=n.jsxs("div",{className:"space-y-1.5",children:[X,N]}),e[63]=X,e[64]=N,e[65]=q):q=e[65];let Z;e[66]===Symbol.for("react.memo_cache_sentinel")?(Z=ge=>g({discardQueryParameters:ge===!0}),e[66]=Z):Z=e[66];let oe;e[67]!==c||e[68]!==d.discardQueryParameters?(oe=n.jsx(es,{checked:d.discardQueryParameters,disabled:c,onCheckedChange:Z}),e[67]=c,e[68]=d.discardQueryParameters,e[69]=oe):oe=e[69];let S;e[70]!==r?(S=r("sandbox.redirectEditor.discardQueryParameters"),e[70]=r,e[71]=S):S=e[71];let se;e[72]!==S?(se=n.jsx("span",{className:"text-sm",children:S}),e[72]=S,e[73]=se):se=e[73];let H;e[74]!==oe||e[75]!==se?(H=n.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[oe,se]}),e[74]=oe,e[75]=se,e[76]=H):H=e[76];let ie;e[77]!==C?(ie=C&&n.jsx("p",{className:"text-xs text-destructive",children:C}),e[77]=C,e[78]=ie):ie=e[78];let ye;e[79]!==I||e[80]!==Y||e[81]!==q||e[82]!==H||e[83]!==ie?(ye=n.jsxs("div",{className:"space-y-4 py-4",children:[I,Y,q,H,ie]}),e[79]=I,e[80]=Y,e[81]=q,e[82]=H,e[83]=ie,e[84]=ye):ye=e[84];let pe;e[85]!==i?(pe=()=>i(!1),e[85]=i,e[86]=pe):pe=e[86];let ke;e[87]!==r?(ke=r("sandbox.redirectFormDialog.cancel"),e[87]=r,e[88]=ke):ke=e[88];let he;e[89]!==c||e[90]!==pe||e[91]!==ke?(he=n.jsx(Be,{type:"button",variant:"outline",onClick:pe,disabled:c,children:ke}),e[89]=c,e[90]=pe,e[91]=ke,e[92]=he):he=e[92];const je=!B;let Se;e[93]!==c||e[94]!==r?(Se=c?n.jsxs(n.Fragment,{children:[n.jsx(rt,{className:"size-3.5"}),r("sandbox.redirectFormDialog.pending")]}):r("sandbox.redirectFormDialog.submit"),e[93]=c,e[94]=r,e[95]=Se):Se=e[95];let Ae;e[96]!==je||e[97]!==Se?(Ae=n.jsx(Be,{type:"submit",disabled:je,children:Se}),e[96]=je,e[97]=Se,e[98]=Ae):Ae=e[98];let Ce;e[99]!==he||e[100]!==Ae?(Ce=n.jsxs(xt,{children:[he,Ae]}),e[99]=he,e[100]=Ae,e[101]=Ce):Ce=e[101];let Pe;e[102]!==w||e[103]!==ye||e[104]!==Ce||e[105]!==_?(Pe=n.jsx(dt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[_,ye,Ce]})}),e[102]=w,e[103]=ye,e[104]=Ce,e[105]=_,e[106]=Pe):Pe=e[106];let _e;return e[107]!==v||e[108]!==s||e[109]!==Pe?(_e=n.jsx(ut,{open:s,onOpenChange:v,children:Pe}),e[107]=v,e[108]=s,e[109]=Pe,e[110]=_e):_e=e[110],_e}function zl(t){const e=ae.c(70),{open:s,blockKey:o,initialName:a,isPending:l,onSubmit:i,onOpenChange:c}=t,r=l===void 0?!1:l,d=Ne(),[p,m]=$.useState(a),[h,u]=$.useState(s);s!==h&&(u(s),s&&m(a));let f;e[0]!==r||e[1]!==c?(f=ce=>{!ce&&!r&&c(!1)},e[0]=r,e[1]=c,e[2]=f):f=e[2];const x=f;let g;e[3]!==r||e[4]!==p||e[5]!==i?(g=async ce=>{ce.preventDefault();const ne=p.trim();!ne||r||await i(ne)},e[3]=r,e[4]=p,e[5]=i,e[6]=g):g=e[6];const y=g;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let j;e[9]!==v?(j=n.jsx(ct,{children:v}),e[9]=v,e[10]=j):j=e[10];let w;e[11]!==d?(w=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=w):w=e[12];let C;e[13]!==w?(C=n.jsx(Vt,{children:w}),e[13]=w,e[14]=C):C=e[14];let E;e[15]!==j||e[16]!==C?(E=n.jsxs(gt,{children:[j,C]}),e[15]=j,e[16]=C,e[17]=E):E=e[17];let B;e[18]!==d?(B=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=B):B=e[19];let k;e[20]!==B?(k=n.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:B}),e[20]=B,e[21]=k):k=e[21];let _;e[22]===Symbol.for("react.memo_cache_sentinel")?(_=ce=>m(ce.target.value),e[22]=_):_=e[22];let O;e[23]!==r||e[24]!==p?(O=n.jsx(Ze,{id:"section-rename-name",value:p,onChange:_,autoFocus:!0,disabled:r}),e[23]=r,e[24]=p,e[25]=O):O=e[25];let L;e[26]!==k||e[27]!==O?(L=n.jsxs("div",{className:"space-y-1.5",children:[k,O]}),e[26]=k,e[27]=O,e[28]=L):L=e[28];let K;e[29]!==d?(K=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=K):K=e[30];let F;e[31]!==K?(F=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:K}),e[31]=K,e[32]=F):F=e[32];let D;e[33]!==o?(D=n.jsx(Ze,{value:o,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=o,e[34]=D):D=e[34];let A;e[35]!==F||e[36]!==D?(A=n.jsxs("div",{className:"space-y-1.5",children:[F,D]}),e[35]=F,e[36]=D,e[37]=A):A=e[37];let I;e[38]!==L||e[39]!==A?(I=n.jsxs("div",{className:"space-y-4 py-4",children:[L,A]}),e[38]=L,e[39]=A,e[40]=I):I=e[40];let R;e[41]!==c?(R=()=>c(!1),e[41]=c,e[42]=R):R=e[42];let V;e[43]!==d?(V=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=V):V=e[44];let z;e[45]!==r||e[46]!==R||e[47]!==V?(z=n.jsx(Be,{type:"button",variant:"outline",onClick:R,disabled:r,children:V}),e[45]=r,e[46]=R,e[47]=V,e[48]=z):z=e[48];let W;e[49]!==r||e[50]!==p?(W=!p.trim()||r,e[49]=r,e[50]=p,e[51]=W):W=e[51];let P;e[52]!==r||e[53]!==d?(P=r?n.jsxs(n.Fragment,{children:[n.jsx(rt,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=r,e[53]=d,e[54]=P):P=e[54];let U;e[55]!==W||e[56]!==P?(U=n.jsx(Be,{type:"submit",disabled:W,children:P}),e[55]=W,e[56]=P,e[57]=U):U=e[57];let Y;e[58]!==z||e[59]!==U?(Y=n.jsxs(xt,{children:[z,U]}),e[58]=z,e[59]=U,e[60]=Y):Y=e[60];let J;e[61]!==y||e[62]!==I||e[63]!==Y||e[64]!==E?(J=n.jsx(dt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:y,children:[E,I,Y]})}),e[61]=y,e[62]=I,e[63]=Y,e[64]=E,e[65]=J):J=e[65];let X;return e[66]!==x||e[67]!==s||e[68]!==J?(X=n.jsx(ut,{open:s,onOpenChange:x,children:J}),e[66]=x,e[67]=s,e[68]=J,e[69]=X):X=e[69],X}function Ml(t){const e=ae.c(7),{type:s}=t,o=zn[s];let a;e[0]!==o?(a=n.jsx(Ye,{asChild:!0,children:n.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:o})}),e[0]=o,e[1]=a):a=e[1];const l=s==="permanent"?"Permanent":"Temporary";let i;e[2]!==l?(i=n.jsx(Qe,{side:"left",children:l}),e[2]=l,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=n.jsxs(Xe,{children:[a,i]}),e[4]=a,e[5]=i,e[6]=c):c=e[6],c}const Vl=60,ps={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Bs=["posts","authors","categories"],Pt={posts:"post",authors:"author",categories:"category"};function lt(t){return Bs.includes(t)}const ss={posts:"post",authors:"author",categories:"category"},Qn={posts:ps.post,authors:ps.author,categories:ps.category},Gl=Object.fromEntries(Object.entries(Qn).map(([t,e])=>[e,t]));function Ul(t){return typeof t=="string"?Gl[t]??null:null}function Re(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ee(t){return typeof t=="string"?t:""}function Hl(t,e){switch(t){case"posts":return{label:ee(e.title)||"Untitled post",subtitle:ee(e.slug)};case"authors":return{label:ee(e.name)||"Unnamed author",subtitle:ee(e.email)};case"categories":return{label:ee(e.name)||"Unnamed category",subtitle:ee(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Xn(t){const e={posts:[],authors:[],categories:[]};for(const[s,o]of Object.entries(t)){const a=Re(o);if(!a)continue;const l=Ul(a.__resolveType);if(!l)continue;const i=Re(a[ss[l]])??{},{label:c,subtitle:r}=Hl(l,i);e[l].push({key:s,kind:l,label:c,subtitle:r})}for(const s of Bs)e[s].sort((o,a)=>o.label.localeCompare(a.label));return e}function Jl(t,e){return Xn(t)[e]}function Ge(t,e){return Jl(t,e).map(s=>({key:s.key,payload:mt(Re(t[s.key])??void 0,e)}))}const Ys=Object.freeze({});function mt(t,e){return t?Re(t[ss[e]])??Ys:Ys}function it(t,e,s){return{name:t,__resolveType:Qn[e],[ss[e]]:s}}function rd({records:t,selected:e,valueField:s,toRef:o}){const a=Array.isArray(e)?e:[],l=h=>typeof h=="string"?h:ee(Re(h)?.[s]),i=h=>typeof h=="string"?h:ee(Re(h)?.name),c=h=>{const u=l(h),f=u?t.find(({payload:g})=>ee(g[s])===u):void 0;if(f)return f;const x=i(h);return x?t.find(({payload:g})=>ee(g.name)===x):void 0},r=t.map(({key:h,payload:u})=>({value:h,label:ee(u.name)||ee(u[s])||h})),d=new Map,p=[];return a.forEach((h,u)=>{const f=c(h);if(f){p.includes(f.key)||p.push(f.key);return}const x=`unresolved:${u}`;d.set(x,h),p.push(x),r.push({value:x,label:i(h)||l(h)||"Unknown"})}),{options:r,selectedValues:p,refsForValues:h=>h.map(u=>{const f=t.find(x=>x.key===u);return f?o(f.payload):d.get(u)}).filter(u=>u!==void 0)}}function et(t){return Array.isArray(t)?t:[]}function nt(t){if(typeof t=="string")return t;const e=Re(t);return e?ee(e.slug):""}function Zn(t){if(typeof t=="string")return t;const e=Re(t);return e?ee(e.email):""}function Es(t){const e=[];return ee(t.title).trim()||e.push("Title"),ee(t.slug).trim()||e.push("Slug"),et(t.categories).map(nt).filter(Boolean).length===0&&e.push("Category"),ee(t.excerpt).trim()||e.push("Excerpt"),ee(t.image).trim()||e.push("Cover image"),e}const Ds=["draft","generating","awaiting_review","scheduled","published","archived"],eo=8;function _t(t){switch(ee(t.status)){case"draft":case"idea":return"draft";case"generating":return"generating";case"awaiting_review":case"in_review":return"awaiting_review";case"scheduled":return"scheduled";case"published":return"published";case"archived":return"archived";case"":return"published";default:return"awaiting_review"}}function ql(t,e){return e!=="published"&&e!=="scheduled"||_t(t)===e?!1:Es(t).length>0}function Wl(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,eo).toISOString()}function Gt(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const o=ee(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(o).getTime())?Wl(s):o}}function to(t){return Ge(t,"posts").map(({key:e,payload:s})=>({key:e,title:ee(s.title)||"Untitled post",slug:ee(s.slug),date:ee(s.date),scheduledDatetime:ee(s.scheduledDatetime),categorySlugs:et(s.categories).map(nt).filter(Boolean),authorEmails:et(s.authors).map(Zn).filter(Boolean),missing:Es(s),status:_t(s),form:"live"}))}const so="blog-manager/posts/";function no(t){return t.startsWith(so)}function Tt(t){return t.split("/").pop()??t}function Ut(t){return`${so}${t}`}function Yl(t){return`collections/blog/posts/${t}`}function bs(){return bt(12)}function Ql(t){const e=Re(t.planning)??{},s=Re(e.format);return{ideaKey:ee(e.ideaKey)||void 0,pillarKey:ee(e.pillarKey)||void 0,pillarTitle:ee(e.pillarTitle)||void 0,format:s?{name:ee(s.name),value:ee(s.value)}:void 0,brief:ee(e.brief)||void 0}}function oo(t){return{title:t.title,slug:"",excerpt:"",date:t.now.toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[],status:"draft",planning:t.planning??{}}}function ft(t,e){return{name:t,[ss.posts]:e}}function cd(t,e){return no(t)?ft(t,e):it(t,"posts",e)}function Xl(t){const e=[];for(const[s,o]of Object.entries(t)){if(!no(s))continue;const a=Re(o);a&&e.push({key:s,payload:mt(a,"posts")})}return e}function Zl(t){return[...Xl(t).map(({key:s,payload:o})=>({key:s,title:ee(o.title)||"Untitled post",slug:ee(o.slug),date:ee(o.date),scheduledDatetime:ee(o.scheduledDatetime),categorySlugs:et(o.categories).map(nt).filter(Boolean),authorEmails:et(o.authors).map(Zn).filter(Boolean),missing:Es(o),status:_t(o),form:"planning"})),...to(t)]}function ei(t,e,s){const o=Gt(t.payload,e,s),a=Tt(t.key),l=e==="scheduled"||e==="published"?"live":"planning",i=l==="live"?Yl(a):Ut(a),c=l==="live"?it(i,"posts",o):ft(i,o);return{writes:{[i]:c},deletes:i===t.key?[]:[t.key]}}function dd(t,e,s){const o=et(t.categories);if(!o.some(c=>nt(c)===e))return t;const a=o.map(c=>{const r=nt(c);return r===e||r===s.slug?{name:s.name,slug:s.slug}:c}),l=new Set,i=a.filter(c=>{const r=nt(c);return r?l.has(r)?!1:(l.add(r),!0):!0});return{...t,categories:i}}function ti(t,e){const s=et(t.categories);return s.some(o=>nt(o)===e)?{...t,categories:s.filter(o=>nt(o)!==e)}:t}function si(t){const e=ee(t.status),s=e==="idea"||e==="in_review"?{status:_t(t)}:{};return{...t,...s,dateModified:new Date().toISOString()}}function bt(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function hs(t,e){const s=`collections/blog/${e}/${bt(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function ao(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${bt(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${bt(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const ni={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},Qs="Box";function oi(t){return t.startsWith("site/")?"site":"app"}function ai(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function kt(...t){for(const e of t)if(e!==void 0)return e}function Xs(t){if(t&&!(t.includes("/")||/\.(tsx?|jsx?)$/.test(t)))return t}function li(t){const e=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():t}function lo(t){const e=new Set,s=[],o=t.manifest?.blocks??{};for(const a of Object.values(o))for(const l of Object.keys(a)){if(!ri(l)||e.has(l))continue;e.add(l);const i=Ns(l,t),c=ns(l),r=ni[c],d=oi(l),p=Xs(i.title),m=Xs(i.description),h=(d==="site"?kt(p,r?.title):kt(r?.title,p))??li(c),u=d==="site"?kt(m,r?.description):kt(r?.description,m),f=d==="site"?i.icon:void 0,x=f&&ai(f)?f:void 0,g=x!==void 0?r?.iconName??Qs:kt(f,r?.iconName)??Qs;s.push({resolveType:l,title:h,description:u,iconName:g,iconUrl:x,source:d})}return s.sort((a,l)=>a.title.localeCompare(l.title))}function ns(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const ii=["blog/sections/blocks/","site/sections/Blog/Post/"];function ri(t){return ii.some(e=>t.startsWith(e))}const _s="blog-manager-brand";function Ke(t){if(!Array.isArray(t))return[];const e=[];for(const s of t){if(typeof s=="string"){s.trim()&&e.push({name:s,value:""});continue}const o=Re(s);o&&e.push({name:ee(o.name),value:ee(o.value)})}return e}function Me(t){return t.filter(e=>e.name.trim()||e.value.trim())}const ci=6e4,di=4e3;function ui(t){const e=[],s=new Set,o=(a,l)=>{if(typeof a=="string"){if(!a.includes(" ")||a.length<4||/^(https?:)?\/\//.test(a)||/^data:/.test(a))return;const i=`${l}: ${a.trim()}`;if(s.has(i))return;s.add(i),e.push(i);return}if(Array.isArray(a)){for(const i of a)o(i,l);return}if(a&&typeof a=="object")for(const[i,c]of Object.entries(a))i!=="__resolveType"&&o(c,i)};return o(t,"block"),e.join(`
3
+ `)}function ud(t,e){const s=new Map,o=d=>{const p=s.get(d);if(p!==void 0)return p;const m=ui(t[d]).slice(0,di);return s.set(d,m),m},a=(d,p)=>o(p).length-o(d).length,l=[...Ge(t,"posts").map(d=>d.key).sort(a),...Ge(t,"categories").map(d=>d.key),...[...e].sort(a)],i=[],c=new Set;let r=ci;for(const d of l){if(i.length>=Vl)break;if(c.has(d)||!t[d])continue;c.add(d);const p=o(d);if(p.length>r)break;i.push({key:d,content:p}),r-=p.length}return i}const io="blog-manager/themes/";function mi(){return`${io}${crypto.randomUUID()}`}function fi(t,e){return{name:t,title:e.title,body:e.body,pillarKey:e.pillarKey??"",createdAt:e.createdAt}}function ro(t){const e=[];for(const[s,o]of Object.entries(t)){if(!s.startsWith(io))continue;const a=Re(o);a&&e.push({key:s,title:ee(a.title),body:ee(a.body),pillarKey:ee(a.pillarKey)||void 0,createdAt:ee(a.createdAt)})}return e.sort((s,o)=>o.createdAt.localeCompare(s.createdAt)||s.title.localeCompare(o.title))}const co="blog-manager/pillars/";function md(){return`${co}${crypto.randomUUID()}`}function uo(t){const e=[];for(const[s,o]of Object.entries(t)){if(!s.startsWith(co))continue;const a=Re(o);a&&e.push({key:s,title:ee(a.title),body:ee(a.body),createdAt:ee(a.createdAt),formats:et(a.formats).map(l=>ee(l)).filter(Boolean)})}return e.sort((s,o)=>o.createdAt.localeCompare(s.createdAt)||s.title.localeCompare(o.title))}const mo="blog-manager-formats",pi=40;function fd(t){return Ge(t,"posts").slice(0,pi).map(({key:e,payload:s})=>({key:e,title:ee(s.title),sections:et(s.sections).map(o=>ee(Re(o)?.__resolveType)).filter(Boolean).map(ns)}))}function hi(t){const e=new Map;for(const s of lo(t)){const o=ns(s.resolveType);e.has(o)||e.set(o,{name:o,title:s.title,description:s.description})}return[...e.values()]}function gi(t){const e=new Set;for(const s of t.matchAll(/(?:^|[\s([{>])@([A-Za-z][\w-]*)/g))s[1]&&e.add(s[1]);return[...e]}function pd(t,e){const s=new Set(e);return gi(t).filter(o=>!s.has(o))}const xi=["Heading","Paragraph","BlockImage","List","Cta"];function hd(t){const e=new Set(t);return xi.filter(s=>e.has(s))}function Zs(t){return t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().replace(/\s+/g," ").trim()}function bi(t,e){const s=new Set(t.map(Zs)),o=[];for(const a of e){const l=Zs(a.title);!l||s.has(l)||(s.add(l),o.push(a))}return o}const yi=["companyName","language","description","tone","targetAudience"];function vi(t){const e=Re(t)??{},s=[];for(const o of yi)ee(e[o]).trim()||s.push(o);return Me(Ke(e.dos)).length===0&&s.push("dos"),Me(Ke(e.avoid)).length===0&&s.push("avoid"),s}function fo(t){const e={};for(const s of lo(t)){const o=ns(s.resolveType);o in e||(e[o]=s.resolveType)}return e}function ji(t,e){const s=[];for(const o of t){const a=e[o.type];if(a)switch(o.type){case"Heading":s.push({__resolveType:a,text:ee(o.text),level:o.level??"2"});break;case"Paragraph":s.push({__resolveType:a,html:ee(o.html)});break;case"List":s.push({__resolveType:a,items:(o.items??[]).join(`
4
+ `),style:o.style??"unordered"});break;case"Quote":s.push({__resolveType:a,quote:ee(o.quote)});break;case"Callout":s.push({__resolveType:a,title:ee(o.title),body:ee(o.body),variant:o.variant??"info"});break;case"Cta":s.push({__resolveType:a,text:ee(o.text),href:ee(o.href)});break;case"Divider":s.push({__resolveType:a});break}}return s}function po(t){return t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function ho(t,e){const s=po(t)||`post-${bt(6)}`,o=new Set(e);if(!o.has(s))return s;for(let a=2;a<100;a++){const l=`${s}-${a}`;if(!o.has(l))return l}return`${s}-${bt(4)}`}function ki({draft:t,resolveTypes:e,categories:s,authors:o,planning:a,takenSlugs:l,now:i}){const c=new Set(t.categorySlugs),r=new Set(t.authorEmails),d={title:t.title,slug:ho(t.title,l),date:i.toISOString().slice(0,10),excerpt:t.excerpt,image:"",alt:"",authors:o.filter(p=>r.has(p.email)),categories:s.filter(p=>c.has(p.slug)),seo:{title:t.seo.title,description:t.seo.description,image:""},sections:ji(t.sections,e),planning:a??{}};return Gt(d,"awaiting_review",i)}const gd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],xd=["January","February","March","April","May","June","July","August","September","October","November","December"],go=1440*60*1e3;function pt(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function bd(t){return new Date(t.getFullYear(),t.getMonth(),1)}function yd(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Ht(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function ys(t,e){return Math.round((pt(t).getTime()-pt(e).getTime())/go)}function Si(t){const e=(t.getTime()-pt(t).getTime())/go;return Math.min(Math.max(e,0),1)}function en(t,e){return ys(t,e)+Si(t)}function vd(t){const e=Ht(t,-t.getDay()),s=[];for(let o=0;o<6;o++){const a=[];for(let l=0;l<7;l++)a.push(Ht(e,o*7+l));s.push(a)}for(;s.length>0&&s[s.length-1].every(o=>o.getMonth()!==t.getMonth());)s.pop();return s}function jd(t,e){const s=pt(t[0]),o=Ht(s,7),a=s.getTime(),l=o.getTime(),i=[];for(const d of e){const p=pt(d.start),m=pt(d.end);if(m.getTime()<s.getTime()||p.getTime()>=o.getTime())continue;const h=p.getTime()<s.getTime()?s:p,u=m.getTime()>=o.getTime()?Ht(o,-1):m,f=ys(h,s),x=ys(u,h)+1;if(x<=0)continue;const g=Math.max(d.start.getTime(),a),y=Math.min(d.end.getTime(),l),v=en(new Date(g),s),j=Math.max(en(new Date(y),s)-v,0);j<=0||i.push({variant:d,startCol:f,span:x,leftUnits:v,widthUnits:j})}i.sort((d,p)=>d.startCol-p.startCol||p.span-d.span||d.variant.blockKey.localeCompare(p.variant.blockKey));const c=[],r=[];for(const d of i){let p=c.findIndex(m=>m<=d.startCol);p===-1&&(p=c.length,c.push(0)),c[p]=d.startCol+d.span,r.push({...d,lane:p})}return r}function Jt(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const xo=/^(\d{4})-(\d{2})-(\d{2})$/;function qt(t){const e=t.trim();if(!e)return null;const s=xo.exec(e);if(s){const a=Number(s[1]),l=Number(s[2])-1,i=Number(s[3]),c=new Date(a,l,i);return c.getMonth()===l&&c.getDate()===i?c:null}const o=new Date(e);return Number.isNaN(o.getTime())?null:pt(o)}function wi(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),eo);return{...ao("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Jt(t)}}function Ni(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(xo.test(e))return qt(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Ci(t,e){const s=Ni(t.scheduledDatetime);if(!s)return null;const o=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),a={...t,scheduledDatetime:o.toISOString()};return(typeof t.date=="string"?t.date:"")===Jt(s)&&(a.date=Jt(o)),a}function Pi(t){return qt(t.scheduledDatetime)??qt(t.date)}function kd(t){const e=new Map,s=[];for(const a of t){const l={post:a,scheduled:qt(a.scheduledDatetime)!==null},i=Pi(a);if(!i){s.push(l);continue}const c=Jt(i),r=e.get(c);r?r.push(l):e.set(c,[l])}const o=(a,l)=>Number(l.scheduled)-Number(a.scheduled)||a.post.title.localeCompare(l.post.title);for(const a of e.values())a.sort(o);return s.sort(o),{byDay:e,undated:s}}const Ti="0.161.0",Bi="0.162.0",tn="7.53.0",Ei="@decocms/apps-blog";function sn(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function nn(t,e){const s=sn(t),o=sn(e);if(!s||!o)return 0;for(let a=0;a<3;a++){const l=s[a]-o[a];if(l!==0)return l}return 0}const bo=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Di(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const o=bo.exec(s)?.[1];if(o)return o}return null}function _i(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const o=s?.title;if(typeof o!="string")continue;const a=bo.exec(o)?.[1];if(a)return a}return null}function Ai(t){return vs(t?.schema?.definitions,"scheduledDatetime")}function vs(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t))return t.some(o=>vs(o,e));const s=t.properties;return s&&typeof s=="object"&&e in s?!0:Object.values(t).some(o=>vs(o,e))}function $i(t){const e=t;for(const s of[e?.dependencies,e?.devDependencies]){if(!s||typeof s!="object")continue;const o=s[Ei];if(typeof o=="string")return o}return null}function Li(t){const e=/^[\^~]?v?(\d+\.\d+\.\d+)$/.exec(t.trim());return e?e[1]:null}function Oi(t){const e=t?.packageManager,s=typeof e=="string"?e.split("@")[0]?.trim():null;return s==="pnpm"||s==="yarn"||s==="bun"?s:"npm"}function yo(t){return t==="deno"?[Ti,Bi]:[tn,tn]}function on(t,e){const[s,o]=yo(t);return!e||nn(e,s)<0?{kind:"outdated",packageManager:t,version:e}:nn(e,o)<0?{kind:"publish-only",packageManager:t,version:e}:{kind:"full",version:e}}function Ii(t){const e=_i(t.meta);if(t.denoJson.kind==="data"||e){const o=t.denoJson.kind==="data"?Di(t.denoJson.data):null;return on("deno",o??e)}if(t.packageJson.kind==="data"){const o=$i(t.packageJson.data);return o===null?{kind:"unsupported-runtime"}:on(Oi(t.packageJson.data),Li(o))}return Ai(t.meta)?{kind:"full",version:null}:t.denoJson.kind==="unavailable"||t.packageJson.kind==="unavailable"?{kind:"unknown"}:{kind:"unsupported-runtime"}}function Ri(t){return t==="deno"?"deno task update":`npx npm-check-updates -u "@decocms/*" && ${t} install`}function Fi(t){return t.kind==="publish-only"||t.kind==="full"}function Sd(t){return t.kind==="full"}function vo(t,e){if(t.kind==="full"||e!=="scheduled"&&e!=="published"||e==="published"&&Fi(t))return null;if(t.kind==="unknown")return{reason:"unknown"};if(t.kind==="unsupported-runtime")return{reason:"no-app"};const[s,o]=yo(t.packageManager);return{reason:"outdated",required:e==="scheduled"?o:s,version:t.version,command:Ri(t.packageManager)}}const an={kind:"unavailable"};function Ki(t){const e=ae.c(26),s=On(t.virtualMcpId),o=Dt()?.taskId??null;let a;e[0]!==s||e[1]!==t||e[2]!==o?(a=y=>({queryFn:()=>la({...t,threadId:o},xs(s,y)),staleTime:3e5}),e[0]=s,e[1]=t,e[2]=o,e[3]=a):a=e[3];const l=a;let i;e[4]!==t.branch||e[5]!==t.orgSlug||e[6]!==t.virtualMcpId?(i=Bt.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[4]=t.branch,e[5]=t.orgSlug,e[6]=t.virtualMcpId,e[7]=i):i=e[7];let c;e[8]!==l?(c=l("deno.json"),e[8]=l,e[9]=c):c=e[9];let r;e[10]!==i||e[11]!==c?(r={queryKey:i,...c},e[10]=i,e[11]=c,e[12]=r):r=e[12];const{data:d}=gs(r);let p;e[13]!==t.branch||e[14]!==t.orgSlug||e[15]!==t.virtualMcpId?(p=Bt.packageJson(t.orgSlug,t.virtualMcpId,t.branch),e[13]=t.branch,e[14]=t.orgSlug,e[15]=t.virtualMcpId,e[16]=p):p=e[16];let m;e[17]!==l?(m=l("package.json"),e[17]=l,e[18]=m):m=e[18];let h;e[19]!==p||e[20]!==m?(h={queryKey:p,...m},e[19]=p,e[20]=m,e[21]=h):h=e[21];const{data:u}=gs(h),f=d??an,x=u??an;let g;return e[22]!==t.meta||e[23]!==f||e[24]!==x?(g=Ii({denoJson:f,packageJson:x,meta:t.meta}),e[22]=t.meta,e[23]=f,e[24]=x,e[25]=g):g=e[25],g}function zi(t){const e=ae.c(37),{orgSlug:s,virtualMcpId:o,branch:a}=t,l=Co(),i=Dt()?.taskId??null,c=On(o),r=Gn(o).runtime==="cms";let d;e[0]!==a||e[1]!==s||e[2]!==o?(d=Bt.decofile(`${s}/${o}/${a}`),e[0]=a,e[1]=s,e[2]=o,e[3]=d):d=e[3];const p=d;let m;e[4]!==a||e[5]!==s||e[6]!==o?(m=_a(s,o,a),e[4]=a,e[5]=s,e[6]=o,e[7]=m):m=e[7];let h;e[8]!==a||e[9]!==s||e[10]!==o?(h=Da(s,o,a),e[8]=a,e[9]=s,e[10]=o,e[11]=h):h=e[11];let u;e[12]!==a||e[13]!==r||e[14]!==s||e[15]!==c||e[16]!==l||e[17]!==i||e[18]!==o?(u=async w=>{const{writes:C,deletes:E}=w,B=ia(C);if(r){const _=await Aa({orgSlug:s,virtualMcpId:o,branch:a},{set:B,delete:E});return $a(l,{orgSlug:s,virtualMcpId:o,branch:a},_),await l.invalidateQueries({queryKey:tl({orgSlug:s,virtualMcpId:o,branch:a,threadId:i})}),_}const k=`/api/${s}/sandbox/${encodeURIComponent(o)}/${encodeURIComponent(a)}`;for(const[_,O]of Object.entries(B)){const L=await fetch(`${k}/write`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:xs(c,Us(_)),content:JSON.stringify(O,null,2)})});if(!L.ok)return Ms(L,"Write")}for(const _ of E){const O=await fetch(`${k}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:xs(c,Us(_))})});if(!O.ok)return Ms(O,"Delete")}return{ok:!0}},e[12]=a,e[13]=r,e[14]=s,e[15]=c,e[16]=l,e[17]=i,e[18]=o,e[19]=u):u=e[19];let f;e[20]!==a||e[21]!==s||e[22]!==l||e[23]!==o?(f=()=>{l.invalidateQueries({queryKey:Bt.liveMeta(s,o,a)})},e[20]=a,e[21]=s,e[22]=l,e[23]=o,e[24]=f):f=e[24];let x;e[25]!==m||e[26]!==h||e[27]!==u||e[28]!==f?(x={mutationKey:m,scope:h,mutationFn:u,onSuccess:f},e[25]=m,e[26]=h,e[27]=u,e[28]=f,e[29]=x):x=e[29];const g=Po(x);let y;e[30]!==g||e[31]!==l||e[32]!==p?(y=async w=>{const C=[...Object.keys(w.writes),...w.deletes],E=l.getQueryData(p),B=new Map;for(const k of C)E&&k in E&&B.set(k,E[k]);l.setQueryData(p,k=>Mi(k,w)),l.cancelQueries({queryKey:p});try{return await g.mutateAsync(w)}catch(k){const _=k;throw l.setQueryData(p,O=>{if(!O)return O;const L={...O};for(const K of C)B.has(K)?L[K]=B.get(K):delete L[K];return L}),_}},e[30]=g,e[31]=l,e[32]=p,e[33]=y):y=e[33];const v=y;let j;return e[34]!==v||e[35]!==g.isPending?(j={move:v,isPending:g.isPending},e[34]=v,e[35]=g.isPending,e[36]=j):j=e[36],j}function Mi(t,{writes:e,deletes:s}){const o={...t??{},...e};for(const a of s)a in e||delete o[a];return o}const Wt={draft:"sandbox.postBoard.laneDraft",generating:"sandbox.postBoard.laneGenerating",awaiting_review:"sandbox.postBoard.laneAwaitingReview",scheduled:"sandbox.postBoard.laneScheduled",published:"sandbox.postBoard.lanePublished",archived:"sandbox.postBoard.laneArchived"};function jo(t,e){switch(e.reason){case"unknown":return t("sandbox.postBoard.moveUnknownApp");case"no-app":return t("sandbox.postBoard.moveNoBlogApp");case"outdated":return t("sandbox.postBoard.moveUnsupported",{required:e.required,command:e.command})}}function Vi({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,support:a,onMoved:l}){const i=Ne(),c=zi({orgSlug:t,virtualMcpId:e,branch:s}),[r,d]=$.useState(new Set),p=f=>mt(o[f],"posts"),m=(f,x,g=p(f))=>{if(x==="generating")return{kind:"not-a-target"};if(r.has(Tt(f)))return{kind:"in-flight"};const y=vo(a,x);return y?{kind:"unsupported",...y}:ql(g,x)?{kind:"incomplete"}:null},h=f=>{switch(f.kind){case"unsupported":return jo(i,f);case"incomplete":return i("sandbox.postBoard.moveBlocked");case"in-flight":return i("sandbox.postBoard.moveInFlight");case"not-a-target":return i("sandbox.postBoard.moveNotATarget");default:return String(f)}};return{apply:async(f,x,g)=>{const y=g??p(f);if(_t(y)===x)return null;const v=m(f,x,y);if(v)return v.kind!=="in-flight"&&me.error(h(v)),null;const j=Tt(f);d(E=>new Set(E).add(j));const w=ei({key:f,payload:y},x,new Date),C=Object.keys(w.writes)[0]??f;C!==f&&l?.(f,C);try{return await c.move(w),C}catch(E){return C!==f&&l?.(C,f),me.error(E instanceof Error?E.message:i("sandbox.postBoard.moveFailed")),null}finally{d(E=>{const B=new Set(E);return B.delete(j),B})}},refuse:m,reasonText:h,isMoving:f=>r.has(Tt(f))}}function Gi(t){const e=ae.c(14),{value:s,onChange:o,placeholder:a,className:l,onFocus:i,onBlur:c,onKeyDown:r,spellCheck:d,inputRef:p}=t,m=d===void 0?!0:d;let h;e[0]!==o?(h=x=>o(x.target.value),e[0]=o,e[1]=h):h=e[1];let u;e[2]!==l?(u=xe("w-full resize-none border-0 bg-transparent p-0 outline-none [field-sizing:content] placeholder:text-muted-foreground/50 focus:ring-0",l),e[2]=l,e[3]=u):u=e[3];let f;return e[4]!==p||e[5]!==c||e[6]!==i||e[7]!==r||e[8]!==a||e[9]!==m||e[10]!==h||e[11]!==u||e[12]!==s?(f=n.jsx("textarea",{ref:p,value:s,onChange:h,onInput:Ui,onFocus:i,onBlur:c,onKeyDown:r,placeholder:a,spellCheck:m,rows:1,className:u}),e[4]=p,e[5]=c,e[6]=i,e[7]=r,e[8]=a,e[9]=m,e[10]=h,e[11]=u,e[12]=s,e[13]=f):f=e[13],f}function Ui(t){const e=t.currentTarget;e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function be(t){return typeof t=="string"?t:""}function wd(t){const e=ae.c(11);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let a;e[3]!==s?(a=xe(s,"pr-9"),e[3]=s,e[4]=a):a=e[4];let l;e[5]!==o||e[6]!==a?(l=n.jsx(Gi,{...o,className:a}),e[5]=o,e[6]=a,e[7]=l):l=e[7];let i;e[8]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Fo,{size:18,"aria-hidden":!0,className:"pointer-events-none absolute right-2 top-3 text-muted-foreground/40 transition-opacity group-hover/editable:text-muted-foreground group-focus-within/editable:text-muted-foreground"}),e[8]=i):i=e[8];let c;return e[9]!==l?(c=n.jsxs("div",{className:"group/editable relative -mx-2 rounded-md px-2 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",children:[l,i]}),e[9]=l,e[10]=c):c=e[10],c}function Nd(t){const e=ae.c(5),{label:s,onClick:o,disabled:a}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Ss,{size:13}),e[0]=l):l=e[0];let i;return e[1]!==a||e[2]!==s||e[3]!==o?(i=n.jsxs("button",{type:"button",onClick:o,disabled:a,className:"flex items-center gap-1.5 rounded-lg border border-dashed px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:border-foreground/30 hover:text-foreground disabled:opacity-40 disabled:hover:border-dashed disabled:hover:text-muted-foreground cursor-pointer",children:[l,s]}),e[1]=a,e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function Cd(t){const e=ae.c(4),{label:s,onClick:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ps,{size:13}),e[0]=a):a=e[0];let l;return e[1]!==s||e[2]!==o?(l=n.jsx("button",{type:"button","aria-label":s,onClick:o,className:"flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground/60 opacity-0 transition-opacity hover:text-destructive group-hover/item:opacity-100 cursor-pointer rounded-lg",children:a}),e[1]=s,e[2]=o,e[3]=l):l=e[3],l}function Pd(t){const e=ae.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.jsx("div",{className:"absolute -top-9 left-0 z-10 flex items-center gap-0.5 rounded-md border bg-popover p-0.5 shadow-md",children:s}),e[0]=s,e[1]=o):o=e[1],o}function Td(t){const e=ae.c(8),{active:s,label:o,onClick:a,children:l}=t,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let c;e[0]!==i?(c=xe("flex h-7 min-w-7 items-center justify-center px-1.5 text-sm transition-colors cursor-pointer rounded-lg",i),e[0]=i,e[1]=c):c=e[1];let r;return e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==a||e[6]!==c?(r=n.jsx("button",{type:"button","aria-label":o,"aria-pressed":s,onMouseDown:Hi,onClick:a,className:c,children:l}),e[2]=s,e[3]=l,e[4]=o,e[5]=a,e[6]=c,e[7]=r):r=e[7],r}function Hi(t){return t.preventDefault()}function Bd(t){if(Array.isArray(t))return t;if(typeof t!="string"||t.trim()==="")return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}function wt(t){const e=ae.c(14),{options:s,value:o,emptyLabel:a,onChange:l}=t;let i;e[0]!==a||e[1]!==l||e[2]!==o?(i=a&&n.jsx(ln,{active:!o,onClick:()=>l(""),children:a}),e[0]=a,e[1]=l,e[2]=o,e[3]=i):i=e[3];let c;if(e[4]!==l||e[5]!==s||e[6]!==o){let d;e[8]!==l||e[9]!==o?(d=p=>n.jsx(ln,{active:p===o,onClick:()=>l(p),children:p},p),e[8]=l,e[9]=o,e[10]=d):d=e[10],c=s.filter(Boolean).map(d),e[4]=l,e[5]=s,e[6]=o,e[7]=c}else c=e[7];let r;return e[11]!==i||e[12]!==c?(r=n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i,c]}),e[11]=i,e[12]=c,e[13]=r):r=e[13],r}function ln(t){const e=ae.c(7),{active:s,onClick:o,children:a}=t,l=s?"border-primary bg-primary text-primary-foreground":"bg-card hover:bg-muted";let i;e[0]!==l?(i=xe("cursor-pointer rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",l),e[0]=l,e[1]=i):i=e[1];let c;return e[2]!==s||e[3]!==a||e[4]!==o||e[5]!==i?(c=n.jsx("button",{type:"button","aria-pressed":s,onClick:o,className:i,children:a}),e[2]=s,e[3]=a,e[4]=o,e[5]=i,e[6]=c):c=e[6],c}function Ed(t,e=[]){return typeof t=="string"?t:JSON.stringify(t??e)}const rn=[{id:"idea",label:"sandbox.generatePost.stepIdea"},{id:"format",label:"sandbox.generatePost.stepFormat"},{id:"extra",label:"sandbox.generatePost.stepExtra"}],Ji={companyName:"sandbox.blogBrand.companyNameLabel",language:"sandbox.blogBrand.languageLabel",description:"sandbox.blogBrand.descriptionLabel",tone:"sandbox.blogBrand.toneLabel",targetAudience:"sandbox.blogBrand.audienceLabel",dos:"sandbox.blogBrand.tabDos",avoid:"sandbox.blogBrand.tabGuardrails"};function qi({open:t,onOpenChange:e,decofile:s,hasAi:o,seed:a,onGenerate:l}){const i=Ne(),c=js(),[r,d]=$.useState(a?"format":"idea"),[p,m]=$.useState(a?.key??""),[h,u]=$.useState(a?.title??""),[f,x]=$.useState(a?.body??""),[g,y]=$.useState([]),[v,j]=$.useState(""),[w,C]=$.useState(""),[E,B]=$.useState(""),[k,_]=$.useState(""),[O,L]=$.useState(""),[K,F]=$.useState(!1),D=s[_s],A=vi(D),I={companyName:be(D?.companyName),description:be(D?.description),language:be(D?.language),tone:be(D?.tone),targetAudience:be(D?.targetAudience),values:Me(Ke(D?.values)),dos:Me(Ke(D?.dos)),avoid:Me(Ke(D?.avoid))},R=ro(s),V=R.find(N=>N.key===p),z=uo(s).find(N=>N.key===V?.pillarKey),W=s[mo],P=Me(Ke(W?.formats)),U=Ge(s,"categories").map(({payload:N})=>({name:be(N.name),slug:be(N.slug)})).filter(N=>N.slug),Y=Ge(s,"authors").map(({payload:N})=>({name:be(N.name),email:be(N.email)})).filter(N=>N.email),J=()=>{d(a?"format":"idea"),m(a?.key??""),u(a?.title??""),x(a?.body??""),y([]),j(""),C(""),B(""),_(""),L("")},X=N=>{e(N),N||J()},ce=async()=>{F(!0);try{const N=await c.call("BLOG_THEME_SUGGEST",{brand:I,existingTitles:[],formats:P.map(q=>q.name).filter(Boolean),guidance:z?`Every idea must be one angle inside the pillar "${z.title}": ${z.body}`:void 0,count:4});y(N.themes)}catch(N){me.error(N instanceof Error?N.message:i("sandbox.generatePost.suggestFailed"))}finally{F(!1)}},ne=a?rn.filter(N=>N.id!=="idea"):rn,de=ne.findIndex(N=>N.id===r),te=r==="idea"?h.trim().length>0:r==="format"?v.trim().length>0&&w.trim().length>0:!0,re=r==="extra",le=()=>{l({idea:{key:p||void 0,title:h.trim(),body:f.trim()},pillar:z?{key:z.key,title:z.title,body:z.body}:void 0,format:{name:v.trim(),value:w.trim()},category:U.find(N=>N.slug===E),author:Y.find(N=>N.email===k),extraInstructions:O.trim()||void 0}),X(!1)};return n.jsx(ut,{open:t,onOpenChange:X,children:n.jsxs(dt,{className:"flex max-h-[85vh] flex-col sm:max-w-2xl",children:[n.jsxs(gt,{children:[n.jsx(ct,{children:i("sandbox.generatePost.title")}),n.jsx(Vt,{children:i("sandbox.generatePost.subtitle")})]}),A.length>0?n.jsx("p",{className:"text-sm text-muted-foreground",children:i("sandbox.generatePost.blockedBrand",{fields:A.map(N=>i(Ji[N])).join(", ")})}):n.jsxs(n.Fragment,{children:[n.jsx("ol",{className:"flex shrink-0 items-center gap-1.5 text-xs",children:ne.map((N,q)=>n.jsx("li",{className:xe("rounded-md px-2 py-1",q===de?"bg-primary text-primary-foreground":q<de?"text-foreground":"text-muted-foreground"),children:i(N.label)},N.id))}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto py-1",children:[r==="idea"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:z?i("sandbox.generatePost.ideaHintInPillar",{pillar:z.title}):i("sandbox.generatePost.ideaHint")}),R.length>0&&n.jsx(wt,{options:R.map(N=>N.title).filter(Boolean),value:V?.title??"",emptyLabel:i("sandbox.generatePost.writeAnIdea"),onChange:N=>{const q=R.find(Z=>Z.title===N);m(q?.key??""),u(q?.title??""),x(q?.body??"")}}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-idea-title",children:i("sandbox.generatePost.ideaTitleLabel")}),n.jsx(Ze,{id:"generate-idea-title",value:h,onChange:N=>{m(""),u(N.target.value)},placeholder:i("sandbox.generatePost.ideaTitlePlaceholder")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-idea-body",children:i("sandbox.generatePost.ideaBodyLabel")}),n.jsx(Rt,{id:"generate-idea-body",value:f,onChange:N=>x(N.target.value),placeholder:i("sandbox.generatePost.ideaBodyPlaceholder"),rows:3})]}),n.jsx(Wi,{label:i("sandbox.generatePost.suggestIdeas"),hint:i("sandbox.generatePost.suggestIdeasHint"),disabled:!o||K,busy:K,onSuggest:ce}),n.jsx(Yi,{suggestions:g,onPick:N=>{u(N.title),x(N.body)}})]}),r==="format"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.generatePost.formatHint")}),n.jsx(wt,{options:P.map(N=>N.name),value:v,onChange:N=>{j(N),C(P.find(q=>q.name===N)?.value??"")}}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-format-name",children:i("sandbox.generatePost.formatNameLabel")}),n.jsx(Ze,{id:"generate-format-name",value:v,onChange:N=>j(N.target.value),placeholder:i("sandbox.generatePost.formatNamePlaceholder")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-format-value",children:i("sandbox.generatePost.formatValueLabel")}),n.jsx(Rt,{id:"generate-format-value",value:w,onChange:N=>C(N.target.value),placeholder:i("sandbox.generatePost.formatValuePlaceholder"),rows:4})]})]}),r==="extra"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-category",children:i("sandbox.generatePost.categoryLabel")}),n.jsx(wt,{options:U.map(N=>N.name),value:U.find(N=>N.slug===E)?.name??"",emptyLabel:i("sandbox.generatePost.inferIt"),onChange:N=>B(U.find(q=>q.name===N)?.slug??"")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-author",children:i("sandbox.generatePost.authorLabel")}),n.jsx(wt,{options:Y.map(N=>N.name),value:Y.find(N=>N.email===k)?.name??"",emptyLabel:i("sandbox.generatePost.inferIt"),onChange:N=>_(Y.find(q=>q.name===N)?.email??"")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-extra",children:i("sandbox.generatePost.extraLabel")}),n.jsx(Rt,{id:"generate-extra",value:O,onChange:N=>L(N.target.value),placeholder:i("sandbox.generatePost.extraPlaceholder"),rows:3})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.generatePost.inferHint")})]})]}),n.jsxs(xt,{className:"shrink-0 sm:justify-between",children:[n.jsx(Be,{type:"button",variant:"outline",disabled:de===0,onClick:()=>d(ne[de-1].id),children:i("sandbox.generatePost.back")}),re?n.jsxs(Be,{type:"button",disabled:!o,onClick:le,children:[n.jsx(tt,{size:14}),i("sandbox.generatePost.generate")]}):n.jsx(Be,{type:"button",disabled:!te,onClick:()=>d(ne[de+1].id),children:i("sandbox.generatePost.next")})]})]})]})})}function Wi(t){const e=ae.c(12),{label:s,hint:o,disabled:a,busy:l,onSuggest:i}=t;let c;e[0]!==o?(c=n.jsx("p",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=c):c=e[1];let r;e[2]!==l?(r=l?n.jsx(Ct,{size:14,className:"animate-spin"}):n.jsx(tt,{size:14}),e[2]=l,e[3]=r):r=e[3];let d;e[4]!==a||e[5]!==s||e[6]!==i||e[7]!==r?(d=n.jsxs(Be,{type:"button",variant:"outline",size:"sm",disabled:a,onClick:i,children:[r,s]}),e[4]=a,e[5]=s,e[6]=i,e[7]=r,e[8]=d):d=e[8];let p;return e[9]!==c||e[10]!==d?(p=n.jsxs("div",{className:"flex items-center justify-between gap-3 border-t pt-3",children:[c,d]}),e[9]=c,e[10]=d,e[11]=p):p=e[11],p}function Yi(t){const e=ae.c(7),{suggestions:s,onPick:o}=t;if(s.length===0)return null;let a;if(e[0]!==o||e[1]!==s){let i;e[3]!==o?(i=c=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>o(c),className:"w-full cursor-pointer rounded-lg border bg-card p-2.5 text-left transition-colors hover:border-primary/40",children:[n.jsx("p",{className:"text-sm font-medium",children:c.title}),n.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:c.body})]})},c.title),e[3]=o,e[4]=i):i=e[4],a=s.map(i),e[0]=o,e[1]=s,e[2]=a}else a=e[2];let l;return e[5]!==a?(l=n.jsx("ul",{className:"space-y-1.5",children:a}),e[5]=a,e[6]=l):l=e[6],l}const Qi=["Heading","Paragraph","List","Quote","Callout","Cta","Divider"];function Xi(t){return Qi.includes(t)}function Zi({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:a,onStarted:l}){const i=Ne(),c=js(),r=Zt({orgSlug:t,virtualMcpId:e,branch:s});return async d=>{const p=Ut(bs()),m={ideaKey:d.idea.key,pillarKey:d.pillar?.key,pillarTitle:d.pillar?.title,format:d.format,brief:d.idea.body},h=Gt(oo({title:d.idea.title,planning:m,now:new Date}),"generating",new Date);await r.mutateAsync({blockKey:p,data:ft(p,h)}),l?.(p);const u=o[_s],f=d.category?[d.category]:Ge(o,"categories").map(({payload:g})=>({name:be(g.name),slug:be(g.slug)})).filter(g=>g.slug),x=d.author?[d.author]:Ge(o,"authors").map(({payload:g})=>({name:be(g.name),email:be(g.email)})).filter(g=>g.email);try{const g=await c.call("BLOG_POST_DRAFT",{brand:{companyName:be(u?.companyName),description:be(u?.description),language:be(u?.language),tone:be(u?.tone),targetAudience:be(u?.targetAudience),values:Me(Ke(u?.values)),dos:Me(Ke(u?.dos)),avoid:Me(Ke(u?.avoid))},pillar:d.pillar?{title:d.pillar.title,body:d.pillar.body}:void 0,theme:{title:d.idea.title,body:d.idea.body},format:d.format,sections:hi(a).filter(v=>Xi(v.name)).map(v=>({type:v.name,purpose:v.description})),categories:f,authors:x,extraInstructions:d.extraInstructions?.trim()||void 0}),y=ki({draft:g,resolveTypes:fo(a),categories:f,authors:x,planning:m,takenSlugs:to(o).map(v=>v.slug),now:new Date});await r.mutateAsync({blockKey:p,data:ft(p,y)}),me.success(i("sandbox.generatePost.done",{title:g.title}))}catch(g){await r.mutateAsync({blockKey:p,data:ft(p,Gt(h,"draft",new Date))}),me.error(g instanceof Error?g.message:i("sandbox.generatePost.failed"))}}}const er=/<(h[1-6]|p|ul|ol|div|img|br|blockquote|section|article|figure)\b|<\/[a-z]/i;function ko(t){return er.test(t)}function tr(t){const e=t.trim();return e?ko(e)?cr(e):ur(e):{title:"",sections:[]}}function As(t){return t.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#0?39;|&apos;/gi,"'").replace(/&amp;/gi,"&")}function St(t){let e=t,s;do s=e,e=e.replace(/<[^>]+>/g,"");while(e!==s);return As(e).replace(/\s+/g," ").trim()}function sr(t){let e=t,s;do s=e,e=e.replace(/<!--[\s\S]*?-->/g,"");while(e!==s);return e}function nr(t){let e=t,s;do s=e,e=e.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/gi,"");while(e!==s);return e}function So(t){let e=t,s;do s=e,e=nr(sr(e));while(e!==s);return e}const or=/^(a|b|strong|i|em|u|s|code|br|span|sub|sup)$/;function Yt(t){let e="";for(const s of t)s.charCodeAt(0)>31&&(e+=s);return e=e.trim(),!/^[a-z][a-z0-9+.-]*:/i.test(e)||/^(https?|mailto|tel):/i.test(e)}function ar(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const lr=/^<\/?([a-z][a-z0-9]*)\b([^>]*)>/i;function ir(t,e,s){const o=e.toLowerCase();if(!or.test(o))return"";if(t.startsWith("</"))return`</${o}>`;if(o!=="a")return`<${o}>`;const a=As(s.match(/href\s*=\s*"([^"]*)"/i)?.[1]??"");return Yt(a)&&a?`<a href="${ar(a)}">`:"<a>"}function wo(t){const e=So(t);let s="",o=0;for(;o<e.length;){const a=e.indexOf("<",o);if(a===-1){s+=e.slice(o);break}s+=e.slice(o,a);const l=lr.exec(e.slice(a));if(!l){s+="&lt;",o=a+1;continue}s+=ir(l[0],l[1]??"",l[2]??""),o=a+l[0].length}return s}function $t(t,e){const s=t.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));return s?.[1]?As(s[1]):""}const rr=/<(h[1-6]|p|ul|ol|blockquote|figure)\b[^>]*>([\s\S]*?)<\/\1\s*>|<hr\b[^>]*\/?>|<img\b[^>]*>/gi;function cr(t){const e=So(t);let s="";const o=[];for(const a of e.matchAll(rr)){const l=a[1]?.toLowerCase(),i=a[2]??"",c=a[0];if(!l){if(/^<img/i.test(c)){const r=$t(c,"src");r&&Yt(r)&&o.push({kind:"image",url:r,alt:$t(c,"alt"),caption:""})}else o.push({kind:"divider"});continue}if(/^h[1-6]$/.test(l)){const r=St(i);if(!r)continue;if(l==="h1"&&!s){s=r;continue}o.push({kind:"heading",text:r,level:l.slice(1)})}else if(l==="p"){const r=wo(i.trim());St(r)&&o.push({kind:"paragraph",html:r})}else if(l==="ul"||l==="ol"){const r=[...i.matchAll(/<li\b[^>]*>([\s\S]*?)<\/li\s*>/gi)].map(d=>St(d[1]??"")).filter(Boolean);r.length&&o.push({kind:"list",items:r,ordered:l==="ol"})}else if(l==="blockquote"){const r=St(i);r&&o.push({kind:"quote",text:r})}else if(l==="figure"){const r=i.match(/<img\b[^>]*>/i)?.[0],d=r?$t(r,"src"):"",p=St(i.match(/<figcaption\b[^>]*>([\s\S]*?)<\/figcaption\s*>/i)?.[1]??"");d&&Yt(d)&&o.push({kind:"image",url:d,alt:r?$t(r,"alt"):"",caption:p})}}return{title:s,sections:o}}function dr(t){return t.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,'<a href="$2">$1</a>').replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*])\*([^*]+)\*/g,"$1<em>$2</em>").replace(/`([^`]+)`/g,"<code>$1</code>")}function ur(t){const e=t.replace(/\r\n?/g,`
5
5
  `).split(`
6
6
  `);let s="";const o=[];let a=[],l=null,i=[];const c=()=>{a.length&&(o.push({kind:"paragraph",html:wo(dr(a.join(" ")))}),a=[])},r=()=>{l&&(o.push({kind:"list",items:l.items,ordered:l.ordered}),l=null)},d=()=>{i.length&&(o.push({kind:"quote",text:i.join(" ")}),i=[])},p=()=>{c(),r(),d()};for(const m of e){const h=m.trimEnd(),u=h.match(/^(#{1,6})\s+(.*)$/),f=h.match(/^!\[([^\]]*)\]\(([^)\s]+)\)\s*$/),x=h.match(/^\s*(?:[-*+]|\d+\.)\s+(.*)$/),g=/^\s*\d+\./.test(h),y=h.match(/^>\s?(.*)$/);if(!h.trim())p();else if(u){p();const v=u[2]?.trim()??"",j=String(u[1]?.length??1);j==="1"&&!s?s=v:v&&o.push({kind:"heading",text:v,level:j})}else if(/^(-{3,}|\*{3,}|_{3,})$/.test(h.trim()))p(),o.push({kind:"divider"});else if(f){p();const v=f[2]??"";Yt(v)&&o.push({kind:"image",url:v,alt:f[1]??"",caption:""})}else x?(c(),d(),l||(l={items:[],ordered:g}),l.items.push(x[1]?.trim()??"")):y?(c(),r(),i.push(y[1]?.trim()??"")):(r(),d(),a.push(h.trim()))}return p(),{title:s,sections:o}}const mr={heading:"Heading",paragraph:"Paragraph",list:"List",quote:"Quote",divider:"Divider",image:"BlockImage"};function fr(t,e){const s=[];for(const o of t){const a=e[mr[o.kind]];if(a)switch(o.kind){case"heading":s.push({__resolveType:a,text:o.text,level:o.level});break;case"paragraph":s.push({__resolveType:a,html:o.html});break;case"list":s.push({__resolveType:a,items:o.items.join(`
7
- `),style:o.ordered?"ordered":"unordered"});break;case"quote":s.push({__resolveType:a,quote:o.text});break;case"divider":s.push({__resolveType:a});break;case"image":s.push({__resolveType:a,url:o.url,alt:o.alt,caption:o.caption,size:"normal"});break}}return s}function pr({title:t,blocks:e,takenSlugs:s,now:o}){const a=t.trim();return{title:a,slug:a?ho(a,s):po(""),date:o.toISOString().slice(0,10),excerpt:"",image:"",alt:"",authors:[],categories:[],sections:e,status:"in_review"}}const cn="__all__",dn={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},hr={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},un="status:";function mn(t){if(!t.startsWith(un))return null;const e=t.slice(un.length);return Ds.includes(e)?e:null}const fn=$.forwardRef(function(e,s){const o=ae.c(20);let a,l,i,c,r;o[0]!==e?({icon:a,active:l,value:r,className:i,...c}=e,o[0]=e,o[1]=a,o[2]=l,o[3]=i,o[4]=c,o[5]=r):(a=o[1],l=o[2],i=o[3],c=o[4],r=o[5]);const d=l?"text-foreground":"text-muted-foreground";let p;o[6]!==i||o[7]!==d?(p=xe("h-7 gap-1 px-1.5 text-xs",d,i),o[6]=i,o[7]=d,o[8]=p):p=o[8];let m;o[9]!==a?(m=n.jsx(a,{size:14,className:"shrink-0"}),o[9]=a,o[10]=m):m=o[10];let h;o[11]!==r?(h=r&&n.jsx("span",{className:"min-w-0 flex-1 truncate",children:r}),o[11]=r,o[12]=h):h=o[12];let u;o[13]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(ht,{size:12,className:"shrink-0 opacity-60"}),o[13]=u):u=o[13];let f;return o[14]!==c||o[15]!==s||o[16]!==p||o[17]!==m||o[18]!==h?(f=n.jsxs(Be,{ref:s,type:"button",variant:"ghost",size:"sm",className:p,...c,children:[m,h,u]}),o[14]=c,o[15]=s,o[16]=p,o[17]=m,o[18]=h,o[19]=f):f=o[19],f});function $s(t){const e=ae.c(2),{count:s}=t;let o;return e[0]!==s?(o=n.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=o):o=e[1],o}function gr(t){const e=ae.c(100),{categories:s,authors:o,statusCounts:a,categoryFilter:l,authorFilter:i,statusFilter:c,sort:r,onCategoryFilterChange:d,onAuthorFilterChange:p,onStatusFilterChange:m,onSortChange:h}=t,u=Ne();let f;if(e[0]!==s||e[1]!==l){let H;e[3]!==l?(H=ie=>ie.slug===l,e[3]=l,e[4]=H):H=e[4],f=s.find(H),e[0]=s,e[1]=l,e[2]=f}else f=e[2];const x=f;let g;if(e[5]!==i||e[6]!==o){let H;e[8]!==i?(H=ie=>ie.email===i,e[8]=i,e[9]=H):H=e[9],g=o.find(H),e[5]=i,e[6]=o,e[7]=g}else g=e[7];const y=g,v=!!(l||i||c);let j;e[10]!==y?.name||e[11]!==x?.name||e[12]!==c||e[13]!==u?(j=x?.name??y?.name??u(c?Wt[c]:"sandbox.postToolbar.filterLabel"),e[10]=y?.name,e[11]=x?.name,e[12]=c,e[13]=u,e[14]=j):j=e[14];const w=j,C=l?`cat:${l}`:i?`author:${i}`:c?`status:${c}`:cn;let E;e[15]!==p||e[16]!==d||e[17]!==m?(E=()=>{d(null),p(null),m(null)},e[15]=p,e[16]=d,e[17]=m,e[18]=E):E=e[18];const B=E;let k;e[19]!==B||e[20]!==p||e[21]!==d||e[22]!==m?(k=H=>{H.startsWith("cat:")?(p(null),m(null),d(H.slice(4))):H.startsWith("author:")?(d(null),m(null),p(H.slice(7))):mn(H)?(d(null),p(null),m(mn(H))):B()},e[19]=B,e[20]=p,e[21]=d,e[22]=m,e[23]=k):k=e[23];const _=k;let O;e[24]!==w||e[25]!==v?(O=n.jsx(Ft,{asChild:!0,children:n.jsx(fn,{icon:Ko,active:v,value:w,className:"min-w-0 shrink"})}),e[24]=w,e[25]=v,e[26]=O):O=e[26];let L;e[27]!==u?(L=u("sandbox.postToolbar.filterBy"),e[27]=u,e[28]=L):L=e[28];let K;e[29]!==L?(K=n.jsx(vt,{children:L}),e[29]=L,e[30]=K):K=e[30];let F;e[31]!==u?(F=u("sandbox.postToolbar.allPosts"),e[31]=u,e[32]=F):F=e[32];let D;e[33]!==F?(D=n.jsx(Nt,{value:cn,children:F}),e[33]=F,e[34]=D):D=e[34];let A;e[35]!==u?(A=u("sandbox.postToolbar.statusLabel"),e[35]=u,e[36]=A):A=e[36];let I;e[37]!==A?(I=n.jsx(vt,{className:"text-muted-foreground/70",children:A}),e[37]=A,e[38]=I):I=e[38];let R;e[39]!==a||e[40]!==u?(R=Ds.map(H=>n.jsxs(Nt,{value:`status:${H}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:u(Wt[H])}),n.jsx($s,{count:a[H]??0})]},`status:${H}`)),e[39]=a,e[40]=u,e[41]=R):R=e[41];let V;e[42]!==s.length||e[43]!==u?(V=s.length>0&&n.jsx(vt,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.categoryLabel")}),e[42]=s.length,e[43]=u,e[44]=V):V=e[44];let z;e[45]!==s?(z=s.map(br),e[45]=s,e[46]=z):z=e[46];let W;e[47]!==o.length||e[48]!==u?(W=o.length>0&&n.jsx(vt,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.authorLabel")}),e[47]=o.length,e[48]=u,e[49]=W):W=e[49];let P;e[50]!==o?(P=o.map(xr),e[50]=o,e[51]=P):P=e[51];let U;e[52]!==C||e[53]!==_||e[54]!==D||e[55]!==I||e[56]!==R||e[57]!==V||e[58]!==z||e[59]!==W||e[60]!==P?(U=n.jsxs(Rs,{value:C,onValueChange:_,children:[D,I,R,V,z,W,P]}),e[52]=C,e[53]=_,e[54]=D,e[55]=I,e[56]=R,e[57]=V,e[58]=z,e[59]=W,e[60]=P,e[61]=U):U=e[61];let Y;e[62]!==U||e[63]!==K?(Y=n.jsxs(Kt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[K,U]}),e[62]=U,e[63]=K,e[64]=Y):Y=e[64];let J;e[65]!==Y||e[66]!==O?(J=n.jsxs(zt,{children:[O,Y]}),e[65]=Y,e[66]=O,e[67]=J):J=e[67];let X;e[68]!==B||e[69]!==v||e[70]!==u?(X=v&&n.jsx(yr,{label:u("sandbox.postToolbar.clearFilter"),onClick:B}),e[68]=B,e[69]=v,e[70]=u,e[71]=X):X=e[71];const ce=hr[r];let ne;e[72]!==u||e[73]!==ce?(ne=u(ce),e[72]=u,e[73]=ce,e[74]=ne):ne=e[74];let de;e[75]!==ne?(de=n.jsx(Ft,{asChild:!0,children:n.jsx(fn,{icon:zo,active:!0,value:ne})}),e[75]=ne,e[76]=de):de=e[76];let te;e[77]!==u?(te=u("sandbox.postToolbar.sortBy"),e[77]=u,e[78]=te):te=e[78];let re;e[79]!==te?(re=n.jsx(vt,{children:te}),e[79]=te,e[80]=re):re=e[80];let le;e[81]!==h?(le=H=>h(H),e[81]=h,e[82]=le):le=e[82];let N;e[83]===Symbol.for("react.memo_cache_sentinel")?(N=Object.keys(dn),e[83]=N):N=e[83];let q;e[84]!==u?(q=N.map(H=>n.jsx(Nt,{value:H,children:u(dn[H])},H)),e[84]=u,e[85]=q):q=e[85];let Z;e[86]!==r||e[87]!==le||e[88]!==q?(Z=n.jsx(Rs,{value:r,onValueChange:le,children:q}),e[86]=r,e[87]=le,e[88]=q,e[89]=Z):Z=e[89];let oe;e[90]!==re||e[91]!==Z?(oe=n.jsxs(Kt,{align:"end",className:"w-44",children:[re,Z]}),e[90]=re,e[91]=Z,e[92]=oe):oe=e[92];let S;e[93]!==de||e[94]!==oe?(S=n.jsx("div",{className:"ml-auto shrink-0",children:n.jsxs(zt,{children:[de,oe]})}),e[93]=de,e[94]=oe,e[95]=S):S=e[95];let se;return e[96]!==J||e[97]!==X||e[98]!==S?(se=n.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[J,X,S]}),e[96]=J,e[97]=X,e[98]=S,e[99]=se):se=e[99],se}function xr(t){return n.jsxs(Nt,{value:`author:${t.email}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx($s,{count:t.count})]},`author:${t.email}`)}function br(t){return n.jsxs(Nt,{value:`cat:${t.slug}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx($s,{count:t.count})]},`cat:${t.slug}`)}function yr(t){const e=ae.c(4),{label:s,onClick:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ts,{size:12}),e[0]=a):a=e[0];let l;return e[1]!==s||e[2]!==o?(l=n.jsx("button",{type:"button","aria-label":s,onClick:o,className:"flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer rounded-lg",children:a}),e[1]=s,e[2]=o,e[3]=l):l=e[3],l}function vr(t){const e=ae.c(18),{checked:s,disabled:o,onToggle:a}=t,l=Ne();let i;e[0]!==a?(i=()=>a(),e[0]=a,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==l?(c=l(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=l,e[4]=c):c=e[4];let r;e[5]!==s||e[6]!==o||e[7]!==i||e[8]!==c?(r=n.jsx(Ye,{asChild:!0,children:n.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:jr,children:n.jsx(es,{checked:s,disabled:o,onCheckedChange:i,"aria-label":c})})}),e[5]=s,e[6]=o,e[7]=i,e[8]=c,e[9]=r):r=e[9];let d;e[10]!==s||e[11]!==l?(d=l(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=l,e[12]=d):d=e[12];let p;e[13]!==d?(p=n.jsx(Qe,{side:"bottom",children:d}),e[13]=d,e[14]=p):p=e[14];let m;return e[15]!==r||e[16]!==p?(m=n.jsxs(Xe,{children:[r,p]}),e[15]=r,e[16]=p,e[17]=m):m=e[17],m}function jr(t){return t.stopPropagation()}function kr(t){const e=ae.c(42),{count:s,allSelected:o,onToggleSelectAll:a,onArchive:l,onExit:i}=t,c=Ne();let r;e[0]!==o||e[1]!==a?(r=n.jsx(vr,{checked:o,onToggle:a}),e[0]=o,e[1]=a,e[2]=r):r=e[2];let d;e[3]!==s||e[4]!==c?(d=c("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=c,e[5]=d):d=e[5];let p;e[6]!==d?(p=n.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=p):p=e[7];const m=s===0;let h;e[8]!==c?(h=c("sandbox.postToolbar.archiveSelectedPosts"),e[8]=c,e[9]=h):h=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(To,{size:14}),e[10]=u):u=e[10];let f;e[11]!==l||e[12]!==m||e[13]!==h?(f=n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:m,onClick:l,"aria-label":h,children:u})}),e[11]=l,e[12]=m,e[13]=h,e[14]=f):f=e[14];let x;e[15]!==c?(x=c("sandbox.postToolbar.archiveSelected"),e[15]=c,e[16]=x):x=e[16];let g;e[17]!==x?(g=n.jsx(Qe,{side:"bottom",children:x}),e[17]=x,e[18]=g):g=e[18];let y;e[19]!==f||e[20]!==g?(y=n.jsxs(Xe,{children:[f,g]}),e[19]=f,e[20]=g,e[21]=y):y=e[21];let v;e[22]!==c?(v=c("sandbox.postToolbar.exitSelection"),e[22]=c,e[23]=v):v=e[23];let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ts,{size:14}),e[24]=j):j=e[24];let w;e[25]!==i||e[26]!==v?(w=n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,"aria-label":v,children:j})}),e[25]=i,e[26]=v,e[27]=w):w=e[27];let C;e[28]!==c?(C=c("sandbox.postToolbar.exitSelection"),e[28]=c,e[29]=C):C=e[29];let E;e[30]!==C?(E=n.jsx(Qe,{side:"bottom",children:C}),e[30]=C,e[31]=E):E=e[31];let B;e[32]!==w||e[33]!==E?(B=n.jsxs(Xe,{children:[w,E]}),e[32]=w,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==y||e[36]!==B?(k=n.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[y,B]}),e[35]=y,e[36]=B,e[37]=k):k=e[37];let _;return e[38]!==r||e[39]!==k||e[40]!==p?(_=n.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[r,p,k]}),e[38]=r,e[39]=k,e[40]=p,e[41]=_):_=e[41],_}const Sr={draft:"outline",generating:"secondary",awaiting_review:"warning",scheduled:"secondary",published:"success",archived:"outline"},pn="ideas",hn=t=>t.scheduledDatetime||t.date||"",wr=(t,e)=>hn(e).localeCompare(hn(t)),Nr=t=>t==="scheduled"||t==="published",No="application/x-post-key";function Cr({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,view:a,selectedKey:l,onViewChange:i,onOpen:c,onClose:r,move:d,support:p,meta:m,renderDetail:h}){const u=Ne(),f=js(),x=Zt({orgSlug:t,virtualMcpId:e,branch:s}),g=zn({orgSlug:t,virtualMcpId:e,branch:s}),y=ol().length>0,[v,j]=$.useState(null),[w,C]=$.useState(!1),[E,B]=$.useState(!1),[k,_]=$.useState(""),[O,L]=$.useState(3),[K,F]=$.useState(""),[D,A]=$.useState(!1),[I,R]=$.useState(!1),[V,z]=$.useState(),[W,P]=$.useState(!1),[U,Y]=$.useState(""),J=$.useRef(null),[X,ce]=Bo(Eo.blogBoardCollapsedLanes(),[]),ne=T=>ce(Q=>Q.includes(T)?Q.filter(Te=>Te!==T):[...Q,T]),de=Zi({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:m,onStarted:c}),te=Zl(o),re=ro(o),le=uo(o),N=T=>le.find(Q=>Q.key===T)?.title,q=T=>mt(o[T],"posts"),Z=l&&te.some(T=>T.key===l)?l:te[0]?.key??null,oe=async T=>{await d.apply(T.key,"archived")&&me.success(u("sandbox.postBoard.archived"))},[S,se]=$.useState(null),[H,ie]=$.useState(null),[ye,pe]=$.useState(null),[ke,he]=$.useState("date-desc"),[je,Se]=$.useState(new Set),Ae=te.reduce((T,Q)=>(T[Q.status]=(T[Q.status]??0)+1,T),{}),Ce=T=>{const Q=new Map;for(const Te of te)for(const Ve of T(Te))Q.set(Ve,(Q.get(Ve)??0)+1);return Q},Pe=Ce(T=>T.categorySlugs),_e=Ce(T=>T.authorEmails),ge=Ge(o,"categories").map(({payload:T})=>({slug:be(T.slug),name:be(T.name)||be(T.slug),count:Pe.get(be(T.slug))??0})),$e=Ge(o,"authors").map(({payload:T})=>({email:be(T.email),name:be(T.name)||be(T.email),count:_e.get(be(T.email))??0})),Le=te.filter(T=>!S||T.categorySlugs.includes(S)).filter(T=>!H||T.authorEmails.includes(H)).filter(T=>!ye||T.status===ye).sort((T,Q)=>{if(ke==="az")return T.title.localeCompare(Q.title);if(ke==="za")return Q.title.localeCompare(T.title);const Te=(T.scheduledDatetime||T.date).localeCompare(Q.scheduledDatetime||Q.date);return ke==="date-asc"?Te:-Te}),M=je.size>0,ve=T=>Se(Q=>{const Te=new Set(Q);return Te.delete(T)||Te.add(T),Te}),we=()=>Se(T=>Le.every(Q=>T.has(Q.key))?new Set:new Set(Le.map(Q=>Q.key))),Oe=async()=>{let T=0;for(const Q of je)await d.apply(Q,"archived")&&(T+=1);Se(new Set),T>0&&me.success(u("sandbox.postBoard.archived"))},os=T=>{z({key:T.key,title:T.title,body:T.body}),R(!0)},as=T=>{g.mutate({blockKey:T.key})},ls=(T,Q)=>{j(null),d.apply(Q,T)},At=()=>{const T=Ut(bs()),Q=oo({title:"",now:new Date});x.mutate({blockKey:T,data:ft(T,Q)}),c(T)},is=()=>{const T=tr(U),Q=fr(T.sections,fo(m));if(Q.length===0&&!T.title.trim()){me.error(u("sandbox.postBoard.importEmpty"));return}const Te=Ut(bs()),Ve=pr({title:T.title,blocks:Q,takenSlugs:te.map(qe=>qe.slug).filter(Boolean),now:new Date});x.mutate({blockKey:Te,data:ft(Te,Ve)}),P(!1),Y(""),me.success(u("sandbox.postBoard.imported")),c(Te)},rs=async()=>{C(!0);const T=le.find(Q=>Q.key===K);try{const Q=o[_s]??{},Te=o[mo],Ve=Ke(Te?.formats).map(Ue=>Ue.name).filter(Boolean),qe=await f.call("BLOG_THEME_SUGGEST",{brand:{companyName:be(Q.companyName),description:be(Q.description),language:be(Q.language),tone:be(Q.tone),targetAudience:be(Q.targetAudience),values:Me(Ke(Q.values)),dos:Me(Ke(Q.dos)),avoid:Me(Ke(Q.avoid))},existingTitles:re.map(Ue=>Ue.title).filter(Boolean),formats:Ve,guidance:[T&&`Every idea must be one angle inside the pillar "${T.title}": ${T.body}`,k.trim()].filter(Boolean).join(`
7
+ `),style:o.ordered?"ordered":"unordered"});break;case"quote":s.push({__resolveType:a,quote:o.text});break;case"divider":s.push({__resolveType:a});break;case"image":s.push({__resolveType:a,url:o.url,alt:o.alt,caption:o.caption,size:"normal"});break}}return s}function pr({title:t,blocks:e,takenSlugs:s,now:o}){const a=t.trim();return{title:a,slug:a?ho(a,s):po(""),date:o.toISOString().slice(0,10),excerpt:"",image:"",alt:"",authors:[],categories:[],sections:e,status:"in_review"}}const cn="__all__",dn={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},hr={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},un="status:";function mn(t){if(!t.startsWith(un))return null;const e=t.slice(un.length);return Ds.includes(e)?e:null}const fn=$.forwardRef(function(e,s){const o=ae.c(20);let a,l,i,c,r;o[0]!==e?({icon:a,active:l,value:r,className:i,...c}=e,o[0]=e,o[1]=a,o[2]=l,o[3]=i,o[4]=c,o[5]=r):(a=o[1],l=o[2],i=o[3],c=o[4],r=o[5]);const d=l?"text-foreground":"text-muted-foreground";let p;o[6]!==i||o[7]!==d?(p=xe("h-7 gap-1 px-1.5 text-xs",d,i),o[6]=i,o[7]=d,o[8]=p):p=o[8];let m;o[9]!==a?(m=n.jsx(a,{size:14,className:"shrink-0"}),o[9]=a,o[10]=m):m=o[10];let h;o[11]!==r?(h=r&&n.jsx("span",{className:"min-w-0 flex-1 truncate",children:r}),o[11]=r,o[12]=h):h=o[12];let u;o[13]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(ht,{size:12,className:"shrink-0 opacity-60"}),o[13]=u):u=o[13];let f;return o[14]!==c||o[15]!==s||o[16]!==p||o[17]!==m||o[18]!==h?(f=n.jsxs(Be,{ref:s,type:"button",variant:"ghost",size:"sm",className:p,...c,children:[m,h,u]}),o[14]=c,o[15]=s,o[16]=p,o[17]=m,o[18]=h,o[19]=f):f=o[19],f});function $s(t){const e=ae.c(2),{count:s}=t;let o;return e[0]!==s?(o=n.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=o):o=e[1],o}function gr(t){const e=ae.c(100),{categories:s,authors:o,statusCounts:a,categoryFilter:l,authorFilter:i,statusFilter:c,sort:r,onCategoryFilterChange:d,onAuthorFilterChange:p,onStatusFilterChange:m,onSortChange:h}=t,u=Ne();let f;if(e[0]!==s||e[1]!==l){let H;e[3]!==l?(H=ie=>ie.slug===l,e[3]=l,e[4]=H):H=e[4],f=s.find(H),e[0]=s,e[1]=l,e[2]=f}else f=e[2];const x=f;let g;if(e[5]!==i||e[6]!==o){let H;e[8]!==i?(H=ie=>ie.email===i,e[8]=i,e[9]=H):H=e[9],g=o.find(H),e[5]=i,e[6]=o,e[7]=g}else g=e[7];const y=g,v=!!(l||i||c);let j;e[10]!==y?.name||e[11]!==x?.name||e[12]!==c||e[13]!==u?(j=x?.name??y?.name??u(c?Wt[c]:"sandbox.postToolbar.filterLabel"),e[10]=y?.name,e[11]=x?.name,e[12]=c,e[13]=u,e[14]=j):j=e[14];const w=j,C=l?`cat:${l}`:i?`author:${i}`:c?`status:${c}`:cn;let E;e[15]!==p||e[16]!==d||e[17]!==m?(E=()=>{d(null),p(null),m(null)},e[15]=p,e[16]=d,e[17]=m,e[18]=E):E=e[18];const B=E;let k;e[19]!==B||e[20]!==p||e[21]!==d||e[22]!==m?(k=H=>{H.startsWith("cat:")?(p(null),m(null),d(H.slice(4))):H.startsWith("author:")?(d(null),m(null),p(H.slice(7))):mn(H)?(d(null),p(null),m(mn(H))):B()},e[19]=B,e[20]=p,e[21]=d,e[22]=m,e[23]=k):k=e[23];const _=k;let O;e[24]!==w||e[25]!==v?(O=n.jsx(Ft,{asChild:!0,children:n.jsx(fn,{icon:Ko,active:v,value:w,className:"min-w-0 shrink"})}),e[24]=w,e[25]=v,e[26]=O):O=e[26];let L;e[27]!==u?(L=u("sandbox.postToolbar.filterBy"),e[27]=u,e[28]=L):L=e[28];let K;e[29]!==L?(K=n.jsx(vt,{children:L}),e[29]=L,e[30]=K):K=e[30];let F;e[31]!==u?(F=u("sandbox.postToolbar.allPosts"),e[31]=u,e[32]=F):F=e[32];let D;e[33]!==F?(D=n.jsx(Nt,{value:cn,children:F}),e[33]=F,e[34]=D):D=e[34];let A;e[35]!==u?(A=u("sandbox.postToolbar.statusLabel"),e[35]=u,e[36]=A):A=e[36];let I;e[37]!==A?(I=n.jsx(vt,{className:"text-muted-foreground/70",children:A}),e[37]=A,e[38]=I):I=e[38];let R;e[39]!==a||e[40]!==u?(R=Ds.map(H=>n.jsxs(Nt,{value:`status:${H}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:u(Wt[H])}),n.jsx($s,{count:a[H]??0})]},`status:${H}`)),e[39]=a,e[40]=u,e[41]=R):R=e[41];let V;e[42]!==s.length||e[43]!==u?(V=s.length>0&&n.jsx(vt,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.categoryLabel")}),e[42]=s.length,e[43]=u,e[44]=V):V=e[44];let z;e[45]!==s?(z=s.map(br),e[45]=s,e[46]=z):z=e[46];let W;e[47]!==o.length||e[48]!==u?(W=o.length>0&&n.jsx(vt,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.authorLabel")}),e[47]=o.length,e[48]=u,e[49]=W):W=e[49];let P;e[50]!==o?(P=o.map(xr),e[50]=o,e[51]=P):P=e[51];let U;e[52]!==C||e[53]!==_||e[54]!==D||e[55]!==I||e[56]!==R||e[57]!==V||e[58]!==z||e[59]!==W||e[60]!==P?(U=n.jsxs(Rs,{value:C,onValueChange:_,children:[D,I,R,V,z,W,P]}),e[52]=C,e[53]=_,e[54]=D,e[55]=I,e[56]=R,e[57]=V,e[58]=z,e[59]=W,e[60]=P,e[61]=U):U=e[61];let Y;e[62]!==U||e[63]!==K?(Y=n.jsxs(Kt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[K,U]}),e[62]=U,e[63]=K,e[64]=Y):Y=e[64];let J;e[65]!==Y||e[66]!==O?(J=n.jsxs(zt,{children:[O,Y]}),e[65]=Y,e[66]=O,e[67]=J):J=e[67];let X;e[68]!==B||e[69]!==v||e[70]!==u?(X=v&&n.jsx(yr,{label:u("sandbox.postToolbar.clearFilter"),onClick:B}),e[68]=B,e[69]=v,e[70]=u,e[71]=X):X=e[71];const ce=hr[r];let ne;e[72]!==u||e[73]!==ce?(ne=u(ce),e[72]=u,e[73]=ce,e[74]=ne):ne=e[74];let de;e[75]!==ne?(de=n.jsx(Ft,{asChild:!0,children:n.jsx(fn,{icon:zo,active:!0,value:ne})}),e[75]=ne,e[76]=de):de=e[76];let te;e[77]!==u?(te=u("sandbox.postToolbar.sortBy"),e[77]=u,e[78]=te):te=e[78];let re;e[79]!==te?(re=n.jsx(vt,{children:te}),e[79]=te,e[80]=re):re=e[80];let le;e[81]!==h?(le=H=>h(H),e[81]=h,e[82]=le):le=e[82];let N;e[83]===Symbol.for("react.memo_cache_sentinel")?(N=Object.keys(dn),e[83]=N):N=e[83];let q;e[84]!==u?(q=N.map(H=>n.jsx(Nt,{value:H,children:u(dn[H])},H)),e[84]=u,e[85]=q):q=e[85];let Z;e[86]!==r||e[87]!==le||e[88]!==q?(Z=n.jsx(Rs,{value:r,onValueChange:le,children:q}),e[86]=r,e[87]=le,e[88]=q,e[89]=Z):Z=e[89];let oe;e[90]!==re||e[91]!==Z?(oe=n.jsxs(Kt,{align:"end",className:"w-44",children:[re,Z]}),e[90]=re,e[91]=Z,e[92]=oe):oe=e[92];let S;e[93]!==de||e[94]!==oe?(S=n.jsx("div",{className:"ml-auto shrink-0",children:n.jsxs(zt,{children:[de,oe]})}),e[93]=de,e[94]=oe,e[95]=S):S=e[95];let se;return e[96]!==J||e[97]!==X||e[98]!==S?(se=n.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[J,X,S]}),e[96]=J,e[97]=X,e[98]=S,e[99]=se):se=e[99],se}function xr(t){return n.jsxs(Nt,{value:`author:${t.email}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx($s,{count:t.count})]},`author:${t.email}`)}function br(t){return n.jsxs(Nt,{value:`cat:${t.slug}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx($s,{count:t.count})]},`cat:${t.slug}`)}function yr(t){const e=ae.c(4),{label:s,onClick:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ts,{size:12}),e[0]=a):a=e[0];let l;return e[1]!==s||e[2]!==o?(l=n.jsx("button",{type:"button","aria-label":s,onClick:o,className:"flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer rounded-lg",children:a}),e[1]=s,e[2]=o,e[3]=l):l=e[3],l}function vr(t){const e=ae.c(18),{checked:s,disabled:o,onToggle:a}=t,l=Ne();let i;e[0]!==a?(i=()=>a(),e[0]=a,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==l?(c=l(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=l,e[4]=c):c=e[4];let r;e[5]!==s||e[6]!==o||e[7]!==i||e[8]!==c?(r=n.jsx(Ye,{asChild:!0,children:n.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:jr,children:n.jsx(es,{checked:s,disabled:o,onCheckedChange:i,"aria-label":c})})}),e[5]=s,e[6]=o,e[7]=i,e[8]=c,e[9]=r):r=e[9];let d;e[10]!==s||e[11]!==l?(d=l(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=l,e[12]=d):d=e[12];let p;e[13]!==d?(p=n.jsx(Qe,{side:"bottom",children:d}),e[13]=d,e[14]=p):p=e[14];let m;return e[15]!==r||e[16]!==p?(m=n.jsxs(Xe,{children:[r,p]}),e[15]=r,e[16]=p,e[17]=m):m=e[17],m}function jr(t){return t.stopPropagation()}function kr(t){const e=ae.c(42),{count:s,allSelected:o,onToggleSelectAll:a,onArchive:l,onExit:i}=t,c=Ne();let r;e[0]!==o||e[1]!==a?(r=n.jsx(vr,{checked:o,onToggle:a}),e[0]=o,e[1]=a,e[2]=r):r=e[2];let d;e[3]!==s||e[4]!==c?(d=c("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=c,e[5]=d):d=e[5];let p;e[6]!==d?(p=n.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=p):p=e[7];const m=s===0;let h;e[8]!==c?(h=c("sandbox.postToolbar.archiveSelectedPosts"),e[8]=c,e[9]=h):h=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(To,{size:14}),e[10]=u):u=e[10];let f;e[11]!==l||e[12]!==m||e[13]!==h?(f=n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:m,onClick:l,"aria-label":h,children:u})}),e[11]=l,e[12]=m,e[13]=h,e[14]=f):f=e[14];let x;e[15]!==c?(x=c("sandbox.postToolbar.archiveSelected"),e[15]=c,e[16]=x):x=e[16];let g;e[17]!==x?(g=n.jsx(Qe,{side:"bottom",children:x}),e[17]=x,e[18]=g):g=e[18];let y;e[19]!==f||e[20]!==g?(y=n.jsxs(Xe,{children:[f,g]}),e[19]=f,e[20]=g,e[21]=y):y=e[21];let v;e[22]!==c?(v=c("sandbox.postToolbar.exitSelection"),e[22]=c,e[23]=v):v=e[23];let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ts,{size:14}),e[24]=j):j=e[24];let w;e[25]!==i||e[26]!==v?(w=n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,"aria-label":v,children:j})}),e[25]=i,e[26]=v,e[27]=w):w=e[27];let C;e[28]!==c?(C=c("sandbox.postToolbar.exitSelection"),e[28]=c,e[29]=C):C=e[29];let E;e[30]!==C?(E=n.jsx(Qe,{side:"bottom",children:C}),e[30]=C,e[31]=E):E=e[31];let B;e[32]!==w||e[33]!==E?(B=n.jsxs(Xe,{children:[w,E]}),e[32]=w,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==y||e[36]!==B?(k=n.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[y,B]}),e[35]=y,e[36]=B,e[37]=k):k=e[37];let _;return e[38]!==r||e[39]!==k||e[40]!==p?(_=n.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[r,p,k]}),e[38]=r,e[39]=k,e[40]=p,e[41]=_):_=e[41],_}const Sr={draft:"outline",generating:"secondary",awaiting_review:"warning",scheduled:"secondary",published:"success",archived:"outline"},pn="ideas",hn=t=>t.scheduledDatetime||t.date||"",wr=(t,e)=>hn(e).localeCompare(hn(t)),Nr=t=>t==="scheduled"||t==="published",No="application/x-post-key";function Cr({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,view:a,selectedKey:l,onViewChange:i,onOpen:c,onClose:r,move:d,support:p,meta:m,renderDetail:h}){const u=Ne(),f=js(),x=Zt({orgSlug:t,virtualMcpId:e,branch:s}),g=Mn({orgSlug:t,virtualMcpId:e,branch:s}),y=ol().length>0,[v,j]=$.useState(null),[w,C]=$.useState(!1),[E,B]=$.useState(!1),[k,_]=$.useState(""),[O,L]=$.useState(3),[K,F]=$.useState(""),[D,A]=$.useState(!1),[I,R]=$.useState(!1),[V,z]=$.useState(),[W,P]=$.useState(!1),[U,Y]=$.useState(""),J=$.useRef(null),[X,ce]=Bo(Eo.blogBoardCollapsedLanes(),[]),ne=T=>ce(Q=>Q.includes(T)?Q.filter(Te=>Te!==T):[...Q,T]),de=Zi({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:m,onStarted:c}),te=Zl(o),re=ro(o),le=uo(o),N=T=>le.find(Q=>Q.key===T)?.title,q=T=>mt(o[T],"posts"),Z=l&&te.some(T=>T.key===l)?l:te[0]?.key??null,oe=async T=>{await d.apply(T.key,"archived")&&me.success(u("sandbox.postBoard.archived"))},[S,se]=$.useState(null),[H,ie]=$.useState(null),[ye,pe]=$.useState(null),[ke,he]=$.useState("date-desc"),[je,Se]=$.useState(new Set),Ae=te.reduce((T,Q)=>(T[Q.status]=(T[Q.status]??0)+1,T),{}),Ce=T=>{const Q=new Map;for(const Te of te)for(const Ve of T(Te))Q.set(Ve,(Q.get(Ve)??0)+1);return Q},Pe=Ce(T=>T.categorySlugs),_e=Ce(T=>T.authorEmails),ge=Ge(o,"categories").map(({payload:T})=>({slug:be(T.slug),name:be(T.name)||be(T.slug),count:Pe.get(be(T.slug))??0})),$e=Ge(o,"authors").map(({payload:T})=>({email:be(T.email),name:be(T.name)||be(T.email),count:_e.get(be(T.email))??0})),Le=te.filter(T=>!S||T.categorySlugs.includes(S)).filter(T=>!H||T.authorEmails.includes(H)).filter(T=>!ye||T.status===ye).sort((T,Q)=>{if(ke==="az")return T.title.localeCompare(Q.title);if(ke==="za")return Q.title.localeCompare(T.title);const Te=(T.scheduledDatetime||T.date).localeCompare(Q.scheduledDatetime||Q.date);return ke==="date-asc"?Te:-Te}),M=je.size>0,ve=T=>Se(Q=>{const Te=new Set(Q);return Te.delete(T)||Te.add(T),Te}),we=()=>Se(T=>Le.every(Q=>T.has(Q.key))?new Set:new Set(Le.map(Q=>Q.key))),Oe=async()=>{let T=0;for(const Q of je)await d.apply(Q,"archived")&&(T+=1);Se(new Set),T>0&&me.success(u("sandbox.postBoard.archived"))},os=T=>{z({key:T.key,title:T.title,body:T.body}),R(!0)},as=T=>{g.mutate({blockKey:T.key})},ls=(T,Q)=>{j(null),d.apply(Q,T)},At=()=>{const T=Ut(bs()),Q=oo({title:"",now:new Date});x.mutate({blockKey:T,data:ft(T,Q)}),c(T)},is=()=>{const T=tr(U),Q=fr(T.sections,fo(m));if(Q.length===0&&!T.title.trim()){me.error(u("sandbox.postBoard.importEmpty"));return}const Te=Ut(bs()),Ve=pr({title:T.title,blocks:Q,takenSlugs:te.map(qe=>qe.slug).filter(Boolean),now:new Date});x.mutate({blockKey:Te,data:ft(Te,Ve)}),P(!1),Y(""),me.success(u("sandbox.postBoard.imported")),c(Te)},rs=async()=>{C(!0);const T=le.find(Q=>Q.key===K);try{const Q=o[_s]??{},Te=o[mo],Ve=Ke(Te?.formats).map(Ue=>Ue.name).filter(Boolean),qe=await f.call("BLOG_THEME_SUGGEST",{brand:{companyName:be(Q.companyName),description:be(Q.description),language:be(Q.language),tone:be(Q.tone),targetAudience:be(Q.targetAudience),values:Me(Ke(Q.values)),dos:Me(Ke(Q.dos)),avoid:Me(Ke(Q.avoid))},existingTitles:re.map(Ue=>Ue.title).filter(Boolean),formats:Ve,guidance:[T&&`Every idea must be one angle inside the pillar "${T.title}": ${T.body}`,k.trim()].filter(Boolean).join(`
8
8
 
9
- `)||void 0,count:O}),Ee=bi(re.map(Ue=>Ue.title),qe.themes);if(Ee.length===0){me.info(u("sandbox.postBoard.ideasFailed"));return}let yt=0;for(const Ue of Ee){const at=mi();try{await x.mutateAsync({blockKey:at,data:fi(at,{title:Ue.title,body:Ue.body,pillarKey:T?.key,createdAt:new Date().toISOString()})}),yt++}catch(cs){console.warn("[posts] could not save a generated idea",cs)}}if(yt===0){me.error(u("sandbox.postBoard.ideasFailed"));return}me.success(u("sandbox.postBoard.ideasAdded",{count:String(yt)}))}catch(Q){me.error(Q instanceof Error?Q.message:u("sandbox.postBoard.ideasFailed"))}finally{C(!1)}};return n.jsxs("div",{className:"relative flex h-full min-w-0 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b px-6 py-3",children:[n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border p-0.5",children:[n.jsx(gn,{active:a==="board",onClick:()=>i("board"),icon:n.jsx(Mo,{size:14}),label:u("sandbox.postBoard.viewBoard")}),n.jsx(gn,{active:a==="list",onClick:()=>i("list"),icon:n.jsx(qo,{size:14}),label:u("sandbox.postBoard.viewList")})]})}),n.jsxs("div",{className:"flex items-center gap-2",children:[w&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[n.jsx(Ct,{size:12,className:"animate-spin"}),u("sandbox.postBoard.generatingLabel")]}),n.jsxs(ut,{open:E,onOpenChange:B,children:[n.jsx(Wa,{asChild:!0,children:n.jsxs(Be,{type:"button",variant:"outline",size:"sm",disabled:!0,children:[n.jsx(tt,{size:14}),u("sandbox.postBoard.generateIdeas"),n.jsx(ot,{variant:"secondary",children:u("common.soon")})]})}),n.jsxs(dt,{className:"sm:max-w-lg",children:[n.jsxs(gt,{children:[n.jsx(ct,{children:u("sandbox.postBoard.generateIdeas")}),n.jsx(Vt,{children:u("sandbox.postBoard.ideaGuidanceLabel")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(Rt,{id:"idea-guidance",value:k,rows:6,autoFocus:!0,onChange:T=>_(T.target.value),placeholder:u("sandbox.postBoard.ideaGuidancePlaceholder"),className:"resize-none text-sm"}),le.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(ze,{className:"text-xs",children:u("sandbox.postBoard.ideaPillarLabel")}),n.jsx(wt,{options:le.map(T=>T.title),value:le.find(T=>T.key===K)?.title??"",emptyLabel:u("sandbox.postBoard.ideaNoPillar"),onChange:T=>F(le.find(Q=>Q.title===T)?.key??"")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ze,{htmlFor:"idea-count",className:"text-xs",children:u("sandbox.postBoard.ideaCount")}),n.jsx(Ze,{id:"idea-count",type:"number",min:1,max:8,value:O,onChange:T=>L(Math.max(1,Math.min(8,Number(T.target.value)||1))),className:"h-9 w-16"}),n.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:u("sandbox.postBoard.usesCredits")})]})]}),n.jsx(xt,{children:n.jsxs(Be,{type:"button",onClick:()=>{B(!1),rs()},children:[n.jsx(tt,{size:14}),u("sandbox.postBoard.generateIdeas")]})})]})]}),n.jsxs(zt,{children:[n.jsx(Ft,{asChild:!0,children:n.jsxs(Be,{type:"button",size:"sm",children:[n.jsx(Ss,{size:14}),u("sandbox.postBoard.newPost"),n.jsx(ht,{size:14})]})}),n.jsxs(Kt,{align:"end",className:"w-56",children:[n.jsxs(We,{disabled:!0,onClick:()=>{z(void 0),R(!0)},children:[n.jsx(tt,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[u("sandbox.postBoard.newPostGenerate"),n.jsx(ot,{variant:"secondary",children:u("common.soon")})]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostGenerateHint")})]})]}),n.jsxs(We,{onClick:At,children:[n.jsx(Vo,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:u("sandbox.postBoard.newPostWrite")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostWriteHint")})]})]}),n.jsxs(We,{onClick:()=>P(!0),children:[n.jsx(fs,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:u("sandbox.postBoard.importContent")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.importContentHint")})]})]})]})]}),n.jsx(qi,{open:I,onOpenChange:R,decofile:o,hasAi:y,seed:V,onGenerate:T=>{de(T)}},V?.title??"scratch"),n.jsx(ut,{open:W,onOpenChange:P,children:n.jsxs(dt,{className:"max-h-[85vh] sm:max-w-2xl",children:[n.jsxs(gt,{children:[n.jsx(ct,{children:u("sandbox.postBoard.importTitle")}),n.jsx(Vt,{children:u("sandbox.postBoard.importDescription")})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"h-72 overflow-hidden rounded-[var(--studio-control-radius,var(--radius-xl))] border bg-[var(--studio-input-background)]",children:n.jsx(Un,{code:U,language:ko(U)?"html":"markdown",height:"100%",autoFocus:!0,onChange:T=>Y(T??"")})}),n.jsx("input",{ref:J,type:"file",accept:".html,.htm,.md,.markdown,.txt",className:"hidden",onChange:async T=>{const Q=T.target.files?.[0];Q&&Y(await Q.text()),T.target.value=""}}),n.jsxs(Be,{type:"button",variant:"outline",size:"sm",onClick:()=>J.current?.click(),children:[n.jsx(fs,{size:14}),u("sandbox.postBoard.importUpload")]})]}),n.jsx(xt,{children:n.jsxs(Be,{type:"button",disabled:!U.trim(),onClick:is,children:[n.jsx(fs,{size:14}),u("sandbox.postBoard.importRun")]})})]})})]})]}),te.length===0&&re.length===0?n.jsx(nl,{className:"flex-1",icon:n.jsx(tt,{size:22}),title:u("sandbox.postBoard.emptyTitle"),description:u("sandbox.postBoard.emptyDescription"),buttonProps:{children:u("sandbox.postBoard.newPost"),onClick:At}}):a==="board"?n.jsxs("div",{className:"flex min-h-0 flex-1 gap-3 overflow-x-auto p-4",children:[n.jsx(Er,{ideas:re,collapsed:X.includes(pn),pillarTitleOf:N,onToggleCollapsed:()=>ne(pn),onGenerate:os,onDelete:as}),n.jsx("div",{"aria-hidden":!0,className:"my-1 w-px shrink-0 self-stretch bg-border"}),Ds.map(T=>{const Q=te.filter(Ee=>Ee.status===T);Nr(T)&&Q.sort(wr);const Te=u(Wt[T]),Ve=X.includes(T),qe=vo(p,T);return n.jsx("div",{onDragOver:Ee=>{Ee.preventDefault(),j(T)},onDragLeave:()=>j(Ee=>Ee===T?null:Ee),onDrop:Ee=>{Ee.preventDefault(),ls(T,Ee.dataTransfer.getData(No))},title:qe?jo(u,qe):void 0,className:xe("flex shrink-0 flex-col rounded-xl border bg-muted/30 transition-colors",Ve?"w-11":"w-72",qe&&"opacity-50",v===T&&"border-primary bg-primary/5"),children:Ve?n.jsxs("button",{type:"button",onClick:()=>ne(T),"aria-label":u("sandbox.postBoard.expandLane",{lane:Te}),"aria-expanded":!1,className:"flex min-h-0 flex-1 cursor-pointer flex-col items-center gap-2 py-2.5 text-muted-foreground hover:text-foreground",children:[n.jsx(Et,{size:14,className:"shrink-0"}),n.jsx("span",{className:"text-xs tabular-nums",children:Q.length}),n.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:Te})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",children:[n.jsxs("button",{type:"button",onClick:()=>ne(T),"aria-label":u("sandbox.postBoard.collapseLane",{lane:Te}),"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[n.jsx(ht,{size:14,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:Te})]}),n.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:Q.length})]}),n.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto px-2 pb-2",children:Q.length===0?n.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:u("sandbox.postBoard.laneEmpty")}):Q.map(Ee=>n.jsx(Br,{post:Ee,payload:q(Ee.key),moving:d.isMoving(Ee.key),onOpen:()=>c(Ee.key),onArchive:Ee.status==="archived"?void 0:()=>{oe(Ee)}},Ee.key))})]})},T)})]}):n.jsxs("div",{className:"flex min-h-0 flex-1",children:[n.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-r",children:[M?n.jsx(kr,{count:je.size,allSelected:Le.length>0&&Le.every(T=>je.has(T.key)),onToggleSelectAll:we,onArchive:()=>{Oe()},onExit:()=>Se(new Set)}):n.jsx(gr,{categories:ge,authors:$e,statusCounts:Ae,categoryFilter:S,authorFilter:H,statusFilter:ye,sort:ke,onCategoryFilterChange:se,onAuthorFilterChange:ie,onStatusFilterChange:pe,onSortChange:he}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n.jsx(Pr,{posts:Le,selectedKey:Z,selectionActive:M,selectedKeys:je,onToggleSelect:ve,onOpen:c,isMoving:d.isMoving,onArchive:T=>{oe(T)}})})]}),n.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:Z&&h?n.jsx($.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(Ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(Z)}):n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:u("sandbox.postBoard.selectPrompt")})})]}),a==="board"&&l&&D&&h&&n.jsx("div",{className:"absolute inset-0 z-30 flex flex-col bg-background",children:h(l,{expanded:!0,onToggleExpand:()=>A(!1),onClose:()=>{A(!1),r?.()}})}),n.jsx(ut,{open:a==="board"&&!!l&&!D,onOpenChange:T=>{T||(A(!1),r?.())},children:n.jsxs(dt,{closeButtonClassName:"hidden",className:"left-auto right-4 top-4 bottom-4 flex h-auto translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl",children:[n.jsx(ct,{className:"sr-only",children:u("sandbox.collectionsSidebar.posts")}),l&&h?n.jsx($.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(Ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(l,{expanded:!1,onToggleExpand:()=>A(!0),onClose:()=>r?.()})}):null]})})]})}function gn(t){const e=ae.c(7),{active:s,onClick:o,icon:a,label:l}=t,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground";let c;e[0]!==i?(c=xe("inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",i),e[0]=i,e[1]=c):c=e[1];let r;return e[2]!==a||e[3]!==l||e[4]!==o||e[5]!==c?(r=n.jsxs("button",{type:"button",onClick:o,className:c,children:[a,l]}),e[2]=a,e[3]=l,e[4]=o,e[5]=c,e[6]=r):r=e[6],r}function Pr(t){const e=ae.c(19),{posts:s,selectedKey:o,selectionActive:a,selectedKeys:l,onToggleSelect:i,onOpen:c,isMoving:r,onArchive:d}=t;let p;if(e[0]!==r||e[1]!==d||e[2]!==c||e[3]!==i||e[4]!==s||e[5]!==o||e[6]!==l||e[7]!==a){let h;e[9]!==r||e[10]!==d||e[11]!==c||e[12]!==i||e[13]!==o||e[14]!==l||e[15]!==a?(h=u=>n.jsx(Tr,{post:u,selected:u.key===o,selectionActive:a,checked:l.has(u.key),onToggleSelect:()=>i(u.key),moving:r(u.key),onOpen:()=>c(u.key),onArchive:u.status==="archived"?void 0:()=>d(u)},u.key),e[9]=r,e[10]=d,e[11]=c,e[12]=i,e[13]=o,e[14]=l,e[15]=a,e[16]=h):h=e[16],p=s.map(h),e[0]=r,e[1]=d,e[2]=c,e[3]=i,e[4]=s,e[5]=o,e[6]=l,e[7]=a,e[8]=p}else p=e[8];let m;return e[17]!==p?(m=n.jsx("ul",{className:"divide-y",children:p}),e[17]=p,e[18]=m):m=e[18],m}function Tr(t){const e=ae.c(56),{post:s,selected:o,selectionActive:a,checked:l,onToggleSelect:i,moving:c,onOpen:r,onArchive:d}=t,p=Ne(),m=s.status==="awaiting_review"&&s.missing.length>0,h=s.status==="scheduled"||s.status==="published",u=a||l?"opacity-100":"opacity-0 focus-within:opacity-100 group-hover/row:opacity-100";let f;e[0]!==u?(f=xe("absolute left-3 top-3 z-10 transition-opacity",u),e[0]=u,e[1]=f):f=e[1];let x;e[2]!==i?(x=()=>i(),e[2]=i,e[3]=x):x=e[3];let g;e[4]!==s.title||e[5]!==p?(g=s.title||p("sandbox.postBoard.untitled"),e[4]=s.title,e[5]=p,e[6]=g):g=e[6];let y;e[7]!==l||e[8]!==x||e[9]!==g?(y=n.jsx(es,{checked:l,onCheckedChange:x,"aria-label":g}),e[7]=l,e[8]=x,e[9]=g,e[10]=y):y=e[10];let v;e[11]!==f||e[12]!==y?(v=n.jsx("span",{className:f,children:y}),e[11]=f,e[12]=y,e[13]=v):v=e[13];let j;e[14]!==c||e[15]!==d||e[16]!==a?(j=d&&!a&&n.jsx(Ls,{onArchive:d,disabled:c,className:"top-2.5"}),e[14]=c,e[15]=d,e[16]=a,e[17]=j):j=e[17];let w;e[18]!==r||e[19]!==i||e[20]!==a?(w=()=>a?i():r(),e[18]=r,e[19]=i,e[20]=a,e[21]=w):w=e[21];const C=o?"bg-accent text-accent-foreground":"bg-card hover:bg-muted/50";let E;e[22]!==C?(E=xe("flex w-full cursor-pointer flex-col gap-1.5 py-2.5 pl-10 pr-3 text-left text-sm transition-colors",C),e[22]=C,e[23]=E):E=e[23];let B;e[24]!==s.title||e[25]!==p?(B=s.title||p("sandbox.postBoard.untitled"),e[24]=s.title,e[25]=p,e[26]=B):B=e[26];let k;e[27]!==B?(k=n.jsx("span",{className:"min-w-0 truncate pr-6 font-medium",children:B}),e[27]=B,e[28]=k):k=e[28];const _=Sr[s.status],O=Wt[s.status];let L;e[29]!==p||e[30]!==O?(L=p(O),e[29]=p,e[30]=O,e[31]=L):L=e[31];let K;e[32]!==_||e[33]!==L?(K=n.jsx(ot,{variant:_,className:"shrink-0",children:L}),e[32]=_,e[33]=L,e[34]=K):K=e[34];let F;e[35]!==m||e[36]!==s.missing?(F=m&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[n.jsx(Qt,{size:12}),s.missing.length]}),e[35]=m,e[36]=s.missing,e[37]=F):F=e[37];let D;e[38]!==h||e[39]!==s.date||e[40]!==s.scheduledDatetime?(D=h&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[n.jsx(ks,{size:12}),(s.scheduledDatetime||s.date||"").slice(0,10)]}),e[38]=h,e[39]=s.date,e[40]=s.scheduledDatetime,e[41]=D):D=e[41];let A;e[42]!==K||e[43]!==F||e[44]!==D?(A=n.jsxs("div",{className:"flex items-center gap-2",children:[K,F,D]}),e[42]=K,e[43]=F,e[44]=D,e[45]=A):A=e[45];let I;e[46]!==o||e[47]!==E||e[48]!==k||e[49]!==A||e[50]!==w?(I=n.jsxs("button",{type:"button",onClick:w,"aria-current":o,className:E,children:[k,A]}),e[46]=o,e[47]=E,e[48]=k,e[49]=A,e[50]=w,e[51]=I):I=e[51];let R;return e[52]!==I||e[53]!==v||e[54]!==j?(R=n.jsxs("li",{className:"group/row relative",children:[v,j,I]}),e[52]=I,e[53]=v,e[54]=j,e[55]=R):R=e[55],R}function Br(t){const e=ae.c(46),{post:s,payload:o,moving:a,onOpen:l,onArchive:i}=t,c=Ne(),r=s.status!=="generating"&&!a;let d;e[0]!==o?(d=Ql(o),e[0]=o,e[1]=d):d=e[1];const p=d,m=!r&&"opacity-80";let h;e[2]!==m?(h=xe("group/card relative rounded-lg border bg-card shadow-sm transition-colors hover:border-primary/40",m),e[2]=m,e[3]=h):h=e[3];let u;e[4]!==a||e[5]!==i?(u=i&&n.jsx(Ls,{onArchive:i,disabled:a,className:"top-2"}),e[4]=a,e[5]=i,e[6]=u):u=e[6];let f;e[7]!==s.key?(f=O=>O.dataTransfer.setData(No,s.key),e[7]=s.key,e[8]=f):f=e[8];const x=r?"cursor-grab active:cursor-grabbing":"cursor-pointer";let g;e[9]!==x?(g=xe("block w-full p-3 text-left",x),e[9]=x,e[10]=g):g=e[10];let y;e[11]!==s.title||e[12]!==c?(y=s.title||c("sandbox.postBoard.untitled"),e[11]=s.title,e[12]=c,e[13]=y):y=e[13];let v;e[14]!==y?(v=n.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:y}),e[14]=y,e[15]=v):v=e[15];let j;e[16]!==p||e[17]!==s.status?(j=s.status==="draft"&&n.jsxs(n.Fragment,{children:[p.pillarTitle&&n.jsx(ot,{variant:"secondary",className:"max-w-full truncate",children:p.pillarTitle}),p.format?.name&&n.jsx(ot,{variant:"outline",className:"max-w-full truncate",children:p.format.name})]}),e[16]=p,e[17]=s.status,e[18]=j):j=e[18];let w;e[19]!==s.status||e[20]!==c?(w=s.status==="generating"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx(Ct,{size:12,className:"animate-spin"}),c("sandbox.postBoard.generatingLabel")]}),e[19]=s.status,e[20]=c,e[21]=w):w=e[21];let C;e[22]!==s.missing||e[23]!==s.status||e[24]!==c?(C=s.status==="awaiting_review"&&(s.missing.length>0?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[n.jsx(Qt,{size:12}),c("sandbox.postBoard.nIssues",{count:String(s.missing.length)})]}):n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-success",children:[n.jsx(sl,{size:12}),c("sandbox.postBoard.readyToSchedule")]})),e[22]=s.missing,e[23]=s.status,e[24]=c,e[25]=C):C=e[25];let E;e[26]!==s.date||e[27]!==s.scheduledDatetime||e[28]!==s.status?(E=(s.status==="scheduled"||s.status==="published")&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[n.jsx(ks,{size:12}),(s.scheduledDatetime||s.date||"").slice(0,10)]}),e[26]=s.date,e[27]=s.scheduledDatetime,e[28]=s.status,e[29]=E):E=e[29];let B;e[30]!==j||e[31]!==w||e[32]!==C||e[33]!==E?(B=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[j,w,C,E]}),e[30]=j,e[31]=w,e[32]=C,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==r||e[36]!==l||e[37]!==B||e[38]!==f||e[39]!==g||e[40]!==v?(k=n.jsxs("button",{type:"button",draggable:r,onDragStart:f,onClick:l,className:g,children:[v,B]}),e[35]=r,e[36]=l,e[37]=B,e[38]=f,e[39]=g,e[40]=v,e[41]=k):k=e[41];let _;return e[42]!==k||e[43]!==h||e[44]!==u?(_=n.jsxs("div",{className:h,children:[u,k]}),e[42]=k,e[43]=h,e[44]=u,e[45]=_):_=e[45],_}function Er(t){const e=ae.c(40),{ideas:s,collapsed:o,pillarTitleOf:a,onToggleCollapsed:l,onGenerate:i,onDelete:c}=t,r=Ne();let d,p,m,h,u,f,x;if(e[0]!==o||e[1]!==s.length||e[2]!==l||e[3]!==r){x=Symbol.for("react.early_return_sentinel");e:{if(d=r("sandbox.postBoard.ideasTray"),o){let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(Et,{size:14,className:"shrink-0"}),e[11]=k):k=e[11];let _;e[12]!==s.length?(_=n.jsx("span",{className:"text-xs tabular-nums",children:s.length}),e[12]=s.length,e[13]=_):_=e[13],x=n.jsxs("button",{type:"button",onClick:l,"aria-label":r("sandbox.postBoard.expandLane",{lane:d}),"aria-expanded":!1,className:"flex w-11 shrink-0 cursor-pointer flex-col items-center gap-2 py-2.5 text-muted-foreground hover:text-foreground",children:[k,_,n.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:d})]});break e}f="flex w-72 shrink-0 flex-col",u="flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",p="button",m=l,h=r("sandbox.postBoard.collapseLane",{lane:d})}e[0]=o,e[1]=s.length,e[2]=l,e[3]=r,e[4]=d,e[5]=p,e[6]=m,e[7]=h,e[8]=u,e[9]=f,e[10]=x}else d=e[4],p=e[5],m=e[6],h=e[7],u=e[8],f=e[9],x=e[10];if(x!==Symbol.for("react.early_return_sentinel"))return x;let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(ht,{size:14,className:"shrink-0"}),e[14]=g):g=e[14];let y;e[15]!==d?(y=n.jsx("span",{className:"truncate",children:d}),e[15]=d,e[16]=y):y=e[16];let v;e[17]!==p||e[18]!==m||e[19]!==h||e[20]!==y?(v=n.jsxs("button",{type:p,onClick:m,"aria-label":h,"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[g,y]}),e[17]=p,e[18]=m,e[19]=h,e[20]=y,e[21]=v):v=e[21];let j;e[22]!==s.length?(j=n.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:s.length}),e[22]=s.length,e[23]=j):j=e[23];let w;e[24]!==j||e[25]!==u||e[26]!==v?(w=n.jsxs("div",{className:u,children:[v,j]}),e[24]=j,e[25]=u,e[26]=v,e[27]=w):w=e[27];let C;e[28]!==s||e[29]!==c||e[30]!==i||e[31]!==a||e[32]!==r?(C=s.length===0?n.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.postBoard.ideasEmpty")}):s.map(k=>{const _=a(k.pillarKey);return n.jsxs("div",{className:"group/card relative rounded-lg border border-dashed bg-card shadow-sm transition-colors hover:border-primary/40",children:[n.jsx(Ls,{label:r("sandbox.postBoard.deleteIdea"),onArchive:()=>c(k),className:"top-2"}),n.jsxs("div",{className:"p-3",children:[n.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:k.title||r("sandbox.postBoard.untitledIdea")}),k.body&&n.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:k.body}),_&&n.jsx(ot,{variant:"secondary",className:"mt-2 max-w-full truncate",children:_})]}),n.jsx("div",{className:"border-t px-3 py-2",children:n.jsxs(Be,{type:"button",variant:"ghost",size:"sm",disabled:!0,className:"h-7 w-full justify-start px-1.5 text-xs",onClick:()=>i(k),children:[n.jsx(tt,{size:13}),r("sandbox.postBoard.writeFromIdea"),n.jsx(ot,{variant:"secondary",className:"ml-auto",children:r("common.soon")})]})})]},k.key)}),e[28]=s,e[29]=c,e[30]=i,e[31]=a,e[32]=r,e[33]=C):C=e[33];let E;e[34]!==C?(E=n.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto pb-2 pr-1",children:C}),e[34]=C,e[35]=E):E=e[35];let B;return e[36]!==w||e[37]!==E||e[38]!==f?(B=n.jsxs("div",{className:f,children:[w,E]}),e[36]=w,e[37]=E,e[38]=f,e[39]=B):B=e[39],B}function Ls(t){const e=ae.c(13),{label:s,onArchive:o,disabled:a,className:l}=t,i=Ne();let c;e[0]!==s||e[1]!==i?(c=s??i("sandbox.postBoard.delete"),e[0]=s,e[1]=i,e[2]=c):c=e[2];const r=c;let d;e[3]!==o?(d=u=>{u.stopPropagation(),o()},e[3]=o,e[4]=d):d=e[4];let p;e[5]!==l?(p=xe("absolute right-2 z-10 flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-destructive focus-visible:opacity-100 group-hover/card:opacity-100 group-hover/row:opacity-100",l),e[5]=l,e[6]=p):p=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ps,{size:13}),e[7]=m):m=e[7];let h;return e[8]!==a||e[9]!==d||e[10]!==p||e[11]!==r?(h=n.jsx("button",{type:"button",disabled:a,"aria-label":r,title:r,onClick:d,className:p,children:m}),e[8]=a,e[9]=d,e[10]=p,e[11]=r,e[12]=h):h=e[12],h}function He(t){const e=ae.c(50),{icon:s,logoUrl:o,title:a,subtitle:l,active:i,accent:c,variantCount:r,trailing:d,selectable:p,selectionActive:m,selected:h,invalid:u,invalidReason:f,onToggleSelect:x,onClick:g,menu:y}=t,v=Ne(),j=c==="global";let w;e[0]!==s||e[1]!==i||e[2]!==j||e[3]!==o?(w=o?n.jsx("img",{src:o,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx("span",{className:xe("flex size-8 shrink-0 items-center justify-center rounded-lg",j?"bg-global-section/15":"bg-muted"),children:n.jsx(s,{size:16,className:xe("shrink-0",!j&&(i?"text-accent-foreground":"text-muted-foreground")),style:j?{color:Cs}:void 0})}),e[0]=s,e[1]=i,e[2]=j,e[3]=o,e[4]=w):w=e[4];const C=w,E=i?j?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":j?"hover:bg-global-section/10":"hover:bg-muted";let B;e[5]!==E?(B=xe("group relative flex min-w-0 items-center rounded-md transition-colors",E),e[5]=E,e[6]=B):B=e[6];let k;e[7]!==x||e[8]!==p||e[9]!==h||e[10]!==m||e[11]!==v||e[12]!==a?(k=p&&n.jsx("span",{className:xe("flex shrink-0 items-center pl-2.5 transition-opacity",h||m?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Dr,children:n.jsx(es,{checked:h,onCheckedChange:()=>x?.(),"aria-label":v("sandbox.itemRow.selectItem",{title:a})})}),e[7]=x,e[8]=p,e[9]=h,e[10]=m,e[11]=v,e[12]=a,e[13]=k):k=e[13];const _=u&&!i&&"text-destructive";let O;e[14]!==_?(O=xe("block truncate text-sm font-medium",_),e[14]=_,e[15]=O):O=e[15];let L;e[16]!==O||e[17]!==a?(L=n.jsx("span",{className:O,children:a}),e[16]=O,e[17]=a,e[18]=L):L=e[18];const K=i?"text-accent-foreground/70":"text-muted-foreground";let F;e[19]!==K?(F=xe("block truncate text-xs",K),e[19]=K,e[20]=F):F=e[20];let D;e[21]!==l||e[22]!==F?(D=n.jsx("span",{className:F,children:l}),e[21]=l,e[22]=F,e[23]=D):D=e[23];let A;e[24]!==D||e[25]!==L?(A=n.jsxs("span",{className:"min-w-0 flex-1",children:[L,D]}),e[24]=D,e[25]=L,e[26]=A):A=e[26];let I;e[27]!==i||e[28]!==v||e[29]!==r?(I=r!==void 0&&r>1&&n.jsxs(Xe,{children:[n.jsx(Ye,{asChild:!0,children:n.jsxs("span",{className:xe("flex shrink-0 items-center gap-1 text-xs font-medium",i?"text-accent-foreground/70":"text-muted-foreground"),children:[n.jsx(Pn,{size:14}),r]})}),n.jsx(Qe,{side:"bottom",children:v("sandbox.itemRow.variantCount",{count:r})})]}),e[27]=i,e[28]=v,e[29]=r,e[30]=I):I=e[30];let R;e[31]!==i||e[32]!==u||e[33]!==f?(R=u&&n.jsxs(Xe,{children:[n.jsx(Ye,{asChild:!0,children:n.jsx("span",{className:xe("flex shrink-0 items-center",i?"text-accent-foreground":"text-destructive"),children:n.jsx(Qt,{size:14})})}),f&&n.jsx(Qe,{side:"bottom",children:f})]}),e[31]=i,e[32]=u,e[33]=f,e[34]=R):R=e[34];let V;e[35]!==g||e[36]!==C||e[37]!==A||e[38]!==I||e[39]!==R||e[40]!==d?(V=n.jsxs("button",{type:"button",onClick:g,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg px-2.5 py-2 text-left cursor-pointer",children:[C,A,I,R,d]}),e[35]=g,e[36]=C,e[37]=A,e[38]=I,e[39]=R,e[40]=d,e[41]=V):V=e[41];let z;e[42]!==i||e[43]!==y?(z=y&&n.jsx("div",{className:xe("pr-1 opacity-0 transition-opacity group-hover:opacity-100",i&&"opacity-100"),children:y}),e[42]=i,e[43]=y,e[44]=z):z=e[44];let W;return e[45]!==V||e[46]!==z||e[47]!==B||e[48]!==k?(W=n.jsxs("div",{className:B,children:[k,V,z]}),e[45]=V,e[46]=z,e[47]=B,e[48]=k,e[49]=W):W=e[49],W}function Dr(t){return t.stopPropagation()}function st(t){const e=ae.c(10),{icon:s,title:o,description:a}=t;let l;e[0]!==s?(l=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=l):l=e[1];let i;e[2]!==o?(i=n.jsx("div",{children:o}),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==a?(c=a&&n.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:a}),e[4]=a,e[5]=c):c=e[5];let r;return e[6]!==l||e[7]!==i||e[8]!==c?(r=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[l,i,c]}),e[6]=l,e[7]=i,e[8]=c,e[9]=r):r=e[9],r}const _r={loaders:Cn,actions:Vn},Ar={loaders:"Loaders",actions:"Actions"},$r={analytics:Ho,blog:Mn,commerce:Uo,site:Go,website:Mt};function Lr(t,e){return e===0?$r[t.toLowerCase()]??Ks:Ks}function Lt(t,e){return e===0?ma(t):t}function Or(t){const e=ae.c(98),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r}=t,d=Ne();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];const[m,h]=$.useState(p),[u,f]=$.useState(null),[x,g]=$.useState(""),[y,v]=$.useState(Gr),[j,w]=$.useState(r);j!==r&&(w(r),h([]),f(null),g(""),v(new Set));let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=J=>{v(X=>{const ce=new Set(X);return ce.has(J)?ce.delete(J):ce.add(J),ce})},e[1]=C):C=e[1];const E=C;let B;e[2]!==a||e[3]!==s||e[4]!==o?(B={orgSlug:s,virtualMcpId:o,branch:a},e[2]=a,e[3]=s,e[4]=o,e[5]=B):B=e[5];const k=Zt(B);let _;e[6]!==k?(_=In((J,X)=>k.mutate({blockKey:J,data:X})),e[6]=k,e[7]=_):_=e[7];const O=_;let L;e[8]!==r?(L=fa(r),e[8]=r,e[9]=L):L=e[9];const K=L,F=_r[r];let D,A,I,R,V,z,W;if(e[10]!==F||e[11]!==a||e[12]!==c||e[13]!==r||e[14]!==i||e[15]!==y||e[16]!==s||e[17]!==m||e[18]!==l||e[19]!==k||e[20]!==O||e[21]!==x||e[22]!==u||e[23]!==K||e[24]!==d||e[25]!==o){I=Symbol.for("react.early_return_sentinel");e:{const J=[...ra(i,c,r).map(Vr),...ca(i,r).map(Mr)],X=x.trim().toLowerCase(),ce=X.length>0,ne=ce?J.filter(M=>M.title.toLowerCase().includes(X)||M.resolveType.toLowerCase().includes(X)):[],de=new Map,te=[],re=new Map;if(!ce){for(const M of J){const ve=M.folderPath;if(!(ve.length<m.length)&&m.every((we,Oe)=>ve[Oe]===we))if(ve.length===m.length)if(M.savedKey!==void 0){const we=re.get(M.resolveType);we?we.push(M):re.set(M.resolveType,[M])}else te.push(M);else{const we=ve[m.length],Oe=de.get(we)??{count:0,savedCount:0};M.savedKey!==void 0?Oe.savedCount=Oe.savedCount+1:Oe.count=Oe.count+1,de.set(we,Oe)}}te.sort(zr);for(const M of re.values())M.sort(Kr)}const le=[...re.entries()].filter(M=>{const[ve]=M;return!te.some(we=>we.resolveType===ve)}).flatMap(Fr).sort(Rr);let N;e[33]!==m?(N=(M,ve)=>Lt(M.name,m.length).localeCompare(Lt(ve.name,m.length)),e[33]=m,e[34]=N):N=e[34];const q=[...de.entries()].map(Ir).sort(N);let Z;e[35]===Symbol.for("react.memo_cache_sentinel")?(Z=M=>{f(M.savedKey!==void 0?{mode:"saved",key:M.savedKey}:{mode:"available",resolveType:M.resolveType,title:M.title})},e[35]=Z):Z=e[35];const oe=Z;let S;e[36]!==k||e[37]!==K||e[38]!==d?(S=async(M,ve)=>{await k.mutateAsync({blockKey:M,data:ve}),me.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:K,blockId:M})),f({mode:"saved",key:M})},e[36]=k,e[37]=K,e[38]=d,e[39]=S):S=e[39];const se=S;let H;e[40]!==c||e[41]!==u?(H=Ur(u,c),e[40]=c,e[41]=u,e[42]=H):H=e[42];const ie=H;if(ie){const M=`${ie.mode}:${ie.mode==="saved"?ie.blockKey:ie.resolveType}`;let ve;e[43]===Symbol.for("react.memo_cache_sentinel")?(ve=()=>f(null),e[43]=ve):ve=e[43];let we;e[44]!==a||e[45]!==c||e[46]!==se||e[47]!==r||e[48]!==i||e[49]!==s||e[50]!==l||e[51]!==k.isPending||e[52]!==O||e[53]!==M||e[54]!==ie.editorTarget||e[55]!==ie.initialValue||e[56]!==o?(we=n.jsx(da,{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r,target:ie.editorTarget,initialValue:ie.initialValue,isCreating:k.isPending,onCreate:se,onSaveReferencedBlock:O,onBack:ve},M),e[44]=a,e[45]=c,e[46]=se,e[47]=r,e[48]=i,e[49]=s,e[50]=l,e[51]=k.isPending,e[52]=O,e[53]=M,e[54]=ie.editorTarget,e[55]=ie.initialValue,e[56]=o,e[57]=we):we=e[57],I=we;break e}W="flex h-full w-full min-w-0 flex-col";let ye;e[58]!==d?(ye=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ye):ye=e[59];let pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>h([]),e[60]=pe):pe=e[60];const ke=m.length===0?"font-medium text-foreground":"text-muted-foreground";let he;e[61]!==ke?(he=xe("min-w-0 truncate rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ke),e[61]=ke,e[62]=he):he=e[62];const je=Ar[r];let Se;e[63]!==he||e[64]!==je?(Se=n.jsx("button",{type:"button",onClick:pe,className:he,children:je}),e[63]=he,e[64]=je,e[65]=Se):Se=e[65];let Ae;e[66]!==m?(Ae=m.map((M,ve)=>{const we=ve===m.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[n.jsx(Et,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>h(m.slice(0,ve+1)),className:xe("min-w-0 truncate rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",we?"font-medium text-foreground":"text-muted-foreground"),children:Lt(M,ve)})]},`${M}-${ve}`)}),e[66]=m,e[67]=Ae):Ae=e[67];let Ce;e[68]!==ye||e[69]!==Se||e[70]!==Ae?(Ce=n.jsxs("nav",{"aria-label":ye,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Se,Ae]}),e[68]=ye,e[69]=Se,e[70]=Ae,e[71]=Ce):Ce=e[71];let Pe;e[72]===Symbol.for("react.memo_cache_sentinel")?(Pe=n.jsx(En,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Pe):Pe=e[72];let _e;e[73]===Symbol.for("react.memo_cache_sentinel")?(_e=M=>g(M.target.value),e[73]=_e):_e=e[73];let ge;e[74]!==r||e[75]!==d?(ge=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:r}),e[74]=r,e[75]=d,e[76]=ge):ge=e[76];let $e;e[77]!==r||e[78]!==d?($e=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:r}),e[77]=r,e[78]=d,e[79]=$e):$e=e[79];let Le;e[80]!==x||e[81]!==ge||e[82]!==$e?(Le=n.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Pe,n.jsx("input",{type:"text",value:x,onChange:_e,placeholder:ge,"aria-label":$e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=x,e[81]=ge,e[82]=$e,e[83]=Le):Le=e[83],e[84]!==Ce||e[85]!==Le?(A=n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[Ce,Le]}),e[84]=Ce,e[85]=Le,e[86]=A):A=e[86],D=Xt,z="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",R="mx-auto w-full max-w-4xl px-6 py-5",V=ce?ne.length===0?n.jsx(st,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:r,query:x.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):n.jsx("div",{className:"flex flex-col gap-1",children:ne.map(M=>n.jsx(He,{icon:F,accent:M.savedKey!==void 0?"global":void 0,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)},M.savedKey??M.resolveType))}):q.length===0&&te.length===0&&le.length===0?n.jsx(st,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:r}),description:m.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):n.jsxs(n.Fragment,{children:[q.length>0&&n.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:q.map(M=>{const ve=Lr(M.name,m.length);return n.jsxs("button",{type:"button",onClick:()=>h([...m,M.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[n.jsx(ve,{size:18,className:"shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-sm font-medium",children:Lt(M.name,m.length)}),n.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[M.count," ",M.count===1?K:r,M.savedCount>0&&n.jsxs(n.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:M.savedCount})]})]})]})]},M.name)})}),(te.length>0||le.length>0)&&n.jsxs("div",{className:xe("flex flex-col gap-1",q.length>0&&"mt-4"),children:[te.map(M=>{const ve=re.get(M.resolveType)??[],we=y.has(M.resolveType);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(He,{icon:F,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)}),ve.length>0&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>E(M.resolveType),"aria-expanded":we,className:"flex items-center gap-1 self-start rounded-lg px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:Cs},children:[we?n.jsx(ht,{size:12,className:"shrink-0"}):n.jsx(Et,{size:12,className:"shrink-0"}),d(we?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ve.length,")"]}),we&&n.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ve.map(Oe=>n.jsx(He,{icon:F,accent:"global",title:Oe.title,subtitle:Oe.resolveType,active:!1,onClick:()=>oe(Oe)},Oe.savedKey))})]})]},M.resolveType)}),le.map(M=>n.jsx(He,{icon:F,accent:"global",title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)},M.savedKey))]})]})}e[10]=F,e[11]=a,e[12]=c,e[13]=r,e[14]=i,e[15]=y,e[16]=s,e[17]=m,e[18]=l,e[19]=k,e[20]=O,e[21]=x,e[22]=u,e[23]=K,e[24]=d,e[25]=o,e[26]=D,e[27]=A,e[28]=I,e[29]=R,e[30]=V,e[31]=z,e[32]=W}else D=e[26],A=e[27],I=e[28],R=e[29],V=e[30],z=e[31],W=e[32];if(I!==Symbol.for("react.early_return_sentinel"))return I;let P;e[87]!==R||e[88]!==V?(P=n.jsx("div",{className:R,children:V}),e[87]=R,e[88]=V,e[89]=P):P=e[89];let U;e[90]!==D||e[91]!==P||e[92]!==z?(U=n.jsx(D,{className:z,children:P}),e[90]=D,e[91]=P,e[92]=z,e[93]=U):U=e[93];let Y;return e[94]!==A||e[95]!==U||e[96]!==W?(Y=n.jsxs("div",{className:W,children:[A,U]}),e[94]=A,e[95]=U,e[96]=W,e[97]=Y):Y=e[97],Y}function Ir(t){const[e,s]=t;return{name:e,...s}}function Rr(t,e){return t.title.localeCompare(e.title)}function Fr(t){const[,e]=t;return e}function Kr(t,e){return t.title.localeCompare(e.title)}function zr(t,e){return t.title.localeCompare(e.title)}function Mr(t){return{resolveType:t.resolveType,title:t.title,folderPath:On(t.resolveType)}}function Vr(t){return{resolveType:t.resolveType,title:t.title,folderPath:On(t.resolveType),savedKey:t.key}}function Gr(){return new Set}function Ur(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:o,title:a}=ua(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:a},initialValue:o}}function Hr(t){const e=ae.c(106),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,resolveType:r,title:d,defaultBlockId:p,isCreating:m,onCreate:h,onSaveReferencedBlock:u}=t,f=Ne(),x=Dt(),g=x?.virtualMcpId,v=Hn(g===o?o:null)?.metadata?.siteSlug??null;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={},e[0]=j):j=e[0];const[w,C]=$.useState(j);let E;e[1]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[1]=E):E=e[1];const[B,k]=$.useState(E),[_,O]=$.useState(0),[L,K]=$.useState(!1);let F;e[2]!==i||e[3]!==r?(F=ws(r,i),e[2]=i,e[3]=r,e[4]=F):F=e[4];const D=F;let A,I,R,V,z,W,P,U;if(e[5]!==v||e[6]!==a||e[7]!==c||e[8]!==B||e[9]!==w||e[10]!==m||e[11]!==h||e[12]!==s||e[13]!==l||e[14]!==r||e[15]!==f||e[16]!==x?.taskId||e[17]!==d||e[18]!==o){const te=r.split("/").pop()?.replace(/\.tsx?$/,"")??r,re=x?.taskId??null,le=l??void 0;let N;e[27]!==v||e[28]!==a||e[29]!==s||e[30]!==le||e[31]!==re||e[32]!==o?(N={orgSlug:s,virtualMcpId:o,branch:a,threadId:re,previewUrl:le,siteSlug:v},e[27]=v,e[28]=a,e[29]=s,e[30]=le,e[31]=re,e[32]=o,e[33]=N):N=e[33],I=N;let q,Z,oe,S;if(e[34]!==c||e[35]!==B||e[36]!==w||e[37]!==h||e[38]!==f||e[39]!==d){const Se=[d,...B],Ae=Pe=>{k(B.slice(0,Pe)),O(Jr)};let Ce;e[48]!==c||e[49]!==w||e[50]!==h?(Ce=async Pe=>{const _e=ha(Pe,c);if(_e){me.error(_e);return}await h(Pe,w),K(!1)},e[48]=c,e[49]=w,e[50]=h,e[51]=Ce):Ce=e[51],A=Ce,U="flex h-full w-full min-w-0",P="flex min-w-0 flex-1 flex-col",z="shrink-0 border-b px-3 py-2.5",S="flex min-w-0 items-center gap-2 overflow-hidden",e[52]!==f?(q=f("sandbox.availableSectionEditor.editingBreadcrumb"),e[52]=f,e[53]=q):q=e[53],Z="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",oe=Se.map((Pe,_e)=>{const ge=_e===Se.length-1,$e=pa(Pe);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[_e>0&&n.jsx(Et,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Ae(_e),title:$e,className:xe("min-w-0 truncate rounded-lg px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ge?"font-medium text-foreground":"text-muted-foreground"),children:$e})]},`${$e}-${_e}`)}),e[34]=c,e[35]=B,e[36]=w,e[37]=h,e[38]=f,e[39]=d,e[40]=A,e[41]=q,e[42]=Z,e[43]=oe,e[44]=S,e[45]=z,e[46]=P,e[47]=U}else A=e[40],q=e[41],Z=e[42],oe=e[43],S=e[44],z=e[45],P=e[46],U=e[47];let se;e[54]!==q||e[55]!==Z||e[56]!==oe?(se=n.jsx("nav",{"aria-label":q,className:Z,children:oe}),e[54]=q,e[55]=Z,e[56]=oe,e[57]=se):se=e[57];let H;e[58]===Symbol.for("react.memo_cache_sentinel")?(H=()=>K(!0),e[58]=H):H=e[58];let ie;e[59]!==f?(ie=f("sandbox.availableSectionEditor.saveAsGlobalSection"),e[59]=f,e[60]=ie):ie=e[60];let ye;e[61]===Symbol.for("react.memo_cache_sentinel")?(ye=n.jsx(Jo,{size:14}),e[61]=ye):ye=e[61];let pe;e[62]!==m||e[63]!==ie?(pe=n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{size:"icon",className:"size-8 shrink-0",disabled:m,onClick:H,"aria-label":ie,children:ye})}),e[62]=m,e[63]=ie,e[64]=pe):pe=e[64];let ke;e[65]!==f?(ke=f("sandbox.availableSectionEditor.saveAsGlobalSection"),e[65]=f,e[66]=ke):ke=e[66];let he;e[67]!==ke?(he=n.jsx(Qe,{side:"bottom",children:ke}),e[67]=ke,e[68]=he):he=e[68];let je;e[69]!==pe||e[70]!==he?(je=n.jsxs(Xe,{children:[pe,he]}),e[69]=pe,e[70]=he,e[71]=je):je=e[71],e[72]!==S||e[73]!==se||e[74]!==je?(W=n.jsxs("div",{className:S,children:[se,je]}),e[72]=S,e[73]=se,e[74]=je,e[75]=W):W=e[75],R="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",V=f("sandbox.availableSectionEditor.localEditsHint",{typeLabel:te}),e[5]=v,e[6]=a,e[7]=c,e[8]=B,e[9]=w,e[10]=m,e[11]=h,e[12]=s,e[13]=l,e[14]=r,e[15]=f,e[16]=x?.taskId,e[17]=d,e[18]=o,e[19]=A,e[20]=I,e[21]=R,e[22]=V,e[23]=z,e[24]=W,e[25]=P,e[26]=U}else A=e[19],I=e[20],R=e[21],V=e[22],z=e[23],W=e[24],P=e[25],U=e[26];let Y;e[76]!==R||e[77]!==V?(Y=n.jsx("p",{className:R,children:V}),e[76]=R,e[77]=V,e[78]=Y):Y=e[78];let J;e[79]!==Y||e[80]!==z||e[81]!==W?(J=n.jsxs("div",{className:z,children:[W,Y]}),e[79]=Y,e[80]=z,e[81]=W,e[82]=J):J=e[82];let X;e[83]!==c||e[84]!==B||e[85]!==_||e[86]!==w||e[87]!==i||e[88]!==u||e[89]!==I||e[90]!==D||e[91]!==f?(X=n.jsx(Xt,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:D?n.jsx(Rn,{schema:D,value:w,onChange:te=>C(te),basePath:"",breadcrumbPath:B,onBreadcrumbChange:k,meta:i,decofile:c,onSaveReferencedBlock:u,sandbox:I},_):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sandbox.availableSectionEditor.noEditableFields")})})})}),e[83]=c,e[84]=B,e[85]=_,e[86]=w,e[87]=i,e[88]=u,e[89]=I,e[90]=D,e[91]=f,e[92]=X):X=e[92];let ce;e[93]!==J||e[94]!==X||e[95]!==P?(ce=n.jsxs("div",{className:P,children:[J,X]}),e[93]=J,e[94]=X,e[95]=P,e[96]=ce):ce=e[96];let ne;e[97]!==p||e[98]!==A||e[99]!==m||e[100]!==L?(ne=n.jsx(ga,{open:L,onOpenChange:K,defaultBlockId:p,isPending:m,onSubmit:A}),e[97]=p,e[98]=A,e[99]=m,e[100]=L,e[101]=ne):ne=e[101];let de;return e[102]!==ce||e[103]!==ne||e[104]!==U?(de=n.jsxs("div",{className:U,children:[ce,ne]}),e[102]=ce,e[103]=ne,e[104]=U,e[105]=de):de=e[105],de}function Jr(t){return t+1}function qr(t,e){const s={__resolveType:t},o=ya([s],e)[0];return o?va(s,o,e):null}function Wr({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:a,decofile:l,blockKey:i,onSaveReferencedBlock:c}){const r=Ne(),d=Dt(),p=d?.virtualMcpId,h=Hn(p===e?e:null)?.metadata?.siteSlug??null,[u]=$.useState(()=>qr(i,l)),[f,x]=$.useState(u?.data??{}),[g,y]=$.useState([]),[v,j]=$.useState(0),[w,C]=$.useState(!1),[E,B]=$.useState(null),k=E!==null,{save:_,flush:O}=xa({orgSlug:t,virtualMcpId:e,branch:s}),L=u?.resolveType?ws(u.resolveType,a):null,K=l[i],F=K?La(i,K):i,D=d?.taskId??null,A={orgSlug:t,virtualMcpId:e,branch:s,threadId:D,previewUrl:o??void 0,siteSlug:h},I=P=>{x(P),_(i,P)},R=()=>{k?(B(null),C(!1),j(P=>P+1)):B(JSON.stringify(f,null,2))},V=P=>{const U=P??"";try{const Y=JSON.parse(U);if(Y&&typeof Y=="object"&&!Array.isArray(Y)){C(!1),I(Y);return}C(!0)}catch{C(!0)}},z=[F,...g],W=P=>{y(g.slice(0,P)),j(U=>U+1)};return n.jsx("div",{className:"flex h-full w-full min-w-0",children:n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsx(ba,{crumbs:z,onSelect:W}),n.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[n.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Cs},"aria-hidden":!0}),n.jsx("div",{className:"flex-1"}),n.jsxs(Xe,{children:[n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:R,"aria-label":r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?n.jsx(Ts,{size:14}):n.jsx(Tn,{size:14})})}),n.jsx(Qe,{side:"bottom",children:r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),n.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:r("sandbox.savedSectionEditor.globalSectionDescription")})]}),n.jsxs("div",{className:"relative min-h-0 flex-1",children:[n.jsx(Xt,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:L?n.jsx(Rn,{schema:L,value:f,onChange:P=>I(P),basePath:"",breadcrumbPath:g,onBreadcrumbChange:y,meta:a,decofile:l,onSaveReferencedBlock:c,sandbox:A},v):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.savedSectionEditor.noEditableFields")})})})}),E!==null&&n.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[w&&n.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:r("sandbox.savedSectionEditor.invalidJsonError")}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Un,{language:"json",height:"100%",code:E,onChange:V,onSave:P=>{V(P),O()}})})]})]})]})})}function Yr(t){const e=ae.c(36),{selection:s,orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,isCreating:d,onCreateAvailable:p,onSaveReferencedBlock:m}=t,h=Ne();if(!s){let x;e[0]!==h?(x=h("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=h,e[1]=x):x=e[1];let g;e[2]!==h?(g=h("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=h,e[3]=g):g=e[3];let y;return e[4]!==x||e[5]!==g?(y=n.jsx(st,{title:x,description:g}),e[4]=x,e[5]=g,e[6]=y):y=e[6],y}if(s.collection==="available-section"){const x=`available:${s.resolveType}`,g=s.resolveType,y=s.title;let v;e[7]!==s.title?(v=ja(s.title),e[7]=s.title,e[8]=v):v=e[8];let j;e[9]!==p||e[10]!==s.resolveType?(j=(C,E)=>p(s.resolveType,C,E),e[9]=p,e[10]=s.resolveType,e[11]=j):j=e[11];let w;return e[12]!==l||e[13]!==r||e[14]!==d||e[15]!==c||e[16]!==m||e[17]!==o||e[18]!==i||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==x||e[22]!==v||e[23]!==j||e[24]!==a?(w=n.jsx(Hr,{orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,resolveType:g,title:y,defaultBlockId:v,isCreating:d,onCreate:j,onSaveReferencedBlock:m},x),e[12]=l,e[13]=r,e[14]=d,e[15]=c,e[16]=m,e[17]=o,e[18]=i,e[19]=s.resolveType,e[20]=s.title,e[21]=x,e[22]=v,e[23]=j,e[24]=a,e[25]=w):w=e[25],w}const u=`saved:${s.key}`;let f;return e[26]!==l||e[27]!==r||e[28]!==c||e[29]!==m||e[30]!==o||e[31]!==i||e[32]!==s.key||e[33]!==u||e[34]!==a?(f=n.jsx(Wr,{orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,blockKey:s.key,onSaveReferencedBlock:m},u),e[26]=l,e[27]=r,e[28]=c,e[29]=m,e[30]=o,e[31]=i,e[32]=s.key,e[33]=u,e[34]=a,e[35]=f):f=e[35],f}function Ot(t){const e=ae.c(34),{onDuplicate:s,onRename:o,onAddVariant:a,onEditSeo:l,onViewJson:i,onDelete:c}=t,r=Ne();let d;e[0]!==r?(d=r("sandbox.itemActions.moreActions"),e[0]=r,e[1]=d):d=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Do,{size:14}),e[2]=p):p=e[2];let m;e[3]!==d?(m=n.jsx(Ft,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Qr,children:p})}),e[3]=d,e[4]=m):m=e[4];let h;e[5]!==o||e[6]!==r?(h=o&&n.jsxs(We,{onClick:o,children:[n.jsx(il,{size:14}),r("sandbox.itemActions.rename")]}),e[5]=o,e[6]=r,e[7]=h):h=e[7];let u;e[8]!==s||e[9]!==r?(u=s&&n.jsxs(We,{onClick:s,children:[n.jsx(ll,{size:14}),r("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=r,e[10]=u):u=e[10];let f;e[11]!==a||e[12]!==r?(f=a&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{}),n.jsxs(We,{onClick:a,className:"cursor-pointer text-success focus:text-success",children:[n.jsx(Pn,{size:14}),r("sandbox.itemActions.addVariant")]})]}),e[11]=a,e[12]=r,e[13]=f):f=e[13];let x;e[14]!==l||e[15]!==i||e[16]!==r?(x=(l||i)&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{}),l&&n.jsxs(We,{onClick:l,children:[n.jsx(Nn,{size:14}),r("sandbox.itemActions.editSeo")]}),i&&n.jsxs(We,{onClick:i,children:[n.jsx(Tn,{size:14}),r("sandbox.itemActions.viewJson")]})]}),e[14]=l,e[15]=i,e[16]=r,e[17]=x):x=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(ds,{}),e[18]=g):g=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ps,{size:14}),e[19]=y):y=e[19];let v;e[20]!==r?(v=r("sandbox.itemActions.delete"),e[20]=r,e[21]=v):v=e[21];let j;e[22]!==c||e[23]!==v?(j=n.jsxs(We,{onClick:c,className:"text-destructive focus:text-destructive",children:[y,v]}),e[22]=c,e[23]=v,e[24]=j):j=e[24];let w;e[25]!==j||e[26]!==h||e[27]!==u||e[28]!==f||e[29]!==x?(w=n.jsxs(Kt,{align:"end",className:"w-44",children:[h,u,f,x,g,j]}),e[25]=j,e[26]=h,e[27]=u,e[28]=f,e[29]=x,e[30]=w):w=e[30];let C;return e[31]!==w||e[32]!==m?(C=n.jsxs(zt,{children:[m,w]}),e[31]=w,e[32]=m,e[33]=C):C=e[33],C}function Qr(t){return t.stopPropagation()}function Xr(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Zr(t){const e=new Map;for(const s of t){const o=Xr(s.resolveType),a=e.get(o);a?a.push(s):e.set(o,[s])}return[...e.entries()].map(([s,o])=>({label:s,sections:o})).sort((s,o)=>s.label.localeCompare(o.label))}function xn(t){const e=ae.c(8),{icon:s,label:o,className:a}=t;let l;e[0]!==a?(l=xe("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",a),e[0]=a,e[1]=l):l=e[1];let i;e[2]!==s?(i=n.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=i):i=e[3];let c;return e[4]!==o||e[5]!==l||e[6]!==i?(c=n.jsxs("div",{className:l,children:[i,o]}),e[4]=o,e[5]=l,e[6]=i,e[7]=c):c=e[7],c}const bn=$.lazy(()=>Je(()=>import("./app-editor-Dk5jSXjv.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177])).then(t=>({default:t.AppEditor}))),ec=$.lazy(()=>Je(()=>import("./post-editor-hRUF_q7o.js"),__vite__mapDeps([178,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,42,41,43,44,45,46,47,48,49,50,27,28,30,51,52,53,54,31,55,56,57,58,59,60,61,62,63,64,32,65,66,67,68,34,69,35,104,179,161,140,84,85,33,107,119,114,112,40,39,37,70,71,72,73,74,75,76,77,78,79,80,26,81,82,83,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,105,106,108,24,25,109,110,111,36,113,115,116,117,118,120,121,122,123,124,125,126,127,180,144,38,181,182,183,128,129,130,131,132,133,134,135,136,137,138,139,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177])).then(t=>({default:t.PostEditor}))),tc=$.lazy(()=>Je(()=>import("./record-editor-D0FEEilz.js"),__vite__mapDeps([184,1,2,35,104,25,26,27,28,112,40,39,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,37,41,42,43,44,45,46,47,48,49,50,30,51,52,53,54,31,55,56,57,58,59,60,61,62,63,64,32,65,66,67,68,34,69,70,71,72,73,74,75,76,77,33,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,105,106,107,108,24,109,110,111,36,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,183,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177])).then(t=>({default:t.RecordEditor}))),sc=$.lazy(()=>Je(()=>import("./context-Cen00PJ2.js"),__vite__mapDeps([185,1,2,28,41,42,43,44,45,46,47,48,49,50,27,30,51,52,53,54,31,55,56,57,58,59,60,61,62,63,64,32,65,66,67,68,34,69,35,104,112,107,20,186,102,95,33,103,97,78,79,4,5,6,7,8,9,10,80,26,144,181,113,77,82,84,85,187,148,145,40,39,12,13,3,11,14,15,16,17,18,19,21,22,23,37,70,71,72,73,74,75,76,81,83,86,87,88,89,90,91,92,93,94,96,98,99,100,101,105,106,108,24,25,109,110,111,36,114,115,116,117,118,119,120,121,122,123,124,125,126,127,172,183,184,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,146,147,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,173,174,175,176,177,188,180,38,182])).then(t=>({default:t.BlogContext}))),nc=$.lazy(()=>Je(()=>import("./category-editor-BVzm0zUq.js"),__vite__mapDeps([188,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,46,48,60,41,42,43,44,45,47,49,50,27,28,30,51,52,53,54,31,55,56,57,58,59,61,62,63,64,32,65,66,67,68,34,69,116,35,104,180,113,84,85,33,107,40,39,37,70,71,72,73,74,75,76,77,78,79,80,26,81,82,83,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,105,106,108,24,25,109,110,111,112,36,114,115,117,118,119,120,121,122,123,124,125,126,127,144,38,181,182,183,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177])).then(t=>({default:t.CategoryEditor}))),oc=$.lazy(()=>Je(()=>import("./sections-editor-IVuj1qGO.js"),__vite__mapDeps([189,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,36,40,39,37,41,42,43,44,45,46,47,48,49,50,27,28,30,51,52,53,54,31,55,56,57,58,59,60,61,62,63,64,32,65,66,67,68,34,69,70,71,72,73,74,75,76,77,33,78,79,80,26,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,35,105,106,107,108,24,25,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,172,190,29,38,191])).then(t=>({default:t.SectionsEditor}))),ac=$.lazy(()=>Je(()=>import("./seo-editor-DWMKmSd9.js"),__vite__mapDeps([192,1,2,41,42,43,44,45,46,47,48,49,50,27,28,30,51,52,53,54,31,55,56,57,58,59,60,61,62,63,64,32,65,66,67,68,34,69,24,25,26,40,39,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,37,70,71,72,73,74,75,76,77,33,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,35,105,106,107,108,109,110,111,112,36,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,190])).then(t=>({default:t.SeoEditor}))),lc=$.lazy(()=>Je(()=>import("./variant-calendar-ZscKzDf5.js"),__vite__mapDeps([193,1,2,41,42,43,44,45,46,47,48,49,50,27,28,30,51,52,53,54,31,55,56,57,58,59,60,61,62,63,64,32,65,66,67,68,34,69,104,24,25,26,114,80,194,128,129,130,5,4,6,7,8,9,10,14,15,16,17,99,131,93,97,132,3,11,12,13,18,19,20,21,22,23,95,33,133,134,79,101,102,103,35,78,135,81,82,83,84,85,86,87,88,89,90,136,39,76,75,77,72,73,119,137,126,96,138,139,140,141,107,142,143,144,145,146,147,148,149,150,151,152,153,154,155,123,124,156,112,157,158,159,160,161,162,163,164,71,74,91,92,94,98,100,105,106,165,117,70,166,167,168,125,121,169,170,171,116,40,37,108,109,110,111,36,113,115,118,120,122,127,172,173,174,175,176,177])).then(t=>({default:t.VariantCalendar}))),ic=$.lazy(()=>Je(()=>import("./post-calendar-DTivbJGd.js"),__vite__mapDeps([195,1,2,42,41,43,44,45,46,47,48,49,50,27,28,30,51,52,53,54,31,55,56,57,58,59,60,61,62,63,64,32,65,66,67,68,34,69,196,24,25,26,128,129,130,5,4,6,7,8,9,10,14,15,16,17,99,131,93,97,132,3,11,12,13,18,19,20,21,22,23,95,80,33,133,134,79,101,102,103,104,35,78,135,81,82,83,84,85,86,87,88,89,90,136,39,76,75,77,72,73,119,137,126,96,138,139,140,141,107,142,143,144,145,146,147,148,149,150,151,152,153,154,155,123,124,156,112,157,158,159,160,161,162,163,164,71,74,91,92,94,98,100,105,106,165,117,70,166,167,168,125,121,169,170,171,116,40,37,108,109,110,111,36,113,114,115,118,120,122,127,172,173,174,175,176,177])).then(t=>({default:t.PostCalendar}))),rc=$.lazy(()=>Je(()=>import("./redirect-editor-8U0kYp-L.js"),__vite__mapDeps([197,1,2,140,27,35,104,25,26,28,40,39,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,37,41,42,43,44,45,46,47,48,49,50,30,51,52,53,54,31,55,56,57,58,59,60,61,62,63,64,32,65,66,67,68,34,69,70,71,72,73,74,75,76,77,33,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,105,106,107,108,24,109,110,111,112,36,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,183])).then(t=>({default:t.RedirectEditor})));function cc(t){const e=ae.c(20),{deepLinkPage:s}=t,{currentBranch:o,virtualMcpId:a}=kn(),{org:l}=_o(),i=Ja(),c=qa(),{runtime:r,previewServerUrl:d}=Gn(a),p=r==="cms";let m;e[0]!==p||e[1]!==c.previewState||e[2]!==i.lifecycle.phase?(m=Tl({fastPreviewActive:p,previewState:c.previewState,lifecyclePhase:i.lifecycle.phase}),e[0]=p,e[1]=c.previewState,e[2]=i.lifecycle.phase,e[3]=m):m=e[3];const h=m;if(h.kind==="sandbox-card"){const x=`/${l.slug}/settings/connections`;let g;return e[4]!==h.state||e[5]!==c.start||e[6]!==x||e[7]!==i.lifecycle||e[8]!==i.phase?(g=n.jsx(Cl,{state:h.state,claimPhase:i.phase,lifecycle:i.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=h.state,e[5]=c.start,e[6]=x,e[7]=i.lifecycle,e[8]=i.phase,e[9]=g):g=e[9],g}if(!a||!o){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(st,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const u=p?d:c.previewUrl;let f;return e[11]!==o||e[12]!==s||e[13]!==h.devServerReady||e[14]!==h.sandboxWarming||e[15]!==c.previewUrl||e[16]!==l.slug||e[17]!==u||e[18]!==a?(f=n.jsx(uc,{orgSlug:l.slug,virtualMcpId:a,branch:o,previewUrl:c.previewUrl,sitePreviewUrl:u,deepLinkPage:s,devServerReady:h.devServerReady,sandboxWarming:h.sandboxWarming}),e[11]=o,e[12]=s,e[13]=h.devServerReady,e[14]=h.sandboxWarming,e[15]=c.previewUrl,e[16]=l.slug,e[17]=u,e[18]=a,e[19]=f):f=e[19],f}const yn=2e3,dc=15;function vn(t,e,s,o){return typeof e!="string"||s&&(Jn(e,s,o)||t.state.dataUpdateCount>=dc)?!1:yn}function uc({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,sitePreviewUrl:a,deepLinkPage:l,devServerReady:i,sandboxWarming:c}){const r=Ne(),d=Dt()?.taskId??null,p={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:o},{data:m,isLoading:h}=ka(p,{fetchEnabled:i}),u=jn({strict:!1}),[f,x]=$.useState(()=>u.contentCollection&&lt(u.contentCollection)&&u.contentCollection||"pages"),[g,y]=$.useState(()=>u.contentItem&&lt(f)?{collection:f,key:u.contentItem}:null),[v,j]=$.useState(null),w=!!(l?.pageId||l?.path||l?.pathTemplate),[C,E]=$.useState(!1);if(w&&!C&&g===null&&m){E(!0);const b=Oa(Vs(m),l??{});b&&(x("pages"),y({collection:"pages",key:b.key,path:b.path}))}const[B,k]=$.useState(""),[_,O]=$.useState("board"),L=b=>{y(b),j(null)},[K,F]=$.useState(f);K!==f&&(F(f),k(""));const{data:D,isLoading:A,isFetching:I}=Sa(p,{fetchEnabled:i,refetchInterval:b=>{const G=b.state.data;if(f==="apps"&&g&&g.collection==="apps"){const ue=m?.[g.key];return vn(b,typeof ue?.__resolveType=="string"?ue.__resolveType:void 0,G)}if(f==="site"&&m){const ue=G?Gs(m,G):null,fe=m.site,De=ue?.resolveType??(typeof fe?.__resolveType=="string"?fe.__resolveType:void 0);return vn(b,De,G,["seo"])}return!1}}),R=(b,G)=>!Jn(b,D,G)&&(A||I),{catalog:V,isLoading:z}=kl(D??void 0,m??void 0,{enabled:f==="apps"}),W=Ki({orgSlug:t,virtualMcpId:e,branch:s,meta:D}),P=Zt(p),U=zn(p),Y=Vi({orgSlug:t,virtualMcpId:e,branch:s,decofile:m??{},support:W,onMoved:(b,G)=>y(ue=>ue?.collection==="posts"&&ue.key===b?{collection:"posts",key:G}:ue)}),[J,X]=$.useState(null),[ce,ne]=$.useState(),[de,te]=$.useState(!1),[re,le]=$.useState(),[N,q]=$.useState(null),[Z,oe]=$.useState(null),[S,se]=$.useState(null),H=!m||!D;if(h||A||H&&c)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(rt,{className:"size-5 text-muted-foreground"})});if(H)return n.jsx(st,{title:"Could not load site data."});const ie=Vs(m).sort((b,G)=>b.name.localeCompare(G.name)),ye=Ia(m).sort((b,G)=>b.from.localeCompare(G.from)),pe=Ra(m,D),ke=f==="sections"?Fa(D):[],he=Gs(m,D),je=Xn(m),Se=Bs.some(b=>je[b].length>0),Ae=lt(f)?je[f]:[],Ce=zs(D,"loaders"),Pe=zs(D,"actions");if(!Ka(m,D)&&!Se&&Ce===0&&Pe===0)return n.jsx(st,{icon:Qt,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const _e={pages:ie.length,sections:pe.length,apps:V.length,loaders:Ce,actions:Pe,redirects:ye.length,posts:je.posts.length,authors:je.authors.length,categories:je.categories.length},ge=new Set(ie.map(b=>It(b.path))),$e=new Set(ie.map(b=>b.name)),Le=new Set(pe.map(b=>b.name)),M=async b=>{const G=m[b.key];if(!G)return;const ue=Fn(m,b.key),fe=wa(m,b.key,Math.max(0,ue-1)),De=Na(G.sections,fe);if(De)try{await P.mutateAsync({blockKey:b.key,data:{...G,sections:De}}),me.success(`Variant added to "${b.name}"`),y({collection:"pages",key:b.key,path:b.path})}catch(Ie){me.error(Ie instanceof Error?Ie.message:"Could not add variant")}},ve=()=>{ne(void 0),X({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},we=b=>{ne(void 0),X({mode:"duplicate",sourceKey:b.key,initialName:qs($e,b.name),initialPath:Bl(ge,b.path)})},Oe=b=>{ne(void 0),X({mode:"rename",sourceKey:b.key,initialName:b.name,initialPath:b.path})},os=async b=>{if(!J)return;const{mode:G,sourceKey:ue}=J;try{if(G==="create"){let fe;if(b.templateKey){const Ie=m[b.templateKey];if(!Ie)throw new Error("Selected template no longer exists.");fe={...Ie,name:b.name,path:b.path}}else fe=_l(b.name,b.path);const De=$l(m,b.name);await P.mutateAsync({blockKey:De,data:fe}),me.success(`Created "${b.name}"`),y({collection:"pages",key:De,path:b.path})}else if(G==="duplicate"&&ue){const fe=m[ue];if(!fe)throw new Error("Source page not found");const{key:De,data:Ie}=Dl({source:fe,pages:ie,newName:b.name,newPath:b.path});await P.mutateAsync({blockKey:De,data:Ie}),me.success(`Duplicated as "${b.name}"`),y({collection:"pages",key:De,path:b.path})}else if(G==="rename"&&ue){const fe=m[ue];if(!fe)throw new Error("Page not found");const De={...fe,name:b.name,path:b.path};await P.mutateAsync({blockKey:ue,data:De}),me.success("Page updated"),g?.collection==="pages"&&g.key===ue&&y({collection:"pages",key:ue,path:b.path})}X(null)}catch(fe){ne(fe instanceof Error?fe.message:"Save failed")}},as=({path:b})=>{if(!J)return null;const G=It(b);return(J.mode==="rename"?It(J.initialPath):null)!==G&&ge.has(G)?`A page with path "${b}" already exists.`:null},ls=async(b,G,ue)=>{await P.mutateAsync({blockKey:G,data:{...ue,name:G,__resolveType:b}}),me.success(r("sandbox.contentBrowser.createdSection",{name:G})),y({collection:"sections",key:G})},At=In((b,G)=>P.mutate({blockKey:b,data:G})),is=async b=>{const G=m[b.key];if(!G){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}const ue=El(m,b.key),fe=qs(Le,b.name),De={...G,name:fe};try{await P.mutateAsync({blockKey:ue,data:De}),me.success(r("sandbox.contentBrowser.duplicatedSection",{name:b.name})),y({collection:"sections",key:ue})}catch(Ie){me.error(Ie instanceof Error?Ie.message:r("sandbox.contentBrowser.duplicateFailed"))}},rs=async b=>{if(!N)return;const G=m[N];if(!G){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}try{await P.mutateAsync({blockKey:N,data:{...G,name:b}}),me.success(r("sandbox.contentBrowser.sectionRenamed")),q(null)}catch(ue){me.error(ue instanceof Error?ue.message:r("sandbox.contentBrowser.renameFailed"))}},T=()=>{le(void 0),te(!0)},Q=async b=>{const G=za(m,b.from),ue=Ma(b);try{await P.mutateAsync({blockKey:G,data:ue}),me.success("Created redirect"),te(!1),y({collection:"redirects",key:G})}catch(fe){le(fe instanceof Error?fe.message:"Could not create redirect")}},Te=async b=>{const G=hs(m,b),ue=it(G,b,ao(b));try{await P.mutateAsync({blockKey:G,data:ue}),me.success(`Created ${Pt[b]}`),y({collection:b,key:G})}catch(fe){me.error(fe instanceof Error?fe.message:"Could not create")}},Ve=async b=>{const G=hs(m,"posts"),ue=it(G,"posts",wi(b));try{await P.mutateAsync({blockKey:G,data:ue}),me.success(r("sandbox.postCalendar.createdScheduledPost")),x("posts"),F("posts"),y({collection:"posts",key:G}),j(null)}catch(fe){me.error(fe instanceof Error?fe.message:r("sandbox.postCalendar.couldNotCreate"))}},qe=async(b,G)=>{const ue=m[b],fe=ue?Ci(mt(ue,"posts"),G):null;if(!fe){me.error(r("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await P.mutateAsync({blockKey:b,data:it(b,"posts",fe)})}catch(De){me.error(De instanceof Error?De.message:r("sandbox.postCalendar.couldNotReschedule"))}},Ee=async b=>{const G=m[b.key];if(!G){me.error("Record not found.");return}const ue=hs(m,b.kind),fe=b.kind==="posts"?"title":"name",De={...structuredClone(mt(G,b.kind)),[fe]:`${b.label} (copy)`};try{await P.mutateAsync({blockKey:ue,data:it(ue,b.kind,De)}),me.success(`Duplicated "${b.label}"`),y({collection:b.kind,key:ue})}catch(Ie){me.error(Ie instanceof Error?Ie.message:"Duplicate failed")}},yt=()=>{x("posts"),F("posts"),y(null),j(null),k("")},Ue=async()=>{if(Z)try{const{kind:b,key:G,label:ue}=Z;if(b==="blog"){if(Z.blogKind==="categories"){const fe=mt(m[G],"categories").slug,De=typeof fe=="string"?fe:"";if(De)for(const{key:Ie,payload:Os}of Ge(m,"posts")){const Is=ti(Os,De);Is!==Os&&await P.mutateAsync({blockKey:Ie,data:it(Ie,"posts",si(Is))})}}await U.mutateAsync({blockKey:G})}else await U.mutateAsync({blockKey:G});me.success(`Deleted "${ue}"`),g&&g.collection!=="available-section"&&g.key===G&&y(null),oe(null)}catch(b){me.error(b instanceof Error?b.message:"Delete failed")}},at=U.isPending||P.isPending,cs=Z?.kind==="blog"?Pt[Z.blogKind]:Z?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(wl,{active:f,counts:_e,showBlog:Se,onSelect:b=>{x(b),y(null),j(null)}}),f!=="seo"&&f!=="site"&&f!=="context"&&f!=="calendar"&&f!=="post-schedule"&&f!=="posts"&&f!=="loaders"&&f!=="actions"&&n.jsx(mc,{activeCollection:f,pages:ie,redirects:ye,sections:pe,availableSections:ke,appCatalog:V,appCatalogLoading:z,blogEntries:Ae,decofile:m,searchQuery:B,onSearchChange:k,selection:g,onSelect:L,onCreate:()=>{f==="pages"?ve():f==="redirects"?T():lt(f)&&Te(f)},onDuplicatePage:we,onRenamePage:Oe,onAddPageVariant:M,onDeletePage:b=>oe({kind:"page",key:b.key,label:b.name}),onEditPageSeo:b=>{const G={collection:"pages",key:b.key,path:b.path};y(G),j(b.key)},onViewPageJson:b=>se(b.key),onDuplicateSection:is,onRenameSection:b=>q(b.key),onDeleteSection:b=>oe({kind:"section",key:b.key,label:b.name}),onDeleteRedirect:b=>oe({kind:"redirect",key:b.key,label:b.from||b.key}),onDuplicateBlog:Ee,onDeleteBlog:b=>oe({kind:"blog",blogKind:b.kind,key:b.key,label:b.label})}),n.jsx("div",{className:"flex-1 min-w-0",children:f==="loaders"||f==="actions"?n.jsx(Or,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:D,decofile:m,kind:f}):n.jsx($.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(rt,{className:"size-5 text-muted-foreground"})}),children:f==="calendar"?n.jsx(lc,{decofile:m}):f==="post-schedule"?n.jsx(ic,{decofile:m,support:W,isCreating:P.isPending,onCreate:b=>{Ve(b)},onReschedule:(b,G)=>{qe(b,G)},onSelect:b=>{x("posts"),F("posts"),y({collection:"posts",key:b}),j(null)}}):f==="site"?he?n.jsx(bn,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:he.key,block:m[he.key],decofile:m,meta:D,title:"Site",excludeFields:["seo"],schemaPending:R(he.resolveType,["seo"]),previewBaseUrl:o},`site:${he.key}`):n.jsx(st,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):f==="context"?n.jsx(ul,{title:r("sandbox.blogContext.soonTitle"),description:r("sandbox.blogContext.soonDescription"),children:n.jsx(sc,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,meta:D,onOpenPost:b=>{x("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},onManageCategoryPosts:()=>{x("posts"),F("posts"),y(null),j(null)}})}):f==="seo"?n.jsx(ac,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,meta:D,target:{kind:"site"},previewBaseUrl:a}):f==="sections"?n.jsx(Yr,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:D,decofile:m,isCreating:P.isPending,onCreateAvailable:ls,onSaveReferencedBlock:At}):f==="posts"?n.jsx(Cr,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,view:_,selectedKey:g?.collection==="posts"?g.key:null,onViewChange:b=>{O(b),y(null)},onClose:()=>y(null),onOpen:b=>{y({collection:"posts",key:b}),j(null)},move:Y,support:W,meta:D,renderDetail:(b,G)=>n.jsx(ec,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:b,block:m[b],decofile:m,meta:D,previewBaseUrl:a,move:Y,onClose:G?.onClose,expanded:G?.expanded,onToggleExpand:G?.onToggleExpand},`post:${Tt(b)}`)}):g&&g.collection!=="available-section"?g.collection==="apps"?n.jsx(bn,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:m[g.key],decofile:m,meta:D,previewBaseUrl:o,schemaPending:R(typeof m[g.key]?.__resolveType=="string"?String(m[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="categories"?n.jsx(nc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:m[g.key],decofile:m,meta:D,onManagePosts:()=>yt(),onOpenPost:b=>{x("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},previewBaseUrl:a},`category:${g.key}`):g.collection==="authors"?n.jsx(tc,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:m[g.key]},`authors:${g.key}`):g.collection==="redirects"?n.jsx(rc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:m[g.key]},`redirect:${g.key}`):n.jsx(oc,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:o??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&v===g.key,onExitSeo:()=>j(null),onSelectRoot:()=>{y(null),j(null)}},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):n.jsx(st,{title:`Select ${lt(f)?`a ${Pt[f]}`:f==="pages"?"a page":f==="apps"?"an app":f==="redirects"?"a redirect":"a section"} to edit`,description:f==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),J&&n.jsx(Rl,{open:!!J,mode:J.mode,initialName:J.initialName,initialPath:J.initialPath,isPending:P.isPending,error:ce,templates:ie,validate:as,onSubmit:os,onOpenChange:b=>{b||(X(null),ne(void 0))}}),n.jsx(Kl,{open:de,isPending:P.isPending,error:re,onSubmit:Q,onOpenChange:b=>{b||(te(!1),le(void 0))}}),N&&n.jsx(zl,{open:!!N,blockKey:N,initialName:pe.find(b=>b.key===N)?.name??N,isPending:P.isPending,onSubmit:rs,onOpenChange:b=>{b||q(null)}}),S&&n.jsx(Va,{open:!!S,onOpenChange:b=>{b||se(null)},pageKey:S,decofile:m,onSave:b=>P.mutateAsync({blockKey:S,data:b})}),n.jsx(Wo,{open:!!Z,onOpenChange:b=>{!b&&!at&&oe(null)},children:n.jsxs(Yo,{children:[n.jsxs(Qo,{children:[n.jsx(Xo,{children:`Delete ${cs}?`}),n.jsx(Zo,{children:Z?.kind==="section"?`"${Z.label}" will be removed. Pages that still reference it will lose this section.`:Z?`"${Z.label}" will be removed permanently. This can't be undone.`:null})]}),n.jsxs(ea,{children:[n.jsx(ta,{disabled:at,children:"Cancel"}),n.jsx(sa,{onClick:b=>{b.preventDefault(),Ue()},disabled:at,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:at?n.jsxs(n.Fragment,{children:[n.jsx(rt,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function mc(t){const e=ae.c(57),{activeCollection:s,pages:o,redirects:a,sections:l,availableSections:i,appCatalog:c,appCatalogLoading:r,blogEntries:d,decofile:p,searchQuery:m,onSearchChange:h,selection:u,onSelect:f,onCreate:x,onDuplicatePage:g,onRenamePage:y,onAddPageVariant:v,onDeletePage:j,onEditPageSeo:w,onViewPageJson:C,onDuplicateSection:E,onRenameSection:B,onDeleteSection:k,onDeleteRedirect:_,onDuplicateBlog:O,onDeleteBlog:L}=t;let K,F,D,A,I,R;if(e[0]!==s||e[1]!==c||e[2]!==r||e[3]!==i||e[4]!==d||e[5]!==p||e[6]!==v||e[7]!==x||e[8]!==L||e[9]!==j||e[10]!==_||e[11]!==k||e[12]!==O||e[13]!==g||e[14]!==E||e[15]!==w||e[16]!==y||e[17]!==B||e[18]!==h||e[19]!==f||e[20]!==C||e[21]!==o||e[22]!==a||e[23]!==m||e[24]!==l||e[25]!==u){const P=m.toLowerCase(),U=o.filter(S=>!P||S.name.toLowerCase().includes(P)||S.path.toLowerCase().includes(P)),Y=a.filter(S=>!P||S.from.toLowerCase().includes(P)||S.to.toLowerCase().includes(P)),J=l.filter(S=>!P||S.name.toLowerCase().includes(P)||S.key.toLowerCase().includes(P)||S.resolveType.toLowerCase().includes(P)),X=i.filter(S=>!P||S.title.toLowerCase().includes(P)||S.resolveType.toLowerCase().includes(P)||(S.description?.toLowerCase().includes(P)??!1)),ce=Zr(J),ne=c.filter(S=>!P||S.title.toLowerCase().includes(P)||S.app.toLowerCase().includes(P)||S.vendor.toLowerCase().includes(P)||S.category.toLowerCase().includes(P)),de=d.filter(S=>!P||S.label.toLowerCase().includes(P)||S.subtitle.toLowerCase().includes(P)),te=`Search ${s}…`,re=lt(s)?`Create new ${Pt[s]}`:s==="redirects"?"Create new redirect":"Create new page",le=s!=="apps"&&s!=="sections";I="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let N;e[32]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(En,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[32]=N):N=e[32];let q;e[33]!==h?(q=S=>h(S.target.value),e[33]=h,e[34]=q):q=e[34];let Z;e[35]!==te||e[36]!==m||e[37]!==q?(Z=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[N,n.jsx("input",{type:"text",value:m,onChange:q,placeholder:te,"aria-label":te,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[35]=te,e[36]=m,e[37]=q,e[38]=Z):Z=e[38];let oe;e[39]!==re||e[40]!==x||e[41]!==le?(oe=le&&n.jsxs(Xe,{children:[n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{variant:"ghost",size:"icon",onClick:x,"aria-label":re,children:n.jsx(Ss,{size:14})})}),n.jsx(Qe,{side:"bottom",children:re})]}),e[39]=re,e[40]=x,e[41]=le,e[42]=oe):oe=e[42],e[43]!==Z||e[44]!==oe?(R=n.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Z,oe]}),e[43]=Z,e[44]=oe,e[45]=R):R=e[45],K=Xt,A="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",F="flex flex-col gap-1 p-1.5",D=s==="pages"?U.length===0?n.jsx(jt,{hasItems:o.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):U.map(S=>{const se=u?.collection==="pages"&&u.key===S.key,H=Fn(p,S.key);return n.jsx(He,{icon:Bn,title:S.name,subtitle:S.path,active:se,variantCount:H,onClick:()=>f({collection:"pages",key:S.key,path:S.path}),menu:n.jsx(Ot,{onDuplicate:()=>g(S),onRename:()=>y(S),onAddVariant:()=>v(S),onEditSeo:()=>w(S),onViewJson:()=>C(S),onDelete:()=>j(S)})},S.key)}):s==="sections"?J.length===0&&X.length===0?n.jsx(jt,{hasItems:l.length>0||i.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):n.jsxs(n.Fragment,{children:[ce.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(xn,{icon:Mt,label:"Saved sections"}),ce.map(S=>n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:S.label}),S.sections.map(se=>{const H=u?.collection==="sections"&&u.key===se.key;return n.jsx(He,{icon:Mt,accent:"global",title:se.name,subtitle:S.label,active:H,onClick:()=>f({collection:"sections",key:se.key}),menu:n.jsx(Ot,{onDuplicate:()=>E(se),onRename:()=>B(se),onDelete:()=>k(se)})},se.key)})]},S.label))]}),X.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(xn,{icon:Fs,label:"Available sections",className:xe(ce.length>0&&"mt-3")}),X.map(S=>{const se=u?.collection==="available-section"&&u.resolveType===S.resolveType,H=S.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return n.jsx(He,{icon:Fs,title:S.title,subtitle:H??S.resolveType,active:se,onClick:()=>f({collection:"available-section",resolveType:S.resolveType,title:S.title})},S.resolveType)})]})]}):s==="apps"?r?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(rt,{className:"size-4.5 text-muted-foreground"})}):ne.length===0?n.jsx(jt,{hasItems:c.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ne.map(S=>{const se=u?.collection==="apps"&&S.blockKey!==null&&u.key===S.blockKey;return n.jsx(He,{icon:_n,logoUrl:S.logo,title:S.title,subtitle:S.category,active:se,trailing:S.installed?n.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!S.installed||!S.blockKey){me.message(`${S.title} is not installed on this site.`);return}f({collection:"apps",key:S.blockKey})}},S.id)}):s==="redirects"?Y.length===0?n.jsx(jt,{hasItems:a.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):Y.map(S=>n.jsx(He,{icon:Sn,title:S.from||"(no source)",subtitle:`→ ${S.to||"(no target)"}`,active:u?.collection==="redirects"&&u.key===S.key,trailing:n.jsx(Ml,{type:S.type}),onClick:()=>f({collection:"redirects",key:S.key}),menu:n.jsx(Ot,{onDelete:()=>_(S)})},S.key)):de.length===0?n.jsx(jt,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${lt(s)?Pt[s]:"item"}.`}):de.map(S=>{const se=u?.collection===S.kind&&u.key===S.key;return n.jsx(He,{icon:S.kind==="posts"?Dn:S.kind==="authors"?An:wn,title:S.label,subtitle:S.subtitle,active:se,onClick:()=>f({collection:S.kind,key:S.key}),menu:n.jsx(Ot,{onDuplicate:()=>O(S),onDelete:()=>L(S)})},S.key)}),e[0]=s,e[1]=c,e[2]=r,e[3]=i,e[4]=d,e[5]=p,e[6]=v,e[7]=x,e[8]=L,e[9]=j,e[10]=_,e[11]=k,e[12]=O,e[13]=g,e[14]=E,e[15]=w,e[16]=y,e[17]=B,e[18]=h,e[19]=f,e[20]=C,e[21]=o,e[22]=a,e[23]=m,e[24]=l,e[25]=u,e[26]=K,e[27]=F,e[28]=D,e[29]=A,e[30]=I,e[31]=R}else K=e[26],F=e[27],D=e[28],A=e[29],I=e[30],R=e[31];let V;e[46]!==F||e[47]!==D?(V=n.jsx("div",{className:F,children:D}),e[46]=F,e[47]=D,e[48]=V):V=e[48];let z;e[49]!==K||e[50]!==A||e[51]!==V?(z=n.jsx(K,{className:A,children:V}),e[49]=K,e[50]=A,e[51]=V,e[52]=z):z=e[52];let W;return e[53]!==I||e[54]!==R||e[55]!==z?(W=n.jsxs("div",{className:I,children:[R,z]}),e[53]=I,e[54]=R,e[55]=z,e[56]=W):W=e[56],W}function fc(t){const e=ae.c(25),{virtualMcpId:s}=t,o=Ne(),[a,l]=$.useState(!1),i=al(s),{activeTask:c}=kn();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const d=jn(r);if(!(Hs(i?.metadata)||Hs(c?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:n.jsx(Js,{className:"size-7 text-foreground"})}),e[1]=h):h=e[1];let u;e[2]!==o?(u=o("mainPanelTabs.contentTab.noContentToEdit"),e[2]=o,e[3]=u):u=e[3];let f;e[4]!==o?(f=o("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=o,e[5]=f):f=e[5];let x,g;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=()=>l(!0),g=n.jsx(Js,{className:"size-4"}),e[6]=x,e[7]=g):(x=e[6],g=e[7]);let y;e[8]!==o?(y=o("mainPanelTabs.previewTab.connectGithub"),e[8]=o,e[9]=y):y=e[9];let v;e[10]!==y?(v=n.jsxs(Be,{onClick:x,children:[g,y]}),e[10]=y,e[11]=v):v=e[11];let j;e[12]!==u||e[13]!==f||e[14]!==v?(j=n.jsx(rl,{className:"h-full",image:h,title:u,description:f,actions:v}),e[12]=u,e[13]=f,e[14]=v,e[15]=j):j=e[15];let w;e[16]!==a?(w=n.jsx(cl,{open:a,onOpenChange:l,mode:"agent"}),e[16]=a,e[17]=w):w=e[17];let C;return e[18]!==w||e[19]!==j?(C=n.jsxs(n.Fragment,{children:[j,w]}),e[18]=w,e[19]=j,e[20]=C):C=e[20],C}let m;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(m=n.jsx(cc,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=m):m=e[24],m}function pc(){const t=ae.c(2),e=dl();let s;return t[0]!==e?(s=n.jsx(Ao,{tabId:"content",children:n.jsx($o,{feature:"cms",children:n.jsx(fc,{virtualMcpId:e})})}),t[0]=e,t[1]=s):s=t[1],s}const Ad=Object.freeze(Object.defineProperty({__proto__:null,default:pc},Symbol.toStringTag,{value:"Module"}));export{vo as $,Pd as A,_s as B,xd as C,hd as D,Cd as E,Bd as F,Xn as G,uo as H,Gi as I,Zs as J,bi as K,pd as L,hs as M,ao as N,md as O,Ds as P,yd as Q,Td as R,vd as S,Ed as T,kd as U,pt as V,Sd as W,jd as X,bd as Y,wd as Z,Jt as _,ud as a,Ad as a0,ns as b,si as c,Nd as d,dd as e,Ge as f,mt as g,Wt as h,Dd as i,ri as j,_d as k,to as l,Es as m,El as n,lo as o,_t as p,it as q,fl as r,be as s,mo as t,Ki as u,Ke as v,hi as w,fd as x,gd as y,Me as z};
9
+ `)||void 0,count:O}),Ee=bi(re.map(Ue=>Ue.title),qe.themes);if(Ee.length===0){me.info(u("sandbox.postBoard.ideasFailed"));return}let yt=0;for(const Ue of Ee){const at=mi();try{await x.mutateAsync({blockKey:at,data:fi(at,{title:Ue.title,body:Ue.body,pillarKey:T?.key,createdAt:new Date().toISOString()})}),yt++}catch(cs){console.warn("[posts] could not save a generated idea",cs)}}if(yt===0){me.error(u("sandbox.postBoard.ideasFailed"));return}me.success(u("sandbox.postBoard.ideasAdded",{count:String(yt)}))}catch(Q){me.error(Q instanceof Error?Q.message:u("sandbox.postBoard.ideasFailed"))}finally{C(!1)}};return n.jsxs("div",{className:"relative flex h-full min-w-0 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b px-6 py-3",children:[n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border p-0.5",children:[n.jsx(gn,{active:a==="board",onClick:()=>i("board"),icon:n.jsx(Mo,{size:14}),label:u("sandbox.postBoard.viewBoard")}),n.jsx(gn,{active:a==="list",onClick:()=>i("list"),icon:n.jsx(qo,{size:14}),label:u("sandbox.postBoard.viewList")})]})}),n.jsxs("div",{className:"flex items-center gap-2",children:[w&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[n.jsx(Ct,{size:12,className:"animate-spin"}),u("sandbox.postBoard.generatingLabel")]}),n.jsxs(ut,{open:E,onOpenChange:B,children:[n.jsx(Wa,{asChild:!0,children:n.jsxs(Be,{type:"button",variant:"outline",size:"sm",disabled:!0,children:[n.jsx(tt,{size:14}),u("sandbox.postBoard.generateIdeas"),n.jsx(ot,{variant:"secondary",children:u("common.soon")})]})}),n.jsxs(dt,{className:"sm:max-w-lg",children:[n.jsxs(gt,{children:[n.jsx(ct,{children:u("sandbox.postBoard.generateIdeas")}),n.jsx(Vt,{children:u("sandbox.postBoard.ideaGuidanceLabel")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(Rt,{id:"idea-guidance",value:k,rows:6,autoFocus:!0,onChange:T=>_(T.target.value),placeholder:u("sandbox.postBoard.ideaGuidancePlaceholder"),className:"resize-none text-sm"}),le.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(ze,{className:"text-xs",children:u("sandbox.postBoard.ideaPillarLabel")}),n.jsx(wt,{options:le.map(T=>T.title),value:le.find(T=>T.key===K)?.title??"",emptyLabel:u("sandbox.postBoard.ideaNoPillar"),onChange:T=>F(le.find(Q=>Q.title===T)?.key??"")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ze,{htmlFor:"idea-count",className:"text-xs",children:u("sandbox.postBoard.ideaCount")}),n.jsx(Ze,{id:"idea-count",type:"number",min:1,max:8,value:O,onChange:T=>L(Math.max(1,Math.min(8,Number(T.target.value)||1))),className:"h-9 w-16"}),n.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:u("sandbox.postBoard.usesCredits")})]})]}),n.jsx(xt,{children:n.jsxs(Be,{type:"button",onClick:()=>{B(!1),rs()},children:[n.jsx(tt,{size:14}),u("sandbox.postBoard.generateIdeas")]})})]})]}),n.jsxs(zt,{children:[n.jsx(Ft,{asChild:!0,children:n.jsxs(Be,{type:"button",size:"sm",children:[n.jsx(Ss,{size:14}),u("sandbox.postBoard.newPost"),n.jsx(ht,{size:14})]})}),n.jsxs(Kt,{align:"end",className:"w-56",children:[n.jsxs(We,{disabled:!0,onClick:()=>{z(void 0),R(!0)},children:[n.jsx(tt,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[u("sandbox.postBoard.newPostGenerate"),n.jsx(ot,{variant:"secondary",children:u("common.soon")})]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostGenerateHint")})]})]}),n.jsxs(We,{onClick:At,children:[n.jsx(Vo,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:u("sandbox.postBoard.newPostWrite")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostWriteHint")})]})]}),n.jsxs(We,{onClick:()=>P(!0),children:[n.jsx(fs,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:u("sandbox.postBoard.importContent")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.importContentHint")})]})]})]})]}),n.jsx(qi,{open:I,onOpenChange:R,decofile:o,hasAi:y,seed:V,onGenerate:T=>{de(T)}},V?.title??"scratch"),n.jsx(ut,{open:W,onOpenChange:P,children:n.jsxs(dt,{className:"max-h-[85vh] sm:max-w-2xl",children:[n.jsxs(gt,{children:[n.jsx(ct,{children:u("sandbox.postBoard.importTitle")}),n.jsx(Vt,{children:u("sandbox.postBoard.importDescription")})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"h-72 overflow-hidden rounded-[var(--studio-control-radius,var(--radius-xl))] border bg-[var(--studio-input-background)]",children:n.jsx(Un,{code:U,language:ko(U)?"html":"markdown",height:"100%",autoFocus:!0,onChange:T=>Y(T??"")})}),n.jsx("input",{ref:J,type:"file",accept:".html,.htm,.md,.markdown,.txt",className:"hidden",onChange:async T=>{const Q=T.target.files?.[0];Q&&Y(await Q.text()),T.target.value=""}}),n.jsxs(Be,{type:"button",variant:"outline",size:"sm",onClick:()=>J.current?.click(),children:[n.jsx(fs,{size:14}),u("sandbox.postBoard.importUpload")]})]}),n.jsx(xt,{children:n.jsxs(Be,{type:"button",disabled:!U.trim(),onClick:is,children:[n.jsx(fs,{size:14}),u("sandbox.postBoard.importRun")]})})]})})]})]}),te.length===0&&re.length===0?n.jsx(nl,{className:"flex-1",icon:n.jsx(tt,{size:22}),title:u("sandbox.postBoard.emptyTitle"),description:u("sandbox.postBoard.emptyDescription"),buttonProps:{children:u("sandbox.postBoard.newPost"),onClick:At}}):a==="board"?n.jsxs("div",{className:"flex min-h-0 flex-1 gap-3 overflow-x-auto p-4",children:[n.jsx(Er,{ideas:re,collapsed:X.includes(pn),pillarTitleOf:N,onToggleCollapsed:()=>ne(pn),onGenerate:os,onDelete:as}),n.jsx("div",{"aria-hidden":!0,className:"my-1 w-px shrink-0 self-stretch bg-border"}),Ds.map(T=>{const Q=te.filter(Ee=>Ee.status===T);Nr(T)&&Q.sort(wr);const Te=u(Wt[T]),Ve=X.includes(T),qe=vo(p,T);return n.jsx("div",{onDragOver:Ee=>{Ee.preventDefault(),j(T)},onDragLeave:()=>j(Ee=>Ee===T?null:Ee),onDrop:Ee=>{Ee.preventDefault(),ls(T,Ee.dataTransfer.getData(No))},title:qe?jo(u,qe):void 0,className:xe("flex shrink-0 flex-col rounded-xl border bg-muted/30 transition-colors",Ve?"w-11":"w-72",qe&&"opacity-50",v===T&&"border-primary bg-primary/5"),children:Ve?n.jsxs("button",{type:"button",onClick:()=>ne(T),"aria-label":u("sandbox.postBoard.expandLane",{lane:Te}),"aria-expanded":!1,className:"flex min-h-0 flex-1 cursor-pointer flex-col items-center gap-2 py-2.5 text-muted-foreground hover:text-foreground",children:[n.jsx(Et,{size:14,className:"shrink-0"}),n.jsx("span",{className:"text-xs tabular-nums",children:Q.length}),n.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:Te})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",children:[n.jsxs("button",{type:"button",onClick:()=>ne(T),"aria-label":u("sandbox.postBoard.collapseLane",{lane:Te}),"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[n.jsx(ht,{size:14,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:Te})]}),n.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:Q.length})]}),n.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto px-2 pb-2",children:Q.length===0?n.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:u("sandbox.postBoard.laneEmpty")}):Q.map(Ee=>n.jsx(Br,{post:Ee,payload:q(Ee.key),moving:d.isMoving(Ee.key),onOpen:()=>c(Ee.key),onArchive:Ee.status==="archived"?void 0:()=>{oe(Ee)}},Ee.key))})]})},T)})]}):n.jsxs("div",{className:"flex min-h-0 flex-1",children:[n.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-r",children:[M?n.jsx(kr,{count:je.size,allSelected:Le.length>0&&Le.every(T=>je.has(T.key)),onToggleSelectAll:we,onArchive:()=>{Oe()},onExit:()=>Se(new Set)}):n.jsx(gr,{categories:ge,authors:$e,statusCounts:Ae,categoryFilter:S,authorFilter:H,statusFilter:ye,sort:ke,onCategoryFilterChange:se,onAuthorFilterChange:ie,onStatusFilterChange:pe,onSortChange:he}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n.jsx(Pr,{posts:Le,selectedKey:Z,selectionActive:M,selectedKeys:je,onToggleSelect:ve,onOpen:c,isMoving:d.isMoving,onArchive:T=>{oe(T)}})})]}),n.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:Z&&h?n.jsx($.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(Ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(Z)}):n.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:u("sandbox.postBoard.selectPrompt")})})]}),a==="board"&&l&&D&&h&&n.jsx("div",{className:"absolute inset-0 z-30 flex flex-col bg-background",children:h(l,{expanded:!0,onToggleExpand:()=>A(!1),onClose:()=>{A(!1),r?.()}})}),n.jsx(ut,{open:a==="board"&&!!l&&!D,onOpenChange:T=>{T||(A(!1),r?.())},children:n.jsxs(dt,{closeButtonClassName:"hidden",className:"left-auto right-4 top-4 bottom-4 flex h-auto translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl",children:[n.jsx(ct,{className:"sr-only",children:u("sandbox.collectionsSidebar.posts")}),l&&h?n.jsx($.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(Ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(l,{expanded:!1,onToggleExpand:()=>A(!0),onClose:()=>r?.()})}):null]})})]})}function gn(t){const e=ae.c(7),{active:s,onClick:o,icon:a,label:l}=t,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground";let c;e[0]!==i?(c=xe("inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",i),e[0]=i,e[1]=c):c=e[1];let r;return e[2]!==a||e[3]!==l||e[4]!==o||e[5]!==c?(r=n.jsxs("button",{type:"button",onClick:o,className:c,children:[a,l]}),e[2]=a,e[3]=l,e[4]=o,e[5]=c,e[6]=r):r=e[6],r}function Pr(t){const e=ae.c(19),{posts:s,selectedKey:o,selectionActive:a,selectedKeys:l,onToggleSelect:i,onOpen:c,isMoving:r,onArchive:d}=t;let p;if(e[0]!==r||e[1]!==d||e[2]!==c||e[3]!==i||e[4]!==s||e[5]!==o||e[6]!==l||e[7]!==a){let h;e[9]!==r||e[10]!==d||e[11]!==c||e[12]!==i||e[13]!==o||e[14]!==l||e[15]!==a?(h=u=>n.jsx(Tr,{post:u,selected:u.key===o,selectionActive:a,checked:l.has(u.key),onToggleSelect:()=>i(u.key),moving:r(u.key),onOpen:()=>c(u.key),onArchive:u.status==="archived"?void 0:()=>d(u)},u.key),e[9]=r,e[10]=d,e[11]=c,e[12]=i,e[13]=o,e[14]=l,e[15]=a,e[16]=h):h=e[16],p=s.map(h),e[0]=r,e[1]=d,e[2]=c,e[3]=i,e[4]=s,e[5]=o,e[6]=l,e[7]=a,e[8]=p}else p=e[8];let m;return e[17]!==p?(m=n.jsx("ul",{className:"divide-y",children:p}),e[17]=p,e[18]=m):m=e[18],m}function Tr(t){const e=ae.c(56),{post:s,selected:o,selectionActive:a,checked:l,onToggleSelect:i,moving:c,onOpen:r,onArchive:d}=t,p=Ne(),m=s.status==="awaiting_review"&&s.missing.length>0,h=s.status==="scheduled"||s.status==="published",u=a||l?"opacity-100":"opacity-0 focus-within:opacity-100 group-hover/row:opacity-100";let f;e[0]!==u?(f=xe("absolute left-3 top-3 z-10 transition-opacity",u),e[0]=u,e[1]=f):f=e[1];let x;e[2]!==i?(x=()=>i(),e[2]=i,e[3]=x):x=e[3];let g;e[4]!==s.title||e[5]!==p?(g=s.title||p("sandbox.postBoard.untitled"),e[4]=s.title,e[5]=p,e[6]=g):g=e[6];let y;e[7]!==l||e[8]!==x||e[9]!==g?(y=n.jsx(es,{checked:l,onCheckedChange:x,"aria-label":g}),e[7]=l,e[8]=x,e[9]=g,e[10]=y):y=e[10];let v;e[11]!==f||e[12]!==y?(v=n.jsx("span",{className:f,children:y}),e[11]=f,e[12]=y,e[13]=v):v=e[13];let j;e[14]!==c||e[15]!==d||e[16]!==a?(j=d&&!a&&n.jsx(Ls,{onArchive:d,disabled:c,className:"top-2.5"}),e[14]=c,e[15]=d,e[16]=a,e[17]=j):j=e[17];let w;e[18]!==r||e[19]!==i||e[20]!==a?(w=()=>a?i():r(),e[18]=r,e[19]=i,e[20]=a,e[21]=w):w=e[21];const C=o?"bg-accent text-accent-foreground":"bg-card hover:bg-muted/50";let E;e[22]!==C?(E=xe("flex w-full cursor-pointer flex-col gap-1.5 py-2.5 pl-10 pr-3 text-left text-sm transition-colors",C),e[22]=C,e[23]=E):E=e[23];let B;e[24]!==s.title||e[25]!==p?(B=s.title||p("sandbox.postBoard.untitled"),e[24]=s.title,e[25]=p,e[26]=B):B=e[26];let k;e[27]!==B?(k=n.jsx("span",{className:"min-w-0 truncate pr-6 font-medium",children:B}),e[27]=B,e[28]=k):k=e[28];const _=Sr[s.status],O=Wt[s.status];let L;e[29]!==p||e[30]!==O?(L=p(O),e[29]=p,e[30]=O,e[31]=L):L=e[31];let K;e[32]!==_||e[33]!==L?(K=n.jsx(ot,{variant:_,className:"shrink-0",children:L}),e[32]=_,e[33]=L,e[34]=K):K=e[34];let F;e[35]!==m||e[36]!==s.missing?(F=m&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[n.jsx(Qt,{size:12}),s.missing.length]}),e[35]=m,e[36]=s.missing,e[37]=F):F=e[37];let D;e[38]!==h||e[39]!==s.date||e[40]!==s.scheduledDatetime?(D=h&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[n.jsx(ks,{size:12}),(s.scheduledDatetime||s.date||"").slice(0,10)]}),e[38]=h,e[39]=s.date,e[40]=s.scheduledDatetime,e[41]=D):D=e[41];let A;e[42]!==K||e[43]!==F||e[44]!==D?(A=n.jsxs("div",{className:"flex items-center gap-2",children:[K,F,D]}),e[42]=K,e[43]=F,e[44]=D,e[45]=A):A=e[45];let I;e[46]!==o||e[47]!==E||e[48]!==k||e[49]!==A||e[50]!==w?(I=n.jsxs("button",{type:"button",onClick:w,"aria-current":o,className:E,children:[k,A]}),e[46]=o,e[47]=E,e[48]=k,e[49]=A,e[50]=w,e[51]=I):I=e[51];let R;return e[52]!==I||e[53]!==v||e[54]!==j?(R=n.jsxs("li",{className:"group/row relative",children:[v,j,I]}),e[52]=I,e[53]=v,e[54]=j,e[55]=R):R=e[55],R}function Br(t){const e=ae.c(46),{post:s,payload:o,moving:a,onOpen:l,onArchive:i}=t,c=Ne(),r=s.status!=="generating"&&!a;let d;e[0]!==o?(d=Ql(o),e[0]=o,e[1]=d):d=e[1];const p=d,m=!r&&"opacity-80";let h;e[2]!==m?(h=xe("group/card relative rounded-lg border bg-card shadow-sm transition-colors hover:border-primary/40",m),e[2]=m,e[3]=h):h=e[3];let u;e[4]!==a||e[5]!==i?(u=i&&n.jsx(Ls,{onArchive:i,disabled:a,className:"top-2"}),e[4]=a,e[5]=i,e[6]=u):u=e[6];let f;e[7]!==s.key?(f=O=>O.dataTransfer.setData(No,s.key),e[7]=s.key,e[8]=f):f=e[8];const x=r?"cursor-grab active:cursor-grabbing":"cursor-pointer";let g;e[9]!==x?(g=xe("block w-full p-3 text-left",x),e[9]=x,e[10]=g):g=e[10];let y;e[11]!==s.title||e[12]!==c?(y=s.title||c("sandbox.postBoard.untitled"),e[11]=s.title,e[12]=c,e[13]=y):y=e[13];let v;e[14]!==y?(v=n.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:y}),e[14]=y,e[15]=v):v=e[15];let j;e[16]!==p||e[17]!==s.status?(j=s.status==="draft"&&n.jsxs(n.Fragment,{children:[p.pillarTitle&&n.jsx(ot,{variant:"secondary",className:"max-w-full truncate",children:p.pillarTitle}),p.format?.name&&n.jsx(ot,{variant:"outline",className:"max-w-full truncate",children:p.format.name})]}),e[16]=p,e[17]=s.status,e[18]=j):j=e[18];let w;e[19]!==s.status||e[20]!==c?(w=s.status==="generating"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx(Ct,{size:12,className:"animate-spin"}),c("sandbox.postBoard.generatingLabel")]}),e[19]=s.status,e[20]=c,e[21]=w):w=e[21];let C;e[22]!==s.missing||e[23]!==s.status||e[24]!==c?(C=s.status==="awaiting_review"&&(s.missing.length>0?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[n.jsx(Qt,{size:12}),c("sandbox.postBoard.nIssues",{count:String(s.missing.length)})]}):n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-success",children:[n.jsx(sl,{size:12}),c("sandbox.postBoard.readyToSchedule")]})),e[22]=s.missing,e[23]=s.status,e[24]=c,e[25]=C):C=e[25];let E;e[26]!==s.date||e[27]!==s.scheduledDatetime||e[28]!==s.status?(E=(s.status==="scheduled"||s.status==="published")&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[n.jsx(ks,{size:12}),(s.scheduledDatetime||s.date||"").slice(0,10)]}),e[26]=s.date,e[27]=s.scheduledDatetime,e[28]=s.status,e[29]=E):E=e[29];let B;e[30]!==j||e[31]!==w||e[32]!==C||e[33]!==E?(B=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[j,w,C,E]}),e[30]=j,e[31]=w,e[32]=C,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==r||e[36]!==l||e[37]!==B||e[38]!==f||e[39]!==g||e[40]!==v?(k=n.jsxs("button",{type:"button",draggable:r,onDragStart:f,onClick:l,className:g,children:[v,B]}),e[35]=r,e[36]=l,e[37]=B,e[38]=f,e[39]=g,e[40]=v,e[41]=k):k=e[41];let _;return e[42]!==k||e[43]!==h||e[44]!==u?(_=n.jsxs("div",{className:h,children:[u,k]}),e[42]=k,e[43]=h,e[44]=u,e[45]=_):_=e[45],_}function Er(t){const e=ae.c(40),{ideas:s,collapsed:o,pillarTitleOf:a,onToggleCollapsed:l,onGenerate:i,onDelete:c}=t,r=Ne();let d,p,m,h,u,f,x;if(e[0]!==o||e[1]!==s.length||e[2]!==l||e[3]!==r){x=Symbol.for("react.early_return_sentinel");e:{if(d=r("sandbox.postBoard.ideasTray"),o){let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(Et,{size:14,className:"shrink-0"}),e[11]=k):k=e[11];let _;e[12]!==s.length?(_=n.jsx("span",{className:"text-xs tabular-nums",children:s.length}),e[12]=s.length,e[13]=_):_=e[13],x=n.jsxs("button",{type:"button",onClick:l,"aria-label":r("sandbox.postBoard.expandLane",{lane:d}),"aria-expanded":!1,className:"flex w-11 shrink-0 cursor-pointer flex-col items-center gap-2 py-2.5 text-muted-foreground hover:text-foreground",children:[k,_,n.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:d})]});break e}f="flex w-72 shrink-0 flex-col",u="flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",p="button",m=l,h=r("sandbox.postBoard.collapseLane",{lane:d})}e[0]=o,e[1]=s.length,e[2]=l,e[3]=r,e[4]=d,e[5]=p,e[6]=m,e[7]=h,e[8]=u,e[9]=f,e[10]=x}else d=e[4],p=e[5],m=e[6],h=e[7],u=e[8],f=e[9],x=e[10];if(x!==Symbol.for("react.early_return_sentinel"))return x;let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(ht,{size:14,className:"shrink-0"}),e[14]=g):g=e[14];let y;e[15]!==d?(y=n.jsx("span",{className:"truncate",children:d}),e[15]=d,e[16]=y):y=e[16];let v;e[17]!==p||e[18]!==m||e[19]!==h||e[20]!==y?(v=n.jsxs("button",{type:p,onClick:m,"aria-label":h,"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[g,y]}),e[17]=p,e[18]=m,e[19]=h,e[20]=y,e[21]=v):v=e[21];let j;e[22]!==s.length?(j=n.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:s.length}),e[22]=s.length,e[23]=j):j=e[23];let w;e[24]!==j||e[25]!==u||e[26]!==v?(w=n.jsxs("div",{className:u,children:[v,j]}),e[24]=j,e[25]=u,e[26]=v,e[27]=w):w=e[27];let C;e[28]!==s||e[29]!==c||e[30]!==i||e[31]!==a||e[32]!==r?(C=s.length===0?n.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.postBoard.ideasEmpty")}):s.map(k=>{const _=a(k.pillarKey);return n.jsxs("div",{className:"group/card relative rounded-lg border border-dashed bg-card shadow-sm transition-colors hover:border-primary/40",children:[n.jsx(Ls,{label:r("sandbox.postBoard.deleteIdea"),onArchive:()=>c(k),className:"top-2"}),n.jsxs("div",{className:"p-3",children:[n.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:k.title||r("sandbox.postBoard.untitledIdea")}),k.body&&n.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:k.body}),_&&n.jsx(ot,{variant:"secondary",className:"mt-2 max-w-full truncate",children:_})]}),n.jsx("div",{className:"border-t px-3 py-2",children:n.jsxs(Be,{type:"button",variant:"ghost",size:"sm",disabled:!0,className:"h-7 w-full justify-start px-1.5 text-xs",onClick:()=>i(k),children:[n.jsx(tt,{size:13}),r("sandbox.postBoard.writeFromIdea"),n.jsx(ot,{variant:"secondary",className:"ml-auto",children:r("common.soon")})]})})]},k.key)}),e[28]=s,e[29]=c,e[30]=i,e[31]=a,e[32]=r,e[33]=C):C=e[33];let E;e[34]!==C?(E=n.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto pb-2 pr-1",children:C}),e[34]=C,e[35]=E):E=e[35];let B;return e[36]!==w||e[37]!==E||e[38]!==f?(B=n.jsxs("div",{className:f,children:[w,E]}),e[36]=w,e[37]=E,e[38]=f,e[39]=B):B=e[39],B}function Ls(t){const e=ae.c(13),{label:s,onArchive:o,disabled:a,className:l}=t,i=Ne();let c;e[0]!==s||e[1]!==i?(c=s??i("sandbox.postBoard.delete"),e[0]=s,e[1]=i,e[2]=c):c=e[2];const r=c;let d;e[3]!==o?(d=u=>{u.stopPropagation(),o()},e[3]=o,e[4]=d):d=e[4];let p;e[5]!==l?(p=xe("absolute right-2 z-10 flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-destructive focus-visible:opacity-100 group-hover/card:opacity-100 group-hover/row:opacity-100",l),e[5]=l,e[6]=p):p=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ps,{size:13}),e[7]=m):m=e[7];let h;return e[8]!==a||e[9]!==d||e[10]!==p||e[11]!==r?(h=n.jsx("button",{type:"button",disabled:a,"aria-label":r,title:r,onClick:d,className:p,children:m}),e[8]=a,e[9]=d,e[10]=p,e[11]=r,e[12]=h):h=e[12],h}function He(t){const e=ae.c(50),{icon:s,logoUrl:o,title:a,subtitle:l,active:i,accent:c,variantCount:r,trailing:d,selectable:p,selectionActive:m,selected:h,invalid:u,invalidReason:f,onToggleSelect:x,onClick:g,menu:y}=t,v=Ne(),j=c==="global";let w;e[0]!==s||e[1]!==i||e[2]!==j||e[3]!==o?(w=o?n.jsx("img",{src:o,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx("span",{className:xe("flex size-8 shrink-0 items-center justify-center rounded-lg",j?"bg-global-section/15":"bg-muted"),children:n.jsx(s,{size:16,className:xe("shrink-0",!j&&(i?"text-accent-foreground":"text-muted-foreground")),style:j?{color:Cs}:void 0})}),e[0]=s,e[1]=i,e[2]=j,e[3]=o,e[4]=w):w=e[4];const C=w,E=i?j?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":j?"hover:bg-global-section/10":"hover:bg-muted";let B;e[5]!==E?(B=xe("group relative flex min-w-0 items-center rounded-md transition-colors",E),e[5]=E,e[6]=B):B=e[6];let k;e[7]!==x||e[8]!==p||e[9]!==h||e[10]!==m||e[11]!==v||e[12]!==a?(k=p&&n.jsx("span",{className:xe("flex shrink-0 items-center pl-2.5 transition-opacity",h||m?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Dr,children:n.jsx(es,{checked:h,onCheckedChange:()=>x?.(),"aria-label":v("sandbox.itemRow.selectItem",{title:a})})}),e[7]=x,e[8]=p,e[9]=h,e[10]=m,e[11]=v,e[12]=a,e[13]=k):k=e[13];const _=u&&!i&&"text-destructive";let O;e[14]!==_?(O=xe("block truncate text-sm font-medium",_),e[14]=_,e[15]=O):O=e[15];let L;e[16]!==O||e[17]!==a?(L=n.jsx("span",{className:O,children:a}),e[16]=O,e[17]=a,e[18]=L):L=e[18];const K=i?"text-accent-foreground/70":"text-muted-foreground";let F;e[19]!==K?(F=xe("block truncate text-xs",K),e[19]=K,e[20]=F):F=e[20];let D;e[21]!==l||e[22]!==F?(D=n.jsx("span",{className:F,children:l}),e[21]=l,e[22]=F,e[23]=D):D=e[23];let A;e[24]!==D||e[25]!==L?(A=n.jsxs("span",{className:"min-w-0 flex-1",children:[L,D]}),e[24]=D,e[25]=L,e[26]=A):A=e[26];let I;e[27]!==i||e[28]!==v||e[29]!==r?(I=r!==void 0&&r>1&&n.jsxs(Xe,{children:[n.jsx(Ye,{asChild:!0,children:n.jsxs("span",{className:xe("flex shrink-0 items-center gap-1 text-xs font-medium",i?"text-accent-foreground/70":"text-muted-foreground"),children:[n.jsx(Pn,{size:14}),r]})}),n.jsx(Qe,{side:"bottom",children:v("sandbox.itemRow.variantCount",{count:r})})]}),e[27]=i,e[28]=v,e[29]=r,e[30]=I):I=e[30];let R;e[31]!==i||e[32]!==u||e[33]!==f?(R=u&&n.jsxs(Xe,{children:[n.jsx(Ye,{asChild:!0,children:n.jsx("span",{className:xe("flex shrink-0 items-center",i?"text-accent-foreground":"text-destructive"),children:n.jsx(Qt,{size:14})})}),f&&n.jsx(Qe,{side:"bottom",children:f})]}),e[31]=i,e[32]=u,e[33]=f,e[34]=R):R=e[34];let V;e[35]!==g||e[36]!==C||e[37]!==A||e[38]!==I||e[39]!==R||e[40]!==d?(V=n.jsxs("button",{type:"button",onClick:g,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg px-2.5 py-2 text-left cursor-pointer",children:[C,A,I,R,d]}),e[35]=g,e[36]=C,e[37]=A,e[38]=I,e[39]=R,e[40]=d,e[41]=V):V=e[41];let z;e[42]!==i||e[43]!==y?(z=y&&n.jsx("div",{className:xe("pr-1 opacity-0 transition-opacity group-hover:opacity-100",i&&"opacity-100"),children:y}),e[42]=i,e[43]=y,e[44]=z):z=e[44];let W;return e[45]!==V||e[46]!==z||e[47]!==B||e[48]!==k?(W=n.jsxs("div",{className:B,children:[k,V,z]}),e[45]=V,e[46]=z,e[47]=B,e[48]=k,e[49]=W):W=e[49],W}function Dr(t){return t.stopPropagation()}function st(t){const e=ae.c(10),{icon:s,title:o,description:a}=t;let l;e[0]!==s?(l=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=l):l=e[1];let i;e[2]!==o?(i=n.jsx("div",{children:o}),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==a?(c=a&&n.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:a}),e[4]=a,e[5]=c):c=e[5];let r;return e[6]!==l||e[7]!==i||e[8]!==c?(r=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[l,i,c]}),e[6]=l,e[7]=i,e[8]=c,e[9]=r):r=e[9],r}const _r={loaders:Cn,actions:_n},Ar={loaders:"Loaders",actions:"Actions"},$r={analytics:Ho,blog:Vn,commerce:Uo,site:Go,website:Mt};function Lr(t,e){return e===0?$r[t.toLowerCase()]??Fs:Fs}function Lt(t,e){return e===0?ma(t):t}function Or(t){const e=ae.c(98),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r}=t,d=Ne();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];const[m,h]=$.useState(p),[u,f]=$.useState(null),[x,g]=$.useState(""),[y,v]=$.useState(Gr),[j,w]=$.useState(r);j!==r&&(w(r),h([]),f(null),g(""),v(new Set));let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=J=>{v(X=>{const ce=new Set(X);return ce.has(J)?ce.delete(J):ce.add(J),ce})},e[1]=C):C=e[1];const E=C;let B;e[2]!==a||e[3]!==s||e[4]!==o?(B={orgSlug:s,virtualMcpId:o,branch:a},e[2]=a,e[3]=s,e[4]=o,e[5]=B):B=e[5];const k=Zt(B);let _;e[6]!==k?(_=Rn((J,X)=>k.mutate({blockKey:J,data:X})),e[6]=k,e[7]=_):_=e[7];const O=_;let L;e[8]!==r?(L=fa(r),e[8]=r,e[9]=L):L=e[9];const K=L,F=_r[r];let D,A,I,R,V,z,W;if(e[10]!==F||e[11]!==a||e[12]!==c||e[13]!==r||e[14]!==i||e[15]!==y||e[16]!==s||e[17]!==m||e[18]!==l||e[19]!==k||e[20]!==O||e[21]!==x||e[22]!==u||e[23]!==K||e[24]!==d||e[25]!==o){I=Symbol.for("react.early_return_sentinel");e:{const J=[...ra(i,c,r).map(Vr),...ca(i,r).map(Mr)],X=x.trim().toLowerCase(),ce=X.length>0,ne=ce?J.filter(M=>M.title.toLowerCase().includes(X)||M.resolveType.toLowerCase().includes(X)):[],de=new Map,te=[],re=new Map;if(!ce){for(const M of J){const ve=M.folderPath;if(!(ve.length<m.length)&&m.every((we,Oe)=>ve[Oe]===we))if(ve.length===m.length)if(M.savedKey!==void 0){const we=re.get(M.resolveType);we?we.push(M):re.set(M.resolveType,[M])}else te.push(M);else{const we=ve[m.length],Oe=de.get(we)??{count:0,savedCount:0};M.savedKey!==void 0?Oe.savedCount=Oe.savedCount+1:Oe.count=Oe.count+1,de.set(we,Oe)}}te.sort(zr);for(const M of re.values())M.sort(Kr)}const le=[...re.entries()].filter(M=>{const[ve]=M;return!te.some(we=>we.resolveType===ve)}).flatMap(Fr).sort(Rr);let N;e[33]!==m?(N=(M,ve)=>Lt(M.name,m.length).localeCompare(Lt(ve.name,m.length)),e[33]=m,e[34]=N):N=e[34];const q=[...de.entries()].map(Ir).sort(N);let Z;e[35]===Symbol.for("react.memo_cache_sentinel")?(Z=M=>{f(M.savedKey!==void 0?{mode:"saved",key:M.savedKey}:{mode:"available",resolveType:M.resolveType,title:M.title})},e[35]=Z):Z=e[35];const oe=Z;let S;e[36]!==k||e[37]!==K||e[38]!==d?(S=async(M,ve)=>{await k.mutateAsync({blockKey:M,data:ve}),me.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:K,blockId:M})),f({mode:"saved",key:M})},e[36]=k,e[37]=K,e[38]=d,e[39]=S):S=e[39];const se=S;let H;e[40]!==c||e[41]!==u?(H=Ur(u,c),e[40]=c,e[41]=u,e[42]=H):H=e[42];const ie=H;if(ie){const M=`${ie.mode}:${ie.mode==="saved"?ie.blockKey:ie.resolveType}`;let ve;e[43]===Symbol.for("react.memo_cache_sentinel")?(ve=()=>f(null),e[43]=ve):ve=e[43];let we;e[44]!==a||e[45]!==c||e[46]!==se||e[47]!==r||e[48]!==i||e[49]!==s||e[50]!==l||e[51]!==k.isPending||e[52]!==O||e[53]!==M||e[54]!==ie.editorTarget||e[55]!==ie.initialValue||e[56]!==o?(we=n.jsx(da,{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r,target:ie.editorTarget,initialValue:ie.initialValue,isCreating:k.isPending,onCreate:se,onSaveReferencedBlock:O,onBack:ve},M),e[44]=a,e[45]=c,e[46]=se,e[47]=r,e[48]=i,e[49]=s,e[50]=l,e[51]=k.isPending,e[52]=O,e[53]=M,e[54]=ie.editorTarget,e[55]=ie.initialValue,e[56]=o,e[57]=we):we=e[57],I=we;break e}W="flex h-full w-full min-w-0 flex-col";let ye;e[58]!==d?(ye=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ye):ye=e[59];let pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>h([]),e[60]=pe):pe=e[60];const ke=m.length===0?"font-medium text-foreground":"text-muted-foreground";let he;e[61]!==ke?(he=xe("min-w-0 truncate rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ke),e[61]=ke,e[62]=he):he=e[62];const je=Ar[r];let Se;e[63]!==he||e[64]!==je?(Se=n.jsx("button",{type:"button",onClick:pe,className:he,children:je}),e[63]=he,e[64]=je,e[65]=Se):Se=e[65];let Ae;e[66]!==m?(Ae=m.map((M,ve)=>{const we=ve===m.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[n.jsx(Et,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>h(m.slice(0,ve+1)),className:xe("min-w-0 truncate rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",we?"font-medium text-foreground":"text-muted-foreground"),children:Lt(M,ve)})]},`${M}-${ve}`)}),e[66]=m,e[67]=Ae):Ae=e[67];let Ce;e[68]!==ye||e[69]!==Se||e[70]!==Ae?(Ce=n.jsxs("nav",{"aria-label":ye,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Se,Ae]}),e[68]=ye,e[69]=Se,e[70]=Ae,e[71]=Ce):Ce=e[71];let Pe;e[72]===Symbol.for("react.memo_cache_sentinel")?(Pe=n.jsx(En,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Pe):Pe=e[72];let _e;e[73]===Symbol.for("react.memo_cache_sentinel")?(_e=M=>g(M.target.value),e[73]=_e):_e=e[73];let ge;e[74]!==r||e[75]!==d?(ge=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:r}),e[74]=r,e[75]=d,e[76]=ge):ge=e[76];let $e;e[77]!==r||e[78]!==d?($e=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:r}),e[77]=r,e[78]=d,e[79]=$e):$e=e[79];let Le;e[80]!==x||e[81]!==ge||e[82]!==$e?(Le=n.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Pe,n.jsx("input",{type:"text",value:x,onChange:_e,placeholder:ge,"aria-label":$e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=x,e[81]=ge,e[82]=$e,e[83]=Le):Le=e[83],e[84]!==Ce||e[85]!==Le?(A=n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[Ce,Le]}),e[84]=Ce,e[85]=Le,e[86]=A):A=e[86],D=Xt,z="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",R="mx-auto w-full max-w-4xl px-6 py-5",V=ce?ne.length===0?n.jsx(st,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:r,query:x.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):n.jsx("div",{className:"flex flex-col gap-1",children:ne.map(M=>n.jsx(He,{icon:F,accent:M.savedKey!==void 0?"global":void 0,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)},M.savedKey??M.resolveType))}):q.length===0&&te.length===0&&le.length===0?n.jsx(st,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:r}),description:m.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):n.jsxs(n.Fragment,{children:[q.length>0&&n.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:q.map(M=>{const ve=Lr(M.name,m.length);return n.jsxs("button",{type:"button",onClick:()=>h([...m,M.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[n.jsx(ve,{size:18,className:"shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-sm font-medium",children:Lt(M.name,m.length)}),n.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[M.count," ",M.count===1?K:r,M.savedCount>0&&n.jsxs(n.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:M.savedCount})]})]})]})]},M.name)})}),(te.length>0||le.length>0)&&n.jsxs("div",{className:xe("flex flex-col gap-1",q.length>0&&"mt-4"),children:[te.map(M=>{const ve=re.get(M.resolveType)??[],we=y.has(M.resolveType);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(He,{icon:F,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)}),ve.length>0&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>E(M.resolveType),"aria-expanded":we,className:"flex items-center gap-1 self-start rounded-lg px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:Cs},children:[we?n.jsx(ht,{size:12,className:"shrink-0"}):n.jsx(Et,{size:12,className:"shrink-0"}),d(we?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ve.length,")"]}),we&&n.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ve.map(Oe=>n.jsx(He,{icon:F,accent:"global",title:Oe.title,subtitle:Oe.resolveType,active:!1,onClick:()=>oe(Oe)},Oe.savedKey))})]})]},M.resolveType)}),le.map(M=>n.jsx(He,{icon:F,accent:"global",title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)},M.savedKey))]})]})}e[10]=F,e[11]=a,e[12]=c,e[13]=r,e[14]=i,e[15]=y,e[16]=s,e[17]=m,e[18]=l,e[19]=k,e[20]=O,e[21]=x,e[22]=u,e[23]=K,e[24]=d,e[25]=o,e[26]=D,e[27]=A,e[28]=I,e[29]=R,e[30]=V,e[31]=z,e[32]=W}else D=e[26],A=e[27],I=e[28],R=e[29],V=e[30],z=e[31],W=e[32];if(I!==Symbol.for("react.early_return_sentinel"))return I;let P;e[87]!==R||e[88]!==V?(P=n.jsx("div",{className:R,children:V}),e[87]=R,e[88]=V,e[89]=P):P=e[89];let U;e[90]!==D||e[91]!==P||e[92]!==z?(U=n.jsx(D,{className:z,children:P}),e[90]=D,e[91]=P,e[92]=z,e[93]=U):U=e[93];let Y;return e[94]!==A||e[95]!==U||e[96]!==W?(Y=n.jsxs("div",{className:W,children:[A,U]}),e[94]=A,e[95]=U,e[96]=W,e[97]=Y):Y=e[97],Y}function Ir(t){const[e,s]=t;return{name:e,...s}}function Rr(t,e){return t.title.localeCompare(e.title)}function Fr(t){const[,e]=t;return e}function Kr(t,e){return t.title.localeCompare(e.title)}function zr(t,e){return t.title.localeCompare(e.title)}function Mr(t){return{resolveType:t.resolveType,title:t.title,folderPath:In(t.resolveType)}}function Vr(t){return{resolveType:t.resolveType,title:t.title,folderPath:In(t.resolveType),savedKey:t.key}}function Gr(){return new Set}function Ur(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:o,title:a}=ua(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:a},initialValue:o}}function Hr(t){const e=ae.c(106),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,resolveType:r,title:d,defaultBlockId:p,isCreating:m,onCreate:h,onSaveReferencedBlock:u}=t,f=Ne(),x=Dt(),g=x?.virtualMcpId,v=Hn(g===o?o:null)?.metadata?.siteSlug??null;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={},e[0]=j):j=e[0];const[w,C]=$.useState(j);let E;e[1]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[1]=E):E=e[1];const[B,k]=$.useState(E),[_,O]=$.useState(0),[L,K]=$.useState(!1);let F;e[2]!==i||e[3]!==r?(F=ws(r,i),e[2]=i,e[3]=r,e[4]=F):F=e[4];const D=F;let A,I,R,V,z,W,P,U;if(e[5]!==v||e[6]!==a||e[7]!==c||e[8]!==B||e[9]!==w||e[10]!==m||e[11]!==h||e[12]!==s||e[13]!==l||e[14]!==r||e[15]!==f||e[16]!==x?.taskId||e[17]!==d||e[18]!==o){const te=r.split("/").pop()?.replace(/\.tsx?$/,"")??r,re=x?.taskId??null,le=l??void 0;let N;e[27]!==v||e[28]!==a||e[29]!==s||e[30]!==le||e[31]!==re||e[32]!==o?(N={orgSlug:s,virtualMcpId:o,branch:a,threadId:re,previewUrl:le,siteSlug:v},e[27]=v,e[28]=a,e[29]=s,e[30]=le,e[31]=re,e[32]=o,e[33]=N):N=e[33],I=N;let q,Z,oe,S;if(e[34]!==c||e[35]!==B||e[36]!==w||e[37]!==h||e[38]!==f||e[39]!==d){const Se=[d,...B],Ae=Pe=>{k(B.slice(0,Pe)),O(Jr)};let Ce;e[48]!==c||e[49]!==w||e[50]!==h?(Ce=async Pe=>{const _e=ha(Pe,c);if(_e){me.error(_e);return}await h(Pe,w),K(!1)},e[48]=c,e[49]=w,e[50]=h,e[51]=Ce):Ce=e[51],A=Ce,U="flex h-full w-full min-w-0",P="flex min-w-0 flex-1 flex-col",z="shrink-0 border-b px-3 py-2.5",S="flex min-w-0 items-center gap-2 overflow-hidden",e[52]!==f?(q=f("sandbox.availableSectionEditor.editingBreadcrumb"),e[52]=f,e[53]=q):q=e[53],Z="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",oe=Se.map((Pe,_e)=>{const ge=_e===Se.length-1,$e=pa(Pe);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[_e>0&&n.jsx(Et,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Ae(_e),title:$e,className:xe("min-w-0 truncate rounded-lg px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ge?"font-medium text-foreground":"text-muted-foreground"),children:$e})]},`${$e}-${_e}`)}),e[34]=c,e[35]=B,e[36]=w,e[37]=h,e[38]=f,e[39]=d,e[40]=A,e[41]=q,e[42]=Z,e[43]=oe,e[44]=S,e[45]=z,e[46]=P,e[47]=U}else A=e[40],q=e[41],Z=e[42],oe=e[43],S=e[44],z=e[45],P=e[46],U=e[47];let se;e[54]!==q||e[55]!==Z||e[56]!==oe?(se=n.jsx("nav",{"aria-label":q,className:Z,children:oe}),e[54]=q,e[55]=Z,e[56]=oe,e[57]=se):se=e[57];let H;e[58]===Symbol.for("react.memo_cache_sentinel")?(H=()=>K(!0),e[58]=H):H=e[58];let ie;e[59]!==f?(ie=f("sandbox.availableSectionEditor.saveAsGlobalSection"),e[59]=f,e[60]=ie):ie=e[60];let ye;e[61]===Symbol.for("react.memo_cache_sentinel")?(ye=n.jsx(Jo,{size:14}),e[61]=ye):ye=e[61];let pe;e[62]!==m||e[63]!==ie?(pe=n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{size:"icon",className:"size-8 shrink-0",disabled:m,onClick:H,"aria-label":ie,children:ye})}),e[62]=m,e[63]=ie,e[64]=pe):pe=e[64];let ke;e[65]!==f?(ke=f("sandbox.availableSectionEditor.saveAsGlobalSection"),e[65]=f,e[66]=ke):ke=e[66];let he;e[67]!==ke?(he=n.jsx(Qe,{side:"bottom",children:ke}),e[67]=ke,e[68]=he):he=e[68];let je;e[69]!==pe||e[70]!==he?(je=n.jsxs(Xe,{children:[pe,he]}),e[69]=pe,e[70]=he,e[71]=je):je=e[71],e[72]!==S||e[73]!==se||e[74]!==je?(W=n.jsxs("div",{className:S,children:[se,je]}),e[72]=S,e[73]=se,e[74]=je,e[75]=W):W=e[75],R="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",V=f("sandbox.availableSectionEditor.localEditsHint",{typeLabel:te}),e[5]=v,e[6]=a,e[7]=c,e[8]=B,e[9]=w,e[10]=m,e[11]=h,e[12]=s,e[13]=l,e[14]=r,e[15]=f,e[16]=x?.taskId,e[17]=d,e[18]=o,e[19]=A,e[20]=I,e[21]=R,e[22]=V,e[23]=z,e[24]=W,e[25]=P,e[26]=U}else A=e[19],I=e[20],R=e[21],V=e[22],z=e[23],W=e[24],P=e[25],U=e[26];let Y;e[76]!==R||e[77]!==V?(Y=n.jsx("p",{className:R,children:V}),e[76]=R,e[77]=V,e[78]=Y):Y=e[78];let J;e[79]!==Y||e[80]!==z||e[81]!==W?(J=n.jsxs("div",{className:z,children:[W,Y]}),e[79]=Y,e[80]=z,e[81]=W,e[82]=J):J=e[82];let X;e[83]!==c||e[84]!==B||e[85]!==_||e[86]!==w||e[87]!==i||e[88]!==u||e[89]!==I||e[90]!==D||e[91]!==f?(X=n.jsx(Xt,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:D?n.jsx(Fn,{schema:D,value:w,onChange:te=>C(te),basePath:"",breadcrumbPath:B,onBreadcrumbChange:k,meta:i,decofile:c,onSaveReferencedBlock:u,sandbox:I},_):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sandbox.availableSectionEditor.noEditableFields")})})})}),e[83]=c,e[84]=B,e[85]=_,e[86]=w,e[87]=i,e[88]=u,e[89]=I,e[90]=D,e[91]=f,e[92]=X):X=e[92];let ce;e[93]!==J||e[94]!==X||e[95]!==P?(ce=n.jsxs("div",{className:P,children:[J,X]}),e[93]=J,e[94]=X,e[95]=P,e[96]=ce):ce=e[96];let ne;e[97]!==p||e[98]!==A||e[99]!==m||e[100]!==L?(ne=n.jsx(ga,{open:L,onOpenChange:K,defaultBlockId:p,isPending:m,onSubmit:A}),e[97]=p,e[98]=A,e[99]=m,e[100]=L,e[101]=ne):ne=e[101];let de;return e[102]!==ce||e[103]!==ne||e[104]!==U?(de=n.jsxs("div",{className:U,children:[ce,ne]}),e[102]=ce,e[103]=ne,e[104]=U,e[105]=de):de=e[105],de}function Jr(t){return t+1}function qr(t,e){const s={__resolveType:t},o=ya([s],e)[0];return o?va(s,o,e):null}function Wr({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:a,decofile:l,blockKey:i,onSaveReferencedBlock:c}){const r=Ne(),d=Dt(),p=d?.virtualMcpId,h=Hn(p===e?e:null)?.metadata?.siteSlug??null,[u]=$.useState(()=>qr(i,l)),[f,x]=$.useState(u?.data??{}),[g,y]=$.useState([]),[v,j]=$.useState(0),[w,C]=$.useState(!1),[E,B]=$.useState(null),k=E!==null,{save:_,flush:O}=xa({orgSlug:t,virtualMcpId:e,branch:s}),L=u?.resolveType?ws(u.resolveType,a):null,K=l[i],F=K?La(i,K):i,D=d?.taskId??null,A={orgSlug:t,virtualMcpId:e,branch:s,threadId:D,previewUrl:o??void 0,siteSlug:h},I=P=>{x(P),_(i,P)},R=()=>{k?(B(null),C(!1),j(P=>P+1)):B(JSON.stringify(f,null,2))},V=P=>{const U=P??"";try{const Y=JSON.parse(U);if(Y&&typeof Y=="object"&&!Array.isArray(Y)){C(!1),I(Y);return}C(!0)}catch{C(!0)}},z=[F,...g],W=P=>{y(g.slice(0,P)),j(U=>U+1)};return n.jsx("div",{className:"flex h-full w-full min-w-0",children:n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsx(ba,{crumbs:z,onSelect:W}),n.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[n.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Cs},"aria-hidden":!0}),n.jsx("div",{className:"flex-1"}),n.jsxs(Xe,{children:[n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:R,"aria-label":r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?n.jsx(Ts,{size:14}):n.jsx(Tn,{size:14})})}),n.jsx(Qe,{side:"bottom",children:r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),n.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:r("sandbox.savedSectionEditor.globalSectionDescription")})]}),n.jsxs("div",{className:"relative min-h-0 flex-1",children:[n.jsx(Xt,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:L?n.jsx(Fn,{schema:L,value:f,onChange:P=>I(P),basePath:"",breadcrumbPath:g,onBreadcrumbChange:y,meta:a,decofile:l,onSaveReferencedBlock:c,sandbox:A},v):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.savedSectionEditor.noEditableFields")})})})}),E!==null&&n.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[w&&n.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:r("sandbox.savedSectionEditor.invalidJsonError")}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Un,{language:"json",height:"100%",code:E,onChange:V,onSave:P=>{V(P),O()}})})]})]})]})})}function Yr(t){const e=ae.c(36),{selection:s,orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,isCreating:d,onCreateAvailable:p,onSaveReferencedBlock:m}=t,h=Ne();if(!s){let x;e[0]!==h?(x=h("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=h,e[1]=x):x=e[1];let g;e[2]!==h?(g=h("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=h,e[3]=g):g=e[3];let y;return e[4]!==x||e[5]!==g?(y=n.jsx(st,{title:x,description:g}),e[4]=x,e[5]=g,e[6]=y):y=e[6],y}if(s.collection==="available-section"){const x=`available:${s.resolveType}`,g=s.resolveType,y=s.title;let v;e[7]!==s.title?(v=ja(s.title),e[7]=s.title,e[8]=v):v=e[8];let j;e[9]!==p||e[10]!==s.resolveType?(j=(C,E)=>p(s.resolveType,C,E),e[9]=p,e[10]=s.resolveType,e[11]=j):j=e[11];let w;return e[12]!==l||e[13]!==r||e[14]!==d||e[15]!==c||e[16]!==m||e[17]!==o||e[18]!==i||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==x||e[22]!==v||e[23]!==j||e[24]!==a?(w=n.jsx(Hr,{orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,resolveType:g,title:y,defaultBlockId:v,isCreating:d,onCreate:j,onSaveReferencedBlock:m},x),e[12]=l,e[13]=r,e[14]=d,e[15]=c,e[16]=m,e[17]=o,e[18]=i,e[19]=s.resolveType,e[20]=s.title,e[21]=x,e[22]=v,e[23]=j,e[24]=a,e[25]=w):w=e[25],w}const u=`saved:${s.key}`;let f;return e[26]!==l||e[27]!==r||e[28]!==c||e[29]!==m||e[30]!==o||e[31]!==i||e[32]!==s.key||e[33]!==u||e[34]!==a?(f=n.jsx(Wr,{orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,blockKey:s.key,onSaveReferencedBlock:m},u),e[26]=l,e[27]=r,e[28]=c,e[29]=m,e[30]=o,e[31]=i,e[32]=s.key,e[33]=u,e[34]=a,e[35]=f):f=e[35],f}function Ot(t){const e=ae.c(34),{onDuplicate:s,onRename:o,onAddVariant:a,onEditSeo:l,onViewJson:i,onDelete:c}=t,r=Ne();let d;e[0]!==r?(d=r("sandbox.itemActions.moreActions"),e[0]=r,e[1]=d):d=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Do,{size:14}),e[2]=p):p=e[2];let m;e[3]!==d?(m=n.jsx(Ft,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Qr,children:p})}),e[3]=d,e[4]=m):m=e[4];let h;e[5]!==o||e[6]!==r?(h=o&&n.jsxs(We,{onClick:o,children:[n.jsx(il,{size:14}),r("sandbox.itemActions.rename")]}),e[5]=o,e[6]=r,e[7]=h):h=e[7];let u;e[8]!==s||e[9]!==r?(u=s&&n.jsxs(We,{onClick:s,children:[n.jsx(ll,{size:14}),r("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=r,e[10]=u):u=e[10];let f;e[11]!==a||e[12]!==r?(f=a&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{}),n.jsxs(We,{onClick:a,className:"cursor-pointer text-success focus:text-success",children:[n.jsx(Pn,{size:14}),r("sandbox.itemActions.addVariant")]})]}),e[11]=a,e[12]=r,e[13]=f):f=e[13];let x;e[14]!==l||e[15]!==i||e[16]!==r?(x=(l||i)&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{}),l&&n.jsxs(We,{onClick:l,children:[n.jsx(Nn,{size:14}),r("sandbox.itemActions.editSeo")]}),i&&n.jsxs(We,{onClick:i,children:[n.jsx(Tn,{size:14}),r("sandbox.itemActions.viewJson")]})]}),e[14]=l,e[15]=i,e[16]=r,e[17]=x):x=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(ds,{}),e[18]=g):g=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ps,{size:14}),e[19]=y):y=e[19];let v;e[20]!==r?(v=r("sandbox.itemActions.delete"),e[20]=r,e[21]=v):v=e[21];let j;e[22]!==c||e[23]!==v?(j=n.jsxs(We,{onClick:c,className:"text-destructive focus:text-destructive",children:[y,v]}),e[22]=c,e[23]=v,e[24]=j):j=e[24];let w;e[25]!==j||e[26]!==h||e[27]!==u||e[28]!==f||e[29]!==x?(w=n.jsxs(Kt,{align:"end",className:"w-44",children:[h,u,f,x,g,j]}),e[25]=j,e[26]=h,e[27]=u,e[28]=f,e[29]=x,e[30]=w):w=e[30];let C;return e[31]!==w||e[32]!==m?(C=n.jsxs(zt,{children:[m,w]}),e[31]=w,e[32]=m,e[33]=C):C=e[33],C}function Qr(t){return t.stopPropagation()}function Xr(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Zr(t){const e=new Map;for(const s of t){const o=Xr(s.resolveType),a=e.get(o);a?a.push(s):e.set(o,[s])}return[...e.entries()].map(([s,o])=>({label:s,sections:o})).sort((s,o)=>s.label.localeCompare(o.label))}function xn(t){const e=ae.c(8),{icon:s,label:o,className:a}=t;let l;e[0]!==a?(l=xe("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",a),e[0]=a,e[1]=l):l=e[1];let i;e[2]!==s?(i=n.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=i):i=e[3];let c;return e[4]!==o||e[5]!==l||e[6]!==i?(c=n.jsxs("div",{className:l,children:[i,o]}),e[4]=o,e[5]=l,e[6]=i,e[7]=c):c=e[7],c}const bn=$.lazy(()=>Je(()=>import("./app-editor-BH13ZfO_.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169])).then(t=>({default:t.AppEditor}))),ec=$.lazy(()=>Je(()=>import("./post-editor-CsDksmyM.js"),__vite__mapDeps([170,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,29,28,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,81,171,156,135,76,77,55,106,118,113,111,61,60,58,62,63,64,65,66,67,68,69,70,71,72,23,73,74,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,21,22,108,109,110,57,112,114,115,116,117,119,120,121,122,123,172,139,59,173,174,175,124,125,126,127,128,129,130,131,132,133,134,136,137,138,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,157,158,159,160,161,162,163,164,165,166,167,168,169])).then(t=>({default:t.PostEditor}))),tc=$.lazy(()=>Je(()=>import("./record-editor-DwoOuklP.js"),__vite__mapDeps([176,1,2,56,81,22,23,24,25,111,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,28,29,30,31,32,33,34,35,36,37,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,21,108,109,110,57,112,113,114,115,116,117,118,119,120,121,122,123,175,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169])).then(t=>({default:t.RecordEditor}))),sc=$.lazy(()=>Je(()=>import("./context-t3HzYqzN.js"),__vite__mapDeps([177,1,2,25,28,29,30,31,32,33,34,35,36,37,24,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,81,111,106,18,178,102,96,55,103,98,70,71,4,5,6,7,8,9,72,23,139,173,112,69,74,76,77,179,143,140,61,60,11,12,13,14,15,3,10,16,17,19,20,58,62,63,64,65,66,67,68,73,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97,99,100,101,104,105,107,21,22,108,109,110,57,113,114,115,116,117,118,119,120,121,122,123,167,175,176,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,141,142,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,168,169,180,172,59,174])).then(t=>({default:t.BlogContext}))),nc=$.lazy(()=>Je(()=>import("./category-editor-fWmRfYwN.js"),__vite__mapDeps([180,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,33,35,45,28,29,30,31,32,34,36,37,24,25,27,38,39,40,41,42,43,44,46,47,48,49,50,51,52,53,54,115,56,81,172,112,76,77,55,106,61,60,58,62,63,64,65,66,67,68,69,70,71,72,23,73,74,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,21,22,108,109,110,111,57,113,114,116,117,118,119,120,121,122,123,139,59,173,174,175,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169])).then(t=>({default:t.CategoryEditor}))),oc=$.lazy(()=>Je(()=>import("./sections-editor-BSMpRRaP.js"),__vite__mapDeps([181,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,57,61,60,58,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,23,73,74,75,76,77,78,79,80,56,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,21,22,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,167,182,26,59,183])).then(t=>({default:t.SectionsEditor}))),ac=$.lazy(()=>Je(()=>import("./seo-editor-BLMg-jAb.js"),__vite__mapDeps([184,1,2,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,21,22,23,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,56,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,57,112,113,114,115,116,117,118,119,120,121,122,123,182])).then(t=>({default:t.SeoEditor}))),lc=$.lazy(()=>Je(()=>import("./variant-calendar-sxqpD_Oi.js"),__vite__mapDeps([185,1,2,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,81,21,22,23,113,72,186,124,125,126,5,4,6,7,8,9,11,12,13,14,15,100,127,94,98,128,3,10,16,17,18,19,20,96,55,129,87,71,101,102,103,56,70,130,73,74,75,76,77,78,79,80,82,83,84,85,86,88,89,90,91,131,60,68,67,69,64,65,118,132,122,97,133,134,135,136,106,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,111,152,153,154,155,156,157,158,159,63,66,92,93,95,99,104,105,160,116,62,161,162,163,121,119,164,165,166,115,61,58,107,108,109,110,57,112,114,117,120,123,167,168,169])).then(t=>({default:t.VariantCalendar}))),ic=$.lazy(()=>Je(()=>import("./post-calendar-B-WdFfky.js"),__vite__mapDeps([187,1,2,29,28,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,188,21,22,23,124,125,126,5,4,6,7,8,9,11,12,13,14,15,100,127,94,98,128,3,10,16,17,18,19,20,96,72,55,129,87,71,101,102,103,81,56,70,130,73,74,75,76,77,78,79,80,82,83,84,85,86,88,89,90,91,131,60,68,67,69,64,65,118,132,122,97,133,134,135,136,106,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,111,152,153,154,155,156,157,158,159,63,66,92,93,95,99,104,105,160,116,62,161,162,163,121,119,164,165,166,115,61,58,107,108,109,110,57,112,113,114,117,120,123,167,168,169])).then(t=>({default:t.PostCalendar}))),rc=$.lazy(()=>Je(()=>import("./redirect-editor-BROySec3.js"),__vite__mapDeps([189,1,2,135,24,56,81,22,23,25,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,28,29,30,31,32,33,34,35,36,37,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,21,108,109,110,111,57,112,113,114,115,116,117,118,119,120,121,122,123,175])).then(t=>({default:t.RedirectEditor})));function cc(t){const e=ae.c(20),{deepLinkPage:s}=t,{currentBranch:o,virtualMcpId:a}=kn(),{org:l}=_o(),i=Ja(),c=qa(),{runtime:r,previewServerUrl:d}=Gn(a),p=r==="cms";let m;e[0]!==p||e[1]!==c.previewState||e[2]!==i.lifecycle.phase?(m=Tl({fastPreviewActive:p,previewState:c.previewState,lifecyclePhase:i.lifecycle.phase}),e[0]=p,e[1]=c.previewState,e[2]=i.lifecycle.phase,e[3]=m):m=e[3];const h=m;if(h.kind==="sandbox-card"){const x=`/${l.slug}/settings/connections`;let g;return e[4]!==h.state||e[5]!==c.start||e[6]!==x||e[7]!==i.lifecycle||e[8]!==i.phase?(g=n.jsx(Cl,{state:h.state,claimPhase:i.phase,lifecycle:i.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=h.state,e[5]=c.start,e[6]=x,e[7]=i.lifecycle,e[8]=i.phase,e[9]=g):g=e[9],g}if(!a||!o){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(st,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const u=p?d:c.previewUrl;let f;return e[11]!==o||e[12]!==s||e[13]!==h.devServerReady||e[14]!==h.sandboxWarming||e[15]!==c.previewUrl||e[16]!==l.slug||e[17]!==u||e[18]!==a?(f=n.jsx(uc,{orgSlug:l.slug,virtualMcpId:a,branch:o,previewUrl:c.previewUrl,sitePreviewUrl:u,deepLinkPage:s,devServerReady:h.devServerReady,sandboxWarming:h.sandboxWarming}),e[11]=o,e[12]=s,e[13]=h.devServerReady,e[14]=h.sandboxWarming,e[15]=c.previewUrl,e[16]=l.slug,e[17]=u,e[18]=a,e[19]=f):f=e[19],f}const yn=2e3,dc=15;function vn(t,e,s,o){return typeof e!="string"||s&&(Jn(e,s,o)||t.state.dataUpdateCount>=dc)?!1:yn}function uc({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,sitePreviewUrl:a,deepLinkPage:l,devServerReady:i,sandboxWarming:c}){const r=Ne(),d=Dt()?.taskId??null,p={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:o},{data:m,isLoading:h}=ka(p,{fetchEnabled:i}),u=jn({strict:!1}),[f,x]=$.useState(()=>u.contentCollection&&lt(u.contentCollection)&&u.contentCollection||"pages"),[g,y]=$.useState(()=>u.contentItem&&lt(f)?{collection:f,key:u.contentItem}:null),[v,j]=$.useState(null),w=!!(l?.pageId||l?.path||l?.pathTemplate),[C,E]=$.useState(!1);if(w&&!C&&g===null&&m){E(!0);const b=Oa(Vs(m),l??{});b&&(x("pages"),y({collection:"pages",key:b.key,path:b.path}))}const[B,k]=$.useState(""),[_,O]=$.useState("board"),L=b=>{y(b),j(null)},[K,F]=$.useState(f);K!==f&&(F(f),k(""));const{data:D,isLoading:A,isFetching:I}=Sa(p,{fetchEnabled:i,refetchInterval:b=>{const G=b.state.data;if(f==="apps"&&g&&g.collection==="apps"){const ue=m?.[g.key];return vn(b,typeof ue?.__resolveType=="string"?ue.__resolveType:void 0,G)}if(f==="site"&&m){const ue=G?Gs(m,G):null,fe=m.site,De=ue?.resolveType??(typeof fe?.__resolveType=="string"?fe.__resolveType:void 0);return vn(b,De,G,["seo"])}return!1}}),R=(b,G)=>!Jn(b,D,G)&&(A||I),{catalog:V,isLoading:z}=kl(D??void 0,m??void 0,{enabled:f==="apps"}),W=Ki({orgSlug:t,virtualMcpId:e,branch:s,meta:D}),P=Zt(p),U=Mn(p),Y=Vi({orgSlug:t,virtualMcpId:e,branch:s,decofile:m??{},support:W,onMoved:(b,G)=>y(ue=>ue?.collection==="posts"&&ue.key===b?{collection:"posts",key:G}:ue)}),[J,X]=$.useState(null),[ce,ne]=$.useState(),[de,te]=$.useState(!1),[re,le]=$.useState(),[N,q]=$.useState(null),[Z,oe]=$.useState(null),[S,se]=$.useState(null),H=!m||!D;if(h||A||H&&c)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(rt,{className:"size-5 text-muted-foreground"})});if(H)return n.jsx(st,{title:"Could not load site data."});const ie=Vs(m).sort((b,G)=>b.name.localeCompare(G.name)),ye=Ia(m).sort((b,G)=>b.from.localeCompare(G.from)),pe=Ra(m,D),ke=f==="sections"?Fa(D):[],he=Gs(m,D),je=Xn(m),Se=Bs.some(b=>je[b].length>0),Ae=lt(f)?je[f]:[],Ce=zs(D,"loaders"),Pe=zs(D,"actions");if(!Ka(m,D)&&!Se&&Ce===0&&Pe===0)return n.jsx(st,{icon:Qt,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const _e={pages:ie.length,sections:pe.length,apps:V.length,loaders:Ce,actions:Pe,redirects:ye.length,posts:je.posts.length,authors:je.authors.length,categories:je.categories.length},ge=new Set(ie.map(b=>It(b.path))),$e=new Set(ie.map(b=>b.name)),Le=new Set(pe.map(b=>b.name)),M=async b=>{const G=m[b.key];if(!G)return;const ue=Kn(m,b.key),fe=wa(m,b.key,Math.max(0,ue-1)),De=Na(G.sections,fe);if(De)try{await P.mutateAsync({blockKey:b.key,data:{...G,sections:De}}),me.success(`Variant added to "${b.name}"`),y({collection:"pages",key:b.key,path:b.path})}catch(Ie){me.error(Ie instanceof Error?Ie.message:"Could not add variant")}},ve=()=>{ne(void 0),X({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},we=b=>{ne(void 0),X({mode:"duplicate",sourceKey:b.key,initialName:qs($e,b.name),initialPath:Bl(ge,b.path)})},Oe=b=>{ne(void 0),X({mode:"rename",sourceKey:b.key,initialName:b.name,initialPath:b.path})},os=async b=>{if(!J)return;const{mode:G,sourceKey:ue}=J;try{if(G==="create"){let fe;if(b.templateKey){const Ie=m[b.templateKey];if(!Ie)throw new Error("Selected template no longer exists.");fe={...Ie,name:b.name,path:b.path}}else fe=_l(b.name,b.path);const De=$l(m,b.name);await P.mutateAsync({blockKey:De,data:fe}),me.success(`Created "${b.name}"`),y({collection:"pages",key:De,path:b.path})}else if(G==="duplicate"&&ue){const fe=m[ue];if(!fe)throw new Error("Source page not found");const{key:De,data:Ie}=Dl({source:fe,pages:ie,newName:b.name,newPath:b.path});await P.mutateAsync({blockKey:De,data:Ie}),me.success(`Duplicated as "${b.name}"`),y({collection:"pages",key:De,path:b.path})}else if(G==="rename"&&ue){const fe=m[ue];if(!fe)throw new Error("Page not found");const De={...fe,name:b.name,path:b.path};await P.mutateAsync({blockKey:ue,data:De}),me.success("Page updated"),g?.collection==="pages"&&g.key===ue&&y({collection:"pages",key:ue,path:b.path})}X(null)}catch(fe){ne(fe instanceof Error?fe.message:"Save failed")}},as=({path:b})=>{if(!J)return null;const G=It(b);return(J.mode==="rename"?It(J.initialPath):null)!==G&&ge.has(G)?`A page with path "${b}" already exists.`:null},ls=async(b,G,ue)=>{await P.mutateAsync({blockKey:G,data:{...ue,name:G,__resolveType:b}}),me.success(r("sandbox.contentBrowser.createdSection",{name:G})),y({collection:"sections",key:G})},At=Rn((b,G)=>P.mutate({blockKey:b,data:G})),is=async b=>{const G=m[b.key];if(!G){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}const ue=El(m,b.key),fe=qs(Le,b.name),De={...G,name:fe};try{await P.mutateAsync({blockKey:ue,data:De}),me.success(r("sandbox.contentBrowser.duplicatedSection",{name:b.name})),y({collection:"sections",key:ue})}catch(Ie){me.error(Ie instanceof Error?Ie.message:r("sandbox.contentBrowser.duplicateFailed"))}},rs=async b=>{if(!N)return;const G=m[N];if(!G){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}try{await P.mutateAsync({blockKey:N,data:{...G,name:b}}),me.success(r("sandbox.contentBrowser.sectionRenamed")),q(null)}catch(ue){me.error(ue instanceof Error?ue.message:r("sandbox.contentBrowser.renameFailed"))}},T=()=>{le(void 0),te(!0)},Q=async b=>{const G=za(m,b.from),ue=Ma(b);try{await P.mutateAsync({blockKey:G,data:ue}),me.success("Created redirect"),te(!1),y({collection:"redirects",key:G})}catch(fe){le(fe instanceof Error?fe.message:"Could not create redirect")}},Te=async b=>{const G=hs(m,b),ue=it(G,b,ao(b));try{await P.mutateAsync({blockKey:G,data:ue}),me.success(`Created ${Pt[b]}`),y({collection:b,key:G})}catch(fe){me.error(fe instanceof Error?fe.message:"Could not create")}},Ve=async b=>{const G=hs(m,"posts"),ue=it(G,"posts",wi(b));try{await P.mutateAsync({blockKey:G,data:ue}),me.success(r("sandbox.postCalendar.createdScheduledPost")),x("posts"),F("posts"),y({collection:"posts",key:G}),j(null)}catch(fe){me.error(fe instanceof Error?fe.message:r("sandbox.postCalendar.couldNotCreate"))}},qe=async(b,G)=>{const ue=m[b],fe=ue?Ci(mt(ue,"posts"),G):null;if(!fe){me.error(r("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await P.mutateAsync({blockKey:b,data:it(b,"posts",fe)})}catch(De){me.error(De instanceof Error?De.message:r("sandbox.postCalendar.couldNotReschedule"))}},Ee=async b=>{const G=m[b.key];if(!G){me.error("Record not found.");return}const ue=hs(m,b.kind),fe=b.kind==="posts"?"title":"name",De={...structuredClone(mt(G,b.kind)),[fe]:`${b.label} (copy)`};try{await P.mutateAsync({blockKey:ue,data:it(ue,b.kind,De)}),me.success(`Duplicated "${b.label}"`),y({collection:b.kind,key:ue})}catch(Ie){me.error(Ie instanceof Error?Ie.message:"Duplicate failed")}},yt=()=>{x("posts"),F("posts"),y(null),j(null),k("")},Ue=async()=>{if(Z)try{const{kind:b,key:G,label:ue}=Z;if(b==="blog"){if(Z.blogKind==="categories"){const fe=mt(m[G],"categories").slug,De=typeof fe=="string"?fe:"";if(De)for(const{key:Ie,payload:Os}of Ge(m,"posts")){const Is=ti(Os,De);Is!==Os&&await P.mutateAsync({blockKey:Ie,data:it(Ie,"posts",si(Is))})}}await U.mutateAsync({blockKey:G})}else await U.mutateAsync({blockKey:G});me.success(`Deleted "${ue}"`),g&&g.collection!=="available-section"&&g.key===G&&y(null),oe(null)}catch(b){me.error(b instanceof Error?b.message:"Delete failed")}},at=U.isPending||P.isPending,cs=Z?.kind==="blog"?Pt[Z.blogKind]:Z?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(wl,{active:f,counts:_e,showBlog:Se,onSelect:b=>{x(b),y(null),j(null)}}),f!=="seo"&&f!=="site"&&f!=="context"&&f!=="calendar"&&f!=="post-schedule"&&f!=="posts"&&f!=="loaders"&&f!=="actions"&&n.jsx(mc,{activeCollection:f,pages:ie,redirects:ye,sections:pe,availableSections:ke,appCatalog:V,appCatalogLoading:z,blogEntries:Ae,decofile:m,searchQuery:B,onSearchChange:k,selection:g,onSelect:L,onCreate:()=>{f==="pages"?ve():f==="redirects"?T():lt(f)&&Te(f)},onDuplicatePage:we,onRenamePage:Oe,onAddPageVariant:M,onDeletePage:b=>oe({kind:"page",key:b.key,label:b.name}),onEditPageSeo:b=>{const G={collection:"pages",key:b.key,path:b.path};y(G),j(b.key)},onViewPageJson:b=>se(b.key),onDuplicateSection:is,onRenameSection:b=>q(b.key),onDeleteSection:b=>oe({kind:"section",key:b.key,label:b.name}),onDeleteRedirect:b=>oe({kind:"redirect",key:b.key,label:b.from||b.key}),onDuplicateBlog:Ee,onDeleteBlog:b=>oe({kind:"blog",blogKind:b.kind,key:b.key,label:b.label})}),n.jsx("div",{className:"flex-1 min-w-0",children:f==="loaders"||f==="actions"?n.jsx(Or,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:D,decofile:m,kind:f}):n.jsx($.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(rt,{className:"size-5 text-muted-foreground"})}),children:f==="calendar"?n.jsx(lc,{decofile:m}):f==="post-schedule"?n.jsx(ic,{decofile:m,support:W,isCreating:P.isPending,onCreate:b=>{Ve(b)},onReschedule:(b,G)=>{qe(b,G)},onSelect:b=>{x("posts"),F("posts"),y({collection:"posts",key:b}),j(null)}}):f==="site"?he?n.jsx(bn,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:he.key,block:m[he.key],decofile:m,meta:D,title:"Site",excludeFields:["seo"],schemaPending:R(he.resolveType,["seo"]),previewBaseUrl:o},`site:${he.key}`):n.jsx(st,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):f==="context"?n.jsx(ul,{title:r("sandbox.blogContext.soonTitle"),description:r("sandbox.blogContext.soonDescription"),children:n.jsx(sc,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,meta:D,onOpenPost:b=>{x("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},onManageCategoryPosts:()=>{x("posts"),F("posts"),y(null),j(null)}})}):f==="seo"?n.jsx(ac,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,meta:D,target:{kind:"site"},previewBaseUrl:a}):f==="sections"?n.jsx(Yr,{selection:g?.collection==="sections"||g?.collection==="available-section"?g:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:D,decofile:m,isCreating:P.isPending,onCreateAvailable:ls,onSaveReferencedBlock:At}):f==="posts"?n.jsx(Cr,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,view:_,selectedKey:g?.collection==="posts"?g.key:null,onViewChange:b=>{O(b),y(null)},onClose:()=>y(null),onOpen:b=>{y({collection:"posts",key:b}),j(null)},move:Y,support:W,meta:D,renderDetail:(b,G)=>n.jsx(ec,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:b,block:m[b],decofile:m,meta:D,previewBaseUrl:a,move:Y,onClose:G?.onClose,expanded:G?.expanded,onToggleExpand:G?.onToggleExpand},`post:${Tt(b)}`)}):g&&g.collection!=="available-section"?g.collection==="apps"?n.jsx(bn,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:m[g.key],decofile:m,meta:D,previewBaseUrl:o,schemaPending:R(typeof m[g.key]?.__resolveType=="string"?String(m[g.key].__resolveType):void 0)},`app:${g.key}`):g.collection==="categories"?n.jsx(nc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:m[g.key],decofile:m,meta:D,onManagePosts:()=>yt(),onOpenPost:b=>{x("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},previewBaseUrl:a},`category:${g.key}`):g.collection==="authors"?n.jsx(tc,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:g.key,block:m[g.key]},`authors:${g.key}`):g.collection==="redirects"?n.jsx(rc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:g.key,block:m[g.key]},`redirect:${g.key}`):n.jsx(oc,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:o??void 0,currentPath:g.collection==="pages"?g.path:"/",activePageBlockKey:g.collection==="pages"?g.key:null,activeGlobalBlockKey:g.collection==="sections"?g.key:null,initialEditSeo:g.collection==="pages"&&v===g.key,onExitSeo:()=>j(null),onSelectRoot:()=>{y(null),j(null)}},g.collection==="pages"?`page:${g.key}`:`section:${g.key}`):n.jsx(st,{title:`Select ${lt(f)?`a ${Pt[f]}`:f==="pages"?"a page":f==="apps"?"an app":f==="redirects"?"a redirect":"a section"} to edit`,description:f==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),J&&n.jsx(Rl,{open:!!J,mode:J.mode,initialName:J.initialName,initialPath:J.initialPath,isPending:P.isPending,error:ce,templates:ie,validate:as,onSubmit:os,onOpenChange:b=>{b||(X(null),ne(void 0))}}),n.jsx(Kl,{open:de,isPending:P.isPending,error:re,onSubmit:Q,onOpenChange:b=>{b||(te(!1),le(void 0))}}),N&&n.jsx(zl,{open:!!N,blockKey:N,initialName:pe.find(b=>b.key===N)?.name??N,isPending:P.isPending,onSubmit:rs,onOpenChange:b=>{b||q(null)}}),S&&n.jsx(Va,{open:!!S,onOpenChange:b=>{b||se(null)},pageKey:S,decofile:m,onSave:b=>P.mutateAsync({blockKey:S,data:b})}),n.jsx(Wo,{open:!!Z,onOpenChange:b=>{!b&&!at&&oe(null)},children:n.jsxs(Yo,{children:[n.jsxs(Qo,{children:[n.jsx(Xo,{children:`Delete ${cs}?`}),n.jsx(Zo,{children:Z?.kind==="section"?`"${Z.label}" will be removed. Pages that still reference it will lose this section.`:Z?`"${Z.label}" will be removed permanently. This can't be undone.`:null})]}),n.jsxs(ea,{children:[n.jsx(ta,{disabled:at,children:"Cancel"}),n.jsx(sa,{onClick:b=>{b.preventDefault(),Ue()},disabled:at,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:at?n.jsxs(n.Fragment,{children:[n.jsx(rt,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function mc(t){const e=ae.c(57),{activeCollection:s,pages:o,redirects:a,sections:l,availableSections:i,appCatalog:c,appCatalogLoading:r,blogEntries:d,decofile:p,searchQuery:m,onSearchChange:h,selection:u,onSelect:f,onCreate:x,onDuplicatePage:g,onRenamePage:y,onAddPageVariant:v,onDeletePage:j,onEditPageSeo:w,onViewPageJson:C,onDuplicateSection:E,onRenameSection:B,onDeleteSection:k,onDeleteRedirect:_,onDuplicateBlog:O,onDeleteBlog:L}=t;let K,F,D,A,I,R;if(e[0]!==s||e[1]!==c||e[2]!==r||e[3]!==i||e[4]!==d||e[5]!==p||e[6]!==v||e[7]!==x||e[8]!==L||e[9]!==j||e[10]!==_||e[11]!==k||e[12]!==O||e[13]!==g||e[14]!==E||e[15]!==w||e[16]!==y||e[17]!==B||e[18]!==h||e[19]!==f||e[20]!==C||e[21]!==o||e[22]!==a||e[23]!==m||e[24]!==l||e[25]!==u){const P=m.toLowerCase(),U=o.filter(S=>!P||S.name.toLowerCase().includes(P)||S.path.toLowerCase().includes(P)),Y=a.filter(S=>!P||S.from.toLowerCase().includes(P)||S.to.toLowerCase().includes(P)),J=l.filter(S=>!P||S.name.toLowerCase().includes(P)||S.key.toLowerCase().includes(P)||S.resolveType.toLowerCase().includes(P)),X=i.filter(S=>!P||S.title.toLowerCase().includes(P)||S.resolveType.toLowerCase().includes(P)||(S.description?.toLowerCase().includes(P)??!1)),ce=Zr(J),ne=c.filter(S=>!P||S.title.toLowerCase().includes(P)||S.app.toLowerCase().includes(P)||S.vendor.toLowerCase().includes(P)||S.category.toLowerCase().includes(P)),de=d.filter(S=>!P||S.label.toLowerCase().includes(P)||S.subtitle.toLowerCase().includes(P)),te=`Search ${s}…`,re=lt(s)?`Create new ${Pt[s]}`:s==="redirects"?"Create new redirect":"Create new page",le=s!=="apps"&&s!=="sections";I="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let N;e[32]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(En,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[32]=N):N=e[32];let q;e[33]!==h?(q=S=>h(S.target.value),e[33]=h,e[34]=q):q=e[34];let Z;e[35]!==te||e[36]!==m||e[37]!==q?(Z=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[N,n.jsx("input",{type:"text",value:m,onChange:q,placeholder:te,"aria-label":te,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[35]=te,e[36]=m,e[37]=q,e[38]=Z):Z=e[38];let oe;e[39]!==re||e[40]!==x||e[41]!==le?(oe=le&&n.jsxs(Xe,{children:[n.jsx(Ye,{asChild:!0,children:n.jsx(Be,{variant:"ghost",size:"icon",onClick:x,"aria-label":re,children:n.jsx(Ss,{size:14})})}),n.jsx(Qe,{side:"bottom",children:re})]}),e[39]=re,e[40]=x,e[41]=le,e[42]=oe):oe=e[42],e[43]!==Z||e[44]!==oe?(R=n.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Z,oe]}),e[43]=Z,e[44]=oe,e[45]=R):R=e[45],K=Xt,A="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",F="flex flex-col gap-1 p-1.5",D=s==="pages"?U.length===0?n.jsx(jt,{hasItems:o.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):U.map(S=>{const se=u?.collection==="pages"&&u.key===S.key,H=Kn(p,S.key);return n.jsx(He,{icon:Bn,title:S.name,subtitle:S.path,active:se,variantCount:H,onClick:()=>f({collection:"pages",key:S.key,path:S.path}),menu:n.jsx(Ot,{onDuplicate:()=>g(S),onRename:()=>y(S),onAddVariant:()=>v(S),onEditSeo:()=>w(S),onViewJson:()=>C(S),onDelete:()=>j(S)})},S.key)}):s==="sections"?J.length===0&&X.length===0?n.jsx(jt,{hasItems:l.length>0||i.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):n.jsxs(n.Fragment,{children:[ce.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(xn,{icon:Mt,label:"Saved sections"}),ce.map(S=>n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:S.label}),S.sections.map(se=>{const H=u?.collection==="sections"&&u.key===se.key;return n.jsx(He,{icon:Mt,accent:"global",title:se.name,subtitle:S.label,active:H,onClick:()=>f({collection:"sections",key:se.key}),menu:n.jsx(Ot,{onDuplicate:()=>E(se),onRename:()=>B(se),onDelete:()=>k(se)})},se.key)})]},S.label))]}),X.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(xn,{icon:Ks,label:"Available sections",className:xe(ce.length>0&&"mt-3")}),X.map(S=>{const se=u?.collection==="available-section"&&u.resolveType===S.resolveType,H=S.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return n.jsx(He,{icon:Ks,title:S.title,subtitle:H??S.resolveType,active:se,onClick:()=>f({collection:"available-section",resolveType:S.resolveType,title:S.title})},S.resolveType)})]})]}):s==="apps"?r?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(rt,{className:"size-4.5 text-muted-foreground"})}):ne.length===0?n.jsx(jt,{hasItems:c.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ne.map(S=>{const se=u?.collection==="apps"&&S.blockKey!==null&&u.key===S.blockKey;return n.jsx(He,{icon:An,logoUrl:S.logo,title:S.title,subtitle:S.category,active:se,trailing:S.installed?n.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!S.installed||!S.blockKey){me.message(`${S.title} is not installed on this site.`);return}f({collection:"apps",key:S.blockKey})}},S.id)}):s==="redirects"?Y.length===0?n.jsx(jt,{hasItems:a.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):Y.map(S=>n.jsx(He,{icon:Sn,title:S.from||"(no source)",subtitle:`→ ${S.to||"(no target)"}`,active:u?.collection==="redirects"&&u.key===S.key,trailing:n.jsx(Ml,{type:S.type}),onClick:()=>f({collection:"redirects",key:S.key}),menu:n.jsx(Ot,{onDelete:()=>_(S)})},S.key)):de.length===0?n.jsx(jt,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${lt(s)?Pt[s]:"item"}.`}):de.map(S=>{const se=u?.collection===S.kind&&u.key===S.key;return n.jsx(He,{icon:S.kind==="posts"?Dn:S.kind==="authors"?$n:wn,title:S.label,subtitle:S.subtitle,active:se,onClick:()=>f({collection:S.kind,key:S.key}),menu:n.jsx(Ot,{onDuplicate:()=>O(S),onDelete:()=>L(S)})},S.key)}),e[0]=s,e[1]=c,e[2]=r,e[3]=i,e[4]=d,e[5]=p,e[6]=v,e[7]=x,e[8]=L,e[9]=j,e[10]=_,e[11]=k,e[12]=O,e[13]=g,e[14]=E,e[15]=w,e[16]=y,e[17]=B,e[18]=h,e[19]=f,e[20]=C,e[21]=o,e[22]=a,e[23]=m,e[24]=l,e[25]=u,e[26]=K,e[27]=F,e[28]=D,e[29]=A,e[30]=I,e[31]=R}else K=e[26],F=e[27],D=e[28],A=e[29],I=e[30],R=e[31];let V;e[46]!==F||e[47]!==D?(V=n.jsx("div",{className:F,children:D}),e[46]=F,e[47]=D,e[48]=V):V=e[48];let z;e[49]!==K||e[50]!==A||e[51]!==V?(z=n.jsx(K,{className:A,children:V}),e[49]=K,e[50]=A,e[51]=V,e[52]=z):z=e[52];let W;return e[53]!==I||e[54]!==R||e[55]!==z?(W=n.jsxs("div",{className:I,children:[R,z]}),e[53]=I,e[54]=R,e[55]=z,e[56]=W):W=e[56],W}function fc(t){const e=ae.c(25),{virtualMcpId:s}=t,o=Ne(),[a,l]=$.useState(!1),i=al(s),{activeTask:c}=kn();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const d=jn(r);if(!(Hs(i?.metadata)||Hs(c?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:n.jsx(Js,{className:"size-7 text-foreground"})}),e[1]=h):h=e[1];let u;e[2]!==o?(u=o("mainPanelTabs.contentTab.noContentToEdit"),e[2]=o,e[3]=u):u=e[3];let f;e[4]!==o?(f=o("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=o,e[5]=f):f=e[5];let x,g;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=()=>l(!0),g=n.jsx(Js,{className:"size-4"}),e[6]=x,e[7]=g):(x=e[6],g=e[7]);let y;e[8]!==o?(y=o("mainPanelTabs.previewTab.connectGithub"),e[8]=o,e[9]=y):y=e[9];let v;e[10]!==y?(v=n.jsxs(Be,{onClick:x,children:[g,y]}),e[10]=y,e[11]=v):v=e[11];let j;e[12]!==u||e[13]!==f||e[14]!==v?(j=n.jsx(rl,{className:"h-full",image:h,title:u,description:f,actions:v}),e[12]=u,e[13]=f,e[14]=v,e[15]=j):j=e[15];let w;e[16]!==a?(w=n.jsx(cl,{open:a,onOpenChange:l,mode:"agent"}),e[16]=a,e[17]=w):w=e[17];let C;return e[18]!==w||e[19]!==j?(C=n.jsxs(n.Fragment,{children:[j,w]}),e[18]=w,e[19]=j,e[20]=C):C=e[20],C}let m;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(m=n.jsx(cc,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=m):m=e[24],m}function pc(){const t=ae.c(2),e=dl();let s;return t[0]!==e?(s=n.jsx(Ao,{tabId:"content",children:n.jsx($o,{feature:"cms",children:n.jsx(fc,{virtualMcpId:e})})}),t[0]=e,t[1]=s):s=t[1],s}const Dd=Object.freeze(Object.defineProperty({__proto__:null,default:pc},Symbol.toStringTag,{value:"Module"}));export{vo as $,Nd as A,_s as B,hd as C,fd as D,wd as E,Pd as F,Xn as G,uo as H,Gi as I,Zs as J,bi as K,md as L,hs as M,ao as N,dd as O,Ds as P,xd as Q,Cd as R,bd as S,Td as T,vd as U,pt as V,jd as W,yd as X,gd as Y,kd as Z,Jt as _,cd as a,Dd as a0,ns as b,si as c,Sd as d,rd as e,Ge as f,mt as g,Wt as h,Bd as i,ri as j,Ed as k,to as l,Es as m,El as n,lo as o,_t as p,it as q,fl as r,be as s,mo as t,Ki as u,Ke as v,hi as w,ud as x,pd as y,Me as z};