decocms 4.570.0 → 4.570.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/dist/client/assets/{AlertCircle-1CFQF9HU.js → AlertCircle-DSTgjQZE.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CUZD7bCb.js → AreaChart-BFiXRx9a.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-yZosAbEQ.js → ArrowLeft-ENfdZA7-.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-B_QEh9AM.js → ArrowUp-BNjQS3K-.js} +1 -1
  5. package/dist/client/assets/{CartesianChart-DOo-DPo8.js → CartesianChart-D6hSTdD_.js} +1 -1
  6. package/dist/client/assets/{CategoricalChart-KK8jWPWD.js → CategoricalChart-BvoSRMBa.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DjUjDOFk.js → CheckCircle-B5oyaJit.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-C2ySHatm.js → ChevronSelectorVertical-D9X2NrqX.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-aVrgoYI4.js → ChevronUp-CWpA2uR_.js} +1 -1
  10. package/dist/client/assets/{CreditCard01-CMrZYrMd.js → CreditCard01-DUDVRgSi.js} +1 -1
  11. package/dist/client/assets/{Globe04-Czvq6voU.js → Globe04-cXNn3Iwb.js} +1 -1
  12. package/dist/client/assets/{Key01-CJVeUDDi.js → Key01-DykOvg3J.js} +1 -1
  13. package/dist/client/assets/{LinkBroken01-Dhn_nIp2.js → LinkBroken01-DWhYckSm.js} +1 -1
  14. package/dist/client/assets/{Minus-qjFidgiH.js → Minus-DD8EF-Qg.js} +1 -1
  15. package/dist/client/assets/{Monitor01-BwW28bRE.js → Monitor01-Brx479PM.js} +1 -1
  16. package/dist/client/assets/{Play-DWKJ4lP6.js → Play-Cnv-o711.js} +1 -1
  17. package/dist/client/assets/{Plus-u00IxELx.js → Plus-Cyljarjx.js} +1 -1
  18. package/dist/client/assets/{ReferenceLine-DhlQLhxT.js → ReferenceLine-CU3NLmsp.js} +1 -1
  19. package/dist/client/assets/{SearchMd-DrxAIngK.js → SearchMd-B8lLWvFT.js} +1 -1
  20. package/dist/client/assets/{ShoppingBag01-BOpj8wnX.js → ShoppingBag01-CsD1bZL0.js} +1 -1
  21. package/dist/client/assets/{Sun-CUTKbSf6.js → Sun-qBi61vDS.js} +1 -1
  22. package/dist/client/assets/{SwitchHorizontal01-DedOEqGg.js → SwitchHorizontal01-omZLJ9y8.js} +1 -1
  23. package/dist/client/assets/{Tool01-BXFm5jK2.js → Tool01-U3lMqDqt.js} +1 -1
  24. package/dist/client/assets/{Tooltip-DhVaIgPv.js → Tooltip-DUfhZGnv.js} +1 -1
  25. package/dist/client/assets/{Trash01-t2BYg0st.js → Trash01-BbqimkDt.js} +1 -1
  26. package/dist/client/assets/{Upload01-BBUgsLLD.js → Upload01-CKgAWfXR.js} +1 -1
  27. package/dist/client/assets/{UserSquare-BloCTB27.js → UserSquare-BItoQb26.js} +1 -1
  28. package/dist/client/assets/{Users01-D0A6lP8t.js → Users01-C6CsMI-H.js} +1 -1
  29. package/dist/client/assets/{XClose-CUME_VK2.js → XClose-B0OqPlIT.js} +1 -1
  30. package/dist/client/assets/{Zap-CmNmFUbX.js → Zap-FLVG2fHK.js} +1 -1
  31. package/dist/client/assets/{access-gate-CbFfEOdM.js → access-gate-BjOW8RuZ.js} +1 -1
  32. package/dist/client/assets/{add-connection-dialog-Bk4KRwLm.js → add-connection-dialog-CUGt2QIL.js} +1 -1
  33. package/dist/client/assets/agent-app-D_QasKCt.js +1 -0
  34. package/dist/client/assets/{agent-assets-CvRDUZu-.js → agent-assets-CJlmAaWQ.js} +1 -1
  35. package/dist/client/assets/{agent-automation-CHtwx6sg.js → agent-automation-DlJDTqvr.js} +1 -1
  36. package/dist/client/assets/{agent-automations-BgmzkAtz.js → agent-automations-DNMHOegy.js} +1 -1
  37. package/dist/client/assets/{agent-calendar-BQ5xnVXW.js → agent-calendar-Z-NoCJJy.js} +1 -1
  38. package/dist/client/assets/{agent-capabilities-DmNIevq-.js → agent-capabilities-DOVKnykH.js} +1 -1
  39. package/dist/client/assets/{agent-connect-sources-DgRvrlpj.js → agent-connect-sources-DLaujtJt.js} +1 -1
  40. package/dist/client/assets/agent-deck-BHqHGfqC.js +1 -0
  41. package/dist/client/assets/{agent-e2e-CowJJC6D.js → agent-e2e-DhR3lPfF.js} +1 -1
  42. package/dist/client/assets/agent-experiments-CsbbrlzU.js +1 -0
  43. package/dist/client/assets/{agent-file-w7JCVN0l.js → agent-file-C-Y5K07p.js} +1 -1
  44. package/dist/client/assets/{agent-hosting-p1C0G82t.js → agent-hosting-BYTFH-Ly.js} +1 -1
  45. package/dist/client/assets/{agent-icon-AbOSM7KF.js → agent-icon-DKTp0XyY.js} +1 -1
  46. package/dist/client/assets/agent-library-BrbVgxGh.js +1 -0
  47. package/dist/client/assets/agent-library-file-38op_SYX.js +1 -0
  48. package/dist/client/assets/agent-overview-rJN7hxM8.js +1 -0
  49. package/dist/client/assets/{agent-releases-BWDO07Iy.js → agent-releases-DXsHCiTg.js} +1 -1
  50. package/dist/client/assets/agent-settings-OJszyqyL.js +1 -0
  51. package/dist/client/assets/{agent-site-editor-BubERiUy.js → agent-site-editor-CTCs3RDg.js} +1 -1
  52. package/dist/client/assets/agent-site-editor-code-Tm63iotr.js +2 -0
  53. package/dist/client/assets/agent-site-editor-content-DGdOpwTo.js +1 -0
  54. package/dist/client/assets/agent-site-editor-preview-UslQ1OuK.js +1 -0
  55. package/dist/client/assets/agent-view-D7OqtWKn.js +1 -0
  56. package/dist/client/assets/{agent-view-guard-w1_Juyu5.js → agent-view-guard-CuLYN5bV.js} +1 -1
  57. package/dist/client/assets/{ai-providers-DAY0nNTK.js → ai-providers-9vWHbCvl.js} +1 -1
  58. package/dist/client/assets/{alert-hJJytfOJ.js → alert-Bvpz2H4v.js} +1 -1
  59. package/dist/client/assets/{analytics-sections-BNJmu5jh.js → analytics-sections-TE-35yVi.js} +1 -1
  60. package/dist/client/assets/api-keys-BwvxdsTQ.js +1 -0
  61. package/dist/client/assets/{api-keys-DOETgk_S.js → api-keys-C-jExymv.js} +1 -1
  62. package/dist/client/assets/{app-editor-CN-Ok2RW.js → app-editor-DnFNwaE0.js} +1 -1
  63. package/dist/client/assets/{asset-utils-DhDLN_-h.js → asset-utils-C8aDDKpg.js} +1 -1
  64. package/dist/client/assets/{auth-D1oBKWc9.js → auth-I4p8-ocC.js} +1 -1
  65. package/dist/client/assets/{auth-catchall-CU9OueC2.js → auth-catchall-CwgMTdiF.js} +1 -1
  66. package/dist/client/assets/{auth-entry-BrGmprWz.js → auth-entry-DandZrkK.js} +1 -1
  67. package/dist/client/assets/{auth-split-layout-DdjSjW7w.js → auth-split-layout-Dg_DSwSr.js} +1 -1
  68. package/dist/client/assets/{authenticate-and-persist-oauth-DfXhL6KV.js → authenticate-and-persist-oauth-NcJzMudq.js} +1 -1
  69. package/dist/client/assets/{automation-list-row-D2RgfFAV.js → automation-list-row-BaDQ8nN-.js} +1 -1
  70. package/dist/client/assets/{automation-runs-_P-ch70z.js → automation-runs-BsUJbSCS.js} +1 -1
  71. package/dist/client/assets/{automations-DVc_UfEJ.js → automations-BnTFSnM5.js} +1 -1
  72. package/dist/client/assets/{autosend-xPyRMwmc.js → autosend-BWmOY3ov.js} +1 -1
  73. package/dist/client/assets/{badge-BLopTdJo.js → badge-DStDMa4b.js} +1 -1
  74. package/dist/client/assets/{block-document-DRcrQBeX.js → block-document-DIb-ND30.js} +1 -1
  75. package/dist/client/assets/{blocks-preview-workspace-context-D9X9QQD5.js → blocks-preview-workspace-context-C8dnQCV5.js} +1 -1
  76. package/dist/client/assets/{blocks-tab-states-DOYuC7hO.js → blocks-tab-states-C3vtkrE6.js} +1 -1
  77. package/dist/client/assets/{blog-schema-njjjFtQI.js → blog-schema-7Bvb7ybL.js} +1 -1
  78. package/dist/client/assets/{buckets-DHR--iFw.js → buckets-CzpSZY9W.js} +1 -1
  79. package/dist/client/assets/{build-improve-prompt-doc-DrCjUiSm.js → build-improve-prompt-doc-DSMfcdZz.js} +1 -1
  80. package/dist/client/assets/{calendar-8e1bW3QX.js → calendar-CWxLf6uz.js} +1 -1
  81. package/dist/client/assets/{capability-load-error-C9mmbd-g.js → capability-load-error-C-cOEkiu.js} +1 -1
  82. package/dist/client/assets/{category-editor-ngsbNhPd.js → category-editor-llVhx3m4.js} +1 -1
  83. package/dist/client/assets/{chart-PfmlhR6m.js → chart-aXx8MtyI.js} +1 -1
  84. package/dist/client/assets/{chat-context-BFpdF0Ea.js → chat-context-B8Z5vGcJ.js} +1 -1
  85. package/dist/client/assets/{chat-draft-B0ZUpMX_.js → chat-draft-DkEn0tls.js} +1 -1
  86. package/dist/client/assets/{checkbox-DDDKCgb5.js → checkbox-BprzbiMO.js} +1 -1
  87. package/dist/client/assets/{choose-editor-XtwrmhD8.js → choose-editor-SgZcLGEy.js} +1 -1
  88. package/dist/client/assets/{cli-auth-success-BnJsDVo5.js → cli-auth-success-DK2OLw1X.js} +1 -1
  89. package/dist/client/assets/{client-icons-Cw3Ivutw.js → client-icons-xxn_7LaS.js} +1 -1
  90. package/dist/client/assets/{cms-settings-editor-DY67ejEv.js → cms-settings-editor-BZi_-T0e.js} +1 -1
  91. package/dist/client/assets/{cms-store-drafts-CYIZoD9d.js → cms-store-drafts-SBEy3_cr.js} +1 -1
  92. package/dist/client/assets/{collapsible-C4GX1H_R.js → collapsible-DFsZxhwL.js} +1 -1
  93. package/dist/client/assets/{collection-detail-8Mxw24IU.js → collection-detail-CSrSzasC.js} +1 -1
  94. package/dist/client/assets/{collection-display-button-WZ9U6Dnn.js → collection-display-button-BxcAk_pb.js} +1 -1
  95. package/dist/client/assets/{collection-search-Dz7QHmOz.js → collection-search-Bhx5TJ6L.js} +1 -1
  96. package/dist/client/assets/{collection-table-wrapper-06TDQKrw.js → collection-table-wrapper-BoSXl9vr.js} +1 -1
  97. package/dist/client/assets/{collection-tabs-C-fKyh8w.js → collection-tabs-QO8RS8bh.js} +1 -1
  98. package/dist/client/assets/{combobox-DqPSOi3v.js → combobox-BmbiPO09.js} +1 -1
  99. package/dist/client/assets/{command-CYK5M8XI.js → command-uMdfud6o.js} +1 -1
  100. package/dist/client/assets/{companion-mcps-section-CAKFIeG-.js → companion-mcps-section-AvTxX0pL.js} +1 -1
  101. package/dist/client/assets/{config-DBXuSQO1.js → config-C9OaANUg.js} +1 -1
  102. package/dist/client/assets/{connect-NGxtU5_0.js → connect-C__OLdre.js} +1 -1
  103. package/dist/client/assets/{connect-layout-DBzvmer6.js → connect-layout-BGiLRWZe.js} +1 -1
  104. package/dist/client/assets/{connect-source-dialog-BnXxvvcJ.js → connect-source-dialog-a9uKmocf.js} +1 -1
  105. package/dist/client/assets/{connection-_PcrLws7.js → connection-DG7KBlix.js} +1 -1
  106. package/dist/client/assets/{connection-card-4gZcunZq.js → connection-card-qG0EXE1L.js} +1 -1
  107. package/dist/client/assets/{connection-detail-C0eX0pfz.js → connection-detail-CpfvCnzG.js} +1 -1
  108. package/dist/client/assets/{connection-form-helpers-C7Gv9-lg.js → connection-form-helpers-Ce5Bf_zZ.js} +1 -1
  109. package/dist/client/assets/{connection-slug-BsU2LQiu.js → connection-slug-BoBDHMu2.js} +1 -1
  110. package/dist/client/assets/{connections-BA8V7XrH.js → connections-d7gGzcVn.js} +1 -1
  111. package/dist/client/assets/{content-tab-C_nIeaie.js → content-tab-BCGl_up3.js} +3 -3
  112. package/dist/client/assets/{context-8d_KiSNS.js → context-BL8O-tTH.js} +1 -1
  113. package/dist/client/assets/{context-menu-o6rJLNXJ.js → context-menu-D_E7697D.js} +1 -1
  114. package/dist/client/assets/{context-shell-C1Ha8IE2.js → context-shell-DunJzbL-.js} +3 -3
  115. package/dist/client/assets/{core.esm-BGRTXfSt.js → core.esm-BKNJrrxU.js} +1 -1
  116. package/dist/client/assets/{create-organization-dialog-h3rzGSt9.js → create-organization-dialog-DJ9X5Xlz.js} +1 -1
  117. package/dist/client/assets/{device-hint-BOo4jdep.js → device-hint-Ce3veXZo.js} +1 -1
  118. package/dist/client/assets/{discover-BeGAehHo.js → discover-NcR5tz4J.js} +1 -1
  119. package/dist/client/assets/{domain-settings-Nhk3Nbp-.js → domain-settings-DimTUYUq.js} +1 -1
  120. package/dist/client/assets/{drawer-C1zPem_-.js → drawer-C6lamT3y.js} +1 -1
  121. package/dist/client/assets/{editor-BcXADR5b.js → editor-C7RxjaWr.js} +1 -1
  122. package/dist/client/assets/{editor-classes-BftbquCD.js → editor-classes-B55y9L5n.js} +1 -1
  123. package/dist/client/assets/{empty-state-BrKCVCOA.js → empty-state-Ci8hZXbK.js} +1 -1
  124. package/dist/client/assets/{empty-state-tlDzCEBe.js → empty-state-DM7xlu-4.js} +1 -1
  125. package/dist/client/assets/{experiments-tab-choice-Dnv5W_mO.js → experiments-tab-choice-ByO3wkbg.js} +1 -1
  126. package/dist/client/assets/{extract-connection-data-B4CAQLEm.js → extract-connection-data-C8qmylg2.js} +1 -1
  127. package/dist/client/assets/{feature-gate-DWILcK73.js → feature-gate-C6EPE__O.js} +1 -1
  128. package/dist/client/assets/{feature-paywall-BOdJ7pc_.js → feature-paywall-7RP1Qwpl.js} +1 -1
  129. package/dist/client/assets/{feedback--BP5XsMC.js → feedback-idlW6Rt2.js} +1 -1
  130. package/dist/client/assets/{file-explorer-BHgkTafl.js → file-explorer-LvtKoAWE.js} +1 -1
  131. package/dist/client/assets/{file-preview-B3c1V4-B.js → file-preview-Ds-vtVwj.js} +1 -1
  132. package/dist/client/assets/{file-share-button-BmfBQCy7.js → file-share-button-B6jqluQi.js} +1 -1
  133. package/dist/client/assets/{file-type-icon-C-QM854F.js → file-type-icon-C_NX_6K0.js} +1 -1
  134. package/dist/client/assets/{folder-icon-evgkGdeR.js → folder-icon-nyqn5Twi.js} +1 -1
  135. package/dist/client/assets/{form-D2GmFQW3.js → form-dOKUm1o9.js} +1 -1
  136. package/dist/client/assets/{general-B3MQGRB4.js → general-CmjqVXSD.js} +1 -1
  137. package/dist/client/assets/{github-icon-i7iUozqR.js → github-icon-D5i5T8iF.js} +1 -1
  138. package/dist/client/assets/{home-ZCo0svlJ.js → home-Bf_aEScW.js} +1 -1
  139. package/dist/client/assets/{home-overview-qYf3hL7N.js → home-overview-BaddYyk7.js} +1 -1
  140. package/dist/client/assets/{hosted-reconcile-CvdR91uj.js → hosted-reconcile-BdQaV1pW.js} +1 -1
  141. package/dist/client/assets/{icon-button-BUwzNv83.js → icon-button-CL44LV6o.js} +1 -1
  142. package/dist/client/assets/{index-CCTNTj2P.js → index-4w1PAhG_.js} +1 -1
  143. package/dist/client/assets/{index-cKSjr8CK.js → index-BWLOSW33.js} +1 -1
  144. package/dist/client/assets/{index-ukVGoFpO.js → index-BZRUARFj.js} +1 -1
  145. package/dist/client/assets/{index-DQBul4yU.js → index-BoutsVvy.js} +1 -1
  146. package/dist/client/assets/{index-CKnb1ufF.js → index-C0-jFhOF.js} +1 -1
  147. package/dist/client/assets/{index-BpRy7AHp.js → index-CSIpvoWn.js} +3 -3
  148. package/dist/client/assets/{index-DPD9OENi.js → index-CmbhAzcu.js} +1 -1
  149. package/dist/client/assets/{index-Dn1UQvhJ.js → index-Cojr6Fpq.js} +1 -1
  150. package/dist/client/assets/{index-C_UqErbC.js → index-Cu6-9y1I.js} +1 -1
  151. package/dist/client/assets/{index-OBb8rfAw.js → index-DADVzh-A.js} +1 -1
  152. package/dist/client/assets/{index-xj3IgJTF.js → index-DR80z_C4.js} +1 -1
  153. package/dist/client/assets/{index-D_UeTS1-.js → index-FggPcfHb.js} +1 -1
  154. package/dist/client/assets/{index-clkmgwR3.js → index-LOAUw-Ks.js} +1 -1
  155. package/dist/client/assets/{index-BfxdS8h-.js → index-Y545ko-X.js} +1 -1
  156. package/dist/client/assets/{index-ChAPkvx3.js → index-cBNiMokO.js} +1 -1
  157. package/dist/client/assets/{index-lbygo01z.js → index-e0iOUxAj.js} +1 -1
  158. package/dist/client/assets/{index-redirect-D-YiN8Xo.js → index-redirect-Bcv6Ftw-.js} +1 -1
  159. package/dist/client/assets/{infiniteQueryObserver-D03R0ede.js → infiniteQueryObserver-CgO-7OwI.js} +1 -1
  160. package/dist/client/assets/{infra-billing-s8EIFgUr.js → infra-billing-C63z5K_k.js} +1 -1
  161. package/dist/client/assets/{input-Cnq9i2l1.js → input-BX4MndAE.js} +1 -1
  162. package/dist/client/assets/{input-DfTSMalp.js → input-DPkRheY2.js} +3 -3
  163. package/dist/client/assets/{integration-icon-FxF8FEU6.js → integration-icon-dTPy2b7i.js} +1 -1
  164. package/dist/client/assets/{jira-icon-BLg3npMf.js → jira-icon-B-iFZO-u.js} +1 -1
  165. package/dist/client/assets/{label-Bh2Pit2O.js → label-ceAH5i3J.js} +1 -1
  166. package/dist/client/assets/{layout-C60ZlULv.js → layout-t2hFRUfQ.js} +1 -1
  167. package/dist/client/assets/{legacy-agents-deep-DwelfdPA.js → legacy-agents-deep-QW5LKNZ9.js} +1 -1
  168. package/dist/client/assets/{legacy-main-redirect-C_4oCw1E.js → legacy-main-redirect-agOJ7qxO.js} +1 -1
  169. package/dist/client/assets/{library-tab-BaUP3ZVF.js → library-tab-Cd6LpVzA.js} +1 -1
  170. package/dist/client/assets/library-y46FHCMx.js +1 -0
  171. package/dist/client/assets/{login-bcoCcqBW.js → login-DAO6F2t7.js} +1 -1
  172. package/dist/client/assets/{markdown-j0gDnxTp.js → markdown-R4HS4rag.js} +1 -1
  173. package/dist/client/assets/{mcp-app-renderer-C3zml1pp.js → mcp-app-renderer-BhX-TA45.js} +1 -1
  174. package/dist/client/assets/{mcp-oauth-I0kjN__K.js → mcp-oauth-B9XClwsH.js} +1 -1
  175. package/dist/client/assets/{mcp-oauth-D4Pxc73w.js → mcp-oauth-BD1gbmnp.js} +1 -1
  176. package/dist/client/assets/{members-Dxz1ewpb.js → members-B5ITOykA.js} +1 -1
  177. package/dist/client/assets/{memory-C_AcXDod.js → memory-2YoF1gtv.js} +1 -1
  178. package/dist/client/assets/{mock-board-COgbDYxA.js → mock-board-B8zFRpTH.js} +3 -3
  179. package/dist/client/assets/{monaco-editor-DtIoXdMD.js → monaco-editor-COXw9tpM.js} +1 -1
  180. package/dist/client/assets/{monitoring-DWb86ZoC.js → monitoring-D40iJL2y.js} +1 -1
  181. package/dist/client/assets/{monitoring-stats-row-BSstVGMX.js → monitoring-stats-row-Bqran8Kb.js} +1 -1
  182. package/dist/client/assets/{multi-select-DailkN9Q.js → multi-select-CJZaGsBr.js} +1 -1
  183. package/dist/client/assets/{mustache-BSD6v2ig.js → mustache-R0EQOelB.js} +1 -1
  184. package/dist/client/assets/{named-rule-view-B_8gTqcI.js → named-rule-view-C5CYsfvZ.js} +1 -1
  185. package/dist/client/assets/{new-project-dialog-wz5dJWkC.js → new-project-dialog-CIVKu-7h.js} +1 -1
  186. package/dist/client/assets/{oauth-callback-B7Nohzxd.js → oauth-callback-BPcRWINw.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-ai-provider-BmsntsZe.js → oauth-callback-ai-provider-B-M4ZinT.js} +1 -1
  188. package/dist/client/assets/{oauth-consent-cf55Bmz-.js → oauth-consent-D4opNBgY.js} +1 -1
  189. package/dist/client/assets/{onboarding-Cdi9idPQ.js → onboarding-B4LUp0An.js} +1 -1
  190. package/dist/client/assets/{openai-conversation-BMpQOydo.js → openai-conversation-zvFqUh2z.js} +1 -1
  191. package/dist/client/assets/{optimistic-project-sidebar-views-AOXvjkSa.js → optimistic-project-sidebar-views-HH03nXs0.js} +1 -1
  192. package/dist/client/assets/{order-monitor-day-Bk2YpEn9.js → order-monitor-day-DAdsKEE4.js} +1 -1
  193. package/dist/client/assets/{organization-choice-CcyZ2sED.js → organization-choice-BS5zo77t.js} +1 -1
  194. package/dist/client/assets/{orgs-C6-Q2iMm.js → orgs-KOkht6C7.js} +1 -1
  195. package/dist/client/assets/{own-accounts-section-BEuNQYr7.js → own-accounts-section-x8GM3van.js} +1 -1
  196. package/dist/client/assets/{pair-D0R2UDgp.js → pair-CCa5vpj1.js} +1 -1
  197. package/dist/client/assets/{parse-sections-DTDSECqx.js → parse-sections-y55_dTHG.js} +7 -7
  198. package/dist/client/assets/{plan-D5_Bt3KJ.js → plan-Bu1ae04L.js} +1 -1
  199. package/dist/client/assets/{plan-ladder-BWKx4tc-.js → plan-ladder-DexOsahh.js} +1 -1
  200. package/dist/client/assets/{plan-usage-card-Z5a-2qYK.js → plan-usage-card-Dv-we64H.js} +1 -1
  201. package/dist/client/assets/{popover-BrVMYzI-.js → popover-DvNPDyrT.js} +1 -1
  202. package/dist/client/assets/{post-calendar-BpEmJgqQ.js → post-calendar-BbxK7Nck.js} +1 -1
  203. package/dist/client/assets/{post-editor-yNAWU29F.js → post-editor-D3-DvSTe.js} +1 -1
  204. package/dist/client/assets/{preview-content-CWagFWI_.js → preview-content-B_nl5Vt5.js} +1 -1
  205. package/dist/client/assets/{preview-dialog-Bc1z8QHZ.js → preview-dialog-CSKtivij.js} +1 -1
  206. package/dist/client/assets/{preview-panel-bcbhyFq_.js → preview-panel-Bgx1GfaD.js} +1 -1
  207. package/dist/client/assets/{preview-tab-nbSkAxxa.js → preview-tab-BhpH-2Ud.js} +3 -3
  208. package/dist/client/assets/{product-picker-dialog-CNr_kHqK.js → product-picker-dialog-7dCvJecm.js} +1 -1
  209. package/dist/client/assets/{profile-DtHrUsir.js → profile-CE19vOJM.js} +1 -1
  210. package/dist/client/assets/{project-app-view-BfN3k7ju.js → project-app-view-1nFCQkd0.js} +1 -1
  211. package/dist/client/assets/{project-apps-C_vCRb8O.js → project-apps-BH_f18IX.js} +1 -1
  212. package/dist/client/assets/{project-icon-n7LBJrfx.js → project-icon-MnmUeo9G.js} +1 -1
  213. package/dist/client/assets/{project-index-2cTAo4fH.js → project-index-VbMkJjNv.js} +1 -1
  214. package/dist/client/assets/project-reports-CnsbnjmF.js +1 -0
  215. package/dist/client/assets/{project-sidebar-views-DhZy-bnC.js → project-sidebar-views-B0YI7MEr.js} +1 -1
  216. package/dist/client/assets/project-tasks-DNvniFkq.js +1 -0
  217. package/dist/client/assets/{projects-OSECm-FW.js → projects-BV3gIN23.js} +1 -1
  218. package/dist/client/assets/{projects-empty-state-B7zdGKEZ.js → projects-empty-state-afMxQRTs.js} +1 -1
  219. package/dist/client/assets/{prompts-J4HaC_ei.js → prompts-oZ33-QKo.js} +1 -1
  220. package/dist/client/assets/record-editor-Z7XUx2eC.js +1 -0
  221. package/dist/client/assets/{redirect-editor-DeoRyu0l.js → redirect-editor-CYAcoJC8.js} +1 -1
  222. package/dist/client/assets/{reports-CpGpr_ZH.js → reports-CDhkA5XZ.js} +1 -1
  223. package/dist/client/assets/reports-D0p-Um_j.js +1 -0
  224. package/dist/client/assets/{reports-onboarding-CJMXOfw7.js → reports-onboarding-N-tDslEn.js} +1 -1
  225. package/dist/client/assets/{reports-tab-LNIEzMQ4.js → reports-tab-CwMJYWOD.js} +2 -2
  226. package/dist/client/assets/repositories-420JyOBQ.js +1 -0
  227. package/dist/client/assets/{repositories-CCBdk88v.js → repositories-Dd6j8vDN.js} +1 -1
  228. package/dist/client/assets/{repository-binding-DdmRVWpz.js → repository-binding-lATwNZrT.js} +1 -1
  229. package/dist/client/assets/{repository-picker-ClelLyeu.js → repository-picker-C4hJc23I.js} +1 -1
  230. package/dist/client/assets/{require-capability-BCUql2uo.js → require-capability-DC5p7lOC.js} +1 -1
  231. package/dist/client/assets/{required-auth-layout-Lh-Wt6uK.js → required-auth-layout-C3gt0jrF.js} +1 -1
  232. package/dist/client/assets/{reset-password-Cq-nDwrY.js → reset-password-CyyT5tby.js} +1 -1
  233. package/dist/client/assets/{resizable-D8U4YOro.js → resizable-BOUBAwD3.js} +1 -1
  234. package/dist/client/assets/{resolve-tab-icon-CukmKoWA.js → resolve-tab-icon-Cy2CMMCX.js} +1 -1
  235. package/dist/client/assets/{review-settings-BzmxgDqt.js → review-settings-BckYzYJ3.js} +1 -1
  236. package/dist/client/assets/{role-color-C-Q62gr6.js → role-color-DoTrcNjE.js} +1 -1
  237. package/dist/client/assets/{roles-b8ba7BB1.js → roles-Bcyxf_BJ.js} +1 -1
  238. package/dist/client/assets/route-Dm6KS1MZ.js +1 -0
  239. package/dist/client/assets/{route-CXbtT4mj.js → route-WCW0DstB.js} +1 -1
  240. package/dist/client/assets/{route-Dq87eMEg.js → route-Z2AgEOBo.js} +1 -1
  241. package/dist/client/assets/{sandbox-lifecycle-context-o_ip6_5z.js → sandbox-lifecycle-context-ezRldKto.js} +1 -1
  242. package/dist/client/assets/{schema-CDmusrrq.js → schema-CYb0A5pZ.js} +1 -1
  243. package/dist/client/assets/{schema-ByYst2Pb.js → schema-oSx50TOf.js} +1 -1
  244. package/dist/client/assets/{scroll-area-Ch8iXNIM.js → scroll-area-C2kqOV3G.js} +1 -1
  245. package/dist/client/assets/{search-input-CqM9MiZ3.js → search-input-D2_G90x-.js} +1 -1
  246. package/dist/client/assets/{search-toggle-VKaSo9uW.js → search-toggle-DB94_Uzf.js} +1 -1
  247. package/dist/client/assets/{secret-picker-DPC7oeFy.js → secret-picker-BaH4MCDx.js} +1 -1
  248. package/dist/client/assets/{secrets-2ntDkWXH.js → secrets-Ba8vj8rp.js} +1 -1
  249. package/dist/client/assets/{section-array-field-ziyJ9KKG.js → section-array-field-C_pqbrT4.js} +1 -1
  250. package/dist/client/assets/{sections-B2FraWlK.js → sections-CiSDVCFc.js} +1 -1
  251. package/dist/client/assets/{sections-editor-D6NJi3oc.js → sections-editor-DbbjUxTa.js} +1 -1
  252. package/dist/client/assets/{select-BqAgCf_e.js → select-5VAmllhJ.js} +1 -1
  253. package/dist/client/assets/{select-model-CgHPgPvz.js → select-model-CGTpgJ_F.js} +1 -1
  254. package/dist/client/assets/{seo-editor-Bc6Ncl3H.js → seo-editor-BToxCPgQ.js} +1 -1
  255. package/dist/client/assets/{separator-B2LjZA6j.js → separator-BPNBTypb.js} +1 -1
  256. package/dist/client/assets/settings-tab-CvzmrN3x.js +1 -0
  257. package/dist/client/assets/{sheet-y4usetIj.js → sheet-DO79DyVm.js} +1 -1
  258. package/dist/client/assets/{shell-layout-BHLD5jhn.js → shell-layout-BE-F-e8S.js} +1 -1
  259. package/dist/client/assets/{site-draft-actions-gfTBLW-u.js → site-draft-actions-CSmqWURg.js} +1 -1
  260. package/dist/client/assets/{site-draft-view-B7polEM8.js → site-draft-view-D9Mkp6Cl.js} +1 -1
  261. package/dist/client/assets/site-editor-BnuHlrBY.js +1 -0
  262. package/dist/client/assets/{site-editor-toast-DaSHvCWu.js → site-editor-toast-hszpYNCy.js} +1 -1
  263. package/dist/client/assets/{skills-BemYRmGR.js → skills-Bv-bIoQE.js} +1 -1
  264. package/dist/client/assets/{slider-CUVU1H_x.js → slider-ShXfqPv2.js} +1 -1
  265. package/dist/client/assets/{sortable.esm-Sw9w3P90.js → sortable.esm-CuHm_9IF.js} +1 -1
  266. package/dist/client/assets/{sso-C3qLFTZi.js → sso-CSplF7G4.js} +1 -1
  267. package/dist/client/assets/{suggestion-BiaV3mvJ.js → suggestion-D3ekTtHr.js} +1 -1
  268. package/dist/client/assets/{switch-DKx4qpl7.js → switch-DXYVQM5M.js} +1 -1
  269. package/dist/client/assets/{synced-repos-edmrMUSZ.js → synced-repos-CuP83Elu.js} +1 -1
  270. package/dist/client/assets/{tab-icon-glyph-C8csunxY.js → tab-icon-glyph-vdlPy3Bm.js} +1 -1
  271. package/dist/client/assets/{table-Dq5I6aY7.js → table-D0fiB6FK.js} +1 -1
  272. package/dist/client/assets/{tabs-0SGJ_qve.js → tabs-Cv20SIqi.js} +1 -1
  273. package/dist/client/assets/{task-board-CWLsdAvC.js → task-board-DSsXkzaF.js} +1 -1
  274. package/dist/client/assets/{task-route-Cay3KQ6a.js → task-route-DMVHtIU_.js} +1 -1
  275. package/dist/client/assets/{task-status-D-bn6Q3b.js → task-status-BNhGvcs9.js} +1 -1
  276. package/dist/client/assets/{taskboard-analytics-L-F5O9dg.js → taskboard-analytics-CMwW3rsH.js} +1 -1
  277. package/dist/client/assets/tasks-BesFuPIU.js +1 -0
  278. package/dist/client/assets/{tasks-DIxE8tYD.js → tasks-DhVzWH9H.js} +1 -1
  279. package/dist/client/assets/{textarea-C8pP4RDC.js → textarea-jvxCA8mN.js} +1 -1
  280. package/dist/client/assets/{thread-analytics-01LkdxOy.js → thread-analytics-CM1xCbgM.js} +1 -1
  281. package/dist/client/assets/{thread-intent-D7FGI3D0.js → thread-intent-BirCtYTn.js} +1 -1
  282. package/dist/client/assets/{thread-route-CKRKYHUZ.js → thread-route-BaKA80Bq.js} +1 -1
  283. package/dist/client/assets/{thread-route-E0bMcc27.js → thread-route-gjL8sFh9.js} +1 -1
  284. package/dist/client/assets/{thread-sheet-body-DkwRzpXX.js → thread-sheet-body-C68t2imw.js} +1 -1
  285. package/dist/client/assets/{time-range-picker-DNs3LiZc.js → time-range-picker-8dvZbzAF.js} +1 -1
  286. package/dist/client/assets/{toggle-group-DkZuJxmr.js → toggle-group-BkFB4B6f.js} +1 -1
  287. package/dist/client/assets/{tool-namespace-CCkkm2qA.js → tool-namespace-BPtJyOTH.js} +1 -1
  288. package/dist/client/assets/{tool-set-selector-5zt8G69C.js → tool-set-selector-D3Q4u2pt.js} +1 -1
  289. package/dist/client/assets/{toolbar-icon-button-Cx0kc5lZ.js → toolbar-icon-button-DWxNo-CH.js} +1 -1
  290. package/dist/client/assets/{tooltip-jhiffORJ.js → tooltip-BS3U7s1j.js} +1 -1
  291. package/dist/client/assets/{tooltipContext-BYQJi6EG.js → tooltipContext-BLujWWNh.js} +1 -1
  292. package/dist/client/assets/{track-8QL-WYe-.js → track-CpUWIu8h.js} +1 -1
  293. package/dist/client/assets/{types-CR7kvQl1.js → types-BzcfuN64.js} +1 -1
  294. package/dist/client/assets/{url-slug-BxiYZtUy.js → url-slug-BOoM9-0A.js} +1 -1
  295. package/dist/client/assets/{usage-stats-DB51uKij.js → usage-stats-8fBPxKmN.js} +1 -1
  296. package/dist/client/assets/{use-ai-providers-sfkouqgF.js → use-ai-providers-CGSjFpU8.js} +1 -1
  297. package/dist/client/assets/{use-apply-named-rule-DA98Iihd.js → use-apply-named-rule-CpJPkStL.js} +1 -1
  298. package/dist/client/assets/use-ask-in-chat-CpD8hrjd.js +1 -0
  299. package/dist/client/assets/{use-automations-DD-H-0gg.js → use-automations-XQDz01iY.js} +1 -1
  300. package/dist/client/assets/{use-autosave-Bw7KaLnG.js → use-autosave-C37w8LAn.js} +1 -1
  301. package/dist/client/assets/use-blocks-v8-project-C468EFq8.js +1 -0
  302. package/dist/client/assets/{use-chat-layout-state-BbG5C9on.js → use-chat-layout-state-VEEgw78z.js} +1 -1
  303. package/dist/client/assets/{use-cms-publish-actions-1o6NX1uP.js → use-cms-publish-actions-ZwEhZ1LO.js} +1 -1
  304. package/dist/client/assets/{use-connect-companion-LWK1AWBF.js → use-connect-companion-DaWAsSVX.js} +1 -1
  305. package/dist/client/assets/{use-connection-CgY1E7FR.js → use-connection-Br1r8foQ.js} +1 -1
  306. package/dist/client/assets/{use-content-sync-9QsuTp3C.js → use-content-sync-W-nuOa0g.js} +1 -1
  307. package/dist/client/assets/{use-copy-DRW_V1kW.js → use-copy-B7Ns5hk7.js} +1 -1
  308. package/dist/client/assets/{use-date-fns-locale-Cw3Zaqb5.js → use-date-fns-locale-DdNyhrK9.js} +1 -1
  309. package/dist/client/assets/{use-debounced-autosave-CgAvArNN.js → use-debounced-autosave-BWd-EoeM.js} +1 -1
  310. package/dist/client/assets/{use-debounced-value-B0a3uxKQ.js → use-debounced-value-_GKTwOmp.js} +1 -1
  311. package/dist/client/assets/{use-deco-credits-BVH6IrV5.js → use-deco-credits-D7cUDa9s.js} +1 -1
  312. package/dist/client/assets/{use-decopilot-events-BYlxYXUQ.js → use-decopilot-events-MFonZFqV.js} +1 -1
  313. package/dist/client/assets/{use-delete-connection-CvuMwKsA.js → use-delete-connection-DqWgt_cH.js} +1 -1
  314. package/dist/client/assets/{use-deployment-admin-Bw3ciRk9.js → use-deployment-admin-Dpt106eE.js} +1 -1
  315. package/dist/client/assets/{use-entitlements-CMCBZq5_.js → use-entitlements-BIn3vhw_.js} +1 -1
  316. package/dist/client/assets/{use-fast-preview-draft-url-BUD5f_Gm.js → use-fast-preview-draft-url-Btcix_Th.js} +1 -1
  317. package/dist/client/assets/{use-file-configs-2Z7OwHbg.js → use-file-configs-B7N8jort.js} +1 -1
  318. package/dist/client/assets/{use-id-selection--cuaALt7.js → use-id-selection-BYftOYVM.js} +1 -1
  319. package/dist/client/assets/{use-inbox-feed-DxzsD1YQ.js → use-inbox-feed-Ccjtmqv0.js} +1 -1
  320. package/dist/client/assets/{use-infinite-scroll-BKVwA-Ob.js → use-infinite-scroll-DIKScsa1.js} +1 -1
  321. package/dist/client/assets/{use-join-requests-BZlGoiU5.js → use-join-requests-CUdH2HZc.js} +1 -1
  322. package/dist/client/assets/{use-main-panel-tabs-4JSMbOrH.js → use-main-panel-tabs-CCwGm8EC.js} +1 -1
  323. package/dist/client/assets/{use-mcp-auth-status-CYCjckUQ.js → use-mcp-auth-status-N-GvDO1N.js} +1 -1
  324. package/dist/client/assets/{use-mcp-client-CjLtJgTU.js → use-mcp-client-C6kW4vbD.js} +1 -1
  325. package/dist/client/assets/{use-mcp-prompts-JVEMCdnt.js → use-mcp-prompts-CjpO3wzS.js} +1 -1
  326. package/dist/client/assets/{use-mcp-tools-C5jhMv1O.js → use-mcp-tools-Cjb6pYnM.js} +1 -1
  327. package/dist/client/assets/{use-mobile-CKr6zvd6.js → use-mobile-Dl5gc-ru.js} +1 -1
  328. package/dist/client/assets/{use-move-blocks-B-6qZYKa.js → use-move-blocks-Ce0Kig2N.js} +1 -1
  329. package/dist/client/assets/{use-navigate-to-agent-BJsKVGd6.js → use-navigate-to-agent-B5ZbLCUr.js} +1 -1
  330. package/dist/client/assets/{use-org-fs-DDhNsbr6.js → use-org-fs-BGMZPpcx.js} +1 -1
  331. package/dist/client/assets/{use-org-repo-syncs-DBx3nqV9.js → use-org-repo-syncs-BAfsGUin.js} +1 -1
  332. package/dist/client/assets/{use-org-sso-DyxTDJHi.js → use-org-sso-CwVEWYSS.js} +1 -1
  333. package/dist/client/assets/{use-organization-settings-Cs5X07HH.js → use-organization-settings-BTar9wUH.js} +1 -1
  334. package/dist/client/assets/{use-project-scope-DK5Zq3Vj.js → use-project-scope-D-D3vFqs.js} +1 -1
  335. package/dist/client/assets/{use-recent-apps-BrqeKXhi.js → use-recent-apps-CLezfBII.js} +1 -1
  336. package/dist/client/assets/{use-reports-diagnostic-D0MF0Enh.js → use-reports-diagnostic-DOqTM6Sq.js} +1 -1
  337. package/dist/client/assets/{use-sandbox-events-DKvN2vib.js → use-sandbox-events-D2qF_K2w.js} +1 -1
  338. package/dist/client/assets/{use-secrets-q3tQjsVS.js → use-secrets-CdTtOnTm.js} +1 -1
  339. package/dist/client/assets/{use-section-preview-base-DI0VnMUg.js → use-section-preview-base-BQcFctze.js} +1 -1
  340. package/dist/client/assets/{use-sidebar-collapsed-NHFQSjyB.js → use-sidebar-collapsed-CU3_YQ2d.js} +1 -1
  341. package/dist/client/assets/{use-tags-7ZRefyR6.js → use-tags-ChNJSZUC.js} +1 -1
  342. package/dist/client/assets/{use-task-board-analytics-CFKUFKZO.js → use-task-board-analytics-CEr1IeWK.js} +1 -1
  343. package/dist/client/assets/{use-task-board-events-D1ietf1D.js → use-task-board-events-sZpvmMHd.js} +1 -1
  344. package/dist/client/assets/{use-task-board-item-prs-hyB7mT0I.js → use-task-board-item-prs-Dv_8MGt1.js} +1 -1
  345. package/dist/client/assets/{use-task-board-items-C5M-iJHh.js → use-task-board-items-CoNq_Cxi.js} +1 -1
  346. package/dist/client/assets/{use-task-board-prompts-Bj8qQJuo.js → use-task-board-prompts-CWMdTCPN.js} +1 -1
  347. package/dist/client/assets/{use-task-metadata-D_W5nMRB.js → use-task-metadata-DsDxaplE.js} +1 -1
  348. package/dist/client/assets/{use-thread-outputs-CIMyOC9i.js → use-thread-outputs-St6ye3b1.js} +1 -1
  349. package/dist/client/assets/{use-voice-input-D0UxQK8p.js → use-voice-input-B9rrFwaR.js} +1 -1
  350. package/dist/client/assets/useInfiniteQuery-Bh3c89Tr.js +1 -0
  351. package/dist/client/assets/{useQueries-D-paqk_N.js → useQueries-H5rWlyEJ.js} +1 -1
  352. package/dist/client/assets/useSuspenseInfiniteQuery-bp-UKwHD.js +1 -0
  353. package/dist/client/assets/{users-CgyVEAVi.js → users-wWFrk5XR.js} +1 -1
  354. package/dist/client/assets/{utils-CML3oMCb.js → utils-1rHoZRD5.js} +1 -1
  355. package/dist/client/assets/{variant-calendar-CiRidZhE.js → variant-calendar-BktNebbV.js} +1 -1
  356. package/dist/client/assets/{variant-matcher-override-DptryLC2.js → variant-matcher-override-CtOZ7RsB.js} +1 -1
  357. package/dist/client/assets/{view-header-C5UPfmG7.js → view-header-BOKi0SWm.js} +1 -1
  358. package/dist/client/assets/{virtual-mcp-BVgnJh3F.js → virtual-mcp-o7wxm5IS.js} +1 -1
  359. package/dist/client/assets/{watch-sse-pool-DiT4THMV.js → watch-sse-pool-D6Aszef8.js} +1 -1
  360. package/dist/client/index.html +1 -1
  361. package/dist/server/server.js +1 -1
  362. package/package.json +1 -1
  363. package/dist/client/assets/agent-app-D1s_xxXR.js +0 -1
  364. package/dist/client/assets/agent-deck-1mK6Ythm.js +0 -1
  365. package/dist/client/assets/agent-experiments-3ZqH1pHZ.js +0 -1
  366. package/dist/client/assets/agent-library-Bivz2SRZ.js +0 -1
  367. package/dist/client/assets/agent-library-file-CpGwdPNs.js +0 -1
  368. package/dist/client/assets/agent-overview-CwCkuDX2.js +0 -1
  369. package/dist/client/assets/agent-settings-DEn_87Gp.js +0 -1
  370. package/dist/client/assets/agent-site-editor-code-DqKm62jM.js +0 -2
  371. package/dist/client/assets/agent-site-editor-content-DmZnej6I.js +0 -1
  372. package/dist/client/assets/agent-site-editor-preview-DuaKrxk_.js +0 -1
  373. package/dist/client/assets/agent-view-Cey5y0PV.js +0 -1
  374. package/dist/client/assets/api-keys-IHsKCg1y.js +0 -1
  375. package/dist/client/assets/library-B-jS61L0.js +0 -1
  376. package/dist/client/assets/project-reports-C1Hkwfya.js +0 -1
  377. package/dist/client/assets/project-tasks-B8hDD-I8.js +0 -1
  378. package/dist/client/assets/record-editor-B3zURv0C.js +0 -1
  379. package/dist/client/assets/reports-CofWqBLU.js +0 -1
  380. package/dist/client/assets/repositories-yBP4WuG_.js +0 -1
  381. package/dist/client/assets/route-BK2wi4kD.js +0 -1
  382. package/dist/client/assets/settings-tab-DzS7_7oR.js +0 -1
  383. package/dist/client/assets/site-editor-Cp5Zuvwt.js +0 -1
  384. package/dist/client/assets/tasks-Drp2qtBI.js +0 -1
  385. package/dist/client/assets/use-ask-in-chat-tQsBmTsy.js +0 -1
  386. package/dist/client/assets/use-blocks-v8-project-DzHuTeMz.js +0 -1
  387. package/dist/client/assets/useInfiniteQuery-4mlqNbEX.js +0 -1
  388. package/dist/client/assets/useSuspenseInfiniteQuery-6pYaPTkl.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-D6NJi3oc.js","assets/index-BpRy7AHp.js","assets/index-CKEKSTrk.css","assets/chat-context-BFpdF0Ea.js","assets/autosend-xPyRMwmc.js","assets/thread-route-E0bMcc27.js","assets/use-project-scope-DK5Zq3Vj.js","assets/repository-binding-DdmRVWpz.js","assets/use-mcp-client-CjLtJgTU.js","assets/auth-D1oBKWc9.js","assets/thread-intent-D7FGI3D0.js","assets/delay-CnY5UFtP.js","assets/watch-sse-pool-DiT4THMV.js","assets/task-board-CWLsdAvC.js","assets/schema-CDmusrrq.js","assets/use-entitlements-CMCBZq5_.js","assets/use-ai-providers-sfkouqgF.js","assets/use-decopilot-events-BYlxYXUQ.js","assets/use-organization-settings-Cs5X07HH.js","assets/parse-sections-DTDSECqx.js","assets/utils-CML3oMCb.js","assets/agent-icon-AbOSM7KF.js","assets/AlertCircle-1CFQF9HU.js","assets/Tool01-BXFm5jK2.js","assets/ArrowUp-B_QEh9AM.js","assets/ArrowLeft-yZosAbEQ.js","assets/LinkBroken01-Dhn_nIp2.js","assets/ShoppingBag01-BOpj8wnX.js","assets/Globe04-Czvq6voU.js","assets/CheckCircle-DjUjDOFk.js","assets/ChevronUp-aVrgoYI4.js","assets/ChevronSelectorVertical-C2ySHatm.js","assets/UserSquare-BloCTB27.js","assets/CreditCard01-CMrZYrMd.js","assets/SwitchHorizontal01-DedOEqGg.js","assets/Key01-CJVeUDDi.js","assets/Minus-qjFidgiH.js","assets/Monitor01-BwW28bRE.js","assets/Sun-CUTKbSf6.js","assets/Play-DWKJ4lP6.js","assets/Plus-u00IxELx.js","assets/SearchMd-DrxAIngK.js","assets/Trash01-t2BYg0st.js","assets/Upload01-BBUgsLLD.js","assets/Users01-D0A6lP8t.js","assets/XClose-CUME_VK2.js","assets/Zap-CmNmFUbX.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/pair-D0R2UDgp.js","assets/collapsible-C4GX1H_R.js","assets/use-copy-DRW_V1kW.js","assets/usage-stats-DB51uKij.js","assets/tool-namespace-CCkkm2qA.js","assets/form-D2GmFQW3.js","assets/label-Bh2Pit2O.js","assets/utils-CVEq3hMx.js","assets/markdown-j0gDnxTp.js","assets/use-mobile-CKr6zvd6.js","assets/tooltip-jhiffORJ.js","assets/index-lbygo01z.js","assets/shell-layout-BHLD5jhn.js","assets/use-deployment-admin-Bw3ciRk9.js","assets/admin-fetch-BhTJlAsX.js","assets/command-CYK5M8XI.js","assets/index-DQBul4yU.js","assets/integration-icon-FxF8FEU6.js","assets/project-icon-n7LBJrfx.js","assets/use-navigate-to-agent-BJsKVGd6.js","assets/use-debounced-value-B0a3uxKQ.js","assets/new-project-dialog-wz5dJWkC.js","assets/repository-picker-ClelLyeu.js","assets/github-icon-i7iUozqR.js","assets/useInfiniteQuery-4mlqNbEX.js","assets/infiniteQueryObserver-D03R0ede.js","assets/collection-search-Dz7QHmOz.js","assets/required-auth-layout-Lh-Wt6uK.js","assets/use-org-sso-DyxTDJHi.js","assets/shell-layout-CE2Eihra.css","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-C3zml1pp.js","assets/types-CR7kvQl1.js","assets/omit-server-managed-metadata-L5IhjRZB.js","assets/sheet-y4usetIj.js","assets/use-connection-CgY1E7FR.js","assets/use-mcp-prompts-JVEMCdnt.js","assets/use-thread-outputs-CIMyOC9i.js","assets/file-type-icon-C-QM854F.js","assets/section-array-field-ziyJ9KKG.js","assets/blocks-tab-states-DOYuC7hO.js","assets/site-editor-toast-DaSHvCWu.js","assets/use-voice-input-D0UxQK8p.js","assets/popover-BrVMYzI-.js","assets/drawer-C1zPem_-.js","assets/index-DPD9OENi.js","assets/checkbox-DDDKCgb5.js","assets/select-BqAgCf_e.js","assets/index-BdQq_4o_.js","assets/ai-providers-logos-DD3qZ33J.js","assets/openai-compatible-presets-BKGfVqEx.js","assets/use-blocks-v8-project-DzHuTeMz.js","assets/sandbox-url-D3mC8qhT.js","assets/use-sandbox-events-DKvN2vib.js","assets/sandbox-git-api-DcqI6XE4.js","assets/empty-state-tlDzCEBe.js","assets/hosted-reconcile-CvdR91uj.js","assets/slider-CUVU1H_x.js","assets/index-OBb8rfAw.js","assets/tooltipContext-BYQJi6EG.js","assets/CategoricalChart-KK8jWPWD.js","assets/index-D_UeTS1-.js","assets/switch-DKx4qpl7.js","assets/textarea-C8pP4RDC.js","assets/scroll-area-Ch8iXNIM.js","assets/monaco-editor-DtIoXdMD.js","assets/editor-BcXADR5b.js","assets/calendar-8e1bW3QX.js","assets/editor-classes-BftbquCD.js","assets/core.esm-BGRTXfSt.js","assets/sortable.esm-Sw9w3P90.js","assets/toggle-group-DkZuJxmr.js","assets/active-indicator-CCMhAsc_.js","assets/combobox-DqPSOi3v.js","assets/search-input-CqM9MiZ3.js","assets/tabs-0SGJ_qve.js","assets/use-file-configs-2Z7OwHbg.js","assets/asset-utils-DhDLN_-h.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/mustache-BSD6v2ig.js","assets/use-section-preview-base-DI0VnMUg.js","assets/seo-editor-Bc6Ncl3H.js","assets/use-apply-named-rule-DA98Iihd.js","assets/use-move-blocks-B-6qZYKa.js","assets/variant-matcher-override-DptryLC2.js"])))=>i.map(i=>d[i]);
2
- import{c as ue,j as r,r as E,m as Fe,b as Te,B as $e,a3 as ni,aF as cn,b4 as ct,aG as De,b5 as si,b6 as ri,b7 as ai,b8 as ii,v as Pr,D as jr,K as Gn,w as Er,x as Nr,e as oi,h as gt,I as Mn,y as li,b9 as ci,a5 as Jn,aZ as di,b2 as ui,i as Tr,ar as Un,at as In,a8 as Cr,P as zn,E as fi,t as dn,b3 as pi,q as mi}from"./index-BpRy7AHp.js";import{u as Rr,g as hi,c as Gs,B as Rn,P as gi,r as vi,R as xi,a as bi,H as wi,b as Lr,S as yi,d as ki,l as Si,m as Pi,p as ji,e as Ei,f as Ln,N as Ni}from"./parse-sections-DTDSECqx.js";import{b as Ti,c as Mt,r as Ar,l as _r,f as Ci,g as Ri,w as Li}from"./chat-context-BFpdF0Ea.js";import{t as Ai}from"./ChevronUp-aVrgoYI4.js";import{P as _i,Q as Oi,J as Or,R as Di,S as Fi,b as $i,T as Bi,U as Dr,V as Mi,W as Fr,X as Js,Y as Ui}from"./agent-icon-AbOSM7KF.js";import{a as Ii,n as zi}from"./UserSquare-BloCTB27.js";import{s as $r}from"./Plus-u00IxELx.js";import{a as Br,b as Mr,P as Ur}from"./popover-BrVMYzI-.js";import{e as dt,b as ut,c as Ir,f as zr,a as Kr,C as Hr}from"./command-CYK5M8XI.js";import{b as Ki,c as Hi,u as Vi}from"./repository-binding-DdmRVWpz.js";import{a as Ut}from"./sandbox-lifecycle-context-o_ip6_5z.js";import{r as Wi}from"./thread-intent-D7FGI3D0.js";import{u as Vr}from"./use-voice-input-D0UxQK8p.js";import{d as qi,f as Gi,i as Ji,g as Yi,h as Qi,j as Xi,k as Zi,u as fn,l as Yn,m as Xe,n as eo,o as Wr,q as to,t as no,v as so,w as qr,x as ro,c as Gr,b as Jr,y as ao,z as He,A as io,B as oo,C as lo,D as co,E as uo,F as fo,G as Ys,H as po,I as Qs,J as mo,K as ho,L as Xs,M as Zs,N as er,O as tr,P as nr,Q as An,R as go,S as vo,U as xo,V as bo,W as wo,e as yo}from"./site-editor-toast-DaSHvCWu.js";import{u as Yr}from"./use-mobile-CKr6zvd6.js";import{T as pt,a as mt,c as ht}from"./tooltip-jhiffORJ.js";import{T as Ze}from"./toolbar-icon-button-Cx0kc5lZ.js";import{w as nn,i as ko}from"./variant-matcher-override-DptryLC2.js";import{s as Bt,n as Qn,a as Qr,f as Ve,v as Xr,u as Zr,h as So,i as Po,B as jo,S as Eo,C as No,b as To,e as Co,c as Ro,d as Lo,N as Ao,g as _o,r as Oo,j as Do,k as sr,p as Fo}from"./blocks-tab-states-DOYuC7hO.js";import{u as $o}from"./use-fast-preview-draft-url-BUD5f_Gm.js";import{g as Bo}from"./section-array-field-ziyJ9KKG.js";import{g as Mo,l as ea}from"./shell-layout-BHLD5jhn.js";import{u as Xn,b as Uo}from"./use-sandbox-events-DKvN2vib.js";import{u as Kn}from"./useQueries-D-paqk_N.js";import{i as Io}from"./LinkBroken01-Dhn_nIp2.js";import{u as ta}from"./blocks-preview-workspace-context-D9X9QQD5.js";import{MonacoCodeEditor as zo}from"./monaco-editor-DtIoXdMD.js";import{c as Ko,u as Ho,i as Vo,l as Wo,D as qo}from"./hosted-reconcile-CvdR91uj.js";import{d as Go}from"./utils-CML3oMCb.js";import{R as rr,a as sn,b as ar}from"./resizable-D8U4YOro.js";import{u as Jo}from"./use-blocks-v8-project-DzHuTeMz.js";import{s as Yo,L as Qo,R as na,D as ir,w as Hn}from"./device-hint-BOo4jdep.js";import{L as Xo}from"./label-Bh2Pit2O.js";import{a as Zo,T as or}from"./toggle-group-DkZuJxmr.js";import{b as el}from"./sandbox-url-D3mC8qhT.js";import{r as tl,R as nl}from"./virtual-mcp-BVgnJh3F.js";import{d as sl}from"./delay-CnY5UFtP.js";import{s as sa}from"./XClose-CUME_VK2.js";import{o as rl}from"./omit-server-managed-metadata-L5IhjRZB.js";import{a as _n,b as al,w as il,n as lr}from"./app-preview-url-9Od4s8Sz.js";import{a as ol}from"./use-organization-settings-Cs5X07HH.js";import{a as On}from"./agent-capabilities-DmNIevq-.js";import{E as ll}from"./empty-state-tlDzCEBe.js";import{G as cr}from"./github-icon-i7iUozqR.js";import{R as cl}from"./new-project-dialog-wz5dJWkC.js";import{r as dl}from"./preview-source-BsRLGWUP.js";import{A as ul,a as fl,b as pl}from"./alert-hJJytfOJ.js";import{u as ml}from"./use-task-metadata-D_W5nMRB.js";function hl(t){const e=ue.c(10),{waiting:n}=t,s=n?"true":"false";let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("span",{className:"flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground sm:size-12",children:r.jsx(_i,{className:"size-5 sm:size-6"})}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("span",{className:"h-px w-full border-t border-dashed border-muted-foreground/40"}),e[1]=l):l=e[1];let u;e[2]!==n?(u=n&&r.jsx("span",{"data-testid":"connection-dot",className:"absolute top-0 size-2 animate-[connection-shuttle_1.8s_var(--ease-in-out-cubic)_infinite_alternate] rounded-full bg-foreground"}),e[2]=n,e[3]=u):u=e[3];let o;e[4]!==u?(o=r.jsxs("span",{className:"relative flex h-2 w-16 items-center sm:w-20",children:[l,u]}),e[4]=u,e[5]=o):o=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground sm:size-12",children:r.jsx(Oi,{className:"size-5 sm:size-6"})}),e[6]=i):i=e[6];let c;return e[7]!==s||e[8]!==o?(c=r.jsxs("div",{"aria-hidden":"true","data-testid":"connection-wire","data-waiting":s,className:"flex items-center gap-2",children:[a,o,i]}),e[7]=s,e[8]=o,e[9]=c):c=e[9],c}function gl(t){const e=ue.c(22),{index:n,numbered:s,step:a,heading:l}=t,u=E.useId();let o;e[0]!==n||e[1]!==s?(o=s&&r.jsx("span",{"aria-hidden":"true",className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium tabular-nums text-foreground",children:n}),e[0]=n,e[1]=s,e[2]=o):o=e[2];let i;e[3]!==l||e[4]!==u||e[5]!==a.title?(i=r.jsx(l,{id:u,className:"text-sm font-medium text-foreground",children:a.title}),e[3]=l,e[4]=u,e[5]=a.title,e[6]=i):i=e[6];let c;e[7]!==o||e[8]!==i?(c=r.jsxs("div",{className:"flex items-center gap-3",children:[o,i]}),e[7]=o,e[8]=i,e[9]=c):c=e[9];const m=s&&"sm:pl-9";let f;e[10]!==m?(f=Fe("flex min-w-0 flex-col gap-3",m),e[10]=m,e[11]=f):f=e[11];let p;e[12]!==a.body?(p=a.body&&r.jsx("p",{className:"text-sm text-muted-foreground",children:a.body}),e[12]=a.body,e[13]=p):p=e[13];let k;e[14]!==a.after||e[15]!==f||e[16]!==p?(k=r.jsxs("div",{className:f,children:[p,a.after]}),e[14]=a.after,e[15]=f,e[16]=p,e[17]=k):k=e[17];let g;return e[18]!==u||e[19]!==c||e[20]!==k?(g=r.jsxs("li",{"aria-labelledby":u,className:"surface flex flex-col gap-3 p-4 sm:p-5",children:[c,k]}),e[18]=u,e[19]=c,e[20]=k,e[21]=g):g=e[21],g}const vl=[];function un(t){const e=ue.c(20),{title:n,lead:s,waiting:a,alerts:l,steps:u,footer:o,headingLevel:i}=t,c=u===void 0?vl:u,m=i===void 0?1:i,f=m===1?"h1":"h2",p=a&&c.length===0?"status":void 0;let k;e[0]!==a?(k=r.jsx(hl,{waiting:a}),e[0]=a,e[1]=k):k=e[1];let g;e[2]!==f||e[3]!==n?(g=r.jsx(f,{tabIndex:-1,className:"text-balance text-lg font-medium text-foreground outline-none sm:text-xl",children:n}),e[2]=f,e[3]=n,e[4]=g):g=e[4];let v;e[5]!==s?(v=s&&r.jsx("p",{className:"text-pretty text-sm text-muted-foreground",children:s}),e[5]=s,e[6]=v):v=e[6];let h;e[7]!==p||e[8]!==k||e[9]!==g||e[10]!==v?(h=r.jsxs("header",{role:p,className:"flex flex-col items-center gap-3 text-center",children:[k,g,v]}),e[7]=p,e[8]=k,e[9]=g,e[10]=v,e[11]=h):h=e[11];let x;e[12]!==m||e[13]!==c?(x=c.length>0&&r.jsx("ol",{className:"flex flex-col gap-3",children:c.map((b,w)=>r.jsx(gl,{index:w+1,numbered:c.length>1,step:b,heading:m===1?"h2":"h3"},b.title))}),e[12]=m,e[13]=c,e[14]=x):x=e[14];let C;return e[15]!==l||e[16]!==o||e[17]!==h||e[18]!==x?(C=r.jsx("div",{className:"h-full w-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-xl flex-col justify-center gap-6 px-4 py-8 sm:py-12",children:[h,l,x,o]})}),e[15]=l,e[16]=o,e[17]=h,e[18]=x,e[19]=C):C=e[19],C}function xl(t){const e=ue.c(43),{wait:n,hosts:s,invalidLink:a}=t,l=a===void 0?!1:a,u=Te();let o;e[0]!==l||e[1]!==u?(o=l&&r.jsx(ul,{variant:"warning",children:r.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[r.jsx(fl,{className:"line-clamp-none text-foreground",children:u("decoServe.link.invalidTitle")}),r.jsx(pl,{children:u("decoServe.link.invalidBody")})]})}),e[0]=l,e[1]=u,e[2]=o):o=e[2];const i=o;if(n.kind==="problem"){let w;e[3]!==u||e[4]!==n.host||e[5]!==n.problem?(w=Yo(u,n.problem,n.host),e[3]=u,e[4]=n.host,e[5]=n.problem,e[6]=w):w=e[6];const{title:N,body:j}=w;let P;e[7]!==j?(P=r.jsx(na,{text:j}),e[7]=j,e[8]=P):P=e[8];let S;e[9]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(ir,{className:"border-t border-border pt-4",links:["troubleshooting","serve"]}),e[9]=S):S=e[9];let R;return e[10]!==i||e[11]!==P||e[12]!==N?(R=r.jsx(un,{headingLevel:2,waiting:!1,title:N,lead:P,alerts:i,footer:S}),e[10]=i,e[11]=P,e[12]=N,e[13]=R):R=e[13],R}const c=n.kind==="looking",m=c&&!n.paused;let f;e[14]!==u?(f=u("decoServe.waiting.title"),e[14]=u,e[15]=f):f=e[15];let p;e[16]!==u?(p=u("decoServe.waiting.lead"),e[16]=u,e[17]=p):p=e[17];let k;e[18]!==i||e[19]!==n.kind?(k=(i||n.kind==="denied")&&r.jsxs(r.Fragment,{children:[i,n.kind==="denied"&&r.jsx(Qo,{})]}),e[18]=i,e[19]=n.kind,e[20]=k):k=e[20];let g;e[21]!==u?(g=u("decoServe.waiting.connect.title"),e[21]=u,e[22]=g):g=e[22];let v;e[23]!==u?(v=u("decoServe.waiting.connect.body"),e[23]=u,e[24]=v):v=e[24];let h;e[25]!==s||e[26]!==c||e[27]!==u||e[28]!==n.kind||e[29]!==n.onStart||e[30]!==n.paused?(h=n.kind==="needs-gesture"?r.jsx($e,{variant:"outline",className:"self-start",onClick:n.onStart,children:u("decoServe.guide.start")}):c&&r.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:n.paused?u("decoServe.guide.paused"):u("decoServe.guide.looking",{hosts:s})}),e[25]=s,e[26]=c,e[27]=u,e[28]=n.kind,e[29]=n.onStart,e[30]=n.paused,e[31]=h):h=e[31];let x;e[32]!==g||e[33]!==v||e[34]!==h?(x=[{title:g,body:v,after:h}],e[32]=g,e[33]=v,e[34]=h,e[35]=x):x=e[35];let C;e[36]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(ir,{className:"border-t border-border pt-4",links:["siteEditor","serve","troubleshooting"]}),e[36]=C):C=e[36];let b;return e[37]!==x||e[38]!==m||e[39]!==f||e[40]!==p||e[41]!==k?(b=r.jsx(un,{headingLevel:2,waiting:m,title:f,lead:p,alerts:k,steps:x,footer:C}),e[37]=x,e[38]=m,e[39]=f,e[40]=p,e[41]=k,e[42]=b):b=e[42],b}function bl(t,e){switch(t.kind){case"needs-permission":return{kind:"denied"};case"problem":return{kind:"problem",problem:t.problem,host:e};default:return{kind:"looking"}}}const wl=15e3,yl=3e3;function kl(t){const{candidates:e,probe:n,onFound:s,onChange:a,doc:l=document,setTimer:u=(w,N)=>setTimeout(w,N),clearTimer:o=w=>clearTimeout(w),timeoutMs:i=yl}=t;let c={status:"searching",firstRoundDone:!1,problem:null},m=!1,f=!1,p=0,k=null,g=null;const v=()=>l.visibilityState==="hidden",h=w=>{c={...c,...w},a(c)},x=async w=>{g=new AbortController;const N=g,j=u(()=>N.abort(),i);try{return await n(w,N.signal),!0}catch(P){if(m)return!1;const S=Gi(P);return S.reason!=="not-answering"?h({problem:{...S,endpoint:w}}):c.problem?.endpoint===w&&h({problem:null}),!1}finally{o(j),g=null}},C=async()=>{if(k=null,!(m||f)){if(e.length===0){h({status:"stopped",firstRoundDone:!0});return}if(v()){h({status:"paused"});return}f=!0,c.status!=="searching"&&h({status:"searching"});for(const w of e){if(m)break;if(await x(w)){if(f=!1,m)return;m=!0,l.removeEventListener("visibilitychange",b),h({status:"found",firstRoundDone:!0}),s(w);return}}if(f=!1,!m){if(p+=1,c.firstRoundDone||h({firstRoundDone:!0}),v()){h({status:"paused"});return}k=u(()=>{C()},qi(p,wl))}}};function b(){if(!m){if(v()){k!==null&&(o(k),k=null),f||h({status:"paused"});return}k!==null&&o(k),p=0,C()}}return l.addEventListener("visibilitychange",b),a(c),C(),()=>{m=!0,k!==null&&o(k),g?.abort(),l.removeEventListener("visibilitychange",b)}}function Sl(t,e){return Yi(Qi({endpoint:t,fetch:n=>fetch(n,{signal:e})}))}const Pl=["loopback-network","local-network-access"];async function jl(){if(Ji(window.location.origin))return null;for(const t of Pl)try{return await navigator.permissions.query({name:t})}catch{}return null}let ra=null,dr=!1;const Dn=new Set;function El(t){if(Dn.add(t),!dr){dr=!0;const e=n=>{ra=n;for(const s of Dn)s()};jl().then(n=>{if(!n)return e("unsupported");e(n.state),n.addEventListener("change",()=>e(n.state))})}return()=>Dn.delete(t)}const Nl={status:"stopped",firstRoundDone:!1,problem:null},Fn=new Map;function Tl(t){const e=Fn.get(t);if(e)return e;let n={status:"searching",firstRoundDone:!1,problem:null};const s=new Set;let a=null;const l={onFound:()=>{},getSnapshot:()=>n,subscribe:u=>(s.add(u),a??=kl({candidates:t.split(" "),probe:Sl,onFound:o=>l.onFound(o),onChange:o=>{n=o;for(const i of s)i()}}),()=>{s.delete(u),!(s.size>0)&&(a?.(),a=null,Fn.delete(t))})};return Fn.set(t,l),l}function aa(){return E.useSyncExternalStore(El,fr,fr)}const Cl=()=>()=>{},ur=()=>Nl,fr=()=>ra;function Gu(t){const e=ue.c(9),{candidates:n,onFound:s}=t,[a,l]=E.useState(!1),u=aa(),i=(u==="granted"||u==="unsupported"||u==="prompt"&&a)&&n.length>0;let c;e[0]!==i||e[1]!==n||e[2]!==s?(c=i?Tl(n.join(" ")):null,c&&(c.onFound=s),e[0]=i,e[1]=n,e[2]=s,e[3]=c):c=e[3];const m=E.useSyncExternalStore(c?.subscribe??Cl,c?.getSnapshot??ur,c?.getSnapshot??ur),f=u==="prompt"&&!a;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>l(!0),e[4]=p):p=e[4];let k;return e[5]!==u||e[6]!==m||e[7]!==f?(k={state:m,access:u,needsGesture:f,start:p},e[5]=u,e[6]=m,e[7]=f,e[8]=k):k=e[8],k}const pr={mode:"none",iframeBase:null,showBlockingOverlay:!1,showWakingPill:!1};function Rl(t){const{previewState:e,progressStatus:n,fastPreviewActive:s=!1,fastPreviewReady:a=!1,codingSession:l=!1,hostedDraft:u=!1}=t,o=l?null:t.previewServerUrl;return t.localPreviewUrl?{mode:"sandbox",iframeBase:t.localPreviewUrl,showBlockingOverlay:!1,showWakingPill:!1}:e.kind==="suspended"||e.kind==="errored"?pr:u&&t.hostedPointerPending&&!a?{...pr,showDecidingLoader:!0}:s&&a&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:s&&u&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:!s&&e.kind==="iframe"&&n!=="doing"?{mode:"sandbox",iframeBase:e.previewUrl,showBlockingOverlay:!1,showWakingPill:!1}:o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!0}:{mode:"none",iframeBase:null,showBlockingOverlay:!0,showWakingPill:!1}}const Ll=1e4,Al=1e3,_l=3e4;function Ol({iframeRef:t,src:e,active:n}){const s=E.useRef(0),a=E.useRef(null),l=E.useRef(null),u=E.useRef(e),o=E.useRef(n);u.current=e,o.current=n;const i=()=>{a.current&&clearTimeout(a.current),l.current&&clearTimeout(l.current),a.current=null,l.current=null},c=()=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m()},Ll)},m=()=>{if(!o.current||!u.current)return;l.current&&clearTimeout(l.current);const k=ni(_l,Al,s.current,2,.5);s.current+=1,l.current=setTimeout(()=>{l.current=null;const g=t.current,v=u.current;!g||!v||!o.current||(g.src=v,c())},k)},f=()=>{s.current=0,i()},p=()=>{a.current&&(clearTimeout(a.current),a.current=null),m()};return E.useEffect(()=>{if(i(),s.current=0,!(!n||!e))return c(),i},[e,n]),{handleLoad:f,handleError:p}}const Dl=1500,Fl=500;function $l({iframe:t,reload:e,waitMs:n=Dl,confirmMs:s=Fl}){let a;const l=()=>{clearTimeout(u),a=setTimeout(e,s)};t.addEventListener("load",l,{once:!0});const u=setTimeout(()=>{t.removeEventListener("load",l),e()},n);return()=>{clearTimeout(u),clearTimeout(a),t.removeEventListener("load",l)}}const Bl=cn({tag:De(),id:De(),classes:De(),text:De(),html:De(),manifestKey:De().nullable(),componentName:De().nullable(),parents:De(),url:De(),path:De(),viewport:cn({width:ct(),height:ct()}),position:cn({x:ct(),y:ct()})}),Ml=`(function() {
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-DbbjUxTa.js","assets/index-CSIpvoWn.js","assets/index-CKEKSTrk.css","assets/chat-context-B8Z5vGcJ.js","assets/autosend-BWmOY3ov.js","assets/thread-route-gjL8sFh9.js","assets/use-project-scope-D-D3vFqs.js","assets/repository-binding-lATwNZrT.js","assets/use-mcp-client-C6kW4vbD.js","assets/auth-I4p8-ocC.js","assets/thread-intent-BirCtYTn.js","assets/delay-CnY5UFtP.js","assets/watch-sse-pool-D6Aszef8.js","assets/task-board-DSsXkzaF.js","assets/schema-CYb0A5pZ.js","assets/use-entitlements-BIn3vhw_.js","assets/use-ai-providers-CGSjFpU8.js","assets/use-decopilot-events-MFonZFqV.js","assets/use-organization-settings-BTar9wUH.js","assets/parse-sections-y55_dTHG.js","assets/utils-1rHoZRD5.js","assets/agent-icon-DKTp0XyY.js","assets/AlertCircle-DSTgjQZE.js","assets/Tool01-U3lMqDqt.js","assets/ArrowUp-BNjQS3K-.js","assets/ArrowLeft-ENfdZA7-.js","assets/LinkBroken01-DWhYckSm.js","assets/ShoppingBag01-CsD1bZL0.js","assets/Globe04-cXNn3Iwb.js","assets/CheckCircle-B5oyaJit.js","assets/ChevronUp-CWpA2uR_.js","assets/ChevronSelectorVertical-D9X2NrqX.js","assets/UserSquare-BItoQb26.js","assets/CreditCard01-DUDVRgSi.js","assets/SwitchHorizontal01-omZLJ9y8.js","assets/Key01-DykOvg3J.js","assets/Minus-DD8EF-Qg.js","assets/Monitor01-Brx479PM.js","assets/Sun-qBi61vDS.js","assets/Play-Cnv-o711.js","assets/Plus-Cyljarjx.js","assets/SearchMd-B8lLWvFT.js","assets/Trash01-BbqimkDt.js","assets/Upload01-CKgAWfXR.js","assets/Users01-C6CsMI-H.js","assets/XClose-B0OqPlIT.js","assets/Zap-FLVG2fHK.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/pair-CCa5vpj1.js","assets/collapsible-DFsZxhwL.js","assets/use-copy-B7Ns5hk7.js","assets/usage-stats-8fBPxKmN.js","assets/tool-namespace-BPtJyOTH.js","assets/form-dOKUm1o9.js","assets/label-ceAH5i3J.js","assets/utils-CVEq3hMx.js","assets/markdown-R4HS4rag.js","assets/use-mobile-Dl5gc-ru.js","assets/tooltip-BS3U7s1j.js","assets/index-e0iOUxAj.js","assets/shell-layout-BE-F-e8S.js","assets/use-deployment-admin-Dpt106eE.js","assets/admin-fetch-BhTJlAsX.js","assets/command-uMdfud6o.js","assets/index-BoutsVvy.js","assets/integration-icon-dTPy2b7i.js","assets/project-icon-MnmUeo9G.js","assets/use-navigate-to-agent-B5ZbLCUr.js","assets/use-debounced-value-_GKTwOmp.js","assets/new-project-dialog-CIVKu-7h.js","assets/repository-picker-C4hJc23I.js","assets/github-icon-D5i5T8iF.js","assets/useInfiniteQuery-Bh3c89Tr.js","assets/infiniteQueryObserver-CgO-7OwI.js","assets/collection-search-Bhx5TJ6L.js","assets/required-auth-layout-C3gt0jrF.js","assets/use-org-sso-CwVEWYSS.js","assets/shell-layout-CE2Eihra.css","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-BhX-TA45.js","assets/types-BzcfuN64.js","assets/omit-server-managed-metadata-L5IhjRZB.js","assets/sheet-DO79DyVm.js","assets/use-connection-Br1r8foQ.js","assets/use-mcp-prompts-CjpO3wzS.js","assets/use-thread-outputs-St6ye3b1.js","assets/file-type-icon-C_NX_6K0.js","assets/section-array-field-C_pqbrT4.js","assets/blocks-tab-states-C3vtkrE6.js","assets/site-editor-toast-hszpYNCy.js","assets/use-voice-input-B9rrFwaR.js","assets/popover-DvNPDyrT.js","assets/drawer-C6lamT3y.js","assets/index-CmbhAzcu.js","assets/checkbox-BprzbiMO.js","assets/select-5VAmllhJ.js","assets/index-BdQq_4o_.js","assets/ai-providers-logos-DD3qZ33J.js","assets/openai-compatible-presets-BKGfVqEx.js","assets/use-blocks-v8-project-C468EFq8.js","assets/sandbox-url-D3mC8qhT.js","assets/use-sandbox-events-D2qF_K2w.js","assets/sandbox-git-api-DcqI6XE4.js","assets/empty-state-DM7xlu-4.js","assets/hosted-reconcile-BdQaV1pW.js","assets/slider-ShXfqPv2.js","assets/index-DADVzh-A.js","assets/tooltipContext-BLujWWNh.js","assets/CategoricalChart-BvoSRMBa.js","assets/index-FggPcfHb.js","assets/switch-DXYVQM5M.js","assets/textarea-jvxCA8mN.js","assets/scroll-area-C2kqOV3G.js","assets/monaco-editor-COXw9tpM.js","assets/editor-C7RxjaWr.js","assets/calendar-CWxLf6uz.js","assets/editor-classes-B55y9L5n.js","assets/core.esm-BKNJrrxU.js","assets/sortable.esm-CuHm_9IF.js","assets/toggle-group-BkFB4B6f.js","assets/active-indicator-CCMhAsc_.js","assets/combobox-BmbiPO09.js","assets/search-input-D2_G90x-.js","assets/tabs-Cv20SIqi.js","assets/use-file-configs-B7N8jort.js","assets/asset-utils-C8aDDKpg.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/mustache-R0EQOelB.js","assets/use-section-preview-base-BQcFctze.js","assets/seo-editor-BToxCPgQ.js","assets/use-apply-named-rule-CpJPkStL.js","assets/use-move-blocks-Ce0Kig2N.js","assets/variant-matcher-override-CtOZ7RsB.js"])))=>i.map(i=>d[i]);
2
+ import{c as ue,j as r,r as E,m as Fe,b as Te,B as $e,a3 as ni,aF as cn,b4 as ct,aG as De,b5 as si,b6 as ri,b7 as ai,b8 as ii,v as Pr,D as jr,K as Gn,w as Er,x as Nr,e as oi,h as gt,I as Mn,y as li,b9 as ci,a5 as Jn,aZ as di,b2 as ui,i as Tr,ar as Un,at as In,a8 as Cr,P as zn,E as fi,t as dn,b3 as pi,q as mi}from"./index-CSIpvoWn.js";import{u as Rr,g as hi,c as Gs,B as Rn,P as gi,r as vi,R as xi,a as bi,H as wi,b as Lr,S as yi,d as ki,l as Si,m as Pi,p as ji,e as Ei,f as Ln,N as Ni}from"./parse-sections-y55_dTHG.js";import{b as Ti,c as Mt,r as Ar,l as _r,f as Ci,g as Ri,w as Li}from"./chat-context-B8Z5vGcJ.js";import{t as Ai}from"./ChevronUp-CWpA2uR_.js";import{P as _i,Q as Oi,J as Or,R as Di,S as Fi,b as $i,T as Bi,U as Dr,V as Mi,W as Fr,X as Js,Y as Ui}from"./agent-icon-DKTp0XyY.js";import{a as Ii,n as zi}from"./UserSquare-BItoQb26.js";import{s as $r}from"./Plus-Cyljarjx.js";import{a as Br,b as Mr,P as Ur}from"./popover-DvNPDyrT.js";import{e as dt,b as ut,c as Ir,f as zr,a as Kr,C as Hr}from"./command-uMdfud6o.js";import{b as Ki,c as Hi,u as Vi}from"./repository-binding-lATwNZrT.js";import{a as Ut}from"./sandbox-lifecycle-context-ezRldKto.js";import{r as Wi}from"./thread-intent-BirCtYTn.js";import{u as Vr}from"./use-voice-input-B9rrFwaR.js";import{d as qi,f as Gi,i as Ji,g as Yi,h as Qi,j as Xi,k as Zi,u as fn,l as Yn,m as Xe,n as eo,o as Wr,q as to,t as no,v as so,w as qr,x as ro,c as Gr,b as Jr,y as ao,z as He,A as io,B as oo,C as lo,D as co,E as uo,F as fo,G as Ys,H as po,I as Qs,J as mo,K as ho,L as Xs,M as Zs,N as er,O as tr,P as nr,Q as An,R as go,S as vo,U as xo,V as bo,W as wo,e as yo}from"./site-editor-toast-hszpYNCy.js";import{u as Yr}from"./use-mobile-Dl5gc-ru.js";import{T as pt,a as mt,c as ht}from"./tooltip-BS3U7s1j.js";import{T as Ze}from"./toolbar-icon-button-DWxNo-CH.js";import{w as nn,i as ko}from"./variant-matcher-override-CtOZ7RsB.js";import{s as Bt,n as Qn,a as Qr,f as Ve,v as Xr,u as Zr,h as So,i as Po,B as jo,S as Eo,C as No,b as To,e as Co,c as Ro,d as Lo,N as Ao,g as _o,r as Oo,j as Do,k as sr,p as Fo}from"./blocks-tab-states-C3vtkrE6.js";import{u as $o}from"./use-fast-preview-draft-url-Btcix_Th.js";import{g as Bo}from"./section-array-field-C_pqbrT4.js";import{g as Mo,l as ea}from"./shell-layout-BE-F-e8S.js";import{u as Xn,b as Uo}from"./use-sandbox-events-D2qF_K2w.js";import{u as Kn}from"./useQueries-H5rWlyEJ.js";import{i as Io}from"./LinkBroken01-DWhYckSm.js";import{u as ta}from"./blocks-preview-workspace-context-C8dnQCV5.js";import{MonacoCodeEditor as zo}from"./monaco-editor-COXw9tpM.js";import{c as Ko,u as Ho,i as Vo,l as Wo,D as qo}from"./hosted-reconcile-BdQaV1pW.js";import{d as Go}from"./utils-1rHoZRD5.js";import{R as rr,a as sn,b as ar}from"./resizable-BOUBAwD3.js";import{u as Jo}from"./use-blocks-v8-project-C468EFq8.js";import{s as Yo,L as Qo,R as na,D as ir,w as Hn}from"./device-hint-Ce3veXZo.js";import{L as Xo}from"./label-ceAH5i3J.js";import{a as Zo,T as or}from"./toggle-group-BkFB4B6f.js";import{b as el}from"./sandbox-url-D3mC8qhT.js";import{r as tl,R as nl}from"./virtual-mcp-o7wxm5IS.js";import{d as sl}from"./delay-CnY5UFtP.js";import{s as sa}from"./XClose-B0OqPlIT.js";import{o as rl}from"./omit-server-managed-metadata-L5IhjRZB.js";import{a as _n,b as al,w as il,n as lr}from"./app-preview-url-9Od4s8Sz.js";import{a as ol}from"./use-organization-settings-BTar9wUH.js";import{a as On}from"./agent-capabilities-DOVKnykH.js";import{E as ll}from"./empty-state-DM7xlu-4.js";import{G as cr}from"./github-icon-D5i5T8iF.js";import{R as cl}from"./new-project-dialog-CIVKu-7h.js";import{r as dl}from"./preview-source-BsRLGWUP.js";import{A as ul,a as fl,b as pl}from"./alert-Bvpz2H4v.js";import{u as ml}from"./use-task-metadata-DsDxaplE.js";function hl(t){const e=ue.c(10),{waiting:n}=t,s=n?"true":"false";let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("span",{className:"flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground sm:size-12",children:r.jsx(_i,{className:"size-5 sm:size-6"})}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=r.jsx("span",{className:"h-px w-full border-t border-dashed border-muted-foreground/40"}),e[1]=l):l=e[1];let u;e[2]!==n?(u=n&&r.jsx("span",{"data-testid":"connection-dot",className:"absolute top-0 size-2 animate-[connection-shuttle_1.8s_var(--ease-in-out-cubic)_infinite_alternate] rounded-full bg-foreground"}),e[2]=n,e[3]=u):u=e[3];let o;e[4]!==u?(o=r.jsxs("span",{className:"relative flex h-2 w-16 items-center sm:w-20",children:[l,u]}),e[4]=u,e[5]=o):o=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx("span",{className:"flex size-10 items-center justify-center rounded-xl bg-muted text-muted-foreground sm:size-12",children:r.jsx(Oi,{className:"size-5 sm:size-6"})}),e[6]=i):i=e[6];let c;return e[7]!==s||e[8]!==o?(c=r.jsxs("div",{"aria-hidden":"true","data-testid":"connection-wire","data-waiting":s,className:"flex items-center gap-2",children:[a,o,i]}),e[7]=s,e[8]=o,e[9]=c):c=e[9],c}function gl(t){const e=ue.c(22),{index:n,numbered:s,step:a,heading:l}=t,u=E.useId();let o;e[0]!==n||e[1]!==s?(o=s&&r.jsx("span",{"aria-hidden":"true",className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium tabular-nums text-foreground",children:n}),e[0]=n,e[1]=s,e[2]=o):o=e[2];let i;e[3]!==l||e[4]!==u||e[5]!==a.title?(i=r.jsx(l,{id:u,className:"text-sm font-medium text-foreground",children:a.title}),e[3]=l,e[4]=u,e[5]=a.title,e[6]=i):i=e[6];let c;e[7]!==o||e[8]!==i?(c=r.jsxs("div",{className:"flex items-center gap-3",children:[o,i]}),e[7]=o,e[8]=i,e[9]=c):c=e[9];const m=s&&"sm:pl-9";let f;e[10]!==m?(f=Fe("flex min-w-0 flex-col gap-3",m),e[10]=m,e[11]=f):f=e[11];let p;e[12]!==a.body?(p=a.body&&r.jsx("p",{className:"text-sm text-muted-foreground",children:a.body}),e[12]=a.body,e[13]=p):p=e[13];let k;e[14]!==a.after||e[15]!==f||e[16]!==p?(k=r.jsxs("div",{className:f,children:[p,a.after]}),e[14]=a.after,e[15]=f,e[16]=p,e[17]=k):k=e[17];let g;return e[18]!==u||e[19]!==c||e[20]!==k?(g=r.jsxs("li",{"aria-labelledby":u,className:"surface flex flex-col gap-3 p-4 sm:p-5",children:[c,k]}),e[18]=u,e[19]=c,e[20]=k,e[21]=g):g=e[21],g}const vl=[];function un(t){const e=ue.c(20),{title:n,lead:s,waiting:a,alerts:l,steps:u,footer:o,headingLevel:i}=t,c=u===void 0?vl:u,m=i===void 0?1:i,f=m===1?"h1":"h2",p=a&&c.length===0?"status":void 0;let k;e[0]!==a?(k=r.jsx(hl,{waiting:a}),e[0]=a,e[1]=k):k=e[1];let g;e[2]!==f||e[3]!==n?(g=r.jsx(f,{tabIndex:-1,className:"text-balance text-lg font-medium text-foreground outline-none sm:text-xl",children:n}),e[2]=f,e[3]=n,e[4]=g):g=e[4];let v;e[5]!==s?(v=s&&r.jsx("p",{className:"text-pretty text-sm text-muted-foreground",children:s}),e[5]=s,e[6]=v):v=e[6];let h;e[7]!==p||e[8]!==k||e[9]!==g||e[10]!==v?(h=r.jsxs("header",{role:p,className:"flex flex-col items-center gap-3 text-center",children:[k,g,v]}),e[7]=p,e[8]=k,e[9]=g,e[10]=v,e[11]=h):h=e[11];let x;e[12]!==m||e[13]!==c?(x=c.length>0&&r.jsx("ol",{className:"flex flex-col gap-3",children:c.map((b,w)=>r.jsx(gl,{index:w+1,numbered:c.length>1,step:b,heading:m===1?"h2":"h3"},b.title))}),e[12]=m,e[13]=c,e[14]=x):x=e[14];let C;return e[15]!==l||e[16]!==o||e[17]!==h||e[18]!==x?(C=r.jsx("div",{className:"h-full w-full overflow-y-auto",children:r.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-xl flex-col justify-center gap-6 px-4 py-8 sm:py-12",children:[h,l,x,o]})}),e[15]=l,e[16]=o,e[17]=h,e[18]=x,e[19]=C):C=e[19],C}function xl(t){const e=ue.c(43),{wait:n,hosts:s,invalidLink:a}=t,l=a===void 0?!1:a,u=Te();let o;e[0]!==l||e[1]!==u?(o=l&&r.jsx(ul,{variant:"warning",children:r.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[r.jsx(fl,{className:"line-clamp-none text-foreground",children:u("decoServe.link.invalidTitle")}),r.jsx(pl,{children:u("decoServe.link.invalidBody")})]})}),e[0]=l,e[1]=u,e[2]=o):o=e[2];const i=o;if(n.kind==="problem"){let w;e[3]!==u||e[4]!==n.host||e[5]!==n.problem?(w=Yo(u,n.problem,n.host),e[3]=u,e[4]=n.host,e[5]=n.problem,e[6]=w):w=e[6];const{title:N,body:j}=w;let P;e[7]!==j?(P=r.jsx(na,{text:j}),e[7]=j,e[8]=P):P=e[8];let S;e[9]===Symbol.for("react.memo_cache_sentinel")?(S=r.jsx(ir,{className:"border-t border-border pt-4",links:["troubleshooting","serve"]}),e[9]=S):S=e[9];let R;return e[10]!==i||e[11]!==P||e[12]!==N?(R=r.jsx(un,{headingLevel:2,waiting:!1,title:N,lead:P,alerts:i,footer:S}),e[10]=i,e[11]=P,e[12]=N,e[13]=R):R=e[13],R}const c=n.kind==="looking",m=c&&!n.paused;let f;e[14]!==u?(f=u("decoServe.waiting.title"),e[14]=u,e[15]=f):f=e[15];let p;e[16]!==u?(p=u("decoServe.waiting.lead"),e[16]=u,e[17]=p):p=e[17];let k;e[18]!==i||e[19]!==n.kind?(k=(i||n.kind==="denied")&&r.jsxs(r.Fragment,{children:[i,n.kind==="denied"&&r.jsx(Qo,{})]}),e[18]=i,e[19]=n.kind,e[20]=k):k=e[20];let g;e[21]!==u?(g=u("decoServe.waiting.connect.title"),e[21]=u,e[22]=g):g=e[22];let v;e[23]!==u?(v=u("decoServe.waiting.connect.body"),e[23]=u,e[24]=v):v=e[24];let h;e[25]!==s||e[26]!==c||e[27]!==u||e[28]!==n.kind||e[29]!==n.onStart||e[30]!==n.paused?(h=n.kind==="needs-gesture"?r.jsx($e,{variant:"outline",className:"self-start",onClick:n.onStart,children:u("decoServe.guide.start")}):c&&r.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:n.paused?u("decoServe.guide.paused"):u("decoServe.guide.looking",{hosts:s})}),e[25]=s,e[26]=c,e[27]=u,e[28]=n.kind,e[29]=n.onStart,e[30]=n.paused,e[31]=h):h=e[31];let x;e[32]!==g||e[33]!==v||e[34]!==h?(x=[{title:g,body:v,after:h}],e[32]=g,e[33]=v,e[34]=h,e[35]=x):x=e[35];let C;e[36]===Symbol.for("react.memo_cache_sentinel")?(C=r.jsx(ir,{className:"border-t border-border pt-4",links:["siteEditor","serve","troubleshooting"]}),e[36]=C):C=e[36];let b;return e[37]!==x||e[38]!==m||e[39]!==f||e[40]!==p||e[41]!==k?(b=r.jsx(un,{headingLevel:2,waiting:m,title:f,lead:p,alerts:k,steps:x,footer:C}),e[37]=x,e[38]=m,e[39]=f,e[40]=p,e[41]=k,e[42]=b):b=e[42],b}function bl(t,e){switch(t.kind){case"needs-permission":return{kind:"denied"};case"problem":return{kind:"problem",problem:t.problem,host:e};default:return{kind:"looking"}}}const wl=15e3,yl=3e3;function kl(t){const{candidates:e,probe:n,onFound:s,onChange:a,doc:l=document,setTimer:u=(w,N)=>setTimeout(w,N),clearTimer:o=w=>clearTimeout(w),timeoutMs:i=yl}=t;let c={status:"searching",firstRoundDone:!1,problem:null},m=!1,f=!1,p=0,k=null,g=null;const v=()=>l.visibilityState==="hidden",h=w=>{c={...c,...w},a(c)},x=async w=>{g=new AbortController;const N=g,j=u(()=>N.abort(),i);try{return await n(w,N.signal),!0}catch(P){if(m)return!1;const S=Gi(P);return S.reason!=="not-answering"?h({problem:{...S,endpoint:w}}):c.problem?.endpoint===w&&h({problem:null}),!1}finally{o(j),g=null}},C=async()=>{if(k=null,!(m||f)){if(e.length===0){h({status:"stopped",firstRoundDone:!0});return}if(v()){h({status:"paused"});return}f=!0,c.status!=="searching"&&h({status:"searching"});for(const w of e){if(m)break;if(await x(w)){if(f=!1,m)return;m=!0,l.removeEventListener("visibilitychange",b),h({status:"found",firstRoundDone:!0}),s(w);return}}if(f=!1,!m){if(p+=1,c.firstRoundDone||h({firstRoundDone:!0}),v()){h({status:"paused"});return}k=u(()=>{C()},qi(p,wl))}}};function b(){if(!m){if(v()){k!==null&&(o(k),k=null),f||h({status:"paused"});return}k!==null&&o(k),p=0,C()}}return l.addEventListener("visibilitychange",b),a(c),C(),()=>{m=!0,k!==null&&o(k),g?.abort(),l.removeEventListener("visibilitychange",b)}}function Sl(t,e){return Yi(Qi({endpoint:t,fetch:n=>fetch(n,{signal:e})}))}const Pl=["loopback-network","local-network-access"];async function jl(){if(Ji(window.location.origin))return null;for(const t of Pl)try{return await navigator.permissions.query({name:t})}catch{}return null}let ra=null,dr=!1;const Dn=new Set;function El(t){if(Dn.add(t),!dr){dr=!0;const e=n=>{ra=n;for(const s of Dn)s()};jl().then(n=>{if(!n)return e("unsupported");e(n.state),n.addEventListener("change",()=>e(n.state))})}return()=>Dn.delete(t)}const Nl={status:"stopped",firstRoundDone:!1,problem:null},Fn=new Map;function Tl(t){const e=Fn.get(t);if(e)return e;let n={status:"searching",firstRoundDone:!1,problem:null};const s=new Set;let a=null;const l={onFound:()=>{},getSnapshot:()=>n,subscribe:u=>(s.add(u),a??=kl({candidates:t.split(" "),probe:Sl,onFound:o=>l.onFound(o),onChange:o=>{n=o;for(const i of s)i()}}),()=>{s.delete(u),!(s.size>0)&&(a?.(),a=null,Fn.delete(t))})};return Fn.set(t,l),l}function aa(){return E.useSyncExternalStore(El,fr,fr)}const Cl=()=>()=>{},ur=()=>Nl,fr=()=>ra;function Gu(t){const e=ue.c(9),{candidates:n,onFound:s}=t,[a,l]=E.useState(!1),u=aa(),i=(u==="granted"||u==="unsupported"||u==="prompt"&&a)&&n.length>0;let c;e[0]!==i||e[1]!==n||e[2]!==s?(c=i?Tl(n.join(" ")):null,c&&(c.onFound=s),e[0]=i,e[1]=n,e[2]=s,e[3]=c):c=e[3];const m=E.useSyncExternalStore(c?.subscribe??Cl,c?.getSnapshot??ur,c?.getSnapshot??ur),f=u==="prompt"&&!a;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>l(!0),e[4]=p):p=e[4];let k;return e[5]!==u||e[6]!==m||e[7]!==f?(k={state:m,access:u,needsGesture:f,start:p},e[5]=u,e[6]=m,e[7]=f,e[8]=k):k=e[8],k}const pr={mode:"none",iframeBase:null,showBlockingOverlay:!1,showWakingPill:!1};function Rl(t){const{previewState:e,progressStatus:n,fastPreviewActive:s=!1,fastPreviewReady:a=!1,codingSession:l=!1,hostedDraft:u=!1}=t,o=l?null:t.previewServerUrl;return t.localPreviewUrl?{mode:"sandbox",iframeBase:t.localPreviewUrl,showBlockingOverlay:!1,showWakingPill:!1}:e.kind==="suspended"||e.kind==="errored"?pr:u&&t.hostedPointerPending&&!a?{...pr,showDecidingLoader:!0}:s&&a&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:s&&u&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:!s&&e.kind==="iframe"&&n!=="doing"?{mode:"sandbox",iframeBase:e.previewUrl,showBlockingOverlay:!1,showWakingPill:!1}:o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!0}:{mode:"none",iframeBase:null,showBlockingOverlay:!0,showWakingPill:!1}}const Ll=1e4,Al=1e3,_l=3e4;function Ol({iframeRef:t,src:e,active:n}){const s=E.useRef(0),a=E.useRef(null),l=E.useRef(null),u=E.useRef(e),o=E.useRef(n);u.current=e,o.current=n;const i=()=>{a.current&&clearTimeout(a.current),l.current&&clearTimeout(l.current),a.current=null,l.current=null},c=()=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m()},Ll)},m=()=>{if(!o.current||!u.current)return;l.current&&clearTimeout(l.current);const k=ni(_l,Al,s.current,2,.5);s.current+=1,l.current=setTimeout(()=>{l.current=null;const g=t.current,v=u.current;!g||!v||!o.current||(g.src=v,c())},k)},f=()=>{s.current=0,i()},p=()=>{a.current&&(clearTimeout(a.current),a.current=null),m()};return E.useEffect(()=>{if(i(),s.current=0,!(!n||!e))return c(),i},[e,n]),{handleLoad:f,handleError:p}}const Dl=1500,Fl=500;function $l({iframe:t,reload:e,waitMs:n=Dl,confirmMs:s=Fl}){let a;const l=()=>{clearTimeout(u),a=setTimeout(e,s)};t.addEventListener("load",l,{once:!0});const u=setTimeout(()=>{t.removeEventListener("load",l),e()},n);return()=>{clearTimeout(u),clearTimeout(a),t.removeEventListener("load",l)}}const Bl=cn({tag:De(),id:De(),classes:De(),text:De(),html:De(),manifestKey:De().nullable(),componentName:De().nullable(),parents:De(),url:De(),path:De(),viewport:cn({width:ct(),height:ct()}),position:cn({x:ct(),y:ct()})}),Ml=`(function() {
3
3
  if (window.__visualEditorActive) return;
4
4
  window.__visualEditorActive = true;
5
5
 
@@ -548,4 +548,4 @@ import{c as ue,j as r,r as E,m as Fe,b as Te,B as $e,a3 as ni,aF as cn,b4 as ct,
548
548
  }
549
549
  });
550
550
  })();`,rn=Object.freeze({ready:"deco:ready",load:"deco:load",loaded:"deco:loaded",loadError:"deco:load-error"}),Kl="v1",Hl="/studio-modules",$n=["wireframe","html-swap"];function Vl(t,e,n){const s=new URL(`${Hl}/${Kl}/${e}.js`,t);return n&&s.searchParams.set("build",n),s.href}const Wl=2e3;class ql{constructor(e){this.options=e,this.urls=Object.fromEntries($n.map(n=>[n,Vl(e.studioOrigin,n,e.build)]))}options;origin=null;urls;loaded=new Set;swapId=0;pendingSwap=null;startTimer=null;has(e){return this.loaded.has(e)}handle(e){const n=this.options.frame();if(!n||e.source!==n)return!1;const s=e.data;if(!s||typeof s.type!="string")return!1;if(s.type===rn.ready)return Gl(e.origin)?(this.ready(e.origin),!0):!1;if(e.origin!==this.origin)return!1;const a=s;switch(a.type){case rn.loaded:{const l=this.nameOf(a.url);return l&&(this.loaded.add(l),this.options.onModulesChange?.(),l==="wireframe"&&this.options.onWireframeReady?.()),!0}case rn.loadError:{const l=this.nameOf(a.url);return l&&this.loaded.delete(l)&&this.options.onModulesChange?.(),l==="html-swap"&&this.failSwap(),!0}case"wireframe:hover":case"wireframe:select":return this.options.onWireframe?.(a),!0;case"html-swap:start":return this.pendingSwap?.id===a.id&&(this.pendingSwap.started=!0,this.clearStartTimer()),!0;case"html-swap:end":return this.pendingSwap?.id!==a.id||(this.pendingSwap=null,this.clearStartTimer(),this.options.onSwapEnd?.()),!0;case"html-swap:error":return this.pendingSwap?.id===a.id&&this.failSwap(),!0;default:return!1}}wireframe(e){return this.post("wireframe",e)}refresh(e){if(e!==void 0&&!this.isFrameOrigin(e))return!1;const n=++this.swapId,s=e?{type:"html-swap:refresh",id:n,url:e}:{type:"html-swap:refresh",id:n};return this.post("html-swap",s)?(this.pendingSwap={id:n,started:!1},this.clearStartTimer(),this.startTimer=setTimeout(()=>{this.startTimer=null,this.pendingSwap?.id===n&&!this.pendingSwap.started&&this.failSwap()},Wl),!0):!1}dispose(){this.clearStartTimer(),this.pendingSwap=null,this.loaded.clear(),this.origin=null}ready(e){this.origin=e,this.loaded.size&&(this.loaded.clear(),this.options.onModulesChange?.()),this.pendingSwap&&(this.pendingSwap=null,this.clearStartTimer(),this.options.onSwapEnd?.());const n=this.options.frame();for(const s of $n)n?.postMessage({type:rn.load,url:this.urls[s]},e)}post(e,n){const s=this.options.frame();return!s||!this.origin||!this.loaded.has(e)?!1:(s.postMessage(n,this.origin),!0)}isFrameOrigin(e){try{return new URL(e).origin===this.origin}catch{return!1}}nameOf(e){return $n.find(n=>this.urls[n]===e)??null}failSwap(){this.clearStartTimer(),this.pendingSwap&&(this.pendingSwap=null,this.options.onSwapFailed?.())}clearStartTimer(){this.startTimer&&clearTimeout(this.startTimer),this.startTimer=null}}function Gl(t){if(typeof t!="string"||t==="null")return!1;try{const e=new URL(t).origin;return e!=="null"&&e===t}catch{return!1}}function Vn(t,e,n=!1){let s=t,a=typeof s?.__resolveType=="string"?s.__resolveType:"";for(let l=0;a&&l<5;l++){const u=e[a];if(u&&typeof u=="object"&&"__resolveType"in u){const o=u.__resolveType;if(typeof o=="string"&&o&&o!==a){s=u,a=o;continue}}break}if(!a)return[];if(a.includes("flags/multivariate")||n&&si(a,n)){const l=Array.isArray(s.variants)?s.variants:[];if(l.length===0||l.every(i=>{const c=i?.rule;return ri(c?.__resolveType,n)}))return null;const o=[];for(const i of l){const c=ai(i,n);if(c&&typeof c=="object")for(const m of Vn(c,e,n)??[])o.includes(m)||o.push(m)}return o}if(ii(a)){const l=s.section&&typeof s.section=="object"?Vn(s.section,e,n):[];return l===null?null:l.length?[a,...l]:[a]}return[a]}function lt(t){return t.replace(/[`*_]/g,"\\$&")}function Jl(t,e){const n=[`The user selected an element on the live preview and asked: **"${lt(e.trim())}"**`,"","For text content changes, locate the correct source file and apply the change.","For code and CSS changes, understand which component the user is referring to and apply changes to the correct component.",""];t.manifestKey&&n.push(`**Section resolveType:** \`${lt(t.manifestKey)}\``,"","This is a Deco resolveType, not a literal file path. The leading segment is the app name, not a directory — the actual source file lives under a sections directory whose root varies by site (commonly `sections/`, `src/sections/`, or `site/sections/`). Locate the file by searching for the trailing path (e.g. the component filename), don't assume the resolveType is a valid path on disk.","");const s=`<${t.tag}${t.classes?` class="${lt(t.classes)}"`:""}>`;n.push(`**Clicked element:** \`${s}\``),t.parents&&n.push(`**DOM breadcrumb:** ${lt(t.parents)} > ${t.tag}`),t.text&&n.push(`**Text content:** "${lt(t.text)}"`),t.componentName&&n.push(`**Component name:** ${lt(t.componentName)}`);const a=t.html.replace(/```/g,"`` `");return n.push("","**HTML snippet:**","```html",a,"```"),n.push("","Please read the source file, locate the element, and apply the requested change."),n.join(`
551
- `)}function Yl(t,e,n=320,s=44,a=12){const{x:l,y:u}=t,{width:o,height:i}=e,c=Math.max(a,Math.min(l-n/2,o-n-a)),f=u/i>.68?Math.max(a,u-s-18):Math.min(u+18,i-s-a);return{leftPct:c/o*100,topPct:f/i*100}}function Ql(t){const e=ue.c(45),{element:n,onDismiss:s}=t,[a,l]=E.useState(""),u=E.useRef(null),{sendMessage:o}=Ti(),{openSidePanel:i}=Mo(),c=Te();let m;e[0]!==n||e[1]!==a||e[2]!==s||e[3]!==i||e[4]!==o?(m=()=>{if(!a.trim())return;const K=Jl(n,a);i(),o({parts:[{type:"text",text:K}]}),s()},e[0]=n,e[1]=a,e[2]=s,e[3]=i,e[4]=o,e[5]=m):m=e[5];const f=m;let p;e[6]!==n.position||e[7]!==n.viewport?(p=Yl(n.position,n.viewport),e[6]=n.position,e[7]=n.viewport,e[8]=p):p=e[8];const k=p,g=`${k.leftPct}%`,v=`${k.topPct}%`;let h;e[9]!==g||e[10]!==v?(h={left:g,top:v,width:"320px"},e[9]=g,e[10]=v,e[11]=h):h=e[11];let x;e[12]!==f?(x=K=>{K.preventDefault(),f()},e[12]=f,e[13]=x):x=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=K=>l(K.target.value),e[14]=C):C=e[14];let b;e[15]!==s?(b=K=>{K.key==="Escape"&&s()},e[15]=s,e[16]=b):b=e[16];let w;e[17]!==c?(w=c("sandbox.visualEditorPrompt.inputPlaceholder"),e[17]=c,e[18]=w):w=e[18];let N;e[19]!==a||e[20]!==b||e[21]!==w?(N=r.jsx("input",{ref:u,autoFocus:!0,type:"text",value:a,onChange:C,onKeyDown:b,placeholder:w,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),e[19]=a,e[20]=b,e[21]=w,e[22]=N):N=e[22];let j;e[23]!==a?(j=a.trim(),e[23]=a,e[24]=j):j=e[24];const P=!j;let S;e[25]!==c?(S=c("sandbox.visualEditorPrompt.sendButton"),e[25]=c,e[26]=S):S=e[26];let R;e[27]!==c?(R=c("sandbox.visualEditorPrompt.sendButton"),e[27]=c,e[28]=R):R=e[28];let U;e[29]!==R?(U=r.jsx("title",{children:R}),e[29]=R,e[30]=U):U=e[30];let T;e[31]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e[31]=T):T=e[31];let A;e[32]!==U?(A=r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[U,T]}),e[32]=U,e[33]=A):A=e[33];let D;e[34]!==P||e[35]!==S||e[36]!==A?(D=r.jsx("button",{type:"submit",disabled:P,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-foreground text-background transition-opacity disabled:opacity-30",title:S,children:A}),e[34]=P,e[35]=S,e[36]=A,e[37]=D):D=e[37];let O;e[38]!==N||e[39]!==D||e[40]!==x?(O=r.jsxs("form",{className:"pointer-events-auto flex w-full items-center gap-1.5 rounded-xl glass px-3 py-1.5",onSubmit:x,children:[N,D]}),e[38]=N,e[39]=D,e[40]=x,e[41]=O):O=e[41];let F;return e[42]!==O||e[43]!==h?(F=r.jsx("div",{className:"absolute z-30 pointer-events-none",style:h,children:O}),e[42]=O,e[43]=h,e[44]=F):F=e[44],F}const mr="site-links",Xl=/details?page|\bpdp\b/i,Zl=/listingpage|\bplp\b/i;function ec(t,e,n){const s=new Set;for(const o of n)Xl.test(o)&&s.add("product"),Zl.test(o)&&s.add("category");const a=Bt(Qn(t)),l=a[a.length-1],u=a[a.length-2];return l?.type==="text"&&l.text==="/p"&&u?.type==="param"&&u.name===e&&s.add("product"),e==="*"&&a.some(o=>o.type==="param"&&o.name==="*")&&s.add("category"),s}const tc=["rosa","preto","pink","black"];function an(t,e){const n=e.trim();return n?t(n):tc.flatMap(s=>t(s))}function nc(t,e){const n=e.trim(),s=[];/^\d+$/.test(n)&&s.push({resolveType:t,props:{ids:[n]}});const l=n.includes("-")&&!/\s/.test(n)?n.replace(/-+/g," "):n;return s.push({resolveType:t,props:{query:l,count:10}}),s}const ia=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function Zn(t){return t.split("/")[0]??""}function sc(t){const e=new Set;for(const n of t){const s=Zn(n);ia.has(s)&&e.add(s)}return e}function rc(t,e){const n=Zn(t);return!ia.has(n)||e.size===0?!0:e.has(n)}const ac=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>an(n=>nc(t,n),e),optionsFromPayload:on},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>an(n=>[{resolveType:t,props:{props:{search:n,pageSize:10,currentPage:1}}}],e),optionsFromPayload:on},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>an(n=>[{resolveType:t,props:{term:n,hitsPerPage:10}}],e),optionsFromPayload:on},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>an(n=>[{resolveType:t,props:{query:n,term:n,count:10,hitsPerPage:10}}],e),optionsFromPayload:on},{kind:"category",test:t=>t==="vtex/loaders/categories/tree.ts"||/categor(y|ies).*tree/i.test(t),clientFilter:!0,buildRequests:t=>[{resolveType:t,props:{}}],optionsFromPayload:fc}];function ic(t,e,n=new Set){const s=[...e],a=o=>{const i=[];for(const c of ac){if(c.kind!==o)continue;const m=s.find(f=>c.test(f)&&rc(f,n));m&&i.push({cand:c,resolveType:m})}return i.find(c=>n.has(Zn(c.resolveType)))??i[0]},l=(o,i,c)=>({kind:o.kind,id:`${o.kind}:${i}`,resolveType:i,clientFilter:o.clientFilter,isFallback:c,buildRequests:m=>o.buildRequests(i,m),optionsFromPayload:o.optionsFromPayload}),u=[];for(const o of["product","category"]){if(!t.has(o))continue;const i=a(o);i&&u.push(l(i.cand,i.resolveType,!1))}return t.size>0&&u.push(oc(t.has("category")?"category":"product")),u}function oc(t){return{kind:t,id:mr,resolveType:mr,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,n)=>vc(e,n)}}function et(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function lc(t,e,n){const s=new Set,a=new Set,l=u=>{if(Array.isArray(u)){for(const c of u)l(c);return}const o=et(u);if(!o)return;const i=o.__resolveType;if(typeof i=="string"){if(n(i))s.add(i);else if(i in e&&!a.has(i)){a.add(i);const c=et(e[i])?.__resolveType;typeof c=="string"&&n(c)&&s.add(i),l(e[i])}}for(const c of Object.values(o))l(c)};return l(t),s}function oa(t){const e=new Set,n=[];for(const s of t)for(const a of s)e.has(a.value)||(e.add(a.value),n.push(a));return n}function la(t){try{return decodeURIComponent(t)}catch{return t}}function cc(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dc(t){const e=[];let n="^";for(const s of t)s.type==="text"?n+=cc(s.text):(e.push(s.name),n+=s.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${n}$`),order:e}}function ca(t,e,n){if(typeof t!="string"||!t)return null;let s;try{s=new URL(t,"https://placeholder.invalid").pathname}catch{return null}s=s.replace(/\/+$/,"");const a=Bt(Qn(e)),{pattern:l,order:u}=dc(a),o=u.indexOf(n);if(o===-1)return null;const i=s.match(l);if(!i)return null;const c=i[o+1]?.replace(/^\/+|\/+$/g,"");return c?la(c):null}function on(t,e){const n=et(t),s=Array.isArray(t)?t:Array.isArray(n?.products)?n.products:Array.isArray(n?.list)?n.list:[],a=[],l=new Set;for(const u of s){const o=et(u);if(!o)continue;const i=ca(o.url,e.template,e.paramName);if(!i||l.has(i))continue;l.add(i);const c=et(o.isVariantOf),m=typeof c?.name=="string"&&c.name||typeof o.name=="string"&&o.name||i,f=Array.isArray(o.image)?et(o.image[0]):null,p=typeof f?.url=="string"?f.url:void 0;a.push({value:i,label:m,image:p})}return a}function uc(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const n=e.replace(/^\/+|\/+$/g,"");return n?la(n):null}function fc(t){const e=[],n=new Set,s=(a,l)=>{const u=et(a);if(!u)return;const o=typeof u.name=="string"&&u.name?u.name:"",i=o?[...l,o]:l,c=uc(u.url);if(c&&!n.has(c)&&(n.add(c),e.push({value:c,label:i.join(" › ")||c})),Array.isArray(u.children))for(const m of u.children)s(m,i)};if(Array.isArray(t))for(const a of t)s(a,[]);return e}const pc=new Set(["login","logout","signin","sign-in","signup","sign-up","register","account","myaccount","my-account","minha-conta","conta","cart","carrinho","checkout","wishlist","favoritos","favorites","orders","pedidos","help","hc","sac","atendimento","contato","contact","institucional","newsletter","customer","sales","catalogsearch","search","busca","privacy-policy-cookie-restriction-mode"]);function mc(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function hc(t){if(typeof t!="string"||!t)return[];const e=[],n=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let s,a=0;for(;(s=n.exec(t))!==null&&a++<5e3;){const l=s[1]??"",u=(s[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:l,text:u})}return e}function gc(t){if(typeof t!="string"||!t)return[];const e=[],n=new Set,s=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,a=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let l,u=0;for(;(l=s.exec(t))!==null&&u++<3e3;){const o=(l[1]??"").replace(/\\\//g,"/");if(!o||n.has(o))continue;n.add(o);const i=t.slice(l.index,l.index+900).match(a)?.[1]?.replace(/\\\//g,"/");e.push({url:o,name:l[2]??"",image:i||void 0})}return e}function vc(t,e){const n=[],s=new Set,a=(l,u,o,i)=>{if(n.length>=200)return;const c=ca(l,e.template,e.paramName);!c||s.has(c)||e.paramName==="*"&&/(^|\/)p$/.test(c)||o==="category"&&pc.has(c.split("/")[0]??"")||(s.add(c),n.push({value:c,label:u&&u.length<=80?u:mc(c),kind:o,image:i}))};for(const{url:l,name:u,image:o}of gc(t))a(l,u,"product",o);for(const{href:l,text:u}of hc(t))l.startsWith("/")&&!l.startsWith("//")&&a(l,u,"category");return n}function Dt(t,e,n=50){const s=e.trim().toLowerCase();return(s?t.filter(l=>l.label.toLowerCase().includes(s)||l.value.toLowerCase().includes(s)):t).slice(0,n)}const da=1e4;function xc(t){return{product:{noun:t("sandbox.pathParamPickerChip.kindProductNoun"),heading:t("sandbox.pathParamPickerChip.kindProductHeading")},category:{noun:t("sandbox.pathParamPickerChip.kindCategoryNoun"),heading:t("sandbox.pathParamPickerChip.kindCategoryHeading")}}}async function bc(t,{resolveType:e,props:n}){const s=await fetch(Xi(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...n}),signal:AbortSignal.timeout(da)});if(!s.ok)throw new Error(`Failed to fetch options: ${s.status}`);return s.json()}async function hr(t,e){const n=await fetch(Zi(t,e),{signal:AbortSignal.timeout(da)});if(!n.ok)throw new Error(`Failed to fetch page: ${n.status}`);return n.text()}async function wc(t,e,n){const s=e.optionsFromPayload(await hr(t,"/"),n),a=s.find(u=>u.kind==="category");if(!a)return s;const l=Ve(n.template,{[n.paramName]:a.value});if(l==="/")return s;try{const u=e.optionsFromPayload(await hr(t,l),n).filter(o=>o.kind==="product");return oa([s,u])}catch{return s}}function yc(t,e,n){return Gn.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":n}`)}async function kc(t,e,n,s){if(e.homepageLinks)return wc(t,e,s);const a=e.buildRequests?.(n)??[];if(a.length===0)return[];const l=await Promise.allSettled(a.map(o=>bc(t,o))),u=l.filter(o=>o.status==="fulfilled").map(o=>o.value);if(u.length===0){const o=l.find(i=>i.status==="rejected");throw o?o.reason:new Error("Failed to fetch options")}return oa(u.map(o=>e.optionsFromPayload(o,s)))}function Wn(t,e,n,s,a){return{queryKey:yc(t,e,n),queryFn:()=>kc(t,e,n,s),enabled:a,staleTime:6e4,retry:1}}function Ft(t){const e=ue.c(16),{heading:n,iconKind:s,options:a,template:l,paramName:u,keyPrefix:o,onSelect:i}=t;if(a.length===0)return null;let c;if(e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==a||e[4]!==u||e[5]!==l){let f;e[7]!==s||e[8]!==o||e[9]!==i||e[10]!==u||e[11]!==l?(f=p=>r.jsxs(ut,{value:`${o}:${p.value}`,className:"gap-3 py-2",onSelect:()=>i(p.value),children:[s==="product"&&r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:p.image?r.jsx("img",{src:p.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):r.jsx(Or,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:p.label}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Ve(l,{[u]:p.value})})]})]},`${o}:${p.value}`),e[7]=s,e[8]=o,e[9]=i,e[10]=u,e[11]=l,e[12]=f):f=e[12],c=a.map(f),e[0]=s,e[1]=o,e[2]=i,e[3]=a,e[4]=u,e[5]=l,e[6]=c}else c=e[6];let m;return e[13]!==n||e[14]!==c?(m=r.jsx(dt,{heading:n,children:c}),e[13]=n,e[14]=c,e[15]=m):m=e[15],m}function gr(t){const e=ue.c(2),{text:n}=t;let s;return e[0]!==n?(s=r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:n}),e[0]=n,e[1]=s):s=e[1],s}function Sc(t){const e=ue.c(52),{sources:n,template:s,paramName:a,value:l,sandboxRef:u,onCommit:o}=t,i=Te(),[c,m]=E.useState(!1),[f,p]=E.useState(""),[k,g]=E.useState(""),v=E.useRef(null),h=a==="*"?i("sandbox.preview.catchAllParamLabel"):`:${a}`,x=xc(i),b=[...new Set(n.map(Z=>x[Z.kind].noun))].join(" or ");let w;e[0]!==i||e[1]!==b?(w=i("sandbox.pathParamPickerChip.searchPlaceholder",{options:b}),e[0]=i,e[1]=b,e[2]=w):w=e[2];const N=w,j={template:s,paramName:a};let P;e[3]!==f?(P=(Z,ce)=>({source:Z,query:ce,options:Z.clientFilter?Dt(ce.data??[],f):ce.data??[]}),e[3]=f,e[4]=P):P=e[4];const S=P,R=n.filter(Lc),U=n.filter(Rc),T=Kn({queries:R.map(Z=>Wn(u,Z,k,j,c))});let A;e[5]!==T||e[6]!==S?(A=(Z,ce)=>S(Z,T[ce]),e[5]=T,e[6]=S,e[7]=A):A=e[7];const D=R.map(A),O=D.length===0||D.every(Cc),F=Kn({queries:U.map(Z=>Wn(u,Z,k,j,c&&O))});let K;e[8]!==F||e[9]!==S?(K=(Z,ce)=>S(Z,F[ce]),e[8]=F,e[9]=S,e[10]=K):K=e[10];const ee=U.map(K),W=O?ee:D,G=W.length===1&&W[0]?.source.homepageLinks?W[0]:null,q=G&&!G.query.isLoading&&!G.query.isError?G?.query.data??[]:[],X=Dt(q.filter(Tc),f),Q=Dt(q.filter(Nc),f),H=X.length>0&&Q.length>0,L=Z=>{m(Z),v.current&&clearTimeout(v.current),p(Z?l:""),g(Z?l:"")};let B;e[11]===Symbol.for("react.memo_cache_sentinel")?(B=Z=>{p(Z),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{g(Z)},300)},e[11]=B):B=e[11];const _=B,M=Z=>{o(Z),L(!1)},z=Qr(f),Y=Ve(s,{[a]:z}),ne=jr,se=Pr,I="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",re=Ec;let ae;e[12]!==h||e[13]!==i?(ae=i("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:h}),e[12]=h,e[13]=i,e[14]=ae):ae=e[14];let ie;e[15]!==ae?(ie=r.jsx(Er,{className:"sr-only",children:r.jsx(Nr,{children:ae})}),e[15]=ae,e[16]=ie):ie=e[16];let me;e[17]===Symbol.for("react.memo_cache_sentinel")?(me=r.jsx(Or,{size:16,className:"shrink-0 text-foreground"}),e[17]=me):me=e[17];let pe;e[18]!==i?(pe=i("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=i,e[19]=pe):pe=e[19];let xe;e[20]!==h?(xe=r.jsx("span",{className:"rounded-sm bg-special/15 px-1 py-0.5 font-mono text-xs text-special",children:h}),e[20]=h,e[21]=xe):xe=e[21];let he;e[22]!==pe||e[23]!==xe?(he=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[me,r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[pe," ",xe]})]}),e[22]=pe,e[23]=xe,e[24]=he):he=e[24];const ve=zr,Se=!1,fe="min-h-0 flex-1";let le;e[25]!==N||e[26]!==f?(le=r.jsx(Kr,{autoFocus:!0,placeholder:N,value:f,onValueChange:_}),e[25]=N,e[26]=f,e[27]=le):le=e[27];const Re=Ir,Ue="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let Ie;e[28]!==i?(Ie=i("sandbox.pathParamPickerChip.noResults"),e[28]=i,e[29]=Ie):Ie=e[29];let Be;e[30]!==Ie?(Be=r.jsx(Hr,{children:Ie}),e[30]=Ie,e[31]=Be):Be=e[31];const vt=z&&r.jsx(dt,{className:"shrink-0",children:r.jsxs(ut,{value:`__raw__:${z}`,className:"gap-3 py-2",onSelect:()=>M(z),children:[r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:r.jsx(Io,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:i("sandbox.pathParamPickerChip.useRawValue",{rawTerm:z,paramLabel:h})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Y})]})]})}),ge=H?r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:r.jsx(Ft,{heading:x.category.heading,iconKind:"category",options:X,template:s,paramName:a,keyPrefix:`${G?.source.id}:cat`,onSelect:M})}),r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r.jsx(Ft,{heading:x.product.heading,iconKind:"product",options:Q,template:s,paramName:a,keyPrefix:`${G?.source.id}:prod`,onSelect:M})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:W.map(Z=>{const{source:ce,query:We,options:xt}=Z,{noun:qe}=x[ce.kind];if(We.isLoading)return r.jsx(gr,{text:i("sandbox.pathParamPickerChip.loading",{noun:qe})},ce.id);if(We.isError)return r.jsx(gr,{text:i("sandbox.pathParamPickerChip.couldNotLoad")},ce.id);if(ce.homepageLinks){const It=We.data??[];return r.jsxs(E.Fragment,{children:[r.jsx(Ft,{heading:x.category.heading,iconKind:"category",options:Dt(It.filter(jc),f),template:s,paramName:a,keyPrefix:`${ce.id}:cat`,onSelect:M}),r.jsx(Ft,{heading:x.product.heading,iconKind:"product",options:Dt(It.filter(Pc),f),template:s,paramName:a,keyPrefix:`${ce.id}:prod`,onSelect:M})]},ce.id)}return r.jsx(Ft,{heading:W.length>1?x[ce.kind].heading:void 0,iconKind:ce.kind,options:xt,template:s,paramName:a,keyPrefix:ce.id,onSelect:M},ce.id)})});let _e;e[32]!==Re||e[33]!==Be||e[34]!==vt||e[35]!==ge?(_e=r.jsxs(Re,{className:Ue,children:[Be,vt,ge]}),e[32]=Re,e[33]=Be,e[34]=vt,e[35]=ge,e[36]=_e):_e=e[36];let be;e[37]!==ve||e[38]!==le||e[39]!==_e?(be=r.jsxs(ve,{shouldFilter:Se,className:fe,children:[le,_e]}),e[37]=ve,e[38]=le,e[39]=_e,e[40]=be):be=e[40];let ze;e[41]!==se||e[42]!==ie||e[43]!==he||e[44]!==be||e[45]!==re?(ze=r.jsxs(se,{className:I,onClick:re,children:[ie,he,be]}),e[41]=se,e[42]=ie,e[43]=he,e[44]=be,e[45]=re,e[46]=ze):ze=e[46];let Le;return e[47]!==ne||e[48]!==L||e[49]!==c||e[50]!==ze?(Le=r.jsx(ne,{open:c,onOpenChange:L,children:ze}),e[47]=ne,e[48]=L,e[49]=c,e[50]=ze,e[51]=Le):Le=e[51],r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",title:i("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:h}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-lg bg-special/15 px-1 py-0.5 text-xs text-special hover:bg-special/25",onClick:Z=>{Z.stopPropagation(),L(!0)},children:l||h}),Le]})}function Pc(t){return t.kind==="product"}function jc(t){return t.kind!=="product"}function Ec(t){return t.stopPropagation()}function Nc(t){return t.kind==="product"}function Tc(t){return t.kind!=="product"}function Cc(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function Rc(t){return t.isFallback}function Lc(t){return!t.isFallback}function Ac(t){const e=ue.c(8),{sources:n,template:s,paramName:a,sandboxRef:l,onFill:u}=t;let o,i;if(e[0]!==a||e[1]!==l||e[2]!==n||e[3]!==s){const k={template:s,paramName:a},g=n.filter(_c);i=Kn,o=g.map(v=>Wn(l,v,"",k,!0)),e[0]=a,e[1]=l,e[2]=n,e[3]=s,e[4]=o,e[5]=i}else o=e[4],i=e[5];let c;e[6]!==o?(c={queries:o},e[6]=o,e[7]=c):c=e[7];const m=i(c),[f,p]=E.useState(!1);if(!f)for(const k of m){if(k.isLoading)break;const g=k.data?.[0];if(g){p(!0),queueMicrotask(()=>u(g.value));break}}return null}function _c(t){return!t.isFallback}function Oc(t){const e=ue.c(31),{name:n,value:s,onCommit:a}=t,l=Te(),[u,o]=E.useState(s),[i,c]=E.useState(!1),m=E.useRef(!1);let f;e[0]!==n||e[1]!==l?(f=n==="*"?l("sandbox.preview.catchAllParamLabel"):`:${n}`,e[0]=n,e[1]=l,e[2]=f):f=e[2];const p=f,k=u||p;let g;e[3]!==k?(g=r.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-xs",children:k}),e[3]=k,e[4]=g):g=e[4];let v;e[5]!==p||e[6]!==l?(v=l("sandbox.preview.valueForParam",{label:p}),e[5]=p,e[6]=l,e[7]=v):v=e[7];let h,x;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=S=>o(S.target.value),x=()=>c(!0),e[8]=h,e[9]=x):(h=e[8],x=e[9]);let C;e[10]!==s?(C=S=>{S.key==="Enter"&&S.currentTarget.blur(),S.key==="Escape"&&(m.current=!0,o(s),S.currentTarget.blur())},e[10]=s,e[11]=C):C=e[11];let b;e[12]!==u||e[13]!==a||e[14]!==s?(b=()=>{if(c(!1),m.current){m.current=!1;return}const S=Qr(u);o(S),S!==s&&a(S)},e[12]=u,e[13]=a,e[14]=s,e[15]=b):b=e[15];let w;e[16]!==u||e[17]!==p||e[18]!==v||e[19]!==C||e[20]!==b?(w=r.jsx("input",{type:"text",value:u,placeholder:p,title:v,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-special/15 px-1 text-xs text-special outline-none placeholder:text-special/60 focus:bg-special/25",onClick:Dc,onChange:h,onFocus:x,onKeyDown:C,onBlur:b}),e[16]=u,e[17]=p,e[18]=v,e[19]=C,e[20]=b,e[21]=w):w=e[21];let N;e[22]!==g||e[23]!==w?(N=r.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[g,w]}),e[22]=g,e[23]=w,e[24]=N):N=e[24];let j;e[25]!==i||e[26]!==l?(j=i&&r.jsxs("span",{className:"pointer-events-none ml-1.5 flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-border bg-muted px-1 py-0.5 text-2xs text-muted-foreground",children:[r.jsx(Di,{size:10}),l("sandbox.preview.enterToGo")]}),e[25]=i,e[26]=l,e[27]=j):j=e[27];let P;return e[28]!==j||e[29]!==N?(P=r.jsxs(r.Fragment,{children:[N,j]}),e[28]=j,e[29]=N,e[30]=P):P=e[30],P}function Dc(t){return t.stopPropagation()}function Fc(t){if(t.activeGlobalSectionName)return t.activeGlobalSectionName;const e=t.iframeBase;if(!e)return t.noServerLabel;try{const n=new URL(e),s=t.resolvedPath==="/"?"":t.resolvedPath;return`${n.host}${s}`}catch{return e}}function $c(t){return t.previewSurfaceActive&&(t.daemonReady||t.production||!!t.servePreviewUrl)}function Bc(t){return t.showPreviewToolbar&&t.contentEditingEnabled}function Mc(t){return t.v8?null:t.production||t.localPreview?{type:"editor::inject",args:{script:t.script}}:{type:"visual-editor::activate",script:t.script}}function Uc(t){return t.v8?null:{type:"visual-editor::activate",script:t.script}}class ua extends Error{constructor(){super("The site's schema isn't loaded yet"),this.name="PageSchemaNotReadyError"}}async function Ic(t,e){if(t)return t;const n=await e?.().catch(()=>null);if(!n)throw new ua;return n}async function zc(t,e,n){return n?Gs(t,e,await Ic(n.meta,n.loadMeta)):Gs(t,e)}function Kc(t){const e=ue.c(5);let n;e[0]!==t?(n=t??{orgSlug:"",virtualMcpId:"",branch:""},e[0]=t,e[1]=n):n=e[1];const s=Rr(n);let a;return e[2]!==t||e[3]!==s?(a={mutationFn:async l=>{const{name:u,path:o,template:i,schema:c}=l;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const m=hi(u),f=i?{...i,name:u,path:o}:await zc(u,o,c);return await s.mutateAsync({blockKey:m,data:f}),{key:m,name:u,path:o}}},e[2]=t,e[3]=s,e[4]=a):a=e[4],oi(a)}function Hc(t){const e=ue.c(89),{open:n,onOpenChange:s,isPending:a,error:l,templates:u,onSubmit:o}=t,i=a===void 0?!1:a,c=Te();let m;e[0]!==c?(m=c("sectionsEditor.createPageModal.defaultPageName"),e[0]=c,e[1]=m):m=e[1];const[f,p]=E.useState(m);let k;e[2]!==c?(k=c("sectionsEditor.createPageModal.defaultPagePath"),e[2]=c,e[3]=k):k=e[3];const[g,v]=E.useState(k),[h,x]=E.useState(Rn),[C,b]=E.useState(null),[w,N]=E.useState(n);n!==w&&(N(n),n&&(p(c("sectionsEditor.createPageModal.defaultPageName")),v(c("sectionsEditor.createPageModal.defaultPagePath")),x(Rn),b(null)));const j=!!u?.length;let P;e[4]!==i||e[5]!==s?(P=pe=>{!pe&&!i&&(b(null),s(!1))},e[4]=i,e[5]=s,e[6]=P):P=e[6];const S=P;let R;e[7]!==i||e[8]!==f||e[9]!==o||e[10]!==g||e[11]!==j||e[12]!==h?(R=async pe=>{pe.preventDefault();const xe=f.trim(),he=g.trim();if(!xe||!he||i)return;const ve=Xr(he);if(ve){b(ve);return}b(null),await o({name:xe,path:he,templateKey:j&&h!==Rn?h:null})},e[7]=i,e[8]=f,e[9]=o,e[10]=g,e[11]=j,e[12]=h,e[13]=R):R=e[13];const U=R,T=C??l;let A;e[14]!==c?(A=c("sectionsEditor.createPageModal.title"),e[14]=c,e[15]=A):A=e[15];let D;e[16]!==A?(D=r.jsx(Er,{children:r.jsx(Nr,{children:A})}),e[16]=A,e[17]=D):D=e[17];let O;e[18]!==c?(O=c("sectionsEditor.createPageModal.nameLabel"),e[18]=c,e[19]=O):O=e[19];let F;e[20]!==O?(F=r.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:O}),e[20]=O,e[21]=F):F=e[21];let K;e[22]===Symbol.for("react.memo_cache_sentinel")?(K=pe=>p(pe.target.value),e[22]=K):K=e[22];let ee;e[23]!==c?(ee=c("sectionsEditor.createPageModal.namePlaceholder"),e[23]=c,e[24]=ee):ee=e[24];let W;e[25]!==i||e[26]!==f||e[27]!==ee?(W=r.jsx(Mn,{id:"new-page-name",value:f,onChange:K,placeholder:ee,autoFocus:!0,disabled:i}),e[25]=i,e[26]=f,e[27]=ee,e[28]=W):W=e[28];let G;e[29]!==W||e[30]!==F?(G=r.jsxs("div",{className:"space-y-1.5",children:[F,W]}),e[29]=W,e[30]=F,e[31]=G):G=e[31];let V;e[32]!==c?(V=c("sectionsEditor.createPageModal.pathLabel"),e[32]=c,e[33]=V):V=e[33];let q;e[34]!==V?(q=r.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:V}),e[34]=V,e[35]=q):q=e[35];let X;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=pe=>v(pe.target.value),e[36]=X):X=e[36];let Q;e[37]!==c?(Q=c("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=c,e[38]=Q):Q=e[38];let H;e[39]!==i||e[40]!==g||e[41]!==Q?(H=r.jsx(Mn,{id:"new-page-path",value:g,onChange:X,placeholder:Q,disabled:i}),e[39]=i,e[40]=g,e[41]=Q,e[42]=H):H=e[42];let L;e[43]!==q||e[44]!==H?(L=r.jsxs("div",{className:"space-y-1.5",children:[q,H]}),e[43]=q,e[44]=H,e[45]=L):L=e[45];let B;e[46]!==i||e[47]!==j||e[48]!==c||e[49]!==h||e[50]!==u?(B=j&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"new-page-template",className:"text-xs font-medium text-muted-foreground",children:c("sectionsEditor.createPageModal.templateLabel")}),r.jsx(gi,{id:"new-page-template",value:h,onChange:x,templates:u??[],disabled:i})]}),e[46]=i,e[47]=j,e[48]=c,e[49]=h,e[50]=u,e[51]=B):B=e[51];let _;e[52]!==T?(_=T&&r.jsx("p",{className:"text-xs text-destructive",children:T}),e[52]=T,e[53]=_):_=e[53];let M;e[54]!==G||e[55]!==L||e[56]!==B||e[57]!==_?(M=r.jsxs("div",{className:"space-y-4 py-4",children:[G,L,B,_]}),e[54]=G,e[55]=L,e[56]=B,e[57]=_,e[58]=M):M=e[58];let z;e[59]!==s?(z=()=>s(!1),e[59]=s,e[60]=z):z=e[60];let Y;e[61]!==c?(Y=c("sectionsEditor.createPageModal.cancelButton"),e[61]=c,e[62]=Y):Y=e[62];let ne;e[63]!==i||e[64]!==z||e[65]!==Y?(ne=r.jsx($e,{type:"button",variant:"outline",onClick:z,disabled:i,children:Y}),e[63]=i,e[64]=z,e[65]=Y,e[66]=ne):ne=e[66];let se;e[67]!==i||e[68]!==f||e[69]!==g?(se=!f.trim()||!g.trim()||i,e[67]=i,e[68]=f,e[69]=g,e[70]=se):se=e[70];let I;e[71]!==i||e[72]!==c?(I=i?r.jsxs(r.Fragment,{children:[r.jsx(gt,{className:"size-3.5"}),c("sectionsEditor.createPageModal.creatingButton")]}):c("sectionsEditor.createPageModal.createButton"),e[71]=i,e[72]=c,e[73]=I):I=e[73];let re;e[74]!==se||e[75]!==I?(re=r.jsx($e,{type:"submit",disabled:se,children:I}),e[74]=se,e[75]=I,e[76]=re):re=e[76];let ae;e[77]!==ne||e[78]!==re?(ae=r.jsxs(li,{children:[ne,re]}),e[77]=ne,e[78]=re,e[79]=ae):ae=e[79];let ie;e[80]!==U||e[81]!==M||e[82]!==ae||e[83]!==D?(ie=r.jsx(Pr,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:U,children:[D,M,ae]})}),e[80]=U,e[81]=M,e[82]=ae,e[83]=D,e[84]=ie):ie=e[84];let me;return e[85]!==S||e[86]!==n||e[87]!==ie?(me=r.jsx(jr,{open:n,onOpenChange:S,children:ie}),e[85]=S,e[86]=n,e[87]=ie,e[88]=me):me=e[88],me}function Vc(t){const e=ue.c(36),{orgSlug:n,virtualMcpId:s,branch:a,previewUrl:l,meta:u,decofile:o,blockKey:i}=t,c=Te();let m;e[0]!==a||e[1]!==n||e[2]!==s?(m={orgSlug:n,virtualMcpId:s,branch:a},e[0]=a,e[1]=n,e[2]=s,e[3]=m):m=e[3];const f=Rr(m);let p;e[4]!==f?(p=bi((P,S)=>f.mutate({blockKey:P,data:S})),e[4]=f,e[5]=p):p=e[5];const k=p;let g;e[6]!==i||e[7]!==o?(g=vi(o,i),e[6]=i,e[7]=o,e[8]=g):g=e[8];const{resolveType:v,props:h,title:x}=g;if(!v){let P;e[9]!==c?(P=c("sandbox.preview.loaderNoLongerExists"),e[9]=c,e[10]=P):P=e[10];let S;return e[11]!==P?(S=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:P}),e[11]=P,e[12]=S):S=e[12],S}const C=`loader:${i}`,b=`loader:${i}`;let w;e[13]!==i||e[14]!==v||e[15]!==x?(w={mode:"saved",blockKey:i,resolveType:v,title:x},e[13]=i,e[14]=v,e[15]=x,e[16]=w):w=e[16];let N;e[17]!==a||e[18]!==o||e[19]!==u||e[20]!==n||e[21]!==l||e[22]!==h||e[23]!==f.isPending||e[24]!==k||e[25]!==b||e[26]!==w||e[27]!==s?(N=r.jsx(xi,{orgSlug:n,virtualMcpId:s,branch:a,previewUrl:l,meta:u,decofile:o,kind:"loaders",target:w,initialValue:h,isCreating:f.isPending,onCreate:Wc,onSaveReferencedBlock:k,showRun:!1},b),e[17]=a,e[18]=o,e[19]=u,e[20]=n,e[21]=l,e[22]=h,e[23]=f.isPending,e[24]=k,e[25]=b,e[26]=w,e[27]=s,e[28]=N):N=e[28];let j;return e[29]!==i||e[30]!==a||e[31]!==n||e[32]!==C||e[33]!==N||e[34]!==s?(j=r.jsx(wi,{orgSlug:n,virtualMcpId:s,branch:a,blockKey:i,present:void 0,children:N},C),e[29]=i,e[30]=a,e[31]=n,e[32]=C,e[33]=N,e[34]=s,e[35]=j):j=e[35],j}async function Wc(){}function qc(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function vr(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:qc(t.error)}}function Gc(t){switch(t){case"clone-failed":case"install-failed":case"start-failed":return"terminal-error";case"idle":case"cloning":return"booting";case"checking-out":case"installing":case"starting":case"running":case"crashed":return"snapshot-readable"}}function Jc(t){if(t.fastPreviewActive)return t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData?{kind:"error",source:"data"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"};const e=Gc(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const n=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return n&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(a=>a.status==="error"&&!a.hasData&&a.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:n?t.lifecyclePhase==="running"||t.lifecyclePhase==="crashed"?{kind:"error",source:"data"}:{kind:"loading"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"}}const Yc=E.lazy(()=>ci(()=>import("./sections-editor-D6NJi3oc.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])).then(t=>({default:t.SectionsEditor})));function xr(t){const e=ue.c(61),{virtualMcpId:n,externalSelection:s,onSectionPicked:a,onViewJsonFile:l}=t,u=s===void 0?null:s,{org:o}=Jn(),{currentBranch:i,taskId:c}=Mt(),m=Xn(),f=Ut(),p=ta(),k=m.lifecycle.phase==="running",g=f.previewUrl;let v;e[0]!==i||e[1]!==o||e[2]!==g||e[3]!==c||e[4]!==n?(v=i?{orgSlug:o.slug,virtualMcpId:n,branch:i,threadId:c??null,previewUrl:g}:null,e[0]=i,e[1]=o,e[2]=g,e[3]=c,e[4]=n,e[5]=v):v=e[5];const h=v,x=fn(n,i);let C;e[6]!==k?(C={fetchEnabled:k},e[6]=k,e[7]=C):C=e[7];const b=Yn(h,C);let w;e[8]!==k?(w={fetchEnabled:k},e[8]=k,e[9]=w):w=e[9];const N=Zr(h,w),j=Jc({lifecyclePhase:m.lifecycle.phase,decofile:vr(b),meta:vr(N),hasEditableContent:So(b.data,N.data),fastPreviewActive:Vr(n).runtime==="cms"||Xe(x)}),P=Lr()===void 0,S=Qc;if(Po(x)){let L;return e[10]===Symbol.for("react.memo_cache_sentinel")?(L=S(r.jsx(Eo,{})),e[10]=L):L=e[10],L}if(x.kind==="pending"&&x.retrying){let L;return e[11]!==x?(L=S(r.jsx(No,{backend:x})),e[11]=x,e[12]=L):L=e[12],L}if(j.kind==="loading"||P){let L;return e[13]===Symbol.for("react.memo_cache_sentinel")?(L=S(r.jsx(di,{})),e[13]=L):L=e[13],L}if(b.data&&eo(N.data)){const L=p.state.target,B=L?.kind==="page"||L?.kind==="section"?L.key:null,_=B??"",M=i??"";let z;return e[14]!==b.data||e[15]!==B||e[16]!==o.slug||e[17]!==_||e[18]!==M||e[19]!==n?(z=S(r.jsx(yi,{orgSlug:o.slug,virtualMcpId:n,branch:M,decofile:b.data,initialKey:B,compact:!0},_)),e[14]=b.data,e[15]=B,e[16]=o.slug,e[17]=_,e[18]=M,e[19]=n,e[20]=z):z=e[20],z}if(j.kind==="empty"){let L;return e[21]===Symbol.for("react.memo_cache_sentinel")?(L=S(r.jsx(To,{})),e[21]=L):L=e[21],L}if(j.kind==="error"){let L;e[22]!==b||e[23]!==f||e[24]!==N||e[25]!==j.source?(L=()=>{if(j.source==="sandbox"){f.retry();return}Promise.all([b.refetch(),N.refetch()])},e[22]=b,e[23]=f,e[24]=N,e[25]=j.source,e[26]=L):L=e[26];const B=L;let _;return e[27]!==B||e[28]!==j.source?(_=S(r.jsx(jo,{source:j.source,onRetry:B})),e[27]=B,e[28]=j.source,e[29]=_):_=e[29],_}let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=L=>S(r.jsx("div",{className:"h-full min-h-0",children:L})),e[30]=R):R=e[30];const U=R,T=p.state.target;if(T?.kind==="loader"&&b.data&&N.data){const L=i??"",B=g??null;let _;return e[31]!==b.data||e[32]!==N.data||e[33]!==o.slug||e[34]!==L||e[35]!==B||e[36]!==T.key||e[37]!==n?(_=U(r.jsx(Vc,{orgSlug:o.slug,virtualMcpId:n,branch:L,previewUrl:B,meta:N.data,decofile:b.data,blockKey:T.key})),e[31]=b.data,e[32]=N.data,e[33]=o.slug,e[34]=L,e[35]=B,e[36]=T.key,e[37]=n,e[38]=_):_=e[38],_}let A;e[39]!==i||e[40]!==o.slug||e[41]!==T||e[42]!==n?(A=T||!i?null:Ar(_r(o.slug,n,i)),e[39]=i,e[40]=o.slug,e[41]=T,e[42]=n,e[43]=A):A=e[43];const D=A;let O="/",F=null,K=null;T?.kind==="page"?(O=T.path,F=T.key):T?.kind==="section"?K=T.key:D&&(O=D.path,F=D.pageKey);const ee=F?`page:${F}`:K?`section:${K}`:`path:${O}`;let W;e[44]===Symbol.for("react.memo_cache_sentinel")?(W=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}),e[44]=W):W=e[44];const G=i??"",V=g??void 0,q=K?null:u,X=K?void 0:a,Q=!!F&&p.state.editSeoPageKey===F;let H;return e[45]!==K||e[46]!==F||e[47]!==O||e[48]!==ee||e[49]!==l||e[50]!==o.slug||e[51]!==q||e[52]!==X||e[53]!==Q||e[54]!==G||e[55]!==V||e[56]!==n||e[57]!==p.consumeEditSeo||e[58]!==p.setFocusedBlock||e[59]!==p.setVariantOverride?(H=U(r.jsx(E.Suspense,{fallback:W,children:r.jsx(Yc,{orgSlug:o.slug,virtualMcpId:n,branch:G,previewReady:!0,previewUrl:V,currentPath:O,activePageBlockKey:F,activeGlobalBlockKey:K,externalSelection:q,onSectionPicked:X,initialEditSeo:Q,onExitSeo:p.consumeEditSeo,onVariantPreviewOverride:p.setVariantOverride,onFocusedBlockChange:p.setFocusedBlock,onViewJsonFile:l},ee)})),e[45]=K,e[46]=F,e[47]=O,e[48]=ee,e[49]=l,e[50]=o.slug,e[51]=q,e[52]=X,e[53]=Q,e[54]=G,e[55]=V,e[56]=n,e[57]=p.consumeEditSeo,e[58]=p.setFocusedBlock,e[59]=p.setVariantOverride,e[60]=H):H=e[60],H}function Qc(t){return r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function br(t){const e=ue.c(51),{virtualMcpId:n,pageKey:s,onClose:a,ref:l}=t,u=Te(),o=Lr(),i=o===!0,c=Wr(n);let m;e[0]!==c||e[1]!==s?(m=to(c,Go(s)),e[0]=c,e[1]=s,e[2]=m):m=e[2];const f=m,{org:p}=Jn(),{currentBranch:k,taskId:g}=Mt(),h=Ut().previewUrl;let x;e[3]!==k||e[4]!==p.slug||e[5]!==h||e[6]!==g||e[7]!==n?(x=k?{orgSlug:p.slug,virtualMcpId:n,branch:k,threadId:g??null,previewUrl:h}:null,e[3]=k,e[4]=p.slug,e[5]=h,e[6]=g,e[7]=n,e[8]=x):x=e[8];const b=Yn(x),w=k??"";let N;e[9]!==p.slug||e[10]!==w||e[11]!==n?(N={orgSlug:p.slug,virtualMcpId:n,branch:w},e[9]=p.slug,e[10]=w,e[11]=n,e[12]=N):N=e[12];let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j={holdsCopy:!0},e[13]=j):j=e[13];const{save:P,flush:S,hold:R}=ki(N,j),U=k??"";let T;e[14]!==p.slug||e[15]!==U||e[16]!==n?(T=Ko({orgSlug:p.slug,virtualMcpId:n,branch:U}),e[14]=p.slug,e[15]=U,e[16]=n,e[17]=T):T=e[17];const A=Ho(T);let D;e[18]!==s||e[19]!==A?(D=A(s),e[18]=s,e[19]=A,e[20]=D):D=e[20];const O=D;let F;e[21]!==O||e[22]!==s?(F={pageKey:s,copyEpoch:O},e[21]=O,e[22]=s,e[23]=F):F=e[23];const[K,ee]=E.useState(F);(K.pageKey!==s||K.copyEpoch!==O)&&(ee({pageKey:s,copyEpoch:O}),R(s));const W=b.data?.[s],G=b.data===void 0&&b.isLoading||o===void 0,V=b.data!==void 0&&W===void 0,q=!k||V||G;let X;e[24]!==W?(X=W===void 0?"":JSON.stringify(W,null,2),e[24]=W,e[25]=X):X=e[25];const Q=X;let H;e[26]!==s||e[27]!==q||e[28]!==P?(H=Y=>{if(q)return;let ne;try{ne=JSON.parse(Y)}catch{return}ne===null||typeof ne!="object"||Array.isArray(ne)||P(s,ne)},e[26]=s,e[27]=q,e[28]=P,e[29]=H):H=e[29];const L=H;let B;e[30]!==S?(B=()=>({flush:S}),e[30]=S,e[31]=B):B=e[31],E.useImperativeHandle(l,B);let _;e[32]!==f||e[33]!==i||e[34]!==a||e[35]!==u?(_=i?r.jsx("div",{className:"flex shrink-0 items-center border-b px-3 py-2.5",children:r.jsx("span",{title:f,className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:f})}):r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[r.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:u("sectionsEditor.pageJsonDialog.titleShort")}),r.jsx($e,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":u("sectionsEditor.pageJsonDialog.close"),className:"shrink-0",children:r.jsx(ui,{size:14})})]}),e[32]=f,e[33]=i,e[34]=a,e[35]=u,e[36]=_):_=e[36];let M;e[37]!==O||e[38]!==b.data||e[39]!==S||e[40]!==Q||e[41]!==G||e[42]!==V||e[43]!==s||e[44]!==q||e[45]!==L||e[46]!==u?(M=G?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}):V?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",u("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(zo,{code:Q,language:"json",readOnly:q,height:"100%",onChange:Y=>L(Y??""),onSave:Y=>{L(Y),S()}},`${s}:${b.data===void 0?"loading":"ready"}:${O}`)}),e[37]=O,e[38]=b.data,e[39]=S,e[40]=Q,e[41]=G,e[42]=V,e[43]=s,e[44]=q,e[45]=L,e[46]=u,e[47]=M):M=e[47];let z;return e[48]!==_||e[49]!==M?(z=r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[_,M]}),e[48]=_,e[49]=M,e[50]=z):z=e[50],z}function fa(t){return t.contentEditingEnabled&&!t.isMobile}function Xc(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function Zc(t,e){return t==="blocks"?"preview":e?"blocks":t}function ed(t){return fa({contentEditingEnabled:ea(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function td(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}function nd(t){const e=no(t),{display:n}=t;let s=null;if(n.mode==="production"&&n.iframeBase)try{s=new URL(t.path,n.iframeBase).href}catch{s=null}const a=so(s,e);return{value:e,frame:a?Hn(a,t.device):null,newTab:a}}function sd(t){const e=ue.c(94),{tests:n,load:s,onOpen:a,options:l,onChange:u,available:o}=t,i=Te();let c;e[0]!==l?(c=qr(l),e[0]=l,e[1]=c):c=e[1];const m=c;let f;e[2]!==l.tests?(f=l.tests??{},e[2]=l.tests,e[3]=f):f=e[3];const p=f;let k;e[4]!==u||e[5]!==l?(k=I=>{const re=I?Wo(I):null,{at:ae,...ie}=l;u(re?{...ie,at:re}:ie)},e[4]=u,e[5]=l,e[6]=k):k=e[6];const g=k;let v;e[7]!==p||e[8]!==u||e[9]!==l?(v=(I,re)=>{const ae={...p};re==="on"?ae[I]=!0:re==="off"?ae[I]=!1:delete ae[I];const{tests:ie,...me}=l;u(Object.keys(ae).length>0?{...me,tests:ae}:me)},e[7]=p,e[8]=u,e[9]=l,e[10]=v):v=e[10];const h=v;let x;e[11]!==a?(x=I=>{I&&a?.()},e[11]=a,e[12]=x):x=e[12];let C;e[13]!==i?(C=i("sandbox.previewAs.label"),e[13]=i,e[14]=C):C=e[14];let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Fi,{size:16}),e[15]=b):b=e[15];let w;e[16]!==m||e[17]!==C?(w=r.jsx(pt,{asChild:!0,children:r.jsx(Br,{asChild:!0,children:r.jsx(Ze,{"aria-label":C,active:m,"data-testid":"preview-as-trigger",children:b})})}),e[16]=m,e[17]=C,e[18]=w):w=e[18];let N;e[19]!==i?(N=i("sandbox.previewAs.label"),e[19]=i,e[20]=N):N=e[20];let j;e[21]!==N?(j=r.jsx(mt,{children:N}),e[21]=N,e[22]=j):j=e[22];let P;e[23]!==j||e[24]!==w?(P=r.jsxs(ht,{children:[w,j]}),e[23]=j,e[24]=w,e[25]=P):P=e[25];let S;e[26]!==i?(S=i("sandbox.previewAs.label"),e[26]=i,e[27]=S):S=e[27];let R;e[28]!==S?(R=r.jsx("h3",{className:"text-sm font-medium",children:S}),e[28]=S,e[29]=R):R=e[29];let U;e[30]!==o||e[31]!==i?(U=i(o?"sandbox.previewAs.intro":"sandbox.previewAs.unavailable"),e[30]=o,e[31]=i,e[32]=U):U=e[32];let T;e[33]!==U?(T=r.jsx("p",{className:"text-xs text-muted-foreground",children:U}),e[33]=U,e[34]=T):T=e[34];let A;e[35]!==R||e[36]!==T?(A=r.jsxs("div",{className:"flex flex-col gap-1",children:[R,T]}),e[35]=R,e[36]=T,e[37]=A):A=e[37];let D;e[38]!==i?(D=i("sandbox.previewAs.momentLabel"),e[38]=i,e[39]=D):D=e[39];let O;e[40]!==D?(O=r.jsx(Xo,{htmlFor:"preview-as-moment",children:D}),e[40]=D,e[41]=O):O=e[41];let F;e[42]!==l.at?(F=Vo(l.at),e[42]=l.at,e[43]=F):F=e[43];let K;e[44]!==g?(K=I=>g(I.target.value),e[44]=g,e[45]=K):K=e[45];let ee;e[46]!==F||e[47]!==K?(ee=r.jsx(Mn,{id:"preview-as-moment",type:"datetime-local",className:qo,value:F,onChange:K}),e[46]=F,e[47]=K,e[48]=ee):ee=e[48];const W=l.at===void 0;let G;e[49]!==g?(G=()=>g(""),e[49]=g,e[50]=G):G=e[50];let V;e[51]!==i?(V=i("sandbox.previewAs.now"),e[51]=i,e[52]=V):V=e[52];let q;e[53]!==W||e[54]!==G||e[55]!==V?(q=r.jsx($e,{type:"button",variant:"ghost",size:"sm",disabled:W,onClick:G,children:V}),e[53]=W,e[54]=G,e[55]=V,e[56]=q):q=e[56];let X;e[57]!==ee||e[58]!==q?(X=r.jsxs("div",{className:"flex items-center gap-2",children:[ee,q]}),e[57]=ee,e[58]=q,e[59]=X):X=e[59];let Q;e[60]!==i?(Q=i("sandbox.previewAs.momentHint"),e[60]=i,e[61]=Q):Q=e[61];let H;e[62]!==Q?(H=r.jsx("p",{className:"text-xs text-muted-foreground",children:Q}),e[62]=Q,e[63]=H):H=e[63];let L;e[64]!==O||e[65]!==X||e[66]!==H?(L=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[O,X,H]}),e[64]=O,e[65]=X,e[66]=H,e[67]=L):L=e[67];let B;e[68]!==i?(B=i("sandbox.previewAs.testsLabel"),e[68]=i,e[69]=B):B=e[69];let _;e[70]!==B?(_=r.jsx("span",{className:"text-sm font-medium",children:B}),e[70]=B,e[71]=_):_=e[71];let M;e[72]!==p||e[73]!==s||e[74]!==h||e[75]!==i||e[76]!==n?(M=s&&!s.ready?s.failed?r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.previewAs.testsLoadFailed")}),r.jsx($e,{type:"button",variant:"outline",size:"sm",onClick:s.retry,children:i("sandbox.previewAs.tryAgain")})]}):r.jsx("div",{className:"flex justify-center py-2","data-testid":"preview-as-tests-loading",children:r.jsx(gt,{className:"size-4 text-muted-foreground"})}):n.length===0?r.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.previewAs.noTests")}):r.jsxs(r.Fragment,{children:[r.jsx("ul",{className:"flex flex-col gap-1.5",children:n.map(I=>r.jsxs("li",{className:"flex items-center justify-between gap-2","data-testid":"preview-as-test",children:[r.jsx("span",{className:"min-w-0 truncate text-sm",children:I}),r.jsxs(Zo,{type:"single",variant:"outline",size:"sm",value:p[I]===void 0?"":p[I]?"on":"off",onValueChange:re=>h(I,re),"aria-label":I,children:[r.jsx(or,{value:"off",children:i("sandbox.previewAs.off")}),r.jsx(or,{value:"on",children:i("sandbox.previewAs.on")})]})]},I))}),r.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.previewAs.testsHint")})]}),e[72]=p,e[73]=s,e[74]=h,e[75]=i,e[76]=n,e[77]=M):M=e[77];let z;e[78]!==_||e[79]!==M?(z=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[_,M]}),e[78]=_,e[79]=M,e[80]=z):z=e[80];let Y;e[81]!==m||e[82]!==u||e[83]!==i?(Y=m&&r.jsx($e,{type:"button",variant:"outline",size:"sm",onClick:()=>u({}),children:i("sandbox.previewAs.reset")}),e[81]=m,e[82]=u,e[83]=i,e[84]=Y):Y=e[84];let ne;e[85]!==A||e[86]!==L||e[87]!==z||e[88]!==Y?(ne=r.jsxs(Mr,{className:"flex w-80 flex-col gap-4 p-4",align:"center",sideOffset:8,"data-testid":"preview-as",children:[A,L,z,Y]}),e[85]=A,e[86]=L,e[87]=z,e[88]=Y,e[89]=ne):ne=e[89];let se;return e[90]!==P||e[91]!==ne||e[92]!==x?(se=r.jsxs(Ur,{onOpenChange:x,children:[P,ne]}),e[90]=P,e[91]=ne,e[92]=x,e[93]=se):se=e[93],se}const rd=15e3;function ad(t,e,n){return n?t.src===e||t.loading?t:{src:e,loading:!0}:t.src===e&&!t.loading?t:{src:e,loading:!1}}function wr(t){return t.loading?{...t,loading:!1}:t}function id(t,e){try{const n=new URL(t),s=new URL(e);return n.origin===s.origin&&n.pathname===s.pathname}catch{return!1}}function od(t,{base:e,frameSrc:n,loadedSrc:s,wanted:a,canSwap:l}){const u=t?.base===e?t:null,o=u?.src??n,i=u?.shown??n;return!a||!o||!i?null:i===a?u:l&&s===o&&id(i,a)?{base:e,src:o,shown:a}:null}const ld=["next"],cd=["@tanstack/react-router","@tanstack/react-start","@tanstack/solid-router","@tanstack/solid-start"],pa=new Set(["tsx","ts","jsx","js","mdx"]),dd=new Set(["tsx","jsx"]),ud=new Set(["404","500"]);function fd(t){const e=new Set;if(!t||typeof t!="object")return e;const n=t;for(const s of["dependencies","devDependencies"]){const a=n[s];if(a&&typeof a=="object"&&!Array.isArray(a))for(const l of Object.keys(a))e.add(l)}return e}function pd(t){const e=fd(t);return ld.some(n=>e.has(n))?"next":cd.some(n=>e.has(n))?"tanstack":null}function ma(t,e){const n=(t??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${e}`:e}function md(t,e){const n=s=>ma(e,s);switch(t){case"next":return[{router:"next-pages",dir:n("pages"),pattern:"**/*"},{router:"next-pages",dir:n("src/pages"),pattern:"**/*"},{router:"next-app",dir:n("app"),pattern:"**/page.*"},{router:"next-app",dir:n("src/app"),pattern:"**/page.*"}];case"tanstack":return[{router:"tanstack",dir:n("src/routes"),pattern:"**/*"}];default:{const s=t;throw new Error(`Unknown framework: ${String(s)}`)}}}function es(t){const e=t.lastIndexOf(".");return e<=0?null:[t.slice(0,e),t.slice(e+1)]}function hd(t){const e=es(t.at(-1)??"");if(!e||!pa.has(e[1]))return null;const[n]=e;if(n.includes("."))return null;const s=[...t.slice(0,-1),n];return s[0]==="api"||s.length===1&&ud.has(n)||s.some(a=>a.startsWith("_")||a.includes("["))?null:(s.at(-1)==="index"&&s.pop(),`/${s.join("/")}`)}function gd(t){const e=es(t.at(-1)??"");if(!e||e[0]!=="page"||!pa.has(e[1]))return null;const n=[];for(const s of t.slice(0,-1)){if(s.startsWith("_")||s.startsWith("@")||/^\(\.{1,3}\)/.test(s)||s.includes("["))return null;s.startsWith("(")&&s.endsWith(")")||n.push(s)}return`/${n.join("/")}`}function vd(t){const e=[];let n="",s=!1;for(const a of t)a==="["?s=!0:a==="]"&&(s=!1),a==="."&&!s?(e.push(n),n=""):n+=a;return e.push(n),e}function xd(t){const e=es(t.at(-1)??"");if(!e||!dd.has(e[1]))return null;const n=[...t.slice(0,-1),...vd(e[0])].filter(Boolean);n.at(-1)==="lazy"&&n.pop();const s=n.at(-1);if(!s||s==="__root"||n.some(l=>l.startsWith("-"))||s.startsWith("_"))return null;(s==="index"||s==="route")&&n.pop();const a=[];for(const l of n){if(l.includes("$"))return null;if(l.startsWith("_")||l.startsWith("(")&&l.endsWith(")"))continue;const u=l.replace(/_$/,"").replace(/[[\]]/g,"");u&&a.push(u)}return`/${a.join("/")}`}function bd(t,e){const n=e.split("/").filter(Boolean);if(n.length===0)return null;switch(t){case"next-pages":return hd(n);case"next-app":return gd(n);case"tanstack":return xd(n);default:{const s=t;throw new Error(`Unknown router: ${String(s)}`)}}}function wd(t){const e=new Set;for(const{root:n,files:s}of t){const a=`${n.dir}/`;for(const l of s){if(!l.startsWith(a))continue;const u=bd(n.router,l.slice(a.length));u&&e.add(u)}}return[...e].sort((n,s)=>n==="/"?-1:s==="/"?1:n.localeCompare(s))}const yd=5e3,kd=6e4;async function Sd(t,e){const n=await fetch(el(t,"glob"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pattern:e.pattern,path:e.dir,limit:yd})});if(!n.ok)throw new Error(`Failed to list ${e.dir}: ${n.status}`);const s=await n.json();return Array.isArray(s.files)?s.files.filter(a=>typeof a=="string"):[]}async function Pd(t,e){const n=await ro(t,ma(e,"package.json"));if(n.kind==="unavailable")throw new Error("package.json unavailable: sandbox not ready");const s=n.kind==="data"?pd(n.data):null;if(!s)return[];const a=md(s,e),l=await Promise.all(a.map(async u=>({root:u,files:await Sd(t,u)})));return wd(l)}function jd(t,e,n){const s=ue.c(12);let a;s[0]!==e||s[1]!==t?(a=t?Gn.frameworkRoutes(t.orgSlug,t.virtualMcpId,t.branch,t.threadId,e):["framework-routes","none"],s[0]=e,s[1]=t,s[2]=a):a=s[2];let l;s[3]!==e||s[4]!==t?(l=()=>t?Pd(t,e):[],s[3]=e,s[4]=t,s[5]=l):l=s[5];const u=n&&!!t;let o;s[6]!==a||s[7]!==l||s[8]!==u?(o={queryKey:a,queryFn:l,enabled:u,staleTime:kd},s[6]=a,s[7]=l,s[8]=u,s[9]=o):o=s[9];const i=Tr(o);let c;return s[10]!==i.data?(c=i.data??[],s[10]=i.data,s[11]=c):c=s[11],c}const Ed=500,Nd={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},yr=1,ln=["desktop","mobile","tablet"],Td=["preview","visual","blocks"],kr={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Cd(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.searchParams.set("__deco_ssr","1"),e.href}catch{return t}}function $t(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function Bn(t,e){try{return new URL(t,e).href}catch{return null}}function Rd(t,e){if(!e.inPlaceRenderActive)return{pin:e.draftPreviewUrl?{path:e.resolvedPath,url:e.draftPreviewUrl}:null,effective:e.draftPreviewUrl};if(e.draftPreviewUrl!==null&&t?.path!==e.resolvedPath){const n={path:e.resolvedPath,url:e.draftPreviewUrl};return{pin:n,effective:n.url}}return{pin:t,effective:t?.url??null}}function Ld(t,e){return!t||t.nav!==e.nav?!1:t.content!==e.content}function Ad(t,e,n){const s=t.toLowerCase(),a=e.toLowerCase(),l=a.split("/").filter(Boolean),u=i=>{if(i===n)return 100;const c=i.indexOf(n);if(c===-1)return 0;let m=40;return c===0?m+=30:/[\s/-]/.test(i[c-1]??"")&&(m+=20),m+=Math.round(n.length/i.length*20),m};let o=Math.max(u(s),u(a));return l.at(-1)===n?o=Math.max(o,95):l.includes(n)&&(o=Math.max(o,90)),o}function _d(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Od({virtualMcpId:t}){const e=Te(),n=Yr(),{currentBranch:s,taskId:a,virtualMcpId:l}=Mt(),u=!!Ci(),o=ta(),i=Ki(l===t?t:null),c=Vr(t),m=tl(i?.metadata?.ui?.layout??null),f=ea(m),p=fa({contentEditingEnabled:f,isMobile:n}),[k]=E.useState(()=>ed({cmsMode:m,isMobile:n})),[g,v]=Un(In.previewEditingMode(t),d=>d&&Td.includes(d)?d:null),h=g??k,[x,C]=Un(In.previewDeviceSize(t),d=>d&&ln.includes(d)?d:"desktop"),[b,w]=E.useState(null),[N,j]=E.useState(null),P=E.useRef(null),S=E.useRef(null),[R,U]=E.useState(!1),T=E.useRef(null),A=()=>{T.current?.flush(),U(!1)},D=()=>U(d=>(d&&T.current?.flush(),!d)),[O,F]=E.useState({width:0,height:0}),[K,ee]=E.useState(!1),[W,G]=E.useState({}),[V,q]=E.useState(""),X=E.useRef(null),[Q,H]=E.useState(!1),[L,B]=E.useState(),[_,M]=E.useState(null),[z,Y]=E.useState(null),[ne,se]=E.useState(null),[I,re]=E.useState(()=>o.state.target?.kind==="page"?o.state.target.path:"/"),[ae,ie]=E.useState(()=>o.state.target?.kind==="page"?o.state.target.key:null),[me,pe]=E.useState({}),[xe,he]=E.useState(!1),ve=E.useRef(null),Se=()=>{he(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>he(!1),15e3)},fe=()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),he(!1)},{org:le}=Jn(),Re=Xn(),Ue=Ut(),Ie=Ue.vmEntry,Be=Re.lifecycle.phase,{url:vt}=Gr(t),ge=fn(t,s),{connection:_e}=Jr(t),be=Jo(t),ze=ao({hasServeConnection:!!_e,runtime:c.runtime}),Le=!Xe(ge)&&ge.kind!=="pending",Z=He(ge)??vt,ce=Z??Ue.previewUrl,We=!!Z||Be==="running",xt=i?.id===t?Wi(i.metadata):null,qe=!Z&&i?.id===t&&c.runtime==="cms",It=c.projectDefault==="cms",bt=Le?io({sandboxUrl:ce,previewServerUrl:xt,fastPreviewActive:qe}):null,ts=t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s,threadId:a??null,previewUrl:ce}:null,ns=Yn(ts,{fetchEnabled:We}),pn=Zr(ts,{fetchEnabled:We}),de=ns.data,Pe=pn.data,Ge=de?Co(de,Pe).sort((d,y)=>d.name.localeCompare(y.name)):[],zt=t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s}:null,ss=Kc(zt),ha=oo(zt),mn=de&&Pe?Ro(de,Pe):[],rs=Le&&de&&Pe?Si(Pe,de,"loaders"):[],as=V?(()=>{const d=V.toLowerCase();return Ge.map(y=>({page:y,score:Ad(y.name,y.path,d)})).filter(({score:y})=>y>0).sort((y,$)=>$.score-y.score||y.page.path.length-$.page.path.length).map(({page:y})=>y)})():Ge,is=mn.filter(d=>{if(!V)return!0;const y=V.toLowerCase();return d.name.toLowerCase().includes(y)||d.key.toLowerCase().includes(y)||d.resolveType.toLowerCase().includes(y)}),os=p?rs:[],ls=os.filter(d=>{if(!V)return!0;const y=V.toLowerCase();return d.title.toLowerCase().includes(y)||d.key.toLowerCase().includes(y)||d.resolveType.toLowerCase().includes(y)}),Kt=z?rs.find(d=>d.key===z)??null:null,Ee=Qn,hn=_||z?null:Lo(Ge,I,ae),oe=hn?.key??null,tt=o.state.target?.kind==="section"?o.state.target.key:o.state.focusedBlockKey??oe,Ht=hn?.path??null,nt=(oe?me[oe]:void 0)??{},Ce=Ve(I,nt),gn={};if(Le&&We&&ce&&Pe&&de){const d=Pi(Pe,"loaders"),y=oe?de[oe]:void 0,$=lc(y,de,ye=>d.has(ye)),te=sc($);for(const ye of Bt(I)){if(ye.type!=="param")continue;const Ne=ec(I,ye.name,$),ot=ic(Ne,d,te);ot.length>0&&(gn[ye.name]=ot)}}const wt=t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s,threadId:a??null}:null,cs=de&&oe?Bo(de,oe,0):[],ds=Xe(ge),us=de?ji(cs,de,ds):[],yt=us.map(d=>d.isSavedBlock?d.label:""),kt=us.map(d=>d.isSavedBlock?"global":d.isMultivariate?"variant":"normal"),St=cs.map(d=>Vn(d,de??{},ds)),st=E.useRef(null),Oe=E.useRef(null),ga=Re.status.state==="paused",vn=Re.phase,fs=Ei({claimPhase:vn,lifecycle:Re.lifecycle}),Je=Ue.previewState,va=Ue.userStopped,xa=lo(le.slug,t??""),{url:Ke}=$o(qe&&t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s,previewServerUrl:xt??null,path:Ce}:null),ba=It&&c.runtime==="sandbox",Ae=co(ge,ze,be),ps=uo(Ae&&qe&&ge.kind==="protocol"&&t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s}:null),ms=Ae?ps.pointer:null,J=Rl({previewState:Je,progressStatus:fs.status,previewServerUrl:xt,fastPreviewActive:qe,fastPreviewReady:!!Ke,codingSession:ba,localPreviewUrl:Z,hostedDraft:Ae,hostedPointerPending:Ae&&(ge.kind==="pending"||ps.pending)}),hs=J.showWakingPill||Ae&&J.mode==="production"&&!ms,Pt=J.mode!=="none",wa=J.mode==="production"&&J.iframeBase?$t(J.iframeBase):null,rt=J.mode==="production"?wa:$t(ce),ya=i?.id===t&&i.metadata?.fastPreviewInPlace===!0,jt=Le?Z?J.mode==="sandbox"&&p&&h==="blocks":J.mode==="production"&&qe&&ya&&p&&h==="blocks":!1,gs=E.useRef(null),{pin:ka,effective:Sa}=Rd(gs.current,{inPlaceRenderActive:jt,draftPreviewUrl:Ke,resolvedPath:Ce});gs.current=ka;const vs=o.state.variantOverride??[],Vt=Le?vs:[],Et=Le?[]:vs,Wt=Xe(ge)&&Ao.some(d=>_o(Pe,d)==="available"),at=Wt?W:{},xs=qr(at),Pa=Wt&&de?Object.keys(Oo(de).experiments):[],[bs,ja]=E.useState(!1),ws=fo(zt,Wt&&bs?Do:[]),Ea={...ws,ready:!(ge.kind==="protocol"&&ge.hosted)||bs&&ws.ready},Ye=t?Ys(le.slug,t):null,Na=po(Ye),qt=Ae?nd({display:J,path:Ce,pointer:ms,heldRevision:Na,device:x,forcedVariants:Et,previewOptions:at}):null,ys=JSON.stringify([Et,at]);E.useEffect(()=>{if(!Ae||!Ye)return;const[d,y]=JSON.parse(ys);Qs(Ye,{forcedVariants:d,previewOptions:y})},[Ae,Ye,ys]),E.useEffect(()=>{if(!(!Ae||!Ye))return()=>Qs(Ye,null)},[Ae,Ye]);const xn=_e&&He(ge)?mo(_e.endpoint,Et,xs):null,Ta=_e&&He(ge)?xn?ho(xn,at):Xs:null,Qe=Cd(J.mode==="sandbox"?nn(Hn(Zs(ne??Bn(Ce,J.iframeBase)??J.iframeBase,Ta),x),Vt):J.mode==="production"&&qt?.frame?qt.frame:J.mode==="production"?nn(Hn(er(tr(Zs(ne??Sa??Bn(Ce,J.iframeBase)??J.iframeBase,hs?Xs:null),Et),at),x),Vt):null),ks=Ke??(J.iframeBase?Bn(Ce,J.iframeBase):null),Ss=J.mode==="production"&&qt?qt.newTab:J.mode==="production"?ks?nn(er(tr(ks,Et),at),Vt):null:Qe??J.iframeBase,Ca=()=>{const d=Ss;d&&window.open(d,"_blank","noopener")},Nt=t&&s?_r(le.slug,t,s):null,Tt=d=>{Nt&&Li(Nt,d)},ke=o.state.target;E.useEffect(()=>{if(!(!ke||!bt||!Pe))if(ke.kind==="page"){const d=me[ke.key]??{};Oe.current=Ve(ke.path,d),M(null),Y(null),se(null),ie(ke.key),re(ke.path),Tt({path:ke.path,pageKey:ke.key,params:d})}else if(ke.kind==="loader")Oe.current=null,M(null),Y(ke.key),se(null);else{const d=mn.find(y=>y.key===ke.key);if(d){Oe.current=null;const y=sr(Pe);Y(null),M(d),se(nr(bt,y,d.key))}}},[ke,bt,Pe,me]),E.useEffect(()=>{!oe||Ht===null||ke?.kind==="page"&&ke.key===oe&&ke.path===Ht||o.selectTarget({kind:"page",key:oe,path:Ht})},[oe,Ht,ke]);const[Ps,Ra]=E.useState(null);if(Je.kind==="iframe"&&Ps!==Je.previewUrl){const d=Ps!==null;Ra(Je.previewUrl);const y=Nt?Ar(Nt):null;if(y){if(Oe.current=Ve(y.path,y.params),re(y.path),ie(y.pageKey),se(null),M(null),Y(null),y.pageKey&&Object.keys(y.params).length>0){const $=y.pageKey;pe(te=>({...te,[$]:y.params}))}}else d&&(Oe.current=null,re("/"),se(null),ie(null),M(null),Y(null))}st.current=Qe;const La=J.mode==="production"&&!!Ke&&!Z,[Gt,bn]=E.useState({src:Qe??void 0,loading:!1}),[Aa,wn]=E.useState(!1),[_a,Oa]=E.useState(),[js,Es]=E.useState(null),je=od(js,{base:J.iframeBase??"",frameSrc:Gt.src,loadedSrc:_a,wanted:Qe??void 0,canSwap:be&&Aa&&!Gt.loading});je!==js&&Es(je);const Jt=ad(Gt,je?je.src:Qe??void 0,La);Jt!==Gt&&bn(Jt);const it=Jt.src,Ns=Jt.loading,Ts=Ol({iframeRef:P,src:J.mode==="sandbox"?Qe:null,active:J.mode==="sandbox"}),Cs=E.useRef(null);E.useEffect(()=>{const d=Ns?setTimeout(()=>bn(wr),rd):null,y=()=>{d&&clearTimeout(d)};if(!Ke||!it||Cs.current===Ke)return y;Cs.current=Ke;const $=P.current;return $&&$.getAttribute("src")!==it&&(Se(),$.src=it),y},[Ke,it,Ns]);const Rs=()=>{const d=P.current?.contentWindow,y=rt;if(!d||!y||!de||!oe)return;const $=de[oe];if(!$||typeof $!="object")return;const te=wo({previewBaseUrl:y,pageBlock:$,decofile:de,path:Ce,pathTemplate:I});if(!te)return;const ye=nn(te.src,ko(Vt,oe));d.postMessage({type:"cms-editor::render",src:ye,body:te.body},y)},yn=E.useRef(null);E.useEffect(()=>{if(!jt||_||z||!oe||!de){yn.current=null;return}const d={nav:JSON.stringify({page:oe,path:Ce,pathTemplate:I}),content:JSON.stringify(de)},y=Ld(yn.current,d);yn.current=d,y&&Rs()},[de,jt,_,z,oe,Ce,I]);const kn=E.useRef(null);E.useEffect(()=>{if(!jt||_||z||!oe||!de){kn.current=null;return}const d=JSON.stringify(o.state.variantOverride??null),y=kn.current;kn.current={page:oe,sig:d},!(!y||y.page!==oe||y.sig===d)&&Rs()},[o.state.variantOverride,jt,_,z,oe]);const Ls=!!t&&!!s&&!Re.notFound&&!va&&!ga&&(vn?.kind==="ready"||Be!=="idle"),As=!Xe(ge),Da=Wr(t??void 0),Fa=jd(wt,Da,As&&Ls),$a=new Set(Ge.map(d=>Ee(d.path))),Yt=As?Fa.filter(d=>!$a.has(Ee(d))):[],_s=V?Yt.filter(d=>d.toLowerCase().includes(V.toLowerCase())):Yt,we=td({editingMode:h,sandboxDisplay:J.mode==="sandbox",blocksEditingEnabled:p});E.useEffect(()=>{const d=rt;if(!d)return;const y=$=>{if($.origin===d)if($.data?.type==="visual-editor::element-clicked"){const te=Bl.safeParse($.data.payload);te.success&&w(te.data)}else if($.data?.type==="cms-editor::section-clicked"){const te=Il.safeParse($.data.payload);te.success&&j({index:te.data.sectionIndex,seq:te.data.clickSeq})}else $.data?.type==="cms-editor::render-start"?Se():$.data?.type==="cms-editor::render-end"?(fe(),P.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:yt,kinds:kt,keys:St},d)):$.data?.type==="cms-editor::render-error"&&fe()};return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[rt,yt,kt,St]);const Os=()=>{const d=P.current?.contentWindow,y=$t(ce),$=Uc({v8:be,script:Ml});!d||!y||!$||d.postMessage($,y)},Ba=()=>{if(be)return;const d=P.current?.contentWindow,y=$t(ce);!d||!y||d.postMessage({type:"visual-editor::deactivate"},y)},Ds=()=>{const d=Me.current;d?.has("wireframe")&&(d.wireframe({type:"wireframe:sections",labels:yt,kinds:kt,keys:St}),d.wireframe({type:we==="blocks"?"wireframe:activate":"wireframe:deactivate"}))},Sn=()=>{if(be){Ds();return}const d=P.current?.contentWindow,y=rt,$=Mc({v8:be,production:J.mode==="production",localPreview:!!Z,script:zl});!d||!y||!$||(d.postMessage($,y),d.postMessage({type:"cms-editor::set-labels",labels:yt,kinds:kt,keys:St},y))},Ma=()=>{if(be){Me.current?.wireframe({type:"wireframe:deactivate"});return}const d=P.current?.contentWindow,y=rt;!d||!y||d.postMessage({type:"cms-editor::deactivate"},y)},Fs=d=>{Me.current?.wireframe({type:"wireframe:scroll-to",sectionIndex:d})},Ua=()=>{if(Me.current?.wireframe({type:"wireframe:clear-hover"}),be)return;const d=P.current?.contentWindow,y=rt;!d||!y||(d.postMessage({type:"cms-editor::clear-hover"},y),d.postMessage({type:"visual-editor::clear-hover"},y))},Qt=d=>{if(d==="blocks"&&!p)return;const y=h;!n&&d!==y&&(d==="blocks"?S.current?.resize("30%"):S.current?.collapse()),v(d),w(null),j(null),d!=="blocks"&&Y(null),y==="visual"&&Ba(),d==="visual"&&Os(),y==="blocks"&&d!=="blocks"&&Ma(),d==="blocks"&&Sn()},Ia=()=>{Qt(Xc(h,p))},za=()=>{Qt(Zc(h,p))},Xt=()=>{const d=P.current;if(!d)return;Se();const y=document.activeElement,$=d.tabIndex;d.tabIndex=-1,d.style.pointerEvents="none",d.blur(),_d(d,st.current);let te;const ye=()=>{clearTimeout(te),d.tabIndex=$,d.style.pointerEvents="";const Ne=document.activeElement;(!Ne||Ne===document.body||Ne===d)&&y?.focus(),d.removeEventListener("load",ye)};d.addEventListener("load",ye),te=setTimeout(ye,3e3)};Uo(Xt);const Me=E.useRef(null),$s=E.useEffectEvent(Ds),Ka=E.useEffectEvent((d,y)=>{j({index:d,seq:y})}),Ha=E.useEffectEvent(()=>{fe(),je&&(Pn.current=je.shown),Rt&&An(Ct)}),Bs=E.useEffectEvent(()=>{if(wn(!1),je&&Es(null),je&&je.src!==st.current){Se();return}Xt()});E.useEffect(()=>{if(!be)return;const d=new ql({studioOrigin:window.location.origin,build:"4.570.0",frame:()=>P.current?.contentWindow??null,onWireframeReady:()=>$s(),onWireframe:$=>{$.type==="wireframe:select"&&Ka($.sectionIndex,$.clickSeq)},onModulesChange:()=>wn(d.has("html-swap")),onSwapEnd:()=>Ha(),onSwapFailed:()=>Bs()});Me.current=d;const y=$=>{d.handle($)};return window.addEventListener("message",y),()=>{window.removeEventListener("message",y),d.dispose(),wn(!1),Me.current===d&&(Me.current=null)}},[be,J.iframeBase]);const Ms=be?JSON.stringify([yt,kt,St,we]):"";E.useEffect(()=>{Ms&&$s()},[Ms]);const Us=E.useRef(null);E.useEffect(()=>{const d=Us.current;if(Us.current=je,je&&je!==d){Me.current?.refresh(je.shown)?Se():Bs();return}!je&&d&&d.shown!==d.src&&d.src===st.current&&Xt()},[je]);const Is=()=>{Me.current?.refresh()||Xt()},Ct=Ys(le.slug,t??""),Rt=Ae&&Pt&&!!t,Pn=E.useRef(null);E.useEffect(()=>{if(Rt)return go(Ct)},[Rt,Ct]);const{reload:Lt}=vo(le.slug,t??""),zs=E.useRef(Lt.seq);E.useEffect(()=>{if(zs.current!==Lt.seq&&(zs.current=Lt.seq,!!Rt&&Pn.current===st.current)){if(Lt.navigates){An(Ct);return}Is()}},[Lt.seq]);const Va=xo(zt),At=bo(He(ge)?Va:""),Ks=E.useRef(At);E.useEffect(()=>{const d=Ks.current;if(Ks.current=At,!d||!At||d===At)return;const y=P.current;if(y)return $l({iframe:y,reload:Is})},[At]);const Wa=()=>{const d=ln.indexOf(x);C(ln[(d+1)%ln.length])},jn=(d,y)=>{if(!oe)return;const $=oe,te={...nt,[d]:y};Oe.current=Ve(I,te),pe(ye=>({...ye,[$]:te})),Tt({path:I,pageKey:$,params:te})},qa=Fc({iframeBase:J.iframeBase,resolvedPath:Ce,activeGlobalSectionName:_?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),En=d=>{const y=me[d.key]??{},$=Ve(d.path,y);(_||Ee($)!==Ee(Ce))&&Se(),Oe.current=$,M(null),Y(null),se(null),j(null),ie(d.key),re(d.path),Tt({path:d.path,pageKey:d.key,params:y}),o.selectTarget({kind:"page",key:d.key,path:d.path})},Hs=d=>{(_||Ee(d)!==Ee(Ce))&&Se(),Oe.current=d,M(null),Y(null),se(null),j(null),ie(null),re(d),Tt({path:d,pageKey:null,params:{}})};Ri(Nt,Hs);const Ga=d=>{if(Xe(ge)){const te=de?Fo(de,d.key,Pe):null;te?En(te):dn.info(e("sandbox.preview.blockOnNoPage"));return}if(!bt||!Pe){dn.error(e("sandbox.preview.previewMetadataNotReady"));return}Se(),Oe.current=null;const y=sr(Pe),$=nr(bt,y,d.key);M(d),Y(null),se($),j(null),o.selectTarget({kind:"section",key:d.key})},Ja=d=>{p&&(M(null),Y(d.key),se(null),Qt("blocks"),o.selectTarget({kind:"loader",key:d.key}))},Ya=async({name:d,path:y,templateKey:$})=>{if(!t||!s)return;const te=Xr(y);if(te){B(te);return}const ye=y.trim().startsWith("/")?y.trim():`/${y.trim()}`;if(Ge.some(Ne=>Ee(Ne.path)===Ee(ye))){B(e("sandbox.preview.pageAlreadyExists",{path:ye}));return}B(void 0);try{const Ne=$?await ha(de,$):void 0;if($&&!Ne){B(e("sandbox.preview.templateNoLongerExists"));return}const ot=await ss.mutateAsync({name:d,path:ye,template:Ne,schema:Xe(ge)?{meta:Pe,loadMeta:async()=>(await pn.refetch()).data}:void 0});H(!1),dn.success(e("sandbox.preview.pageCreated",{name:d})),await sl(Ed),En({key:ot.key,name:ot.name,path:ot.path}),Qt("blocks")}catch(Ne){B(Ne instanceof ua?e("sandbox.preview.pageSchemaNotReady"):Ne instanceof Error?Ne.message:e("sandbox.preview.failedToCreatePage"))}},Zt=$c({previewSurfaceActive:Pt,daemonReady:Ls,production:J.mode==="production",servePreviewUrl:He(ge)}),Qa=Bc({showPreviewToolbar:Zt,contentEditingEnabled:f}),_t=()=>{ee(!1),q("")},Nn=_?.name??Kt?.title??hn?.name,Tn=ns.isPending||pn.isPending,Cn=Tn?$t(J.iframeBase):Nn,Ot=_?`section:${_.key}`:z?`loader:${z}`:oe?`page:${oe}`:Yt.includes(Ee(I))?`route:${Ee(I)}`:void 0,Xa=Zt?Qa?r.jsxs(Ur,{open:K,onOpenChange:d=>{ee(d),d||q("")},children:[r.jsx(Br,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":e("sandbox.preview.choosePage"),"data-testid":"preview-page-picker",title:Tn?Cn??void 0:_||Kt?Nn:[Nn,I].filter(Boolean).join(" · "),className:"group/page-picker flex h-7 w-fit min-w-[320px] items-stretch overflow-hidden whitespace-nowrap rounded-[var(--studio-button-radius,calc(var(--radius)*1.333))] border border-border/60 bg-background text-left text-xs text-muted-foreground transition-colors hover:border-border focus-ring",children:r.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 px-2 transition-colors group-hover/page-picker:bg-accent/50 group-data-[state=open]/page-picker:bg-accent/50",children:[_&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-2xs font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[r.jsx($i,{size:11}),e("sandbox.preview.globalBadge")]}),Kt&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-2xs font-medium text-muted-foreground",children:[r.jsx(Bi,{size:11}),e("sandbox.preview.loaderBadge")]}),Cn&&r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:Cn}),!Tn&&!_&&!Kt&&r.jsx("span",{"data-testid":"preview-page-path",className:"ml-auto min-w-0 truncate text-right font-mono text-muted-foreground",children:I}),r.jsx(Ai,{size:12,className:Fe("shrink-0 transition-transform",K&&"rotate-180")})]})})}),r.jsxs(Mr,{className:"w-112 max-w-[calc(100vw-2rem)] p-0",align:"center",sideOffset:8,children:[r.jsxs(zr,{shouldFilter:!1,defaultValue:Ot,children:[r.jsx(Kr,{value:V,onValueChange:d=>{q(d),X.current?.scrollTo({top:0})},placeholder:e("sandbox.preview.searchPagesAndComponents")}),r.jsxs(Ir,{ref:X,className:"max-h-80",children:[r.jsx(Hr,{children:Ge.length===0&&Yt.length===0&&mn.length===0&&os.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}),as.length>0&&r.jsx(dt,{children:as.map(d=>r.jsxs(ut,{value:`page:${d.key}`,"aria-current":Ot===`page:${d.key}`||void 0,title:`${d.name} · ${d.path}`,onSelect:()=>{_t(),En(d)},className:"gap-3 px-3 py-2.5 aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:d.name}),r.jsx("span",{className:"min-w-0 max-w-1/2 truncate text-right font-mono text-xs text-muted-foreground",children:d.path})]},d.key))}),_s.length>0&&r.jsx(dt,{heading:e("sandbox.preview.siteRoutes"),children:_s.map(d=>r.jsx(ut,{value:`route:${d}`,"aria-current":Ot===`route:${d}`||void 0,title:d,onSelect:()=>{_t(),Hs(d)},className:"px-3 py-2.5 aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",children:r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:d})},d))}),is.length>0&&r.jsx(dt,{heading:e("sandbox.preview.globalComponents"),children:is.map(d=>r.jsx(ut,{value:`section:${d.key}`,"aria-current":Ot===`section:${d.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{_t(),Ga(d)},children:r.jsx("span",{className:"truncate",children:d.name})},d.key))}),ls.length>0&&r.jsx(dt,{heading:e("sandbox.preview.globalLoaders"),children:ls.map(d=>r.jsx(ut,{value:`loader:${d.key}`,"aria-current":Ot===`loader:${d.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{_t(),Ja(d)},children:r.jsx("span",{className:"truncate",children:d.title})},d.key))})]})]}),!_&&!z&&Bt(I).some(d=>d.type!=="text")&&r.jsx("div",{className:"flex flex-wrap items-center gap-1 border-t px-3 py-3 text-xs text-muted-foreground",children:Bt(I).map((d,y)=>{if(d.type==="text")return r.jsx("span",{children:d.text},`text-${y}`);const $=gn[d.name];return $&&wt?r.jsx(Sc,{sources:$,template:I,paramName:d.name,value:nt[d.name]??"",sandboxRef:wt,onCommit:te=>jn(d.name,te)},`${oe}:${d.name}`):r.jsx(Oc,{name:d.name,value:nt[d.name]??"",onCommit:te=>jn(d.name,te)},`${oe}:${d.name}`)})}),r.jsx("div",{className:"border-t p-1.5",children:r.jsxs($e,{variant:"ghost",className:"w-full justify-start",onClick:()=>{_t(),B(void 0),H(!0)},children:[r.jsx($r,{size:16}),e("sandbox.preview.createNewPage")]})})]})]}):r.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:qa}):null,Vs=Zt||f?r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsxs(ht,{children:[r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{onClick:Wa,"aria-label":e(kr[x]),children:x==="mobile"?r.jsx(Dr,{size:16}):x==="tablet"?r.jsx(Mi,{size:16}):r.jsx(Fr,{size:16})})}),r.jsx(mt,{children:e(kr[x])})]}),Xa,r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Wt&&r.jsx(sd,{tests:Pa,load:Ea,onOpen:()=>ja(!0),options:W,onChange:d=>{G(d),o.previewAsChanged()},available:!!xn||!hs||!xs}),r.jsx(Ze,{onClick:Ca,disabled:Ae&&!Ss,"aria-label":e("sandbox.preview.openInNewTab"),children:r.jsx(Cr,{size:16})})]})]}):null,Za=(Le||u)&&J.mode==="sandbox",en=Nd[x],tn=x==="desktop"&&(O.width===0||O.width>=en.width+2*yr),Ws=tn?1:Math.min(O.width>0?O.width/(en.width+2*yr):1,1),ei=tn?{width:"100%",height:"100%"}:{width:`${en.width}px`,height:O.height>0?`${O.height/Ws}px`:`${en.height}px`,transform:`scale(${Ws})`,transformOrigin:"top center"},qs=r.jsxs(r.Fragment,{children:[Za&&(Zt||f)&&r.jsx(Ze,{onClick:Ia,"aria-pressed":we==="visual","aria-label":e("sandbox.preview.visualEditor"),active:we==="visual",children:r.jsx(Js,{size:16})}),p&&r.jsxs(ht,{children:[r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{onClick:za,"aria-pressed":we==="blocks","aria-label":e("sandbox.preview.blocksEditor"),active:we==="blocks",children:r.jsx(Ii,{size:16})})}),r.jsx(mt,{children:e("sandbox.preview.blocksEditor")})]}),tt&&r.jsxs(ht,{children:[r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{onClick:D,"aria-pressed":R,"aria-label":e("sectionsEditor.sectionsEditor.viewJson"),active:R,children:r.jsx(Ui,{size:16})})}),r.jsx(mt,{children:e("sectionsEditor.sectionsEditor.viewJson")})]})]}),ti=!!z&&we==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[wt&&Object.entries(gn).map(([d,y])=>(nt[d]??"")===""?r.jsx(Ac,{sources:y,template:I,paramName:d,sandboxRef:wt,onFill:$=>jn(d,$)},`${oe}:${d}`):null),r.jsxs(r.Fragment,{children:[r.jsx(zn.Toolbar.Center.Portal,{fallback:r.jsx("div",{className:"flex min-w-0 items-center justify-center border-b p-2",children:Vs}),children:Vs}),r.jsx(zn.Toolbar.Right.Portal,{fallback:qs,children:qs})]}),r.jsx("div",{className:"flex-1 overflow-hidden relative",children:ti?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(xr,{virtualMcpId:t,externalSelection:N,onSectionPicked:Fs,onViewJsonFile:D}),R&&tt&&r.jsx("div",{className:"absolute inset-0 z-10",children:r.jsx(br,{ref:T,virtualMcpId:t,pageKey:tt,onClose:A})})]}):r.jsxs(rr,{orientation:"horizontal",disabled:we!=="blocks",className:"relative isolate",children:[r.jsx(sn,{ref:S,id:"preview-blocks-editor",defaultSize:we==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:we==="blocks"&&r.jsx(xr,{virtualMcpId:t,externalSelection:N,onSectionPicked:Fs,onViewJsonFile:D})}),we==="blocks"&&r.jsx(ar,{withHandle:!0}),r.jsx(sn,{id:"preview-canvas",defaultSize:we==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden relative z-0",children:r.jsxs(rr,{orientation:"horizontal",disabled:!(R&&tt),children:[r.jsx(sn,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:d=>{if(!d)return;const y=()=>F(te=>te.width===d.clientWidth&&te.height===d.clientHeight?te:{width:d.clientWidth,height:d.clientHeight});y();const $=new ResizeObserver(y);return $.observe(d),()=>$.disconnect()},className:Fe("h-full relative overflow-clip flex justify-center",Pt&&!tn&&"bg-muted/30"),children:[(xe||xa)&&Pt&&r.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:r.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),J.showDecidingLoader&&r.jsx("div",{"data-testid":"preview-deciding",className:"absolute inset-0 z-30 flex items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}),J.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"starting",progress:fs,claimPhase:vn})}),!Z&&Je.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"suspended",onResume:Ue.resume})}),!Z&&Je.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"errored",error:Je.error,onRetry:Ue.retry,connectionsHref:`/${le.slug}/settings/connections`})}),J.showWakingPill&&r.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl bg-muted px-4 py-3 shadow-soft pointer-events-none select-none",children:[r.jsx(gt,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),we==="visual"&&!b&&r.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-special/40 bg-special/90 px-3 py-1 text-xs font-medium text-special-foreground shadow-soft backdrop-blur-sm pointer-events-none select-none",children:[r.jsx(Js,{size:12}),e("sandbox.preview.clickElementToAsk")]}),we==="visual"&&b&&r.jsx(Ql,{element:b,onDismiss:()=>w(null)}),Pt&&Qe&&r.jsx("div",{className:Fe("shrink-0",!tn&&"bg-background shadow-edge"),style:ei,onMouseLeave:Ua,children:r.jsx("iframe",{ref:P,src:it,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Ts.handleError,onLoad:()=>{if(bn(wr),Oa(it),Ts.handleLoad(),fe(),Pn.current=st.current,Rt&&An(Ct),J.mode!=="sandbox"||Z){(J.mode==="production"&&!J.showWakingPill||Z)&&we==="blocks"&&Sn();return}if(fi("vm_preview_loaded",{view_mode:we,vm_id:Ie?.sandboxHandle??null}),!_)try{const d=P.current?.contentWindow?.location?.pathname;if(!d)return;const y=Oe.current;if(y!==null&&(Oe.current=null,Ee(d)!==Ee(y))||Ee(d)===Ee(Ce))return;re(d),Tt({path:d,pageKey:ae,params:nt})}catch{}we==="visual"&&Os(),we==="blocks"&&Sn()}},J.iframeBase)})]})}),R&&tt&&r.jsxs(r.Fragment,{children:[r.jsx(ar,{withHandle:!0}),r.jsx(sn,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:r.jsx(br,{ref:T,virtualMcpId:t,pageKey:tt,onClose:A})})]})]})})]})}),r.jsx(Hc,{open:Q,onOpenChange:H,isPending:ss.isPending,error:L,templates:Ge,onSubmit:Ya})]})}const qn={app:null,split:!1};function Dd(t){const e=ue.c(24),{project:n,maxApps:s,children:a}=t,l=Te();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={silent:!0},e[0]=u):u=e[0];const o=Hi(u),i=Ut();let c;e[1]!==n.metadata.runtime?(c=n.metadata.runtime??{},e[1]=n.metadata.runtime,e[2]=c):c=e[2];const m=c;let f;e[3]!==m.apps?(f=m.apps??[],e[3]=m.apps,e[4]=f):f=e[4];const p=f;let k;e[5]!==o.update||e[6]!==i||e[7]!==n.id||e[8]!==n.metadata||e[9]!==m||e[10]!==l?(k=b=>o.update.mutate({id:n.id,data:{metadata:{...rl(n.metadata),runtime:{...m,apps:b.length?b:null}}}},{onSuccess:()=>i.start(),onError:()=>dn.error(l("sandbox.appTabs.saveError"))}),e[5]=o.update,e[6]=i,e[7]=n.id,e[8]=n.metadata,e[9]=m,e[10]=l,e[11]=k):k=e[11];const g=k,v=m.path??null;let h,x;e[12]!==p||e[13]!==g?(h=b=>g([...p,{path:b}]),x=b=>g(p.filter(w=>w.path!==b)),e[12]=p,e[13]=g,e[14]=h,e[15]=x):(h=e[14],x=e[15]);let C;return e[16]!==p||e[17]!==a||e[18]!==s||e[19]!==n.id||e[20]!==v||e[21]!==h||e[22]!==x?(C=r.jsx(Fd,{virtualMcpId:n.id,mainPath:v,apps:p,maxApps:s,onAddApp:h,onRemoveApp:x,children:a}),e[16]=p,e[17]=a,e[18]=s,e[19]=n.id,e[20]=v,e[21]=h,e[22]=x,e[23]=C):C=e[23],C}function Fd(t){const e=ue.c(102),{virtualMcpId:n,mainPath:s,apps:a,maxApps:l,onAddApp:u,onRemoveApp:o,children:i}=t,c=Te(),m=Yr(),{currentBranch:f}=Mt(),p=Ut(),k=Xn().lifecycle.phase,g=fn(n,f),{url:v}=Gr(n);let h;e[0]!==g||e[1]!==v?(h=He(g)??v,e[0]=g,e[1]=v,e[2]=h):h=e[2];const x=h,C=x??p.previewUrl,b=!!x||k==="running",w=!b&&p.status==="errored";let N;e[3]!==p.vmEntry?.startedWith?.apps?(N=p.vmEntry?.startedWith?.apps??[],e[3]=p.vmEntry?.startedWith?.apps,e[4]=N):N=e[4];const j=N;let P;e[5]!==n?(P=In.previewAppLayout(n),e[5]=n,e[6]=P):P=e[6];const[S,R]=Un(P,$d);let U;e[7]!==a||e[8]!==S?(U=a.some(fe=>fe.path===S.app)?S.app:null,e[7]=a,e[8]=S,e[9]=U):U=e[9];const T=U,A=T!==null&&S.split&&!m,D=T===null||A,O=T??a[0]?.path??null,[F,K]=E.useState(null),[ee,W]=E.useState(!1);let G;e[10]===Symbol.for("react.memo_cache_sentinel")?(G=()=>{K(null),W(!1)},e[10]=G):G=e[10];const V=G;let q;e[11]!==a||e[12]!==F||e[13]!==m||e[14]!==s||e[15]!==u||e[16]!==R?(q=()=>{if(F===null)return;const fe=lr(F);if(!fe){V();return}if(fe===lr(s??"")||a.some(le=>le.path===fe)){W(!0);return}u(fe),R({app:fe,split:!m}),V()},e[11]=a,e[12]=F,e[13]=m,e[14]=s,e[15]=u,e[16]=R,e[17]=q):q=e[17];const X=q;let Q;e[18]!==s||e[19]!==c?(Q=s?_n(s):c("sandbox.appTabs.root"),e[18]=s,e[19]=c,e[20]=Q):Q=e[20];const H=Q;let L;e[21]!==A||e[22]!==c?(L=c(A?"sandbox.appTabs.single":"sandbox.appTabs.split"),e[21]=A,e[22]=c,e[23]=L):L=e[23];const B=L;let _;e[24]!==c?(_=c("sandbox.appTabs.label"),e[24]=c,e[25]=_):_=e[25];let M;e[26]!==c?(M=c("sandbox.appTabs.main"),e[26]=c,e[27]=M):M=e[27];let z;e[28]!==c?(z=c("sandbox.appTabs.mainHint"),e[28]=c,e[29]=z):z=e[29];let Y;e[30]!==R?(Y=()=>R(qn),e[30]=R,e[31]=Y):Y=e[31];let ne;e[32]!==w||e[33]!==H||e[34]!==b||e[35]!==D||e[36]!==M||e[37]!==z||e[38]!==Y?(ne=r.jsx(Sr,{label:H,badge:M,hint:z,ready:b,failed:w,onScreen:D,onSelect:Y}),e[32]=w,e[33]=H,e[34]=b,e[35]=D,e[36]=M,e[37]=z,e[38]=Y,e[39]=ne):ne=e[39];let se;if(e[40]!==a||e[41]!==T||e[42]!==w||e[43]!==H||e[44]!==o||e[45]!==b||e[46]!==R||e[47]!==A||e[48]!==c){let fe;e[50]!==T||e[51]!==w||e[52]!==H||e[53]!==o||e[54]!==b||e[55]!==R||e[56]!==A||e[57]!==c?(fe=le=>{const Re=_n(le.path);return r.jsx(Sr,{label:Re,hint:c("sandbox.appTabs.extraHint",{app:H}),ready:b,failed:w,onScreen:le.path===T,onSelect:()=>R({app:le.path,split:A}),onRemove:()=>o(le.path),removeLabel:c("sandbox.appTabs.remove",{app:Re})},le.path)},e[50]=T,e[51]=w,e[52]=H,e[53]=o,e[54]=b,e[55]=R,e[56]=A,e[57]=c,e[58]=fe):fe=e[58],se=a.map(fe),e[40]=a,e[41]=T,e[42]=w,e[43]=H,e[44]=o,e[45]=b,e[46]=R,e[47]=A,e[48]=c,e[49]=se}else se=e[49];let I;e[59]!==ne||e[60]!==se||e[61]!==_?(I=r.jsxs("div",{role:"tablist","aria-label":_,className:"flex min-w-0 items-center gap-1 overflow-x-auto",children:[ne,se]}),e[59]=ne,e[60]=se,e[61]=_,e[62]=I):I=e[62];let re;e[63]!==a.length||e[64]!==X||e[65]!==F||e[66]!==ee||e[67]!==l||e[68]!==c?(re=F!==null?r.jsx("form",{className:"w-40 shrink-0",onSubmit:fe=>{fe.preventDefault(),X()},children:r.jsx("input",{autoFocus:!0,value:F,placeholder:"apps/checkout","aria-label":c("sandbox.appTabs.pathLabel"),"aria-invalid":ee,onChange:fe=>{K(fe.target.value),W(!1)},onBlur:V,onKeyDown:fe=>{fe.key==="Escape"&&V()},className:Fe("h-7 w-full rounded-md border bg-background px-2 font-mono text-xs outline-none",ee?"border-destructive":"border-border")})}):a.length<l&&r.jsx(ft,{label:c("sandbox.appTabs.add"),onClick:()=>K(""),children:r.jsx($r,{})}),e[63]=a.length,e[64]=X,e[65]=F,e[66]=ee,e[67]=l,e[68]=c,e[69]=re):re=e[69];let ae;e[70]!==m||e[71]!==R||e[72]!==A||e[73]!==B||e[74]!==O?(ae=!m&&O&&r.jsx(ft,{label:B,active:A,onClick:()=>R(A?qn:{app:O,split:!0}),children:r.jsx(zi,{})}),e[70]=m,e[71]=R,e[72]=A,e[73]=B,e[74]=O,e[75]=ae):ae=e[75];let ie;e[76]!==I||e[77]!==re||e[78]!==ae?(ie=r.jsxs(r.Fragment,{children:[I,re,ae]}),e[76]=I,e[77]=re,e[78]=ae,e[79]=ie):ie=e[79];const me=ie;let pe;e[80]!==me?(pe=r.jsx(zn.Topbar.Left.Portal,{fallback:r.jsx("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-border px-2",children:me}),children:r.jsx("div",{className:"ml-1 flex min-w-0 items-center gap-1 border-l border-border/60 pl-2",children:me})}),e[80]=me,e[81]=pe):pe=e[81];let xe;e[82]!==i||e[83]!==D?(xe=D&&r.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:i}),e[82]=i,e[83]=D,e[84]=xe):xe=e[84];let he;e[85]!==T||e[86]!==w||e[87]!==p.start||e[88]!==x||e[89]!==H||e[90]!==C||e[91]!==b||e[92]!==R||e[93]!==A||e[94]!==j?(he=T!==null&&r.jsx(Bd,{name:_n(T),mainName:H,appUrl:C?al(C,T):null,ready:b,failed:w,notStarted:!x&&!j.includes(T),onStart:p.start,className:Fe(A&&"border-l border-border"),onClose:A?()=>R({app:T,split:!1}):void 0},T),e[85]=T,e[86]=w,e[87]=p.start,e[88]=x,e[89]=H,e[90]=C,e[91]=b,e[92]=R,e[93]=A,e[94]=j,e[95]=he):he=e[95];let ve;e[96]!==xe||e[97]!==he?(ve=r.jsxs("div",{className:"flex min-h-0 flex-1",children:[xe,he]}),e[96]=xe,e[97]=he,e[98]=ve):ve=e[98];let Se;return e[99]!==pe||e[100]!==ve?(Se=r.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col",children:[pe,ve]}),e[99]=pe,e[100]=ve,e[101]=Se):Se=e[101],Se}function $d(t){return t??qn}function Sr(t){const e=ue.c(28),{label:n,badge:s,hint:a,ready:l,failed:u,onScreen:o,onSelect:i,onRemove:c,removeLabel:m}=t,f=o?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/60 hover:text-foreground";let p;e[0]!==f?(p=Fe("group/app-tab flex h-7 shrink-0 items-center rounded-md text-xs transition-colors",f),e[0]=f,e[1]=p):p=e[1];const k=l?"bg-success":u?"bg-destructive":"animate-pulse bg-warning";let g;e[2]!==k?(g=Fe("size-1.5 rounded-full",k),e[2]=k,e[3]=g):g=e[3];let v;e[4]!==g?(v=r.jsx("span",{"aria-hidden":!0,className:g}),e[4]=g,e[5]=v):v=e[5];let h;e[6]!==n?(h=r.jsx("span",{className:"max-w-40 truncate",children:n}),e[6]=n,e[7]=h):h=e[7];let x;e[8]!==s?(x=s&&r.jsx("span",{className:"text-[10px] text-muted-foreground",children:s}),e[8]=s,e[9]=x):x=e[9];let C;e[10]!==o||e[11]!==i||e[12]!==v||e[13]!==h||e[14]!==x?(C=r.jsx(pt,{asChild:!0,children:r.jsxs("button",{type:"button",role:"tab","aria-selected":o,onClick:i,className:"flex h-full items-center gap-1.5 rounded-md px-2.5 focus-ring",children:[v,h,x]})}),e[10]=o,e[11]=i,e[12]=v,e[13]=h,e[14]=x,e[15]=C):C=e[15];let b;e[16]!==a?(b=r.jsx(mt,{className:"max-w-64",children:a}),e[16]=a,e[17]=b):b=e[17];let w;e[18]!==C||e[19]!==b?(w=r.jsxs(ht,{children:[C,b]}),e[18]=C,e[19]=b,e[20]=w):w=e[20];let N;e[21]!==c||e[22]!==m?(N=c&&r.jsx("button",{type:"button","aria-label":m,onClick:c,className:"-ml-1 mr-1 flex size-5 items-center justify-center rounded opacity-0 hover:bg-sidebar-accent focus-ring focus-visible:opacity-100 group-hover/app-tab:opacity-100",children:r.jsx(sa,{className:"size-3"})}),e[21]=c,e[22]=m,e[23]=N):N=e[23];let j;return e[24]!==w||e[25]!==N||e[26]!==p?(j=r.jsxs("div",{className:p,children:[w,N]}),e[24]=w,e[25]=N,e[26]=p,e[27]=j):j=e[27],j}function Bd(t){const e=ue.c(71),{name:n,mainName:s,appUrl:a,ready:l,failed:u,notStarted:o,onStart:i,className:c,onClose:m}=t,f=Te(),[p,k]=E.useState("/"),[g,v]=E.useState("desktop"),[h,x]=E.useState(0),C=E.useRef(null);let b;e[0]!==a||e[1]!==p?(b=a?il(a,p):null,e[0]=a,e[1]=p,e[2]=b):b=e[2];const w=b;let N;e[3]!==c?(N=Fe("flex min-h-0 min-w-0 flex-1 flex-col",c),e[3]=c,e[4]=N):N=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=z=>{z.preventDefault(),k(C.current?.value||"/")},e[5]=j):j=e[5];let P;e[6]!==n||e[7]!==f?(P=f("sandbox.appPane.path",{app:n}),e[6]=n,e[7]=f,e[8]=P):P=e[8];let S;e[9]!==p||e[10]!==P?(S=r.jsx("form",{className:"min-w-0 flex-1",onSubmit:j,children:r.jsx("input",{ref:C,defaultValue:p,"aria-label":P,className:"h-7 w-full rounded-md border border-border/60 bg-background px-2 font-mono text-xs text-muted-foreground outline-none hover:border-border focus:border-border focus:text-foreground"})}),e[9]=p,e[10]=P,e[11]=S):S=e[11];let R;e[12]!==g||e[13]!==f?(R=f(g==="desktop"?"sandbox.preview.deviceMobile":"sandbox.preview.deviceDesktop"),e[12]=g,e[13]=f,e[14]=R):R=e[14];let U;e[15]===Symbol.for("react.memo_cache_sentinel")?(U=()=>v(Ud),e[15]=U):U=e[15];let T;e[16]!==g?(T=g==="desktop"?r.jsx(Fr,{}):r.jsx(Dr,{}),e[16]=g,e[17]=T):T=e[17];let A;e[18]!==R||e[19]!==T?(A=r.jsx(ft,{label:R,onClick:U,children:T}),e[18]=R,e[19]=T,e[20]=A):A=e[20];let D;e[21]!==n||e[22]!==f?(D=f("sandbox.appPane.reload",{app:n}),e[21]=n,e[22]=f,e[23]=D):D=e[23];const O=!w||!l;let F,K;e[24]===Symbol.for("react.memo_cache_sentinel")?(F=()=>x(Md),K=r.jsx(pi,{}),e[24]=F,e[25]=K):(F=e[24],K=e[25]);let ee;e[26]!==D||e[27]!==O?(ee=r.jsx(ft,{label:D,disabled:O,onClick:F,children:K}),e[26]=D,e[27]=O,e[28]=ee):ee=e[28];let W;e[29]!==n||e[30]!==f?(W=f("sandbox.appPane.openInNewTab",{app:n}),e[29]=n,e[30]=f,e[31]=W):W=e[31];const G=!w||!l;let V;e[32]!==w?(V=()=>w&&window.open(w,"_blank","noopener"),e[32]=w,e[33]=V):V=e[33];let q;e[34]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx(Cr,{}),e[34]=q):q=e[34];let X;e[35]!==W||e[36]!==G||e[37]!==V?(X=r.jsx(ft,{label:W,disabled:G,onClick:V,children:q}),e[35]=W,e[36]=G,e[37]=V,e[38]=X):X=e[38];let Q;e[39]!==n||e[40]!==m||e[41]!==f?(Q=m&&r.jsx(ft,{label:f("sandbox.appPane.close",{app:n}),onClick:m,children:r.jsx(sa,{})}),e[39]=n,e[40]=m,e[41]=f,e[42]=Q):Q=e[42];let H;e[43]!==ee||e[44]!==X||e[45]!==Q||e[46]!==S||e[47]!==A?(H=r.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-border px-2",children:[S,A,ee,X,Q]}),e[43]=ee,e[44]=X,e[45]=Q,e[46]=S,e[47]=A,e[48]=H):H=e[48];let L;e[49]!==s||e[50]!==f?(L=f("sandbox.appPane.previewOnly",{app:s}),e[49]=s,e[50]=f,e[51]=L):L=e[51];let B;e[52]!==L?(B=r.jsx("p",{className:"shrink-0 truncate border-b border-border bg-muted/40 px-3 py-1.5 text-xs text-muted-foreground",children:L}),e[52]=L,e[53]=B):B=e[53];let _;e[54]!==g||e[55]!==u||e[56]!==s||e[57]!==n||e[58]!==o||e[59]!==i||e[60]!==l||e[61]!==h||e[62]!==w||e[63]!==f?(_=r.jsx("div",{className:"flex min-h-0 flex-1 justify-center overflow-auto bg-muted/40",children:l&&o?r.jsxs("div",{className:"flex flex-col items-center gap-3 self-center px-6 text-center",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:f("sandbox.appPane.notStarted",{app:n})}),r.jsx($e,{size:"sm",variant:"outline",onClick:i,children:f("sandbox.appPane.start",{app:n})})]}):!l||!w?r.jsx("p",{className:"self-center px-6 text-center text-sm text-muted-foreground",children:l?f("sandbox.appPane.noUrl"):u?f("sandbox.appPane.failed",{app:s}):f("sandbox.appPane.waiting")}):r.jsx("iframe",{src:w,title:n,className:Fe("h-full bg-background",g==="mobile"?"w-[412px] max-w-full border-x border-border":"w-full")},`${w}#${h}`)}),e[54]=g,e[55]=u,e[56]=s,e[57]=n,e[58]=o,e[59]=i,e[60]=l,e[61]=h,e[62]=w,e[63]=f,e[64]=_):_=e[64];let M;return e[65]!==n||e[66]!==N||e[67]!==H||e[68]!==B||e[69]!==_?(M=r.jsxs("section",{"aria-label":n,className:N,children:[H,B,_]}),e[65]=n,e[66]=N,e[67]=H,e[68]=B,e[69]=_,e[70]=M):M=e[70],M}function Md(t){return t+1}function Ud(t){return t==="desktop"?"mobile":"desktop"}function ft(t){const e=ue.c(11),{label:n,children:s,active:a,disabled:l,onClick:u}=t;let o;e[0]!==a||e[1]!==s||e[2]!==l||e[3]!==n||e[4]!==u?(o=r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{"aria-label":n,"aria-pressed":a,active:a,disabled:l,onClick:u,children:s})}),e[0]=a,e[1]=s,e[2]=l,e[3]=n,e[4]=u,e[5]=o):o=e[5];let i;e[6]!==n?(i=r.jsx(mt,{children:n}),e[6]=n,e[7]=i):i=e[7];let c;return e[8]!==o||e[9]!==i?(c=r.jsxs(ht,{children:[o,i]}),e[8]=o,e[9]=i,e[10]=c):c=e[10],c}const Id=async(t,e)=>{try{return await fetch(t,{method:"HEAD",mode:"no-cors",cache:"no-store",credentials:"omit",signal:e}),!0}catch{return!1}},zd=1e4,Kd=1e4,Hd=5e3,Vd=2;function Wd(t,e){return t&&e===0?Kd:Math.min(1e3*2**Math.max(0,e-1),Hd)}function qd(t,e,n){return e?!0:t===!0&&n<Vd}function Gd(t,e){const n=ue.c(11),s=Id,a=mi();let l;n[0]!==t?(l=Gn.localAppReachable(t??""),n[0]=t,n[1]=l):l=n[1];const u=l;let o;n[2]!==s||n[3]!==a||n[4]!==u||n[5]!==t?(o=async f=>{const{signal:p}=f,k=new AbortController,g=()=>k.abort();p.addEventListener("abort",g);const v=setTimeout(g,zd),h=await s(t,k.signal).catch(Yd);clearTimeout(v),p.removeEventListener("abort",g);const x=a.getQueryData(u),C=h?0:(x?.failures??0)+1;return{up:qd(x?.up??null,h,C),failures:C}},n[2]=s,n[3]=a,n[4]=u,n[5]=t,n[6]=o):o=n[6];const i=!!t;let c;n[7]!==u||n[8]!==o||n[9]!==i?(c={queryKey:u,queryFn:o,enabled:i,retry:!1,staleTime:0,gcTime:0,refetchInterval:Jd},n[7]=u,n[8]=o,n[9]=i,n[10]=c):c=n[10];const{data:m}=Tr(c);return t?m?.up??null:null}function Jd(t){return t.state.data?Wd(t.state.data.up,t.state.data.failures):!1}function Yd(){return!1}function Qd(t){const{backend:e}=t;if(e.kind==="protocol"&&e.source==="local")return{kind:"connected"};if(e.kind==="unavailable"&&e.source==="local"){const n=e.problem;return!n||n.reason==="not-answering"?t.access==="denied"?{kind:"needs-permission"}:{kind:"not-running"}:{kind:"problem",problem:n}}return{kind:"connecting"}}function Ju(t){const e=ue.c(53),{virtualMcpId:n}=t,s=Te(),a=Vi(n),{connection:l}=Jr(n),{activeTask:u,taskId:o,currentBranch:i}=Mt(),c=ml(o),[m,f]=E.useState(!1),p=fn(n,i);let k;e[0]!==p||e[1]!==l?(k=l?He(p):null,e[0]=p,e[1]=l,e[2]=k):k=e[2];const g=k,v=Gd(g),h=aa(),x=ol("multi_app_preview");if(dl({threadId:o,sandboxBranch:u?.branch??i,agentHasRepo:On(a?.metadata),threadHasRepo:On(c)||On(u?.metadata)})==="none"&&!l){let j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(cr,{className:"size-7 text-foreground"})}),e[3]=j):j=e[3];let P;e[4]!==s?(P=s("mainPanelTabs.previewTab.noSourceToPreview"),e[4]=s,e[5]=P):P=e[5];let S;e[6]!==s?(S=s("mainPanelTabs.previewTab.connectGithubDescription"),e[6]=s,e[7]=S):S=e[7];let R,U;e[8]===Symbol.for("react.memo_cache_sentinel")?(R=()=>f(!0),U=r.jsx(cr,{className:"size-4"}),e[8]=R,e[9]=U):(R=e[8],U=e[9]);let T;e[10]!==s?(T=s("mainPanelTabs.previewTab.connectGithub"),e[10]=s,e[11]=T):T=e[11];let A;e[12]!==T?(A=r.jsxs($e,{onClick:R,children:[U,T]}),e[12]=T,e[13]=A):A=e[13];let D;e[14]!==P||e[15]!==S||e[16]!==A?(D=r.jsx(ll,{className:"h-full",image:j,title:P,description:S,actions:A}),e[14]=P,e[15]=S,e[16]=A,e[17]=D):D=e[17];let O;e[18]!==m?(O=r.jsx(cl,{open:m,onOpenChange:f,mode:"agent"}),e[18]=m,e[19]=O):O=e[19];let F;return e[20]!==O||e[21]!==D?(F=r.jsxs(r.Fragment,{children:[D,O]}),e[20]=O,e[21]=D,e[22]=F):F=e[22],F}if(l&&a&&!He(p)){let j;e[23]!==h||e[24]!==p?(j=Qd({backend:p,access:h}),e[23]=h,e[24]=p,e[25]=j):j=e[25];let P;e[26]!==l.endpoint?(P=yo(l.endpoint),e[26]=l.endpoint,e[27]=P):P=e[27];let S;return e[28]!==j||e[29]!==P?(S=r.jsx(Zd,{status:j,host:P}),e[28]=j,e[29]=P,e[30]=S):S=e[30],S}if(g&&v!==!0){let j;e[31]!==s?(j=s("mainPanelTabs.previewTab.localAppWaiting.title"),e[31]=s,e[32]=j):j=e[32];let P;e[33]!==g||e[34]!==s?(P=s("mainPanelTabs.previewTab.localAppWaiting.body",{host:Xd(g)}),e[33]=g,e[34]=s,e[35]=P):P=e[35];let S;e[36]!==P?(S=r.jsx(na,{text:P}),e[36]=P,e[37]=S):S=e[37];let R;e[38]!==s?(R=s("mainPanelTabs.previewTab.localAppWaiting.hint"),e[38]=s,e[39]=R):R=e[39];let U;e[40]!==R?(U=r.jsx("p",{role:"status",className:"text-center text-sm text-muted-foreground",children:R}),e[40]=R,e[41]=U):U=e[41];let T;return e[42]!==j||e[43]!==S||e[44]!==U?(T=r.jsx(un,{headingLevel:2,waiting:!0,title:j,lead:S,footer:U}),e[42]=j,e[43]=S,e[44]=U,e[45]=T):T=e[45],T}let b;e[46]!==n?(b=r.jsx(Od,{virtualMcpId:n}),e[46]=n,e[47]=b):b=e[47];const w=b;let N;return e[48]!==a||e[49]!==x||e[50]!==w||e[51]!==l?(N=r.jsx(Ni,{children:x&&a&&!l?r.jsx(Dd,{project:a,maxApps:nl,children:w}):w}),e[48]=a,e[49]=x,e[50]=w,e[51]=l,e[52]=N):N=e[52],N}function Xd(t){try{return new URL(t).host}catch{return t}}function Zd(t){const e=ue.c(13),{status:n,host:s}=t,a=Te();if(n.kind==="connected"){let o;e[0]!==a?(o=a("mainPanelTabs.previewTab.localhostNoPreview.title"),e[0]=a,e[1]=o):o=e[1];let i;e[2]!==a?(i=a("mainPanelTabs.previewTab.localhostNoPreview.body"),e[2]=a,e[3]=i):i=e[3];let c;return e[4]!==o||e[5]!==i?(c=r.jsx(un,{headingLevel:2,waiting:!1,title:o,lead:i}),e[4]=o,e[5]=i,e[6]=c):c=e[6],c}let l;e[7]!==s||e[8]!==n?(l=bl(n,s),e[7]=s,e[8]=n,e[9]=l):l=e[9];let u;return e[10]!==s||e[11]!==l?(u=r.jsx(xl,{wait:l,hosts:s}),e[10]=s,e[11]=l,e[12]=u):u=e[12],u}export{xl as L,Ju as P,un as S,Gu as u};
551
+ `)}function Yl(t,e,n=320,s=44,a=12){const{x:l,y:u}=t,{width:o,height:i}=e,c=Math.max(a,Math.min(l-n/2,o-n-a)),f=u/i>.68?Math.max(a,u-s-18):Math.min(u+18,i-s-a);return{leftPct:c/o*100,topPct:f/i*100}}function Ql(t){const e=ue.c(45),{element:n,onDismiss:s}=t,[a,l]=E.useState(""),u=E.useRef(null),{sendMessage:o}=Ti(),{openSidePanel:i}=Mo(),c=Te();let m;e[0]!==n||e[1]!==a||e[2]!==s||e[3]!==i||e[4]!==o?(m=()=>{if(!a.trim())return;const K=Jl(n,a);i(),o({parts:[{type:"text",text:K}]}),s()},e[0]=n,e[1]=a,e[2]=s,e[3]=i,e[4]=o,e[5]=m):m=e[5];const f=m;let p;e[6]!==n.position||e[7]!==n.viewport?(p=Yl(n.position,n.viewport),e[6]=n.position,e[7]=n.viewport,e[8]=p):p=e[8];const k=p,g=`${k.leftPct}%`,v=`${k.topPct}%`;let h;e[9]!==g||e[10]!==v?(h={left:g,top:v,width:"320px"},e[9]=g,e[10]=v,e[11]=h):h=e[11];let x;e[12]!==f?(x=K=>{K.preventDefault(),f()},e[12]=f,e[13]=x):x=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=K=>l(K.target.value),e[14]=C):C=e[14];let b;e[15]!==s?(b=K=>{K.key==="Escape"&&s()},e[15]=s,e[16]=b):b=e[16];let w;e[17]!==c?(w=c("sandbox.visualEditorPrompt.inputPlaceholder"),e[17]=c,e[18]=w):w=e[18];let N;e[19]!==a||e[20]!==b||e[21]!==w?(N=r.jsx("input",{ref:u,autoFocus:!0,type:"text",value:a,onChange:C,onKeyDown:b,placeholder:w,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),e[19]=a,e[20]=b,e[21]=w,e[22]=N):N=e[22];let j;e[23]!==a?(j=a.trim(),e[23]=a,e[24]=j):j=e[24];const P=!j;let S;e[25]!==c?(S=c("sandbox.visualEditorPrompt.sendButton"),e[25]=c,e[26]=S):S=e[26];let R;e[27]!==c?(R=c("sandbox.visualEditorPrompt.sendButton"),e[27]=c,e[28]=R):R=e[28];let U;e[29]!==R?(U=r.jsx("title",{children:R}),e[29]=R,e[30]=U):U=e[30];let T;e[31]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e[31]=T):T=e[31];let A;e[32]!==U?(A=r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[U,T]}),e[32]=U,e[33]=A):A=e[33];let D;e[34]!==P||e[35]!==S||e[36]!==A?(D=r.jsx("button",{type:"submit",disabled:P,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-foreground text-background transition-opacity disabled:opacity-30",title:S,children:A}),e[34]=P,e[35]=S,e[36]=A,e[37]=D):D=e[37];let O;e[38]!==N||e[39]!==D||e[40]!==x?(O=r.jsxs("form",{className:"pointer-events-auto flex w-full items-center gap-1.5 rounded-xl glass px-3 py-1.5",onSubmit:x,children:[N,D]}),e[38]=N,e[39]=D,e[40]=x,e[41]=O):O=e[41];let F;return e[42]!==O||e[43]!==h?(F=r.jsx("div",{className:"absolute z-30 pointer-events-none",style:h,children:O}),e[42]=O,e[43]=h,e[44]=F):F=e[44],F}const mr="site-links",Xl=/details?page|\bpdp\b/i,Zl=/listingpage|\bplp\b/i;function ec(t,e,n){const s=new Set;for(const o of n)Xl.test(o)&&s.add("product"),Zl.test(o)&&s.add("category");const a=Bt(Qn(t)),l=a[a.length-1],u=a[a.length-2];return l?.type==="text"&&l.text==="/p"&&u?.type==="param"&&u.name===e&&s.add("product"),e==="*"&&a.some(o=>o.type==="param"&&o.name==="*")&&s.add("category"),s}const tc=["rosa","preto","pink","black"];function an(t,e){const n=e.trim();return n?t(n):tc.flatMap(s=>t(s))}function nc(t,e){const n=e.trim(),s=[];/^\d+$/.test(n)&&s.push({resolveType:t,props:{ids:[n]}});const l=n.includes("-")&&!/\s/.test(n)?n.replace(/-+/g," "):n;return s.push({resolveType:t,props:{query:l,count:10}}),s}const ia=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function Zn(t){return t.split("/")[0]??""}function sc(t){const e=new Set;for(const n of t){const s=Zn(n);ia.has(s)&&e.add(s)}return e}function rc(t,e){const n=Zn(t);return!ia.has(n)||e.size===0?!0:e.has(n)}const ac=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>an(n=>nc(t,n),e),optionsFromPayload:on},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>an(n=>[{resolveType:t,props:{props:{search:n,pageSize:10,currentPage:1}}}],e),optionsFromPayload:on},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>an(n=>[{resolveType:t,props:{term:n,hitsPerPage:10}}],e),optionsFromPayload:on},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>an(n=>[{resolveType:t,props:{query:n,term:n,count:10,hitsPerPage:10}}],e),optionsFromPayload:on},{kind:"category",test:t=>t==="vtex/loaders/categories/tree.ts"||/categor(y|ies).*tree/i.test(t),clientFilter:!0,buildRequests:t=>[{resolveType:t,props:{}}],optionsFromPayload:fc}];function ic(t,e,n=new Set){const s=[...e],a=o=>{const i=[];for(const c of ac){if(c.kind!==o)continue;const m=s.find(f=>c.test(f)&&rc(f,n));m&&i.push({cand:c,resolveType:m})}return i.find(c=>n.has(Zn(c.resolveType)))??i[0]},l=(o,i,c)=>({kind:o.kind,id:`${o.kind}:${i}`,resolveType:i,clientFilter:o.clientFilter,isFallback:c,buildRequests:m=>o.buildRequests(i,m),optionsFromPayload:o.optionsFromPayload}),u=[];for(const o of["product","category"]){if(!t.has(o))continue;const i=a(o);i&&u.push(l(i.cand,i.resolveType,!1))}return t.size>0&&u.push(oc(t.has("category")?"category":"product")),u}function oc(t){return{kind:t,id:mr,resolveType:mr,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,n)=>vc(e,n)}}function et(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function lc(t,e,n){const s=new Set,a=new Set,l=u=>{if(Array.isArray(u)){for(const c of u)l(c);return}const o=et(u);if(!o)return;const i=o.__resolveType;if(typeof i=="string"){if(n(i))s.add(i);else if(i in e&&!a.has(i)){a.add(i);const c=et(e[i])?.__resolveType;typeof c=="string"&&n(c)&&s.add(i),l(e[i])}}for(const c of Object.values(o))l(c)};return l(t),s}function oa(t){const e=new Set,n=[];for(const s of t)for(const a of s)e.has(a.value)||(e.add(a.value),n.push(a));return n}function la(t){try{return decodeURIComponent(t)}catch{return t}}function cc(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dc(t){const e=[];let n="^";for(const s of t)s.type==="text"?n+=cc(s.text):(e.push(s.name),n+=s.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${n}$`),order:e}}function ca(t,e,n){if(typeof t!="string"||!t)return null;let s;try{s=new URL(t,"https://placeholder.invalid").pathname}catch{return null}s=s.replace(/\/+$/,"");const a=Bt(Qn(e)),{pattern:l,order:u}=dc(a),o=u.indexOf(n);if(o===-1)return null;const i=s.match(l);if(!i)return null;const c=i[o+1]?.replace(/^\/+|\/+$/g,"");return c?la(c):null}function on(t,e){const n=et(t),s=Array.isArray(t)?t:Array.isArray(n?.products)?n.products:Array.isArray(n?.list)?n.list:[],a=[],l=new Set;for(const u of s){const o=et(u);if(!o)continue;const i=ca(o.url,e.template,e.paramName);if(!i||l.has(i))continue;l.add(i);const c=et(o.isVariantOf),m=typeof c?.name=="string"&&c.name||typeof o.name=="string"&&o.name||i,f=Array.isArray(o.image)?et(o.image[0]):null,p=typeof f?.url=="string"?f.url:void 0;a.push({value:i,label:m,image:p})}return a}function uc(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const n=e.replace(/^\/+|\/+$/g,"");return n?la(n):null}function fc(t){const e=[],n=new Set,s=(a,l)=>{const u=et(a);if(!u)return;const o=typeof u.name=="string"&&u.name?u.name:"",i=o?[...l,o]:l,c=uc(u.url);if(c&&!n.has(c)&&(n.add(c),e.push({value:c,label:i.join(" › ")||c})),Array.isArray(u.children))for(const m of u.children)s(m,i)};if(Array.isArray(t))for(const a of t)s(a,[]);return e}const pc=new Set(["login","logout","signin","sign-in","signup","sign-up","register","account","myaccount","my-account","minha-conta","conta","cart","carrinho","checkout","wishlist","favoritos","favorites","orders","pedidos","help","hc","sac","atendimento","contato","contact","institucional","newsletter","customer","sales","catalogsearch","search","busca","privacy-policy-cookie-restriction-mode"]);function mc(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function hc(t){if(typeof t!="string"||!t)return[];const e=[],n=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let s,a=0;for(;(s=n.exec(t))!==null&&a++<5e3;){const l=s[1]??"",u=(s[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:l,text:u})}return e}function gc(t){if(typeof t!="string"||!t)return[];const e=[],n=new Set,s=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,a=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let l,u=0;for(;(l=s.exec(t))!==null&&u++<3e3;){const o=(l[1]??"").replace(/\\\//g,"/");if(!o||n.has(o))continue;n.add(o);const i=t.slice(l.index,l.index+900).match(a)?.[1]?.replace(/\\\//g,"/");e.push({url:o,name:l[2]??"",image:i||void 0})}return e}function vc(t,e){const n=[],s=new Set,a=(l,u,o,i)=>{if(n.length>=200)return;const c=ca(l,e.template,e.paramName);!c||s.has(c)||e.paramName==="*"&&/(^|\/)p$/.test(c)||o==="category"&&pc.has(c.split("/")[0]??"")||(s.add(c),n.push({value:c,label:u&&u.length<=80?u:mc(c),kind:o,image:i}))};for(const{url:l,name:u,image:o}of gc(t))a(l,u,"product",o);for(const{href:l,text:u}of hc(t))l.startsWith("/")&&!l.startsWith("//")&&a(l,u,"category");return n}function Dt(t,e,n=50){const s=e.trim().toLowerCase();return(s?t.filter(l=>l.label.toLowerCase().includes(s)||l.value.toLowerCase().includes(s)):t).slice(0,n)}const da=1e4;function xc(t){return{product:{noun:t("sandbox.pathParamPickerChip.kindProductNoun"),heading:t("sandbox.pathParamPickerChip.kindProductHeading")},category:{noun:t("sandbox.pathParamPickerChip.kindCategoryNoun"),heading:t("sandbox.pathParamPickerChip.kindCategoryHeading")}}}async function bc(t,{resolveType:e,props:n}){const s=await fetch(Xi(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...n}),signal:AbortSignal.timeout(da)});if(!s.ok)throw new Error(`Failed to fetch options: ${s.status}`);return s.json()}async function hr(t,e){const n=await fetch(Zi(t,e),{signal:AbortSignal.timeout(da)});if(!n.ok)throw new Error(`Failed to fetch page: ${n.status}`);return n.text()}async function wc(t,e,n){const s=e.optionsFromPayload(await hr(t,"/"),n),a=s.find(u=>u.kind==="category");if(!a)return s;const l=Ve(n.template,{[n.paramName]:a.value});if(l==="/")return s;try{const u=e.optionsFromPayload(await hr(t,l),n).filter(o=>o.kind==="product");return oa([s,u])}catch{return s}}function yc(t,e,n){return Gn.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":n}`)}async function kc(t,e,n,s){if(e.homepageLinks)return wc(t,e,s);const a=e.buildRequests?.(n)??[];if(a.length===0)return[];const l=await Promise.allSettled(a.map(o=>bc(t,o))),u=l.filter(o=>o.status==="fulfilled").map(o=>o.value);if(u.length===0){const o=l.find(i=>i.status==="rejected");throw o?o.reason:new Error("Failed to fetch options")}return oa(u.map(o=>e.optionsFromPayload(o,s)))}function Wn(t,e,n,s,a){return{queryKey:yc(t,e,n),queryFn:()=>kc(t,e,n,s),enabled:a,staleTime:6e4,retry:1}}function Ft(t){const e=ue.c(16),{heading:n,iconKind:s,options:a,template:l,paramName:u,keyPrefix:o,onSelect:i}=t;if(a.length===0)return null;let c;if(e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==a||e[4]!==u||e[5]!==l){let f;e[7]!==s||e[8]!==o||e[9]!==i||e[10]!==u||e[11]!==l?(f=p=>r.jsxs(ut,{value:`${o}:${p.value}`,className:"gap-3 py-2",onSelect:()=>i(p.value),children:[s==="product"&&r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:p.image?r.jsx("img",{src:p.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):r.jsx(Or,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:p.label}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Ve(l,{[u]:p.value})})]})]},`${o}:${p.value}`),e[7]=s,e[8]=o,e[9]=i,e[10]=u,e[11]=l,e[12]=f):f=e[12],c=a.map(f),e[0]=s,e[1]=o,e[2]=i,e[3]=a,e[4]=u,e[5]=l,e[6]=c}else c=e[6];let m;return e[13]!==n||e[14]!==c?(m=r.jsx(dt,{heading:n,children:c}),e[13]=n,e[14]=c,e[15]=m):m=e[15],m}function gr(t){const e=ue.c(2),{text:n}=t;let s;return e[0]!==n?(s=r.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:n}),e[0]=n,e[1]=s):s=e[1],s}function Sc(t){const e=ue.c(52),{sources:n,template:s,paramName:a,value:l,sandboxRef:u,onCommit:o}=t,i=Te(),[c,m]=E.useState(!1),[f,p]=E.useState(""),[k,g]=E.useState(""),v=E.useRef(null),h=a==="*"?i("sandbox.preview.catchAllParamLabel"):`:${a}`,x=xc(i),b=[...new Set(n.map(Z=>x[Z.kind].noun))].join(" or ");let w;e[0]!==i||e[1]!==b?(w=i("sandbox.pathParamPickerChip.searchPlaceholder",{options:b}),e[0]=i,e[1]=b,e[2]=w):w=e[2];const N=w,j={template:s,paramName:a};let P;e[3]!==f?(P=(Z,ce)=>({source:Z,query:ce,options:Z.clientFilter?Dt(ce.data??[],f):ce.data??[]}),e[3]=f,e[4]=P):P=e[4];const S=P,R=n.filter(Lc),U=n.filter(Rc),T=Kn({queries:R.map(Z=>Wn(u,Z,k,j,c))});let A;e[5]!==T||e[6]!==S?(A=(Z,ce)=>S(Z,T[ce]),e[5]=T,e[6]=S,e[7]=A):A=e[7];const D=R.map(A),O=D.length===0||D.every(Cc),F=Kn({queries:U.map(Z=>Wn(u,Z,k,j,c&&O))});let K;e[8]!==F||e[9]!==S?(K=(Z,ce)=>S(Z,F[ce]),e[8]=F,e[9]=S,e[10]=K):K=e[10];const ee=U.map(K),W=O?ee:D,G=W.length===1&&W[0]?.source.homepageLinks?W[0]:null,q=G&&!G.query.isLoading&&!G.query.isError?G?.query.data??[]:[],X=Dt(q.filter(Tc),f),Q=Dt(q.filter(Nc),f),H=X.length>0&&Q.length>0,L=Z=>{m(Z),v.current&&clearTimeout(v.current),p(Z?l:""),g(Z?l:"")};let B;e[11]===Symbol.for("react.memo_cache_sentinel")?(B=Z=>{p(Z),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{g(Z)},300)},e[11]=B):B=e[11];const _=B,M=Z=>{o(Z),L(!1)},z=Qr(f),Y=Ve(s,{[a]:z}),ne=jr,se=Pr,I="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",re=Ec;let ae;e[12]!==h||e[13]!==i?(ae=i("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:h}),e[12]=h,e[13]=i,e[14]=ae):ae=e[14];let ie;e[15]!==ae?(ie=r.jsx(Er,{className:"sr-only",children:r.jsx(Nr,{children:ae})}),e[15]=ae,e[16]=ie):ie=e[16];let me;e[17]===Symbol.for("react.memo_cache_sentinel")?(me=r.jsx(Or,{size:16,className:"shrink-0 text-foreground"}),e[17]=me):me=e[17];let pe;e[18]!==i?(pe=i("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=i,e[19]=pe):pe=e[19];let xe;e[20]!==h?(xe=r.jsx("span",{className:"rounded-sm bg-special/15 px-1 py-0.5 font-mono text-xs text-special",children:h}),e[20]=h,e[21]=xe):xe=e[21];let he;e[22]!==pe||e[23]!==xe?(he=r.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[me,r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[pe," ",xe]})]}),e[22]=pe,e[23]=xe,e[24]=he):he=e[24];const ve=zr,Se=!1,fe="min-h-0 flex-1";let le;e[25]!==N||e[26]!==f?(le=r.jsx(Kr,{autoFocus:!0,placeholder:N,value:f,onValueChange:_}),e[25]=N,e[26]=f,e[27]=le):le=e[27];const Re=Ir,Ue="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let Ie;e[28]!==i?(Ie=i("sandbox.pathParamPickerChip.noResults"),e[28]=i,e[29]=Ie):Ie=e[29];let Be;e[30]!==Ie?(Be=r.jsx(Hr,{children:Ie}),e[30]=Ie,e[31]=Be):Be=e[31];const vt=z&&r.jsx(dt,{className:"shrink-0",children:r.jsxs(ut,{value:`__raw__:${z}`,className:"gap-3 py-2",onSelect:()=>M(z),children:[r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:r.jsx(Io,{size:14,className:"text-muted-foreground"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm",children:i("sandbox.pathParamPickerChip.useRawValue",{rawTerm:z,paramLabel:h})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Y})]})]})}),ge=H?r.jsxs("div",{className:"flex min-h-0 flex-1",children:[r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:r.jsx(Ft,{heading:x.category.heading,iconKind:"category",options:X,template:s,paramName:a,keyPrefix:`${G?.source.id}:cat`,onSelect:M})}),r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r.jsx(Ft,{heading:x.product.heading,iconKind:"product",options:Q,template:s,paramName:a,keyPrefix:`${G?.source.id}:prod`,onSelect:M})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:W.map(Z=>{const{source:ce,query:We,options:xt}=Z,{noun:qe}=x[ce.kind];if(We.isLoading)return r.jsx(gr,{text:i("sandbox.pathParamPickerChip.loading",{noun:qe})},ce.id);if(We.isError)return r.jsx(gr,{text:i("sandbox.pathParamPickerChip.couldNotLoad")},ce.id);if(ce.homepageLinks){const It=We.data??[];return r.jsxs(E.Fragment,{children:[r.jsx(Ft,{heading:x.category.heading,iconKind:"category",options:Dt(It.filter(jc),f),template:s,paramName:a,keyPrefix:`${ce.id}:cat`,onSelect:M}),r.jsx(Ft,{heading:x.product.heading,iconKind:"product",options:Dt(It.filter(Pc),f),template:s,paramName:a,keyPrefix:`${ce.id}:prod`,onSelect:M})]},ce.id)}return r.jsx(Ft,{heading:W.length>1?x[ce.kind].heading:void 0,iconKind:ce.kind,options:xt,template:s,paramName:a,keyPrefix:ce.id,onSelect:M},ce.id)})});let _e;e[32]!==Re||e[33]!==Be||e[34]!==vt||e[35]!==ge?(_e=r.jsxs(Re,{className:Ue,children:[Be,vt,ge]}),e[32]=Re,e[33]=Be,e[34]=vt,e[35]=ge,e[36]=_e):_e=e[36];let be;e[37]!==ve||e[38]!==le||e[39]!==_e?(be=r.jsxs(ve,{shouldFilter:Se,className:fe,children:[le,_e]}),e[37]=ve,e[38]=le,e[39]=_e,e[40]=be):be=e[40];let ze;e[41]!==se||e[42]!==ie||e[43]!==he||e[44]!==be||e[45]!==re?(ze=r.jsxs(se,{className:I,onClick:re,children:[ie,he,be]}),e[41]=se,e[42]=ie,e[43]=he,e[44]=be,e[45]=re,e[46]=ze):ze=e[46];let Le;return e[47]!==ne||e[48]!==L||e[49]!==c||e[50]!==ze?(Le=r.jsx(ne,{open:c,onOpenChange:L,children:ze}),e[47]=ne,e[48]=L,e[49]=c,e[50]=ze,e[51]=Le):Le=e[51],r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",title:i("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:h}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-lg bg-special/15 px-1 py-0.5 text-xs text-special hover:bg-special/25",onClick:Z=>{Z.stopPropagation(),L(!0)},children:l||h}),Le]})}function Pc(t){return t.kind==="product"}function jc(t){return t.kind!=="product"}function Ec(t){return t.stopPropagation()}function Nc(t){return t.kind==="product"}function Tc(t){return t.kind!=="product"}function Cc(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function Rc(t){return t.isFallback}function Lc(t){return!t.isFallback}function Ac(t){const e=ue.c(8),{sources:n,template:s,paramName:a,sandboxRef:l,onFill:u}=t;let o,i;if(e[0]!==a||e[1]!==l||e[2]!==n||e[3]!==s){const k={template:s,paramName:a},g=n.filter(_c);i=Kn,o=g.map(v=>Wn(l,v,"",k,!0)),e[0]=a,e[1]=l,e[2]=n,e[3]=s,e[4]=o,e[5]=i}else o=e[4],i=e[5];let c;e[6]!==o?(c={queries:o},e[6]=o,e[7]=c):c=e[7];const m=i(c),[f,p]=E.useState(!1);if(!f)for(const k of m){if(k.isLoading)break;const g=k.data?.[0];if(g){p(!0),queueMicrotask(()=>u(g.value));break}}return null}function _c(t){return!t.isFallback}function Oc(t){const e=ue.c(31),{name:n,value:s,onCommit:a}=t,l=Te(),[u,o]=E.useState(s),[i,c]=E.useState(!1),m=E.useRef(!1);let f;e[0]!==n||e[1]!==l?(f=n==="*"?l("sandbox.preview.catchAllParamLabel"):`:${n}`,e[0]=n,e[1]=l,e[2]=f):f=e[2];const p=f,k=u||p;let g;e[3]!==k?(g=r.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-xs",children:k}),e[3]=k,e[4]=g):g=e[4];let v;e[5]!==p||e[6]!==l?(v=l("sandbox.preview.valueForParam",{label:p}),e[5]=p,e[6]=l,e[7]=v):v=e[7];let h,x;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=S=>o(S.target.value),x=()=>c(!0),e[8]=h,e[9]=x):(h=e[8],x=e[9]);let C;e[10]!==s?(C=S=>{S.key==="Enter"&&S.currentTarget.blur(),S.key==="Escape"&&(m.current=!0,o(s),S.currentTarget.blur())},e[10]=s,e[11]=C):C=e[11];let b;e[12]!==u||e[13]!==a||e[14]!==s?(b=()=>{if(c(!1),m.current){m.current=!1;return}const S=Qr(u);o(S),S!==s&&a(S)},e[12]=u,e[13]=a,e[14]=s,e[15]=b):b=e[15];let w;e[16]!==u||e[17]!==p||e[18]!==v||e[19]!==C||e[20]!==b?(w=r.jsx("input",{type:"text",value:u,placeholder:p,title:v,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-special/15 px-1 text-xs text-special outline-none placeholder:text-special/60 focus:bg-special/25",onClick:Dc,onChange:h,onFocus:x,onKeyDown:C,onBlur:b}),e[16]=u,e[17]=p,e[18]=v,e[19]=C,e[20]=b,e[21]=w):w=e[21];let N;e[22]!==g||e[23]!==w?(N=r.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[g,w]}),e[22]=g,e[23]=w,e[24]=N):N=e[24];let j;e[25]!==i||e[26]!==l?(j=i&&r.jsxs("span",{className:"pointer-events-none ml-1.5 flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-border bg-muted px-1 py-0.5 text-2xs text-muted-foreground",children:[r.jsx(Di,{size:10}),l("sandbox.preview.enterToGo")]}),e[25]=i,e[26]=l,e[27]=j):j=e[27];let P;return e[28]!==j||e[29]!==N?(P=r.jsxs(r.Fragment,{children:[N,j]}),e[28]=j,e[29]=N,e[30]=P):P=e[30],P}function Dc(t){return t.stopPropagation()}function Fc(t){if(t.activeGlobalSectionName)return t.activeGlobalSectionName;const e=t.iframeBase;if(!e)return t.noServerLabel;try{const n=new URL(e),s=t.resolvedPath==="/"?"":t.resolvedPath;return`${n.host}${s}`}catch{return e}}function $c(t){return t.previewSurfaceActive&&(t.daemonReady||t.production||!!t.servePreviewUrl)}function Bc(t){return t.showPreviewToolbar&&t.contentEditingEnabled}function Mc(t){return t.v8?null:t.production||t.localPreview?{type:"editor::inject",args:{script:t.script}}:{type:"visual-editor::activate",script:t.script}}function Uc(t){return t.v8?null:{type:"visual-editor::activate",script:t.script}}class ua extends Error{constructor(){super("The site's schema isn't loaded yet"),this.name="PageSchemaNotReadyError"}}async function Ic(t,e){if(t)return t;const n=await e?.().catch(()=>null);if(!n)throw new ua;return n}async function zc(t,e,n){return n?Gs(t,e,await Ic(n.meta,n.loadMeta)):Gs(t,e)}function Kc(t){const e=ue.c(5);let n;e[0]!==t?(n=t??{orgSlug:"",virtualMcpId:"",branch:""},e[0]=t,e[1]=n):n=e[1];const s=Rr(n);let a;return e[2]!==t||e[3]!==s?(a={mutationFn:async l=>{const{name:u,path:o,template:i,schema:c}=l;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const m=hi(u),f=i?{...i,name:u,path:o}:await zc(u,o,c);return await s.mutateAsync({blockKey:m,data:f}),{key:m,name:u,path:o}}},e[2]=t,e[3]=s,e[4]=a):a=e[4],oi(a)}function Hc(t){const e=ue.c(89),{open:n,onOpenChange:s,isPending:a,error:l,templates:u,onSubmit:o}=t,i=a===void 0?!1:a,c=Te();let m;e[0]!==c?(m=c("sectionsEditor.createPageModal.defaultPageName"),e[0]=c,e[1]=m):m=e[1];const[f,p]=E.useState(m);let k;e[2]!==c?(k=c("sectionsEditor.createPageModal.defaultPagePath"),e[2]=c,e[3]=k):k=e[3];const[g,v]=E.useState(k),[h,x]=E.useState(Rn),[C,b]=E.useState(null),[w,N]=E.useState(n);n!==w&&(N(n),n&&(p(c("sectionsEditor.createPageModal.defaultPageName")),v(c("sectionsEditor.createPageModal.defaultPagePath")),x(Rn),b(null)));const j=!!u?.length;let P;e[4]!==i||e[5]!==s?(P=pe=>{!pe&&!i&&(b(null),s(!1))},e[4]=i,e[5]=s,e[6]=P):P=e[6];const S=P;let R;e[7]!==i||e[8]!==f||e[9]!==o||e[10]!==g||e[11]!==j||e[12]!==h?(R=async pe=>{pe.preventDefault();const xe=f.trim(),he=g.trim();if(!xe||!he||i)return;const ve=Xr(he);if(ve){b(ve);return}b(null),await o({name:xe,path:he,templateKey:j&&h!==Rn?h:null})},e[7]=i,e[8]=f,e[9]=o,e[10]=g,e[11]=j,e[12]=h,e[13]=R):R=e[13];const U=R,T=C??l;let A;e[14]!==c?(A=c("sectionsEditor.createPageModal.title"),e[14]=c,e[15]=A):A=e[15];let D;e[16]!==A?(D=r.jsx(Er,{children:r.jsx(Nr,{children:A})}),e[16]=A,e[17]=D):D=e[17];let O;e[18]!==c?(O=c("sectionsEditor.createPageModal.nameLabel"),e[18]=c,e[19]=O):O=e[19];let F;e[20]!==O?(F=r.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:O}),e[20]=O,e[21]=F):F=e[21];let K;e[22]===Symbol.for("react.memo_cache_sentinel")?(K=pe=>p(pe.target.value),e[22]=K):K=e[22];let ee;e[23]!==c?(ee=c("sectionsEditor.createPageModal.namePlaceholder"),e[23]=c,e[24]=ee):ee=e[24];let W;e[25]!==i||e[26]!==f||e[27]!==ee?(W=r.jsx(Mn,{id:"new-page-name",value:f,onChange:K,placeholder:ee,autoFocus:!0,disabled:i}),e[25]=i,e[26]=f,e[27]=ee,e[28]=W):W=e[28];let G;e[29]!==W||e[30]!==F?(G=r.jsxs("div",{className:"space-y-1.5",children:[F,W]}),e[29]=W,e[30]=F,e[31]=G):G=e[31];let V;e[32]!==c?(V=c("sectionsEditor.createPageModal.pathLabel"),e[32]=c,e[33]=V):V=e[33];let q;e[34]!==V?(q=r.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:V}),e[34]=V,e[35]=q):q=e[35];let X;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=pe=>v(pe.target.value),e[36]=X):X=e[36];let Q;e[37]!==c?(Q=c("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=c,e[38]=Q):Q=e[38];let H;e[39]!==i||e[40]!==g||e[41]!==Q?(H=r.jsx(Mn,{id:"new-page-path",value:g,onChange:X,placeholder:Q,disabled:i}),e[39]=i,e[40]=g,e[41]=Q,e[42]=H):H=e[42];let L;e[43]!==q||e[44]!==H?(L=r.jsxs("div",{className:"space-y-1.5",children:[q,H]}),e[43]=q,e[44]=H,e[45]=L):L=e[45];let B;e[46]!==i||e[47]!==j||e[48]!==c||e[49]!==h||e[50]!==u?(B=j&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"new-page-template",className:"text-xs font-medium text-muted-foreground",children:c("sectionsEditor.createPageModal.templateLabel")}),r.jsx(gi,{id:"new-page-template",value:h,onChange:x,templates:u??[],disabled:i})]}),e[46]=i,e[47]=j,e[48]=c,e[49]=h,e[50]=u,e[51]=B):B=e[51];let _;e[52]!==T?(_=T&&r.jsx("p",{className:"text-xs text-destructive",children:T}),e[52]=T,e[53]=_):_=e[53];let M;e[54]!==G||e[55]!==L||e[56]!==B||e[57]!==_?(M=r.jsxs("div",{className:"space-y-4 py-4",children:[G,L,B,_]}),e[54]=G,e[55]=L,e[56]=B,e[57]=_,e[58]=M):M=e[58];let z;e[59]!==s?(z=()=>s(!1),e[59]=s,e[60]=z):z=e[60];let Y;e[61]!==c?(Y=c("sectionsEditor.createPageModal.cancelButton"),e[61]=c,e[62]=Y):Y=e[62];let ne;e[63]!==i||e[64]!==z||e[65]!==Y?(ne=r.jsx($e,{type:"button",variant:"outline",onClick:z,disabled:i,children:Y}),e[63]=i,e[64]=z,e[65]=Y,e[66]=ne):ne=e[66];let se;e[67]!==i||e[68]!==f||e[69]!==g?(se=!f.trim()||!g.trim()||i,e[67]=i,e[68]=f,e[69]=g,e[70]=se):se=e[70];let I;e[71]!==i||e[72]!==c?(I=i?r.jsxs(r.Fragment,{children:[r.jsx(gt,{className:"size-3.5"}),c("sectionsEditor.createPageModal.creatingButton")]}):c("sectionsEditor.createPageModal.createButton"),e[71]=i,e[72]=c,e[73]=I):I=e[73];let re;e[74]!==se||e[75]!==I?(re=r.jsx($e,{type:"submit",disabled:se,children:I}),e[74]=se,e[75]=I,e[76]=re):re=e[76];let ae;e[77]!==ne||e[78]!==re?(ae=r.jsxs(li,{children:[ne,re]}),e[77]=ne,e[78]=re,e[79]=ae):ae=e[79];let ie;e[80]!==U||e[81]!==M||e[82]!==ae||e[83]!==D?(ie=r.jsx(Pr,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:U,children:[D,M,ae]})}),e[80]=U,e[81]=M,e[82]=ae,e[83]=D,e[84]=ie):ie=e[84];let me;return e[85]!==S||e[86]!==n||e[87]!==ie?(me=r.jsx(jr,{open:n,onOpenChange:S,children:ie}),e[85]=S,e[86]=n,e[87]=ie,e[88]=me):me=e[88],me}function Vc(t){const e=ue.c(36),{orgSlug:n,virtualMcpId:s,branch:a,previewUrl:l,meta:u,decofile:o,blockKey:i}=t,c=Te();let m;e[0]!==a||e[1]!==n||e[2]!==s?(m={orgSlug:n,virtualMcpId:s,branch:a},e[0]=a,e[1]=n,e[2]=s,e[3]=m):m=e[3];const f=Rr(m);let p;e[4]!==f?(p=bi((P,S)=>f.mutate({blockKey:P,data:S})),e[4]=f,e[5]=p):p=e[5];const k=p;let g;e[6]!==i||e[7]!==o?(g=vi(o,i),e[6]=i,e[7]=o,e[8]=g):g=e[8];const{resolveType:v,props:h,title:x}=g;if(!v){let P;e[9]!==c?(P=c("sandbox.preview.loaderNoLongerExists"),e[9]=c,e[10]=P):P=e[10];let S;return e[11]!==P?(S=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:P}),e[11]=P,e[12]=S):S=e[12],S}const C=`loader:${i}`,b=`loader:${i}`;let w;e[13]!==i||e[14]!==v||e[15]!==x?(w={mode:"saved",blockKey:i,resolveType:v,title:x},e[13]=i,e[14]=v,e[15]=x,e[16]=w):w=e[16];let N;e[17]!==a||e[18]!==o||e[19]!==u||e[20]!==n||e[21]!==l||e[22]!==h||e[23]!==f.isPending||e[24]!==k||e[25]!==b||e[26]!==w||e[27]!==s?(N=r.jsx(xi,{orgSlug:n,virtualMcpId:s,branch:a,previewUrl:l,meta:u,decofile:o,kind:"loaders",target:w,initialValue:h,isCreating:f.isPending,onCreate:Wc,onSaveReferencedBlock:k,showRun:!1},b),e[17]=a,e[18]=o,e[19]=u,e[20]=n,e[21]=l,e[22]=h,e[23]=f.isPending,e[24]=k,e[25]=b,e[26]=w,e[27]=s,e[28]=N):N=e[28];let j;return e[29]!==i||e[30]!==a||e[31]!==n||e[32]!==C||e[33]!==N||e[34]!==s?(j=r.jsx(wi,{orgSlug:n,virtualMcpId:s,branch:a,blockKey:i,present:void 0,children:N},C),e[29]=i,e[30]=a,e[31]=n,e[32]=C,e[33]=N,e[34]=s,e[35]=j):j=e[35],j}async function Wc(){}function qc(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function vr(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:qc(t.error)}}function Gc(t){switch(t){case"clone-failed":case"install-failed":case"start-failed":return"terminal-error";case"idle":case"cloning":return"booting";case"checking-out":case"installing":case"starting":case"running":case"crashed":return"snapshot-readable"}}function Jc(t){if(t.fastPreviewActive)return t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData?{kind:"error",source:"data"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"};const e=Gc(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const n=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return n&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(a=>a.status==="error"&&!a.hasData&&a.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:n?t.lifecyclePhase==="running"||t.lifecyclePhase==="crashed"?{kind:"error",source:"data"}:{kind:"loading"}:!t.decofile.hasData||!t.meta.hasData?{kind:"loading"}:t.hasEditableContent?{kind:"content"}:{kind:"empty",reason:"no-content"}}const Yc=E.lazy(()=>ci(()=>import("./sections-editor-DbbjUxTa.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])).then(t=>({default:t.SectionsEditor})));function xr(t){const e=ue.c(61),{virtualMcpId:n,externalSelection:s,onSectionPicked:a,onViewJsonFile:l}=t,u=s===void 0?null:s,{org:o}=Jn(),{currentBranch:i,taskId:c}=Mt(),m=Xn(),f=Ut(),p=ta(),k=m.lifecycle.phase==="running",g=f.previewUrl;let v;e[0]!==i||e[1]!==o||e[2]!==g||e[3]!==c||e[4]!==n?(v=i?{orgSlug:o.slug,virtualMcpId:n,branch:i,threadId:c??null,previewUrl:g}:null,e[0]=i,e[1]=o,e[2]=g,e[3]=c,e[4]=n,e[5]=v):v=e[5];const h=v,x=fn(n,i);let C;e[6]!==k?(C={fetchEnabled:k},e[6]=k,e[7]=C):C=e[7];const b=Yn(h,C);let w;e[8]!==k?(w={fetchEnabled:k},e[8]=k,e[9]=w):w=e[9];const N=Zr(h,w),j=Jc({lifecyclePhase:m.lifecycle.phase,decofile:vr(b),meta:vr(N),hasEditableContent:So(b.data,N.data),fastPreviewActive:Vr(n).runtime==="cms"||Xe(x)}),P=Lr()===void 0,S=Qc;if(Po(x)){let L;return e[10]===Symbol.for("react.memo_cache_sentinel")?(L=S(r.jsx(Eo,{})),e[10]=L):L=e[10],L}if(x.kind==="pending"&&x.retrying){let L;return e[11]!==x?(L=S(r.jsx(No,{backend:x})),e[11]=x,e[12]=L):L=e[12],L}if(j.kind==="loading"||P){let L;return e[13]===Symbol.for("react.memo_cache_sentinel")?(L=S(r.jsx(di,{})),e[13]=L):L=e[13],L}if(b.data&&eo(N.data)){const L=p.state.target,B=L?.kind==="page"||L?.kind==="section"?L.key:null,_=B??"",M=i??"";let z;return e[14]!==b.data||e[15]!==B||e[16]!==o.slug||e[17]!==_||e[18]!==M||e[19]!==n?(z=S(r.jsx(yi,{orgSlug:o.slug,virtualMcpId:n,branch:M,decofile:b.data,initialKey:B,compact:!0},_)),e[14]=b.data,e[15]=B,e[16]=o.slug,e[17]=_,e[18]=M,e[19]=n,e[20]=z):z=e[20],z}if(j.kind==="empty"){let L;return e[21]===Symbol.for("react.memo_cache_sentinel")?(L=S(r.jsx(To,{})),e[21]=L):L=e[21],L}if(j.kind==="error"){let L;e[22]!==b||e[23]!==f||e[24]!==N||e[25]!==j.source?(L=()=>{if(j.source==="sandbox"){f.retry();return}Promise.all([b.refetch(),N.refetch()])},e[22]=b,e[23]=f,e[24]=N,e[25]=j.source,e[26]=L):L=e[26];const B=L;let _;return e[27]!==B||e[28]!==j.source?(_=S(r.jsx(jo,{source:j.source,onRetry:B})),e[27]=B,e[28]=j.source,e[29]=_):_=e[29],_}let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=L=>S(r.jsx("div",{className:"h-full min-h-0",children:L})),e[30]=R):R=e[30];const U=R,T=p.state.target;if(T?.kind==="loader"&&b.data&&N.data){const L=i??"",B=g??null;let _;return e[31]!==b.data||e[32]!==N.data||e[33]!==o.slug||e[34]!==L||e[35]!==B||e[36]!==T.key||e[37]!==n?(_=U(r.jsx(Vc,{orgSlug:o.slug,virtualMcpId:n,branch:L,previewUrl:B,meta:N.data,decofile:b.data,blockKey:T.key})),e[31]=b.data,e[32]=N.data,e[33]=o.slug,e[34]=L,e[35]=B,e[36]=T.key,e[37]=n,e[38]=_):_=e[38],_}let A;e[39]!==i||e[40]!==o.slug||e[41]!==T||e[42]!==n?(A=T||!i?null:Ar(_r(o.slug,n,i)),e[39]=i,e[40]=o.slug,e[41]=T,e[42]=n,e[43]=A):A=e[43];const D=A;let O="/",F=null,K=null;T?.kind==="page"?(O=T.path,F=T.key):T?.kind==="section"?K=T.key:D&&(O=D.path,F=D.pageKey);const ee=F?`page:${F}`:K?`section:${K}`:`path:${O}`;let W;e[44]===Symbol.for("react.memo_cache_sentinel")?(W=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}),e[44]=W):W=e[44];const G=i??"",V=g??void 0,q=K?null:u,X=K?void 0:a,Q=!!F&&p.state.editSeoPageKey===F;let H;return e[45]!==K||e[46]!==F||e[47]!==O||e[48]!==ee||e[49]!==l||e[50]!==o.slug||e[51]!==q||e[52]!==X||e[53]!==Q||e[54]!==G||e[55]!==V||e[56]!==n||e[57]!==p.consumeEditSeo||e[58]!==p.setFocusedBlock||e[59]!==p.setVariantOverride?(H=U(r.jsx(E.Suspense,{fallback:W,children:r.jsx(Yc,{orgSlug:o.slug,virtualMcpId:n,branch:G,previewReady:!0,previewUrl:V,currentPath:O,activePageBlockKey:F,activeGlobalBlockKey:K,externalSelection:q,onSectionPicked:X,initialEditSeo:Q,onExitSeo:p.consumeEditSeo,onVariantPreviewOverride:p.setVariantOverride,onFocusedBlockChange:p.setFocusedBlock,onViewJsonFile:l},ee)})),e[45]=K,e[46]=F,e[47]=O,e[48]=ee,e[49]=l,e[50]=o.slug,e[51]=q,e[52]=X,e[53]=Q,e[54]=G,e[55]=V,e[56]=n,e[57]=p.consumeEditSeo,e[58]=p.setFocusedBlock,e[59]=p.setVariantOverride,e[60]=H):H=e[60],H}function Qc(t){return r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function br(t){const e=ue.c(51),{virtualMcpId:n,pageKey:s,onClose:a,ref:l}=t,u=Te(),o=Lr(),i=o===!0,c=Wr(n);let m;e[0]!==c||e[1]!==s?(m=to(c,Go(s)),e[0]=c,e[1]=s,e[2]=m):m=e[2];const f=m,{org:p}=Jn(),{currentBranch:k,taskId:g}=Mt(),h=Ut().previewUrl;let x;e[3]!==k||e[4]!==p.slug||e[5]!==h||e[6]!==g||e[7]!==n?(x=k?{orgSlug:p.slug,virtualMcpId:n,branch:k,threadId:g??null,previewUrl:h}:null,e[3]=k,e[4]=p.slug,e[5]=h,e[6]=g,e[7]=n,e[8]=x):x=e[8];const b=Yn(x),w=k??"";let N;e[9]!==p.slug||e[10]!==w||e[11]!==n?(N={orgSlug:p.slug,virtualMcpId:n,branch:w},e[9]=p.slug,e[10]=w,e[11]=n,e[12]=N):N=e[12];let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j={holdsCopy:!0},e[13]=j):j=e[13];const{save:P,flush:S,hold:R}=ki(N,j),U=k??"";let T;e[14]!==p.slug||e[15]!==U||e[16]!==n?(T=Ko({orgSlug:p.slug,virtualMcpId:n,branch:U}),e[14]=p.slug,e[15]=U,e[16]=n,e[17]=T):T=e[17];const A=Ho(T);let D;e[18]!==s||e[19]!==A?(D=A(s),e[18]=s,e[19]=A,e[20]=D):D=e[20];const O=D;let F;e[21]!==O||e[22]!==s?(F={pageKey:s,copyEpoch:O},e[21]=O,e[22]=s,e[23]=F):F=e[23];const[K,ee]=E.useState(F);(K.pageKey!==s||K.copyEpoch!==O)&&(ee({pageKey:s,copyEpoch:O}),R(s));const W=b.data?.[s],G=b.data===void 0&&b.isLoading||o===void 0,V=b.data!==void 0&&W===void 0,q=!k||V||G;let X;e[24]!==W?(X=W===void 0?"":JSON.stringify(W,null,2),e[24]=W,e[25]=X):X=e[25];const Q=X;let H;e[26]!==s||e[27]!==q||e[28]!==P?(H=Y=>{if(q)return;let ne;try{ne=JSON.parse(Y)}catch{return}ne===null||typeof ne!="object"||Array.isArray(ne)||P(s,ne)},e[26]=s,e[27]=q,e[28]=P,e[29]=H):H=e[29];const L=H;let B;e[30]!==S?(B=()=>({flush:S}),e[30]=S,e[31]=B):B=e[31],E.useImperativeHandle(l,B);let _;e[32]!==f||e[33]!==i||e[34]!==a||e[35]!==u?(_=i?r.jsx("div",{className:"flex shrink-0 items-center border-b px-3 py-2.5",children:r.jsx("span",{title:f,className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:f})}):r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[r.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:u("sectionsEditor.pageJsonDialog.titleShort")}),r.jsx($e,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":u("sectionsEditor.pageJsonDialog.close"),className:"shrink-0",children:r.jsx(ui,{size:14})})]}),e[32]=f,e[33]=i,e[34]=a,e[35]=u,e[36]=_):_=e[36];let M;e[37]!==O||e[38]!==b.data||e[39]!==S||e[40]!==Q||e[41]!==G||e[42]!==V||e[43]!==s||e[44]!==q||e[45]!==L||e[46]!==u?(M=G?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}):V?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",u("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(zo,{code:Q,language:"json",readOnly:q,height:"100%",onChange:Y=>L(Y??""),onSave:Y=>{L(Y),S()}},`${s}:${b.data===void 0?"loading":"ready"}:${O}`)}),e[37]=O,e[38]=b.data,e[39]=S,e[40]=Q,e[41]=G,e[42]=V,e[43]=s,e[44]=q,e[45]=L,e[46]=u,e[47]=M):M=e[47];let z;return e[48]!==_||e[49]!==M?(z=r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[_,M]}),e[48]=_,e[49]=M,e[50]=z):z=e[50],z}function fa(t){return t.contentEditingEnabled&&!t.isMobile}function Xc(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function Zc(t,e){return t==="blocks"?"preview":e?"blocks":t}function ed(t){return fa({contentEditingEnabled:ea(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function td(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}function nd(t){const e=no(t),{display:n}=t;let s=null;if(n.mode==="production"&&n.iframeBase)try{s=new URL(t.path,n.iframeBase).href}catch{s=null}const a=so(s,e);return{value:e,frame:a?Hn(a,t.device):null,newTab:a}}function sd(t){const e=ue.c(94),{tests:n,load:s,onOpen:a,options:l,onChange:u,available:o}=t,i=Te();let c;e[0]!==l?(c=qr(l),e[0]=l,e[1]=c):c=e[1];const m=c;let f;e[2]!==l.tests?(f=l.tests??{},e[2]=l.tests,e[3]=f):f=e[3];const p=f;let k;e[4]!==u||e[5]!==l?(k=I=>{const re=I?Wo(I):null,{at:ae,...ie}=l;u(re?{...ie,at:re}:ie)},e[4]=u,e[5]=l,e[6]=k):k=e[6];const g=k;let v;e[7]!==p||e[8]!==u||e[9]!==l?(v=(I,re)=>{const ae={...p};re==="on"?ae[I]=!0:re==="off"?ae[I]=!1:delete ae[I];const{tests:ie,...me}=l;u(Object.keys(ae).length>0?{...me,tests:ae}:me)},e[7]=p,e[8]=u,e[9]=l,e[10]=v):v=e[10];const h=v;let x;e[11]!==a?(x=I=>{I&&a?.()},e[11]=a,e[12]=x):x=e[12];let C;e[13]!==i?(C=i("sandbox.previewAs.label"),e[13]=i,e[14]=C):C=e[14];let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=r.jsx(Fi,{size:16}),e[15]=b):b=e[15];let w;e[16]!==m||e[17]!==C?(w=r.jsx(pt,{asChild:!0,children:r.jsx(Br,{asChild:!0,children:r.jsx(Ze,{"aria-label":C,active:m,"data-testid":"preview-as-trigger",children:b})})}),e[16]=m,e[17]=C,e[18]=w):w=e[18];let N;e[19]!==i?(N=i("sandbox.previewAs.label"),e[19]=i,e[20]=N):N=e[20];let j;e[21]!==N?(j=r.jsx(mt,{children:N}),e[21]=N,e[22]=j):j=e[22];let P;e[23]!==j||e[24]!==w?(P=r.jsxs(ht,{children:[w,j]}),e[23]=j,e[24]=w,e[25]=P):P=e[25];let S;e[26]!==i?(S=i("sandbox.previewAs.label"),e[26]=i,e[27]=S):S=e[27];let R;e[28]!==S?(R=r.jsx("h3",{className:"text-sm font-medium",children:S}),e[28]=S,e[29]=R):R=e[29];let U;e[30]!==o||e[31]!==i?(U=i(o?"sandbox.previewAs.intro":"sandbox.previewAs.unavailable"),e[30]=o,e[31]=i,e[32]=U):U=e[32];let T;e[33]!==U?(T=r.jsx("p",{className:"text-xs text-muted-foreground",children:U}),e[33]=U,e[34]=T):T=e[34];let A;e[35]!==R||e[36]!==T?(A=r.jsxs("div",{className:"flex flex-col gap-1",children:[R,T]}),e[35]=R,e[36]=T,e[37]=A):A=e[37];let D;e[38]!==i?(D=i("sandbox.previewAs.momentLabel"),e[38]=i,e[39]=D):D=e[39];let O;e[40]!==D?(O=r.jsx(Xo,{htmlFor:"preview-as-moment",children:D}),e[40]=D,e[41]=O):O=e[41];let F;e[42]!==l.at?(F=Vo(l.at),e[42]=l.at,e[43]=F):F=e[43];let K;e[44]!==g?(K=I=>g(I.target.value),e[44]=g,e[45]=K):K=e[45];let ee;e[46]!==F||e[47]!==K?(ee=r.jsx(Mn,{id:"preview-as-moment",type:"datetime-local",className:qo,value:F,onChange:K}),e[46]=F,e[47]=K,e[48]=ee):ee=e[48];const W=l.at===void 0;let G;e[49]!==g?(G=()=>g(""),e[49]=g,e[50]=G):G=e[50];let V;e[51]!==i?(V=i("sandbox.previewAs.now"),e[51]=i,e[52]=V):V=e[52];let q;e[53]!==W||e[54]!==G||e[55]!==V?(q=r.jsx($e,{type:"button",variant:"ghost",size:"sm",disabled:W,onClick:G,children:V}),e[53]=W,e[54]=G,e[55]=V,e[56]=q):q=e[56];let X;e[57]!==ee||e[58]!==q?(X=r.jsxs("div",{className:"flex items-center gap-2",children:[ee,q]}),e[57]=ee,e[58]=q,e[59]=X):X=e[59];let Q;e[60]!==i?(Q=i("sandbox.previewAs.momentHint"),e[60]=i,e[61]=Q):Q=e[61];let H;e[62]!==Q?(H=r.jsx("p",{className:"text-xs text-muted-foreground",children:Q}),e[62]=Q,e[63]=H):H=e[63];let L;e[64]!==O||e[65]!==X||e[66]!==H?(L=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[O,X,H]}),e[64]=O,e[65]=X,e[66]=H,e[67]=L):L=e[67];let B;e[68]!==i?(B=i("sandbox.previewAs.testsLabel"),e[68]=i,e[69]=B):B=e[69];let _;e[70]!==B?(_=r.jsx("span",{className:"text-sm font-medium",children:B}),e[70]=B,e[71]=_):_=e[71];let M;e[72]!==p||e[73]!==s||e[74]!==h||e[75]!==i||e[76]!==n?(M=s&&!s.ready?s.failed?r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.previewAs.testsLoadFailed")}),r.jsx($e,{type:"button",variant:"outline",size:"sm",onClick:s.retry,children:i("sandbox.previewAs.tryAgain")})]}):r.jsx("div",{className:"flex justify-center py-2","data-testid":"preview-as-tests-loading",children:r.jsx(gt,{className:"size-4 text-muted-foreground"})}):n.length===0?r.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.previewAs.noTests")}):r.jsxs(r.Fragment,{children:[r.jsx("ul",{className:"flex flex-col gap-1.5",children:n.map(I=>r.jsxs("li",{className:"flex items-center justify-between gap-2","data-testid":"preview-as-test",children:[r.jsx("span",{className:"min-w-0 truncate text-sm",children:I}),r.jsxs(Zo,{type:"single",variant:"outline",size:"sm",value:p[I]===void 0?"":p[I]?"on":"off",onValueChange:re=>h(I,re),"aria-label":I,children:[r.jsx(or,{value:"off",children:i("sandbox.previewAs.off")}),r.jsx(or,{value:"on",children:i("sandbox.previewAs.on")})]})]},I))}),r.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.previewAs.testsHint")})]}),e[72]=p,e[73]=s,e[74]=h,e[75]=i,e[76]=n,e[77]=M):M=e[77];let z;e[78]!==_||e[79]!==M?(z=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[_,M]}),e[78]=_,e[79]=M,e[80]=z):z=e[80];let Y;e[81]!==m||e[82]!==u||e[83]!==i?(Y=m&&r.jsx($e,{type:"button",variant:"outline",size:"sm",onClick:()=>u({}),children:i("sandbox.previewAs.reset")}),e[81]=m,e[82]=u,e[83]=i,e[84]=Y):Y=e[84];let ne;e[85]!==A||e[86]!==L||e[87]!==z||e[88]!==Y?(ne=r.jsxs(Mr,{className:"flex w-80 flex-col gap-4 p-4",align:"center",sideOffset:8,"data-testid":"preview-as",children:[A,L,z,Y]}),e[85]=A,e[86]=L,e[87]=z,e[88]=Y,e[89]=ne):ne=e[89];let se;return e[90]!==P||e[91]!==ne||e[92]!==x?(se=r.jsxs(Ur,{onOpenChange:x,children:[P,ne]}),e[90]=P,e[91]=ne,e[92]=x,e[93]=se):se=e[93],se}const rd=15e3;function ad(t,e,n){return n?t.src===e||t.loading?t:{src:e,loading:!0}:t.src===e&&!t.loading?t:{src:e,loading:!1}}function wr(t){return t.loading?{...t,loading:!1}:t}function id(t,e){try{const n=new URL(t),s=new URL(e);return n.origin===s.origin&&n.pathname===s.pathname}catch{return!1}}function od(t,{base:e,frameSrc:n,loadedSrc:s,wanted:a,canSwap:l}){const u=t?.base===e?t:null,o=u?.src??n,i=u?.shown??n;return!a||!o||!i?null:i===a?u:l&&s===o&&id(i,a)?{base:e,src:o,shown:a}:null}const ld=["next"],cd=["@tanstack/react-router","@tanstack/react-start","@tanstack/solid-router","@tanstack/solid-start"],pa=new Set(["tsx","ts","jsx","js","mdx"]),dd=new Set(["tsx","jsx"]),ud=new Set(["404","500"]);function fd(t){const e=new Set;if(!t||typeof t!="object")return e;const n=t;for(const s of["dependencies","devDependencies"]){const a=n[s];if(a&&typeof a=="object"&&!Array.isArray(a))for(const l of Object.keys(a))e.add(l)}return e}function pd(t){const e=fd(t);return ld.some(n=>e.has(n))?"next":cd.some(n=>e.has(n))?"tanstack":null}function ma(t,e){const n=(t??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${e}`:e}function md(t,e){const n=s=>ma(e,s);switch(t){case"next":return[{router:"next-pages",dir:n("pages"),pattern:"**/*"},{router:"next-pages",dir:n("src/pages"),pattern:"**/*"},{router:"next-app",dir:n("app"),pattern:"**/page.*"},{router:"next-app",dir:n("src/app"),pattern:"**/page.*"}];case"tanstack":return[{router:"tanstack",dir:n("src/routes"),pattern:"**/*"}];default:{const s=t;throw new Error(`Unknown framework: ${String(s)}`)}}}function es(t){const e=t.lastIndexOf(".");return e<=0?null:[t.slice(0,e),t.slice(e+1)]}function hd(t){const e=es(t.at(-1)??"");if(!e||!pa.has(e[1]))return null;const[n]=e;if(n.includes("."))return null;const s=[...t.slice(0,-1),n];return s[0]==="api"||s.length===1&&ud.has(n)||s.some(a=>a.startsWith("_")||a.includes("["))?null:(s.at(-1)==="index"&&s.pop(),`/${s.join("/")}`)}function gd(t){const e=es(t.at(-1)??"");if(!e||e[0]!=="page"||!pa.has(e[1]))return null;const n=[];for(const s of t.slice(0,-1)){if(s.startsWith("_")||s.startsWith("@")||/^\(\.{1,3}\)/.test(s)||s.includes("["))return null;s.startsWith("(")&&s.endsWith(")")||n.push(s)}return`/${n.join("/")}`}function vd(t){const e=[];let n="",s=!1;for(const a of t)a==="["?s=!0:a==="]"&&(s=!1),a==="."&&!s?(e.push(n),n=""):n+=a;return e.push(n),e}function xd(t){const e=es(t.at(-1)??"");if(!e||!dd.has(e[1]))return null;const n=[...t.slice(0,-1),...vd(e[0])].filter(Boolean);n.at(-1)==="lazy"&&n.pop();const s=n.at(-1);if(!s||s==="__root"||n.some(l=>l.startsWith("-"))||s.startsWith("_"))return null;(s==="index"||s==="route")&&n.pop();const a=[];for(const l of n){if(l.includes("$"))return null;if(l.startsWith("_")||l.startsWith("(")&&l.endsWith(")"))continue;const u=l.replace(/_$/,"").replace(/[[\]]/g,"");u&&a.push(u)}return`/${a.join("/")}`}function bd(t,e){const n=e.split("/").filter(Boolean);if(n.length===0)return null;switch(t){case"next-pages":return hd(n);case"next-app":return gd(n);case"tanstack":return xd(n);default:{const s=t;throw new Error(`Unknown router: ${String(s)}`)}}}function wd(t){const e=new Set;for(const{root:n,files:s}of t){const a=`${n.dir}/`;for(const l of s){if(!l.startsWith(a))continue;const u=bd(n.router,l.slice(a.length));u&&e.add(u)}}return[...e].sort((n,s)=>n==="/"?-1:s==="/"?1:n.localeCompare(s))}const yd=5e3,kd=6e4;async function Sd(t,e){const n=await fetch(el(t,"glob"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pattern:e.pattern,path:e.dir,limit:yd})});if(!n.ok)throw new Error(`Failed to list ${e.dir}: ${n.status}`);const s=await n.json();return Array.isArray(s.files)?s.files.filter(a=>typeof a=="string"):[]}async function Pd(t,e){const n=await ro(t,ma(e,"package.json"));if(n.kind==="unavailable")throw new Error("package.json unavailable: sandbox not ready");const s=n.kind==="data"?pd(n.data):null;if(!s)return[];const a=md(s,e),l=await Promise.all(a.map(async u=>({root:u,files:await Sd(t,u)})));return wd(l)}function jd(t,e,n){const s=ue.c(12);let a;s[0]!==e||s[1]!==t?(a=t?Gn.frameworkRoutes(t.orgSlug,t.virtualMcpId,t.branch,t.threadId,e):["framework-routes","none"],s[0]=e,s[1]=t,s[2]=a):a=s[2];let l;s[3]!==e||s[4]!==t?(l=()=>t?Pd(t,e):[],s[3]=e,s[4]=t,s[5]=l):l=s[5];const u=n&&!!t;let o;s[6]!==a||s[7]!==l||s[8]!==u?(o={queryKey:a,queryFn:l,enabled:u,staleTime:kd},s[6]=a,s[7]=l,s[8]=u,s[9]=o):o=s[9];const i=Tr(o);let c;return s[10]!==i.data?(c=i.data??[],s[10]=i.data,s[11]=c):c=s[11],c}const Ed=500,Nd={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},yr=1,ln=["desktop","mobile","tablet"],Td=["preview","visual","blocks"],kr={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Cd(t){if(!t)return null;try{const e=new URL(t,window.location.href);return e.searchParams.set("__decoFBT","0"),e.searchParams.set("__deco_ssr","1"),e.href}catch{return t}}function $t(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function Bn(t,e){try{return new URL(t,e).href}catch{return null}}function Rd(t,e){if(!e.inPlaceRenderActive)return{pin:e.draftPreviewUrl?{path:e.resolvedPath,url:e.draftPreviewUrl}:null,effective:e.draftPreviewUrl};if(e.draftPreviewUrl!==null&&t?.path!==e.resolvedPath){const n={path:e.resolvedPath,url:e.draftPreviewUrl};return{pin:n,effective:n.url}}return{pin:t,effective:t?.url??null}}function Ld(t,e){return!t||t.nav!==e.nav?!1:t.content!==e.content}function Ad(t,e,n){const s=t.toLowerCase(),a=e.toLowerCase(),l=a.split("/").filter(Boolean),u=i=>{if(i===n)return 100;const c=i.indexOf(n);if(c===-1)return 0;let m=40;return c===0?m+=30:/[\s/-]/.test(i[c-1]??"")&&(m+=20),m+=Math.round(n.length/i.length*20),m};let o=Math.max(u(s),u(a));return l.at(-1)===n?o=Math.max(o,95):l.includes(n)&&(o=Math.max(o,90)),o}function _d(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Od({virtualMcpId:t}){const e=Te(),n=Yr(),{currentBranch:s,taskId:a,virtualMcpId:l}=Mt(),u=!!Ci(),o=ta(),i=Ki(l===t?t:null),c=Vr(t),m=tl(i?.metadata?.ui?.layout??null),f=ea(m),p=fa({contentEditingEnabled:f,isMobile:n}),[k]=E.useState(()=>ed({cmsMode:m,isMobile:n})),[g,v]=Un(In.previewEditingMode(t),d=>d&&Td.includes(d)?d:null),h=g??k,[x,C]=Un(In.previewDeviceSize(t),d=>d&&ln.includes(d)?d:"desktop"),[b,w]=E.useState(null),[N,j]=E.useState(null),P=E.useRef(null),S=E.useRef(null),[R,U]=E.useState(!1),T=E.useRef(null),A=()=>{T.current?.flush(),U(!1)},D=()=>U(d=>(d&&T.current?.flush(),!d)),[O,F]=E.useState({width:0,height:0}),[K,ee]=E.useState(!1),[W,G]=E.useState({}),[V,q]=E.useState(""),X=E.useRef(null),[Q,H]=E.useState(!1),[L,B]=E.useState(),[_,M]=E.useState(null),[z,Y]=E.useState(null),[ne,se]=E.useState(null),[I,re]=E.useState(()=>o.state.target?.kind==="page"?o.state.target.path:"/"),[ae,ie]=E.useState(()=>o.state.target?.kind==="page"?o.state.target.key:null),[me,pe]=E.useState({}),[xe,he]=E.useState(!1),ve=E.useRef(null),Se=()=>{he(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>he(!1),15e3)},fe=()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),he(!1)},{org:le}=Jn(),Re=Xn(),Ue=Ut(),Ie=Ue.vmEntry,Be=Re.lifecycle.phase,{url:vt}=Gr(t),ge=fn(t,s),{connection:_e}=Jr(t),be=Jo(t),ze=ao({hasServeConnection:!!_e,runtime:c.runtime}),Le=!Xe(ge)&&ge.kind!=="pending",Z=He(ge)??vt,ce=Z??Ue.previewUrl,We=!!Z||Be==="running",xt=i?.id===t?Wi(i.metadata):null,qe=!Z&&i?.id===t&&c.runtime==="cms",It=c.projectDefault==="cms",bt=Le?io({sandboxUrl:ce,previewServerUrl:xt,fastPreviewActive:qe}):null,ts=t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s,threadId:a??null,previewUrl:ce}:null,ns=Yn(ts,{fetchEnabled:We}),pn=Zr(ts,{fetchEnabled:We}),de=ns.data,Pe=pn.data,Ge=de?Co(de,Pe).sort((d,y)=>d.name.localeCompare(y.name)):[],zt=t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s}:null,ss=Kc(zt),ha=oo(zt),mn=de&&Pe?Ro(de,Pe):[],rs=Le&&de&&Pe?Si(Pe,de,"loaders"):[],as=V?(()=>{const d=V.toLowerCase();return Ge.map(y=>({page:y,score:Ad(y.name,y.path,d)})).filter(({score:y})=>y>0).sort((y,$)=>$.score-y.score||y.page.path.length-$.page.path.length).map(({page:y})=>y)})():Ge,is=mn.filter(d=>{if(!V)return!0;const y=V.toLowerCase();return d.name.toLowerCase().includes(y)||d.key.toLowerCase().includes(y)||d.resolveType.toLowerCase().includes(y)}),os=p?rs:[],ls=os.filter(d=>{if(!V)return!0;const y=V.toLowerCase();return d.title.toLowerCase().includes(y)||d.key.toLowerCase().includes(y)||d.resolveType.toLowerCase().includes(y)}),Kt=z?rs.find(d=>d.key===z)??null:null,Ee=Qn,hn=_||z?null:Lo(Ge,I,ae),oe=hn?.key??null,tt=o.state.target?.kind==="section"?o.state.target.key:o.state.focusedBlockKey??oe,Ht=hn?.path??null,nt=(oe?me[oe]:void 0)??{},Ce=Ve(I,nt),gn={};if(Le&&We&&ce&&Pe&&de){const d=Pi(Pe,"loaders"),y=oe?de[oe]:void 0,$=lc(y,de,ye=>d.has(ye)),te=sc($);for(const ye of Bt(I)){if(ye.type!=="param")continue;const Ne=ec(I,ye.name,$),ot=ic(Ne,d,te);ot.length>0&&(gn[ye.name]=ot)}}const wt=t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s,threadId:a??null}:null,cs=de&&oe?Bo(de,oe,0):[],ds=Xe(ge),us=de?ji(cs,de,ds):[],yt=us.map(d=>d.isSavedBlock?d.label:""),kt=us.map(d=>d.isSavedBlock?"global":d.isMultivariate?"variant":"normal"),St=cs.map(d=>Vn(d,de??{},ds)),st=E.useRef(null),Oe=E.useRef(null),ga=Re.status.state==="paused",vn=Re.phase,fs=Ei({claimPhase:vn,lifecycle:Re.lifecycle}),Je=Ue.previewState,va=Ue.userStopped,xa=lo(le.slug,t??""),{url:Ke}=$o(qe&&t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s,previewServerUrl:xt??null,path:Ce}:null),ba=It&&c.runtime==="sandbox",Ae=co(ge,ze,be),ps=uo(Ae&&qe&&ge.kind==="protocol"&&t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s}:null),ms=Ae?ps.pointer:null,J=Rl({previewState:Je,progressStatus:fs.status,previewServerUrl:xt,fastPreviewActive:qe,fastPreviewReady:!!Ke,codingSession:ba,localPreviewUrl:Z,hostedDraft:Ae,hostedPointerPending:Ae&&(ge.kind==="pending"||ps.pending)}),hs=J.showWakingPill||Ae&&J.mode==="production"&&!ms,Pt=J.mode!=="none",wa=J.mode==="production"&&J.iframeBase?$t(J.iframeBase):null,rt=J.mode==="production"?wa:$t(ce),ya=i?.id===t&&i.metadata?.fastPreviewInPlace===!0,jt=Le?Z?J.mode==="sandbox"&&p&&h==="blocks":J.mode==="production"&&qe&&ya&&p&&h==="blocks":!1,gs=E.useRef(null),{pin:ka,effective:Sa}=Rd(gs.current,{inPlaceRenderActive:jt,draftPreviewUrl:Ke,resolvedPath:Ce});gs.current=ka;const vs=o.state.variantOverride??[],Vt=Le?vs:[],Et=Le?[]:vs,Wt=Xe(ge)&&Ao.some(d=>_o(Pe,d)==="available"),at=Wt?W:{},xs=qr(at),Pa=Wt&&de?Object.keys(Oo(de).experiments):[],[bs,ja]=E.useState(!1),ws=fo(zt,Wt&&bs?Do:[]),Ea={...ws,ready:!(ge.kind==="protocol"&&ge.hosted)||bs&&ws.ready},Ye=t?Ys(le.slug,t):null,Na=po(Ye),qt=Ae?nd({display:J,path:Ce,pointer:ms,heldRevision:Na,device:x,forcedVariants:Et,previewOptions:at}):null,ys=JSON.stringify([Et,at]);E.useEffect(()=>{if(!Ae||!Ye)return;const[d,y]=JSON.parse(ys);Qs(Ye,{forcedVariants:d,previewOptions:y})},[Ae,Ye,ys]),E.useEffect(()=>{if(!(!Ae||!Ye))return()=>Qs(Ye,null)},[Ae,Ye]);const xn=_e&&He(ge)?mo(_e.endpoint,Et,xs):null,Ta=_e&&He(ge)?xn?ho(xn,at):Xs:null,Qe=Cd(J.mode==="sandbox"?nn(Hn(Zs(ne??Bn(Ce,J.iframeBase)??J.iframeBase,Ta),x),Vt):J.mode==="production"&&qt?.frame?qt.frame:J.mode==="production"?nn(Hn(er(tr(Zs(ne??Sa??Bn(Ce,J.iframeBase)??J.iframeBase,hs?Xs:null),Et),at),x),Vt):null),ks=Ke??(J.iframeBase?Bn(Ce,J.iframeBase):null),Ss=J.mode==="production"&&qt?qt.newTab:J.mode==="production"?ks?nn(er(tr(ks,Et),at),Vt):null:Qe??J.iframeBase,Ca=()=>{const d=Ss;d&&window.open(d,"_blank","noopener")},Nt=t&&s?_r(le.slug,t,s):null,Tt=d=>{Nt&&Li(Nt,d)},ke=o.state.target;E.useEffect(()=>{if(!(!ke||!bt||!Pe))if(ke.kind==="page"){const d=me[ke.key]??{};Oe.current=Ve(ke.path,d),M(null),Y(null),se(null),ie(ke.key),re(ke.path),Tt({path:ke.path,pageKey:ke.key,params:d})}else if(ke.kind==="loader")Oe.current=null,M(null),Y(ke.key),se(null);else{const d=mn.find(y=>y.key===ke.key);if(d){Oe.current=null;const y=sr(Pe);Y(null),M(d),se(nr(bt,y,d.key))}}},[ke,bt,Pe,me]),E.useEffect(()=>{!oe||Ht===null||ke?.kind==="page"&&ke.key===oe&&ke.path===Ht||o.selectTarget({kind:"page",key:oe,path:Ht})},[oe,Ht,ke]);const[Ps,Ra]=E.useState(null);if(Je.kind==="iframe"&&Ps!==Je.previewUrl){const d=Ps!==null;Ra(Je.previewUrl);const y=Nt?Ar(Nt):null;if(y){if(Oe.current=Ve(y.path,y.params),re(y.path),ie(y.pageKey),se(null),M(null),Y(null),y.pageKey&&Object.keys(y.params).length>0){const $=y.pageKey;pe(te=>({...te,[$]:y.params}))}}else d&&(Oe.current=null,re("/"),se(null),ie(null),M(null),Y(null))}st.current=Qe;const La=J.mode==="production"&&!!Ke&&!Z,[Gt,bn]=E.useState({src:Qe??void 0,loading:!1}),[Aa,wn]=E.useState(!1),[_a,Oa]=E.useState(),[js,Es]=E.useState(null),je=od(js,{base:J.iframeBase??"",frameSrc:Gt.src,loadedSrc:_a,wanted:Qe??void 0,canSwap:be&&Aa&&!Gt.loading});je!==js&&Es(je);const Jt=ad(Gt,je?je.src:Qe??void 0,La);Jt!==Gt&&bn(Jt);const it=Jt.src,Ns=Jt.loading,Ts=Ol({iframeRef:P,src:J.mode==="sandbox"?Qe:null,active:J.mode==="sandbox"}),Cs=E.useRef(null);E.useEffect(()=>{const d=Ns?setTimeout(()=>bn(wr),rd):null,y=()=>{d&&clearTimeout(d)};if(!Ke||!it||Cs.current===Ke)return y;Cs.current=Ke;const $=P.current;return $&&$.getAttribute("src")!==it&&(Se(),$.src=it),y},[Ke,it,Ns]);const Rs=()=>{const d=P.current?.contentWindow,y=rt;if(!d||!y||!de||!oe)return;const $=de[oe];if(!$||typeof $!="object")return;const te=wo({previewBaseUrl:y,pageBlock:$,decofile:de,path:Ce,pathTemplate:I});if(!te)return;const ye=nn(te.src,ko(Vt,oe));d.postMessage({type:"cms-editor::render",src:ye,body:te.body},y)},yn=E.useRef(null);E.useEffect(()=>{if(!jt||_||z||!oe||!de){yn.current=null;return}const d={nav:JSON.stringify({page:oe,path:Ce,pathTemplate:I}),content:JSON.stringify(de)},y=Ld(yn.current,d);yn.current=d,y&&Rs()},[de,jt,_,z,oe,Ce,I]);const kn=E.useRef(null);E.useEffect(()=>{if(!jt||_||z||!oe||!de){kn.current=null;return}const d=JSON.stringify(o.state.variantOverride??null),y=kn.current;kn.current={page:oe,sig:d},!(!y||y.page!==oe||y.sig===d)&&Rs()},[o.state.variantOverride,jt,_,z,oe]);const Ls=!!t&&!!s&&!Re.notFound&&!va&&!ga&&(vn?.kind==="ready"||Be!=="idle"),As=!Xe(ge),Da=Wr(t??void 0),Fa=jd(wt,Da,As&&Ls),$a=new Set(Ge.map(d=>Ee(d.path))),Yt=As?Fa.filter(d=>!$a.has(Ee(d))):[],_s=V?Yt.filter(d=>d.toLowerCase().includes(V.toLowerCase())):Yt,we=td({editingMode:h,sandboxDisplay:J.mode==="sandbox",blocksEditingEnabled:p});E.useEffect(()=>{const d=rt;if(!d)return;const y=$=>{if($.origin===d)if($.data?.type==="visual-editor::element-clicked"){const te=Bl.safeParse($.data.payload);te.success&&w(te.data)}else if($.data?.type==="cms-editor::section-clicked"){const te=Il.safeParse($.data.payload);te.success&&j({index:te.data.sectionIndex,seq:te.data.clickSeq})}else $.data?.type==="cms-editor::render-start"?Se():$.data?.type==="cms-editor::render-end"?(fe(),P.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:yt,kinds:kt,keys:St},d)):$.data?.type==="cms-editor::render-error"&&fe()};return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[rt,yt,kt,St]);const Os=()=>{const d=P.current?.contentWindow,y=$t(ce),$=Uc({v8:be,script:Ml});!d||!y||!$||d.postMessage($,y)},Ba=()=>{if(be)return;const d=P.current?.contentWindow,y=$t(ce);!d||!y||d.postMessage({type:"visual-editor::deactivate"},y)},Ds=()=>{const d=Me.current;d?.has("wireframe")&&(d.wireframe({type:"wireframe:sections",labels:yt,kinds:kt,keys:St}),d.wireframe({type:we==="blocks"?"wireframe:activate":"wireframe:deactivate"}))},Sn=()=>{if(be){Ds();return}const d=P.current?.contentWindow,y=rt,$=Mc({v8:be,production:J.mode==="production",localPreview:!!Z,script:zl});!d||!y||!$||(d.postMessage($,y),d.postMessage({type:"cms-editor::set-labels",labels:yt,kinds:kt,keys:St},y))},Ma=()=>{if(be){Me.current?.wireframe({type:"wireframe:deactivate"});return}const d=P.current?.contentWindow,y=rt;!d||!y||d.postMessage({type:"cms-editor::deactivate"},y)},Fs=d=>{Me.current?.wireframe({type:"wireframe:scroll-to",sectionIndex:d})},Ua=()=>{if(Me.current?.wireframe({type:"wireframe:clear-hover"}),be)return;const d=P.current?.contentWindow,y=rt;!d||!y||(d.postMessage({type:"cms-editor::clear-hover"},y),d.postMessage({type:"visual-editor::clear-hover"},y))},Qt=d=>{if(d==="blocks"&&!p)return;const y=h;!n&&d!==y&&(d==="blocks"?S.current?.resize("30%"):S.current?.collapse()),v(d),w(null),j(null),d!=="blocks"&&Y(null),y==="visual"&&Ba(),d==="visual"&&Os(),y==="blocks"&&d!=="blocks"&&Ma(),d==="blocks"&&Sn()},Ia=()=>{Qt(Xc(h,p))},za=()=>{Qt(Zc(h,p))},Xt=()=>{const d=P.current;if(!d)return;Se();const y=document.activeElement,$=d.tabIndex;d.tabIndex=-1,d.style.pointerEvents="none",d.blur(),_d(d,st.current);let te;const ye=()=>{clearTimeout(te),d.tabIndex=$,d.style.pointerEvents="";const Ne=document.activeElement;(!Ne||Ne===document.body||Ne===d)&&y?.focus(),d.removeEventListener("load",ye)};d.addEventListener("load",ye),te=setTimeout(ye,3e3)};Uo(Xt);const Me=E.useRef(null),$s=E.useEffectEvent(Ds),Ka=E.useEffectEvent((d,y)=>{j({index:d,seq:y})}),Ha=E.useEffectEvent(()=>{fe(),je&&(Pn.current=je.shown),Rt&&An(Ct)}),Bs=E.useEffectEvent(()=>{if(wn(!1),je&&Es(null),je&&je.src!==st.current){Se();return}Xt()});E.useEffect(()=>{if(!be)return;const d=new ql({studioOrigin:window.location.origin,build:"4.570.1",frame:()=>P.current?.contentWindow??null,onWireframeReady:()=>$s(),onWireframe:$=>{$.type==="wireframe:select"&&Ka($.sectionIndex,$.clickSeq)},onModulesChange:()=>wn(d.has("html-swap")),onSwapEnd:()=>Ha(),onSwapFailed:()=>Bs()});Me.current=d;const y=$=>{d.handle($)};return window.addEventListener("message",y),()=>{window.removeEventListener("message",y),d.dispose(),wn(!1),Me.current===d&&(Me.current=null)}},[be,J.iframeBase]);const Ms=be?JSON.stringify([yt,kt,St,we]):"";E.useEffect(()=>{Ms&&$s()},[Ms]);const Us=E.useRef(null);E.useEffect(()=>{const d=Us.current;if(Us.current=je,je&&je!==d){Me.current?.refresh(je.shown)?Se():Bs();return}!je&&d&&d.shown!==d.src&&d.src===st.current&&Xt()},[je]);const Is=()=>{Me.current?.refresh()||Xt()},Ct=Ys(le.slug,t??""),Rt=Ae&&Pt&&!!t,Pn=E.useRef(null);E.useEffect(()=>{if(Rt)return go(Ct)},[Rt,Ct]);const{reload:Lt}=vo(le.slug,t??""),zs=E.useRef(Lt.seq);E.useEffect(()=>{if(zs.current!==Lt.seq&&(zs.current=Lt.seq,!!Rt&&Pn.current===st.current)){if(Lt.navigates){An(Ct);return}Is()}},[Lt.seq]);const Va=xo(zt),At=bo(He(ge)?Va:""),Ks=E.useRef(At);E.useEffect(()=>{const d=Ks.current;if(Ks.current=At,!d||!At||d===At)return;const y=P.current;if(y)return $l({iframe:y,reload:Is})},[At]);const Wa=()=>{const d=ln.indexOf(x);C(ln[(d+1)%ln.length])},jn=(d,y)=>{if(!oe)return;const $=oe,te={...nt,[d]:y};Oe.current=Ve(I,te),pe(ye=>({...ye,[$]:te})),Tt({path:I,pageKey:$,params:te})},qa=Fc({iframeBase:J.iframeBase,resolvedPath:Ce,activeGlobalSectionName:_?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),En=d=>{const y=me[d.key]??{},$=Ve(d.path,y);(_||Ee($)!==Ee(Ce))&&Se(),Oe.current=$,M(null),Y(null),se(null),j(null),ie(d.key),re(d.path),Tt({path:d.path,pageKey:d.key,params:y}),o.selectTarget({kind:"page",key:d.key,path:d.path})},Hs=d=>{(_||Ee(d)!==Ee(Ce))&&Se(),Oe.current=d,M(null),Y(null),se(null),j(null),ie(null),re(d),Tt({path:d,pageKey:null,params:{}})};Ri(Nt,Hs);const Ga=d=>{if(Xe(ge)){const te=de?Fo(de,d.key,Pe):null;te?En(te):dn.info(e("sandbox.preview.blockOnNoPage"));return}if(!bt||!Pe){dn.error(e("sandbox.preview.previewMetadataNotReady"));return}Se(),Oe.current=null;const y=sr(Pe),$=nr(bt,y,d.key);M(d),Y(null),se($),j(null),o.selectTarget({kind:"section",key:d.key})},Ja=d=>{p&&(M(null),Y(d.key),se(null),Qt("blocks"),o.selectTarget({kind:"loader",key:d.key}))},Ya=async({name:d,path:y,templateKey:$})=>{if(!t||!s)return;const te=Xr(y);if(te){B(te);return}const ye=y.trim().startsWith("/")?y.trim():`/${y.trim()}`;if(Ge.some(Ne=>Ee(Ne.path)===Ee(ye))){B(e("sandbox.preview.pageAlreadyExists",{path:ye}));return}B(void 0);try{const Ne=$?await ha(de,$):void 0;if($&&!Ne){B(e("sandbox.preview.templateNoLongerExists"));return}const ot=await ss.mutateAsync({name:d,path:ye,template:Ne,schema:Xe(ge)?{meta:Pe,loadMeta:async()=>(await pn.refetch()).data}:void 0});H(!1),dn.success(e("sandbox.preview.pageCreated",{name:d})),await sl(Ed),En({key:ot.key,name:ot.name,path:ot.path}),Qt("blocks")}catch(Ne){B(Ne instanceof ua?e("sandbox.preview.pageSchemaNotReady"):Ne instanceof Error?Ne.message:e("sandbox.preview.failedToCreatePage"))}},Zt=$c({previewSurfaceActive:Pt,daemonReady:Ls,production:J.mode==="production",servePreviewUrl:He(ge)}),Qa=Bc({showPreviewToolbar:Zt,contentEditingEnabled:f}),_t=()=>{ee(!1),q("")},Nn=_?.name??Kt?.title??hn?.name,Tn=ns.isPending||pn.isPending,Cn=Tn?$t(J.iframeBase):Nn,Ot=_?`section:${_.key}`:z?`loader:${z}`:oe?`page:${oe}`:Yt.includes(Ee(I))?`route:${Ee(I)}`:void 0,Xa=Zt?Qa?r.jsxs(Ur,{open:K,onOpenChange:d=>{ee(d),d||q("")},children:[r.jsx(Br,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":e("sandbox.preview.choosePage"),"data-testid":"preview-page-picker",title:Tn?Cn??void 0:_||Kt?Nn:[Nn,I].filter(Boolean).join(" · "),className:"group/page-picker flex h-7 w-fit min-w-[320px] items-stretch overflow-hidden whitespace-nowrap rounded-[var(--studio-button-radius,calc(var(--radius)*1.333))] border border-border/60 bg-background text-left text-xs text-muted-foreground transition-colors hover:border-border focus-ring",children:r.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 px-2 transition-colors group-hover/page-picker:bg-accent/50 group-data-[state=open]/page-picker:bg-accent/50",children:[_&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-2xs font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[r.jsx($i,{size:11}),e("sandbox.preview.globalBadge")]}),Kt&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-2xs font-medium text-muted-foreground",children:[r.jsx(Bi,{size:11}),e("sandbox.preview.loaderBadge")]}),Cn&&r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:Cn}),!Tn&&!_&&!Kt&&r.jsx("span",{"data-testid":"preview-page-path",className:"ml-auto min-w-0 truncate text-right font-mono text-muted-foreground",children:I}),r.jsx(Ai,{size:12,className:Fe("shrink-0 transition-transform",K&&"rotate-180")})]})})}),r.jsxs(Mr,{className:"w-112 max-w-[calc(100vw-2rem)] p-0",align:"center",sideOffset:8,children:[r.jsxs(zr,{shouldFilter:!1,defaultValue:Ot,children:[r.jsx(Kr,{value:V,onValueChange:d=>{q(d),X.current?.scrollTo({top:0})},placeholder:e("sandbox.preview.searchPagesAndComponents")}),r.jsxs(Ir,{ref:X,className:"max-h-80",children:[r.jsx(Hr,{children:Ge.length===0&&Yt.length===0&&mn.length===0&&os.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}),as.length>0&&r.jsx(dt,{children:as.map(d=>r.jsxs(ut,{value:`page:${d.key}`,"aria-current":Ot===`page:${d.key}`||void 0,title:`${d.name} · ${d.path}`,onSelect:()=>{_t(),En(d)},className:"gap-3 px-3 py-2.5 aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:d.name}),r.jsx("span",{className:"min-w-0 max-w-1/2 truncate text-right font-mono text-xs text-muted-foreground",children:d.path})]},d.key))}),_s.length>0&&r.jsx(dt,{heading:e("sandbox.preview.siteRoutes"),children:_s.map(d=>r.jsx(ut,{value:`route:${d}`,"aria-current":Ot===`route:${d}`||void 0,title:d,onSelect:()=>{_t(),Hs(d)},className:"px-3 py-2.5 aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",children:r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:d})},d))}),is.length>0&&r.jsx(dt,{heading:e("sandbox.preview.globalComponents"),children:is.map(d=>r.jsx(ut,{value:`section:${d.key}`,"aria-current":Ot===`section:${d.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{_t(),Ga(d)},children:r.jsx("span",{className:"truncate",children:d.name})},d.key))}),ls.length>0&&r.jsx(dt,{heading:e("sandbox.preview.globalLoaders"),children:ls.map(d=>r.jsx(ut,{value:`loader:${d.key}`,"aria-current":Ot===`loader:${d.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{_t(),Ja(d)},children:r.jsx("span",{className:"truncate",children:d.title})},d.key))})]})]}),!_&&!z&&Bt(I).some(d=>d.type!=="text")&&r.jsx("div",{className:"flex flex-wrap items-center gap-1 border-t px-3 py-3 text-xs text-muted-foreground",children:Bt(I).map((d,y)=>{if(d.type==="text")return r.jsx("span",{children:d.text},`text-${y}`);const $=gn[d.name];return $&&wt?r.jsx(Sc,{sources:$,template:I,paramName:d.name,value:nt[d.name]??"",sandboxRef:wt,onCommit:te=>jn(d.name,te)},`${oe}:${d.name}`):r.jsx(Oc,{name:d.name,value:nt[d.name]??"",onCommit:te=>jn(d.name,te)},`${oe}:${d.name}`)})}),r.jsx("div",{className:"border-t p-1.5",children:r.jsxs($e,{variant:"ghost",className:"w-full justify-start",onClick:()=>{_t(),B(void 0),H(!0)},children:[r.jsx($r,{size:16}),e("sandbox.preview.createNewPage")]})})]})]}):r.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:qa}):null,Vs=Zt||f?r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsxs(ht,{children:[r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{onClick:Wa,"aria-label":e(kr[x]),children:x==="mobile"?r.jsx(Dr,{size:16}):x==="tablet"?r.jsx(Mi,{size:16}):r.jsx(Fr,{size:16})})}),r.jsx(mt,{children:e(kr[x])})]}),Xa,r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Wt&&r.jsx(sd,{tests:Pa,load:Ea,onOpen:()=>ja(!0),options:W,onChange:d=>{G(d),o.previewAsChanged()},available:!!xn||!hs||!xs}),r.jsx(Ze,{onClick:Ca,disabled:Ae&&!Ss,"aria-label":e("sandbox.preview.openInNewTab"),children:r.jsx(Cr,{size:16})})]})]}):null,Za=(Le||u)&&J.mode==="sandbox",en=Nd[x],tn=x==="desktop"&&(O.width===0||O.width>=en.width+2*yr),Ws=tn?1:Math.min(O.width>0?O.width/(en.width+2*yr):1,1),ei=tn?{width:"100%",height:"100%"}:{width:`${en.width}px`,height:O.height>0?`${O.height/Ws}px`:`${en.height}px`,transform:`scale(${Ws})`,transformOrigin:"top center"},qs=r.jsxs(r.Fragment,{children:[Za&&(Zt||f)&&r.jsx(Ze,{onClick:Ia,"aria-pressed":we==="visual","aria-label":e("sandbox.preview.visualEditor"),active:we==="visual",children:r.jsx(Js,{size:16})}),p&&r.jsxs(ht,{children:[r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{onClick:za,"aria-pressed":we==="blocks","aria-label":e("sandbox.preview.blocksEditor"),active:we==="blocks",children:r.jsx(Ii,{size:16})})}),r.jsx(mt,{children:e("sandbox.preview.blocksEditor")})]}),tt&&r.jsxs(ht,{children:[r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{onClick:D,"aria-pressed":R,"aria-label":e("sectionsEditor.sectionsEditor.viewJson"),active:R,children:r.jsx(Ui,{size:16})})}),r.jsx(mt,{children:e("sectionsEditor.sectionsEditor.viewJson")})]})]}),ti=!!z&&we==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[wt&&Object.entries(gn).map(([d,y])=>(nt[d]??"")===""?r.jsx(Ac,{sources:y,template:I,paramName:d,sandboxRef:wt,onFill:$=>jn(d,$)},`${oe}:${d}`):null),r.jsxs(r.Fragment,{children:[r.jsx(zn.Toolbar.Center.Portal,{fallback:r.jsx("div",{className:"flex min-w-0 items-center justify-center border-b p-2",children:Vs}),children:Vs}),r.jsx(zn.Toolbar.Right.Portal,{fallback:qs,children:qs})]}),r.jsx("div",{className:"flex-1 overflow-hidden relative",children:ti?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(xr,{virtualMcpId:t,externalSelection:N,onSectionPicked:Fs,onViewJsonFile:D}),R&&tt&&r.jsx("div",{className:"absolute inset-0 z-10",children:r.jsx(br,{ref:T,virtualMcpId:t,pageKey:tt,onClose:A})})]}):r.jsxs(rr,{orientation:"horizontal",disabled:we!=="blocks",className:"relative isolate",children:[r.jsx(sn,{ref:S,id:"preview-blocks-editor",defaultSize:we==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:we==="blocks"&&r.jsx(xr,{virtualMcpId:t,externalSelection:N,onSectionPicked:Fs,onViewJsonFile:D})}),we==="blocks"&&r.jsx(ar,{withHandle:!0}),r.jsx(sn,{id:"preview-canvas",defaultSize:we==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden relative z-0",children:r.jsxs(rr,{orientation:"horizontal",disabled:!(R&&tt),children:[r.jsx(sn,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:d=>{if(!d)return;const y=()=>F(te=>te.width===d.clientWidth&&te.height===d.clientHeight?te:{width:d.clientWidth,height:d.clientHeight});y();const $=new ResizeObserver(y);return $.observe(d),()=>$.disconnect()},className:Fe("h-full relative overflow-clip flex justify-center",Pt&&!tn&&"bg-muted/30"),children:[(xe||xa)&&Pt&&r.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:r.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),J.showDecidingLoader&&r.jsx("div",{"data-testid":"preview-deciding",className:"absolute inset-0 z-30 flex items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}),J.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"starting",progress:fs,claimPhase:vn})}),!Z&&Je.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"suspended",onResume:Ue.resume})}),!Z&&Je.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"errored",error:Je.error,onRetry:Ue.retry,connectionsHref:`/${le.slug}/settings/connections`})}),J.showWakingPill&&r.jsxs("div",{className:"absolute top-4 left-1/2 z-20 flex max-w-md -translate-x-1/2 items-start gap-3 rounded-xl bg-muted px-4 py-3 shadow-soft pointer-events-none select-none",children:[r.jsx(gt,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),r.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),we==="visual"&&!b&&r.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-special/40 bg-special/90 px-3 py-1 text-xs font-medium text-special-foreground shadow-soft backdrop-blur-sm pointer-events-none select-none",children:[r.jsx(Js,{size:12}),e("sandbox.preview.clickElementToAsk")]}),we==="visual"&&b&&r.jsx(Ql,{element:b,onDismiss:()=>w(null)}),Pt&&Qe&&r.jsx("div",{className:Fe("shrink-0",!tn&&"bg-background shadow-edge"),style:ei,onMouseLeave:Ua,children:r.jsx("iframe",{ref:P,src:it,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Ts.handleError,onLoad:()=>{if(bn(wr),Oa(it),Ts.handleLoad(),fe(),Pn.current=st.current,Rt&&An(Ct),J.mode!=="sandbox"||Z){(J.mode==="production"&&!J.showWakingPill||Z)&&we==="blocks"&&Sn();return}if(fi("vm_preview_loaded",{view_mode:we,vm_id:Ie?.sandboxHandle??null}),!_)try{const d=P.current?.contentWindow?.location?.pathname;if(!d)return;const y=Oe.current;if(y!==null&&(Oe.current=null,Ee(d)!==Ee(y))||Ee(d)===Ee(Ce))return;re(d),Tt({path:d,pageKey:ae,params:nt})}catch{}we==="visual"&&Os(),we==="blocks"&&Sn()}},J.iframeBase)})]})}),R&&tt&&r.jsxs(r.Fragment,{children:[r.jsx(ar,{withHandle:!0}),r.jsx(sn,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:r.jsx(br,{ref:T,virtualMcpId:t,pageKey:tt,onClose:A})})]})]})})]})}),r.jsx(Hc,{open:Q,onOpenChange:H,isPending:ss.isPending,error:L,templates:Ge,onSubmit:Ya})]})}const qn={app:null,split:!1};function Dd(t){const e=ue.c(24),{project:n,maxApps:s,children:a}=t,l=Te();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={silent:!0},e[0]=u):u=e[0];const o=Hi(u),i=Ut();let c;e[1]!==n.metadata.runtime?(c=n.metadata.runtime??{},e[1]=n.metadata.runtime,e[2]=c):c=e[2];const m=c;let f;e[3]!==m.apps?(f=m.apps??[],e[3]=m.apps,e[4]=f):f=e[4];const p=f;let k;e[5]!==o.update||e[6]!==i||e[7]!==n.id||e[8]!==n.metadata||e[9]!==m||e[10]!==l?(k=b=>o.update.mutate({id:n.id,data:{metadata:{...rl(n.metadata),runtime:{...m,apps:b.length?b:null}}}},{onSuccess:()=>i.start(),onError:()=>dn.error(l("sandbox.appTabs.saveError"))}),e[5]=o.update,e[6]=i,e[7]=n.id,e[8]=n.metadata,e[9]=m,e[10]=l,e[11]=k):k=e[11];const g=k,v=m.path??null;let h,x;e[12]!==p||e[13]!==g?(h=b=>g([...p,{path:b}]),x=b=>g(p.filter(w=>w.path!==b)),e[12]=p,e[13]=g,e[14]=h,e[15]=x):(h=e[14],x=e[15]);let C;return e[16]!==p||e[17]!==a||e[18]!==s||e[19]!==n.id||e[20]!==v||e[21]!==h||e[22]!==x?(C=r.jsx(Fd,{virtualMcpId:n.id,mainPath:v,apps:p,maxApps:s,onAddApp:h,onRemoveApp:x,children:a}),e[16]=p,e[17]=a,e[18]=s,e[19]=n.id,e[20]=v,e[21]=h,e[22]=x,e[23]=C):C=e[23],C}function Fd(t){const e=ue.c(102),{virtualMcpId:n,mainPath:s,apps:a,maxApps:l,onAddApp:u,onRemoveApp:o,children:i}=t,c=Te(),m=Yr(),{currentBranch:f}=Mt(),p=Ut(),k=Xn().lifecycle.phase,g=fn(n,f),{url:v}=Gr(n);let h;e[0]!==g||e[1]!==v?(h=He(g)??v,e[0]=g,e[1]=v,e[2]=h):h=e[2];const x=h,C=x??p.previewUrl,b=!!x||k==="running",w=!b&&p.status==="errored";let N;e[3]!==p.vmEntry?.startedWith?.apps?(N=p.vmEntry?.startedWith?.apps??[],e[3]=p.vmEntry?.startedWith?.apps,e[4]=N):N=e[4];const j=N;let P;e[5]!==n?(P=In.previewAppLayout(n),e[5]=n,e[6]=P):P=e[6];const[S,R]=Un(P,$d);let U;e[7]!==a||e[8]!==S?(U=a.some(fe=>fe.path===S.app)?S.app:null,e[7]=a,e[8]=S,e[9]=U):U=e[9];const T=U,A=T!==null&&S.split&&!m,D=T===null||A,O=T??a[0]?.path??null,[F,K]=E.useState(null),[ee,W]=E.useState(!1);let G;e[10]===Symbol.for("react.memo_cache_sentinel")?(G=()=>{K(null),W(!1)},e[10]=G):G=e[10];const V=G;let q;e[11]!==a||e[12]!==F||e[13]!==m||e[14]!==s||e[15]!==u||e[16]!==R?(q=()=>{if(F===null)return;const fe=lr(F);if(!fe){V();return}if(fe===lr(s??"")||a.some(le=>le.path===fe)){W(!0);return}u(fe),R({app:fe,split:!m}),V()},e[11]=a,e[12]=F,e[13]=m,e[14]=s,e[15]=u,e[16]=R,e[17]=q):q=e[17];const X=q;let Q;e[18]!==s||e[19]!==c?(Q=s?_n(s):c("sandbox.appTabs.root"),e[18]=s,e[19]=c,e[20]=Q):Q=e[20];const H=Q;let L;e[21]!==A||e[22]!==c?(L=c(A?"sandbox.appTabs.single":"sandbox.appTabs.split"),e[21]=A,e[22]=c,e[23]=L):L=e[23];const B=L;let _;e[24]!==c?(_=c("sandbox.appTabs.label"),e[24]=c,e[25]=_):_=e[25];let M;e[26]!==c?(M=c("sandbox.appTabs.main"),e[26]=c,e[27]=M):M=e[27];let z;e[28]!==c?(z=c("sandbox.appTabs.mainHint"),e[28]=c,e[29]=z):z=e[29];let Y;e[30]!==R?(Y=()=>R(qn),e[30]=R,e[31]=Y):Y=e[31];let ne;e[32]!==w||e[33]!==H||e[34]!==b||e[35]!==D||e[36]!==M||e[37]!==z||e[38]!==Y?(ne=r.jsx(Sr,{label:H,badge:M,hint:z,ready:b,failed:w,onScreen:D,onSelect:Y}),e[32]=w,e[33]=H,e[34]=b,e[35]=D,e[36]=M,e[37]=z,e[38]=Y,e[39]=ne):ne=e[39];let se;if(e[40]!==a||e[41]!==T||e[42]!==w||e[43]!==H||e[44]!==o||e[45]!==b||e[46]!==R||e[47]!==A||e[48]!==c){let fe;e[50]!==T||e[51]!==w||e[52]!==H||e[53]!==o||e[54]!==b||e[55]!==R||e[56]!==A||e[57]!==c?(fe=le=>{const Re=_n(le.path);return r.jsx(Sr,{label:Re,hint:c("sandbox.appTabs.extraHint",{app:H}),ready:b,failed:w,onScreen:le.path===T,onSelect:()=>R({app:le.path,split:A}),onRemove:()=>o(le.path),removeLabel:c("sandbox.appTabs.remove",{app:Re})},le.path)},e[50]=T,e[51]=w,e[52]=H,e[53]=o,e[54]=b,e[55]=R,e[56]=A,e[57]=c,e[58]=fe):fe=e[58],se=a.map(fe),e[40]=a,e[41]=T,e[42]=w,e[43]=H,e[44]=o,e[45]=b,e[46]=R,e[47]=A,e[48]=c,e[49]=se}else se=e[49];let I;e[59]!==ne||e[60]!==se||e[61]!==_?(I=r.jsxs("div",{role:"tablist","aria-label":_,className:"flex min-w-0 items-center gap-1 overflow-x-auto",children:[ne,se]}),e[59]=ne,e[60]=se,e[61]=_,e[62]=I):I=e[62];let re;e[63]!==a.length||e[64]!==X||e[65]!==F||e[66]!==ee||e[67]!==l||e[68]!==c?(re=F!==null?r.jsx("form",{className:"w-40 shrink-0",onSubmit:fe=>{fe.preventDefault(),X()},children:r.jsx("input",{autoFocus:!0,value:F,placeholder:"apps/checkout","aria-label":c("sandbox.appTabs.pathLabel"),"aria-invalid":ee,onChange:fe=>{K(fe.target.value),W(!1)},onBlur:V,onKeyDown:fe=>{fe.key==="Escape"&&V()},className:Fe("h-7 w-full rounded-md border bg-background px-2 font-mono text-xs outline-none",ee?"border-destructive":"border-border")})}):a.length<l&&r.jsx(ft,{label:c("sandbox.appTabs.add"),onClick:()=>K(""),children:r.jsx($r,{})}),e[63]=a.length,e[64]=X,e[65]=F,e[66]=ee,e[67]=l,e[68]=c,e[69]=re):re=e[69];let ae;e[70]!==m||e[71]!==R||e[72]!==A||e[73]!==B||e[74]!==O?(ae=!m&&O&&r.jsx(ft,{label:B,active:A,onClick:()=>R(A?qn:{app:O,split:!0}),children:r.jsx(zi,{})}),e[70]=m,e[71]=R,e[72]=A,e[73]=B,e[74]=O,e[75]=ae):ae=e[75];let ie;e[76]!==I||e[77]!==re||e[78]!==ae?(ie=r.jsxs(r.Fragment,{children:[I,re,ae]}),e[76]=I,e[77]=re,e[78]=ae,e[79]=ie):ie=e[79];const me=ie;let pe;e[80]!==me?(pe=r.jsx(zn.Topbar.Left.Portal,{fallback:r.jsx("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-border px-2",children:me}),children:r.jsx("div",{className:"ml-1 flex min-w-0 items-center gap-1 border-l border-border/60 pl-2",children:me})}),e[80]=me,e[81]=pe):pe=e[81];let xe;e[82]!==i||e[83]!==D?(xe=D&&r.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:i}),e[82]=i,e[83]=D,e[84]=xe):xe=e[84];let he;e[85]!==T||e[86]!==w||e[87]!==p.start||e[88]!==x||e[89]!==H||e[90]!==C||e[91]!==b||e[92]!==R||e[93]!==A||e[94]!==j?(he=T!==null&&r.jsx(Bd,{name:_n(T),mainName:H,appUrl:C?al(C,T):null,ready:b,failed:w,notStarted:!x&&!j.includes(T),onStart:p.start,className:Fe(A&&"border-l border-border"),onClose:A?()=>R({app:T,split:!1}):void 0},T),e[85]=T,e[86]=w,e[87]=p.start,e[88]=x,e[89]=H,e[90]=C,e[91]=b,e[92]=R,e[93]=A,e[94]=j,e[95]=he):he=e[95];let ve;e[96]!==xe||e[97]!==he?(ve=r.jsxs("div",{className:"flex min-h-0 flex-1",children:[xe,he]}),e[96]=xe,e[97]=he,e[98]=ve):ve=e[98];let Se;return e[99]!==pe||e[100]!==ve?(Se=r.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col",children:[pe,ve]}),e[99]=pe,e[100]=ve,e[101]=Se):Se=e[101],Se}function $d(t){return t??qn}function Sr(t){const e=ue.c(28),{label:n,badge:s,hint:a,ready:l,failed:u,onScreen:o,onSelect:i,onRemove:c,removeLabel:m}=t,f=o?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/60 hover:text-foreground";let p;e[0]!==f?(p=Fe("group/app-tab flex h-7 shrink-0 items-center rounded-md text-xs transition-colors",f),e[0]=f,e[1]=p):p=e[1];const k=l?"bg-success":u?"bg-destructive":"animate-pulse bg-warning";let g;e[2]!==k?(g=Fe("size-1.5 rounded-full",k),e[2]=k,e[3]=g):g=e[3];let v;e[4]!==g?(v=r.jsx("span",{"aria-hidden":!0,className:g}),e[4]=g,e[5]=v):v=e[5];let h;e[6]!==n?(h=r.jsx("span",{className:"max-w-40 truncate",children:n}),e[6]=n,e[7]=h):h=e[7];let x;e[8]!==s?(x=s&&r.jsx("span",{className:"text-[10px] text-muted-foreground",children:s}),e[8]=s,e[9]=x):x=e[9];let C;e[10]!==o||e[11]!==i||e[12]!==v||e[13]!==h||e[14]!==x?(C=r.jsx(pt,{asChild:!0,children:r.jsxs("button",{type:"button",role:"tab","aria-selected":o,onClick:i,className:"flex h-full items-center gap-1.5 rounded-md px-2.5 focus-ring",children:[v,h,x]})}),e[10]=o,e[11]=i,e[12]=v,e[13]=h,e[14]=x,e[15]=C):C=e[15];let b;e[16]!==a?(b=r.jsx(mt,{className:"max-w-64",children:a}),e[16]=a,e[17]=b):b=e[17];let w;e[18]!==C||e[19]!==b?(w=r.jsxs(ht,{children:[C,b]}),e[18]=C,e[19]=b,e[20]=w):w=e[20];let N;e[21]!==c||e[22]!==m?(N=c&&r.jsx("button",{type:"button","aria-label":m,onClick:c,className:"-ml-1 mr-1 flex size-5 items-center justify-center rounded opacity-0 hover:bg-sidebar-accent focus-ring focus-visible:opacity-100 group-hover/app-tab:opacity-100",children:r.jsx(sa,{className:"size-3"})}),e[21]=c,e[22]=m,e[23]=N):N=e[23];let j;return e[24]!==w||e[25]!==N||e[26]!==p?(j=r.jsxs("div",{className:p,children:[w,N]}),e[24]=w,e[25]=N,e[26]=p,e[27]=j):j=e[27],j}function Bd(t){const e=ue.c(71),{name:n,mainName:s,appUrl:a,ready:l,failed:u,notStarted:o,onStart:i,className:c,onClose:m}=t,f=Te(),[p,k]=E.useState("/"),[g,v]=E.useState("desktop"),[h,x]=E.useState(0),C=E.useRef(null);let b;e[0]!==a||e[1]!==p?(b=a?il(a,p):null,e[0]=a,e[1]=p,e[2]=b):b=e[2];const w=b;let N;e[3]!==c?(N=Fe("flex min-h-0 min-w-0 flex-1 flex-col",c),e[3]=c,e[4]=N):N=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=z=>{z.preventDefault(),k(C.current?.value||"/")},e[5]=j):j=e[5];let P;e[6]!==n||e[7]!==f?(P=f("sandbox.appPane.path",{app:n}),e[6]=n,e[7]=f,e[8]=P):P=e[8];let S;e[9]!==p||e[10]!==P?(S=r.jsx("form",{className:"min-w-0 flex-1",onSubmit:j,children:r.jsx("input",{ref:C,defaultValue:p,"aria-label":P,className:"h-7 w-full rounded-md border border-border/60 bg-background px-2 font-mono text-xs text-muted-foreground outline-none hover:border-border focus:border-border focus:text-foreground"})}),e[9]=p,e[10]=P,e[11]=S):S=e[11];let R;e[12]!==g||e[13]!==f?(R=f(g==="desktop"?"sandbox.preview.deviceMobile":"sandbox.preview.deviceDesktop"),e[12]=g,e[13]=f,e[14]=R):R=e[14];let U;e[15]===Symbol.for("react.memo_cache_sentinel")?(U=()=>v(Ud),e[15]=U):U=e[15];let T;e[16]!==g?(T=g==="desktop"?r.jsx(Fr,{}):r.jsx(Dr,{}),e[16]=g,e[17]=T):T=e[17];let A;e[18]!==R||e[19]!==T?(A=r.jsx(ft,{label:R,onClick:U,children:T}),e[18]=R,e[19]=T,e[20]=A):A=e[20];let D;e[21]!==n||e[22]!==f?(D=f("sandbox.appPane.reload",{app:n}),e[21]=n,e[22]=f,e[23]=D):D=e[23];const O=!w||!l;let F,K;e[24]===Symbol.for("react.memo_cache_sentinel")?(F=()=>x(Md),K=r.jsx(pi,{}),e[24]=F,e[25]=K):(F=e[24],K=e[25]);let ee;e[26]!==D||e[27]!==O?(ee=r.jsx(ft,{label:D,disabled:O,onClick:F,children:K}),e[26]=D,e[27]=O,e[28]=ee):ee=e[28];let W;e[29]!==n||e[30]!==f?(W=f("sandbox.appPane.openInNewTab",{app:n}),e[29]=n,e[30]=f,e[31]=W):W=e[31];const G=!w||!l;let V;e[32]!==w?(V=()=>w&&window.open(w,"_blank","noopener"),e[32]=w,e[33]=V):V=e[33];let q;e[34]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx(Cr,{}),e[34]=q):q=e[34];let X;e[35]!==W||e[36]!==G||e[37]!==V?(X=r.jsx(ft,{label:W,disabled:G,onClick:V,children:q}),e[35]=W,e[36]=G,e[37]=V,e[38]=X):X=e[38];let Q;e[39]!==n||e[40]!==m||e[41]!==f?(Q=m&&r.jsx(ft,{label:f("sandbox.appPane.close",{app:n}),onClick:m,children:r.jsx(sa,{})}),e[39]=n,e[40]=m,e[41]=f,e[42]=Q):Q=e[42];let H;e[43]!==ee||e[44]!==X||e[45]!==Q||e[46]!==S||e[47]!==A?(H=r.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-border px-2",children:[S,A,ee,X,Q]}),e[43]=ee,e[44]=X,e[45]=Q,e[46]=S,e[47]=A,e[48]=H):H=e[48];let L;e[49]!==s||e[50]!==f?(L=f("sandbox.appPane.previewOnly",{app:s}),e[49]=s,e[50]=f,e[51]=L):L=e[51];let B;e[52]!==L?(B=r.jsx("p",{className:"shrink-0 truncate border-b border-border bg-muted/40 px-3 py-1.5 text-xs text-muted-foreground",children:L}),e[52]=L,e[53]=B):B=e[53];let _;e[54]!==g||e[55]!==u||e[56]!==s||e[57]!==n||e[58]!==o||e[59]!==i||e[60]!==l||e[61]!==h||e[62]!==w||e[63]!==f?(_=r.jsx("div",{className:"flex min-h-0 flex-1 justify-center overflow-auto bg-muted/40",children:l&&o?r.jsxs("div",{className:"flex flex-col items-center gap-3 self-center px-6 text-center",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:f("sandbox.appPane.notStarted",{app:n})}),r.jsx($e,{size:"sm",variant:"outline",onClick:i,children:f("sandbox.appPane.start",{app:n})})]}):!l||!w?r.jsx("p",{className:"self-center px-6 text-center text-sm text-muted-foreground",children:l?f("sandbox.appPane.noUrl"):u?f("sandbox.appPane.failed",{app:s}):f("sandbox.appPane.waiting")}):r.jsx("iframe",{src:w,title:n,className:Fe("h-full bg-background",g==="mobile"?"w-[412px] max-w-full border-x border-border":"w-full")},`${w}#${h}`)}),e[54]=g,e[55]=u,e[56]=s,e[57]=n,e[58]=o,e[59]=i,e[60]=l,e[61]=h,e[62]=w,e[63]=f,e[64]=_):_=e[64];let M;return e[65]!==n||e[66]!==N||e[67]!==H||e[68]!==B||e[69]!==_?(M=r.jsxs("section",{"aria-label":n,className:N,children:[H,B,_]}),e[65]=n,e[66]=N,e[67]=H,e[68]=B,e[69]=_,e[70]=M):M=e[70],M}function Md(t){return t+1}function Ud(t){return t==="desktop"?"mobile":"desktop"}function ft(t){const e=ue.c(11),{label:n,children:s,active:a,disabled:l,onClick:u}=t;let o;e[0]!==a||e[1]!==s||e[2]!==l||e[3]!==n||e[4]!==u?(o=r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{"aria-label":n,"aria-pressed":a,active:a,disabled:l,onClick:u,children:s})}),e[0]=a,e[1]=s,e[2]=l,e[3]=n,e[4]=u,e[5]=o):o=e[5];let i;e[6]!==n?(i=r.jsx(mt,{children:n}),e[6]=n,e[7]=i):i=e[7];let c;return e[8]!==o||e[9]!==i?(c=r.jsxs(ht,{children:[o,i]}),e[8]=o,e[9]=i,e[10]=c):c=e[10],c}const Id=async(t,e)=>{try{return await fetch(t,{method:"HEAD",mode:"no-cors",cache:"no-store",credentials:"omit",signal:e}),!0}catch{return!1}},zd=1e4,Kd=1e4,Hd=5e3,Vd=2;function Wd(t,e){return t&&e===0?Kd:Math.min(1e3*2**Math.max(0,e-1),Hd)}function qd(t,e,n){return e?!0:t===!0&&n<Vd}function Gd(t,e){const n=ue.c(11),s=Id,a=mi();let l;n[0]!==t?(l=Gn.localAppReachable(t??""),n[0]=t,n[1]=l):l=n[1];const u=l;let o;n[2]!==s||n[3]!==a||n[4]!==u||n[5]!==t?(o=async f=>{const{signal:p}=f,k=new AbortController,g=()=>k.abort();p.addEventListener("abort",g);const v=setTimeout(g,zd),h=await s(t,k.signal).catch(Yd);clearTimeout(v),p.removeEventListener("abort",g);const x=a.getQueryData(u),C=h?0:(x?.failures??0)+1;return{up:qd(x?.up??null,h,C),failures:C}},n[2]=s,n[3]=a,n[4]=u,n[5]=t,n[6]=o):o=n[6];const i=!!t;let c;n[7]!==u||n[8]!==o||n[9]!==i?(c={queryKey:u,queryFn:o,enabled:i,retry:!1,staleTime:0,gcTime:0,refetchInterval:Jd},n[7]=u,n[8]=o,n[9]=i,n[10]=c):c=n[10];const{data:m}=Tr(c);return t?m?.up??null:null}function Jd(t){return t.state.data?Wd(t.state.data.up,t.state.data.failures):!1}function Yd(){return!1}function Qd(t){const{backend:e}=t;if(e.kind==="protocol"&&e.source==="local")return{kind:"connected"};if(e.kind==="unavailable"&&e.source==="local"){const n=e.problem;return!n||n.reason==="not-answering"?t.access==="denied"?{kind:"needs-permission"}:{kind:"not-running"}:{kind:"problem",problem:n}}return{kind:"connecting"}}function Ju(t){const e=ue.c(53),{virtualMcpId:n}=t,s=Te(),a=Vi(n),{connection:l}=Jr(n),{activeTask:u,taskId:o,currentBranch:i}=Mt(),c=ml(o),[m,f]=E.useState(!1),p=fn(n,i);let k;e[0]!==p||e[1]!==l?(k=l?He(p):null,e[0]=p,e[1]=l,e[2]=k):k=e[2];const g=k,v=Gd(g),h=aa(),x=ol("multi_app_preview");if(dl({threadId:o,sandboxBranch:u?.branch??i,agentHasRepo:On(a?.metadata),threadHasRepo:On(c)||On(u?.metadata)})==="none"&&!l){let j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(cr,{className:"size-7 text-foreground"})}),e[3]=j):j=e[3];let P;e[4]!==s?(P=s("mainPanelTabs.previewTab.noSourceToPreview"),e[4]=s,e[5]=P):P=e[5];let S;e[6]!==s?(S=s("mainPanelTabs.previewTab.connectGithubDescription"),e[6]=s,e[7]=S):S=e[7];let R,U;e[8]===Symbol.for("react.memo_cache_sentinel")?(R=()=>f(!0),U=r.jsx(cr,{className:"size-4"}),e[8]=R,e[9]=U):(R=e[8],U=e[9]);let T;e[10]!==s?(T=s("mainPanelTabs.previewTab.connectGithub"),e[10]=s,e[11]=T):T=e[11];let A;e[12]!==T?(A=r.jsxs($e,{onClick:R,children:[U,T]}),e[12]=T,e[13]=A):A=e[13];let D;e[14]!==P||e[15]!==S||e[16]!==A?(D=r.jsx(ll,{className:"h-full",image:j,title:P,description:S,actions:A}),e[14]=P,e[15]=S,e[16]=A,e[17]=D):D=e[17];let O;e[18]!==m?(O=r.jsx(cl,{open:m,onOpenChange:f,mode:"agent"}),e[18]=m,e[19]=O):O=e[19];let F;return e[20]!==O||e[21]!==D?(F=r.jsxs(r.Fragment,{children:[D,O]}),e[20]=O,e[21]=D,e[22]=F):F=e[22],F}if(l&&a&&!He(p)){let j;e[23]!==h||e[24]!==p?(j=Qd({backend:p,access:h}),e[23]=h,e[24]=p,e[25]=j):j=e[25];let P;e[26]!==l.endpoint?(P=yo(l.endpoint),e[26]=l.endpoint,e[27]=P):P=e[27];let S;return e[28]!==j||e[29]!==P?(S=r.jsx(Zd,{status:j,host:P}),e[28]=j,e[29]=P,e[30]=S):S=e[30],S}if(g&&v!==!0){let j;e[31]!==s?(j=s("mainPanelTabs.previewTab.localAppWaiting.title"),e[31]=s,e[32]=j):j=e[32];let P;e[33]!==g||e[34]!==s?(P=s("mainPanelTabs.previewTab.localAppWaiting.body",{host:Xd(g)}),e[33]=g,e[34]=s,e[35]=P):P=e[35];let S;e[36]!==P?(S=r.jsx(na,{text:P}),e[36]=P,e[37]=S):S=e[37];let R;e[38]!==s?(R=s("mainPanelTabs.previewTab.localAppWaiting.hint"),e[38]=s,e[39]=R):R=e[39];let U;e[40]!==R?(U=r.jsx("p",{role:"status",className:"text-center text-sm text-muted-foreground",children:R}),e[40]=R,e[41]=U):U=e[41];let T;return e[42]!==j||e[43]!==S||e[44]!==U?(T=r.jsx(un,{headingLevel:2,waiting:!0,title:j,lead:S,footer:U}),e[42]=j,e[43]=S,e[44]=U,e[45]=T):T=e[45],T}let b;e[46]!==n?(b=r.jsx(Od,{virtualMcpId:n}),e[46]=n,e[47]=b):b=e[47];const w=b;let N;return e[48]!==a||e[49]!==x||e[50]!==w||e[51]!==l?(N=r.jsx(Ni,{children:x&&a&&!l?r.jsx(Dd,{project:a,maxApps:nl,children:w}):w}),e[48]=a,e[49]=x,e[50]=w,e[51]=l,e[52]=N):N=e[52],N}function Xd(t){try{return new URL(t).host}catch{return t}}function Zd(t){const e=ue.c(13),{status:n,host:s}=t,a=Te();if(n.kind==="connected"){let o;e[0]!==a?(o=a("mainPanelTabs.previewTab.localhostNoPreview.title"),e[0]=a,e[1]=o):o=e[1];let i;e[2]!==a?(i=a("mainPanelTabs.previewTab.localhostNoPreview.body"),e[2]=a,e[3]=i):i=e[3];let c;return e[4]!==o||e[5]!==i?(c=r.jsx(un,{headingLevel:2,waiting:!1,title:o,lead:i}),e[4]=o,e[5]=i,e[6]=c):c=e[6],c}let l;e[7]!==s||e[8]!==n?(l=bl(n,s),e[7]=s,e[8]=n,e[9]=l):l=e[9];let u;return e[10]!==s||e[11]!==l?(u=r.jsx(xl,{wait:l,hosts:s}),e[10]=s,e[11]=l,e[12]=u):u=e[12],u}export{xl as L,Ju as P,un as S,Gu as u};