decocms 4.565.0 → 4.566.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/dist/client/assets/{AlertCircle-BUZy3sYx.js → AlertCircle-vm4sk-x9.js} +1 -1
  2. package/dist/client/assets/{AreaChart-D0-n_ugf.js → AreaChart-D7_hgduK.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DDsFHkTp.js → ArrowLeft-DDdp1fkC.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-DWQcbDQV.js → ArrowUp-DD_r1Y_T.js} +1 -1
  5. package/dist/client/assets/{CartesianChart-BOuUkFJ5.js → CartesianChart-DZaqdCN6.js} +1 -1
  6. package/dist/client/assets/{CategoricalChart-EDrHq-65.js → CategoricalChart-Dannm-85.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DIJUPKEz.js → CheckCircle-CO-Sp-gI.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-CTH779Lx.js → ChevronSelectorVertical-BsQHRlTg.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DKpA0SQs.js → ChevronUp-DzfCpOxS.js} +1 -1
  10. package/dist/client/assets/{CreditCard01-Br5lPOuR.js → CreditCard01-Dg0W_VbM.js} +1 -1
  11. package/dist/client/assets/{Globe04-B5etP6wn.js → Globe04-CbE4fQfn.js} +1 -1
  12. package/dist/client/assets/{Key01-DK9zv-Op.js → Key01-DnFTUPGs.js} +1 -1
  13. package/dist/client/assets/{LinkBroken01-BH9f0tfg.js → LinkBroken01-BrWXpfvW.js} +1 -1
  14. package/dist/client/assets/{Minus-ccD5p3q-.js → Minus-CGC-Ky2T.js} +1 -1
  15. package/dist/client/assets/{Monitor01-Dzr2ls8R.js → Monitor01-DPIeBRgo.js} +1 -1
  16. package/dist/client/assets/{Play-Btzw93Bx.js → Play-B9PgWZlg.js} +1 -1
  17. package/dist/client/assets/{Plus-CgQrQuUH.js → Plus-CZbPbPr7.js} +1 -1
  18. package/dist/client/assets/{ReferenceLine-CtRADngO.js → ReferenceLine-ZH8D8bPO.js} +1 -1
  19. package/dist/client/assets/{SearchMd-CxCEqQoC.js → SearchMd-DseifSbW.js} +1 -1
  20. package/dist/client/assets/{ShoppingBag01-DZhdG6kl.js → ShoppingBag01-TG8T0GTy.js} +1 -1
  21. package/dist/client/assets/{Sun-BCBzha1f.js → Sun-CBOZY0wW.js} +1 -1
  22. package/dist/client/assets/{SwitchHorizontal01-COrh-gwe.js → SwitchHorizontal01-CTmes_jp.js} +1 -1
  23. package/dist/client/assets/{Tool01-PTUwz10y.js → Tool01-BhHpHR3H.js} +1 -1
  24. package/dist/client/assets/{Tooltip-B-Z7AH1O.js → Tooltip-ClzMOV5r.js} +1 -1
  25. package/dist/client/assets/{Trash01-CSeiUIoJ.js → Trash01-HGp7pYgQ.js} +1 -1
  26. package/dist/client/assets/{Upload01-XfsfpdVT.js → Upload01-B2W5ZMg1.js} +1 -1
  27. package/dist/client/assets/{UserSquare-CBsLM8SI.js → UserSquare-6Sdby0FR.js} +1 -1
  28. package/dist/client/assets/{Users01-BprztEKc.js → Users01-DQRKjdTI.js} +1 -1
  29. package/dist/client/assets/{XClose-DdH4UADI.js → XClose-DeFo1VOD.js} +1 -1
  30. package/dist/client/assets/{Zap-OzyQY3vd.js → Zap-DalPfKev.js} +1 -1
  31. package/dist/client/assets/{access-gate-CKMy1mbR.js → access-gate-QW6XL1k3.js} +1 -1
  32. package/dist/client/assets/{add-connection-dialog-AHjZRtfP.js → add-connection-dialog-DSHTc4iD.js} +1 -1
  33. package/dist/client/assets/agent-app-BOWDvrpS.js +1 -0
  34. package/dist/client/assets/{agent-assets-BLu431Wu.js → agent-assets-DHBXzTkB.js} +1 -1
  35. package/dist/client/assets/{agent-automation-Bej00D4m.js → agent-automation-CkV5B9AK.js} +1 -1
  36. package/dist/client/assets/{agent-automations-DjiOoY8H.js → agent-automations-M5aYunrZ.js} +1 -1
  37. package/dist/client/assets/{agent-calendar-B97lQHdV.js → agent-calendar-DFReqWL3.js} +1 -1
  38. package/dist/client/assets/{agent-capabilities-BFL3-oro.js → agent-capabilities-D6AEfG_r.js} +1 -1
  39. package/dist/client/assets/{agent-connect-sources-QxyEtOWi.js → agent-connect-sources-BAUjcdOy.js} +1 -1
  40. package/dist/client/assets/agent-deck-Bx7kJg98.js +1 -0
  41. package/dist/client/assets/{agent-e2e-fCfzW_FQ.js → agent-e2e-vXEqRzNY.js} +1 -1
  42. package/dist/client/assets/agent-experiments-DMJmKtxn.js +1 -0
  43. package/dist/client/assets/{agent-file-DgQgKujU.js → agent-file-ByXLEOEk.js} +1 -1
  44. package/dist/client/assets/{agent-hosting-BPsqj3Yn.js → agent-hosting-DN3p71Ic.js} +1 -1
  45. package/dist/client/assets/{agent-icon-j6t5huQo.js → agent-icon-CTjv6Gf3.js} +1 -1
  46. package/dist/client/assets/agent-library-_YpYk3se.js +1 -0
  47. package/dist/client/assets/agent-library-file-BGthAKoz.js +1 -0
  48. package/dist/client/assets/agent-overview-CunpO2WP.js +1 -0
  49. package/dist/client/assets/{agent-releases-B1im8uWG.js → agent-releases-HbfAzMUb.js} +1 -1
  50. package/dist/client/assets/agent-settings-Cf2re97I.js +1 -0
  51. package/dist/client/assets/{agent-site-editor-CWbn-ALi.js → agent-site-editor-ZQQDb3Rx.js} +1 -1
  52. package/dist/client/assets/agent-site-editor-code-CBnPLDwR.js +2 -0
  53. package/dist/client/assets/agent-site-editor-content-BMrNzhJ0.js +1 -0
  54. package/dist/client/assets/agent-site-editor-preview-GFFDvuZl.js +1 -0
  55. package/dist/client/assets/agent-view-BoMty4cJ.js +1 -0
  56. package/dist/client/assets/{agent-view-guard-Aay8xve-.js → agent-view-guard-CvY79irZ.js} +1 -1
  57. package/dist/client/assets/{ai-providers-qcfEE-3u.js → ai-providers-hi0gzVEm.js} +1 -1
  58. package/dist/client/assets/{alert-KmUmMQhB.js → alert-CBNKTKcv.js} +1 -1
  59. package/dist/client/assets/{analytics-sections-DDjPUZlX.js → analytics-sections-DLAuNCzk.js} +1 -1
  60. package/dist/client/assets/api-keys-3ZWG2OME.js +1 -0
  61. package/dist/client/assets/{api-keys-DalsboNs.js → api-keys-BFyU3rHn.js} +1 -1
  62. package/dist/client/assets/{app-editor-CGEsTkX5.js → app-editor-D6EIgj3g.js} +1 -1
  63. package/dist/client/assets/{asset-utils-DurtmtJB.js → asset-utils-DC1EoBVm.js} +1 -1
  64. package/dist/client/assets/{auth-DKMucRNN.js → auth-BZ5Ef56k.js} +1 -1
  65. package/dist/client/assets/{auth-catchall-CkPAI3Uh.js → auth-catchall-DvKB5Itg.js} +1 -1
  66. package/dist/client/assets/{auth-entry-A7VyhJjR.js → auth-entry-BPV6B4VL.js} +1 -1
  67. package/dist/client/assets/{auth-split-layout-LoT4Xun1.js → auth-split-layout-DhnEMT3K.js} +1 -1
  68. package/dist/client/assets/{authenticate-and-persist-oauth-9jPFumIX.js → authenticate-and-persist-oauth-DwlAs1ZZ.js} +1 -1
  69. package/dist/client/assets/{automation-list-row-Cu3GEMCa.js → automation-list-row-CWJ60M-N.js} +1 -1
  70. package/dist/client/assets/{automation-runs-CpmB4Tc_.js → automation-runs-otqJFTtW.js} +1 -1
  71. package/dist/client/assets/{automations-CKgKaXHz.js → automations-ByVN628t.js} +1 -1
  72. package/dist/client/assets/{autosend-Ct94XjGX.js → autosend-FOyswNSR.js} +1 -1
  73. package/dist/client/assets/{badge-CiHbBWYb.js → badge-D4fF-8ns.js} +1 -1
  74. package/dist/client/assets/{block-document-BxukMqsM.js → block-document-DZDOtPeq.js} +1 -1
  75. package/dist/client/assets/{blocks-preview-workspace-context-XqFh3zcs.js → blocks-preview-workspace-context-B7BEJFAh.js} +1 -1
  76. package/dist/client/assets/{blocks-tab-states-DQ2uW3vb.js → blocks-tab-states-DAhg2Ye6.js} +1 -1
  77. package/dist/client/assets/{blog-schema-D9NweiCR.js → blog-schema-C6fspqby.js} +1 -1
  78. package/dist/client/assets/{buckets-CRNcXCo2.js → buckets-Ck5_X87E.js} +1 -1
  79. package/dist/client/assets/{build-improve-prompt-doc-d8Z2ZnPa.js → build-improve-prompt-doc-C7YK4Pu4.js} +1 -1
  80. package/dist/client/assets/{calendar-DaAEMIpU.js → calendar-C6M3LMV4.js} +1 -1
  81. package/dist/client/assets/{capability-load-error-f8fuLXFE.js → capability-load-error-C2BQaZ2o.js} +1 -1
  82. package/dist/client/assets/{category-editor-DVmCZ-bz.js → category-editor-QazjTrf0.js} +1 -1
  83. package/dist/client/assets/{chart-CzeYnulq.js → chart-g5ZZsRJb.js} +1 -1
  84. package/dist/client/assets/{chat-context-DrlDLCTg.js → chat-context-C4aI-9Gh.js} +1 -1
  85. package/dist/client/assets/{chat-draft-DutF2IY0.js → chat-draft-v_nDJXuK.js} +1 -1
  86. package/dist/client/assets/{checkbox-C4q-ggo1.js → checkbox-BpYZyZtV.js} +1 -1
  87. package/dist/client/assets/{choose-editor-CNjh4gU1.js → choose-editor-D5eTMtDH.js} +1 -1
  88. package/dist/client/assets/{cli-auth-success-Dt-NZyXk.js → cli-auth-success-CAUQEN95.js} +1 -1
  89. package/dist/client/assets/{client-icons-ChrUnL8R.js → client-icons-D2cDT816.js} +1 -1
  90. package/dist/client/assets/{cms-settings-editor-D6y5_SVS.js → cms-settings-editor-5skFaLht.js} +1 -1
  91. package/dist/client/assets/{cms-store-drafts-4RdP5PWT.js → cms-store-drafts-VPkfiqMe.js} +1 -1
  92. package/dist/client/assets/{collapsible-p2X_LZ_q.js → collapsible-BgpbICto.js} +1 -1
  93. package/dist/client/assets/{collection-detail-Cc7LC1R5.js → collection-detail-CEsMpM_C.js} +1 -1
  94. package/dist/client/assets/{collection-display-button-5bNL2B-r.js → collection-display-button-PZqoRcbJ.js} +1 -1
  95. package/dist/client/assets/{collection-search-Rq9aAmdK.js → collection-search-CH54VXGp.js} +1 -1
  96. package/dist/client/assets/{collection-table-wrapper-Dfgu36rj.js → collection-table-wrapper-bVMovNDL.js} +1 -1
  97. package/dist/client/assets/{collection-tabs-CdN1mEqK.js → collection-tabs-DF52b4Gj.js} +1 -1
  98. package/dist/client/assets/{combobox-B_k816xS.js → combobox-Bfj0PjLE.js} +1 -1
  99. package/dist/client/assets/{command-D9i8Wmtq.js → command-CsBJ3GOI.js} +1 -1
  100. package/dist/client/assets/{companion-mcps-section-_xwSRr1Z.js → companion-mcps-section-YQlM2-Os.js} +1 -1
  101. package/dist/client/assets/{config-gHvF9zN4.js → config-BMlT5DPg.js} +1 -1
  102. package/dist/client/assets/{connect-layout-CSBXeiVm.js → connect-layout-DLqiwduY.js} +1 -1
  103. package/dist/client/assets/{connect-B7DHTQSC.js → connect-qXBtQ-OH.js} +1 -1
  104. package/dist/client/assets/{connect-source-dialog-Cq5kJyv3.js → connect-source-dialog-Bsqg8dUA.js} +1 -1
  105. package/dist/client/assets/{connection-BXJ_FY41.js → connection-95gHZiW5.js} +1 -1
  106. package/dist/client/assets/{connection-card-CdQGf9Gr.js → connection-card-CMMSZX4x.js} +1 -1
  107. package/dist/client/assets/{connection-detail-h3Xef5BT.js → connection-detail-BaU7wg0S.js} +1 -1
  108. package/dist/client/assets/{connection-form-helpers-CAbFPCRq.js → connection-form-helpers-BJkokVuQ.js} +1 -1
  109. package/dist/client/assets/{connection-slug-DlGEGmx-.js → connection-slug-CVtaxOKz.js} +1 -1
  110. package/dist/client/assets/{connections-knVBH_SV.js → connections-BtILN1R8.js} +1 -1
  111. package/dist/client/assets/{content-tab-Bgt3yfFJ.js → content-tab-DQG8vdsL.js} +3 -3
  112. package/dist/client/assets/{context-CzjjsOy1.js → context-4QFXsbD6.js} +1 -1
  113. package/dist/client/assets/{context-menu-I7seXZR-.js → context-menu-1fzYZhm_.js} +1 -1
  114. package/dist/client/assets/{context-shell-W-FDFEuo.js → context-shell-CCkAMmWr.js} +3 -3
  115. package/dist/client/assets/{core.esm-B2YwU_IP.js → core.esm-DYzatWGk.js} +1 -1
  116. package/dist/client/assets/{create-organization-dialog-DTsC6N0a.js → create-organization-dialog-DCgZG2cL.js} +1 -1
  117. package/dist/client/assets/{device-hint-DScofASI.js → device-hint-CFx01Kw_.js} +1 -1
  118. package/dist/client/assets/{discover-D5YLb2mr.js → discover-CoCxl4Q9.js} +1 -1
  119. package/dist/client/assets/{domain-settings-Bvue8cd_.js → domain-settings-DuCeTo5C.js} +1 -1
  120. package/dist/client/assets/{drawer-rcd6q2GW.js → drawer-B5at6I_u.js} +1 -1
  121. package/dist/client/assets/{editor-DKXiN5wq.js → editor-DD0jwUtP.js} +1 -1
  122. package/dist/client/assets/{editor-classes-CEDZ4HqC.js → editor-classes-Dnkv0ExO.js} +1 -1
  123. package/dist/client/assets/{empty-state-vqQ3KE7u.js → empty-state-D3yjfo9M.js} +1 -1
  124. package/dist/client/assets/{empty-state-DjHc7-hg.js → empty-state-Df2e2-7k.js} +1 -1
  125. package/dist/client/assets/{experiments-tab-choice-Dh8ppYAz.js → experiments-tab-choice-DbCV3Tta.js} +1 -1
  126. package/dist/client/assets/{extract-connection-data-C5kjoBvz.js → extract-connection-data-Bw93eWWI.js} +1 -1
  127. package/dist/client/assets/{feature-gate-C23cezIt.js → feature-gate-CWwTIDAD.js} +1 -1
  128. package/dist/client/assets/{feature-paywall-DjcqAfOJ.js → feature-paywall-CAaY2lMU.js} +1 -1
  129. package/dist/client/assets/{feedback-drIplfYL.js → feedback-ByVb71jj.js} +1 -1
  130. package/dist/client/assets/{file-explorer-DBLkEKms.js → file-explorer-zWsChJTW.js} +1 -1
  131. package/dist/client/assets/{file-preview-CVMBd1Aq.js → file-preview-B5EKno-W.js} +1 -1
  132. package/dist/client/assets/{file-share-button-vL9eIvKg.js → file-share-button-C7-QuaCd.js} +1 -1
  133. package/dist/client/assets/{file-type-icon-CCFDVXm1.js → file-type-icon-BsiKabia.js} +1 -1
  134. package/dist/client/assets/{folder-icon-CppdX2mp.js → folder-icon-DkUbY_Ow.js} +1 -1
  135. package/dist/client/assets/{form-C4sadtDB.js → form-C_M4QV9P.js} +1 -1
  136. package/dist/client/assets/{general-BuV3Nce0.js → general-BjfnjzGy.js} +1 -1
  137. package/dist/client/assets/{github-icon-BEtyiUak.js → github-icon-BZYLnrQK.js} +1 -1
  138. package/dist/client/assets/{home-D03v7B7M.js → home-DQQdj4Ea.js} +1 -1
  139. package/dist/client/assets/{home-overview-B5N2uzQG.js → home-overview-CvCaFo1b.js} +1 -1
  140. package/dist/client/assets/{hosted-reconcile-CTo69L2B.js → hosted-reconcile-DVCi8vCY.js} +1 -1
  141. package/dist/client/assets/{icon-button-D7BqTj7e.js → icon-button-FgAeY2VI.js} +1 -1
  142. package/dist/client/assets/{index-DL44u3pr.js → index--p_IIMqb.js} +1 -1
  143. package/dist/client/assets/{index-B6dL3l3v.js → index-4rp3iqoc.js} +1 -1
  144. package/dist/client/assets/{index-DkFHTWdU.js → index-BVwTm9yy.js} +1 -1
  145. package/dist/client/assets/{index-DRJopDNa.js → index-BqJ-zbRp.js} +1 -1
  146. package/dist/client/assets/{index-B9QAGcIi.js → index-C0YexCRj.js} +3 -3
  147. package/dist/client/assets/{index-BreUqgwa.js → index-CA5MpDJ2.js} +1 -1
  148. package/dist/client/assets/{index-DZP2U0sA.js → index-CAMi4lK6.js} +1 -1
  149. package/dist/client/assets/{index-HhJUJvXL.js → index-CZvihk7A.js} +1 -1
  150. package/dist/client/assets/{index-WPlNd6HG.js → index-CdLJWnRN.js} +1 -1
  151. package/dist/client/assets/{index-SfqoOQYU.js → index-D-aBBLRs.js} +1 -1
  152. package/dist/client/assets/{index-D1l3fAOF.js → index-DB7GDsnk.js} +1 -1
  153. package/dist/client/assets/{index-D16zKa27.js → index-Deyc3saa.js} +1 -1
  154. package/dist/client/assets/{index-Bcs1Jn6T.js → index-Do6PllqG.js} +1 -1
  155. package/dist/client/assets/{index-CdkyKdQE.js → index-DqGr7Hc1.js} +1 -1
  156. package/dist/client/assets/{index-BnjrBR8E.js → index-hzDwssoq.js} +1 -1
  157. package/dist/client/assets/{index-redirect-PIpqWCO6.js → index-redirect-Bu_aNRdm.js} +1 -1
  158. package/dist/client/assets/{index-Bg3B7UHn.js → index-vlmYuijH.js} +1 -1
  159. package/dist/client/assets/{infiniteQueryObserver-C-hgR5Ng.js → infiniteQueryObserver-BMqABh4H.js} +1 -1
  160. package/dist/client/assets/{infra-billing-zV8SMnqa.js → infra-billing-TR3zcfyD.js} +1 -1
  161. package/dist/client/assets/{input-E3sOauPj.js → input--UVdiTAB.js} +3 -3
  162. package/dist/client/assets/{input-DAJXuUGX.js → input-Br1caJ_d.js} +1 -1
  163. package/dist/client/assets/{integration-icon-gO2PpMmm.js → integration-icon-D6ksbVbr.js} +1 -1
  164. package/dist/client/assets/{jira-icon-Bly7_EHi.js → jira-icon-Dw9qRy7z.js} +1 -1
  165. package/dist/client/assets/{label-vS6r_XGb.js → label-CnHmgvIU.js} +1 -1
  166. package/dist/client/assets/{layout-ClXd0E_v.js → layout-DNHVxHcF.js} +1 -1
  167. package/dist/client/assets/{legacy-agents-deep-D_m5HUln.js → legacy-agents-deep-phbsWihE.js} +1 -1
  168. package/dist/client/assets/{legacy-main-redirect-Bhp1P1b4.js → legacy-main-redirect-COYA2M-b.js} +1 -1
  169. package/dist/client/assets/library-PQWanCvO.js +1 -0
  170. package/dist/client/assets/{library-tab-BL-Getqj.js → library-tab-Dizgrk4k.js} +1 -1
  171. package/dist/client/assets/{login-f4lgwVY7.js → login-C_kb8goZ.js} +1 -1
  172. package/dist/client/assets/{markdown-DpeGUbAj.js → markdown-CN4Sgkcu.js} +1 -1
  173. package/dist/client/assets/{mcp-app-renderer-DjD3bMOq.js → mcp-app-renderer-B7qZoNog.js} +1 -1
  174. package/dist/client/assets/{mcp-oauth-Dtv3HdvF.js → mcp-oauth-BTwGti_Q.js} +1 -1
  175. package/dist/client/assets/{mcp-oauth-Cy5aE8WI.js → mcp-oauth-tf6SdsCd.js} +1 -1
  176. package/dist/client/assets/{members-Cl92bXBM.js → members-kEy-UuPd.js} +1 -1
  177. package/dist/client/assets/{memory-BL_joWCg.js → memory-K-xVpveK.js} +1 -1
  178. package/dist/client/assets/{mock-board-B7XWzCAY.js → mock-board-CYPKmuLz.js} +3 -3
  179. package/dist/client/assets/{monaco-editor-CMN1nj-z.js → monaco-editor-DRELyy_D.js} +1 -1
  180. package/dist/client/assets/{monitoring-CivJic7t.js → monitoring-QNe1nTpU.js} +1 -1
  181. package/dist/client/assets/{monitoring-stats-row-CFPCZIJ6.js → monitoring-stats-row-BJ3mVu8v.js} +1 -1
  182. package/dist/client/assets/{multi-select-CRqAQYHR.js → multi-select-ZlDR0NXs.js} +1 -1
  183. package/dist/client/assets/{mustache-BVc9oNvd.js → mustache-CMDiec2Z.js} +1 -1
  184. package/dist/client/assets/{named-rule-view-BxYaeyPw.js → named-rule-view-vbAzCqnU.js} +1 -1
  185. package/dist/client/assets/{new-project-dialog-D5pTs5sE.js → new-project-dialog-C0bl_2Ba.js} +1 -1
  186. package/dist/client/assets/{oauth-callback-ai-provider-BfIz-ivq.js → oauth-callback-ai-provider-C5tN-P7D.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-BS9cs2pQ.js → oauth-callback-seyUpLHE.js} +1 -1
  188. package/dist/client/assets/{oauth-consent-BP08bdO4.js → oauth-consent-Csxt2TlH.js} +1 -1
  189. package/dist/client/assets/{onboarding-Bl5ZkXNE.js → onboarding-CLe1nQhR.js} +1 -1
  190. package/dist/client/assets/{openai-conversation-DoQkXI6l.js → openai-conversation-BrNIC0gU.js} +1 -1
  191. package/dist/client/assets/{optimistic-project-sidebar-views-tS3PmAgd.js → optimistic-project-sidebar-views-CxAVgylL.js} +1 -1
  192. package/dist/client/assets/{order-monitor-day-Bv5hfoVb.js → order-monitor-day-pxrX3JmM.js} +1 -1
  193. package/dist/client/assets/{organization-choice-amaY9pb3.js → organization-choice-BpSAzd2p.js} +1 -1
  194. package/dist/client/assets/{orgs-CJA8kvjG.js → orgs-p1XKp1ZG.js} +1 -1
  195. package/dist/client/assets/{own-accounts-section-BLd-7Js0.js → own-accounts-section-CbvkYG1v.js} +1 -1
  196. package/dist/client/assets/{pair-DHqTslhV.js → pair-D-1ihySL.js} +1 -1
  197. package/dist/client/assets/{parse-sections-BVMpX2K7.js → parse-sections-DAzG_Y-i.js} +3 -3
  198. package/dist/client/assets/{plan-hbgIq9zB.js → plan-Ct48TCKI.js} +1 -1
  199. package/dist/client/assets/{plan-ladder-B5cE0jWA.js → plan-ladder-EgyMICws.js} +1 -1
  200. package/dist/client/assets/{plan-usage-card-Dj0pO4XV.js → plan-usage-card-55U4oLof.js} +1 -1
  201. package/dist/client/assets/{popover-C-jO615q.js → popover-ChvCIlNB.js} +1 -1
  202. package/dist/client/assets/{post-calendar-CIL9XfgC.js → post-calendar-B-eIxloA.js} +1 -1
  203. package/dist/client/assets/{post-editor-BMQwNp8x.js → post-editor-DCSvvVMs.js} +1 -1
  204. package/dist/client/assets/{preview-content-BukNzknx.js → preview-content-DV3ORZ_c.js} +1 -1
  205. package/dist/client/assets/{preview-dialog-D5U4zv2O.js → preview-dialog-BREniLg2.js} +1 -1
  206. package/dist/client/assets/{preview-panel-BL_lgpiC.js → preview-panel-UEmA70eG.js} +1 -1
  207. package/dist/client/assets/{preview-tab-DcqwQItc.js → preview-tab-BrupxuLJ.js} +3 -3
  208. package/dist/client/assets/{product-picker-dialog-B92R7jys.js → product-picker-dialog-C9QNyiBq.js} +1 -1
  209. package/dist/client/assets/{profile-LNbZJ_ux.js → profile-DCr1-Qvc.js} +1 -1
  210. package/dist/client/assets/{project-app-view-R18k-SGv.js → project-app-view-rhGgr5Sc.js} +1 -1
  211. package/dist/client/assets/{project-apps-DysK_I9D.js → project-apps-DgmZ54eE.js} +1 -1
  212. package/dist/client/assets/{project-icon-BwRso9pR.js → project-icon-CmV5zxWN.js} +1 -1
  213. package/dist/client/assets/{project-index-9_5MRu0H.js → project-index-ComZIF5j.js} +1 -1
  214. package/dist/client/assets/project-reports-CVQtK-Va.js +1 -0
  215. package/dist/client/assets/{project-sidebar-views-DqUhr5Jd.js → project-sidebar-views-CDN0Y7nM.js} +1 -1
  216. package/dist/client/assets/project-tasks-CtZ4MN1R.js +1 -0
  217. package/dist/client/assets/{projects-Cm09eTvv.js → projects-BH7yFrNo.js} +1 -1
  218. package/dist/client/assets/{projects-empty-state-DcAgqv_c.js → projects-empty-state-D7JOaHzT.js} +1 -1
  219. package/dist/client/assets/{prompts-BCijiEsh.js → prompts-BE2oz-mN.js} +1 -1
  220. package/dist/client/assets/record-editor-SI7Q-pVr.js +1 -0
  221. package/dist/client/assets/{redirect-editor-CSzQk1jy.js → redirect-editor-BbsrbYSo.js} +1 -1
  222. package/dist/client/assets/reports-C-TsCVxa.js +1 -0
  223. package/dist/client/assets/{reports-DXAJ0INx.js → reports-CqsqZ5NG.js} +1 -1
  224. package/dist/client/assets/{reports-onboarding-FFEfe47C.js → reports-onboarding-DN1rE25Z.js} +1 -1
  225. package/dist/client/assets/{reports-tab-D34JJuD5.js → reports-tab-BkEWE3Wb.js} +2 -2
  226. package/dist/client/assets/repositories-CE7fOdIh.js +1 -0
  227. package/dist/client/assets/{repositories-CX1gcCIy.js → repositories-D5p56rp8.js} +1 -1
  228. package/dist/client/assets/{repository-binding-DQBwqIdh.js → repository-binding-zAuhrRNl.js} +1 -1
  229. package/dist/client/assets/{repository-picker-D28IiEA1.js → repository-picker-C8xivTfl.js} +1 -1
  230. package/dist/client/assets/{require-capability-lC-cq-4i.js → require-capability-DcSbNfND.js} +1 -1
  231. package/dist/client/assets/{required-auth-layout-B1n-jO0G.js → required-auth-layout-CQCCkUAY.js} +1 -1
  232. package/dist/client/assets/{reset-password-BRead2qa.js → reset-password-qF03il-Y.js} +1 -1
  233. package/dist/client/assets/{resizable-CgUywIR3.js → resizable-BbH6Rq9j.js} +1 -1
  234. package/dist/client/assets/{resolve-tab-icon-3yBFBtck.js → resolve-tab-icon-DT-C34an.js} +1 -1
  235. package/dist/client/assets/{review-settings-bxD9xR2o.js → review-settings-zQhgda-0.js} +1 -1
  236. package/dist/client/assets/{role-color-hEm79GE-.js → role-color-Ce0vE_lJ.js} +1 -1
  237. package/dist/client/assets/{roles-Cyf3_30G.js → roles-CS8RSWSS.js} +1 -1
  238. package/dist/client/assets/route-BCTRYX9A.js +1 -0
  239. package/dist/client/assets/{route-Vc2fvKzt.js → route-Ci6YieJ3.js} +1 -1
  240. package/dist/client/assets/{route-Dr8TlTpE.js → route-CmtRblLz.js} +1 -1
  241. package/dist/client/assets/{sandbox-lifecycle-context-C-cikADe.js → sandbox-lifecycle-context-NUpZmc9C.js} +1 -1
  242. package/dist/client/assets/{schema-xK_YLRyW.js → schema-CbQkhAdU.js} +1 -1
  243. package/dist/client/assets/{schema-BmoGjDOl.js → schema-DfRf1jxZ.js} +1 -1
  244. package/dist/client/assets/{scroll-area-_tOH3ur-.js → scroll-area-C8lIzaxm.js} +1 -1
  245. package/dist/client/assets/{search-input-_nT4LD9W.js → search-input-D2E1z19V.js} +1 -1
  246. package/dist/client/assets/{search-toggle-Bt0RBV_T.js → search-toggle-CZItDB1R.js} +1 -1
  247. package/dist/client/assets/{secret-picker-BEMjze77.js → secret-picker-DGsGo-lH.js} +1 -1
  248. package/dist/client/assets/{secrets-C4pvpPFF.js → secrets-Dac8hncd.js} +1 -1
  249. package/dist/client/assets/{section-array-field-BhmZf33V.js → section-array-field-3fy_eFLn.js} +1 -1
  250. package/dist/client/assets/{sections-oyFdwcdt.js → sections-BSqM_8t2.js} +1 -1
  251. package/dist/client/assets/{sections-editor-BahV49vR.js → sections-editor-UNPiBRIi.js} +1 -1
  252. package/dist/client/assets/{select-Ck5SAjc0.js → select-C67xaSM-.js} +1 -1
  253. package/dist/client/assets/{select-model-TlM3kGOM.js → select-model-B7BkbJ8q.js} +1 -1
  254. package/dist/client/assets/{seo-editor-DbYSgwgg.js → seo-editor-D6BbHFAR.js} +1 -1
  255. package/dist/client/assets/{separator-nr4yw_w3.js → separator-BJXdAG6q.js} +1 -1
  256. package/dist/client/assets/settings-tab-BKHHd0_C.js +1 -0
  257. package/dist/client/assets/{sheet-Ck3eYK8j.js → sheet-D1FdDYgh.js} +1 -1
  258. package/dist/client/assets/{shell-layout-0PvdYI4e.js → shell-layout-q9TPgR4S.js} +1 -1
  259. package/dist/client/assets/{site-draft-actions-D8RlcpAy.js → site-draft-actions-DEdhulne.js} +1 -1
  260. package/dist/client/assets/{site-draft-view--bKEMpRl.js → site-draft-view-Du5u3dh2.js} +1 -1
  261. package/dist/client/assets/site-editor-BSjvpXJX.js +1 -0
  262. package/dist/client/assets/{site-editor-toast-1xU8PLbH.js → site-editor-toast-BQb3pwds.js} +1 -1
  263. package/dist/client/assets/{skills-rfB5-VI0.js → skills-BO__rEmW.js} +1 -1
  264. package/dist/client/assets/{slider-8IGhnWwI.js → slider-COwHhiq0.js} +1 -1
  265. package/dist/client/assets/{sortable.esm-C3omzTs2.js → sortable.esm-BoEIu5W0.js} +1 -1
  266. package/dist/client/assets/{sso-CvsmzOVo.js → sso-DzouQIR7.js} +1 -1
  267. package/dist/client/assets/{suggestion-BnWZuYZ4.js → suggestion-0IJfbUde.js} +1 -1
  268. package/dist/client/assets/{switch-CrMzty1r.js → switch-By9JubUf.js} +1 -1
  269. package/dist/client/assets/{synced-repos-EvtkBI_e.js → synced-repos-D6Z7ziCu.js} +1 -1
  270. package/dist/client/assets/{tab-icon-glyph-BZwIIvKt.js → tab-icon-glyph-BIJxIcux.js} +1 -1
  271. package/dist/client/assets/{table-B-PaUoV-.js → table-BiZFGesF.js} +1 -1
  272. package/dist/client/assets/{tabs-DsvRYtth.js → tabs-Bb2xgzcm.js} +1 -1
  273. package/dist/client/assets/{task-board-DUjYvB64.js → task-board-4SvjUpMb.js} +1 -1
  274. package/dist/client/assets/{task-route-BMEJVpqc.js → task-route-DVEP01nU.js} +1 -1
  275. package/dist/client/assets/{task-status-DUJ4klbA.js → task-status-DcO-XRPI.js} +1 -1
  276. package/dist/client/assets/{taskboard-analytics-C4m8rGz-.js → taskboard-analytics-BSun1TbW.js} +1 -1
  277. package/dist/client/assets/{tasks-CNMR5vbO.js → tasks--l87WFyL.js} +1 -1
  278. package/dist/client/assets/tasks-CXuVo5e-.js +1 -0
  279. package/dist/client/assets/{textarea-B-d79s_Z.js → textarea-Duz08Iqx.js} +1 -1
  280. package/dist/client/assets/{thread-analytics-DbW-orFR.js → thread-analytics-oUI0Ldjh.js} +1 -1
  281. package/dist/client/assets/{thread-intent-nPaIrh5T.js → thread-intent-BGQF0i18.js} +1 -1
  282. package/dist/client/assets/{thread-route-C-fZMEzK.js → thread-route-Cjav7kKF.js} +1 -1
  283. package/dist/client/assets/{thread-route-D6FVJ5Pt.js → thread-route-D3Npgdwy.js} +1 -1
  284. package/dist/client/assets/{thread-sheet-body-4kfwGVLF.js → thread-sheet-body--mz7LDhh.js} +1 -1
  285. package/dist/client/assets/{time-range-picker-D3lhDkd6.js → time-range-picker-Dcl7u7UC.js} +1 -1
  286. package/dist/client/assets/{toggle-group-DDLjSUGx.js → toggle-group-CCnoRxJ5.js} +1 -1
  287. package/dist/client/assets/{tool-namespace-C_xQ9mqM.js → tool-namespace-0JnTVTOi.js} +1 -1
  288. package/dist/client/assets/{tool-set-selector-DEXMYXsv.js → tool-set-selector-Cs7GdO0i.js} +1 -1
  289. package/dist/client/assets/{toolbar-icon-button-CWL_p98D.js → toolbar-icon-button-CpfF_t2h.js} +1 -1
  290. package/dist/client/assets/{tooltip-oILxW0vz.js → tooltip-B4vnoW3c.js} +1 -1
  291. package/dist/client/assets/{tooltipContext-C_nJIpn-.js → tooltipContext-Di8C4u-8.js} +1 -1
  292. package/dist/client/assets/{track-BWVeZkDF.js → track-Byem6YG_.js} +1 -1
  293. package/dist/client/assets/{types-CsgacF3E.js → types-Cvkdtetr.js} +1 -1
  294. package/dist/client/assets/{url-slug-FKQbDq1Y.js → url-slug-T5nyiyN7.js} +1 -1
  295. package/dist/client/assets/{usage-stats-ckY7bir_.js → usage-stats-D9-LtkOq.js} +1 -1
  296. package/dist/client/assets/{use-ai-providers-Bt6-bPMi.js → use-ai-providers-DKBQ22lC.js} +1 -1
  297. package/dist/client/assets/{use-apply-named-rule-CB2USRZm.js → use-apply-named-rule-hAr6r48R.js} +1 -1
  298. package/dist/client/assets/use-ask-in-chat-CMwCc1F-.js +1 -0
  299. package/dist/client/assets/{use-automations-DqqmzjNf.js → use-automations-pTfMxWF2.js} +1 -1
  300. package/dist/client/assets/{use-autosave-Ci8EUR3c.js → use-autosave-CwoAt-Cr.js} +1 -1
  301. package/dist/client/assets/use-blocks-v8-project-FZUFv9Vq.js +1 -0
  302. package/dist/client/assets/{use-chat-layout-state-DEw-Z4XH.js → use-chat-layout-state-DMTZvG3v.js} +1 -1
  303. package/dist/client/assets/{use-cms-publish-actions-B6_zhSLP.js → use-cms-publish-actions-C7a0pDGH.js} +1 -1
  304. package/dist/client/assets/{use-connect-companion-CJ1V6Cc9.js → use-connect-companion-Bw9DztfC.js} +1 -1
  305. package/dist/client/assets/{use-connection-MZkJifu9.js → use-connection-Cd0tT7Hz.js} +1 -1
  306. package/dist/client/assets/{use-content-sync-xsHAgdwR.js → use-content-sync-B7G_IDZR.js} +1 -1
  307. package/dist/client/assets/{use-copy-CmgIzYEc.js → use-copy-L2uJJmEn.js} +1 -1
  308. package/dist/client/assets/{use-date-fns-locale-CiK-kZT2.js → use-date-fns-locale-BWR3I0yD.js} +1 -1
  309. package/dist/client/assets/{use-debounced-autosave-k0uhxHTu.js → use-debounced-autosave-D6uv4Ht0.js} +1 -1
  310. package/dist/client/assets/{use-debounced-value-4HPN6F1v.js → use-debounced-value-yze9Agx0.js} +1 -1
  311. package/dist/client/assets/{use-deco-credits-B4lu3fXJ.js → use-deco-credits-CpL6RZMd.js} +1 -1
  312. package/dist/client/assets/{use-decopilot-events-CSMeMZFB.js → use-decopilot-events-Emf31ERY.js} +1 -1
  313. package/dist/client/assets/{use-delete-connection-CV7YpSZq.js → use-delete-connection-BOGW-gWO.js} +1 -1
  314. package/dist/client/assets/{use-deployment-admin-DrbwQcfz.js → use-deployment-admin-C05Wl5hm.js} +1 -1
  315. package/dist/client/assets/{use-entitlements-CwMPeVRh.js → use-entitlements-DyCdoeJS.js} +1 -1
  316. package/dist/client/assets/{use-fast-preview-draft-url-HR2Mguzw.js → use-fast-preview-draft-url-CUn670We.js} +1 -1
  317. package/dist/client/assets/{use-file-configs-CtHitp6a.js → use-file-configs-C2_msq8y.js} +1 -1
  318. package/dist/client/assets/{use-id-selection-5eeHtHC2.js → use-id-selection-DAVcESqY.js} +1 -1
  319. package/dist/client/assets/{use-inbox-feed-e0rtwoRI.js → use-inbox-feed-CDj71yb0.js} +1 -1
  320. package/dist/client/assets/{use-infinite-scroll-JJ1sRtN8.js → use-infinite-scroll-D1VEiyLA.js} +1 -1
  321. package/dist/client/assets/{use-join-requests-D4Y8yFTh.js → use-join-requests-Cn6BUpqb.js} +1 -1
  322. package/dist/client/assets/{use-main-panel-tabs-CSsS4ygl.js → use-main-panel-tabs-C43j023G.js} +1 -1
  323. package/dist/client/assets/{use-mcp-auth-status-CLh3EI2o.js → use-mcp-auth-status-B0TiKwJF.js} +1 -1
  324. package/dist/client/assets/{use-mcp-client-DMMY7p2F.js → use-mcp-client-DBEWWTcM.js} +1 -1
  325. package/dist/client/assets/{use-mcp-prompts-Cnaz613K.js → use-mcp-prompts-CQ9PPuTj.js} +1 -1
  326. package/dist/client/assets/{use-mcp-tools-DUwKta2N.js → use-mcp-tools-BCKxSU46.js} +1 -1
  327. package/dist/client/assets/{use-mobile-CxVTRfmL.js → use-mobile-CRjTpdEZ.js} +1 -1
  328. package/dist/client/assets/{use-move-blocks-DodzNqQA.js → use-move-blocks-Dn5Uj2rh.js} +1 -1
  329. package/dist/client/assets/{use-navigate-to-agent-brFKQesH.js → use-navigate-to-agent-B9-xP8hn.js} +1 -1
  330. package/dist/client/assets/{use-org-fs-CCuveubU.js → use-org-fs-CAEafaQy.js} +1 -1
  331. package/dist/client/assets/{use-org-repo-syncs-BCYcL58l.js → use-org-repo-syncs-D7vGRv_1.js} +1 -1
  332. package/dist/client/assets/{use-org-sso-B4FQ0C98.js → use-org-sso-DcHAsgmH.js} +1 -1
  333. package/dist/client/assets/{use-organization-settings-DH5kZG2b.js → use-organization-settings-Df-csuDo.js} +1 -1
  334. package/dist/client/assets/{use-project-scope-uO0SKwDI.js → use-project-scope-DwEcCTYT.js} +1 -1
  335. package/dist/client/assets/{use-recent-apps-BJNw5gWP.js → use-recent-apps-Bewb5o_E.js} +1 -1
  336. package/dist/client/assets/{use-reports-diagnostic-kYFSO4R9.js → use-reports-diagnostic-B92d9OS0.js} +1 -1
  337. package/dist/client/assets/{use-sandbox-events-AvaA9vQX.js → use-sandbox-events-BxZfdvM3.js} +1 -1
  338. package/dist/client/assets/{use-secrets-DCu-T9As.js → use-secrets-4gWR8BJM.js} +1 -1
  339. package/dist/client/assets/{use-section-preview-base-BLb3OKQi.js → use-section-preview-base-nthVDFUD.js} +1 -1
  340. package/dist/client/assets/{use-sidebar-collapsed-dPXmQ4W-.js → use-sidebar-collapsed-B_25RrQb.js} +1 -1
  341. package/dist/client/assets/{use-tags-C11lA6hi.js → use-tags-BPdkrSTc.js} +1 -1
  342. package/dist/client/assets/{use-task-board-analytics-CY_2ndKg.js → use-task-board-analytics-DWzCS1h7.js} +1 -1
  343. package/dist/client/assets/{use-task-board-events-DpeC1l86.js → use-task-board-events-C0AmYx3j.js} +1 -1
  344. package/dist/client/assets/{use-task-board-item-prs-DDZyRhcP.js → use-task-board-item-prs-BwjTfRBq.js} +1 -1
  345. package/dist/client/assets/{use-task-board-items-tAyw3uLv.js → use-task-board-items-Bueh6O2r.js} +1 -1
  346. package/dist/client/assets/{use-task-board-prompts-O9x7Uh9U.js → use-task-board-prompts-BeKRCQFj.js} +1 -1
  347. package/dist/client/assets/{use-task-metadata-C23PzQfJ.js → use-task-metadata-CpevmR5K.js} +1 -1
  348. package/dist/client/assets/{use-thread-outputs-DiaGC7Y7.js → use-thread-outputs-D4glxnBY.js} +1 -1
  349. package/dist/client/assets/{use-voice-input-BY0JjW9k.js → use-voice-input-CXfzcEw1.js} +1 -1
  350. package/dist/client/assets/useInfiniteQuery-Bq3XzHMD.js +1 -0
  351. package/dist/client/assets/{useQueries-CaG99_C7.js → useQueries-BZNL1IMW.js} +1 -1
  352. package/dist/client/assets/useSuspenseInfiniteQuery-B3WDnHYO.js +1 -0
  353. package/dist/client/assets/{users-ClNnYbzC.js → users-Cdd9D-dR.js} +1 -1
  354. package/dist/client/assets/{utils-BmmitFKg.js → utils-CtoE4BzT.js} +1 -1
  355. package/dist/client/assets/{variant-calendar-C5TS_GsH.js → variant-calendar-DMEwLCMH.js} +1 -1
  356. package/dist/client/assets/{variant-matcher-override-CJZktUQX.js → variant-matcher-override-BCR-xrVe.js} +1 -1
  357. package/dist/client/assets/{view-header-YmnNJKSa.js → view-header-KJ6rsezd.js} +1 -1
  358. package/dist/client/assets/{virtual-mcp-CLe7zCk-.js → virtual-mcp-wrwCllE9.js} +1 -1
  359. package/dist/client/assets/{watch-sse-pool-DXHpGpdE.js → watch-sse-pool-BNZW-YJq.js} +1 -1
  360. package/dist/client/index.html +1 -1
  361. package/dist/server/cli.js +63 -63
  362. package/dist/server/server.js +587 -587
  363. package/package.json +1 -1
  364. package/dist/client/assets/agent-app-FxZxWAqv.js +0 -1
  365. package/dist/client/assets/agent-deck-CUDUDwqI.js +0 -1
  366. package/dist/client/assets/agent-experiments-D-5JyF8e.js +0 -1
  367. package/dist/client/assets/agent-library-file-B5PZVECD.js +0 -1
  368. package/dist/client/assets/agent-library-vOMTA0EO.js +0 -1
  369. package/dist/client/assets/agent-overview-DvJE04ag.js +0 -1
  370. package/dist/client/assets/agent-settings-DZtfb5db.js +0 -1
  371. package/dist/client/assets/agent-site-editor-code-B_Y2MLg6.js +0 -2
  372. package/dist/client/assets/agent-site-editor-content-DQQE1ka2.js +0 -1
  373. package/dist/client/assets/agent-site-editor-preview-CDYg5AAV.js +0 -1
  374. package/dist/client/assets/agent-view-BE6ELT_z.js +0 -1
  375. package/dist/client/assets/api-keys-BjAlc6Pz.js +0 -1
  376. package/dist/client/assets/library-Db4s-ko5.js +0 -1
  377. package/dist/client/assets/project-reports-DpEsKYcB.js +0 -1
  378. package/dist/client/assets/project-tasks-CaCrY53V.js +0 -1
  379. package/dist/client/assets/record-editor-CPuAtXe_.js +0 -1
  380. package/dist/client/assets/reports-DDzW56I0.js +0 -1
  381. package/dist/client/assets/repositories-BF8FKyyH.js +0 -1
  382. package/dist/client/assets/route-B0ZIQ0Ma.js +0 -1
  383. package/dist/client/assets/settings-tab-C574GkDL.js +0 -1
  384. package/dist/client/assets/site-editor-DliU2BL4.js +0 -1
  385. package/dist/client/assets/tasks-ClrYvNJS.js +0 -1
  386. package/dist/client/assets/use-ask-in-chat-Lm_VhfAp.js +0 -1
  387. package/dist/client/assets/use-blocks-v8-project-CEe6lCIY.js +0 -1
  388. package/dist/client/assets/useInfiniteQuery-BmW6K-t7.js +0 -1
  389. package/dist/client/assets/useSuspenseInfiniteQuery-CxbSfeDW.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-BahV49vR.js","assets/index-B9QAGcIi.js","assets/index-SmuiYnIl.css","assets/chat-context-DrlDLCTg.js","assets/autosend-Ct94XjGX.js","assets/thread-route-D6FVJ5Pt.js","assets/use-project-scope-uO0SKwDI.js","assets/repository-binding-DQBwqIdh.js","assets/use-mcp-client-DMMY7p2F.js","assets/auth-DKMucRNN.js","assets/thread-intent-nPaIrh5T.js","assets/delay-CnY5UFtP.js","assets/watch-sse-pool-DXHpGpdE.js","assets/task-board-DUjYvB64.js","assets/schema-BmoGjDOl.js","assets/use-entitlements-CwMPeVRh.js","assets/use-ai-providers-Bt6-bPMi.js","assets/use-decopilot-events-CSMeMZFB.js","assets/use-organization-settings-DH5kZG2b.js","assets/parse-sections-BVMpX2K7.js","assets/utils-BmmitFKg.js","assets/agent-icon-j6t5huQo.js","assets/AlertCircle-BUZy3sYx.js","assets/Tool01-PTUwz10y.js","assets/ArrowUp-DWQcbDQV.js","assets/ArrowLeft-DDsFHkTp.js","assets/LinkBroken01-BH9f0tfg.js","assets/ShoppingBag01-DZhdG6kl.js","assets/Globe04-B5etP6wn.js","assets/CheckCircle-DIJUPKEz.js","assets/ChevronUp-DKpA0SQs.js","assets/ChevronSelectorVertical-CTH779Lx.js","assets/UserSquare-CBsLM8SI.js","assets/CreditCard01-Br5lPOuR.js","assets/SwitchHorizontal01-COrh-gwe.js","assets/Key01-DK9zv-Op.js","assets/Minus-ccD5p3q-.js","assets/Monitor01-Dzr2ls8R.js","assets/Sun-BCBzha1f.js","assets/Play-Btzw93Bx.js","assets/Plus-CgQrQuUH.js","assets/SearchMd-CxCEqQoC.js","assets/Trash01-CSeiUIoJ.js","assets/Upload01-XfsfpdVT.js","assets/Users01-BprztEKc.js","assets/XClose-DdH4UADI.js","assets/Zap-OzyQY3vd.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/pair-DHqTslhV.js","assets/collapsible-p2X_LZ_q.js","assets/use-copy-CmgIzYEc.js","assets/usage-stats-ckY7bir_.js","assets/tool-namespace-C_xQ9mqM.js","assets/form-C4sadtDB.js","assets/label-vS6r_XGb.js","assets/utils-CVEq3hMx.js","assets/markdown-DpeGUbAj.js","assets/use-mobile-CxVTRfmL.js","assets/tooltip-oILxW0vz.js","assets/index-WPlNd6HG.js","assets/shell-layout-0PvdYI4e.js","assets/use-deployment-admin-DrbwQcfz.js","assets/admin-fetch-BhTJlAsX.js","assets/command-D9i8Wmtq.js","assets/index-Bcs1Jn6T.js","assets/integration-icon-gO2PpMmm.js","assets/project-icon-BwRso9pR.js","assets/use-navigate-to-agent-brFKQesH.js","assets/new-project-dialog-D5pTs5sE.js","assets/repository-picker-D28IiEA1.js","assets/github-icon-BEtyiUak.js","assets/useInfiniteQuery-BmW6K-t7.js","assets/infiniteQueryObserver-C-hgR5Ng.js","assets/collection-search-Rq9aAmdK.js","assets/use-debounced-value-4HPN6F1v.js","assets/required-auth-layout-B1n-jO0G.js","assets/use-org-sso-B4FQ0C98.js","assets/shell-layout-CE2Eihra.css","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-DjD3bMOq.js","assets/types-CsgacF3E.js","assets/omit-server-managed-metadata-L5IhjRZB.js","assets/sheet-Ck3eYK8j.js","assets/use-connection-MZkJifu9.js","assets/use-mcp-prompts-Cnaz613K.js","assets/use-thread-outputs-DiaGC7Y7.js","assets/file-type-icon-CCFDVXm1.js","assets/section-array-field-BhmZf33V.js","assets/blocks-tab-states-DQ2uW3vb.js","assets/site-editor-toast-1xU8PLbH.js","assets/use-voice-input-BY0JjW9k.js","assets/popover-C-jO615q.js","assets/drawer-rcd6q2GW.js","assets/index-DkFHTWdU.js","assets/checkbox-C4q-ggo1.js","assets/select-Ck5SAjc0.js","assets/index-BdQq_4o_.js","assets/ai-providers-logos-DD3qZ33J.js","assets/openai-compatible-presets-BKGfVqEx.js","assets/use-blocks-v8-project-CEe6lCIY.js","assets/sandbox-url-D3mC8qhT.js","assets/use-sandbox-events-AvaA9vQX.js","assets/sandbox-git-api-DcqI6XE4.js","assets/empty-state-vqQ3KE7u.js","assets/hosted-reconcile-CTo69L2B.js","assets/slider-8IGhnWwI.js","assets/index-DRJopDNa.js","assets/tooltipContext-C_nJIpn-.js","assets/CategoricalChart-EDrHq-65.js","assets/index-CdkyKdQE.js","assets/switch-CrMzty1r.js","assets/textarea-B-d79s_Z.js","assets/scroll-area-_tOH3ur-.js","assets/monaco-editor-CMN1nj-z.js","assets/editor-DKXiN5wq.js","assets/calendar-DaAEMIpU.js","assets/editor-classes-CEDZ4HqC.js","assets/core.esm-B2YwU_IP.js","assets/sortable.esm-C3omzTs2.js","assets/toggle-group-DDLjSUGx.js","assets/active-indicator-CCMhAsc_.js","assets/combobox-B_k816xS.js","assets/search-input-_nT4LD9W.js","assets/tabs-DsvRYtth.js","assets/use-file-configs-CtHitp6a.js","assets/asset-utils-DurtmtJB.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/mustache-BVc9oNvd.js","assets/use-section-preview-base-BLb3OKQi.js","assets/seo-editor-DbYSgwgg.js","assets/use-apply-named-rule-CB2USRZm.js","assets/use-move-blocks-DodzNqQA.js","assets/variant-matcher-override-CJZktUQX.js"])))=>i.map(i=>d[i]);
2
- import{c as ue,j as r,r as j,m as Fe,b as Te,B as $e,a3 as ti,aF as cn,b4 as ct,aG as De,b5 as ni,b6 as si,b7 as ri,b8 as ai,v as Sr,D as Pr,K as Gn,w as jr,x as Er,e as ii,h as gt,I as Mn,y as oi,b9 as li,a5 as Jn,aZ as ci,b2 as di,i as Nr,ar as Un,at as In,a8 as Tr,P as zn,E as ui,t as dn,b3 as fi,q as pi}from"./index-B9QAGcIi.js";import{u as Cr,g as mi,c as qs,B as Rn,P as hi,r as gi,R as vi,a as xi,H as bi,b as Rr,S as wi,d as yi,l as ki,m as Si,p as Pi,e as ji,f as Ln,N as Ei}from"./parse-sections-BVMpX2K7.js";import{b as Ni,c as Mt,r as Lr,l as Ar,f as Ti,g as Ci,w as Ri}from"./chat-context-DrlDLCTg.js";import{t as Li}from"./ChevronUp-DKpA0SQs.js";import{P as Ai,Q as _i,J as _r,R as Oi,S as Di,b as Fi,T as $i,U as Or,V as Bi,W as Dr,X as Gs,Y as Mi}from"./agent-icon-j6t5huQo.js";import{a as Ui,n as Ii}from"./UserSquare-CBsLM8SI.js";import{s as Fr}from"./Plus-CgQrQuUH.js";import{a as $r,b as Br,P as Mr}from"./popover-C-jO615q.js";import{e as dt,b as ut,c as Ur,f as Ir,a as zr,C as Kr}from"./command-D9i8Wmtq.js";import{b as zi,c as Ki,u as Hi}from"./repository-binding-DQBwqIdh.js";import{a as Ut}from"./sandbox-lifecycle-context-C-cikADe.js";import{r as Vi}from"./thread-intent-nPaIrh5T.js";import{u as Hr}from"./use-voice-input-BY0JjW9k.js";import{d as Wi,f as qi,i as Gi,g as Ji,h as Yi,j as Qi,k as Xi,u as fn,l as Yn,m as Xe,n as Zi,o as Vr,q as eo,t as to,v as no,w as Wr,x as so,c as qr,b as Gr,y as ro,z as He,A as ao,B as io,C as oo,D as lo,E as co,F as uo,G as Js,H as fo,I as Ys,J as po,K as mo,L as Qs,M as Xs,N as Zs,O as er,P as tr,Q as An,R as ho,S as go,U as vo,V as xo,W as bo,e as wo}from"./site-editor-toast-1xU8PLbH.js";import{u as Jr}from"./use-mobile-CxVTRfmL.js";import{T as pt,a as mt,c as ht}from"./tooltip-oILxW0vz.js";import{T as Ze}from"./toolbar-icon-button-CWL_p98D.js";import{w as nn,i as yo}from"./variant-matcher-override-CJZktUQX.js";import{s as Bt,n as Qn,a as Yr,f as Ve,v as Qr,u as Xr,h as ko,i as So,B as Po,S as jo,C as Eo,b as No,e as To,c as Co,d as Ro,N as Lo,g as Ao,r as _o,j as Oo,k as nr,p as Do}from"./blocks-tab-states-DQ2uW3vb.js";import{u as Fo}from"./use-fast-preview-draft-url-HR2Mguzw.js";import{g as $o}from"./section-array-field-BhmZf33V.js";import{a as Bo,c as Zr}from"./shell-layout-0PvdYI4e.js";import{u as Xn,b as Mo}from"./use-sandbox-events-AvaA9vQX.js";import{u as Kn}from"./useQueries-CaG99_C7.js";import{i as Uo}from"./LinkBroken01-BH9f0tfg.js";import{u as ea}from"./blocks-preview-workspace-context-XqFh3zcs.js";import{MonacoCodeEditor as Io}from"./monaco-editor-CMN1nj-z.js";import{c as zo,u as Ko,i as Ho,l as Vo,D as Wo}from"./hosted-reconcile-CTo69L2B.js";import{d as qo}from"./utils-BmmitFKg.js";import{R as sr,a as sn,b as rr}from"./resizable-CgUywIR3.js";import{u as Go}from"./use-blocks-v8-project-CEe6lCIY.js";import{s as Jo,L as Yo,R as ta,D as ar,w as Hn}from"./device-hint-DScofASI.js";import{L as Qo}from"./label-vS6r_XGb.js";import{a as Xo,T as ir}from"./toggle-group-DDLjSUGx.js";import{b as Zo}from"./sandbox-url-D3mC8qhT.js";import{r as el,R as tl}from"./virtual-mcp-CLe7zCk-.js";import{d as nl}from"./delay-CnY5UFtP.js";import{s as na}from"./XClose-DdH4UADI.js";import{o as sl}from"./omit-server-managed-metadata-L5IhjRZB.js";import{a as _n,b as rl,w as al,n as or}from"./app-preview-url-9Od4s8Sz.js";import{a as il}from"./use-organization-settings-DH5kZG2b.js";import{a as On}from"./agent-capabilities-BFL3-oro.js";import{E as ol}from"./empty-state-vqQ3KE7u.js";import{G as lr}from"./github-icon-BEtyiUak.js";import{R as ll}from"./new-project-dialog-D5pTs5sE.js";import{r as cl}from"./preview-source-BsRLGWUP.js";import{A as dl,a as ul,b as fl}from"./alert-KmUmMQhB.js";import{u as pl}from"./use-task-metadata-C23PzQfJ.js";function ml(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(Ai,{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 c;e[2]!==n?(c=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]=c):c=e[3];let o;e[4]!==c?(o=r.jsxs("span",{className:"relative flex h-2 w-16 items-center sm:w-20",children:[l,c]}),e[4]=c,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(_i,{className:"size-5 sm:size-6"})}),e[6]=i):i=e[6];let d;return e[7]!==s||e[8]!==o?(d=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]=d):d=e[9],d}function hl(t){const e=ue.c(22),{index:n,numbered:s,step:a,heading:l}=t,c=j.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]!==c||e[5]!==a.title?(i=r.jsx(l,{id:c,className:"text-sm font-medium text-foreground",children:a.title}),e[3]=l,e[4]=c,e[5]=a.title,e[6]=i):i=e[6];let d;e[7]!==o||e[8]!==i?(d=r.jsxs("div",{className:"flex items-center gap-3",children:[o,i]}),e[7]=o,e[8]=i,e[9]=d):d=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 S;e[14]!==a.after||e[15]!==f||e[16]!==p?(S=r.jsxs("div",{className:f,children:[p,a.after]}),e[14]=a.after,e[15]=f,e[16]=p,e[17]=S):S=e[17];let v;return e[18]!==c||e[19]!==d||e[20]!==S?(v=r.jsxs("li",{"aria-labelledby":c,className:"surface flex flex-col gap-3 p-4 sm:p-5",children:[d,S]}),e[18]=c,e[19]=d,e[20]=S,e[21]=v):v=e[21],v}const gl=[];function un(t){const e=ue.c(20),{title:n,lead:s,waiting:a,alerts:l,steps:c,footer:o,headingLevel:i}=t,d=c===void 0?gl:c,m=i===void 0?1:i,f=m===1?"h1":"h2",p=a&&d.length===0?"status":void 0;let S;e[0]!==a?(S=r.jsx(ml,{waiting:a}),e[0]=a,e[1]=S):S=e[1];let v;e[2]!==f||e[3]!==n?(v=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]=v):v=e[4];let x;e[5]!==s?(x=s&&r.jsx("p",{className:"text-pretty text-sm text-muted-foreground",children:s}),e[5]=s,e[6]=x):x=e[6];let h;e[7]!==p||e[8]!==S||e[9]!==v||e[10]!==x?(h=r.jsxs("header",{role:p,className:"flex flex-col items-center gap-3 text-center",children:[S,v,x]}),e[7]=p,e[8]=S,e[9]=v,e[10]=x,e[11]=h):h=e[11];let b;e[12]!==m||e[13]!==d?(b=d.length>0&&r.jsx("ol",{className:"flex flex-col gap-3",children:d.map((y,g)=>r.jsx(hl,{index:g+1,numbered:d.length>1,step:y,heading:m===1?"h2":"h3"},y.title))}),e[12]=m,e[13]=d,e[14]=b):b=e[14];let T;return e[15]!==l||e[16]!==o||e[17]!==h||e[18]!==b?(T=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,b,o]})}),e[15]=l,e[16]=o,e[17]=h,e[18]=b,e[19]=T):T=e[19],T}function vl(t){const e=ue.c(43),{wait:n,hosts:s,invalidLink:a}=t,l=a===void 0?!1:a,c=Te();let o;e[0]!==l||e[1]!==c?(o=l&&r.jsx(dl,{variant:"warning",children:r.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[r.jsx(ul,{className:"line-clamp-none text-foreground",children:c("decoServe.link.invalidTitle")}),r.jsx(fl,{children:c("decoServe.link.invalidBody")})]})}),e[0]=l,e[1]=c,e[2]=o):o=e[2];const i=o;if(n.kind==="problem"){let g;e[3]!==c||e[4]!==n.host||e[5]!==n.problem?(g=Jo(c,n.problem,n.host),e[3]=c,e[4]=n.host,e[5]=n.problem,e[6]=g):g=e[6];const{title:N,body:E}=g;let k;e[7]!==E?(k=r.jsx(ta,{text:E}),e[7]=E,e[8]=k):k=e[8];let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(ar,{className:"border-t border-border pt-4",links:["troubleshooting","serve"]}),e[9]=P):P=e[9];let C;return e[10]!==i||e[11]!==k||e[12]!==N?(C=r.jsx(un,{headingLevel:2,waiting:!1,title:N,lead:k,alerts:i,footer:P}),e[10]=i,e[11]=k,e[12]=N,e[13]=C):C=e[13],C}const d=n.kind==="looking",m=d&&!n.paused;let f;e[14]!==c?(f=c("decoServe.waiting.title"),e[14]=c,e[15]=f):f=e[15];let p;e[16]!==c?(p=c("decoServe.waiting.lead"),e[16]=c,e[17]=p):p=e[17];let S;e[18]!==i||e[19]!==n.kind?(S=(i||n.kind==="denied")&&r.jsxs(r.Fragment,{children:[i,n.kind==="denied"&&r.jsx(Yo,{})]}),e[18]=i,e[19]=n.kind,e[20]=S):S=e[20];let v;e[21]!==c?(v=c("decoServe.waiting.connect.title"),e[21]=c,e[22]=v):v=e[22];let x;e[23]!==c?(x=c("decoServe.waiting.connect.body"),e[23]=c,e[24]=x):x=e[24];let h;e[25]!==s||e[26]!==d||e[27]!==c||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:c("decoServe.guide.start")}):d&&r.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:n.paused?c("decoServe.guide.paused"):c("decoServe.guide.looking",{hosts:s})}),e[25]=s,e[26]=d,e[27]=c,e[28]=n.kind,e[29]=n.onStart,e[30]=n.paused,e[31]=h):h=e[31];let b;e[32]!==v||e[33]!==x||e[34]!==h?(b=[{title:v,body:x,after:h}],e[32]=v,e[33]=x,e[34]=h,e[35]=b):b=e[35];let T;e[36]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(ar,{className:"border-t border-border pt-4",links:["siteEditor","serve","troubleshooting"]}),e[36]=T):T=e[36];let y;return e[37]!==b||e[38]!==m||e[39]!==f||e[40]!==p||e[41]!==S?(y=r.jsx(un,{headingLevel:2,waiting:m,title:f,lead:p,alerts:S,steps:b,footer:T}),e[37]=b,e[38]=m,e[39]=f,e[40]=p,e[41]=S,e[42]=y):y=e[42],y}function xl(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 bl=15e3,wl=3e3;function yl(t){const{candidates:e,probe:n,onFound:s,onChange:a,doc:l=document,setTimer:c=(g,N)=>setTimeout(g,N),clearTimer:o=g=>clearTimeout(g),timeoutMs:i=wl}=t;let d={status:"searching",firstRoundDone:!1,problem:null},m=!1,f=!1,p=0,S=null,v=null;const x=()=>l.visibilityState==="hidden",h=g=>{d={...d,...g},a(d)},b=async g=>{v=new AbortController;const N=v,E=c(()=>N.abort(),i);try{return await n(g,N.signal),!0}catch(k){if(m)return!1;const P=qi(k);return P.reason!=="not-answering"?h({problem:{...P,endpoint:g}}):d.problem?.endpoint===g&&h({problem:null}),!1}finally{o(E),v=null}},T=async()=>{if(S=null,!(m||f)){if(e.length===0){h({status:"stopped",firstRoundDone:!0});return}if(x()){h({status:"paused"});return}f=!0,d.status!=="searching"&&h({status:"searching"});for(const g of e){if(m)break;if(await b(g)){if(f=!1,m)return;m=!0,l.removeEventListener("visibilitychange",y),h({status:"found",firstRoundDone:!0}),s(g);return}}if(f=!1,!m){if(p+=1,d.firstRoundDone||h({firstRoundDone:!0}),x()){h({status:"paused"});return}S=c(()=>{T()},Wi(p,bl))}}};function y(){if(!m){if(x()){S!==null&&(o(S),S=null),f||h({status:"paused"});return}S!==null&&o(S),p=0,T()}}return l.addEventListener("visibilitychange",y),a(d),T(),()=>{m=!0,S!==null&&o(S),v?.abort(),l.removeEventListener("visibilitychange",y)}}function kl(t,e){return Ji(Yi({endpoint:t,fetch:n=>fetch(n,{signal:e})}))}const Sl=["loopback-network","local-network-access"];async function Pl(){if(Gi(window.location.origin))return null;for(const t of Sl)try{return await navigator.permissions.query({name:t})}catch{}return null}let sa=null,cr=!1;const Dn=new Set;function jl(t){if(Dn.add(t),!cr){cr=!0;const e=n=>{sa=n;for(const s of Dn)s()};Pl().then(n=>{if(!n)return e("unsupported");e(n.state),n.addEventListener("change",()=>e(n.state))})}return()=>Dn.delete(t)}const El={status:"stopped",firstRoundDone:!1,problem:null},Fn=new Map;function Nl(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:c=>(s.add(c),a??=yl({candidates:t.split(" "),probe:kl,onFound:o=>l.onFound(o),onChange:o=>{n=o;for(const i of s)i()}}),()=>{s.delete(c),!(s.size>0)&&(a?.(),a=null,Fn.delete(t))})};return Fn.set(t,l),l}function ra(){return j.useSyncExternalStore(jl,ur,ur)}const Tl=()=>()=>{},dr=()=>El,ur=()=>sa;function qu(t){const e=ue.c(9),{candidates:n,onFound:s}=t,[a,l]=j.useState(!1),c=ra(),i=(c==="granted"||c==="unsupported"||c==="prompt"&&a)&&n.length>0;let d;e[0]!==i||e[1]!==n||e[2]!==s?(d=i?Nl(n.join(" ")):null,d&&(d.onFound=s),e[0]=i,e[1]=n,e[2]=s,e[3]=d):d=e[3];const m=j.useSyncExternalStore(d?.subscribe??Tl,d?.getSnapshot??dr,d?.getSnapshot??dr),f=c==="prompt"&&!a;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>l(!0),e[4]=p):p=e[4];let S;return e[5]!==c||e[6]!==m||e[7]!==f?(S={state:m,access:c,needsGesture:f,start:p},e[5]=c,e[6]=m,e[7]=f,e[8]=S):S=e[8],S}const fr={mode:"none",iframeBase:null,showBlockingOverlay:!1,showWakingPill:!1};function Cl(t){const{previewState:e,progressStatus:n,fastPreviewActive:s=!1,fastPreviewReady:a=!1,codingSession:l=!1,hostedDraft:c=!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"?fr:c&&t.hostedPointerPending&&!a?{...fr,showDecidingLoader:!0}:s&&a&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:s&&c&&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 Rl=1e4,Ll=1e3,Al=3e4;function _l({iframeRef:t,src:e,active:n}){const s=j.useRef(0),a=j.useRef(null),l=j.useRef(null),c=j.useRef(e),o=j.useRef(n);c.current=e,o.current=n;const i=()=>{a.current&&clearTimeout(a.current),l.current&&clearTimeout(l.current),a.current=null,l.current=null},d=()=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m()},Rl)},m=()=>{if(!o.current||!c.current)return;l.current&&clearTimeout(l.current);const S=ti(Al,Ll,s.current,2,.5);s.current+=1,l.current=setTimeout(()=>{l.current=null;const v=t.current,x=c.current;!v||!x||!o.current||(v.src=x,d())},S)},f=()=>{s.current=0,i()},p=()=>{a.current&&(clearTimeout(a.current),a.current=null),m()};return j.useEffect(()=>{if(i(),s.current=0,!(!n||!e))return d(),i},[e,n]),{handleLoad:f,handleError:p}}const Ol=1500,Dl=500;function Fl({iframe:t,reload:e,waitMs:n=Ol,confirmMs:s=Dl}){let a;const l=()=>{clearTimeout(c),a=setTimeout(e,s)};t.addEventListener("load",l,{once:!0});const c=setTimeout(()=>{t.removeEventListener("load",l),e()},n);return()=>{clearTimeout(c),clearTimeout(a),t.removeEventListener("load",l)}}const $l=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()})}),Bl=`(function() {
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-UNPiBRIi.js","assets/index-C0YexCRj.js","assets/index-SmuiYnIl.css","assets/chat-context-C4aI-9Gh.js","assets/autosend-FOyswNSR.js","assets/thread-route-D3Npgdwy.js","assets/use-project-scope-DwEcCTYT.js","assets/repository-binding-zAuhrRNl.js","assets/use-mcp-client-DBEWWTcM.js","assets/auth-BZ5Ef56k.js","assets/thread-intent-BGQF0i18.js","assets/delay-CnY5UFtP.js","assets/watch-sse-pool-BNZW-YJq.js","assets/task-board-4SvjUpMb.js","assets/schema-DfRf1jxZ.js","assets/use-entitlements-DyCdoeJS.js","assets/use-ai-providers-DKBQ22lC.js","assets/use-decopilot-events-Emf31ERY.js","assets/use-organization-settings-Df-csuDo.js","assets/parse-sections-DAzG_Y-i.js","assets/utils-CtoE4BzT.js","assets/agent-icon-CTjv6Gf3.js","assets/AlertCircle-vm4sk-x9.js","assets/Tool01-BhHpHR3H.js","assets/ArrowUp-DD_r1Y_T.js","assets/ArrowLeft-DDdp1fkC.js","assets/LinkBroken01-BrWXpfvW.js","assets/ShoppingBag01-TG8T0GTy.js","assets/Globe04-CbE4fQfn.js","assets/CheckCircle-CO-Sp-gI.js","assets/ChevronUp-DzfCpOxS.js","assets/ChevronSelectorVertical-BsQHRlTg.js","assets/UserSquare-6Sdby0FR.js","assets/CreditCard01-Dg0W_VbM.js","assets/SwitchHorizontal01-CTmes_jp.js","assets/Key01-DnFTUPGs.js","assets/Minus-CGC-Ky2T.js","assets/Monitor01-DPIeBRgo.js","assets/Sun-CBOZY0wW.js","assets/Play-B9PgWZlg.js","assets/Plus-CZbPbPr7.js","assets/SearchMd-DseifSbW.js","assets/Trash01-HGp7pYgQ.js","assets/Upload01-B2W5ZMg1.js","assets/Users01-DQRKjdTI.js","assets/XClose-DeFo1VOD.js","assets/Zap-DalPfKev.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/pair-D-1ihySL.js","assets/collapsible-BgpbICto.js","assets/use-copy-L2uJJmEn.js","assets/usage-stats-D9-LtkOq.js","assets/tool-namespace-0JnTVTOi.js","assets/form-C_M4QV9P.js","assets/label-CnHmgvIU.js","assets/utils-CVEq3hMx.js","assets/markdown-CN4Sgkcu.js","assets/use-mobile-CRjTpdEZ.js","assets/tooltip-B4vnoW3c.js","assets/index-CdLJWnRN.js","assets/shell-layout-q9TPgR4S.js","assets/use-deployment-admin-C05Wl5hm.js","assets/admin-fetch-BhTJlAsX.js","assets/command-CsBJ3GOI.js","assets/index-Do6PllqG.js","assets/integration-icon-D6ksbVbr.js","assets/project-icon-CmV5zxWN.js","assets/use-navigate-to-agent-B9-xP8hn.js","assets/new-project-dialog-C0bl_2Ba.js","assets/repository-picker-C8xivTfl.js","assets/github-icon-BZYLnrQK.js","assets/useInfiniteQuery-Bq3XzHMD.js","assets/infiniteQueryObserver-BMqABh4H.js","assets/collection-search-CH54VXGp.js","assets/use-debounced-value-yze9Agx0.js","assets/required-auth-layout-CQCCkUAY.js","assets/use-org-sso-DcHAsgmH.js","assets/shell-layout-CE2Eihra.css","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-B7qZoNog.js","assets/types-Cvkdtetr.js","assets/omit-server-managed-metadata-L5IhjRZB.js","assets/sheet-D1FdDYgh.js","assets/use-connection-Cd0tT7Hz.js","assets/use-mcp-prompts-CQ9PPuTj.js","assets/use-thread-outputs-D4glxnBY.js","assets/file-type-icon-BsiKabia.js","assets/section-array-field-3fy_eFLn.js","assets/blocks-tab-states-DAhg2Ye6.js","assets/site-editor-toast-BQb3pwds.js","assets/use-voice-input-CXfzcEw1.js","assets/popover-ChvCIlNB.js","assets/drawer-B5at6I_u.js","assets/index-BVwTm9yy.js","assets/checkbox-BpYZyZtV.js","assets/select-C67xaSM-.js","assets/index-BdQq_4o_.js","assets/ai-providers-logos-DD3qZ33J.js","assets/openai-compatible-presets-BKGfVqEx.js","assets/use-blocks-v8-project-FZUFv9Vq.js","assets/sandbox-url-D3mC8qhT.js","assets/use-sandbox-events-BxZfdvM3.js","assets/sandbox-git-api-DcqI6XE4.js","assets/empty-state-D3yjfo9M.js","assets/hosted-reconcile-DVCi8vCY.js","assets/slider-COwHhiq0.js","assets/index-BqJ-zbRp.js","assets/tooltipContext-Di8C4u-8.js","assets/CategoricalChart-Dannm-85.js","assets/index-DqGr7Hc1.js","assets/switch-By9JubUf.js","assets/textarea-Duz08Iqx.js","assets/scroll-area-C8lIzaxm.js","assets/monaco-editor-DRELyy_D.js","assets/editor-DD0jwUtP.js","assets/calendar-C6M3LMV4.js","assets/editor-classes-Dnkv0ExO.js","assets/core.esm-DYzatWGk.js","assets/sortable.esm-BoEIu5W0.js","assets/toggle-group-CCnoRxJ5.js","assets/active-indicator-CCMhAsc_.js","assets/combobox-Bfj0PjLE.js","assets/search-input-D2E1z19V.js","assets/tabs-Bb2xgzcm.js","assets/use-file-configs-C2_msq8y.js","assets/asset-utils-DC1EoBVm.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/mustache-CMDiec2Z.js","assets/use-section-preview-base-nthVDFUD.js","assets/seo-editor-D6BbHFAR.js","assets/use-apply-named-rule-hAr6r48R.js","assets/use-move-blocks-Dn5Uj2rh.js","assets/variant-matcher-override-BCR-xrVe.js"])))=>i.map(i=>d[i]);
2
+ import{c as ue,j as r,r as j,m as Fe,b as Te,B as $e,a3 as ti,aF as cn,b4 as ct,aG as De,b5 as ni,b6 as si,b7 as ri,b8 as ai,v as Sr,D as Pr,K as Gn,w as jr,x as Er,e as ii,h as gt,I as Mn,y as oi,b9 as li,a5 as Jn,aZ as ci,b2 as di,i as Nr,ar as Un,at as In,a8 as Tr,P as zn,E as ui,t as dn,b3 as fi,q as pi}from"./index-C0YexCRj.js";import{u as Cr,g as mi,c as qs,B as Rn,P as hi,r as gi,R as vi,a as xi,H as bi,b as Rr,S as wi,d as yi,l as ki,m as Si,p as Pi,e as ji,f as Ln,N as Ei}from"./parse-sections-DAzG_Y-i.js";import{b as Ni,c as Mt,r as Lr,l as Ar,f as Ti,g as Ci,w as Ri}from"./chat-context-C4aI-9Gh.js";import{t as Li}from"./ChevronUp-DzfCpOxS.js";import{P as Ai,Q as _i,J as _r,R as Oi,S as Di,b as Fi,T as $i,U as Or,V as Bi,W as Dr,X as Gs,Y as Mi}from"./agent-icon-CTjv6Gf3.js";import{a as Ui,n as Ii}from"./UserSquare-6Sdby0FR.js";import{s as Fr}from"./Plus-CZbPbPr7.js";import{a as $r,b as Br,P as Mr}from"./popover-ChvCIlNB.js";import{e as dt,b as ut,c as Ur,f as Ir,a as zr,C as Kr}from"./command-CsBJ3GOI.js";import{b as zi,c as Ki,u as Hi}from"./repository-binding-zAuhrRNl.js";import{a as Ut}from"./sandbox-lifecycle-context-NUpZmc9C.js";import{r as Vi}from"./thread-intent-BGQF0i18.js";import{u as Hr}from"./use-voice-input-CXfzcEw1.js";import{d as Wi,f as qi,i as Gi,g as Ji,h as Yi,j as Qi,k as Xi,u as fn,l as Yn,m as Xe,n as Zi,o as Vr,q as eo,t as to,v as no,w as Wr,x as so,c as qr,b as Gr,y as ro,z as He,A as ao,B as io,C as oo,D as lo,E as co,F as uo,G as Js,H as fo,I as Ys,J as po,K as mo,L as Qs,M as Xs,N as Zs,O as er,P as tr,Q as An,R as ho,S as go,U as vo,V as xo,W as bo,e as wo}from"./site-editor-toast-BQb3pwds.js";import{u as Jr}from"./use-mobile-CRjTpdEZ.js";import{T as pt,a as mt,c as ht}from"./tooltip-B4vnoW3c.js";import{T as Ze}from"./toolbar-icon-button-CpfF_t2h.js";import{w as nn,i as yo}from"./variant-matcher-override-BCR-xrVe.js";import{s as Bt,n as Qn,a as Yr,f as Ve,v as Qr,u as Xr,h as ko,i as So,B as Po,S as jo,C as Eo,b as No,e as To,c as Co,d as Ro,N as Lo,g as Ao,r as _o,j as Oo,k as nr,p as Do}from"./blocks-tab-states-DAhg2Ye6.js";import{u as Fo}from"./use-fast-preview-draft-url-CUn670We.js";import{g as $o}from"./section-array-field-3fy_eFLn.js";import{a as Bo,c as Zr}from"./shell-layout-q9TPgR4S.js";import{u as Xn,b as Mo}from"./use-sandbox-events-BxZfdvM3.js";import{u as Kn}from"./useQueries-BZNL1IMW.js";import{i as Uo}from"./LinkBroken01-BrWXpfvW.js";import{u as ea}from"./blocks-preview-workspace-context-B7BEJFAh.js";import{MonacoCodeEditor as Io}from"./monaco-editor-DRELyy_D.js";import{c as zo,u as Ko,i as Ho,l as Vo,D as Wo}from"./hosted-reconcile-DVCi8vCY.js";import{d as qo}from"./utils-CtoE4BzT.js";import{R as sr,a as sn,b as rr}from"./resizable-BbH6Rq9j.js";import{u as Go}from"./use-blocks-v8-project-FZUFv9Vq.js";import{s as Jo,L as Yo,R as ta,D as ar,w as Hn}from"./device-hint-CFx01Kw_.js";import{L as Qo}from"./label-CnHmgvIU.js";import{a as Xo,T as ir}from"./toggle-group-CCnoRxJ5.js";import{b as Zo}from"./sandbox-url-D3mC8qhT.js";import{r as el,R as tl}from"./virtual-mcp-wrwCllE9.js";import{d as nl}from"./delay-CnY5UFtP.js";import{s as na}from"./XClose-DeFo1VOD.js";import{o as sl}from"./omit-server-managed-metadata-L5IhjRZB.js";import{a as _n,b as rl,w as al,n as or}from"./app-preview-url-9Od4s8Sz.js";import{a as il}from"./use-organization-settings-Df-csuDo.js";import{a as On}from"./agent-capabilities-D6AEfG_r.js";import{E as ol}from"./empty-state-D3yjfo9M.js";import{G as lr}from"./github-icon-BZYLnrQK.js";import{R as ll}from"./new-project-dialog-C0bl_2Ba.js";import{r as cl}from"./preview-source-BsRLGWUP.js";import{A as dl,a as ul,b as fl}from"./alert-CBNKTKcv.js";import{u as pl}from"./use-task-metadata-CpevmR5K.js";function ml(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(Ai,{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 c;e[2]!==n?(c=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]=c):c=e[3];let o;e[4]!==c?(o=r.jsxs("span",{className:"relative flex h-2 w-16 items-center sm:w-20",children:[l,c]}),e[4]=c,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(_i,{className:"size-5 sm:size-6"})}),e[6]=i):i=e[6];let d;return e[7]!==s||e[8]!==o?(d=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]=d):d=e[9],d}function hl(t){const e=ue.c(22),{index:n,numbered:s,step:a,heading:l}=t,c=j.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]!==c||e[5]!==a.title?(i=r.jsx(l,{id:c,className:"text-sm font-medium text-foreground",children:a.title}),e[3]=l,e[4]=c,e[5]=a.title,e[6]=i):i=e[6];let d;e[7]!==o||e[8]!==i?(d=r.jsxs("div",{className:"flex items-center gap-3",children:[o,i]}),e[7]=o,e[8]=i,e[9]=d):d=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 S;e[14]!==a.after||e[15]!==f||e[16]!==p?(S=r.jsxs("div",{className:f,children:[p,a.after]}),e[14]=a.after,e[15]=f,e[16]=p,e[17]=S):S=e[17];let v;return e[18]!==c||e[19]!==d||e[20]!==S?(v=r.jsxs("li",{"aria-labelledby":c,className:"surface flex flex-col gap-3 p-4 sm:p-5",children:[d,S]}),e[18]=c,e[19]=d,e[20]=S,e[21]=v):v=e[21],v}const gl=[];function un(t){const e=ue.c(20),{title:n,lead:s,waiting:a,alerts:l,steps:c,footer:o,headingLevel:i}=t,d=c===void 0?gl:c,m=i===void 0?1:i,f=m===1?"h1":"h2",p=a&&d.length===0?"status":void 0;let S;e[0]!==a?(S=r.jsx(ml,{waiting:a}),e[0]=a,e[1]=S):S=e[1];let v;e[2]!==f||e[3]!==n?(v=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]=v):v=e[4];let x;e[5]!==s?(x=s&&r.jsx("p",{className:"text-pretty text-sm text-muted-foreground",children:s}),e[5]=s,e[6]=x):x=e[6];let h;e[7]!==p||e[8]!==S||e[9]!==v||e[10]!==x?(h=r.jsxs("header",{role:p,className:"flex flex-col items-center gap-3 text-center",children:[S,v,x]}),e[7]=p,e[8]=S,e[9]=v,e[10]=x,e[11]=h):h=e[11];let b;e[12]!==m||e[13]!==d?(b=d.length>0&&r.jsx("ol",{className:"flex flex-col gap-3",children:d.map((y,g)=>r.jsx(hl,{index:g+1,numbered:d.length>1,step:y,heading:m===1?"h2":"h3"},y.title))}),e[12]=m,e[13]=d,e[14]=b):b=e[14];let T;return e[15]!==l||e[16]!==o||e[17]!==h||e[18]!==b?(T=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,b,o]})}),e[15]=l,e[16]=o,e[17]=h,e[18]=b,e[19]=T):T=e[19],T}function vl(t){const e=ue.c(43),{wait:n,hosts:s,invalidLink:a}=t,l=a===void 0?!1:a,c=Te();let o;e[0]!==l||e[1]!==c?(o=l&&r.jsx(dl,{variant:"warning",children:r.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[r.jsx(ul,{className:"line-clamp-none text-foreground",children:c("decoServe.link.invalidTitle")}),r.jsx(fl,{children:c("decoServe.link.invalidBody")})]})}),e[0]=l,e[1]=c,e[2]=o):o=e[2];const i=o;if(n.kind==="problem"){let g;e[3]!==c||e[4]!==n.host||e[5]!==n.problem?(g=Jo(c,n.problem,n.host),e[3]=c,e[4]=n.host,e[5]=n.problem,e[6]=g):g=e[6];const{title:N,body:E}=g;let k;e[7]!==E?(k=r.jsx(ta,{text:E}),e[7]=E,e[8]=k):k=e[8];let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=r.jsx(ar,{className:"border-t border-border pt-4",links:["troubleshooting","serve"]}),e[9]=P):P=e[9];let C;return e[10]!==i||e[11]!==k||e[12]!==N?(C=r.jsx(un,{headingLevel:2,waiting:!1,title:N,lead:k,alerts:i,footer:P}),e[10]=i,e[11]=k,e[12]=N,e[13]=C):C=e[13],C}const d=n.kind==="looking",m=d&&!n.paused;let f;e[14]!==c?(f=c("decoServe.waiting.title"),e[14]=c,e[15]=f):f=e[15];let p;e[16]!==c?(p=c("decoServe.waiting.lead"),e[16]=c,e[17]=p):p=e[17];let S;e[18]!==i||e[19]!==n.kind?(S=(i||n.kind==="denied")&&r.jsxs(r.Fragment,{children:[i,n.kind==="denied"&&r.jsx(Yo,{})]}),e[18]=i,e[19]=n.kind,e[20]=S):S=e[20];let v;e[21]!==c?(v=c("decoServe.waiting.connect.title"),e[21]=c,e[22]=v):v=e[22];let x;e[23]!==c?(x=c("decoServe.waiting.connect.body"),e[23]=c,e[24]=x):x=e[24];let h;e[25]!==s||e[26]!==d||e[27]!==c||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:c("decoServe.guide.start")}):d&&r.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:n.paused?c("decoServe.guide.paused"):c("decoServe.guide.looking",{hosts:s})}),e[25]=s,e[26]=d,e[27]=c,e[28]=n.kind,e[29]=n.onStart,e[30]=n.paused,e[31]=h):h=e[31];let b;e[32]!==v||e[33]!==x||e[34]!==h?(b=[{title:v,body:x,after:h}],e[32]=v,e[33]=x,e[34]=h,e[35]=b):b=e[35];let T;e[36]===Symbol.for("react.memo_cache_sentinel")?(T=r.jsx(ar,{className:"border-t border-border pt-4",links:["siteEditor","serve","troubleshooting"]}),e[36]=T):T=e[36];let y;return e[37]!==b||e[38]!==m||e[39]!==f||e[40]!==p||e[41]!==S?(y=r.jsx(un,{headingLevel:2,waiting:m,title:f,lead:p,alerts:S,steps:b,footer:T}),e[37]=b,e[38]=m,e[39]=f,e[40]=p,e[41]=S,e[42]=y):y=e[42],y}function xl(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 bl=15e3,wl=3e3;function yl(t){const{candidates:e,probe:n,onFound:s,onChange:a,doc:l=document,setTimer:c=(g,N)=>setTimeout(g,N),clearTimer:o=g=>clearTimeout(g),timeoutMs:i=wl}=t;let d={status:"searching",firstRoundDone:!1,problem:null},m=!1,f=!1,p=0,S=null,v=null;const x=()=>l.visibilityState==="hidden",h=g=>{d={...d,...g},a(d)},b=async g=>{v=new AbortController;const N=v,E=c(()=>N.abort(),i);try{return await n(g,N.signal),!0}catch(k){if(m)return!1;const P=qi(k);return P.reason!=="not-answering"?h({problem:{...P,endpoint:g}}):d.problem?.endpoint===g&&h({problem:null}),!1}finally{o(E),v=null}},T=async()=>{if(S=null,!(m||f)){if(e.length===0){h({status:"stopped",firstRoundDone:!0});return}if(x()){h({status:"paused"});return}f=!0,d.status!=="searching"&&h({status:"searching"});for(const g of e){if(m)break;if(await b(g)){if(f=!1,m)return;m=!0,l.removeEventListener("visibilitychange",y),h({status:"found",firstRoundDone:!0}),s(g);return}}if(f=!1,!m){if(p+=1,d.firstRoundDone||h({firstRoundDone:!0}),x()){h({status:"paused"});return}S=c(()=>{T()},Wi(p,bl))}}};function y(){if(!m){if(x()){S!==null&&(o(S),S=null),f||h({status:"paused"});return}S!==null&&o(S),p=0,T()}}return l.addEventListener("visibilitychange",y),a(d),T(),()=>{m=!0,S!==null&&o(S),v?.abort(),l.removeEventListener("visibilitychange",y)}}function kl(t,e){return Ji(Yi({endpoint:t,fetch:n=>fetch(n,{signal:e})}))}const Sl=["loopback-network","local-network-access"];async function Pl(){if(Gi(window.location.origin))return null;for(const t of Sl)try{return await navigator.permissions.query({name:t})}catch{}return null}let sa=null,cr=!1;const Dn=new Set;function jl(t){if(Dn.add(t),!cr){cr=!0;const e=n=>{sa=n;for(const s of Dn)s()};Pl().then(n=>{if(!n)return e("unsupported");e(n.state),n.addEventListener("change",()=>e(n.state))})}return()=>Dn.delete(t)}const El={status:"stopped",firstRoundDone:!1,problem:null},Fn=new Map;function Nl(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:c=>(s.add(c),a??=yl({candidates:t.split(" "),probe:kl,onFound:o=>l.onFound(o),onChange:o=>{n=o;for(const i of s)i()}}),()=>{s.delete(c),!(s.size>0)&&(a?.(),a=null,Fn.delete(t))})};return Fn.set(t,l),l}function ra(){return j.useSyncExternalStore(jl,ur,ur)}const Tl=()=>()=>{},dr=()=>El,ur=()=>sa;function qu(t){const e=ue.c(9),{candidates:n,onFound:s}=t,[a,l]=j.useState(!1),c=ra(),i=(c==="granted"||c==="unsupported"||c==="prompt"&&a)&&n.length>0;let d;e[0]!==i||e[1]!==n||e[2]!==s?(d=i?Nl(n.join(" ")):null,d&&(d.onFound=s),e[0]=i,e[1]=n,e[2]=s,e[3]=d):d=e[3];const m=j.useSyncExternalStore(d?.subscribe??Tl,d?.getSnapshot??dr,d?.getSnapshot??dr),f=c==="prompt"&&!a;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>l(!0),e[4]=p):p=e[4];let S;return e[5]!==c||e[6]!==m||e[7]!==f?(S={state:m,access:c,needsGesture:f,start:p},e[5]=c,e[6]=m,e[7]=f,e[8]=S):S=e[8],S}const fr={mode:"none",iframeBase:null,showBlockingOverlay:!1,showWakingPill:!1};function Cl(t){const{previewState:e,progressStatus:n,fastPreviewActive:s=!1,fastPreviewReady:a=!1,codingSession:l=!1,hostedDraft:c=!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"?fr:c&&t.hostedPointerPending&&!a?{...fr,showDecidingLoader:!0}:s&&a&&o?{mode:"production",iframeBase:o,showBlockingOverlay:!1,showWakingPill:!1}:s&&c&&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 Rl=1e4,Ll=1e3,Al=3e4;function _l({iframeRef:t,src:e,active:n}){const s=j.useRef(0),a=j.useRef(null),l=j.useRef(null),c=j.useRef(e),o=j.useRef(n);c.current=e,o.current=n;const i=()=>{a.current&&clearTimeout(a.current),l.current&&clearTimeout(l.current),a.current=null,l.current=null},d=()=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m()},Rl)},m=()=>{if(!o.current||!c.current)return;l.current&&clearTimeout(l.current);const S=ti(Al,Ll,s.current,2,.5);s.current+=1,l.current=setTimeout(()=>{l.current=null;const v=t.current,x=c.current;!v||!x||!o.current||(v.src=x,d())},S)},f=()=>{s.current=0,i()},p=()=>{a.current&&(clearTimeout(a.current),a.current=null),m()};return j.useEffect(()=>{if(i(),s.current=0,!(!n||!e))return d(),i},[e,n]),{handleLoad:f,handleError:p}}const Ol=1500,Dl=500;function Fl({iframe:t,reload:e,waitMs:n=Ol,confirmMs:s=Dl}){let a;const l=()=>{clearTimeout(c),a=setTimeout(e,s)};t.addEventListener("load",l,{once:!0});const c=setTimeout(()=>{t.removeEventListener("load",l),e()},n);return()=>{clearTimeout(c),clearTimeout(a),t.removeEventListener("load",l)}}const $l=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()})}),Bl=`(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 j,m as Fe,b as Te,B as $e,a3 as ti,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"}),zl="v1",Kl="/studio-modules",$n=["wireframe","html-swap"];function Hl(t,e,n){const s=new URL(`${Kl}/${zl}/${e}.js`,t);return n&&s.searchParams.set("build",n),s.href}const Vl=2e3;class Wl{constructor(e){this.options=e,this.urls=Object.fromEntries($n.map(n=>[n,Hl(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 ql(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()},Vl),!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 ql(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 c=e[a];if(c&&typeof c=="object"&&"__resolveType"in c){const o=c.__resolveType;if(typeof o=="string"&&o&&o!==a){s=c,a=o;continue}}break}if(!a)return[];if(a.includes("flags/multivariate")||n&&ni(a,n)){const l=Array.isArray(s.variants)?s.variants:[];if(l.length===0||l.every(i=>{const d=i?.rule;return si(d?.__resolveType,n)}))return null;const o=[];for(const i of l){const d=ri(i,n);if(d&&typeof d=="object")for(const m of Vn(d,e,n)??[])o.includes(m)||o.push(m)}return o}if(ai(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 Gl(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 Jl(t,e,n=320,s=44,a=12){const{x:l,y:c}=t,{width:o,height:i}=e,d=Math.max(a,Math.min(l-n/2,o-n-a)),f=c/i>.68?Math.max(a,c-s-18):Math.min(c+18,i-s-a);return{leftPct:d/o*100,topPct:f/i*100}}function Yl(t){const e=ue.c(45),{element:n,onDismiss:s}=t,[a,l]=j.useState(""),c=j.useRef(null),{sendMessage:o}=Ni(),{openSidePanel:i}=Bo(),d=Te();let m;e[0]!==n||e[1]!==a||e[2]!==s||e[3]!==i||e[4]!==o?(m=()=>{if(!a.trim())return;const W=Gl(n,a);i(),o({parts:[{type:"text",text:W}]}),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=Jl(n.position,n.viewport),e[6]=n.position,e[7]=n.viewport,e[8]=p):p=e[8];const S=p,v=`${S.leftPct}%`,x=`${S.topPct}%`;let h;e[9]!==v||e[10]!==x?(h={left:v,top:x,width:"320px"},e[9]=v,e[10]=x,e[11]=h):h=e[11];let b;e[12]!==f?(b=W=>{W.preventDefault(),f()},e[12]=f,e[13]=b):b=e[13];let T;e[14]===Symbol.for("react.memo_cache_sentinel")?(T=W=>l(W.target.value),e[14]=T):T=e[14];let y;e[15]!==s?(y=W=>{W.key==="Escape"&&s()},e[15]=s,e[16]=y):y=e[16];let g;e[17]!==d?(g=d("sandbox.visualEditorPrompt.inputPlaceholder"),e[17]=d,e[18]=g):g=e[18];let N;e[19]!==a||e[20]!==y||e[21]!==g?(N=r.jsx("input",{ref:c,autoFocus:!0,type:"text",value:a,onChange:T,onKeyDown:y,placeholder:g,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),e[19]=a,e[20]=y,e[21]=g,e[22]=N):N=e[22];let E;e[23]!==a?(E=a.trim(),e[23]=a,e[24]=E):E=e[24];const k=!E;let P;e[25]!==d?(P=d("sandbox.visualEditorPrompt.sendButton"),e[25]=d,e[26]=P):P=e[26];let C;e[27]!==d?(C=d("sandbox.visualEditorPrompt.sendButton"),e[27]=d,e[28]=C):C=e[28];let O;e[29]!==C?(O=r.jsx("title",{children:C}),e[29]=C,e[30]=O):O=e[30];let R;e[31]===Symbol.for("react.memo_cache_sentinel")?(R=r.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e[31]=R):R=e[31];let A;e[32]!==O?(A=r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[O,R]}),e[32]=O,e[33]=A):A=e[33];let D;e[34]!==k||e[35]!==P||e[36]!==A?(D=r.jsx("button",{type:"submit",disabled:k,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-foreground text-background transition-opacity disabled:opacity-30",title:P,children:A}),e[34]=k,e[35]=P,e[36]=A,e[37]=D):D=e[37];let _;e[38]!==N||e[39]!==D||e[40]!==b?(_=r.jsxs("form",{className:"pointer-events-auto flex w-full items-center gap-1.5 rounded-xl glass px-3 py-1.5",onSubmit:b,children:[N,D]}),e[38]=N,e[39]=D,e[40]=b,e[41]=_):_=e[41];let B;return e[42]!==_||e[43]!==h?(B=r.jsx("div",{className:"absolute z-30 pointer-events-none",style:h,children:_}),e[42]=_,e[43]=h,e[44]=B):B=e[44],B}const pr="site-links",Ql=/details?page|\bpdp\b/i,Xl=/listingpage|\bplp\b/i;function Zl(t,e,n){const s=new Set;for(const o of n)Ql.test(o)&&s.add("product"),Xl.test(o)&&s.add("category");const a=Bt(Qn(t)),l=a[a.length-1],c=a[a.length-2];return l?.type==="text"&&l.text==="/p"&&c?.type==="param"&&c.name===e&&s.add("product"),e==="*"&&a.some(o=>o.type==="param"&&o.name==="*")&&s.add("category"),s}const ec=["rosa","preto","pink","black"];function an(t,e){const n=e.trim();return n?t(n):ec.flatMap(s=>t(s))}function tc(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 aa=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function Zn(t){return t.split("/")[0]??""}function nc(t){const e=new Set;for(const n of t){const s=Zn(n);aa.has(s)&&e.add(s)}return e}function sc(t,e){const n=Zn(t);return!aa.has(n)||e.size===0?!0:e.has(n)}const rc=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>an(n=>tc(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:uc}];function ac(t,e,n=new Set){const s=[...e],a=o=>{const i=[];for(const d of rc){if(d.kind!==o)continue;const m=s.find(f=>d.test(f)&&sc(f,n));m&&i.push({cand:d,resolveType:m})}return i.find(d=>n.has(Zn(d.resolveType)))??i[0]},l=(o,i,d)=>({kind:o.kind,id:`${o.kind}:${i}`,resolveType:i,clientFilter:o.clientFilter,isFallback:d,buildRequests:m=>o.buildRequests(i,m),optionsFromPayload:o.optionsFromPayload}),c=[];for(const o of["product","category"]){if(!t.has(o))continue;const i=a(o);i&&c.push(l(i.cand,i.resolveType,!1))}return t.size>0&&c.push(ic(t.has("category")?"category":"product")),c}function ic(t){return{kind:t,id:pr,resolveType:pr,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,n)=>gc(e,n)}}function et(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function oc(t,e,n){const s=new Set,a=new Set,l=c=>{if(Array.isArray(c)){for(const d of c)l(d);return}const o=et(c);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 d=et(e[i])?.__resolveType;typeof d=="string"&&n(d)&&s.add(i),l(e[i])}}for(const d of Object.values(o))l(d)};return l(t),s}function ia(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 oa(t){try{return decodeURIComponent(t)}catch{return t}}function lc(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cc(t){const e=[];let n="^";for(const s of t)s.type==="text"?n+=lc(s.text):(e.push(s.name),n+=s.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${n}$`),order:e}}function la(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:c}=cc(a),o=c.indexOf(n);if(o===-1)return null;const i=s.match(l);if(!i)return null;const d=i[o+1]?.replace(/^\/+|\/+$/g,"");return d?oa(d):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 c of s){const o=et(c);if(!o)continue;const i=la(o.url,e.template,e.paramName);if(!i||l.has(i))continue;l.add(i);const d=et(o.isVariantOf),m=typeof d?.name=="string"&&d.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 dc(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?oa(n):null}function uc(t){const e=[],n=new Set,s=(a,l)=>{const c=et(a);if(!c)return;const o=typeof c.name=="string"&&c.name?c.name:"",i=o?[...l,o]:l,d=dc(c.url);if(d&&!n.has(d)&&(n.add(d),e.push({value:d,label:i.join(" › ")||d})),Array.isArray(c.children))for(const m of c.children)s(m,i)};if(Array.isArray(t))for(const a of t)s(a,[]);return e}const fc=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 pc(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function mc(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]??"",c=(s[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:l,text:c})}return e}function hc(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,c=0;for(;(l=s.exec(t))!==null&&c++<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 gc(t,e){const n=[],s=new Set,a=(l,c,o,i)=>{if(n.length>=200)return;const d=la(l,e.template,e.paramName);!d||s.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||o==="category"&&fc.has(d.split("/")[0]??"")||(s.add(d),n.push({value:d,label:c&&c.length<=80?c:pc(d),kind:o,image:i}))};for(const{url:l,name:c,image:o}of hc(t))a(l,c,"product",o);for(const{href:l,text:c}of mc(t))l.startsWith("/")&&!l.startsWith("//")&&a(l,c,"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 ca=1e4;function vc(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 xc(t,{resolveType:e,props:n}){const s=await fetch(Qi(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...n}),signal:AbortSignal.timeout(ca)});if(!s.ok)throw new Error(`Failed to fetch options: ${s.status}`);return s.json()}async function mr(t,e){const n=await fetch(Xi(t,e),{signal:AbortSignal.timeout(ca)});if(!n.ok)throw new Error(`Failed to fetch page: ${n.status}`);return n.text()}async function bc(t,e,n){const s=e.optionsFromPayload(await mr(t,"/"),n),a=s.find(c=>c.kind==="category");if(!a)return s;const l=Ve(n.template,{[n.paramName]:a.value});if(l==="/")return s;try{const c=e.optionsFromPayload(await mr(t,l),n).filter(o=>o.kind==="product");return ia([s,c])}catch{return s}}function wc(t,e,n){return Gn.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":n}`)}async function yc(t,e,n,s){if(e.homepageLinks)return bc(t,e,s);const a=e.buildRequests?.(n)??[];if(a.length===0)return[];const l=await Promise.allSettled(a.map(o=>xc(t,o))),c=l.filter(o=>o.status==="fulfilled").map(o=>o.value);if(c.length===0){const o=l.find(i=>i.status==="rejected");throw o?o.reason:new Error("Failed to fetch options")}return ia(c.map(o=>e.optionsFromPayload(o,s)))}function Wn(t,e,n,s,a){return{queryKey:wc(t,e,n),queryFn:()=>yc(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:c,keyPrefix:o,onSelect:i}=t;if(a.length===0)return null;let d;if(e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==a||e[4]!==c||e[5]!==l){let f;e[7]!==s||e[8]!==o||e[9]!==i||e[10]!==c||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(_r,{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,{[c]:p.value})})]})]},`${o}:${p.value}`),e[7]=s,e[8]=o,e[9]=i,e[10]=c,e[11]=l,e[12]=f):f=e[12],d=a.map(f),e[0]=s,e[1]=o,e[2]=i,e[3]=a,e[4]=c,e[5]=l,e[6]=d}else d=e[6];let m;return e[13]!==n||e[14]!==d?(m=r.jsx(dt,{heading:n,children:d}),e[13]=n,e[14]=d,e[15]=m):m=e[15],m}function hr(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 kc(t){const e=ue.c(52),{sources:n,template:s,paramName:a,value:l,sandboxRef:c,onCommit:o}=t,i=Te(),[d,m]=j.useState(!1),[f,p]=j.useState(""),[S,v]=j.useState(""),x=j.useRef(null),h=a==="*"?i("sandbox.preview.catchAllParamLabel"):`:${a}`,b=vc(i),y=[...new Set(n.map(ee=>b[ee.kind].noun))].join(" or ");let g;e[0]!==i||e[1]!==y?(g=i("sandbox.pathParamPickerChip.searchPlaceholder",{options:y}),e[0]=i,e[1]=y,e[2]=g):g=e[2];const N=g,E={template:s,paramName:a};let k;e[3]!==f?(k=(ee,ce)=>({source:ee,query:ce,options:ee.clientFilter?Dt(ce.data??[],f):ce.data??[]}),e[3]=f,e[4]=k):k=e[4];const P=k,C=n.filter(Rc),O=n.filter(Cc),R=Kn({queries:C.map(ee=>Wn(c,ee,S,E,d))});let A;e[5]!==R||e[6]!==P?(A=(ee,ce)=>P(ee,R[ce]),e[5]=R,e[6]=P,e[7]=A):A=e[7];const D=C.map(A),_=D.length===0||D.every(Tc),B=Kn({queries:O.map(ee=>Wn(c,ee,S,E,d&&_))});let W;e[8]!==B||e[9]!==P?(W=(ee,ce)=>P(ee,B[ce]),e[8]=B,e[9]=P,e[10]=W):W=e[10];const Z=O.map(W),G=_?Z:D,J=G.length===1&&G[0]?.source.homepageLinks?G[0]:null,q=J&&!J.query.isLoading&&!J.query.isError?J?.query.data??[]:[],X=Dt(q.filter(Nc),f),L=Dt(q.filter(Ec),f),M=X.length>0&&L.length>0,U=ee=>{m(ee),x.current&&clearTimeout(x.current),p(ee?l:""),v(ee?l:"")};let H;e[11]===Symbol.for("react.memo_cache_sentinel")?(H=ee=>{p(ee),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{v(ee)},300)},e[11]=H):H=e[11];const F=H,z=ee=>{o(ee),U(!1)},V=Yr(f),Q=Ve(s,{[a]:V}),ne=Pr,se=Sr,I="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",re=jc;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(jr,{className:"sr-only",children:r.jsx(Er,{children:ae})}),e[15]=ae,e[16]=ie):ie=e[16];let me;e[17]===Symbol.for("react.memo_cache_sentinel")?(me=r.jsx(_r,{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=Ir,Se=!1,fe="min-h-0 flex-1";let le;e[25]!==N||e[26]!==f?(le=r.jsx(zr,{autoFocus:!0,placeholder:N,value:f,onValueChange:F}),e[25]=N,e[26]=f,e[27]=le):le=e[27];const Re=Ur,Me="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let Ue;e[28]!==i?(Ue=i("sandbox.pathParamPickerChip.noResults"),e[28]=i,e[29]=Ue):Ue=e[29];let Be;e[30]!==Ue?(Be=r.jsx(Kr,{children:Ue}),e[30]=Ue,e[31]=Be):Be=e[31];const vt=V&&r.jsx(dt,{className:"shrink-0",children:r.jsxs(ut,{value:`__raw__:${V}`,className:"gap-3 py-2",onSelect:()=>z(V),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(Uo,{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:V,paramLabel:h})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Q})]})]})}),ge=M?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:b.category.heading,iconKind:"category",options:X,template:s,paramName:a,keyPrefix:`${J?.source.id}:cat`,onSelect:z})}),r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r.jsx(Ft,{heading:b.product.heading,iconKind:"product",options:L,template:s,paramName:a,keyPrefix:`${J?.source.id}:prod`,onSelect:z})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:G.map(ee=>{const{source:ce,query:We,options:xt}=ee,{noun:qe}=b[ce.kind];if(We.isLoading)return r.jsx(hr,{text:i("sandbox.pathParamPickerChip.loading",{noun:qe})},ce.id);if(We.isError)return r.jsx(hr,{text:i("sandbox.pathParamPickerChip.couldNotLoad")},ce.id);if(ce.homepageLinks){const It=We.data??[];return r.jsxs(j.Fragment,{children:[r.jsx(Ft,{heading:b.category.heading,iconKind:"category",options:Dt(It.filter(Pc),f),template:s,paramName:a,keyPrefix:`${ce.id}:cat`,onSelect:z}),r.jsx(Ft,{heading:b.product.heading,iconKind:"product",options:Dt(It.filter(Sc),f),template:s,paramName:a,keyPrefix:`${ce.id}:prod`,onSelect:z})]},ce.id)}return r.jsx(Ft,{heading:G.length>1?b[ce.kind].heading:void 0,iconKind:ce.kind,options:xt,template:s,paramName:a,keyPrefix:ce.id,onSelect:z},ce.id)})});let _e;e[32]!==Re||e[33]!==Be||e[34]!==vt||e[35]!==ge?(_e=r.jsxs(Re,{className:Me,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 Ie;e[41]!==se||e[42]!==ie||e[43]!==he||e[44]!==be||e[45]!==re?(Ie=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]=Ie):Ie=e[46];let Le;return e[47]!==ne||e[48]!==U||e[49]!==d||e[50]!==Ie?(Le=r.jsx(ne,{open:d,onOpenChange:U,children:Ie}),e[47]=ne,e[48]=U,e[49]=d,e[50]=Ie,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:ee=>{ee.stopPropagation(),U(!0)},children:l||h}),Le]})}function Sc(t){return t.kind==="product"}function Pc(t){return t.kind!=="product"}function jc(t){return t.stopPropagation()}function Ec(t){return t.kind==="product"}function Nc(t){return t.kind!=="product"}function Tc(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function Cc(t){return t.isFallback}function Rc(t){return!t.isFallback}function Lc(t){const e=ue.c(8),{sources:n,template:s,paramName:a,sandboxRef:l,onFill:c}=t;let o,i;if(e[0]!==a||e[1]!==l||e[2]!==n||e[3]!==s){const S={template:s,paramName:a},v=n.filter(Ac);i=Kn,o=v.map(x=>Wn(l,x,"",S,!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 d;e[6]!==o?(d={queries:o},e[6]=o,e[7]=d):d=e[7];const m=i(d),[f,p]=j.useState(!1);if(!f)for(const S of m){if(S.isLoading)break;const v=S.data?.[0];if(v){p(!0),queueMicrotask(()=>c(v.value));break}}return null}function Ac(t){return!t.isFallback}function _c(t){const e=ue.c(31),{name:n,value:s,onCommit:a}=t,l=Te(),[c,o]=j.useState(s),[i,d]=j.useState(!1),m=j.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,S=c||p;let v;e[3]!==S?(v=r.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-xs",children:S}),e[3]=S,e[4]=v):v=e[4];let x;e[5]!==p||e[6]!==l?(x=l("sandbox.preview.valueForParam",{label:p}),e[5]=p,e[6]=l,e[7]=x):x=e[7];let h,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=P=>o(P.target.value),b=()=>d(!0),e[8]=h,e[9]=b):(h=e[8],b=e[9]);let T;e[10]!==s?(T=P=>{P.key==="Enter"&&P.currentTarget.blur(),P.key==="Escape"&&(m.current=!0,o(s),P.currentTarget.blur())},e[10]=s,e[11]=T):T=e[11];let y;e[12]!==c||e[13]!==a||e[14]!==s?(y=()=>{if(d(!1),m.current){m.current=!1;return}const P=Yr(c);o(P),P!==s&&a(P)},e[12]=c,e[13]=a,e[14]=s,e[15]=y):y=e[15];let g;e[16]!==c||e[17]!==p||e[18]!==x||e[19]!==T||e[20]!==y?(g=r.jsx("input",{type:"text",value:c,placeholder:p,title:x,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:Oc,onChange:h,onFocus:b,onKeyDown:T,onBlur:y}),e[16]=c,e[17]=p,e[18]=x,e[19]=T,e[20]=y,e[21]=g):g=e[21];let N;e[22]!==v||e[23]!==g?(N=r.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[v,g]}),e[22]=v,e[23]=g,e[24]=N):N=e[24];let E;e[25]!==i||e[26]!==l?(E=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(Oi,{size:10}),l("sandbox.preview.enterToGo")]}),e[25]=i,e[26]=l,e[27]=E):E=e[27];let k;return e[28]!==E||e[29]!==N?(k=r.jsxs(r.Fragment,{children:[N,E]}),e[28]=E,e[29]=N,e[30]=k):k=e[30],k}function Oc(t){return t.stopPropagation()}function Dc(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 Fc(t){return t.previewSurfaceActive&&(t.daemonReady||t.production||!!t.servePreviewUrl)}function $c(t){return t.showPreviewToolbar&&t.contentEditingEnabled}function Bc(t){return t.v8?null:t.production||t.localPreview?{type:"editor::inject",args:{script:t.script}}:{type:"visual-editor::activate",script:t.script}}function Mc(t){return t.v8?null:{type:"visual-editor::activate",script:t.script}}class da extends Error{constructor(){super("The site's schema isn't loaded yet"),this.name="PageSchemaNotReadyError"}}async function Uc(t,e){if(t)return t;const n=await e?.().catch(()=>null);if(!n)throw new da;return n}async function Ic(t,e,n){return n?qs(t,e,await Uc(n.meta,n.loadMeta)):qs(t,e)}function zc(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=Cr(n);let a;return e[2]!==t||e[3]!==s?(a={mutationFn:async l=>{const{name:c,path:o,template:i,schema:d}=l;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const m=mi(c),f=i?{...i,name:c,path:o}:await Ic(c,o,d);return await s.mutateAsync({blockKey:m,data:f}),{key:m,name:c,path:o}}},e[2]=t,e[3]=s,e[4]=a):a=e[4],ii(a)}function Kc(t){const e=ue.c(89),{open:n,onOpenChange:s,isPending:a,error:l,templates:c,onSubmit:o}=t,i=a===void 0?!1:a,d=Te();let m;e[0]!==d?(m=d("sectionsEditor.createPageModal.defaultPageName"),e[0]=d,e[1]=m):m=e[1];const[f,p]=j.useState(m);let S;e[2]!==d?(S=d("sectionsEditor.createPageModal.defaultPagePath"),e[2]=d,e[3]=S):S=e[3];const[v,x]=j.useState(S),[h,b]=j.useState(Rn),[T,y]=j.useState(null),[g,N]=j.useState(n);n!==g&&(N(n),n&&(p(d("sectionsEditor.createPageModal.defaultPageName")),x(d("sectionsEditor.createPageModal.defaultPagePath")),b(Rn),y(null)));const E=!!c?.length;let k;e[4]!==i||e[5]!==s?(k=pe=>{!pe&&!i&&(y(null),s(!1))},e[4]=i,e[5]=s,e[6]=k):k=e[6];const P=k;let C;e[7]!==i||e[8]!==f||e[9]!==o||e[10]!==v||e[11]!==E||e[12]!==h?(C=async pe=>{pe.preventDefault();const xe=f.trim(),he=v.trim();if(!xe||!he||i)return;const ve=Qr(he);if(ve){y(ve);return}y(null),await o({name:xe,path:he,templateKey:E&&h!==Rn?h:null})},e[7]=i,e[8]=f,e[9]=o,e[10]=v,e[11]=E,e[12]=h,e[13]=C):C=e[13];const O=C,R=T??l;let A;e[14]!==d?(A=d("sectionsEditor.createPageModal.title"),e[14]=d,e[15]=A):A=e[15];let D;e[16]!==A?(D=r.jsx(jr,{children:r.jsx(Er,{children:A})}),e[16]=A,e[17]=D):D=e[17];let _;e[18]!==d?(_=d("sectionsEditor.createPageModal.nameLabel"),e[18]=d,e[19]=_):_=e[19];let B;e[20]!==_?(B=r.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:_}),e[20]=_,e[21]=B):B=e[21];let W;e[22]===Symbol.for("react.memo_cache_sentinel")?(W=pe=>p(pe.target.value),e[22]=W):W=e[22];let Z;e[23]!==d?(Z=d("sectionsEditor.createPageModal.namePlaceholder"),e[23]=d,e[24]=Z):Z=e[24];let G;e[25]!==i||e[26]!==f||e[27]!==Z?(G=r.jsx(Mn,{id:"new-page-name",value:f,onChange:W,placeholder:Z,autoFocus:!0,disabled:i}),e[25]=i,e[26]=f,e[27]=Z,e[28]=G):G=e[28];let J;e[29]!==G||e[30]!==B?(J=r.jsxs("div",{className:"space-y-1.5",children:[B,G]}),e[29]=G,e[30]=B,e[31]=J):J=e[31];let K;e[32]!==d?(K=d("sectionsEditor.createPageModal.pathLabel"),e[32]=d,e[33]=K):K=e[33];let q;e[34]!==K?(q=r.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:K}),e[34]=K,e[35]=q):q=e[35];let X;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=pe=>x(pe.target.value),e[36]=X):X=e[36];let L;e[37]!==d?(L=d("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=d,e[38]=L):L=e[38];let M;e[39]!==i||e[40]!==v||e[41]!==L?(M=r.jsx(Mn,{id:"new-page-path",value:v,onChange:X,placeholder:L,disabled:i}),e[39]=i,e[40]=v,e[41]=L,e[42]=M):M=e[42];let U;e[43]!==q||e[44]!==M?(U=r.jsxs("div",{className:"space-y-1.5",children:[q,M]}),e[43]=q,e[44]=M,e[45]=U):U=e[45];let H;e[46]!==i||e[47]!==E||e[48]!==d||e[49]!==h||e[50]!==c?(H=E&&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:d("sectionsEditor.createPageModal.templateLabel")}),r.jsx(hi,{id:"new-page-template",value:h,onChange:b,templates:c??[],disabled:i})]}),e[46]=i,e[47]=E,e[48]=d,e[49]=h,e[50]=c,e[51]=H):H=e[51];let F;e[52]!==R?(F=R&&r.jsx("p",{className:"text-xs text-destructive",children:R}),e[52]=R,e[53]=F):F=e[53];let z;e[54]!==J||e[55]!==U||e[56]!==H||e[57]!==F?(z=r.jsxs("div",{className:"space-y-4 py-4",children:[J,U,H,F]}),e[54]=J,e[55]=U,e[56]=H,e[57]=F,e[58]=z):z=e[58];let V;e[59]!==s?(V=()=>s(!1),e[59]=s,e[60]=V):V=e[60];let Q;e[61]!==d?(Q=d("sectionsEditor.createPageModal.cancelButton"),e[61]=d,e[62]=Q):Q=e[62];let ne;e[63]!==i||e[64]!==V||e[65]!==Q?(ne=r.jsx($e,{type:"button",variant:"outline",onClick:V,disabled:i,children:Q}),e[63]=i,e[64]=V,e[65]=Q,e[66]=ne):ne=e[66];let se;e[67]!==i||e[68]!==f||e[69]!==v?(se=!f.trim()||!v.trim()||i,e[67]=i,e[68]=f,e[69]=v,e[70]=se):se=e[70];let I;e[71]!==i||e[72]!==d?(I=i?r.jsxs(r.Fragment,{children:[r.jsx(gt,{className:"size-3.5"}),d("sectionsEditor.createPageModal.creatingButton")]}):d("sectionsEditor.createPageModal.createButton"),e[71]=i,e[72]=d,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(oi,{children:[ne,re]}),e[77]=ne,e[78]=re,e[79]=ae):ae=e[79];let ie;e[80]!==O||e[81]!==z||e[82]!==ae||e[83]!==D?(ie=r.jsx(Sr,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:O,children:[D,z,ae]})}),e[80]=O,e[81]=z,e[82]=ae,e[83]=D,e[84]=ie):ie=e[84];let me;return e[85]!==P||e[86]!==n||e[87]!==ie?(me=r.jsx(Pr,{open:n,onOpenChange:P,children:ie}),e[85]=P,e[86]=n,e[87]=ie,e[88]=me):me=e[88],me}function Hc(t){const e=ue.c(36),{orgSlug:n,virtualMcpId:s,branch:a,previewUrl:l,meta:c,decofile:o,blockKey:i}=t,d=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=Cr(m);let p;e[4]!==f?(p=xi((k,P)=>f.mutate({blockKey:k,data:P})),e[4]=f,e[5]=p):p=e[5];const S=p;let v;e[6]!==i||e[7]!==o?(v=gi(o,i),e[6]=i,e[7]=o,e[8]=v):v=e[8];const{resolveType:x,props:h,title:b}=v;if(!x){let k;e[9]!==d?(k=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=k):k=e[10];let P;return e[11]!==k?(P=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:k}),e[11]=k,e[12]=P):P=e[12],P}const T=`loader:${i}`,y=`loader:${i}`;let g;e[13]!==i||e[14]!==x||e[15]!==b?(g={mode:"saved",blockKey:i,resolveType:x,title:b},e[13]=i,e[14]=x,e[15]=b,e[16]=g):g=e[16];let N;e[17]!==a||e[18]!==o||e[19]!==c||e[20]!==n||e[21]!==l||e[22]!==h||e[23]!==f.isPending||e[24]!==S||e[25]!==y||e[26]!==g||e[27]!==s?(N=r.jsx(vi,{orgSlug:n,virtualMcpId:s,branch:a,previewUrl:l,meta:c,decofile:o,kind:"loaders",target:g,initialValue:h,isCreating:f.isPending,onCreate:Vc,onSaveReferencedBlock:S,showRun:!1},y),e[17]=a,e[18]=o,e[19]=c,e[20]=n,e[21]=l,e[22]=h,e[23]=f.isPending,e[24]=S,e[25]=y,e[26]=g,e[27]=s,e[28]=N):N=e[28];let E;return e[29]!==i||e[30]!==a||e[31]!==n||e[32]!==T||e[33]!==N||e[34]!==s?(E=r.jsx(bi,{orgSlug:n,virtualMcpId:s,branch:a,blockKey:i,present:void 0,children:N},T),e[29]=i,e[30]=a,e[31]=n,e[32]=T,e[33]=N,e[34]=s,e[35]=E):E=e[35],E}async function Vc(){}function Wc(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function gr(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:Wc(t.error)}}function qc(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 Gc(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=qc(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 Jc=j.lazy(()=>li(()=>import("./sections-editor-BahV49vR.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 vr(t){const e=ue.c(60),{virtualMcpId:n,externalSelection:s,onViewJsonFile:a}=t,l=s===void 0?null:s,{org:c}=Jn(),{currentBranch:o,taskId:i}=Mt(),d=Xn(),m=Ut(),f=ea(),p=d.lifecycle.phase==="running",S=m.previewUrl;let v;e[0]!==o||e[1]!==c||e[2]!==S||e[3]!==i||e[4]!==n?(v=o?{orgSlug:c.slug,virtualMcpId:n,branch:o,threadId:i??null,previewUrl:S}:null,e[0]=o,e[1]=c,e[2]=S,e[3]=i,e[4]=n,e[5]=v):v=e[5];const x=v,h=fn(n,o);let b;e[6]!==p?(b={fetchEnabled:p},e[6]=p,e[7]=b):b=e[7];const T=Yn(x,b);let y;e[8]!==p?(y={fetchEnabled:p},e[8]=p,e[9]=y):y=e[9];const g=Xr(x,y),N=Gc({lifecyclePhase:d.lifecycle.phase,decofile:gr(T),meta:gr(g),hasEditableContent:ko(T.data,g.data),fastPreviewActive:Hr(n).runtime==="cms"||Xe(h)}),E=Rr()===void 0,k=Yc;if(So(h)){let L;return e[10]===Symbol.for("react.memo_cache_sentinel")?(L=k(r.jsx(jo,{})),e[10]=L):L=e[10],L}if(h.kind==="pending"&&h.retrying){let L;return e[11]!==h?(L=k(r.jsx(Eo,{backend:h})),e[11]=h,e[12]=L):L=e[12],L}if(N.kind==="loading"||E){let L;return e[13]===Symbol.for("react.memo_cache_sentinel")?(L=k(r.jsx(ci,{})),e[13]=L):L=e[13],L}if(T.data&&Zi(g.data)){const L=f.state.target,M=L?.kind==="page"||L?.kind==="section"?L.key:null,U=M??"",H=o??"";let F;return e[14]!==T.data||e[15]!==M||e[16]!==c.slug||e[17]!==U||e[18]!==H||e[19]!==n?(F=k(r.jsx(wi,{orgSlug:c.slug,virtualMcpId:n,branch:H,decofile:T.data,initialKey:M,compact:!0},U)),e[14]=T.data,e[15]=M,e[16]=c.slug,e[17]=U,e[18]=H,e[19]=n,e[20]=F):F=e[20],F}if(N.kind==="empty"){let L;return e[21]===Symbol.for("react.memo_cache_sentinel")?(L=k(r.jsx(No,{})),e[21]=L):L=e[21],L}if(N.kind==="error"){let L;e[22]!==T||e[23]!==m||e[24]!==g||e[25]!==N.source?(L=()=>{if(N.source==="sandbox"){m.retry();return}Promise.all([T.refetch(),g.refetch()])},e[22]=T,e[23]=m,e[24]=g,e[25]=N.source,e[26]=L):L=e[26];const M=L;let U;return e[27]!==M||e[28]!==N.source?(U=k(r.jsx(Po,{source:N.source,onRetry:M})),e[27]=M,e[28]=N.source,e[29]=U):U=e[29],U}let P;e[30]===Symbol.for("react.memo_cache_sentinel")?(P=L=>k(r.jsx("div",{className:"h-full min-h-0",children:L})),e[30]=P):P=e[30];const C=P,O=f.state.target;if(O?.kind==="loader"&&T.data&&g.data){const L=o??"",M=S??null;let U;return e[31]!==T.data||e[32]!==g.data||e[33]!==c.slug||e[34]!==L||e[35]!==M||e[36]!==O.key||e[37]!==n?(U=C(r.jsx(Hc,{orgSlug:c.slug,virtualMcpId:n,branch:L,previewUrl:M,meta:g.data,decofile:T.data,blockKey:O.key})),e[31]=T.data,e[32]=g.data,e[33]=c.slug,e[34]=L,e[35]=M,e[36]=O.key,e[37]=n,e[38]=U):U=e[38],U}let R;e[39]!==o||e[40]!==c.slug||e[41]!==O||e[42]!==n?(R=O||!o?null:Lr(Ar(c.slug,n,o)),e[39]=o,e[40]=c.slug,e[41]=O,e[42]=n,e[43]=R):R=e[43];const A=R;let D="/",_=null,B=null;O?.kind==="page"?(D=O.path,_=O.key):O?.kind==="section"?B=O.key:A&&(D=A.path,_=A.pageKey);const W=_?`page:${_}`:B?`section:${B}`:`path:${D}`;let Z;e[44]===Symbol.for("react.memo_cache_sentinel")?(Z=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}),e[44]=Z):Z=e[44];const G=o??"",J=S??void 0,K=B?null:l,q=!!_&&f.state.editSeoPageKey===_;let X;return e[45]!==B||e[46]!==_||e[47]!==D||e[48]!==W||e[49]!==a||e[50]!==c.slug||e[51]!==K||e[52]!==q||e[53]!==G||e[54]!==J||e[55]!==n||e[56]!==f.consumeEditSeo||e[57]!==f.setFocusedBlock||e[58]!==f.setVariantOverride?(X=C(r.jsx(j.Suspense,{fallback:Z,children:r.jsx(Jc,{orgSlug:c.slug,virtualMcpId:n,branch:G,previewReady:!0,previewUrl:J,currentPath:D,activePageBlockKey:_,activeGlobalBlockKey:B,externalSelection:K,initialEditSeo:q,onExitSeo:f.consumeEditSeo,onVariantPreviewOverride:f.setVariantOverride,onFocusedBlockChange:f.setFocusedBlock,onViewJsonFile:a},W)})),e[45]=B,e[46]=_,e[47]=D,e[48]=W,e[49]=a,e[50]=c.slug,e[51]=K,e[52]=q,e[53]=G,e[54]=J,e[55]=n,e[56]=f.consumeEditSeo,e[57]=f.setFocusedBlock,e[58]=f.setVariantOverride,e[59]=X):X=e[59],X}function Yc(t){return r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function xr(t){const e=ue.c(51),{virtualMcpId:n,pageKey:s,onClose:a,ref:l}=t,c=Te(),o=Rr(),i=o===!0,d=Vr(n);let m;e[0]!==d||e[1]!==s?(m=eo(d,qo(s)),e[0]=d,e[1]=s,e[2]=m):m=e[2];const f=m,{org:p}=Jn(),{currentBranch:S,taskId:v}=Mt(),h=Ut().previewUrl;let b;e[3]!==S||e[4]!==p.slug||e[5]!==h||e[6]!==v||e[7]!==n?(b=S?{orgSlug:p.slug,virtualMcpId:n,branch:S,threadId:v??null,previewUrl:h}:null,e[3]=S,e[4]=p.slug,e[5]=h,e[6]=v,e[7]=n,e[8]=b):b=e[8];const y=Yn(b),g=S??"";let N;e[9]!==p.slug||e[10]!==g||e[11]!==n?(N={orgSlug:p.slug,virtualMcpId:n,branch:g},e[9]=p.slug,e[10]=g,e[11]=n,e[12]=N):N=e[12];let E;e[13]===Symbol.for("react.memo_cache_sentinel")?(E={holdsCopy:!0},e[13]=E):E=e[13];const{save:k,flush:P,hold:C}=yi(N,E),O=S??"";let R;e[14]!==p.slug||e[15]!==O||e[16]!==n?(R=zo({orgSlug:p.slug,virtualMcpId:n,branch:O}),e[14]=p.slug,e[15]=O,e[16]=n,e[17]=R):R=e[17];const A=Ko(R);let D;e[18]!==s||e[19]!==A?(D=A(s),e[18]=s,e[19]=A,e[20]=D):D=e[20];const _=D;let B;e[21]!==_||e[22]!==s?(B={pageKey:s,copyEpoch:_},e[21]=_,e[22]=s,e[23]=B):B=e[23];const[W,Z]=j.useState(B);(W.pageKey!==s||W.copyEpoch!==_)&&(Z({pageKey:s,copyEpoch:_}),C(s));const G=y.data?.[s],J=y.data===void 0&&y.isLoading||o===void 0,K=y.data!==void 0&&G===void 0,q=!S||K||J;let X;e[24]!==G?(X=G===void 0?"":JSON.stringify(G,null,2),e[24]=G,e[25]=X):X=e[25];const L=X;let M;e[26]!==s||e[27]!==q||e[28]!==k?(M=Q=>{if(q)return;let ne;try{ne=JSON.parse(Q)}catch{return}ne===null||typeof ne!="object"||Array.isArray(ne)||k(s,ne)},e[26]=s,e[27]=q,e[28]=k,e[29]=M):M=e[29];const U=M;let H;e[30]!==P?(H=()=>({flush:P}),e[30]=P,e[31]=H):H=e[31],j.useImperativeHandle(l,H);let F;e[32]!==f||e[33]!==i||e[34]!==a||e[35]!==c?(F=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:c("sectionsEditor.pageJsonDialog.titleShort")}),r.jsx($e,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":c("sectionsEditor.pageJsonDialog.close"),className:"shrink-0",children:r.jsx(di,{size:14})})]}),e[32]=f,e[33]=i,e[34]=a,e[35]=c,e[36]=F):F=e[36];let z;e[37]!==_||e[38]!==y.data||e[39]!==P||e[40]!==L||e[41]!==J||e[42]!==K||e[43]!==s||e[44]!==q||e[45]!==U||e[46]!==c?(z=J?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}):K?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",c("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Io,{code:L,language:"json",readOnly:q,height:"100%",onChange:Q=>U(Q??""),onSave:Q=>{U(Q),P()}},`${s}:${y.data===void 0?"loading":"ready"}:${_}`)}),e[37]=_,e[38]=y.data,e[39]=P,e[40]=L,e[41]=J,e[42]=K,e[43]=s,e[44]=q,e[45]=U,e[46]=c,e[47]=z):z=e[47];let V;return e[48]!==F||e[49]!==z?(V=r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[F,z]}),e[48]=F,e[49]=z,e[50]=V):V=e[50],V}function ua(t){return t.contentEditingEnabled&&!t.isMobile}function Qc(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function Xc(t,e){return t==="blocks"?"preview":e?"blocks":t}function Zc(t){return ua({contentEditingEnabled:Zr(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function ed(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}function td(t){const e=to(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=no(s,e);return{value:e,frame:a?Hn(a,t.device):null,newTab:a}}function nd(t){const e=ue.c(94),{tests:n,load:s,onOpen:a,options:l,onChange:c,available:o}=t,i=Te();let d;e[0]!==l?(d=Wr(l),e[0]=l,e[1]=d):d=e[1];const m=d;let f;e[2]!==l.tests?(f=l.tests??{},e[2]=l.tests,e[3]=f):f=e[3];const p=f;let S;e[4]!==c||e[5]!==l?(S=I=>{const re=I?Vo(I):null,{at:ae,...ie}=l;c(re?{...ie,at:re}:ie)},e[4]=c,e[5]=l,e[6]=S):S=e[6];const v=S;let x;e[7]!==p||e[8]!==c||e[9]!==l?(x=(I,re)=>{const ae={...p};re==="on"?ae[I]=!0:re==="off"?ae[I]=!1:delete ae[I];const{tests:ie,...me}=l;c(Object.keys(ae).length>0?{...me,tests:ae}:me)},e[7]=p,e[8]=c,e[9]=l,e[10]=x):x=e[10];const h=x;let b;e[11]!==a?(b=I=>{I&&a?.()},e[11]=a,e[12]=b):b=e[12];let T;e[13]!==i?(T=i("sandbox.previewAs.label"),e[13]=i,e[14]=T):T=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Di,{size:16}),e[15]=y):y=e[15];let g;e[16]!==m||e[17]!==T?(g=r.jsx(pt,{asChild:!0,children:r.jsx($r,{asChild:!0,children:r.jsx(Ze,{"aria-label":T,active:m,"data-testid":"preview-as-trigger",children:y})})}),e[16]=m,e[17]=T,e[18]=g):g=e[18];let N;e[19]!==i?(N=i("sandbox.previewAs.label"),e[19]=i,e[20]=N):N=e[20];let E;e[21]!==N?(E=r.jsx(mt,{children:N}),e[21]=N,e[22]=E):E=e[22];let k;e[23]!==E||e[24]!==g?(k=r.jsxs(ht,{children:[g,E]}),e[23]=E,e[24]=g,e[25]=k):k=e[25];let P;e[26]!==i?(P=i("sandbox.previewAs.label"),e[26]=i,e[27]=P):P=e[27];let C;e[28]!==P?(C=r.jsx("h3",{className:"text-sm font-medium",children:P}),e[28]=P,e[29]=C):C=e[29];let O;e[30]!==o||e[31]!==i?(O=i(o?"sandbox.previewAs.intro":"sandbox.previewAs.unavailable"),e[30]=o,e[31]=i,e[32]=O):O=e[32];let R;e[33]!==O?(R=r.jsx("p",{className:"text-xs text-muted-foreground",children:O}),e[33]=O,e[34]=R):R=e[34];let A;e[35]!==C||e[36]!==R?(A=r.jsxs("div",{className:"flex flex-col gap-1",children:[C,R]}),e[35]=C,e[36]=R,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 _;e[40]!==D?(_=r.jsx(Qo,{htmlFor:"preview-as-moment",children:D}),e[40]=D,e[41]=_):_=e[41];let B;e[42]!==l.at?(B=Ho(l.at),e[42]=l.at,e[43]=B):B=e[43];let W;e[44]!==v?(W=I=>v(I.target.value),e[44]=v,e[45]=W):W=e[45];let Z;e[46]!==B||e[47]!==W?(Z=r.jsx(Mn,{id:"preview-as-moment",type:"datetime-local",className:Wo,value:B,onChange:W}),e[46]=B,e[47]=W,e[48]=Z):Z=e[48];const G=l.at===void 0;let J;e[49]!==v?(J=()=>v(""),e[49]=v,e[50]=J):J=e[50];let K;e[51]!==i?(K=i("sandbox.previewAs.now"),e[51]=i,e[52]=K):K=e[52];let q;e[53]!==G||e[54]!==J||e[55]!==K?(q=r.jsx($e,{type:"button",variant:"ghost",size:"sm",disabled:G,onClick:J,children:K}),e[53]=G,e[54]=J,e[55]=K,e[56]=q):q=e[56];let X;e[57]!==Z||e[58]!==q?(X=r.jsxs("div",{className:"flex items-center gap-2",children:[Z,q]}),e[57]=Z,e[58]=q,e[59]=X):X=e[59];let L;e[60]!==i?(L=i("sandbox.previewAs.momentHint"),e[60]=i,e[61]=L):L=e[61];let M;e[62]!==L?(M=r.jsx("p",{className:"text-xs text-muted-foreground",children:L}),e[62]=L,e[63]=M):M=e[63];let U;e[64]!==_||e[65]!==X||e[66]!==M?(U=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[_,X,M]}),e[64]=_,e[65]=X,e[66]=M,e[67]=U):U=e[67];let H;e[68]!==i?(H=i("sandbox.previewAs.testsLabel"),e[68]=i,e[69]=H):H=e[69];let F;e[70]!==H?(F=r.jsx("span",{className:"text-sm font-medium",children:H}),e[70]=H,e[71]=F):F=e[71];let z;e[72]!==p||e[73]!==s||e[74]!==h||e[75]!==i||e[76]!==n?(z=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(Xo,{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(ir,{value:"off",children:i("sandbox.previewAs.off")}),r.jsx(ir,{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]=z):z=e[77];let V;e[78]!==F||e[79]!==z?(V=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[F,z]}),e[78]=F,e[79]=z,e[80]=V):V=e[80];let Q;e[81]!==m||e[82]!==c||e[83]!==i?(Q=m&&r.jsx($e,{type:"button",variant:"outline",size:"sm",onClick:()=>c({}),children:i("sandbox.previewAs.reset")}),e[81]=m,e[82]=c,e[83]=i,e[84]=Q):Q=e[84];let ne;e[85]!==A||e[86]!==U||e[87]!==V||e[88]!==Q?(ne=r.jsxs(Br,{className:"flex w-80 flex-col gap-4 p-4",align:"center",sideOffset:8,"data-testid":"preview-as",children:[A,U,V,Q]}),e[85]=A,e[86]=U,e[87]=V,e[88]=Q,e[89]=ne):ne=e[89];let se;return e[90]!==k||e[91]!==ne||e[92]!==b?(se=r.jsxs(Mr,{onOpenChange:b,children:[k,ne]}),e[90]=k,e[91]=ne,e[92]=b,e[93]=se):se=e[93],se}const sd=15e3;function rd(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 br(t){return t.loading?{...t,loading:!1}:t}function ad(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 id(t,{base:e,frameSrc:n,loadedSrc:s,wanted:a,canSwap:l}){const c=t?.base===e?t:null,o=c?.src??n,i=c?.shown??n;return!a||!o||!i?null:i===a?c:l&&s===o&&ad(i,a)?{base:e,src:o,shown:a}:null}const od=["next"],ld=["@tanstack/react-router","@tanstack/react-start","@tanstack/solid-router","@tanstack/solid-start"],fa=new Set(["tsx","ts","jsx","js","mdx"]),cd=new Set(["tsx","jsx"]),dd=new Set(["404","500"]);function ud(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 fd(t){const e=ud(t);return od.some(n=>e.has(n))?"next":ld.some(n=>e.has(n))?"tanstack":null}function pa(t,e){const n=(t??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${e}`:e}function pd(t,e){const n=s=>pa(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 md(t){const e=es(t.at(-1)??"");if(!e||!fa.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&&dd.has(n)||s.some(a=>a.startsWith("_")||a.includes("["))?null:(s.at(-1)==="index"&&s.pop(),`/${s.join("/")}`)}function hd(t){const e=es(t.at(-1)??"");if(!e||e[0]!=="page"||!fa.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 gd(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 vd(t){const e=es(t.at(-1)??"");if(!e||!cd.has(e[1]))return null;const n=[...t.slice(0,-1),...gd(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 c=l.replace(/_$/,"").replace(/[[\]]/g,"");c&&a.push(c)}return`/${a.join("/")}`}function xd(t,e){const n=e.split("/").filter(Boolean);if(n.length===0)return null;switch(t){case"next-pages":return md(n);case"next-app":return hd(n);case"tanstack":return vd(n);default:{const s=t;throw new Error(`Unknown router: ${String(s)}`)}}}function bd(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 c=xd(n.router,l.slice(a.length));c&&e.add(c)}}return[...e].sort((n,s)=>n==="/"?-1:s==="/"?1:n.localeCompare(s))}const wd=5e3,yd=6e4;async function kd(t,e){const n=await fetch(Zo(t,"glob"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pattern:e.pattern,path:e.dir,limit:wd})});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 Sd(t,e){const n=await so(t,pa(e,"package.json"));if(n.kind==="unavailable")throw new Error("package.json unavailable: sandbox not ready");const s=n.kind==="data"?fd(n.data):null;if(!s)return[];const a=pd(s,e),l=await Promise.all(a.map(async c=>({root:c,files:await kd(t,c)})));return bd(l)}function Pd(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?Sd(t,e):[],s[3]=e,s[4]=t,s[5]=l):l=s[5];const c=n&&!!t;let o;s[6]!==a||s[7]!==l||s[8]!==c?(o={queryKey:a,queryFn:l,enabled:c,staleTime:yd},s[6]=a,s[7]=l,s[8]=c,s[9]=o):o=s[9];const i=Nr(o);let d;return s[10]!==i.data?(d=i.data??[],s[10]=i.data,s[11]=d):d=s[11],d}const jd=500,Ed={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},wr=1,ln=["desktop","mobile","tablet"],Nd=["preview","visual","blocks"],yr={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Td(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 Cd(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 Rd(t,e){return!t||t.nav!==e.nav?!1:t.content!==e.content}function Ld(t,e,n){const s=t.toLowerCase(),a=e.toLowerCase(),l=a.split("/").filter(Boolean),c=i=>{if(i===n)return 100;const d=i.indexOf(n);if(d===-1)return 0;let m=40;return d===0?m+=30:/[\s/-]/.test(i[d-1]??"")&&(m+=20),m+=Math.round(n.length/i.length*20),m};let o=Math.max(c(s),c(a));return l.at(-1)===n?o=Math.max(o,95):l.includes(n)&&(o=Math.max(o,90)),o}function Ad(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function _d({virtualMcpId:t}){const e=Te(),n=Jr(),{currentBranch:s,taskId:a,virtualMcpId:l}=Mt(),c=!!Ti(),o=ea(),i=zi(l===t?t:null),d=Hr(t),m=el(i?.metadata?.ui?.layout??null),f=Zr(m),p=ua({contentEditingEnabled:f,isMobile:n}),[S]=j.useState(()=>Zc({cmsMode:m,isMobile:n})),[v,x]=Un(In.previewEditingMode(t),u=>u&&Nd.includes(u)?u:null),h=v??S,[b,T]=Un(In.previewDeviceSize(t),u=>u&&ln.includes(u)?u:"desktop"),[y,g]=j.useState(null),[N,E]=j.useState(null),k=j.useRef(null),P=j.useRef(null),[C,O]=j.useState(!1),R=j.useRef(null),A=()=>{R.current?.flush(),O(!1)},D=()=>O(u=>(u&&R.current?.flush(),!u)),[_,B]=j.useState({width:0,height:0}),[W,Z]=j.useState(!1),[G,J]=j.useState({}),[K,q]=j.useState(""),X=j.useRef(null),[L,M]=j.useState(!1),[U,H]=j.useState(),[F,z]=j.useState(null),[V,Q]=j.useState(null),[ne,se]=j.useState(null),[I,re]=j.useState(()=>o.state.target?.kind==="page"?o.state.target.path:"/"),[ae,ie]=j.useState(()=>o.state.target?.kind==="page"?o.state.target.key:null),[me,pe]=j.useState({}),[xe,he]=j.useState(!1),ve=j.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(),Me=Ut(),Ue=Me.vmEntry,Be=Re.lifecycle.phase,{url:vt}=qr(t),ge=fn(t,s),{connection:_e}=Gr(t),be=Go(t),Ie=ro({hasServeConnection:!!_e,runtime:d.runtime}),Le=!Xe(ge)&&ge.kind!=="pending",ee=He(ge)??vt,ce=ee??Me.previewUrl,We=!!ee||Be==="running",xt=i?.id===t?Vi(i.metadata):null,qe=!ee&&i?.id===t&&d.runtime==="cms",It=d.projectDefault==="cms",bt=Le?ao({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=Xr(ts,{fetchEnabled:We}),de=ns.data,Pe=pn.data,Ge=de?To(de,Pe).sort((u,w)=>u.name.localeCompare(w.name)):[],zt=t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s}:null,ss=zc(zt),ma=io(zt),mn=de&&Pe?Co(de,Pe):[],rs=Le&&de&&Pe?ki(Pe,de,"loaders"):[],as=K?(()=>{const u=K.toLowerCase();return Ge.map(w=>({page:w,score:Ld(w.name,w.path,u)})).filter(({score:w})=>w>0).sort((w,$)=>$.score-w.score||w.page.path.length-$.page.path.length).map(({page:w})=>w)})():Ge,is=mn.filter(u=>{if(!K)return!0;const w=K.toLowerCase();return u.name.toLowerCase().includes(w)||u.key.toLowerCase().includes(w)||u.resolveType.toLowerCase().includes(w)}),os=p?rs:[],ls=os.filter(u=>{if(!K)return!0;const w=K.toLowerCase();return u.title.toLowerCase().includes(w)||u.key.toLowerCase().includes(w)||u.resolveType.toLowerCase().includes(w)}),Kt=V?rs.find(u=>u.key===V)??null:null,Ee=Qn,hn=F||V?null:Ro(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 u=Si(Pe,"loaders"),w=oe?de[oe]:void 0,$=oc(w,de,ye=>u.has(ye)),te=nc($);for(const ye of Bt(I)){if(ye.type!=="param")continue;const Ne=Zl(I,ye.name,$),ot=ac(Ne,u,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?$o(de,oe,0):[],ds=Xe(ge),us=de?Pi(cs,de,ds):[],yt=us.map(u=>u.isSavedBlock?u.label:""),kt=us.map(u=>u.isSavedBlock?"global":u.isMultivariate?"variant":"normal"),St=cs.map(u=>Vn(u,de??{},ds)),st=j.useRef(null),Oe=j.useRef(null),ha=Re.status.state==="paused",vn=Re.phase,fs=ji({claimPhase:vn,lifecycle:Re.lifecycle}),Je=Me.previewState,ga=Me.userStopped,va=oo(le.slug,t??""),{url:ze}=Fo(qe&&t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s,previewServerUrl:xt??null,path:Ce}:null),xa=It&&d.runtime==="sandbox",Ae=lo(ge,Ie,be),ps=co(Ae&&qe&&ge.kind==="protocol"&&t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s}:null),ms=Ae?ps.pointer:null,Y=Cl({previewState:Je,progressStatus:fs.status,previewServerUrl:xt,fastPreviewActive:qe,fastPreviewReady:!!ze,codingSession:xa,localPreviewUrl:ee,hostedDraft:Ae,hostedPointerPending:Ae&&(ge.kind==="pending"||ps.pending)}),hs=Y.showWakingPill||Ae&&Y.mode==="production"&&!ms,Pt=Y.mode!=="none",ba=Y.mode==="production"&&Y.iframeBase?$t(Y.iframeBase):null,rt=Y.mode==="production"?ba:$t(ce),wa=i?.id===t&&i.metadata?.fastPreviewInPlace===!0,jt=Le?ee?Y.mode==="sandbox"&&p&&h==="blocks":Y.mode==="production"&&qe&&wa&&p&&h==="blocks":!1,gs=j.useRef(null),{pin:ya,effective:ka}=Cd(gs.current,{inPlaceRenderActive:jt,draftPreviewUrl:ze,resolvedPath:Ce});gs.current=ya;const vs=o.state.variantOverride??[],Vt=Le?vs:[],Et=Le?[]:vs,Wt=Xe(ge)&&Lo.some(u=>Ao(Pe,u)==="available"),at=Wt?G:{},xs=Wr(at),Sa=Wt&&de?Object.keys(_o(de).experiments):[],[bs,Pa]=j.useState(!1),ws=uo(zt,Wt&&bs?Oo:[]),ja={...ws,ready:!(ge.kind==="protocol"&&ge.hosted)||bs&&ws.ready},Ye=t?Js(le.slug,t):null,Ea=fo(Ye),qt=Ae?td({display:Y,path:Ce,pointer:ms,heldRevision:Ea,device:b,forcedVariants:Et,previewOptions:at}):null,ys=JSON.stringify([Et,at]);j.useEffect(()=>{if(!Ae||!Ye)return;const[u,w]=JSON.parse(ys);Ys(Ye,{forcedVariants:u,previewOptions:w})},[Ae,Ye,ys]),j.useEffect(()=>{if(!(!Ae||!Ye))return()=>Ys(Ye,null)},[Ae,Ye]);const xn=_e&&He(ge)?po(_e.endpoint,Et,xs):null,Na=_e&&He(ge)?xn?mo(xn,at):Qs:null,Qe=Td(Y.mode==="sandbox"?nn(Hn(Xs(ne??Bn(Ce,Y.iframeBase)??Y.iframeBase,Na),b),Vt):Y.mode==="production"&&qt?.frame?qt.frame:Y.mode==="production"?nn(Hn(Zs(er(Xs(ne??ka??Bn(Ce,Y.iframeBase)??Y.iframeBase,hs?Qs:null),Et),at),b),Vt):null),ks=ze??(Y.iframeBase?Bn(Ce,Y.iframeBase):null),Ss=Y.mode==="production"&&qt?qt.newTab:Y.mode==="production"?ks?nn(Zs(er(ks,Et),at),Vt):null:Qe??Y.iframeBase,Ta=()=>{const u=Ss;u&&window.open(u,"_blank","noopener")},Nt=t&&s?Ar(le.slug,t,s):null,Tt=u=>{Nt&&Ri(Nt,u)},ke=o.state.target;j.useEffect(()=>{if(!(!ke||!bt||!Pe))if(ke.kind==="page"){const u=me[ke.key]??{};Oe.current=Ve(ke.path,u),z(null),Q(null),se(null),ie(ke.key),re(ke.path),Tt({path:ke.path,pageKey:ke.key,params:u})}else if(ke.kind==="loader")Oe.current=null,z(null),Q(ke.key),se(null);else{const u=mn.find(w=>w.key===ke.key);if(u){Oe.current=null;const w=nr(Pe);Q(null),z(u),se(tr(bt,w,u.key))}}},[ke,bt,Pe,me]),j.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,Ca]=j.useState(null);if(Je.kind==="iframe"&&Ps!==Je.previewUrl){const u=Ps!==null;Ca(Je.previewUrl);const w=Nt?Lr(Nt):null;if(w){if(Oe.current=Ve(w.path,w.params),re(w.path),ie(w.pageKey),se(null),z(null),Q(null),w.pageKey&&Object.keys(w.params).length>0){const $=w.pageKey;pe(te=>({...te,[$]:w.params}))}}else u&&(Oe.current=null,re("/"),se(null),ie(null),z(null),Q(null))}st.current=Qe;const Ra=Y.mode==="production"&&!!ze&&!ee,[Gt,bn]=j.useState({src:Qe??void 0,loading:!1}),[La,wn]=j.useState(!1),[Aa,_a]=j.useState(),[js,Es]=j.useState(null),je=id(js,{base:Y.iframeBase??"",frameSrc:Gt.src,loadedSrc:Aa,wanted:Qe??void 0,canSwap:be&&La&&!Gt.loading});je!==js&&Es(je);const Jt=rd(Gt,je?je.src:Qe??void 0,Ra);Jt!==Gt&&bn(Jt);const it=Jt.src,Ns=Jt.loading,Ts=_l({iframeRef:k,src:Y.mode==="sandbox"?Qe:null,active:Y.mode==="sandbox"}),Cs=j.useRef(null);j.useEffect(()=>{const u=Ns?setTimeout(()=>bn(br),sd):null,w=()=>{u&&clearTimeout(u)};if(!ze||!it||Cs.current===ze)return w;Cs.current=ze;const $=k.current;return $&&$.getAttribute("src")!==it&&(Se(),$.src=it),w},[ze,it,Ns]);const Rs=()=>{const u=k.current?.contentWindow,w=rt;if(!u||!w||!de||!oe)return;const $=de[oe];if(!$||typeof $!="object")return;const te=bo({previewBaseUrl:w,pageBlock:$,decofile:de,path:Ce,pathTemplate:I});if(!te)return;const ye=nn(te.src,yo(Vt,oe));u.postMessage({type:"cms-editor::render",src:ye,body:te.body},w)},yn=j.useRef(null);j.useEffect(()=>{if(!jt||F||V||!oe||!de){yn.current=null;return}const u={nav:JSON.stringify({page:oe,path:Ce,pathTemplate:I}),content:JSON.stringify(de)},w=Rd(yn.current,u);yn.current=u,w&&Rs()},[de,jt,F,V,oe,Ce,I]);const kn=j.useRef(null);j.useEffect(()=>{if(!jt||F||V||!oe||!de){kn.current=null;return}const u=JSON.stringify(o.state.variantOverride??null),w=kn.current;kn.current={page:oe,sig:u},!(!w||w.page!==oe||w.sig===u)&&Rs()},[o.state.variantOverride,jt,F,V,oe]);const Ls=!!t&&!!s&&!Re.notFound&&!ga&&!ha&&(vn?.kind==="ready"||Be!=="idle"),As=!Xe(ge),Oa=Vr(t??void 0),Da=Pd(wt,Oa,As&&Ls),Fa=new Set(Ge.map(u=>Ee(u.path))),Yt=As?Da.filter(u=>!Fa.has(Ee(u))):[],_s=K?Yt.filter(u=>u.toLowerCase().includes(K.toLowerCase())):Yt,we=ed({editingMode:h,sandboxDisplay:Y.mode==="sandbox",blocksEditingEnabled:p});j.useEffect(()=>{const u=rt;if(!u)return;const w=$=>{if($.origin===u)if($.data?.type==="visual-editor::element-clicked"){const te=$l.safeParse($.data.payload);te.success&&g(te.data)}else if($.data?.type==="cms-editor::section-clicked"){const te=Ul.safeParse($.data.payload);te.success&&E({index:te.data.sectionIndex,seq:te.data.clickSeq})}else $.data?.type==="cms-editor::render-start"?Se():$.data?.type==="cms-editor::render-end"?(fe(),k.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:yt,kinds:kt,keys:St},u)):$.data?.type==="cms-editor::render-error"&&fe()};return window.addEventListener("message",w),()=>window.removeEventListener("message",w)},[rt,yt,kt,St]);const Os=()=>{const u=k.current?.contentWindow,w=$t(ce),$=Mc({v8:be,script:Bl});!u||!w||!$||u.postMessage($,w)},$a=()=>{if(be)return;const u=k.current?.contentWindow,w=$t(ce);!u||!w||u.postMessage({type:"visual-editor::deactivate"},w)},Ds=()=>{const u=Ke.current;u?.has("wireframe")&&(u.wireframe({type:"wireframe:sections",labels:yt,kinds:kt,keys:St}),u.wireframe({type:we==="blocks"?"wireframe:activate":"wireframe:deactivate"}))},Sn=()=>{if(be){Ds();return}const u=k.current?.contentWindow,w=rt,$=Bc({v8:be,production:Y.mode==="production",localPreview:!!ee,script:Il});!u||!w||!$||(u.postMessage($,w),u.postMessage({type:"cms-editor::set-labels",labels:yt,kinds:kt,keys:St},w))},Ba=()=>{if(be){Ke.current?.wireframe({type:"wireframe:deactivate"});return}const u=k.current?.contentWindow,w=rt;!u||!w||u.postMessage({type:"cms-editor::deactivate"},w)},Ma=()=>{if(Ke.current?.wireframe({type:"wireframe:clear-hover"}),be)return;const u=k.current?.contentWindow,w=rt;!u||!w||(u.postMessage({type:"cms-editor::clear-hover"},w),u.postMessage({type:"visual-editor::clear-hover"},w))},Qt=u=>{if(u==="blocks"&&!p)return;const w=h;!n&&u!==w&&(u==="blocks"?P.current?.resize("30%"):P.current?.collapse()),x(u),g(null),E(null),u!=="blocks"&&Q(null),w==="visual"&&$a(),u==="visual"&&Os(),w==="blocks"&&u!=="blocks"&&Ba(),u==="blocks"&&Sn()},Ua=()=>{Qt(Qc(h,p))},Ia=()=>{Qt(Xc(h,p))},Xt=()=>{const u=k.current;if(!u)return;Se();const w=document.activeElement,$=u.tabIndex;u.tabIndex=-1,u.style.pointerEvents="none",u.blur(),Ad(u,st.current);let te;const ye=()=>{clearTimeout(te),u.tabIndex=$,u.style.pointerEvents="";const Ne=document.activeElement;(!Ne||Ne===document.body||Ne===u)&&w?.focus(),u.removeEventListener("load",ye)};u.addEventListener("load",ye),te=setTimeout(ye,3e3)};Mo(Xt);const Ke=j.useRef(null),Fs=j.useEffectEvent(Ds),za=j.useEffectEvent((u,w)=>{E({index:u,seq:w})}),Ka=j.useEffectEvent(()=>{fe(),je&&(Pn.current=je.shown),Rt&&An(Ct)}),$s=j.useEffectEvent(()=>{if(wn(!1),je&&Es(null),je&&je.src!==st.current){Se();return}Xt()});j.useEffect(()=>{if(!be)return;const u=new Wl({studioOrigin:window.location.origin,build:"4.565.0",frame:()=>k.current?.contentWindow??null,onWireframeReady:()=>Fs(),onWireframe:$=>{$.type==="wireframe:select"&&za($.sectionIndex,$.clickSeq)},onModulesChange:()=>wn(u.has("html-swap")),onSwapEnd:()=>Ka(),onSwapFailed:()=>$s()});Ke.current=u;const w=$=>{u.handle($)};return window.addEventListener("message",w),()=>{window.removeEventListener("message",w),u.dispose(),wn(!1),Ke.current===u&&(Ke.current=null)}},[be,Y.iframeBase]);const Bs=be?JSON.stringify([yt,kt,St,we]):"";j.useEffect(()=>{Bs&&Fs()},[Bs]);const Ms=j.useRef(null);j.useEffect(()=>{const u=Ms.current;if(Ms.current=je,je&&je!==u){Ke.current?.refresh(je.shown)?Se():$s();return}!je&&u&&u.shown!==u.src&&u.src===st.current&&Xt()},[je]);const Us=()=>{Ke.current?.refresh()||Xt()},Ct=Js(le.slug,t??""),Rt=Ae&&Pt&&!!t,Pn=j.useRef(null);j.useEffect(()=>{if(Rt)return ho(Ct)},[Rt,Ct]);const{reload:Lt}=go(le.slug,t??""),Is=j.useRef(Lt.seq);j.useEffect(()=>{if(Is.current!==Lt.seq&&(Is.current=Lt.seq,!!Rt&&Pn.current===st.current)){if(Lt.navigates){An(Ct);return}Us()}},[Lt.seq]);const Ha=vo(zt),At=xo(He(ge)?Ha:""),zs=j.useRef(At);j.useEffect(()=>{const u=zs.current;if(zs.current=At,!u||!At||u===At)return;const w=k.current;if(w)return Fl({iframe:w,reload:Us})},[At]);const Va=()=>{const u=ln.indexOf(b);T(ln[(u+1)%ln.length])},jn=(u,w)=>{if(!oe)return;const $=oe,te={...nt,[u]:w};Oe.current=Ve(I,te),pe(ye=>({...ye,[$]:te})),Tt({path:I,pageKey:$,params:te})},Wa=Dc({iframeBase:Y.iframeBase,resolvedPath:Ce,activeGlobalSectionName:F?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),En=u=>{const w=me[u.key]??{},$=Ve(u.path,w);(F||Ee($)!==Ee(Ce))&&Se(),Oe.current=$,z(null),Q(null),se(null),E(null),ie(u.key),re(u.path),Tt({path:u.path,pageKey:u.key,params:w}),o.selectTarget({kind:"page",key:u.key,path:u.path})},Ks=u=>{(F||Ee(u)!==Ee(Ce))&&Se(),Oe.current=u,z(null),Q(null),se(null),E(null),ie(null),re(u),Tt({path:u,pageKey:null,params:{}})};Ci(Nt,Ks);const qa=u=>{if(Xe(ge)){const te=de?Do(de,u.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 w=nr(Pe),$=tr(bt,w,u.key);z(u),Q(null),se($),E(null),o.selectTarget({kind:"section",key:u.key})},Ga=u=>{p&&(z(null),Q(u.key),se(null),Qt("blocks"),o.selectTarget({kind:"loader",key:u.key}))},Ja=async({name:u,path:w,templateKey:$})=>{if(!t||!s)return;const te=Qr(w);if(te){H(te);return}const ye=w.trim().startsWith("/")?w.trim():`/${w.trim()}`;if(Ge.some(Ne=>Ee(Ne.path)===Ee(ye))){H(e("sandbox.preview.pageAlreadyExists",{path:ye}));return}H(void 0);try{const Ne=$?await ma(de,$):void 0;if($&&!Ne){H(e("sandbox.preview.templateNoLongerExists"));return}const ot=await ss.mutateAsync({name:u,path:ye,template:Ne,schema:Xe(ge)?{meta:Pe,loadMeta:async()=>(await pn.refetch()).data}:void 0});M(!1),dn.success(e("sandbox.preview.pageCreated",{name:u})),await nl(jd),En({key:ot.key,name:ot.name,path:ot.path}),Qt("blocks")}catch(Ne){H(Ne instanceof da?e("sandbox.preview.pageSchemaNotReady"):Ne instanceof Error?Ne.message:e("sandbox.preview.failedToCreatePage"))}},Zt=Fc({previewSurfaceActive:Pt,daemonReady:Ls,production:Y.mode==="production",servePreviewUrl:He(ge)}),Ya=$c({showPreviewToolbar:Zt,contentEditingEnabled:f}),_t=()=>{Z(!1),q("")},Nn=F?.name??Kt?.title??hn?.name,Tn=ns.isPending||pn.isPending,Cn=Tn?$t(Y.iframeBase):Nn,Ot=F?`section:${F.key}`:V?`loader:${V}`:oe?`page:${oe}`:Yt.includes(Ee(I))?`route:${Ee(I)}`:void 0,Qa=Zt?Ya?r.jsxs(Mr,{open:W,onOpenChange:u=>{Z(u),u||q("")},children:[r.jsx($r,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":e("sandbox.preview.choosePage"),"data-testid":"preview-page-picker",title:Tn?Cn??void 0:F||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:[F&&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(Fi,{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($i,{size:11}),e("sandbox.preview.loaderBadge")]}),Cn&&r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:Cn}),!Tn&&!F&&!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(Li,{size:12,className:Fe("shrink-0 transition-transform",W&&"rotate-180")})]})})}),r.jsxs(Br,{className:"w-112 max-w-[calc(100vw-2rem)] p-0",align:"center",sideOffset:8,children:[r.jsxs(Ir,{shouldFilter:!1,defaultValue:Ot,children:[r.jsx(zr,{value:K,onValueChange:u=>{q(u),X.current?.scrollTo({top:0})},placeholder:e("sandbox.preview.searchPagesAndComponents")}),r.jsxs(Ur,{ref:X,className:"max-h-80",children:[r.jsx(Kr,{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(u=>r.jsxs(ut,{value:`page:${u.key}`,"aria-current":Ot===`page:${u.key}`||void 0,title:`${u.name} · ${u.path}`,onSelect:()=>{_t(),En(u)},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:u.name}),r.jsx("span",{className:"min-w-0 max-w-1/2 truncate text-right font-mono text-xs text-muted-foreground",children:u.path})]},u.key))}),_s.length>0&&r.jsx(dt,{heading:e("sandbox.preview.siteRoutes"),children:_s.map(u=>r.jsx(ut,{value:`route:${u}`,"aria-current":Ot===`route:${u}`||void 0,title:u,onSelect:()=>{_t(),Ks(u)},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:u})},u))}),is.length>0&&r.jsx(dt,{heading:e("sandbox.preview.globalComponents"),children:is.map(u=>r.jsx(ut,{value:`section:${u.key}`,"aria-current":Ot===`section:${u.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{_t(),qa(u)},children:r.jsx("span",{className:"truncate",children:u.name})},u.key))}),ls.length>0&&r.jsx(dt,{heading:e("sandbox.preview.globalLoaders"),children:ls.map(u=>r.jsx(ut,{value:`loader:${u.key}`,"aria-current":Ot===`loader:${u.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{_t(),Ga(u)},children:r.jsx("span",{className:"truncate",children:u.title})},u.key))})]})]}),!F&&!V&&Bt(I).some(u=>u.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((u,w)=>{if(u.type==="text")return r.jsx("span",{children:u.text},`text-${w}`);const $=gn[u.name];return $&&wt?r.jsx(kc,{sources:$,template:I,paramName:u.name,value:nt[u.name]??"",sandboxRef:wt,onCommit:te=>jn(u.name,te)},`${oe}:${u.name}`):r.jsx(_c,{name:u.name,value:nt[u.name]??"",onCommit:te=>jn(u.name,te)},`${oe}:${u.name}`)})}),r.jsx("div",{className:"border-t p-1.5",children:r.jsxs($e,{variant:"ghost",className:"w-full justify-start",onClick:()=>{_t(),H(void 0),M(!0)},children:[r.jsx(Fr,{size:16}),e("sandbox.preview.createNewPage")]})})]})]}):r.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:Wa}):null,Hs=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:Va,"aria-label":e(yr[b]),children:b==="mobile"?r.jsx(Or,{size:16}):b==="tablet"?r.jsx(Bi,{size:16}):r.jsx(Dr,{size:16})})}),r.jsx(mt,{children:e(yr[b])})]}),Qa,r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Wt&&r.jsx(nd,{tests:Sa,load:ja,onOpen:()=>Pa(!0),options:G,onChange:u=>{J(u),o.previewAsChanged()},available:!!xn||!hs||!xs}),r.jsx(Ze,{onClick:Ta,disabled:Ae&&!Ss,"aria-label":e("sandbox.preview.openInNewTab"),children:r.jsx(Tr,{size:16})})]})]}):null,Xa=(Le||c)&&Y.mode==="sandbox",en=Ed[b],tn=b==="desktop"&&(_.width===0||_.width>=en.width+2*wr),Vs=tn?1:Math.min(_.width>0?_.width/(en.width+2*wr):1,1),Za=tn?{width:"100%",height:"100%"}:{width:`${en.width}px`,height:_.height>0?`${_.height/Vs}px`:`${en.height}px`,transform:`scale(${Vs})`,transformOrigin:"top center"},Ws=r.jsxs(r.Fragment,{children:[Xa&&(Zt||f)&&r.jsx(Ze,{onClick:Ua,"aria-pressed":we==="visual","aria-label":e("sandbox.preview.visualEditor"),active:we==="visual",children:r.jsx(Gs,{size:16})}),p&&r.jsxs(ht,{children:[r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{onClick:Ia,"aria-pressed":we==="blocks","aria-label":e("sandbox.preview.blocksEditor"),active:we==="blocks",children:r.jsx(Ui,{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":C,"aria-label":e("sectionsEditor.sectionsEditor.viewJson"),active:C,children:r.jsx(Mi,{size:16})})}),r.jsx(mt,{children:e("sectionsEditor.sectionsEditor.viewJson")})]})]}),ei=!!V&&we==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[wt&&Object.entries(gn).map(([u,w])=>(nt[u]??"")===""?r.jsx(Lc,{sources:w,template:I,paramName:u,sandboxRef:wt,onFill:$=>jn(u,$)},`${oe}:${u}`):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:Hs}),children:Hs}),r.jsx(zn.Toolbar.Right.Portal,{fallback:Ws,children:Ws})]}),r.jsx("div",{className:"flex-1 overflow-hidden relative",children:ei?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(vr,{virtualMcpId:t,externalSelection:N,onViewJsonFile:D}),C&&tt&&r.jsx("div",{className:"absolute inset-0 z-10",children:r.jsx(xr,{ref:R,virtualMcpId:t,pageKey:tt,onClose:A})})]}):r.jsxs(sr,{orientation:"horizontal",disabled:we!=="blocks",className:"relative isolate",children:[r.jsx(sn,{ref:P,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(vr,{virtualMcpId:t,externalSelection:N,onViewJsonFile:D})}),we==="blocks"&&r.jsx(rr,{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(sr,{orientation:"horizontal",disabled:!(C&&tt),children:[r.jsx(sn,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:u=>{if(!u)return;const w=()=>B(te=>te.width===u.clientWidth&&te.height===u.clientHeight?te:{width:u.clientWidth,height:u.clientHeight});w();const $=new ResizeObserver(w);return $.observe(u),()=>$.disconnect()},className:Fe("h-full relative overflow-clip flex justify-center",Pt&&!tn&&"bg-muted/30"),children:[(xe||va)&&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"})}),Y.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"})}),Y.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"starting",progress:fs,claimPhase:vn})}),!ee&&Je.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"suspended",onResume:Me.resume})}),!ee&&Je.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"errored",error:Je.error,onRetry:Me.retry,connectionsHref:`/${le.slug}/settings/connections`})}),Y.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"&&!y&&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(Gs,{size:12}),e("sandbox.preview.clickElementToAsk")]}),we==="visual"&&y&&r.jsx(Yl,{element:y,onDismiss:()=>g(null)}),Pt&&Qe&&r.jsx("div",{className:Fe("shrink-0",!tn&&"bg-background shadow-edge"),style:Za,onMouseLeave:Ma,children:r.jsx("iframe",{ref:k,src:it,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Ts.handleError,onLoad:()=>{if(bn(br),_a(it),Ts.handleLoad(),fe(),Pn.current=st.current,Rt&&An(Ct),Y.mode!=="sandbox"||ee){(Y.mode==="production"&&!Y.showWakingPill||ee)&&we==="blocks"&&Sn();return}if(ui("vm_preview_loaded",{view_mode:we,vm_id:Ue?.sandboxHandle??null}),!F)try{const u=k.current?.contentWindow?.location?.pathname;if(!u)return;const w=Oe.current;if(w!==null&&(Oe.current=null,Ee(u)!==Ee(w))||Ee(u)===Ee(Ce))return;re(u),Tt({path:u,pageKey:ae,params:nt})}catch{}we==="visual"&&Os(),we==="blocks"&&Sn()}},Y.iframeBase)})]})}),C&&tt&&r.jsxs(r.Fragment,{children:[r.jsx(rr,{withHandle:!0}),r.jsx(sn,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:r.jsx(xr,{ref:R,virtualMcpId:t,pageKey:tt,onClose:A})})]})]})})]})}),r.jsx(Kc,{open:L,onOpenChange:M,isPending:ss.isPending,error:U,templates:Ge,onSubmit:Ja})]})}const qn={app:null,split:!1};function Od(t){const e=ue.c(24),{project:n,maxApps:s,children:a}=t,l=Te();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={silent:!0},e[0]=c):c=e[0];const o=Ki(c),i=Ut();let d;e[1]!==n.metadata.runtime?(d=n.metadata.runtime??{},e[1]=n.metadata.runtime,e[2]=d):d=e[2];const m=d;let f;e[3]!==m.apps?(f=m.apps??[],e[3]=m.apps,e[4]=f):f=e[4];const p=f;let S;e[5]!==o.update||e[6]!==i||e[7]!==n.id||e[8]!==n.metadata||e[9]!==m||e[10]!==l?(S=y=>o.update.mutate({id:n.id,data:{metadata:{...sl(n.metadata),runtime:{...m,apps:y.length?y: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]=S):S=e[11];const v=S,x=m.path??null;let h,b;e[12]!==p||e[13]!==v?(h=y=>v([...p,{path:y}]),b=y=>v(p.filter(g=>g.path!==y)),e[12]=p,e[13]=v,e[14]=h,e[15]=b):(h=e[14],b=e[15]);let T;return e[16]!==p||e[17]!==a||e[18]!==s||e[19]!==n.id||e[20]!==x||e[21]!==h||e[22]!==b?(T=r.jsx(Dd,{virtualMcpId:n.id,mainPath:x,apps:p,maxApps:s,onAddApp:h,onRemoveApp:b,children:a}),e[16]=p,e[17]=a,e[18]=s,e[19]=n.id,e[20]=x,e[21]=h,e[22]=b,e[23]=T):T=e[23],T}function Dd(t){const e=ue.c(102),{virtualMcpId:n,mainPath:s,apps:a,maxApps:l,onAddApp:c,onRemoveApp:o,children:i}=t,d=Te(),m=Jr(),{currentBranch:f}=Mt(),p=Ut(),S=Xn().lifecycle.phase,v=fn(n,f),{url:x}=qr(n);let h;e[0]!==v||e[1]!==x?(h=He(v)??x,e[0]=v,e[1]=x,e[2]=h):h=e[2];const b=h,T=b??p.previewUrl,y=!!b||S==="running",g=!y&&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 E=N;let k;e[5]!==n?(k=In.previewAppLayout(n),e[5]=n,e[6]=k):k=e[6];const[P,C]=Un(k,Fd);let O;e[7]!==a||e[8]!==P?(O=a.some(fe=>fe.path===P.app)?P.app:null,e[7]=a,e[8]=P,e[9]=O):O=e[9];const R=O,A=R!==null&&P.split&&!m,D=R===null||A,_=R??a[0]?.path??null,[B,W]=j.useState(null),[Z,G]=j.useState(!1);let J;e[10]===Symbol.for("react.memo_cache_sentinel")?(J=()=>{W(null),G(!1)},e[10]=J):J=e[10];const K=J;let q;e[11]!==a||e[12]!==B||e[13]!==m||e[14]!==s||e[15]!==c||e[16]!==C?(q=()=>{if(B===null)return;const fe=or(B);if(!fe){K();return}if(fe===or(s??"")||a.some(le=>le.path===fe)){G(!0);return}c(fe),C({app:fe,split:!m}),K()},e[11]=a,e[12]=B,e[13]=m,e[14]=s,e[15]=c,e[16]=C,e[17]=q):q=e[17];const X=q;let L;e[18]!==s||e[19]!==d?(L=s?_n(s):d("sandbox.appTabs.root"),e[18]=s,e[19]=d,e[20]=L):L=e[20];const M=L;let U;e[21]!==A||e[22]!==d?(U=d(A?"sandbox.appTabs.single":"sandbox.appTabs.split"),e[21]=A,e[22]=d,e[23]=U):U=e[23];const H=U;let F;e[24]!==d?(F=d("sandbox.appTabs.label"),e[24]=d,e[25]=F):F=e[25];let z;e[26]!==d?(z=d("sandbox.appTabs.main"),e[26]=d,e[27]=z):z=e[27];let V;e[28]!==d?(V=d("sandbox.appTabs.mainHint"),e[28]=d,e[29]=V):V=e[29];let Q;e[30]!==C?(Q=()=>C(qn),e[30]=C,e[31]=Q):Q=e[31];let ne;e[32]!==g||e[33]!==M||e[34]!==y||e[35]!==D||e[36]!==z||e[37]!==V||e[38]!==Q?(ne=r.jsx(kr,{label:M,badge:z,hint:V,ready:y,failed:g,onScreen:D,onSelect:Q}),e[32]=g,e[33]=M,e[34]=y,e[35]=D,e[36]=z,e[37]=V,e[38]=Q,e[39]=ne):ne=e[39];let se;if(e[40]!==a||e[41]!==R||e[42]!==g||e[43]!==M||e[44]!==o||e[45]!==y||e[46]!==C||e[47]!==A||e[48]!==d){let fe;e[50]!==R||e[51]!==g||e[52]!==M||e[53]!==o||e[54]!==y||e[55]!==C||e[56]!==A||e[57]!==d?(fe=le=>{const Re=_n(le.path);return r.jsx(kr,{label:Re,hint:d("sandbox.appTabs.extraHint",{app:M}),ready:y,failed:g,onScreen:le.path===R,onSelect:()=>C({app:le.path,split:A}),onRemove:()=>o(le.path),removeLabel:d("sandbox.appTabs.remove",{app:Re})},le.path)},e[50]=R,e[51]=g,e[52]=M,e[53]=o,e[54]=y,e[55]=C,e[56]=A,e[57]=d,e[58]=fe):fe=e[58],se=a.map(fe),e[40]=a,e[41]=R,e[42]=g,e[43]=M,e[44]=o,e[45]=y,e[46]=C,e[47]=A,e[48]=d,e[49]=se}else se=e[49];let I;e[59]!==ne||e[60]!==se||e[61]!==F?(I=r.jsxs("div",{role:"tablist","aria-label":F,className:"flex min-w-0 items-center gap-1 overflow-x-auto",children:[ne,se]}),e[59]=ne,e[60]=se,e[61]=F,e[62]=I):I=e[62];let re;e[63]!==a.length||e[64]!==X||e[65]!==B||e[66]!==Z||e[67]!==l||e[68]!==d?(re=B!==null?r.jsx("form",{className:"w-40 shrink-0",onSubmit:fe=>{fe.preventDefault(),X()},children:r.jsx("input",{autoFocus:!0,value:B,placeholder:"apps/checkout","aria-label":d("sandbox.appTabs.pathLabel"),"aria-invalid":Z,onChange:fe=>{W(fe.target.value),G(!1)},onBlur:K,onKeyDown:fe=>{fe.key==="Escape"&&K()},className:Fe("h-7 w-full rounded-md border bg-background px-2 font-mono text-xs outline-none",Z?"border-destructive":"border-border")})}):a.length<l&&r.jsx(ft,{label:d("sandbox.appTabs.add"),onClick:()=>W(""),children:r.jsx(Fr,{})}),e[63]=a.length,e[64]=X,e[65]=B,e[66]=Z,e[67]=l,e[68]=d,e[69]=re):re=e[69];let ae;e[70]!==m||e[71]!==C||e[72]!==A||e[73]!==H||e[74]!==_?(ae=!m&&_&&r.jsx(ft,{label:H,active:A,onClick:()=>C(A?qn:{app:_,split:!0}),children:r.jsx(Ii,{})}),e[70]=m,e[71]=C,e[72]=A,e[73]=H,e[74]=_,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]!==R||e[86]!==g||e[87]!==p.start||e[88]!==b||e[89]!==M||e[90]!==T||e[91]!==y||e[92]!==C||e[93]!==A||e[94]!==E?(he=R!==null&&r.jsx($d,{name:_n(R),mainName:M,appUrl:T?rl(T,R):null,ready:y,failed:g,notStarted:!b&&!E.includes(R),onStart:p.start,className:Fe(A&&"border-l border-border"),onClose:A?()=>C({app:R,split:!1}):void 0},R),e[85]=R,e[86]=g,e[87]=p.start,e[88]=b,e[89]=M,e[90]=T,e[91]=y,e[92]=C,e[93]=A,e[94]=E,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 Fd(t){return t??qn}function kr(t){const e=ue.c(28),{label:n,badge:s,hint:a,ready:l,failed:c,onScreen:o,onSelect:i,onRemove:d,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 S=l?"bg-success":c?"bg-destructive":"animate-pulse bg-warning";let v;e[2]!==S?(v=Fe("size-1.5 rounded-full",S),e[2]=S,e[3]=v):v=e[3];let x;e[4]!==v?(x=r.jsx("span",{"aria-hidden":!0,className:v}),e[4]=v,e[5]=x):x=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 b;e[8]!==s?(b=s&&r.jsx("span",{className:"text-[10px] text-muted-foreground",children:s}),e[8]=s,e[9]=b):b=e[9];let T;e[10]!==o||e[11]!==i||e[12]!==x||e[13]!==h||e[14]!==b?(T=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:[x,h,b]})}),e[10]=o,e[11]=i,e[12]=x,e[13]=h,e[14]=b,e[15]=T):T=e[15];let y;e[16]!==a?(y=r.jsx(mt,{className:"max-w-64",children:a}),e[16]=a,e[17]=y):y=e[17];let g;e[18]!==T||e[19]!==y?(g=r.jsxs(ht,{children:[T,y]}),e[18]=T,e[19]=y,e[20]=g):g=e[20];let N;e[21]!==d||e[22]!==m?(N=d&&r.jsx("button",{type:"button","aria-label":m,onClick:d,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(na,{className:"size-3"})}),e[21]=d,e[22]=m,e[23]=N):N=e[23];let E;return e[24]!==g||e[25]!==N||e[26]!==p?(E=r.jsxs("div",{className:p,children:[g,N]}),e[24]=g,e[25]=N,e[26]=p,e[27]=E):E=e[27],E}function $d(t){const e=ue.c(71),{name:n,mainName:s,appUrl:a,ready:l,failed:c,notStarted:o,onStart:i,className:d,onClose:m}=t,f=Te(),[p,S]=j.useState("/"),[v,x]=j.useState("desktop"),[h,b]=j.useState(0),T=j.useRef(null);let y;e[0]!==a||e[1]!==p?(y=a?al(a,p):null,e[0]=a,e[1]=p,e[2]=y):y=e[2];const g=y;let N;e[3]!==d?(N=Fe("flex min-h-0 min-w-0 flex-1 flex-col",d),e[3]=d,e[4]=N):N=e[4];let E;e[5]===Symbol.for("react.memo_cache_sentinel")?(E=V=>{V.preventDefault(),S(T.current?.value||"/")},e[5]=E):E=e[5];let k;e[6]!==n||e[7]!==f?(k=f("sandbox.appPane.path",{app:n}),e[6]=n,e[7]=f,e[8]=k):k=e[8];let P;e[9]!==p||e[10]!==k?(P=r.jsx("form",{className:"min-w-0 flex-1",onSubmit:E,children:r.jsx("input",{ref:T,defaultValue:p,"aria-label":k,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]=k,e[11]=P):P=e[11];let C;e[12]!==v||e[13]!==f?(C=f(v==="desktop"?"sandbox.preview.deviceMobile":"sandbox.preview.deviceDesktop"),e[12]=v,e[13]=f,e[14]=C):C=e[14];let O;e[15]===Symbol.for("react.memo_cache_sentinel")?(O=()=>x(Md),e[15]=O):O=e[15];let R;e[16]!==v?(R=v==="desktop"?r.jsx(Dr,{}):r.jsx(Or,{}),e[16]=v,e[17]=R):R=e[17];let A;e[18]!==C||e[19]!==R?(A=r.jsx(ft,{label:C,onClick:O,children:R}),e[18]=C,e[19]=R,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 _=!g||!l;let B,W;e[24]===Symbol.for("react.memo_cache_sentinel")?(B=()=>b(Bd),W=r.jsx(fi,{}),e[24]=B,e[25]=W):(B=e[24],W=e[25]);let Z;e[26]!==D||e[27]!==_?(Z=r.jsx(ft,{label:D,disabled:_,onClick:B,children:W}),e[26]=D,e[27]=_,e[28]=Z):Z=e[28];let G;e[29]!==n||e[30]!==f?(G=f("sandbox.appPane.openInNewTab",{app:n}),e[29]=n,e[30]=f,e[31]=G):G=e[31];const J=!g||!l;let K;e[32]!==g?(K=()=>g&&window.open(g,"_blank","noopener"),e[32]=g,e[33]=K):K=e[33];let q;e[34]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx(Tr,{}),e[34]=q):q=e[34];let X;e[35]!==G||e[36]!==J||e[37]!==K?(X=r.jsx(ft,{label:G,disabled:J,onClick:K,children:q}),e[35]=G,e[36]=J,e[37]=K,e[38]=X):X=e[38];let L;e[39]!==n||e[40]!==m||e[41]!==f?(L=m&&r.jsx(ft,{label:f("sandbox.appPane.close",{app:n}),onClick:m,children:r.jsx(na,{})}),e[39]=n,e[40]=m,e[41]=f,e[42]=L):L=e[42];let M;e[43]!==Z||e[44]!==X||e[45]!==L||e[46]!==P||e[47]!==A?(M=r.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-border px-2",children:[P,A,Z,X,L]}),e[43]=Z,e[44]=X,e[45]=L,e[46]=P,e[47]=A,e[48]=M):M=e[48];let U;e[49]!==s||e[50]!==f?(U=f("sandbox.appPane.previewOnly",{app:s}),e[49]=s,e[50]=f,e[51]=U):U=e[51];let H;e[52]!==U?(H=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:U}),e[52]=U,e[53]=H):H=e[53];let F;e[54]!==v||e[55]!==c||e[56]!==s||e[57]!==n||e[58]!==o||e[59]!==i||e[60]!==l||e[61]!==h||e[62]!==g||e[63]!==f?(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||!g?r.jsx("p",{className:"self-center px-6 text-center text-sm text-muted-foreground",children:l?f("sandbox.appPane.noUrl"):c?f("sandbox.appPane.failed",{app:s}):f("sandbox.appPane.waiting")}):r.jsx("iframe",{src:g,title:n,className:Fe("h-full bg-background",v==="mobile"?"w-[412px] max-w-full border-x border-border":"w-full")},`${g}#${h}`)}),e[54]=v,e[55]=c,e[56]=s,e[57]=n,e[58]=o,e[59]=i,e[60]=l,e[61]=h,e[62]=g,e[63]=f,e[64]=F):F=e[64];let z;return e[65]!==n||e[66]!==N||e[67]!==M||e[68]!==H||e[69]!==F?(z=r.jsxs("section",{"aria-label":n,className:N,children:[M,H,F]}),e[65]=n,e[66]=N,e[67]=M,e[68]=H,e[69]=F,e[70]=z):z=e[70],z}function Bd(t){return t+1}function Md(t){return t==="desktop"?"mobile":"desktop"}function ft(t){const e=ue.c(11),{label:n,children:s,active:a,disabled:l,onClick:c}=t;let o;e[0]!==a||e[1]!==s||e[2]!==l||e[3]!==n||e[4]!==c?(o=r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{"aria-label":n,"aria-pressed":a,active:a,disabled:l,onClick:c,children:s})}),e[0]=a,e[1]=s,e[2]=l,e[3]=n,e[4]=c,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 d;return e[8]!==o||e[9]!==i?(d=r.jsxs(ht,{children:[o,i]}),e[8]=o,e[9]=i,e[10]=d):d=e[10],d}const Ud=async(t,e)=>{try{return await fetch(t,{method:"HEAD",mode:"no-cors",cache:"no-store",credentials:"omit",signal:e}),!0}catch{return!1}},Id=1e4,zd=1e4,Kd=5e3,Hd=2;function Vd(t,e){return t&&e===0?zd:Math.min(1e3*2**Math.max(0,e-1),Kd)}function Wd(t,e,n){return e?!0:t===!0&&n<Hd}function qd(t,e){const n=ue.c(11),s=Ud,a=pi();let l;n[0]!==t?(l=Gn.localAppReachable(t??""),n[0]=t,n[1]=l):l=n[1];const c=l;let o;n[2]!==s||n[3]!==a||n[4]!==c||n[5]!==t?(o=async f=>{const{signal:p}=f,S=new AbortController,v=()=>S.abort();p.addEventListener("abort",v);const x=setTimeout(v,Id),h=await s(t,S.signal).catch(Jd);clearTimeout(x),p.removeEventListener("abort",v);const b=a.getQueryData(c),T=h?0:(b?.failures??0)+1;return{up:Wd(b?.up??null,h,T),failures:T}},n[2]=s,n[3]=a,n[4]=c,n[5]=t,n[6]=o):o=n[6];const i=!!t;let d;n[7]!==c||n[8]!==o||n[9]!==i?(d={queryKey:c,queryFn:o,enabled:i,retry:!1,staleTime:0,gcTime:0,refetchInterval:Gd},n[7]=c,n[8]=o,n[9]=i,n[10]=d):d=n[10];const{data:m}=Nr(d);return t?m?.up??null:null}function Gd(t){return t.state.data?Vd(t.state.data.up,t.state.data.failures):!1}function Jd(){return!1}function Yd(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 Gu(t){const e=ue.c(53),{virtualMcpId:n}=t,s=Te(),a=Hi(n),{connection:l}=Gr(n),{activeTask:c,taskId:o,currentBranch:i}=Mt(),d=pl(o),[m,f]=j.useState(!1),p=fn(n,i);let S;e[0]!==p||e[1]!==l?(S=l?He(p):null,e[0]=p,e[1]=l,e[2]=S):S=e[2];const v=S,x=qd(v),h=ra(),b=il("multi_app_preview");if(cl({threadId:o,sandboxBranch:c?.branch??i,agentHasRepo:On(a?.metadata),threadHasRepo:On(d)||On(c?.metadata)})==="none"&&!l){let E;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(lr,{className:"size-7 text-foreground"})}),e[3]=E):E=e[3];let k;e[4]!==s?(k=s("mainPanelTabs.previewTab.noSourceToPreview"),e[4]=s,e[5]=k):k=e[5];let P;e[6]!==s?(P=s("mainPanelTabs.previewTab.connectGithubDescription"),e[6]=s,e[7]=P):P=e[7];let C,O;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=()=>f(!0),O=r.jsx(lr,{className:"size-4"}),e[8]=C,e[9]=O):(C=e[8],O=e[9]);let R;e[10]!==s?(R=s("mainPanelTabs.previewTab.connectGithub"),e[10]=s,e[11]=R):R=e[11];let A;e[12]!==R?(A=r.jsxs($e,{onClick:C,children:[O,R]}),e[12]=R,e[13]=A):A=e[13];let D;e[14]!==k||e[15]!==P||e[16]!==A?(D=r.jsx(ol,{className:"h-full",image:E,title:k,description:P,actions:A}),e[14]=k,e[15]=P,e[16]=A,e[17]=D):D=e[17];let _;e[18]!==m?(_=r.jsx(ll,{open:m,onOpenChange:f,mode:"agent"}),e[18]=m,e[19]=_):_=e[19];let B;return e[20]!==_||e[21]!==D?(B=r.jsxs(r.Fragment,{children:[D,_]}),e[20]=_,e[21]=D,e[22]=B):B=e[22],B}if(l&&a&&!He(p)){let E;e[23]!==h||e[24]!==p?(E=Yd({backend:p,access:h}),e[23]=h,e[24]=p,e[25]=E):E=e[25];let k;e[26]!==l.endpoint?(k=wo(l.endpoint),e[26]=l.endpoint,e[27]=k):k=e[27];let P;return e[28]!==E||e[29]!==k?(P=r.jsx(Xd,{status:E,host:k}),e[28]=E,e[29]=k,e[30]=P):P=e[30],P}if(v&&x!==!0){let E;e[31]!==s?(E=s("mainPanelTabs.previewTab.localAppWaiting.title"),e[31]=s,e[32]=E):E=e[32];let k;e[33]!==v||e[34]!==s?(k=s("mainPanelTabs.previewTab.localAppWaiting.body",{host:Qd(v)}),e[33]=v,e[34]=s,e[35]=k):k=e[35];let P;e[36]!==k?(P=r.jsx(ta,{text:k}),e[36]=k,e[37]=P):P=e[37];let C;e[38]!==s?(C=s("mainPanelTabs.previewTab.localAppWaiting.hint"),e[38]=s,e[39]=C):C=e[39];let O;e[40]!==C?(O=r.jsx("p",{role:"status",className:"text-center text-sm text-muted-foreground",children:C}),e[40]=C,e[41]=O):O=e[41];let R;return e[42]!==E||e[43]!==P||e[44]!==O?(R=r.jsx(un,{headingLevel:2,waiting:!0,title:E,lead:P,footer:O}),e[42]=E,e[43]=P,e[44]=O,e[45]=R):R=e[45],R}let y;e[46]!==n?(y=r.jsx(_d,{virtualMcpId:n}),e[46]=n,e[47]=y):y=e[47];const g=y;let N;return e[48]!==a||e[49]!==b||e[50]!==g||e[51]!==l?(N=r.jsx(Ei,{children:b&&a&&!l?r.jsx(Od,{project:a,maxApps:tl,children:g}):g}),e[48]=a,e[49]=b,e[50]=g,e[51]=l,e[52]=N):N=e[52],N}function Qd(t){try{return new URL(t).host}catch{return t}}function Xd(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 d;return e[4]!==o||e[5]!==i?(d=r.jsx(un,{headingLevel:2,waiting:!1,title:o,lead:i}),e[4]=o,e[5]=i,e[6]=d):d=e[6],d}let l;e[7]!==s||e[8]!==n?(l=xl(n,s),e[7]=s,e[8]=n,e[9]=l):l=e[9];let c;return e[10]!==s||e[11]!==l?(c=r.jsx(vl,{wait:l,hosts:s}),e[10]=s,e[11]=l,e[12]=c):c=e[12],c}export{vl as L,Gu as P,un as S,qu as u};
551
+ `)}function Jl(t,e,n=320,s=44,a=12){const{x:l,y:c}=t,{width:o,height:i}=e,d=Math.max(a,Math.min(l-n/2,o-n-a)),f=c/i>.68?Math.max(a,c-s-18):Math.min(c+18,i-s-a);return{leftPct:d/o*100,topPct:f/i*100}}function Yl(t){const e=ue.c(45),{element:n,onDismiss:s}=t,[a,l]=j.useState(""),c=j.useRef(null),{sendMessage:o}=Ni(),{openSidePanel:i}=Bo(),d=Te();let m;e[0]!==n||e[1]!==a||e[2]!==s||e[3]!==i||e[4]!==o?(m=()=>{if(!a.trim())return;const W=Gl(n,a);i(),o({parts:[{type:"text",text:W}]}),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=Jl(n.position,n.viewport),e[6]=n.position,e[7]=n.viewport,e[8]=p):p=e[8];const S=p,v=`${S.leftPct}%`,x=`${S.topPct}%`;let h;e[9]!==v||e[10]!==x?(h={left:v,top:x,width:"320px"},e[9]=v,e[10]=x,e[11]=h):h=e[11];let b;e[12]!==f?(b=W=>{W.preventDefault(),f()},e[12]=f,e[13]=b):b=e[13];let T;e[14]===Symbol.for("react.memo_cache_sentinel")?(T=W=>l(W.target.value),e[14]=T):T=e[14];let y;e[15]!==s?(y=W=>{W.key==="Escape"&&s()},e[15]=s,e[16]=y):y=e[16];let g;e[17]!==d?(g=d("sandbox.visualEditorPrompt.inputPlaceholder"),e[17]=d,e[18]=g):g=e[18];let N;e[19]!==a||e[20]!==y||e[21]!==g?(N=r.jsx("input",{ref:c,autoFocus:!0,type:"text",value:a,onChange:T,onKeyDown:y,placeholder:g,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"}),e[19]=a,e[20]=y,e[21]=g,e[22]=N):N=e[22];let E;e[23]!==a?(E=a.trim(),e[23]=a,e[24]=E):E=e[24];const k=!E;let P;e[25]!==d?(P=d("sandbox.visualEditorPrompt.sendButton"),e[25]=d,e[26]=P):P=e[26];let C;e[27]!==d?(C=d("sandbox.visualEditorPrompt.sendButton"),e[27]=d,e[28]=C):C=e[28];let O;e[29]!==C?(O=r.jsx("title",{children:C}),e[29]=C,e[30]=O):O=e[30];let R;e[31]===Symbol.for("react.memo_cache_sentinel")?(R=r.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e[31]=R):R=e[31];let A;e[32]!==O?(A=r.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[O,R]}),e[32]=O,e[33]=A):A=e[33];let D;e[34]!==k||e[35]!==P||e[36]!==A?(D=r.jsx("button",{type:"submit",disabled:k,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-foreground text-background transition-opacity disabled:opacity-30",title:P,children:A}),e[34]=k,e[35]=P,e[36]=A,e[37]=D):D=e[37];let _;e[38]!==N||e[39]!==D||e[40]!==b?(_=r.jsxs("form",{className:"pointer-events-auto flex w-full items-center gap-1.5 rounded-xl glass px-3 py-1.5",onSubmit:b,children:[N,D]}),e[38]=N,e[39]=D,e[40]=b,e[41]=_):_=e[41];let B;return e[42]!==_||e[43]!==h?(B=r.jsx("div",{className:"absolute z-30 pointer-events-none",style:h,children:_}),e[42]=_,e[43]=h,e[44]=B):B=e[44],B}const pr="site-links",Ql=/details?page|\bpdp\b/i,Xl=/listingpage|\bplp\b/i;function Zl(t,e,n){const s=new Set;for(const o of n)Ql.test(o)&&s.add("product"),Xl.test(o)&&s.add("category");const a=Bt(Qn(t)),l=a[a.length-1],c=a[a.length-2];return l?.type==="text"&&l.text==="/p"&&c?.type==="param"&&c.name===e&&s.add("product"),e==="*"&&a.some(o=>o.type==="param"&&o.name==="*")&&s.add("category"),s}const ec=["rosa","preto","pink","black"];function an(t,e){const n=e.trim();return n?t(n):ec.flatMap(s=>t(s))}function tc(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 aa=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function Zn(t){return t.split("/")[0]??""}function nc(t){const e=new Set;for(const n of t){const s=Zn(n);aa.has(s)&&e.add(s)}return e}function sc(t,e){const n=Zn(t);return!aa.has(n)||e.size===0?!0:e.has(n)}const rc=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>an(n=>tc(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:uc}];function ac(t,e,n=new Set){const s=[...e],a=o=>{const i=[];for(const d of rc){if(d.kind!==o)continue;const m=s.find(f=>d.test(f)&&sc(f,n));m&&i.push({cand:d,resolveType:m})}return i.find(d=>n.has(Zn(d.resolveType)))??i[0]},l=(o,i,d)=>({kind:o.kind,id:`${o.kind}:${i}`,resolveType:i,clientFilter:o.clientFilter,isFallback:d,buildRequests:m=>o.buildRequests(i,m),optionsFromPayload:o.optionsFromPayload}),c=[];for(const o of["product","category"]){if(!t.has(o))continue;const i=a(o);i&&c.push(l(i.cand,i.resolveType,!1))}return t.size>0&&c.push(ic(t.has("category")?"category":"product")),c}function ic(t){return{kind:t,id:pr,resolveType:pr,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,n)=>gc(e,n)}}function et(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function oc(t,e,n){const s=new Set,a=new Set,l=c=>{if(Array.isArray(c)){for(const d of c)l(d);return}const o=et(c);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 d=et(e[i])?.__resolveType;typeof d=="string"&&n(d)&&s.add(i),l(e[i])}}for(const d of Object.values(o))l(d)};return l(t),s}function ia(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 oa(t){try{return decodeURIComponent(t)}catch{return t}}function lc(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cc(t){const e=[];let n="^";for(const s of t)s.type==="text"?n+=lc(s.text):(e.push(s.name),n+=s.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${n}$`),order:e}}function la(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:c}=cc(a),o=c.indexOf(n);if(o===-1)return null;const i=s.match(l);if(!i)return null;const d=i[o+1]?.replace(/^\/+|\/+$/g,"");return d?oa(d):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 c of s){const o=et(c);if(!o)continue;const i=la(o.url,e.template,e.paramName);if(!i||l.has(i))continue;l.add(i);const d=et(o.isVariantOf),m=typeof d?.name=="string"&&d.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 dc(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?oa(n):null}function uc(t){const e=[],n=new Set,s=(a,l)=>{const c=et(a);if(!c)return;const o=typeof c.name=="string"&&c.name?c.name:"",i=o?[...l,o]:l,d=dc(c.url);if(d&&!n.has(d)&&(n.add(d),e.push({value:d,label:i.join(" › ")||d})),Array.isArray(c.children))for(const m of c.children)s(m,i)};if(Array.isArray(t))for(const a of t)s(a,[]);return e}const fc=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 pc(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,n=>n.toUpperCase())}function mc(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]??"",c=(s[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:l,text:c})}return e}function hc(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,c=0;for(;(l=s.exec(t))!==null&&c++<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 gc(t,e){const n=[],s=new Set,a=(l,c,o,i)=>{if(n.length>=200)return;const d=la(l,e.template,e.paramName);!d||s.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||o==="category"&&fc.has(d.split("/")[0]??"")||(s.add(d),n.push({value:d,label:c&&c.length<=80?c:pc(d),kind:o,image:i}))};for(const{url:l,name:c,image:o}of hc(t))a(l,c,"product",o);for(const{href:l,text:c}of mc(t))l.startsWith("/")&&!l.startsWith("//")&&a(l,c,"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 ca=1e4;function vc(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 xc(t,{resolveType:e,props:n}){const s=await fetch(Qi(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...n}),signal:AbortSignal.timeout(ca)});if(!s.ok)throw new Error(`Failed to fetch options: ${s.status}`);return s.json()}async function mr(t,e){const n=await fetch(Xi(t,e),{signal:AbortSignal.timeout(ca)});if(!n.ok)throw new Error(`Failed to fetch page: ${n.status}`);return n.text()}async function bc(t,e,n){const s=e.optionsFromPayload(await mr(t,"/"),n),a=s.find(c=>c.kind==="category");if(!a)return s;const l=Ve(n.template,{[n.paramName]:a.value});if(l==="/")return s;try{const c=e.optionsFromPayload(await mr(t,l),n).filter(o=>o.kind==="product");return ia([s,c])}catch{return s}}function wc(t,e,n){return Gn.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":n}`)}async function yc(t,e,n,s){if(e.homepageLinks)return bc(t,e,s);const a=e.buildRequests?.(n)??[];if(a.length===0)return[];const l=await Promise.allSettled(a.map(o=>xc(t,o))),c=l.filter(o=>o.status==="fulfilled").map(o=>o.value);if(c.length===0){const o=l.find(i=>i.status==="rejected");throw o?o.reason:new Error("Failed to fetch options")}return ia(c.map(o=>e.optionsFromPayload(o,s)))}function Wn(t,e,n,s,a){return{queryKey:wc(t,e,n),queryFn:()=>yc(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:c,keyPrefix:o,onSelect:i}=t;if(a.length===0)return null;let d;if(e[0]!==s||e[1]!==o||e[2]!==i||e[3]!==a||e[4]!==c||e[5]!==l){let f;e[7]!==s||e[8]!==o||e[9]!==i||e[10]!==c||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(_r,{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,{[c]:p.value})})]})]},`${o}:${p.value}`),e[7]=s,e[8]=o,e[9]=i,e[10]=c,e[11]=l,e[12]=f):f=e[12],d=a.map(f),e[0]=s,e[1]=o,e[2]=i,e[3]=a,e[4]=c,e[5]=l,e[6]=d}else d=e[6];let m;return e[13]!==n||e[14]!==d?(m=r.jsx(dt,{heading:n,children:d}),e[13]=n,e[14]=d,e[15]=m):m=e[15],m}function hr(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 kc(t){const e=ue.c(52),{sources:n,template:s,paramName:a,value:l,sandboxRef:c,onCommit:o}=t,i=Te(),[d,m]=j.useState(!1),[f,p]=j.useState(""),[S,v]=j.useState(""),x=j.useRef(null),h=a==="*"?i("sandbox.preview.catchAllParamLabel"):`:${a}`,b=vc(i),y=[...new Set(n.map(ee=>b[ee.kind].noun))].join(" or ");let g;e[0]!==i||e[1]!==y?(g=i("sandbox.pathParamPickerChip.searchPlaceholder",{options:y}),e[0]=i,e[1]=y,e[2]=g):g=e[2];const N=g,E={template:s,paramName:a};let k;e[3]!==f?(k=(ee,ce)=>({source:ee,query:ce,options:ee.clientFilter?Dt(ce.data??[],f):ce.data??[]}),e[3]=f,e[4]=k):k=e[4];const P=k,C=n.filter(Rc),O=n.filter(Cc),R=Kn({queries:C.map(ee=>Wn(c,ee,S,E,d))});let A;e[5]!==R||e[6]!==P?(A=(ee,ce)=>P(ee,R[ce]),e[5]=R,e[6]=P,e[7]=A):A=e[7];const D=C.map(A),_=D.length===0||D.every(Tc),B=Kn({queries:O.map(ee=>Wn(c,ee,S,E,d&&_))});let W;e[8]!==B||e[9]!==P?(W=(ee,ce)=>P(ee,B[ce]),e[8]=B,e[9]=P,e[10]=W):W=e[10];const Z=O.map(W),G=_?Z:D,J=G.length===1&&G[0]?.source.homepageLinks?G[0]:null,q=J&&!J.query.isLoading&&!J.query.isError?J?.query.data??[]:[],X=Dt(q.filter(Nc),f),L=Dt(q.filter(Ec),f),M=X.length>0&&L.length>0,U=ee=>{m(ee),x.current&&clearTimeout(x.current),p(ee?l:""),v(ee?l:"")};let H;e[11]===Symbol.for("react.memo_cache_sentinel")?(H=ee=>{p(ee),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{v(ee)},300)},e[11]=H):H=e[11];const F=H,z=ee=>{o(ee),U(!1)},V=Yr(f),Q=Ve(s,{[a]:V}),ne=Pr,se=Sr,I="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",re=jc;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(jr,{className:"sr-only",children:r.jsx(Er,{children:ae})}),e[15]=ae,e[16]=ie):ie=e[16];let me;e[17]===Symbol.for("react.memo_cache_sentinel")?(me=r.jsx(_r,{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=Ir,Se=!1,fe="min-h-0 flex-1";let le;e[25]!==N||e[26]!==f?(le=r.jsx(zr,{autoFocus:!0,placeholder:N,value:f,onValueChange:F}),e[25]=N,e[26]=f,e[27]=le):le=e[27];const Re=Ur,Me="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let Ue;e[28]!==i?(Ue=i("sandbox.pathParamPickerChip.noResults"),e[28]=i,e[29]=Ue):Ue=e[29];let Be;e[30]!==Ue?(Be=r.jsx(Kr,{children:Ue}),e[30]=Ue,e[31]=Be):Be=e[31];const vt=V&&r.jsx(dt,{className:"shrink-0",children:r.jsxs(ut,{value:`__raw__:${V}`,className:"gap-3 py-2",onSelect:()=>z(V),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(Uo,{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:V,paramLabel:h})}),r.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Q})]})]})}),ge=M?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:b.category.heading,iconKind:"category",options:X,template:s,paramName:a,keyPrefix:`${J?.source.id}:cat`,onSelect:z})}),r.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r.jsx(Ft,{heading:b.product.heading,iconKind:"product",options:L,template:s,paramName:a,keyPrefix:`${J?.source.id}:prod`,onSelect:z})})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:G.map(ee=>{const{source:ce,query:We,options:xt}=ee,{noun:qe}=b[ce.kind];if(We.isLoading)return r.jsx(hr,{text:i("sandbox.pathParamPickerChip.loading",{noun:qe})},ce.id);if(We.isError)return r.jsx(hr,{text:i("sandbox.pathParamPickerChip.couldNotLoad")},ce.id);if(ce.homepageLinks){const It=We.data??[];return r.jsxs(j.Fragment,{children:[r.jsx(Ft,{heading:b.category.heading,iconKind:"category",options:Dt(It.filter(Pc),f),template:s,paramName:a,keyPrefix:`${ce.id}:cat`,onSelect:z}),r.jsx(Ft,{heading:b.product.heading,iconKind:"product",options:Dt(It.filter(Sc),f),template:s,paramName:a,keyPrefix:`${ce.id}:prod`,onSelect:z})]},ce.id)}return r.jsx(Ft,{heading:G.length>1?b[ce.kind].heading:void 0,iconKind:ce.kind,options:xt,template:s,paramName:a,keyPrefix:ce.id,onSelect:z},ce.id)})});let _e;e[32]!==Re||e[33]!==Be||e[34]!==vt||e[35]!==ge?(_e=r.jsxs(Re,{className:Me,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 Ie;e[41]!==se||e[42]!==ie||e[43]!==he||e[44]!==be||e[45]!==re?(Ie=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]=Ie):Ie=e[46];let Le;return e[47]!==ne||e[48]!==U||e[49]!==d||e[50]!==Ie?(Le=r.jsx(ne,{open:d,onOpenChange:U,children:Ie}),e[47]=ne,e[48]=U,e[49]=d,e[50]=Ie,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:ee=>{ee.stopPropagation(),U(!0)},children:l||h}),Le]})}function Sc(t){return t.kind==="product"}function Pc(t){return t.kind!=="product"}function jc(t){return t.stopPropagation()}function Ec(t){return t.kind==="product"}function Nc(t){return t.kind!=="product"}function Tc(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function Cc(t){return t.isFallback}function Rc(t){return!t.isFallback}function Lc(t){const e=ue.c(8),{sources:n,template:s,paramName:a,sandboxRef:l,onFill:c}=t;let o,i;if(e[0]!==a||e[1]!==l||e[2]!==n||e[3]!==s){const S={template:s,paramName:a},v=n.filter(Ac);i=Kn,o=v.map(x=>Wn(l,x,"",S,!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 d;e[6]!==o?(d={queries:o},e[6]=o,e[7]=d):d=e[7];const m=i(d),[f,p]=j.useState(!1);if(!f)for(const S of m){if(S.isLoading)break;const v=S.data?.[0];if(v){p(!0),queueMicrotask(()=>c(v.value));break}}return null}function Ac(t){return!t.isFallback}function _c(t){const e=ue.c(31),{name:n,value:s,onCommit:a}=t,l=Te(),[c,o]=j.useState(s),[i,d]=j.useState(!1),m=j.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,S=c||p;let v;e[3]!==S?(v=r.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-xs",children:S}),e[3]=S,e[4]=v):v=e[4];let x;e[5]!==p||e[6]!==l?(x=l("sandbox.preview.valueForParam",{label:p}),e[5]=p,e[6]=l,e[7]=x):x=e[7];let h,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=P=>o(P.target.value),b=()=>d(!0),e[8]=h,e[9]=b):(h=e[8],b=e[9]);let T;e[10]!==s?(T=P=>{P.key==="Enter"&&P.currentTarget.blur(),P.key==="Escape"&&(m.current=!0,o(s),P.currentTarget.blur())},e[10]=s,e[11]=T):T=e[11];let y;e[12]!==c||e[13]!==a||e[14]!==s?(y=()=>{if(d(!1),m.current){m.current=!1;return}const P=Yr(c);o(P),P!==s&&a(P)},e[12]=c,e[13]=a,e[14]=s,e[15]=y):y=e[15];let g;e[16]!==c||e[17]!==p||e[18]!==x||e[19]!==T||e[20]!==y?(g=r.jsx("input",{type:"text",value:c,placeholder:p,title:x,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:Oc,onChange:h,onFocus:b,onKeyDown:T,onBlur:y}),e[16]=c,e[17]=p,e[18]=x,e[19]=T,e[20]=y,e[21]=g):g=e[21];let N;e[22]!==v||e[23]!==g?(N=r.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[v,g]}),e[22]=v,e[23]=g,e[24]=N):N=e[24];let E;e[25]!==i||e[26]!==l?(E=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(Oi,{size:10}),l("sandbox.preview.enterToGo")]}),e[25]=i,e[26]=l,e[27]=E):E=e[27];let k;return e[28]!==E||e[29]!==N?(k=r.jsxs(r.Fragment,{children:[N,E]}),e[28]=E,e[29]=N,e[30]=k):k=e[30],k}function Oc(t){return t.stopPropagation()}function Dc(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 Fc(t){return t.previewSurfaceActive&&(t.daemonReady||t.production||!!t.servePreviewUrl)}function $c(t){return t.showPreviewToolbar&&t.contentEditingEnabled}function Bc(t){return t.v8?null:t.production||t.localPreview?{type:"editor::inject",args:{script:t.script}}:{type:"visual-editor::activate",script:t.script}}function Mc(t){return t.v8?null:{type:"visual-editor::activate",script:t.script}}class da extends Error{constructor(){super("The site's schema isn't loaded yet"),this.name="PageSchemaNotReadyError"}}async function Uc(t,e){if(t)return t;const n=await e?.().catch(()=>null);if(!n)throw new da;return n}async function Ic(t,e,n){return n?qs(t,e,await Uc(n.meta,n.loadMeta)):qs(t,e)}function zc(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=Cr(n);let a;return e[2]!==t||e[3]!==s?(a={mutationFn:async l=>{const{name:c,path:o,template:i,schema:d}=l;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const m=mi(c),f=i?{...i,name:c,path:o}:await Ic(c,o,d);return await s.mutateAsync({blockKey:m,data:f}),{key:m,name:c,path:o}}},e[2]=t,e[3]=s,e[4]=a):a=e[4],ii(a)}function Kc(t){const e=ue.c(89),{open:n,onOpenChange:s,isPending:a,error:l,templates:c,onSubmit:o}=t,i=a===void 0?!1:a,d=Te();let m;e[0]!==d?(m=d("sectionsEditor.createPageModal.defaultPageName"),e[0]=d,e[1]=m):m=e[1];const[f,p]=j.useState(m);let S;e[2]!==d?(S=d("sectionsEditor.createPageModal.defaultPagePath"),e[2]=d,e[3]=S):S=e[3];const[v,x]=j.useState(S),[h,b]=j.useState(Rn),[T,y]=j.useState(null),[g,N]=j.useState(n);n!==g&&(N(n),n&&(p(d("sectionsEditor.createPageModal.defaultPageName")),x(d("sectionsEditor.createPageModal.defaultPagePath")),b(Rn),y(null)));const E=!!c?.length;let k;e[4]!==i||e[5]!==s?(k=pe=>{!pe&&!i&&(y(null),s(!1))},e[4]=i,e[5]=s,e[6]=k):k=e[6];const P=k;let C;e[7]!==i||e[8]!==f||e[9]!==o||e[10]!==v||e[11]!==E||e[12]!==h?(C=async pe=>{pe.preventDefault();const xe=f.trim(),he=v.trim();if(!xe||!he||i)return;const ve=Qr(he);if(ve){y(ve);return}y(null),await o({name:xe,path:he,templateKey:E&&h!==Rn?h:null})},e[7]=i,e[8]=f,e[9]=o,e[10]=v,e[11]=E,e[12]=h,e[13]=C):C=e[13];const O=C,R=T??l;let A;e[14]!==d?(A=d("sectionsEditor.createPageModal.title"),e[14]=d,e[15]=A):A=e[15];let D;e[16]!==A?(D=r.jsx(jr,{children:r.jsx(Er,{children:A})}),e[16]=A,e[17]=D):D=e[17];let _;e[18]!==d?(_=d("sectionsEditor.createPageModal.nameLabel"),e[18]=d,e[19]=_):_=e[19];let B;e[20]!==_?(B=r.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:_}),e[20]=_,e[21]=B):B=e[21];let W;e[22]===Symbol.for("react.memo_cache_sentinel")?(W=pe=>p(pe.target.value),e[22]=W):W=e[22];let Z;e[23]!==d?(Z=d("sectionsEditor.createPageModal.namePlaceholder"),e[23]=d,e[24]=Z):Z=e[24];let G;e[25]!==i||e[26]!==f||e[27]!==Z?(G=r.jsx(Mn,{id:"new-page-name",value:f,onChange:W,placeholder:Z,autoFocus:!0,disabled:i}),e[25]=i,e[26]=f,e[27]=Z,e[28]=G):G=e[28];let J;e[29]!==G||e[30]!==B?(J=r.jsxs("div",{className:"space-y-1.5",children:[B,G]}),e[29]=G,e[30]=B,e[31]=J):J=e[31];let K;e[32]!==d?(K=d("sectionsEditor.createPageModal.pathLabel"),e[32]=d,e[33]=K):K=e[33];let q;e[34]!==K?(q=r.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:K}),e[34]=K,e[35]=q):q=e[35];let X;e[36]===Symbol.for("react.memo_cache_sentinel")?(X=pe=>x(pe.target.value),e[36]=X):X=e[36];let L;e[37]!==d?(L=d("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=d,e[38]=L):L=e[38];let M;e[39]!==i||e[40]!==v||e[41]!==L?(M=r.jsx(Mn,{id:"new-page-path",value:v,onChange:X,placeholder:L,disabled:i}),e[39]=i,e[40]=v,e[41]=L,e[42]=M):M=e[42];let U;e[43]!==q||e[44]!==M?(U=r.jsxs("div",{className:"space-y-1.5",children:[q,M]}),e[43]=q,e[44]=M,e[45]=U):U=e[45];let H;e[46]!==i||e[47]!==E||e[48]!==d||e[49]!==h||e[50]!==c?(H=E&&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:d("sectionsEditor.createPageModal.templateLabel")}),r.jsx(hi,{id:"new-page-template",value:h,onChange:b,templates:c??[],disabled:i})]}),e[46]=i,e[47]=E,e[48]=d,e[49]=h,e[50]=c,e[51]=H):H=e[51];let F;e[52]!==R?(F=R&&r.jsx("p",{className:"text-xs text-destructive",children:R}),e[52]=R,e[53]=F):F=e[53];let z;e[54]!==J||e[55]!==U||e[56]!==H||e[57]!==F?(z=r.jsxs("div",{className:"space-y-4 py-4",children:[J,U,H,F]}),e[54]=J,e[55]=U,e[56]=H,e[57]=F,e[58]=z):z=e[58];let V;e[59]!==s?(V=()=>s(!1),e[59]=s,e[60]=V):V=e[60];let Q;e[61]!==d?(Q=d("sectionsEditor.createPageModal.cancelButton"),e[61]=d,e[62]=Q):Q=e[62];let ne;e[63]!==i||e[64]!==V||e[65]!==Q?(ne=r.jsx($e,{type:"button",variant:"outline",onClick:V,disabled:i,children:Q}),e[63]=i,e[64]=V,e[65]=Q,e[66]=ne):ne=e[66];let se;e[67]!==i||e[68]!==f||e[69]!==v?(se=!f.trim()||!v.trim()||i,e[67]=i,e[68]=f,e[69]=v,e[70]=se):se=e[70];let I;e[71]!==i||e[72]!==d?(I=i?r.jsxs(r.Fragment,{children:[r.jsx(gt,{className:"size-3.5"}),d("sectionsEditor.createPageModal.creatingButton")]}):d("sectionsEditor.createPageModal.createButton"),e[71]=i,e[72]=d,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(oi,{children:[ne,re]}),e[77]=ne,e[78]=re,e[79]=ae):ae=e[79];let ie;e[80]!==O||e[81]!==z||e[82]!==ae||e[83]!==D?(ie=r.jsx(Sr,{className:"sm:max-w-md",children:r.jsxs("form",{onSubmit:O,children:[D,z,ae]})}),e[80]=O,e[81]=z,e[82]=ae,e[83]=D,e[84]=ie):ie=e[84];let me;return e[85]!==P||e[86]!==n||e[87]!==ie?(me=r.jsx(Pr,{open:n,onOpenChange:P,children:ie}),e[85]=P,e[86]=n,e[87]=ie,e[88]=me):me=e[88],me}function Hc(t){const e=ue.c(36),{orgSlug:n,virtualMcpId:s,branch:a,previewUrl:l,meta:c,decofile:o,blockKey:i}=t,d=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=Cr(m);let p;e[4]!==f?(p=xi((k,P)=>f.mutate({blockKey:k,data:P})),e[4]=f,e[5]=p):p=e[5];const S=p;let v;e[6]!==i||e[7]!==o?(v=gi(o,i),e[6]=i,e[7]=o,e[8]=v):v=e[8];const{resolveType:x,props:h,title:b}=v;if(!x){let k;e[9]!==d?(k=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=k):k=e[10];let P;return e[11]!==k?(P=r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:k}),e[11]=k,e[12]=P):P=e[12],P}const T=`loader:${i}`,y=`loader:${i}`;let g;e[13]!==i||e[14]!==x||e[15]!==b?(g={mode:"saved",blockKey:i,resolveType:x,title:b},e[13]=i,e[14]=x,e[15]=b,e[16]=g):g=e[16];let N;e[17]!==a||e[18]!==o||e[19]!==c||e[20]!==n||e[21]!==l||e[22]!==h||e[23]!==f.isPending||e[24]!==S||e[25]!==y||e[26]!==g||e[27]!==s?(N=r.jsx(vi,{orgSlug:n,virtualMcpId:s,branch:a,previewUrl:l,meta:c,decofile:o,kind:"loaders",target:g,initialValue:h,isCreating:f.isPending,onCreate:Vc,onSaveReferencedBlock:S,showRun:!1},y),e[17]=a,e[18]=o,e[19]=c,e[20]=n,e[21]=l,e[22]=h,e[23]=f.isPending,e[24]=S,e[25]=y,e[26]=g,e[27]=s,e[28]=N):N=e[28];let E;return e[29]!==i||e[30]!==a||e[31]!==n||e[32]!==T||e[33]!==N||e[34]!==s?(E=r.jsx(bi,{orgSlug:n,virtualMcpId:s,branch:a,blockKey:i,present:void 0,children:N},T),e[29]=i,e[30]=a,e[31]=n,e[32]=T,e[33]=N,e[34]=s,e[35]=E):E=e[35],E}async function Vc(){}function Wc(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function gr(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:Wc(t.error)}}function qc(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 Gc(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=qc(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 Jc=j.lazy(()=>li(()=>import("./sections-editor-UNPiBRIi.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 vr(t){const e=ue.c(60),{virtualMcpId:n,externalSelection:s,onViewJsonFile:a}=t,l=s===void 0?null:s,{org:c}=Jn(),{currentBranch:o,taskId:i}=Mt(),d=Xn(),m=Ut(),f=ea(),p=d.lifecycle.phase==="running",S=m.previewUrl;let v;e[0]!==o||e[1]!==c||e[2]!==S||e[3]!==i||e[4]!==n?(v=o?{orgSlug:c.slug,virtualMcpId:n,branch:o,threadId:i??null,previewUrl:S}:null,e[0]=o,e[1]=c,e[2]=S,e[3]=i,e[4]=n,e[5]=v):v=e[5];const x=v,h=fn(n,o);let b;e[6]!==p?(b={fetchEnabled:p},e[6]=p,e[7]=b):b=e[7];const T=Yn(x,b);let y;e[8]!==p?(y={fetchEnabled:p},e[8]=p,e[9]=y):y=e[9];const g=Xr(x,y),N=Gc({lifecyclePhase:d.lifecycle.phase,decofile:gr(T),meta:gr(g),hasEditableContent:ko(T.data,g.data),fastPreviewActive:Hr(n).runtime==="cms"||Xe(h)}),E=Rr()===void 0,k=Yc;if(So(h)){let L;return e[10]===Symbol.for("react.memo_cache_sentinel")?(L=k(r.jsx(jo,{})),e[10]=L):L=e[10],L}if(h.kind==="pending"&&h.retrying){let L;return e[11]!==h?(L=k(r.jsx(Eo,{backend:h})),e[11]=h,e[12]=L):L=e[12],L}if(N.kind==="loading"||E){let L;return e[13]===Symbol.for("react.memo_cache_sentinel")?(L=k(r.jsx(ci,{})),e[13]=L):L=e[13],L}if(T.data&&Zi(g.data)){const L=f.state.target,M=L?.kind==="page"||L?.kind==="section"?L.key:null,U=M??"",H=o??"";let F;return e[14]!==T.data||e[15]!==M||e[16]!==c.slug||e[17]!==U||e[18]!==H||e[19]!==n?(F=k(r.jsx(wi,{orgSlug:c.slug,virtualMcpId:n,branch:H,decofile:T.data,initialKey:M,compact:!0},U)),e[14]=T.data,e[15]=M,e[16]=c.slug,e[17]=U,e[18]=H,e[19]=n,e[20]=F):F=e[20],F}if(N.kind==="empty"){let L;return e[21]===Symbol.for("react.memo_cache_sentinel")?(L=k(r.jsx(No,{})),e[21]=L):L=e[21],L}if(N.kind==="error"){let L;e[22]!==T||e[23]!==m||e[24]!==g||e[25]!==N.source?(L=()=>{if(N.source==="sandbox"){m.retry();return}Promise.all([T.refetch(),g.refetch()])},e[22]=T,e[23]=m,e[24]=g,e[25]=N.source,e[26]=L):L=e[26];const M=L;let U;return e[27]!==M||e[28]!==N.source?(U=k(r.jsx(Po,{source:N.source,onRetry:M})),e[27]=M,e[28]=N.source,e[29]=U):U=e[29],U}let P;e[30]===Symbol.for("react.memo_cache_sentinel")?(P=L=>k(r.jsx("div",{className:"h-full min-h-0",children:L})),e[30]=P):P=e[30];const C=P,O=f.state.target;if(O?.kind==="loader"&&T.data&&g.data){const L=o??"",M=S??null;let U;return e[31]!==T.data||e[32]!==g.data||e[33]!==c.slug||e[34]!==L||e[35]!==M||e[36]!==O.key||e[37]!==n?(U=C(r.jsx(Hc,{orgSlug:c.slug,virtualMcpId:n,branch:L,previewUrl:M,meta:g.data,decofile:T.data,blockKey:O.key})),e[31]=T.data,e[32]=g.data,e[33]=c.slug,e[34]=L,e[35]=M,e[36]=O.key,e[37]=n,e[38]=U):U=e[38],U}let R;e[39]!==o||e[40]!==c.slug||e[41]!==O||e[42]!==n?(R=O||!o?null:Lr(Ar(c.slug,n,o)),e[39]=o,e[40]=c.slug,e[41]=O,e[42]=n,e[43]=R):R=e[43];const A=R;let D="/",_=null,B=null;O?.kind==="page"?(D=O.path,_=O.key):O?.kind==="section"?B=O.key:A&&(D=A.path,_=A.pageKey);const W=_?`page:${_}`:B?`section:${B}`:`path:${D}`;let Z;e[44]===Symbol.for("react.memo_cache_sentinel")?(Z=r.jsx("div",{className:"h-full flex items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}),e[44]=Z):Z=e[44];const G=o??"",J=S??void 0,K=B?null:l,q=!!_&&f.state.editSeoPageKey===_;let X;return e[45]!==B||e[46]!==_||e[47]!==D||e[48]!==W||e[49]!==a||e[50]!==c.slug||e[51]!==K||e[52]!==q||e[53]!==G||e[54]!==J||e[55]!==n||e[56]!==f.consumeEditSeo||e[57]!==f.setFocusedBlock||e[58]!==f.setVariantOverride?(X=C(r.jsx(j.Suspense,{fallback:Z,children:r.jsx(Jc,{orgSlug:c.slug,virtualMcpId:n,branch:G,previewReady:!0,previewUrl:J,currentPath:D,activePageBlockKey:_,activeGlobalBlockKey:B,externalSelection:K,initialEditSeo:q,onExitSeo:f.consumeEditSeo,onVariantPreviewOverride:f.setVariantOverride,onFocusedBlockChange:f.setFocusedBlock,onViewJsonFile:a},W)})),e[45]=B,e[46]=_,e[47]=D,e[48]=W,e[49]=a,e[50]=c.slug,e[51]=K,e[52]=q,e[53]=G,e[54]=J,e[55]=n,e[56]=f.consumeEditSeo,e[57]=f.setFocusedBlock,e[58]=f.setVariantOverride,e[59]=X):X=e[59],X}function Yc(t){return r.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function xr(t){const e=ue.c(51),{virtualMcpId:n,pageKey:s,onClose:a,ref:l}=t,c=Te(),o=Rr(),i=o===!0,d=Vr(n);let m;e[0]!==d||e[1]!==s?(m=eo(d,qo(s)),e[0]=d,e[1]=s,e[2]=m):m=e[2];const f=m,{org:p}=Jn(),{currentBranch:S,taskId:v}=Mt(),h=Ut().previewUrl;let b;e[3]!==S||e[4]!==p.slug||e[5]!==h||e[6]!==v||e[7]!==n?(b=S?{orgSlug:p.slug,virtualMcpId:n,branch:S,threadId:v??null,previewUrl:h}:null,e[3]=S,e[4]=p.slug,e[5]=h,e[6]=v,e[7]=n,e[8]=b):b=e[8];const y=Yn(b),g=S??"";let N;e[9]!==p.slug||e[10]!==g||e[11]!==n?(N={orgSlug:p.slug,virtualMcpId:n,branch:g},e[9]=p.slug,e[10]=g,e[11]=n,e[12]=N):N=e[12];let E;e[13]===Symbol.for("react.memo_cache_sentinel")?(E={holdsCopy:!0},e[13]=E):E=e[13];const{save:k,flush:P,hold:C}=yi(N,E),O=S??"";let R;e[14]!==p.slug||e[15]!==O||e[16]!==n?(R=zo({orgSlug:p.slug,virtualMcpId:n,branch:O}),e[14]=p.slug,e[15]=O,e[16]=n,e[17]=R):R=e[17];const A=Ko(R);let D;e[18]!==s||e[19]!==A?(D=A(s),e[18]=s,e[19]=A,e[20]=D):D=e[20];const _=D;let B;e[21]!==_||e[22]!==s?(B={pageKey:s,copyEpoch:_},e[21]=_,e[22]=s,e[23]=B):B=e[23];const[W,Z]=j.useState(B);(W.pageKey!==s||W.copyEpoch!==_)&&(Z({pageKey:s,copyEpoch:_}),C(s));const G=y.data?.[s],J=y.data===void 0&&y.isLoading||o===void 0,K=y.data!==void 0&&G===void 0,q=!S||K||J;let X;e[24]!==G?(X=G===void 0?"":JSON.stringify(G,null,2),e[24]=G,e[25]=X):X=e[25];const L=X;let M;e[26]!==s||e[27]!==q||e[28]!==k?(M=Q=>{if(q)return;let ne;try{ne=JSON.parse(Q)}catch{return}ne===null||typeof ne!="object"||Array.isArray(ne)||k(s,ne)},e[26]=s,e[27]=q,e[28]=k,e[29]=M):M=e[29];const U=M;let H;e[30]!==P?(H=()=>({flush:P}),e[30]=P,e[31]=H):H=e[31],j.useImperativeHandle(l,H);let F;e[32]!==f||e[33]!==i||e[34]!==a||e[35]!==c?(F=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:c("sectionsEditor.pageJsonDialog.titleShort")}),r.jsx($e,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":c("sectionsEditor.pageJsonDialog.close"),className:"shrink-0",children:r.jsx(di,{size:14})})]}),e[32]=f,e[33]=i,e[34]=a,e[35]=c,e[36]=F):F=e[36];let z;e[37]!==_||e[38]!==y.data||e[39]!==P||e[40]!==L||e[41]!==J||e[42]!==K||e[43]!==s||e[44]!==q||e[45]!==U||e[46]!==c?(z=J?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(gt,{className:"size-5 text-muted-foreground"})}):K?r.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",c("sectionsEditor.pageJsonDialog.pageNotFound")]}):r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Io,{code:L,language:"json",readOnly:q,height:"100%",onChange:Q=>U(Q??""),onSave:Q=>{U(Q),P()}},`${s}:${y.data===void 0?"loading":"ready"}:${_}`)}),e[37]=_,e[38]=y.data,e[39]=P,e[40]=L,e[41]=J,e[42]=K,e[43]=s,e[44]=q,e[45]=U,e[46]=c,e[47]=z):z=e[47];let V;return e[48]!==F||e[49]!==z?(V=r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[F,z]}),e[48]=F,e[49]=z,e[50]=V):V=e[50],V}function ua(t){return t.contentEditingEnabled&&!t.isMobile}function Qc(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function Xc(t,e){return t==="blocks"?"preview":e?"blocks":t}function Zc(t){return ua({contentEditingEnabled:Zr(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function ed(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}function td(t){const e=to(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=no(s,e);return{value:e,frame:a?Hn(a,t.device):null,newTab:a}}function nd(t){const e=ue.c(94),{tests:n,load:s,onOpen:a,options:l,onChange:c,available:o}=t,i=Te();let d;e[0]!==l?(d=Wr(l),e[0]=l,e[1]=d):d=e[1];const m=d;let f;e[2]!==l.tests?(f=l.tests??{},e[2]=l.tests,e[3]=f):f=e[3];const p=f;let S;e[4]!==c||e[5]!==l?(S=I=>{const re=I?Vo(I):null,{at:ae,...ie}=l;c(re?{...ie,at:re}:ie)},e[4]=c,e[5]=l,e[6]=S):S=e[6];const v=S;let x;e[7]!==p||e[8]!==c||e[9]!==l?(x=(I,re)=>{const ae={...p};re==="on"?ae[I]=!0:re==="off"?ae[I]=!1:delete ae[I];const{tests:ie,...me}=l;c(Object.keys(ae).length>0?{...me,tests:ae}:me)},e[7]=p,e[8]=c,e[9]=l,e[10]=x):x=e[10];const h=x;let b;e[11]!==a?(b=I=>{I&&a?.()},e[11]=a,e[12]=b):b=e[12];let T;e[13]!==i?(T=i("sandbox.previewAs.label"),e[13]=i,e[14]=T):T=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=r.jsx(Di,{size:16}),e[15]=y):y=e[15];let g;e[16]!==m||e[17]!==T?(g=r.jsx(pt,{asChild:!0,children:r.jsx($r,{asChild:!0,children:r.jsx(Ze,{"aria-label":T,active:m,"data-testid":"preview-as-trigger",children:y})})}),e[16]=m,e[17]=T,e[18]=g):g=e[18];let N;e[19]!==i?(N=i("sandbox.previewAs.label"),e[19]=i,e[20]=N):N=e[20];let E;e[21]!==N?(E=r.jsx(mt,{children:N}),e[21]=N,e[22]=E):E=e[22];let k;e[23]!==E||e[24]!==g?(k=r.jsxs(ht,{children:[g,E]}),e[23]=E,e[24]=g,e[25]=k):k=e[25];let P;e[26]!==i?(P=i("sandbox.previewAs.label"),e[26]=i,e[27]=P):P=e[27];let C;e[28]!==P?(C=r.jsx("h3",{className:"text-sm font-medium",children:P}),e[28]=P,e[29]=C):C=e[29];let O;e[30]!==o||e[31]!==i?(O=i(o?"sandbox.previewAs.intro":"sandbox.previewAs.unavailable"),e[30]=o,e[31]=i,e[32]=O):O=e[32];let R;e[33]!==O?(R=r.jsx("p",{className:"text-xs text-muted-foreground",children:O}),e[33]=O,e[34]=R):R=e[34];let A;e[35]!==C||e[36]!==R?(A=r.jsxs("div",{className:"flex flex-col gap-1",children:[C,R]}),e[35]=C,e[36]=R,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 _;e[40]!==D?(_=r.jsx(Qo,{htmlFor:"preview-as-moment",children:D}),e[40]=D,e[41]=_):_=e[41];let B;e[42]!==l.at?(B=Ho(l.at),e[42]=l.at,e[43]=B):B=e[43];let W;e[44]!==v?(W=I=>v(I.target.value),e[44]=v,e[45]=W):W=e[45];let Z;e[46]!==B||e[47]!==W?(Z=r.jsx(Mn,{id:"preview-as-moment",type:"datetime-local",className:Wo,value:B,onChange:W}),e[46]=B,e[47]=W,e[48]=Z):Z=e[48];const G=l.at===void 0;let J;e[49]!==v?(J=()=>v(""),e[49]=v,e[50]=J):J=e[50];let K;e[51]!==i?(K=i("sandbox.previewAs.now"),e[51]=i,e[52]=K):K=e[52];let q;e[53]!==G||e[54]!==J||e[55]!==K?(q=r.jsx($e,{type:"button",variant:"ghost",size:"sm",disabled:G,onClick:J,children:K}),e[53]=G,e[54]=J,e[55]=K,e[56]=q):q=e[56];let X;e[57]!==Z||e[58]!==q?(X=r.jsxs("div",{className:"flex items-center gap-2",children:[Z,q]}),e[57]=Z,e[58]=q,e[59]=X):X=e[59];let L;e[60]!==i?(L=i("sandbox.previewAs.momentHint"),e[60]=i,e[61]=L):L=e[61];let M;e[62]!==L?(M=r.jsx("p",{className:"text-xs text-muted-foreground",children:L}),e[62]=L,e[63]=M):M=e[63];let U;e[64]!==_||e[65]!==X||e[66]!==M?(U=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[_,X,M]}),e[64]=_,e[65]=X,e[66]=M,e[67]=U):U=e[67];let H;e[68]!==i?(H=i("sandbox.previewAs.testsLabel"),e[68]=i,e[69]=H):H=e[69];let F;e[70]!==H?(F=r.jsx("span",{className:"text-sm font-medium",children:H}),e[70]=H,e[71]=F):F=e[71];let z;e[72]!==p||e[73]!==s||e[74]!==h||e[75]!==i||e[76]!==n?(z=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(Xo,{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(ir,{value:"off",children:i("sandbox.previewAs.off")}),r.jsx(ir,{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]=z):z=e[77];let V;e[78]!==F||e[79]!==z?(V=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[F,z]}),e[78]=F,e[79]=z,e[80]=V):V=e[80];let Q;e[81]!==m||e[82]!==c||e[83]!==i?(Q=m&&r.jsx($e,{type:"button",variant:"outline",size:"sm",onClick:()=>c({}),children:i("sandbox.previewAs.reset")}),e[81]=m,e[82]=c,e[83]=i,e[84]=Q):Q=e[84];let ne;e[85]!==A||e[86]!==U||e[87]!==V||e[88]!==Q?(ne=r.jsxs(Br,{className:"flex w-80 flex-col gap-4 p-4",align:"center",sideOffset:8,"data-testid":"preview-as",children:[A,U,V,Q]}),e[85]=A,e[86]=U,e[87]=V,e[88]=Q,e[89]=ne):ne=e[89];let se;return e[90]!==k||e[91]!==ne||e[92]!==b?(se=r.jsxs(Mr,{onOpenChange:b,children:[k,ne]}),e[90]=k,e[91]=ne,e[92]=b,e[93]=se):se=e[93],se}const sd=15e3;function rd(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 br(t){return t.loading?{...t,loading:!1}:t}function ad(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 id(t,{base:e,frameSrc:n,loadedSrc:s,wanted:a,canSwap:l}){const c=t?.base===e?t:null,o=c?.src??n,i=c?.shown??n;return!a||!o||!i?null:i===a?c:l&&s===o&&ad(i,a)?{base:e,src:o,shown:a}:null}const od=["next"],ld=["@tanstack/react-router","@tanstack/react-start","@tanstack/solid-router","@tanstack/solid-start"],fa=new Set(["tsx","ts","jsx","js","mdx"]),cd=new Set(["tsx","jsx"]),dd=new Set(["404","500"]);function ud(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 fd(t){const e=ud(t);return od.some(n=>e.has(n))?"next":ld.some(n=>e.has(n))?"tanstack":null}function pa(t,e){const n=(t??"").trim().replace(/^[/\\]+|[/\\]+$/g,"");return n?`${n}/${e}`:e}function pd(t,e){const n=s=>pa(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 md(t){const e=es(t.at(-1)??"");if(!e||!fa.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&&dd.has(n)||s.some(a=>a.startsWith("_")||a.includes("["))?null:(s.at(-1)==="index"&&s.pop(),`/${s.join("/")}`)}function hd(t){const e=es(t.at(-1)??"");if(!e||e[0]!=="page"||!fa.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 gd(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 vd(t){const e=es(t.at(-1)??"");if(!e||!cd.has(e[1]))return null;const n=[...t.slice(0,-1),...gd(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 c=l.replace(/_$/,"").replace(/[[\]]/g,"");c&&a.push(c)}return`/${a.join("/")}`}function xd(t,e){const n=e.split("/").filter(Boolean);if(n.length===0)return null;switch(t){case"next-pages":return md(n);case"next-app":return hd(n);case"tanstack":return vd(n);default:{const s=t;throw new Error(`Unknown router: ${String(s)}`)}}}function bd(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 c=xd(n.router,l.slice(a.length));c&&e.add(c)}}return[...e].sort((n,s)=>n==="/"?-1:s==="/"?1:n.localeCompare(s))}const wd=5e3,yd=6e4;async function kd(t,e){const n=await fetch(Zo(t,"glob"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pattern:e.pattern,path:e.dir,limit:wd})});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 Sd(t,e){const n=await so(t,pa(e,"package.json"));if(n.kind==="unavailable")throw new Error("package.json unavailable: sandbox not ready");const s=n.kind==="data"?fd(n.data):null;if(!s)return[];const a=pd(s,e),l=await Promise.all(a.map(async c=>({root:c,files:await kd(t,c)})));return bd(l)}function Pd(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?Sd(t,e):[],s[3]=e,s[4]=t,s[5]=l):l=s[5];const c=n&&!!t;let o;s[6]!==a||s[7]!==l||s[8]!==c?(o={queryKey:a,queryFn:l,enabled:c,staleTime:yd},s[6]=a,s[7]=l,s[8]=c,s[9]=o):o=s[9];const i=Nr(o);let d;return s[10]!==i.data?(d=i.data??[],s[10]=i.data,s[11]=d):d=s[11],d}const jd=500,Ed={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},wr=1,ln=["desktop","mobile","tablet"],Nd=["preview","visual","blocks"],yr={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Td(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 Cd(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 Rd(t,e){return!t||t.nav!==e.nav?!1:t.content!==e.content}function Ld(t,e,n){const s=t.toLowerCase(),a=e.toLowerCase(),l=a.split("/").filter(Boolean),c=i=>{if(i===n)return 100;const d=i.indexOf(n);if(d===-1)return 0;let m=40;return d===0?m+=30:/[\s/-]/.test(i[d-1]??"")&&(m+=20),m+=Math.round(n.length/i.length*20),m};let o=Math.max(c(s),c(a));return l.at(-1)===n?o=Math.max(o,95):l.includes(n)&&(o=Math.max(o,90)),o}function Ad(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function _d({virtualMcpId:t}){const e=Te(),n=Jr(),{currentBranch:s,taskId:a,virtualMcpId:l}=Mt(),c=!!Ti(),o=ea(),i=zi(l===t?t:null),d=Hr(t),m=el(i?.metadata?.ui?.layout??null),f=Zr(m),p=ua({contentEditingEnabled:f,isMobile:n}),[S]=j.useState(()=>Zc({cmsMode:m,isMobile:n})),[v,x]=Un(In.previewEditingMode(t),u=>u&&Nd.includes(u)?u:null),h=v??S,[b,T]=Un(In.previewDeviceSize(t),u=>u&&ln.includes(u)?u:"desktop"),[y,g]=j.useState(null),[N,E]=j.useState(null),k=j.useRef(null),P=j.useRef(null),[C,O]=j.useState(!1),R=j.useRef(null),A=()=>{R.current?.flush(),O(!1)},D=()=>O(u=>(u&&R.current?.flush(),!u)),[_,B]=j.useState({width:0,height:0}),[W,Z]=j.useState(!1),[G,J]=j.useState({}),[K,q]=j.useState(""),X=j.useRef(null),[L,M]=j.useState(!1),[U,H]=j.useState(),[F,z]=j.useState(null),[V,Q]=j.useState(null),[ne,se]=j.useState(null),[I,re]=j.useState(()=>o.state.target?.kind==="page"?o.state.target.path:"/"),[ae,ie]=j.useState(()=>o.state.target?.kind==="page"?o.state.target.key:null),[me,pe]=j.useState({}),[xe,he]=j.useState(!1),ve=j.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(),Me=Ut(),Ue=Me.vmEntry,Be=Re.lifecycle.phase,{url:vt}=qr(t),ge=fn(t,s),{connection:_e}=Gr(t),be=Go(t),Ie=ro({hasServeConnection:!!_e,runtime:d.runtime}),Le=!Xe(ge)&&ge.kind!=="pending",ee=He(ge)??vt,ce=ee??Me.previewUrl,We=!!ee||Be==="running",xt=i?.id===t?Vi(i.metadata):null,qe=!ee&&i?.id===t&&d.runtime==="cms",It=d.projectDefault==="cms",bt=Le?ao({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=Xr(ts,{fetchEnabled:We}),de=ns.data,Pe=pn.data,Ge=de?To(de,Pe).sort((u,w)=>u.name.localeCompare(w.name)):[],zt=t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s}:null,ss=zc(zt),ma=io(zt),mn=de&&Pe?Co(de,Pe):[],rs=Le&&de&&Pe?ki(Pe,de,"loaders"):[],as=K?(()=>{const u=K.toLowerCase();return Ge.map(w=>({page:w,score:Ld(w.name,w.path,u)})).filter(({score:w})=>w>0).sort((w,$)=>$.score-w.score||w.page.path.length-$.page.path.length).map(({page:w})=>w)})():Ge,is=mn.filter(u=>{if(!K)return!0;const w=K.toLowerCase();return u.name.toLowerCase().includes(w)||u.key.toLowerCase().includes(w)||u.resolveType.toLowerCase().includes(w)}),os=p?rs:[],ls=os.filter(u=>{if(!K)return!0;const w=K.toLowerCase();return u.title.toLowerCase().includes(w)||u.key.toLowerCase().includes(w)||u.resolveType.toLowerCase().includes(w)}),Kt=V?rs.find(u=>u.key===V)??null:null,Ee=Qn,hn=F||V?null:Ro(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 u=Si(Pe,"loaders"),w=oe?de[oe]:void 0,$=oc(w,de,ye=>u.has(ye)),te=nc($);for(const ye of Bt(I)){if(ye.type!=="param")continue;const Ne=Zl(I,ye.name,$),ot=ac(Ne,u,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?$o(de,oe,0):[],ds=Xe(ge),us=de?Pi(cs,de,ds):[],yt=us.map(u=>u.isSavedBlock?u.label:""),kt=us.map(u=>u.isSavedBlock?"global":u.isMultivariate?"variant":"normal"),St=cs.map(u=>Vn(u,de??{},ds)),st=j.useRef(null),Oe=j.useRef(null),ha=Re.status.state==="paused",vn=Re.phase,fs=ji({claimPhase:vn,lifecycle:Re.lifecycle}),Je=Me.previewState,ga=Me.userStopped,va=oo(le.slug,t??""),{url:ze}=Fo(qe&&t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s,previewServerUrl:xt??null,path:Ce}:null),xa=It&&d.runtime==="sandbox",Ae=lo(ge,Ie,be),ps=co(Ae&&qe&&ge.kind==="protocol"&&t&&s?{orgSlug:le.slug,virtualMcpId:t,branch:s}:null),ms=Ae?ps.pointer:null,Y=Cl({previewState:Je,progressStatus:fs.status,previewServerUrl:xt,fastPreviewActive:qe,fastPreviewReady:!!ze,codingSession:xa,localPreviewUrl:ee,hostedDraft:Ae,hostedPointerPending:Ae&&(ge.kind==="pending"||ps.pending)}),hs=Y.showWakingPill||Ae&&Y.mode==="production"&&!ms,Pt=Y.mode!=="none",ba=Y.mode==="production"&&Y.iframeBase?$t(Y.iframeBase):null,rt=Y.mode==="production"?ba:$t(ce),wa=i?.id===t&&i.metadata?.fastPreviewInPlace===!0,jt=Le?ee?Y.mode==="sandbox"&&p&&h==="blocks":Y.mode==="production"&&qe&&wa&&p&&h==="blocks":!1,gs=j.useRef(null),{pin:ya,effective:ka}=Cd(gs.current,{inPlaceRenderActive:jt,draftPreviewUrl:ze,resolvedPath:Ce});gs.current=ya;const vs=o.state.variantOverride??[],Vt=Le?vs:[],Et=Le?[]:vs,Wt=Xe(ge)&&Lo.some(u=>Ao(Pe,u)==="available"),at=Wt?G:{},xs=Wr(at),Sa=Wt&&de?Object.keys(_o(de).experiments):[],[bs,Pa]=j.useState(!1),ws=uo(zt,Wt&&bs?Oo:[]),ja={...ws,ready:!(ge.kind==="protocol"&&ge.hosted)||bs&&ws.ready},Ye=t?Js(le.slug,t):null,Ea=fo(Ye),qt=Ae?td({display:Y,path:Ce,pointer:ms,heldRevision:Ea,device:b,forcedVariants:Et,previewOptions:at}):null,ys=JSON.stringify([Et,at]);j.useEffect(()=>{if(!Ae||!Ye)return;const[u,w]=JSON.parse(ys);Ys(Ye,{forcedVariants:u,previewOptions:w})},[Ae,Ye,ys]),j.useEffect(()=>{if(!(!Ae||!Ye))return()=>Ys(Ye,null)},[Ae,Ye]);const xn=_e&&He(ge)?po(_e.endpoint,Et,xs):null,Na=_e&&He(ge)?xn?mo(xn,at):Qs:null,Qe=Td(Y.mode==="sandbox"?nn(Hn(Xs(ne??Bn(Ce,Y.iframeBase)??Y.iframeBase,Na),b),Vt):Y.mode==="production"&&qt?.frame?qt.frame:Y.mode==="production"?nn(Hn(Zs(er(Xs(ne??ka??Bn(Ce,Y.iframeBase)??Y.iframeBase,hs?Qs:null),Et),at),b),Vt):null),ks=ze??(Y.iframeBase?Bn(Ce,Y.iframeBase):null),Ss=Y.mode==="production"&&qt?qt.newTab:Y.mode==="production"?ks?nn(Zs(er(ks,Et),at),Vt):null:Qe??Y.iframeBase,Ta=()=>{const u=Ss;u&&window.open(u,"_blank","noopener")},Nt=t&&s?Ar(le.slug,t,s):null,Tt=u=>{Nt&&Ri(Nt,u)},ke=o.state.target;j.useEffect(()=>{if(!(!ke||!bt||!Pe))if(ke.kind==="page"){const u=me[ke.key]??{};Oe.current=Ve(ke.path,u),z(null),Q(null),se(null),ie(ke.key),re(ke.path),Tt({path:ke.path,pageKey:ke.key,params:u})}else if(ke.kind==="loader")Oe.current=null,z(null),Q(ke.key),se(null);else{const u=mn.find(w=>w.key===ke.key);if(u){Oe.current=null;const w=nr(Pe);Q(null),z(u),se(tr(bt,w,u.key))}}},[ke,bt,Pe,me]),j.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,Ca]=j.useState(null);if(Je.kind==="iframe"&&Ps!==Je.previewUrl){const u=Ps!==null;Ca(Je.previewUrl);const w=Nt?Lr(Nt):null;if(w){if(Oe.current=Ve(w.path,w.params),re(w.path),ie(w.pageKey),se(null),z(null),Q(null),w.pageKey&&Object.keys(w.params).length>0){const $=w.pageKey;pe(te=>({...te,[$]:w.params}))}}else u&&(Oe.current=null,re("/"),se(null),ie(null),z(null),Q(null))}st.current=Qe;const Ra=Y.mode==="production"&&!!ze&&!ee,[Gt,bn]=j.useState({src:Qe??void 0,loading:!1}),[La,wn]=j.useState(!1),[Aa,_a]=j.useState(),[js,Es]=j.useState(null),je=id(js,{base:Y.iframeBase??"",frameSrc:Gt.src,loadedSrc:Aa,wanted:Qe??void 0,canSwap:be&&La&&!Gt.loading});je!==js&&Es(je);const Jt=rd(Gt,je?je.src:Qe??void 0,Ra);Jt!==Gt&&bn(Jt);const it=Jt.src,Ns=Jt.loading,Ts=_l({iframeRef:k,src:Y.mode==="sandbox"?Qe:null,active:Y.mode==="sandbox"}),Cs=j.useRef(null);j.useEffect(()=>{const u=Ns?setTimeout(()=>bn(br),sd):null,w=()=>{u&&clearTimeout(u)};if(!ze||!it||Cs.current===ze)return w;Cs.current=ze;const $=k.current;return $&&$.getAttribute("src")!==it&&(Se(),$.src=it),w},[ze,it,Ns]);const Rs=()=>{const u=k.current?.contentWindow,w=rt;if(!u||!w||!de||!oe)return;const $=de[oe];if(!$||typeof $!="object")return;const te=bo({previewBaseUrl:w,pageBlock:$,decofile:de,path:Ce,pathTemplate:I});if(!te)return;const ye=nn(te.src,yo(Vt,oe));u.postMessage({type:"cms-editor::render",src:ye,body:te.body},w)},yn=j.useRef(null);j.useEffect(()=>{if(!jt||F||V||!oe||!de){yn.current=null;return}const u={nav:JSON.stringify({page:oe,path:Ce,pathTemplate:I}),content:JSON.stringify(de)},w=Rd(yn.current,u);yn.current=u,w&&Rs()},[de,jt,F,V,oe,Ce,I]);const kn=j.useRef(null);j.useEffect(()=>{if(!jt||F||V||!oe||!de){kn.current=null;return}const u=JSON.stringify(o.state.variantOverride??null),w=kn.current;kn.current={page:oe,sig:u},!(!w||w.page!==oe||w.sig===u)&&Rs()},[o.state.variantOverride,jt,F,V,oe]);const Ls=!!t&&!!s&&!Re.notFound&&!ga&&!ha&&(vn?.kind==="ready"||Be!=="idle"),As=!Xe(ge),Oa=Vr(t??void 0),Da=Pd(wt,Oa,As&&Ls),Fa=new Set(Ge.map(u=>Ee(u.path))),Yt=As?Da.filter(u=>!Fa.has(Ee(u))):[],_s=K?Yt.filter(u=>u.toLowerCase().includes(K.toLowerCase())):Yt,we=ed({editingMode:h,sandboxDisplay:Y.mode==="sandbox",blocksEditingEnabled:p});j.useEffect(()=>{const u=rt;if(!u)return;const w=$=>{if($.origin===u)if($.data?.type==="visual-editor::element-clicked"){const te=$l.safeParse($.data.payload);te.success&&g(te.data)}else if($.data?.type==="cms-editor::section-clicked"){const te=Ul.safeParse($.data.payload);te.success&&E({index:te.data.sectionIndex,seq:te.data.clickSeq})}else $.data?.type==="cms-editor::render-start"?Se():$.data?.type==="cms-editor::render-end"?(fe(),k.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:yt,kinds:kt,keys:St},u)):$.data?.type==="cms-editor::render-error"&&fe()};return window.addEventListener("message",w),()=>window.removeEventListener("message",w)},[rt,yt,kt,St]);const Os=()=>{const u=k.current?.contentWindow,w=$t(ce),$=Mc({v8:be,script:Bl});!u||!w||!$||u.postMessage($,w)},$a=()=>{if(be)return;const u=k.current?.contentWindow,w=$t(ce);!u||!w||u.postMessage({type:"visual-editor::deactivate"},w)},Ds=()=>{const u=Ke.current;u?.has("wireframe")&&(u.wireframe({type:"wireframe:sections",labels:yt,kinds:kt,keys:St}),u.wireframe({type:we==="blocks"?"wireframe:activate":"wireframe:deactivate"}))},Sn=()=>{if(be){Ds();return}const u=k.current?.contentWindow,w=rt,$=Bc({v8:be,production:Y.mode==="production",localPreview:!!ee,script:Il});!u||!w||!$||(u.postMessage($,w),u.postMessage({type:"cms-editor::set-labels",labels:yt,kinds:kt,keys:St},w))},Ba=()=>{if(be){Ke.current?.wireframe({type:"wireframe:deactivate"});return}const u=k.current?.contentWindow,w=rt;!u||!w||u.postMessage({type:"cms-editor::deactivate"},w)},Ma=()=>{if(Ke.current?.wireframe({type:"wireframe:clear-hover"}),be)return;const u=k.current?.contentWindow,w=rt;!u||!w||(u.postMessage({type:"cms-editor::clear-hover"},w),u.postMessage({type:"visual-editor::clear-hover"},w))},Qt=u=>{if(u==="blocks"&&!p)return;const w=h;!n&&u!==w&&(u==="blocks"?P.current?.resize("30%"):P.current?.collapse()),x(u),g(null),E(null),u!=="blocks"&&Q(null),w==="visual"&&$a(),u==="visual"&&Os(),w==="blocks"&&u!=="blocks"&&Ba(),u==="blocks"&&Sn()},Ua=()=>{Qt(Qc(h,p))},Ia=()=>{Qt(Xc(h,p))},Xt=()=>{const u=k.current;if(!u)return;Se();const w=document.activeElement,$=u.tabIndex;u.tabIndex=-1,u.style.pointerEvents="none",u.blur(),Ad(u,st.current);let te;const ye=()=>{clearTimeout(te),u.tabIndex=$,u.style.pointerEvents="";const Ne=document.activeElement;(!Ne||Ne===document.body||Ne===u)&&w?.focus(),u.removeEventListener("load",ye)};u.addEventListener("load",ye),te=setTimeout(ye,3e3)};Mo(Xt);const Ke=j.useRef(null),Fs=j.useEffectEvent(Ds),za=j.useEffectEvent((u,w)=>{E({index:u,seq:w})}),Ka=j.useEffectEvent(()=>{fe(),je&&(Pn.current=je.shown),Rt&&An(Ct)}),$s=j.useEffectEvent(()=>{if(wn(!1),je&&Es(null),je&&je.src!==st.current){Se();return}Xt()});j.useEffect(()=>{if(!be)return;const u=new Wl({studioOrigin:window.location.origin,build:"4.566.0",frame:()=>k.current?.contentWindow??null,onWireframeReady:()=>Fs(),onWireframe:$=>{$.type==="wireframe:select"&&za($.sectionIndex,$.clickSeq)},onModulesChange:()=>wn(u.has("html-swap")),onSwapEnd:()=>Ka(),onSwapFailed:()=>$s()});Ke.current=u;const w=$=>{u.handle($)};return window.addEventListener("message",w),()=>{window.removeEventListener("message",w),u.dispose(),wn(!1),Ke.current===u&&(Ke.current=null)}},[be,Y.iframeBase]);const Bs=be?JSON.stringify([yt,kt,St,we]):"";j.useEffect(()=>{Bs&&Fs()},[Bs]);const Ms=j.useRef(null);j.useEffect(()=>{const u=Ms.current;if(Ms.current=je,je&&je!==u){Ke.current?.refresh(je.shown)?Se():$s();return}!je&&u&&u.shown!==u.src&&u.src===st.current&&Xt()},[je]);const Us=()=>{Ke.current?.refresh()||Xt()},Ct=Js(le.slug,t??""),Rt=Ae&&Pt&&!!t,Pn=j.useRef(null);j.useEffect(()=>{if(Rt)return ho(Ct)},[Rt,Ct]);const{reload:Lt}=go(le.slug,t??""),Is=j.useRef(Lt.seq);j.useEffect(()=>{if(Is.current!==Lt.seq&&(Is.current=Lt.seq,!!Rt&&Pn.current===st.current)){if(Lt.navigates){An(Ct);return}Us()}},[Lt.seq]);const Ha=vo(zt),At=xo(He(ge)?Ha:""),zs=j.useRef(At);j.useEffect(()=>{const u=zs.current;if(zs.current=At,!u||!At||u===At)return;const w=k.current;if(w)return Fl({iframe:w,reload:Us})},[At]);const Va=()=>{const u=ln.indexOf(b);T(ln[(u+1)%ln.length])},jn=(u,w)=>{if(!oe)return;const $=oe,te={...nt,[u]:w};Oe.current=Ve(I,te),pe(ye=>({...ye,[$]:te})),Tt({path:I,pageKey:$,params:te})},Wa=Dc({iframeBase:Y.iframeBase,resolvedPath:Ce,activeGlobalSectionName:F?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),En=u=>{const w=me[u.key]??{},$=Ve(u.path,w);(F||Ee($)!==Ee(Ce))&&Se(),Oe.current=$,z(null),Q(null),se(null),E(null),ie(u.key),re(u.path),Tt({path:u.path,pageKey:u.key,params:w}),o.selectTarget({kind:"page",key:u.key,path:u.path})},Ks=u=>{(F||Ee(u)!==Ee(Ce))&&Se(),Oe.current=u,z(null),Q(null),se(null),E(null),ie(null),re(u),Tt({path:u,pageKey:null,params:{}})};Ci(Nt,Ks);const qa=u=>{if(Xe(ge)){const te=de?Do(de,u.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 w=nr(Pe),$=tr(bt,w,u.key);z(u),Q(null),se($),E(null),o.selectTarget({kind:"section",key:u.key})},Ga=u=>{p&&(z(null),Q(u.key),se(null),Qt("blocks"),o.selectTarget({kind:"loader",key:u.key}))},Ja=async({name:u,path:w,templateKey:$})=>{if(!t||!s)return;const te=Qr(w);if(te){H(te);return}const ye=w.trim().startsWith("/")?w.trim():`/${w.trim()}`;if(Ge.some(Ne=>Ee(Ne.path)===Ee(ye))){H(e("sandbox.preview.pageAlreadyExists",{path:ye}));return}H(void 0);try{const Ne=$?await ma(de,$):void 0;if($&&!Ne){H(e("sandbox.preview.templateNoLongerExists"));return}const ot=await ss.mutateAsync({name:u,path:ye,template:Ne,schema:Xe(ge)?{meta:Pe,loadMeta:async()=>(await pn.refetch()).data}:void 0});M(!1),dn.success(e("sandbox.preview.pageCreated",{name:u})),await nl(jd),En({key:ot.key,name:ot.name,path:ot.path}),Qt("blocks")}catch(Ne){H(Ne instanceof da?e("sandbox.preview.pageSchemaNotReady"):Ne instanceof Error?Ne.message:e("sandbox.preview.failedToCreatePage"))}},Zt=Fc({previewSurfaceActive:Pt,daemonReady:Ls,production:Y.mode==="production",servePreviewUrl:He(ge)}),Ya=$c({showPreviewToolbar:Zt,contentEditingEnabled:f}),_t=()=>{Z(!1),q("")},Nn=F?.name??Kt?.title??hn?.name,Tn=ns.isPending||pn.isPending,Cn=Tn?$t(Y.iframeBase):Nn,Ot=F?`section:${F.key}`:V?`loader:${V}`:oe?`page:${oe}`:Yt.includes(Ee(I))?`route:${Ee(I)}`:void 0,Qa=Zt?Ya?r.jsxs(Mr,{open:W,onOpenChange:u=>{Z(u),u||q("")},children:[r.jsx($r,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":e("sandbox.preview.choosePage"),"data-testid":"preview-page-picker",title:Tn?Cn??void 0:F||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:[F&&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(Fi,{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($i,{size:11}),e("sandbox.preview.loaderBadge")]}),Cn&&r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:Cn}),!Tn&&!F&&!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(Li,{size:12,className:Fe("shrink-0 transition-transform",W&&"rotate-180")})]})})}),r.jsxs(Br,{className:"w-112 max-w-[calc(100vw-2rem)] p-0",align:"center",sideOffset:8,children:[r.jsxs(Ir,{shouldFilter:!1,defaultValue:Ot,children:[r.jsx(zr,{value:K,onValueChange:u=>{q(u),X.current?.scrollTo({top:0})},placeholder:e("sandbox.preview.searchPagesAndComponents")}),r.jsxs(Ur,{ref:X,className:"max-h-80",children:[r.jsx(Kr,{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(u=>r.jsxs(ut,{value:`page:${u.key}`,"aria-current":Ot===`page:${u.key}`||void 0,title:`${u.name} · ${u.path}`,onSelect:()=>{_t(),En(u)},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:u.name}),r.jsx("span",{className:"min-w-0 max-w-1/2 truncate text-right font-mono text-xs text-muted-foreground",children:u.path})]},u.key))}),_s.length>0&&r.jsx(dt,{heading:e("sandbox.preview.siteRoutes"),children:_s.map(u=>r.jsx(ut,{value:`route:${u}`,"aria-current":Ot===`route:${u}`||void 0,title:u,onSelect:()=>{_t(),Ks(u)},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:u})},u))}),is.length>0&&r.jsx(dt,{heading:e("sandbox.preview.globalComponents"),children:is.map(u=>r.jsx(ut,{value:`section:${u.key}`,"aria-current":Ot===`section:${u.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{_t(),qa(u)},children:r.jsx("span",{className:"truncate",children:u.name})},u.key))}),ls.length>0&&r.jsx(dt,{heading:e("sandbox.preview.globalLoaders"),children:ls.map(u=>r.jsx(ut,{value:`loader:${u.key}`,"aria-current":Ot===`loader:${u.key}`||void 0,className:"aria-[current=true]:bg-accent aria-[current=true]:text-accent-foreground",onSelect:()=>{_t(),Ga(u)},children:r.jsx("span",{className:"truncate",children:u.title})},u.key))})]})]}),!F&&!V&&Bt(I).some(u=>u.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((u,w)=>{if(u.type==="text")return r.jsx("span",{children:u.text},`text-${w}`);const $=gn[u.name];return $&&wt?r.jsx(kc,{sources:$,template:I,paramName:u.name,value:nt[u.name]??"",sandboxRef:wt,onCommit:te=>jn(u.name,te)},`${oe}:${u.name}`):r.jsx(_c,{name:u.name,value:nt[u.name]??"",onCommit:te=>jn(u.name,te)},`${oe}:${u.name}`)})}),r.jsx("div",{className:"border-t p-1.5",children:r.jsxs($e,{variant:"ghost",className:"w-full justify-start",onClick:()=>{_t(),H(void 0),M(!0)},children:[r.jsx(Fr,{size:16}),e("sandbox.preview.createNewPage")]})})]})]}):r.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:Wa}):null,Hs=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:Va,"aria-label":e(yr[b]),children:b==="mobile"?r.jsx(Or,{size:16}):b==="tablet"?r.jsx(Bi,{size:16}):r.jsx(Dr,{size:16})})}),r.jsx(mt,{children:e(yr[b])})]}),Qa,r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Wt&&r.jsx(nd,{tests:Sa,load:ja,onOpen:()=>Pa(!0),options:G,onChange:u=>{J(u),o.previewAsChanged()},available:!!xn||!hs||!xs}),r.jsx(Ze,{onClick:Ta,disabled:Ae&&!Ss,"aria-label":e("sandbox.preview.openInNewTab"),children:r.jsx(Tr,{size:16})})]})]}):null,Xa=(Le||c)&&Y.mode==="sandbox",en=Ed[b],tn=b==="desktop"&&(_.width===0||_.width>=en.width+2*wr),Vs=tn?1:Math.min(_.width>0?_.width/(en.width+2*wr):1,1),Za=tn?{width:"100%",height:"100%"}:{width:`${en.width}px`,height:_.height>0?`${_.height/Vs}px`:`${en.height}px`,transform:`scale(${Vs})`,transformOrigin:"top center"},Ws=r.jsxs(r.Fragment,{children:[Xa&&(Zt||f)&&r.jsx(Ze,{onClick:Ua,"aria-pressed":we==="visual","aria-label":e("sandbox.preview.visualEditor"),active:we==="visual",children:r.jsx(Gs,{size:16})}),p&&r.jsxs(ht,{children:[r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{onClick:Ia,"aria-pressed":we==="blocks","aria-label":e("sandbox.preview.blocksEditor"),active:we==="blocks",children:r.jsx(Ui,{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":C,"aria-label":e("sectionsEditor.sectionsEditor.viewJson"),active:C,children:r.jsx(Mi,{size:16})})}),r.jsx(mt,{children:e("sectionsEditor.sectionsEditor.viewJson")})]})]}),ei=!!V&&we==="blocks";return r.jsxs("div",{className:"flex flex-col w-full h-full",children:[wt&&Object.entries(gn).map(([u,w])=>(nt[u]??"")===""?r.jsx(Lc,{sources:w,template:I,paramName:u,sandboxRef:wt,onFill:$=>jn(u,$)},`${oe}:${u}`):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:Hs}),children:Hs}),r.jsx(zn.Toolbar.Right.Portal,{fallback:Ws,children:Ws})]}),r.jsx("div",{className:"flex-1 overflow-hidden relative",children:ei?r.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[r.jsx(vr,{virtualMcpId:t,externalSelection:N,onViewJsonFile:D}),C&&tt&&r.jsx("div",{className:"absolute inset-0 z-10",children:r.jsx(xr,{ref:R,virtualMcpId:t,pageKey:tt,onClose:A})})]}):r.jsxs(sr,{orientation:"horizontal",disabled:we!=="blocks",className:"relative isolate",children:[r.jsx(sn,{ref:P,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(vr,{virtualMcpId:t,externalSelection:N,onViewJsonFile:D})}),we==="blocks"&&r.jsx(rr,{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(sr,{orientation:"horizontal",disabled:!(C&&tt),children:[r.jsx(sn,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:r.jsxs("div",{ref:u=>{if(!u)return;const w=()=>B(te=>te.width===u.clientWidth&&te.height===u.clientHeight?te:{width:u.clientWidth,height:u.clientHeight});w();const $=new ResizeObserver(w);return $.observe(u),()=>$.disconnect()},className:Fe("h-full relative overflow-clip flex justify-center",Pt&&!tn&&"bg-muted/30"),children:[(xe||va)&&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"})}),Y.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"})}),Y.showBlockingOverlay&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"starting",progress:fs,claimPhase:vn})}),!ee&&Je.kind==="suspended"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"suspended",onResume:Me.resume})}),!ee&&Je.kind==="errored"&&r.jsx("div",{className:"absolute inset-0 z-30",children:r.jsx(Ln,{kind:"errored",error:Je.error,onRetry:Me.retry,connectionsHref:`/${le.slug}/settings/connections`})}),Y.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"&&!y&&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(Gs,{size:12}),e("sandbox.preview.clickElementToAsk")]}),we==="visual"&&y&&r.jsx(Yl,{element:y,onDismiss:()=>g(null)}),Pt&&Qe&&r.jsx("div",{className:Fe("shrink-0",!tn&&"bg-background shadow-edge"),style:Za,onMouseLeave:Ma,children:r.jsx("iframe",{ref:k,src:it,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Ts.handleError,onLoad:()=>{if(bn(br),_a(it),Ts.handleLoad(),fe(),Pn.current=st.current,Rt&&An(Ct),Y.mode!=="sandbox"||ee){(Y.mode==="production"&&!Y.showWakingPill||ee)&&we==="blocks"&&Sn();return}if(ui("vm_preview_loaded",{view_mode:we,vm_id:Ue?.sandboxHandle??null}),!F)try{const u=k.current?.contentWindow?.location?.pathname;if(!u)return;const w=Oe.current;if(w!==null&&(Oe.current=null,Ee(u)!==Ee(w))||Ee(u)===Ee(Ce))return;re(u),Tt({path:u,pageKey:ae,params:nt})}catch{}we==="visual"&&Os(),we==="blocks"&&Sn()}},Y.iframeBase)})]})}),C&&tt&&r.jsxs(r.Fragment,{children:[r.jsx(rr,{withHandle:!0}),r.jsx(sn,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:r.jsx(xr,{ref:R,virtualMcpId:t,pageKey:tt,onClose:A})})]})]})})]})}),r.jsx(Kc,{open:L,onOpenChange:M,isPending:ss.isPending,error:U,templates:Ge,onSubmit:Ja})]})}const qn={app:null,split:!1};function Od(t){const e=ue.c(24),{project:n,maxApps:s,children:a}=t,l=Te();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={silent:!0},e[0]=c):c=e[0];const o=Ki(c),i=Ut();let d;e[1]!==n.metadata.runtime?(d=n.metadata.runtime??{},e[1]=n.metadata.runtime,e[2]=d):d=e[2];const m=d;let f;e[3]!==m.apps?(f=m.apps??[],e[3]=m.apps,e[4]=f):f=e[4];const p=f;let S;e[5]!==o.update||e[6]!==i||e[7]!==n.id||e[8]!==n.metadata||e[9]!==m||e[10]!==l?(S=y=>o.update.mutate({id:n.id,data:{metadata:{...sl(n.metadata),runtime:{...m,apps:y.length?y: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]=S):S=e[11];const v=S,x=m.path??null;let h,b;e[12]!==p||e[13]!==v?(h=y=>v([...p,{path:y}]),b=y=>v(p.filter(g=>g.path!==y)),e[12]=p,e[13]=v,e[14]=h,e[15]=b):(h=e[14],b=e[15]);let T;return e[16]!==p||e[17]!==a||e[18]!==s||e[19]!==n.id||e[20]!==x||e[21]!==h||e[22]!==b?(T=r.jsx(Dd,{virtualMcpId:n.id,mainPath:x,apps:p,maxApps:s,onAddApp:h,onRemoveApp:b,children:a}),e[16]=p,e[17]=a,e[18]=s,e[19]=n.id,e[20]=x,e[21]=h,e[22]=b,e[23]=T):T=e[23],T}function Dd(t){const e=ue.c(102),{virtualMcpId:n,mainPath:s,apps:a,maxApps:l,onAddApp:c,onRemoveApp:o,children:i}=t,d=Te(),m=Jr(),{currentBranch:f}=Mt(),p=Ut(),S=Xn().lifecycle.phase,v=fn(n,f),{url:x}=qr(n);let h;e[0]!==v||e[1]!==x?(h=He(v)??x,e[0]=v,e[1]=x,e[2]=h):h=e[2];const b=h,T=b??p.previewUrl,y=!!b||S==="running",g=!y&&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 E=N;let k;e[5]!==n?(k=In.previewAppLayout(n),e[5]=n,e[6]=k):k=e[6];const[P,C]=Un(k,Fd);let O;e[7]!==a||e[8]!==P?(O=a.some(fe=>fe.path===P.app)?P.app:null,e[7]=a,e[8]=P,e[9]=O):O=e[9];const R=O,A=R!==null&&P.split&&!m,D=R===null||A,_=R??a[0]?.path??null,[B,W]=j.useState(null),[Z,G]=j.useState(!1);let J;e[10]===Symbol.for("react.memo_cache_sentinel")?(J=()=>{W(null),G(!1)},e[10]=J):J=e[10];const K=J;let q;e[11]!==a||e[12]!==B||e[13]!==m||e[14]!==s||e[15]!==c||e[16]!==C?(q=()=>{if(B===null)return;const fe=or(B);if(!fe){K();return}if(fe===or(s??"")||a.some(le=>le.path===fe)){G(!0);return}c(fe),C({app:fe,split:!m}),K()},e[11]=a,e[12]=B,e[13]=m,e[14]=s,e[15]=c,e[16]=C,e[17]=q):q=e[17];const X=q;let L;e[18]!==s||e[19]!==d?(L=s?_n(s):d("sandbox.appTabs.root"),e[18]=s,e[19]=d,e[20]=L):L=e[20];const M=L;let U;e[21]!==A||e[22]!==d?(U=d(A?"sandbox.appTabs.single":"sandbox.appTabs.split"),e[21]=A,e[22]=d,e[23]=U):U=e[23];const H=U;let F;e[24]!==d?(F=d("sandbox.appTabs.label"),e[24]=d,e[25]=F):F=e[25];let z;e[26]!==d?(z=d("sandbox.appTabs.main"),e[26]=d,e[27]=z):z=e[27];let V;e[28]!==d?(V=d("sandbox.appTabs.mainHint"),e[28]=d,e[29]=V):V=e[29];let Q;e[30]!==C?(Q=()=>C(qn),e[30]=C,e[31]=Q):Q=e[31];let ne;e[32]!==g||e[33]!==M||e[34]!==y||e[35]!==D||e[36]!==z||e[37]!==V||e[38]!==Q?(ne=r.jsx(kr,{label:M,badge:z,hint:V,ready:y,failed:g,onScreen:D,onSelect:Q}),e[32]=g,e[33]=M,e[34]=y,e[35]=D,e[36]=z,e[37]=V,e[38]=Q,e[39]=ne):ne=e[39];let se;if(e[40]!==a||e[41]!==R||e[42]!==g||e[43]!==M||e[44]!==o||e[45]!==y||e[46]!==C||e[47]!==A||e[48]!==d){let fe;e[50]!==R||e[51]!==g||e[52]!==M||e[53]!==o||e[54]!==y||e[55]!==C||e[56]!==A||e[57]!==d?(fe=le=>{const Re=_n(le.path);return r.jsx(kr,{label:Re,hint:d("sandbox.appTabs.extraHint",{app:M}),ready:y,failed:g,onScreen:le.path===R,onSelect:()=>C({app:le.path,split:A}),onRemove:()=>o(le.path),removeLabel:d("sandbox.appTabs.remove",{app:Re})},le.path)},e[50]=R,e[51]=g,e[52]=M,e[53]=o,e[54]=y,e[55]=C,e[56]=A,e[57]=d,e[58]=fe):fe=e[58],se=a.map(fe),e[40]=a,e[41]=R,e[42]=g,e[43]=M,e[44]=o,e[45]=y,e[46]=C,e[47]=A,e[48]=d,e[49]=se}else se=e[49];let I;e[59]!==ne||e[60]!==se||e[61]!==F?(I=r.jsxs("div",{role:"tablist","aria-label":F,className:"flex min-w-0 items-center gap-1 overflow-x-auto",children:[ne,se]}),e[59]=ne,e[60]=se,e[61]=F,e[62]=I):I=e[62];let re;e[63]!==a.length||e[64]!==X||e[65]!==B||e[66]!==Z||e[67]!==l||e[68]!==d?(re=B!==null?r.jsx("form",{className:"w-40 shrink-0",onSubmit:fe=>{fe.preventDefault(),X()},children:r.jsx("input",{autoFocus:!0,value:B,placeholder:"apps/checkout","aria-label":d("sandbox.appTabs.pathLabel"),"aria-invalid":Z,onChange:fe=>{W(fe.target.value),G(!1)},onBlur:K,onKeyDown:fe=>{fe.key==="Escape"&&K()},className:Fe("h-7 w-full rounded-md border bg-background px-2 font-mono text-xs outline-none",Z?"border-destructive":"border-border")})}):a.length<l&&r.jsx(ft,{label:d("sandbox.appTabs.add"),onClick:()=>W(""),children:r.jsx(Fr,{})}),e[63]=a.length,e[64]=X,e[65]=B,e[66]=Z,e[67]=l,e[68]=d,e[69]=re):re=e[69];let ae;e[70]!==m||e[71]!==C||e[72]!==A||e[73]!==H||e[74]!==_?(ae=!m&&_&&r.jsx(ft,{label:H,active:A,onClick:()=>C(A?qn:{app:_,split:!0}),children:r.jsx(Ii,{})}),e[70]=m,e[71]=C,e[72]=A,e[73]=H,e[74]=_,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]!==R||e[86]!==g||e[87]!==p.start||e[88]!==b||e[89]!==M||e[90]!==T||e[91]!==y||e[92]!==C||e[93]!==A||e[94]!==E?(he=R!==null&&r.jsx($d,{name:_n(R),mainName:M,appUrl:T?rl(T,R):null,ready:y,failed:g,notStarted:!b&&!E.includes(R),onStart:p.start,className:Fe(A&&"border-l border-border"),onClose:A?()=>C({app:R,split:!1}):void 0},R),e[85]=R,e[86]=g,e[87]=p.start,e[88]=b,e[89]=M,e[90]=T,e[91]=y,e[92]=C,e[93]=A,e[94]=E,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 Fd(t){return t??qn}function kr(t){const e=ue.c(28),{label:n,badge:s,hint:a,ready:l,failed:c,onScreen:o,onSelect:i,onRemove:d,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 S=l?"bg-success":c?"bg-destructive":"animate-pulse bg-warning";let v;e[2]!==S?(v=Fe("size-1.5 rounded-full",S),e[2]=S,e[3]=v):v=e[3];let x;e[4]!==v?(x=r.jsx("span",{"aria-hidden":!0,className:v}),e[4]=v,e[5]=x):x=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 b;e[8]!==s?(b=s&&r.jsx("span",{className:"text-[10px] text-muted-foreground",children:s}),e[8]=s,e[9]=b):b=e[9];let T;e[10]!==o||e[11]!==i||e[12]!==x||e[13]!==h||e[14]!==b?(T=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:[x,h,b]})}),e[10]=o,e[11]=i,e[12]=x,e[13]=h,e[14]=b,e[15]=T):T=e[15];let y;e[16]!==a?(y=r.jsx(mt,{className:"max-w-64",children:a}),e[16]=a,e[17]=y):y=e[17];let g;e[18]!==T||e[19]!==y?(g=r.jsxs(ht,{children:[T,y]}),e[18]=T,e[19]=y,e[20]=g):g=e[20];let N;e[21]!==d||e[22]!==m?(N=d&&r.jsx("button",{type:"button","aria-label":m,onClick:d,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(na,{className:"size-3"})}),e[21]=d,e[22]=m,e[23]=N):N=e[23];let E;return e[24]!==g||e[25]!==N||e[26]!==p?(E=r.jsxs("div",{className:p,children:[g,N]}),e[24]=g,e[25]=N,e[26]=p,e[27]=E):E=e[27],E}function $d(t){const e=ue.c(71),{name:n,mainName:s,appUrl:a,ready:l,failed:c,notStarted:o,onStart:i,className:d,onClose:m}=t,f=Te(),[p,S]=j.useState("/"),[v,x]=j.useState("desktop"),[h,b]=j.useState(0),T=j.useRef(null);let y;e[0]!==a||e[1]!==p?(y=a?al(a,p):null,e[0]=a,e[1]=p,e[2]=y):y=e[2];const g=y;let N;e[3]!==d?(N=Fe("flex min-h-0 min-w-0 flex-1 flex-col",d),e[3]=d,e[4]=N):N=e[4];let E;e[5]===Symbol.for("react.memo_cache_sentinel")?(E=V=>{V.preventDefault(),S(T.current?.value||"/")},e[5]=E):E=e[5];let k;e[6]!==n||e[7]!==f?(k=f("sandbox.appPane.path",{app:n}),e[6]=n,e[7]=f,e[8]=k):k=e[8];let P;e[9]!==p||e[10]!==k?(P=r.jsx("form",{className:"min-w-0 flex-1",onSubmit:E,children:r.jsx("input",{ref:T,defaultValue:p,"aria-label":k,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]=k,e[11]=P):P=e[11];let C;e[12]!==v||e[13]!==f?(C=f(v==="desktop"?"sandbox.preview.deviceMobile":"sandbox.preview.deviceDesktop"),e[12]=v,e[13]=f,e[14]=C):C=e[14];let O;e[15]===Symbol.for("react.memo_cache_sentinel")?(O=()=>x(Md),e[15]=O):O=e[15];let R;e[16]!==v?(R=v==="desktop"?r.jsx(Dr,{}):r.jsx(Or,{}),e[16]=v,e[17]=R):R=e[17];let A;e[18]!==C||e[19]!==R?(A=r.jsx(ft,{label:C,onClick:O,children:R}),e[18]=C,e[19]=R,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 _=!g||!l;let B,W;e[24]===Symbol.for("react.memo_cache_sentinel")?(B=()=>b(Bd),W=r.jsx(fi,{}),e[24]=B,e[25]=W):(B=e[24],W=e[25]);let Z;e[26]!==D||e[27]!==_?(Z=r.jsx(ft,{label:D,disabled:_,onClick:B,children:W}),e[26]=D,e[27]=_,e[28]=Z):Z=e[28];let G;e[29]!==n||e[30]!==f?(G=f("sandbox.appPane.openInNewTab",{app:n}),e[29]=n,e[30]=f,e[31]=G):G=e[31];const J=!g||!l;let K;e[32]!==g?(K=()=>g&&window.open(g,"_blank","noopener"),e[32]=g,e[33]=K):K=e[33];let q;e[34]===Symbol.for("react.memo_cache_sentinel")?(q=r.jsx(Tr,{}),e[34]=q):q=e[34];let X;e[35]!==G||e[36]!==J||e[37]!==K?(X=r.jsx(ft,{label:G,disabled:J,onClick:K,children:q}),e[35]=G,e[36]=J,e[37]=K,e[38]=X):X=e[38];let L;e[39]!==n||e[40]!==m||e[41]!==f?(L=m&&r.jsx(ft,{label:f("sandbox.appPane.close",{app:n}),onClick:m,children:r.jsx(na,{})}),e[39]=n,e[40]=m,e[41]=f,e[42]=L):L=e[42];let M;e[43]!==Z||e[44]!==X||e[45]!==L||e[46]!==P||e[47]!==A?(M=r.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-border px-2",children:[P,A,Z,X,L]}),e[43]=Z,e[44]=X,e[45]=L,e[46]=P,e[47]=A,e[48]=M):M=e[48];let U;e[49]!==s||e[50]!==f?(U=f("sandbox.appPane.previewOnly",{app:s}),e[49]=s,e[50]=f,e[51]=U):U=e[51];let H;e[52]!==U?(H=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:U}),e[52]=U,e[53]=H):H=e[53];let F;e[54]!==v||e[55]!==c||e[56]!==s||e[57]!==n||e[58]!==o||e[59]!==i||e[60]!==l||e[61]!==h||e[62]!==g||e[63]!==f?(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||!g?r.jsx("p",{className:"self-center px-6 text-center text-sm text-muted-foreground",children:l?f("sandbox.appPane.noUrl"):c?f("sandbox.appPane.failed",{app:s}):f("sandbox.appPane.waiting")}):r.jsx("iframe",{src:g,title:n,className:Fe("h-full bg-background",v==="mobile"?"w-[412px] max-w-full border-x border-border":"w-full")},`${g}#${h}`)}),e[54]=v,e[55]=c,e[56]=s,e[57]=n,e[58]=o,e[59]=i,e[60]=l,e[61]=h,e[62]=g,e[63]=f,e[64]=F):F=e[64];let z;return e[65]!==n||e[66]!==N||e[67]!==M||e[68]!==H||e[69]!==F?(z=r.jsxs("section",{"aria-label":n,className:N,children:[M,H,F]}),e[65]=n,e[66]=N,e[67]=M,e[68]=H,e[69]=F,e[70]=z):z=e[70],z}function Bd(t){return t+1}function Md(t){return t==="desktop"?"mobile":"desktop"}function ft(t){const e=ue.c(11),{label:n,children:s,active:a,disabled:l,onClick:c}=t;let o;e[0]!==a||e[1]!==s||e[2]!==l||e[3]!==n||e[4]!==c?(o=r.jsx(pt,{asChild:!0,children:r.jsx(Ze,{"aria-label":n,"aria-pressed":a,active:a,disabled:l,onClick:c,children:s})}),e[0]=a,e[1]=s,e[2]=l,e[3]=n,e[4]=c,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 d;return e[8]!==o||e[9]!==i?(d=r.jsxs(ht,{children:[o,i]}),e[8]=o,e[9]=i,e[10]=d):d=e[10],d}const Ud=async(t,e)=>{try{return await fetch(t,{method:"HEAD",mode:"no-cors",cache:"no-store",credentials:"omit",signal:e}),!0}catch{return!1}},Id=1e4,zd=1e4,Kd=5e3,Hd=2;function Vd(t,e){return t&&e===0?zd:Math.min(1e3*2**Math.max(0,e-1),Kd)}function Wd(t,e,n){return e?!0:t===!0&&n<Hd}function qd(t,e){const n=ue.c(11),s=Ud,a=pi();let l;n[0]!==t?(l=Gn.localAppReachable(t??""),n[0]=t,n[1]=l):l=n[1];const c=l;let o;n[2]!==s||n[3]!==a||n[4]!==c||n[5]!==t?(o=async f=>{const{signal:p}=f,S=new AbortController,v=()=>S.abort();p.addEventListener("abort",v);const x=setTimeout(v,Id),h=await s(t,S.signal).catch(Jd);clearTimeout(x),p.removeEventListener("abort",v);const b=a.getQueryData(c),T=h?0:(b?.failures??0)+1;return{up:Wd(b?.up??null,h,T),failures:T}},n[2]=s,n[3]=a,n[4]=c,n[5]=t,n[6]=o):o=n[6];const i=!!t;let d;n[7]!==c||n[8]!==o||n[9]!==i?(d={queryKey:c,queryFn:o,enabled:i,retry:!1,staleTime:0,gcTime:0,refetchInterval:Gd},n[7]=c,n[8]=o,n[9]=i,n[10]=d):d=n[10];const{data:m}=Nr(d);return t?m?.up??null:null}function Gd(t){return t.state.data?Vd(t.state.data.up,t.state.data.failures):!1}function Jd(){return!1}function Yd(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 Gu(t){const e=ue.c(53),{virtualMcpId:n}=t,s=Te(),a=Hi(n),{connection:l}=Gr(n),{activeTask:c,taskId:o,currentBranch:i}=Mt(),d=pl(o),[m,f]=j.useState(!1),p=fn(n,i);let S;e[0]!==p||e[1]!==l?(S=l?He(p):null,e[0]=p,e[1]=l,e[2]=S):S=e[2];const v=S,x=qd(v),h=ra(),b=il("multi_app_preview");if(cl({threadId:o,sandboxBranch:c?.branch??i,agentHasRepo:On(a?.metadata),threadHasRepo:On(d)||On(c?.metadata)})==="none"&&!l){let E;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=r.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:r.jsx(lr,{className:"size-7 text-foreground"})}),e[3]=E):E=e[3];let k;e[4]!==s?(k=s("mainPanelTabs.previewTab.noSourceToPreview"),e[4]=s,e[5]=k):k=e[5];let P;e[6]!==s?(P=s("mainPanelTabs.previewTab.connectGithubDescription"),e[6]=s,e[7]=P):P=e[7];let C,O;e[8]===Symbol.for("react.memo_cache_sentinel")?(C=()=>f(!0),O=r.jsx(lr,{className:"size-4"}),e[8]=C,e[9]=O):(C=e[8],O=e[9]);let R;e[10]!==s?(R=s("mainPanelTabs.previewTab.connectGithub"),e[10]=s,e[11]=R):R=e[11];let A;e[12]!==R?(A=r.jsxs($e,{onClick:C,children:[O,R]}),e[12]=R,e[13]=A):A=e[13];let D;e[14]!==k||e[15]!==P||e[16]!==A?(D=r.jsx(ol,{className:"h-full",image:E,title:k,description:P,actions:A}),e[14]=k,e[15]=P,e[16]=A,e[17]=D):D=e[17];let _;e[18]!==m?(_=r.jsx(ll,{open:m,onOpenChange:f,mode:"agent"}),e[18]=m,e[19]=_):_=e[19];let B;return e[20]!==_||e[21]!==D?(B=r.jsxs(r.Fragment,{children:[D,_]}),e[20]=_,e[21]=D,e[22]=B):B=e[22],B}if(l&&a&&!He(p)){let E;e[23]!==h||e[24]!==p?(E=Yd({backend:p,access:h}),e[23]=h,e[24]=p,e[25]=E):E=e[25];let k;e[26]!==l.endpoint?(k=wo(l.endpoint),e[26]=l.endpoint,e[27]=k):k=e[27];let P;return e[28]!==E||e[29]!==k?(P=r.jsx(Xd,{status:E,host:k}),e[28]=E,e[29]=k,e[30]=P):P=e[30],P}if(v&&x!==!0){let E;e[31]!==s?(E=s("mainPanelTabs.previewTab.localAppWaiting.title"),e[31]=s,e[32]=E):E=e[32];let k;e[33]!==v||e[34]!==s?(k=s("mainPanelTabs.previewTab.localAppWaiting.body",{host:Qd(v)}),e[33]=v,e[34]=s,e[35]=k):k=e[35];let P;e[36]!==k?(P=r.jsx(ta,{text:k}),e[36]=k,e[37]=P):P=e[37];let C;e[38]!==s?(C=s("mainPanelTabs.previewTab.localAppWaiting.hint"),e[38]=s,e[39]=C):C=e[39];let O;e[40]!==C?(O=r.jsx("p",{role:"status",className:"text-center text-sm text-muted-foreground",children:C}),e[40]=C,e[41]=O):O=e[41];let R;return e[42]!==E||e[43]!==P||e[44]!==O?(R=r.jsx(un,{headingLevel:2,waiting:!0,title:E,lead:P,footer:O}),e[42]=E,e[43]=P,e[44]=O,e[45]=R):R=e[45],R}let y;e[46]!==n?(y=r.jsx(_d,{virtualMcpId:n}),e[46]=n,e[47]=y):y=e[47];const g=y;let N;return e[48]!==a||e[49]!==b||e[50]!==g||e[51]!==l?(N=r.jsx(Ei,{children:b&&a&&!l?r.jsx(Od,{project:a,maxApps:tl,children:g}):g}),e[48]=a,e[49]=b,e[50]=g,e[51]=l,e[52]=N):N=e[52],N}function Qd(t){try{return new URL(t).host}catch{return t}}function Xd(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 d;return e[4]!==o||e[5]!==i?(d=r.jsx(un,{headingLevel:2,waiting:!1,title:o,lead:i}),e[4]=o,e[5]=i,e[6]=d):d=e[6],d}let l;e[7]!==s||e[8]!==n?(l=xl(n,s),e[7]=s,e[8]=n,e[9]=l):l=e[9];let c;return e[10]!==s||e[11]!==l?(c=r.jsx(vl,{wait:l,hosts:s}),e[10]=s,e[11]=l,e[12]=c):c=e[12],c}export{vl as L,Gu as P,un as S,qu as u};