decocms 4.355.2 → 4.356.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 (261) hide show
  1. package/dist/client/assets/{AlertCircle-C2I0CPt8.js → AlertCircle-Dn2LzgCm.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DvG2Chn9.js → AreaChart-BiimE_rJ.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DiFtyxtp.js → ArrowLeft-CR4qoLXz.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-Cr3akrFT.js → ArrowRight-DMcdWoqA.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-DF6vzMhN.js → ArrowUp-C639yND1.js} +1 -1
  6. package/dist/client/assets/{Check-sicxXYN7.js → Check-DP-GgTkq.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-Cbkf0Hrm.js → CheckCircle-BWifOun7.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-r0gLJbn2.js → ChevronRight-YI71RlIj.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-CejccrOe.js → ChevronSelectorVertical-t-xj8puk.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-CBLrm_OT.js → ChevronUp-NbusZS2V.js} +1 -1
  11. package/dist/client/assets/{Copy01-BzbXBjHv.js → Copy01-DSogth1g.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-C8AQ6_dn.js → CreditCard01-BZJO-bzS.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-Cyt1EoXA.js → DotsVertical-D3y9ry8A.js} +1 -1
  14. package/dist/client/assets/{Download01-Db1D2BD0.js → Download01-BS_WlExa.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-BdZSwiSN.js → ErrorBarContext-D_bPFmDB.js} +1 -1
  16. package/dist/client/assets/{Eye-QPQVcqGb.js → Eye-a7O0RJR_.js} +1 -1
  17. package/dist/client/assets/{GitBranch01-D3Ep4J5o.js → GitBranch01-BRixRiL-.js} +1 -1
  18. package/dist/client/assets/{Globe01-dlVOEKaQ.js → Globe01-BlolZAbP.js} +1 -1
  19. package/dist/client/assets/{HardDrive-W8kLhAmw.js → HardDrive-DBwa73-Y.js} +1 -1
  20. package/dist/client/assets/{Image01-B1m-gUl3.js → Image01-VrGlYNYd.js} +1 -1
  21. package/dist/client/assets/{Key01-DquPZpqN.js → Key01-DOTGSU1P.js} +1 -1
  22. package/dist/client/assets/{Link01-ClTL5UTN.js → Link01-BTPLMWJL.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-BepJT7Oz.js → LinkExternal01-Lt28tIPJ.js} +1 -1
  24. package/dist/client/assets/{Monitor01-Bndg-M3Y.js → Monitor01-BY8ASxwP.js} +1 -1
  25. package/dist/client/assets/{Package-B2Up-gTH.js → Package-dzgX9LxL.js} +1 -1
  26. package/dist/client/assets/{Palette-BsEqDIgy.js → Palette-Crv7MRNs.js} +1 -1
  27. package/dist/client/assets/{Play-DZtU_bVy.js → Play-CrHqV07_.js} +1 -1
  28. package/dist/client/assets/{Plus-5jblmb5M.js → Plus-BbNbMcZp.js} +1 -1
  29. package/dist/client/assets/{SearchLg-DFeP1_X8.js → SearchLg-D48hKTmL.js} +1 -1
  30. package/dist/client/assets/{SearchMd-CnBFXj_Z.js → SearchMd-Dd-_aqng.js} +1 -1
  31. package/dist/client/assets/{Sector-DnHG75nj.js → Sector-BOhRmviT.js} +1 -1
  32. package/dist/client/assets/{Settings02-5WiTDc8b.js → Settings02-C_hf-cvI.js} +1 -1
  33. package/dist/client/assets/{Share07-DzTdSg05.js → Share07-CIXJRI7f.js} +1 -1
  34. package/dist/client/assets/{Shield01-qqcKLTxE.js → Shield01-B5MEXmYj.js} +1 -1
  35. package/dist/client/assets/{Stars01-CFR1c-1g.js → Stars01-CIhmnYwE.js} +1 -1
  36. package/dist/client/assets/{Sun-Bxqb4eKN.js → Sun-DSykKOZ-.js} +1 -1
  37. package/dist/client/assets/{Tool01-DCz0PgHD.js → Tool01-Ci448Aet.js} +1 -1
  38. package/dist/client/assets/{Tool02-Dx9QVS5U.js → Tool02-DiUGHbsi.js} +1 -1
  39. package/dist/client/assets/{Trash01-D5ciFh4O.js → Trash01-8pnJyNzG.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-DjG8w8m_.js → TrendUp01-BuuwfsCN.js} +1 -1
  41. package/dist/client/assets/{Upload01-Dbydv0Li.js → Upload01-DHWZ0LJK.js} +1 -1
  42. package/dist/client/assets/{User01-Dq0QszR-.js → User01-B36CpY2j.js} +1 -1
  43. package/dist/client/assets/{UserSquare-Bi0Jy-6E.js → UserSquare-DsDbJW8O.js} +1 -1
  44. package/dist/client/assets/{Users01-C_RVSWfd.js → Users01-DNjzWOys.js} +1 -1
  45. package/dist/client/assets/{Users03-DPq3XXBm.js → Users03-DeLCL3rd.js} +1 -1
  46. package/dist/client/assets/{XCircle-CiIZAkGm.js → XCircle-Dh1Q5jf-.js} +1 -1
  47. package/dist/client/assets/{XClose-hM3AAAai.js → XClose-pz5VhGt8.js} +1 -1
  48. package/dist/client/assets/{Zap-Bb7Qo7M3.js → Zap-7WzpzN1h.js} +1 -1
  49. package/dist/client/assets/{ZoomOut-B_xPvOLH.js → ZoomOut-DVGJ65sx.js} +1 -1
  50. package/dist/client/assets/{access-gate-B2eHW19E.js → access-gate-C2RJFonv.js} +1 -1
  51. package/dist/client/assets/{agent-icon-BMTcgZga.js → agent-icon-DEB76nEG.js} +1 -1
  52. package/dist/client/assets/{agents-list-C54ZadWw.js → agents-list-MTlMMBrJ.js} +1 -1
  53. package/dist/client/assets/{ai-providers-BzDqK8qy.js → ai-providers-D-OKXUs0.js} +1 -1
  54. package/dist/client/assets/{alert-BrLgpHg1.js → alert-Dl94NWJF.js} +1 -1
  55. package/dist/client/assets/{alert-dialog-BikX6FFY.js → alert-dialog-BZAsgwQj.js} +1 -1
  56. package/dist/client/assets/{analytics-tab-CsPoqNEM.js → analytics-tab-DV5GngUD.js} +1 -1
  57. package/dist/client/assets/api-keys-AIbwlI25.js +1 -0
  58. package/dist/client/assets/{api-keys-Cq2DDoKg.js → api-keys-DMI7qGpv.js} +1 -1
  59. package/dist/client/assets/app-editor-BZA5-H8D.js +1 -0
  60. package/dist/client/assets/{auth-catchall-5CZsMp3G.js → auth-catchall-CYXCTdeb.js} +1 -1
  61. package/dist/client/assets/{auth-entry-CamvS-yK.js → auth-entry-BTynJJl6.js} +1 -1
  62. package/dist/client/assets/{auth-CNVXmSkG.js → auth-mD7u-8Dc.js} +1 -1
  63. package/dist/client/assets/{auth-split-layout-BOtLd_pv.js → auth-split-layout-CYJr47jd.js} +1 -1
  64. package/dist/client/assets/{authenticate-and-persist-oauth-DZYDyEg2.js → authenticate-and-persist-oauth-Cb1VPfbU.js} +1 -1
  65. package/dist/client/assets/{automation-list-row-Dj0Hlwog.js → automation-list-row-DmZ6OQPy.js} +1 -1
  66. package/dist/client/assets/{automation-runs-2af22T9w.js → automation-runs-DHixRXVQ.js} +1 -1
  67. package/dist/client/assets/{automations-B2SV0OTy.js → automations-DIDAwvy0.js} +1 -1
  68. package/dist/client/assets/{autosend-D9JhT_oZ.js → autosend-DwiQt7Hp.js} +1 -1
  69. package/dist/client/assets/{avatar-CPkw3h7t.js → avatar-TxNHOaZo.js} +1 -1
  70. package/dist/client/assets/{badge-C_ARXG3i.js → badge-C5ldr2h3.js} +1 -1
  71. package/dist/client/assets/block-document-DzTTwdPj.js +3 -0
  72. package/dist/client/assets/{breadcrumb-CsyYyKv7.js → breadcrumb-DZWD8NyH.js} +1 -1
  73. package/dist/client/assets/{buckets-C3rsO-J0.js → buckets-Bkp-GuZZ.js} +1 -1
  74. package/dist/client/assets/{bulk-category-panel-8YfIcV58.js → bulk-category-panel-pNvZGXoC.js} +1 -1
  75. package/dist/client/assets/{capability-load-error-_DjYgnoI.js → capability-load-error-BAT0cQkw.js} +1 -1
  76. package/dist/client/assets/{cards-C17dmtwv.js → cards-ahWPrDYX.js} +1 -1
  77. package/dist/client/assets/{category-editor-DRxFVwt9.js → category-editor-CVQOrSGs.js} +1 -1
  78. package/dist/client/assets/{cdn-tab-xbZtzilg.js → cdn-tab-DnFT0Npy.js} +1 -1
  79. package/dist/client/assets/{chart-HqfMLVT_.js → chart-yjAjx-Cm.js} +1 -1
  80. package/dist/client/assets/{chat-context-CvoU8WQ4.js → chat-context-CNfzERFI.js} +1 -1
  81. package/dist/client/assets/{checkbox-Cgrb5XJJ.js → checkbox-BLlbj82t.js} +1 -1
  82. package/dist/client/assets/{choose-editor-DWeJjqnG.js → choose-editor-5hR0ORsl.js} +1 -1
  83. package/dist/client/assets/{cli-auth-success-BdI--VSg.js → cli-auth-success-D790f8wt.js} +1 -1
  84. package/dist/client/assets/{client-icons-B-EXG49U.js → client-icons-CC68pbc1.js} +1 -1
  85. package/dist/client/assets/{collection-detail-swCyhtIz.js → collection-detail-DpTiQkoA.js} +1 -1
  86. package/dist/client/assets/{collection-display-button-BbFCPrTl.js → collection-display-button-CnyyeR_6.js} +1 -1
  87. package/dist/client/assets/{collection-search-CJb7f2bn.js → collection-search-Cnw9syfX.js} +1 -1
  88. package/dist/client/assets/{collection-table-wrapper-DC-4y8I-.js → collection-table-wrapper-C8PFfI6H.js} +1 -1
  89. package/dist/client/assets/{collection-tabs-BxnrIEJp.js → collection-tabs-0q04uQ8E.js} +1 -1
  90. package/dist/client/assets/{command-CqNTTNRi.js → command-FZrYmBJm.js} +1 -1
  91. package/dist/client/assets/{commerce-onboarding-DFX26jT9.js → commerce-onboarding-bUvSwdsg.js} +1 -1
  92. package/dist/client/assets/{connect-DtII47Uj.js → connect-KFzLKvSy.js} +1 -1
  93. package/dist/client/assets/{connect-layout-TQ2j2S05.js → connect-layout-Cj7kYzPZ.js} +1 -1
  94. package/dist/client/assets/{connection-DtCer1Uy.js → connection-BoN2o4Cn.js} +1 -1
  95. package/dist/client/assets/{connection-card-BzEzwA5b.js → connection-card-DAWGXfZx.js} +1 -1
  96. package/dist/client/assets/{connection-detail-BqVCcP--.js → connection-detail-DDs6MMxI.js} +1 -1
  97. package/dist/client/assets/{connection-form-helpers-swpd49hK.js → connection-form-helpers-3H2I2sjs.js} +1 -1
  98. package/dist/client/assets/{connections-BtJpCjSi.js → connections-DPoDqz9z.js} +1 -1
  99. package/dist/client/assets/{create-organization-dialog-_A_tQwgl.js → create-organization-dialog-Bc3D9tD4.js} +1 -1
  100. package/dist/client/assets/{decopilot-sse-pool-pjl5bOdE.js → decopilot-sse-pool-BKKbLnQj.js} +1 -1
  101. package/dist/client/assets/{dialog-B0OdXcqs.js → dialog-4-8ZKkTU.js} +1 -1
  102. package/dist/client/assets/{domain-settings-D9jM3qAJ.js → domain-settings-C5JT3wTd.js} +1 -1
  103. package/dist/client/assets/{drawer-C2s6Up5H.js → drawer-CT1GhzaI.js} +1 -1
  104. package/dist/client/assets/{dropdown-menu-CoV3z2Yq.js → dropdown-menu-CYjkjxzI.js} +1 -1
  105. package/dist/client/assets/{e2e-tab-H0hc-BZ9.js → e2e-tab-DG1u-6iR.js} +1 -1
  106. package/dist/client/assets/{editor-DDZRpuBY.js → editor-Bvcuzd-o.js} +1 -1
  107. package/dist/client/assets/{empty-state-CZg3u6TE.js → empty-state-Cnutw7Rx.js} +1 -1
  108. package/dist/client/assets/{empty-state-UGFooPJ_.js → empty-state-Djp5Qrmx.js} +1 -1
  109. package/dist/client/assets/{extract-connection-data-BPXLZ9J6.js → extract-connection-data-Mn0BJca1.js} +1 -1
  110. package/dist/client/assets/{file-explorer-CDJlhfne.js → file-explorer-HB3Kjc_j.js} +1 -1
  111. package/dist/client/assets/{file-type-icon-DnRMRlEa.js → file-type-icon-D1-w6wZy.js} +1 -1
  112. package/dist/client/assets/{folder-icon-D1UH1rlz.js → folder-icon-CT3Do-ro.js} +1 -1
  113. package/dist/client/assets/{form-TWkufiDd.js → form-DaQjjTxU.js} +1 -1
  114. package/dist/client/assets/{general-Dm-xRItO.js → general-BBxEqFk0.js} +1 -1
  115. package/dist/client/assets/{github-icon-DMu-fvNj.js → github-icon-fZjpu2Cy.js} +1 -1
  116. package/dist/client/assets/{hooks-BJUiYjpq.js → hooks-CsAfHnwZ.js} +1 -1
  117. package/dist/client/assets/{index-Dfke77qN.js → index-B7aWVUxa.js} +1 -1
  118. package/dist/client/assets/{index-KPDf_vWx.js → index-BQc11LJ5.js} +1 -1
  119. package/dist/client/assets/{index-D6kz3ebr.js → index-BQrXYHq8.js} +2 -2
  120. package/dist/client/assets/{index-DeOJD6d8.js → index-BbF94fPM.js} +1 -1
  121. package/dist/client/assets/{index-DIovfAvf.js → index-Beqb_sH-.js} +1 -1
  122. package/dist/client/assets/{index-BPwgxBBZ.js → index-BikowZRG.js} +1 -1
  123. package/dist/client/assets/{index-BI90bdn8.js → index-Bxrn69YR.js} +1 -1
  124. package/dist/client/assets/{index-DBDSE4L5.css → index-DVOqYnNc.css} +1 -1
  125. package/dist/client/assets/{index-B5IAGVkM.js → index-DZMELk7p.js} +7 -7
  126. package/dist/client/assets/{index-Bf3UYpNv.js → index-DeRHV1NZ.js} +1 -1
  127. package/dist/client/assets/{index-CNT4COX0.js → index-UTNjrPGP.js} +1 -1
  128. package/dist/client/assets/{index-ObR7HuX3.js → index-acrOElZ3.js} +1 -1
  129. package/dist/client/assets/{index-redirect-n5VV5WB_.js → index-redirect-Boyye5fM.js} +1 -1
  130. package/dist/client/assets/{index-DucBuZzH.js → index-rw7lxc98.js} +1 -1
  131. package/dist/client/assets/{infiniteQueryObserver-Dld3rVqh.js → infiniteQueryObserver-DoVQcRsV.js} +1 -1
  132. package/dist/client/assets/{infra-billing-D04CQzUh.js → infra-billing-CkhvKHcW.js} +1 -1
  133. package/dist/client/assets/{input-SHpohkkd.js → input-qeaSKkDL.js} +1 -1
  134. package/dist/client/assets/{integration-icon-BQARLIol.js → integration-icon-BndzYdzO.js} +1 -1
  135. package/dist/client/assets/{invite-member-dialog-DGV9h8p7.js → invite-member-dialog-B7Nh5ICF.js} +1 -1
  136. package/dist/client/assets/{label-rD90jMRy.js → label-2w5sLZrP.js} +1 -1
  137. package/dist/client/assets/{layout-DneON2K-.js → layout-DFWDvyCN.js} +1 -1
  138. package/dist/client/assets/{login-KMTs7jKS.js → login-Ds86XEx2.js} +1 -1
  139. package/dist/client/assets/{markdown-DOFXhXXc.js → markdown-BfU9Q14B.js} +1 -1
  140. package/dist/client/assets/{mcp-app-renderer-DzI0XDOX.js → mcp-app-renderer-31nL2thK.js} +1 -1
  141. package/dist/client/assets/{mcp-oauth-DHIeN6FN.js → mcp-oauth-KMXzsvi6.js} +1 -1
  142. package/dist/client/assets/{members-AHwwCvg3.js → members-CXOXJDsa.js} +1 -1
  143. package/dist/client/assets/{monaco-editor-BncUqSbn.js → monaco-editor-COQ5T_AM.js} +1 -1
  144. package/dist/client/assets/{monitoring-stats-row-CEzHQPkU.js → monitoring-stats-row-CmBTGmKw.js} +1 -1
  145. package/dist/client/assets/{multi-select-BuWqwtfL.js → multi-select-DHeAu7TI.js} +1 -1
  146. package/dist/client/assets/{oauth-callback-BC7x9Uxy.js → oauth-callback-NkQ8X8RL.js} +1 -1
  147. package/dist/client/assets/{oauth-callback-ai-provider-Difk9x6B.js → oauth-callback-ai-provider-Vx4tZIYf.js} +1 -1
  148. package/dist/client/assets/{onboarding-EhIUSeAF.js → onboarding-BB-3O2CH.js} +1 -1
  149. package/dist/client/assets/{org-layout-CSFqN6iA.js → org-layout-C2z1qg2z.js} +1 -1
  150. package/dist/client/assets/{organization-choice-NrSjC7-6.js → organization-choice-CyCWVU0x.js} +1 -1
  151. package/dist/client/assets/{orgs-02MvW8eo.js → orgs-rYh7KCOD.js} +1 -1
  152. package/dist/client/assets/page-seo-form-CNEivUHF.js +1 -0
  153. package/dist/client/assets/{popover-DClv4J5a.js → popover-wqdxNGOt.js} +1 -1
  154. package/dist/client/assets/{post-calendar-BqjLapsw.js → post-calendar-ChmrbB0W.js} +1 -1
  155. package/dist/client/assets/{post-editor-CKi-qWNG.js → post-editor-DKXuicWV.js} +1 -1
  156. package/dist/client/assets/{primitives-DpTtwzO3.js → primitives-C5_v8n2J.js} +1 -1
  157. package/dist/client/assets/{profile-DDFJC2Vv.js → profile-Cx0qSnec.js} +1 -1
  158. package/dist/client/assets/{project-app-view-BxEzaMDJ.js → project-app-view-DKi7PUJM.js} +1 -1
  159. package/dist/client/assets/{project-icon-DB0uWZzs.js → project-icon-BFxISnLs.js} +1 -1
  160. package/dist/client/assets/{prompts-Dwzm6Z4Z.js → prompts-DdFZb9MS.js} +1 -1
  161. package/dist/client/assets/record-editor-BNIadC-Z.js +1 -0
  162. package/dist/client/assets/redirect-editor-DQa7nNe7.js +1 -0
  163. package/dist/client/assets/registry-DgbAUGGg.js +2 -0
  164. package/dist/client/assets/{registry-layout-DY-ilKoy.js → registry-layout-CO8lQl-U.js} +1 -1
  165. package/dist/client/assets/{reports-dy7OW4nR.js → reports-DYkA1Gd8.js} +1 -1
  166. package/dist/client/assets/{repositories-B3EUtLfQ.js → repositories-DBL9bPzz.js} +1 -1
  167. package/dist/client/assets/{repository-import-picker-Ds-7ia8x.js → repository-import-picker-DzCXGQBU.js} +1 -1
  168. package/dist/client/assets/{repository-picker-zcqpFECf.js → repository-picker-BlNupbcV.js} +1 -1
  169. package/dist/client/assets/{require-capability-BkcUyh1H.js → require-capability-DjogcNDM.js} +1 -1
  170. package/dist/client/assets/{required-auth-layout-BkCbiYhR.js → required-auth-layout-DLzQMK2l.js} +1 -1
  171. package/dist/client/assets/{reset-password-B5BEqtw9.js → reset-password-iqfMcqcX.js} +1 -1
  172. package/dist/client/assets/{review-settings-V3J_suZO.js → review-settings-BxaVGUvQ.js} +1 -1
  173. package/dist/client/assets/{roles-CFXICquL.js → roles-HXU_X95c.js} +1 -1
  174. package/dist/client/assets/{schema-DQTSPDPc.js → schema-CRVQdEkJ.js} +1 -1
  175. package/dist/client/assets/{scroll-area-Bk3bop_C.js → scroll-area-DEm8VUVS.js} +1 -1
  176. package/dist/client/assets/{search-input-Cr1xDzOR.js → search-input-C0ULLiZH.js} +1 -1
  177. package/dist/client/assets/{secrets-D4THHRB2.js → secrets-DBzj5UQN.js} +1 -1
  178. package/dist/client/assets/{sections-editor-of2aPbXF.js → sections-editor-D_5Mw5mz.js} +1 -1
  179. package/dist/client/assets/{select-VruWLBER.js → select-Dy0mCkHM.js} +1 -1
  180. package/dist/client/assets/{select-model-R6GRqP4o.js → select-model-DpTTzy_N.js} +1 -1
  181. package/dist/client/assets/{self-tool-result-B6OwqL4s.js → self-tool-result-CaFwP-iH.js} +1 -1
  182. package/dist/client/assets/{seo-editor-BdFo1CDL.js → seo-editor-87YPoabW.js} +1 -1
  183. package/dist/client/assets/settings-layout-BLnjL10b.js +1 -0
  184. package/dist/client/assets/{settings-sidebar-fJ4N2ofG.js → settings-sidebar-Bqwsz6Pn.js} +1 -1
  185. package/dist/client/assets/{shell-controls-Di6eVhxs.js → shell-controls-B2dHmMje.js} +1 -1
  186. package/dist/client/assets/{shell-layout-DtX3xYLo.js → shell-layout-CotO2kr7.js} +1 -1
  187. package/dist/client/assets/{skill-preview-Cn_VmuJU.js → skill-preview-Wnefbpcm.js} +1 -1
  188. package/dist/client/assets/{skills-BYyTg_dQ.js → skills-BhN93XqJ.js} +1 -1
  189. package/dist/client/assets/{sso-B4-17OvU.js → sso-B16EoILH.js} +1 -1
  190. package/dist/client/assets/{store-duvEEQay.js → store-B8PLIrEa.js} +1 -1
  191. package/dist/client/assets/store-registry-CFO8batJ.js +2 -0
  192. package/dist/client/assets/{switch-D5mDYZzD.js → switch-BnmWU4VE.js} +1 -1
  193. package/dist/client/assets/{synced-repos-BcFubVX4.js → synced-repos-B6_aCxu0.js} +1 -1
  194. package/dist/client/assets/{table-Co1Yo9Ou.js → table-KAgZfIp5.js} +1 -1
  195. package/dist/client/assets/{tabs-CzhgwOMh.js → tabs-BC4Wj_kt.js} +1 -1
  196. package/dist/client/assets/{task-board-F9nWsjW0.js → task-board-Y16rTsTT.js} +1 -1
  197. package/dist/client/assets/{task-route-C50QtiSH.js → task-route-CmhiLHqL.js} +1 -1
  198. package/dist/client/assets/{tasks-PqS_Dc-u.js → tasks-BBZWavmy.js} +1 -1
  199. package/dist/client/assets/{textarea-D5yUmTuo.js → textarea-CiyC7MI9.js} +1 -1
  200. package/dist/client/assets/{thread-intent-CqM5vUU9.js → thread-intent-Bs2zwccc.js} +1 -1
  201. package/dist/client/assets/{thread-route-B_3hJRNO.js → thread-route-7UJtJt_K.js} +1 -1
  202. package/dist/client/assets/{toggle-group-C6RmEYNw.js → toggle-group-Diok74bY.js} +1 -1
  203. package/dist/client/assets/{toolbar-DalvtXvG.js → toolbar-B_18C3DR.js} +1 -1
  204. package/dist/client/assets/{toolbar-icon-button-aV5MA64L.js → toolbar-icon-button-kSF0Tiq-.js} +1 -1
  205. package/dist/client/assets/{track-IbgYjppW.js → track-BDpi6fse.js} +1 -1
  206. package/dist/client/assets/{types-CaQxQn--.js → types-C7H-jvYH.js} +1 -1
  207. package/dist/client/assets/{use-ai-providers-CBAbpFCs.js → use-ai-providers-Dviyjy6N.js} +1 -1
  208. package/dist/client/assets/{use-automations-HZOOTOR3.js → use-automations-sMEuHhLU.js} +1 -1
  209. package/dist/client/assets/{use-autosave-Cd2yn2WA.js → use-autosave-DYGkUibZ.js} +1 -1
  210. package/dist/client/assets/{use-connection-Cxk618DD.js → use-connection-fouxnnWP.js} +1 -1
  211. package/dist/client/assets/{use-copy-JToNQsYl.js → use-copy-DWPBkf_8.js} +1 -1
  212. package/dist/client/assets/{use-create-virtual-mcp-BDVK9Nnk.js → use-create-virtual-mcp-B-EatAJ5.js} +1 -1
  213. package/dist/client/assets/{use-date-fns-locale-BC9XewCs.js → use-date-fns-locale-b4nMMivC.js} +1 -1
  214. package/dist/client/assets/{use-debounced-autosave-ChhxmJyP.js → use-debounced-autosave-C1YtdIK-.js} +1 -1
  215. package/dist/client/assets/{use-debounced-value-B2sataBb.js → use-debounced-value-Bw89OGDR.js} +1 -1
  216. package/dist/client/assets/{use-decopilot-events-w-PNw0gQ.js → use-decopilot-events-D-6EFthp.js} +1 -1
  217. package/dist/client/assets/{use-delete-connection-C0Ue1RpB.js → use-delete-connection-COL0fiiO.js} +1 -1
  218. package/dist/client/assets/{use-deployment-admin-FdJOF92N.js → use-deployment-admin-CnkHFjDB.js} +1 -1
  219. package/dist/client/assets/{use-destination-route-DaFWrAHj.js → use-destination-route-D6cSISdD.js} +1 -1
  220. package/dist/client/assets/{use-file-configs-BszfQ6Ii.js → use-file-configs-cX-RxRlm.js} +1 -1
  221. package/dist/client/assets/{use-infinite-scroll-UlP3mdDG.js → use-infinite-scroll-BQ5AKvaC.js} +1 -1
  222. package/dist/client/assets/{use-join-requests-DbLnXh7p.js → use-join-requests-CWXwXoHW.js} +1 -1
  223. package/dist/client/assets/{use-mcp-auth-status-Dm4k96-0.js → use-mcp-auth-status-B54cY0IQ.js} +1 -1
  224. package/dist/client/assets/{use-mcp-client-BS1HAuw9.js → use-mcp-client-DOWZTxzf.js} +1 -1
  225. package/dist/client/assets/{use-mcp-prompts-Bqus7nV6.js → use-mcp-prompts-l34GNVIi.js} +1 -1
  226. package/dist/client/assets/{use-mcp-tools-CcPY1kUa.js → use-mcp-tools-DtR_LDJa.js} +1 -1
  227. package/dist/client/assets/{use-members-BPrB4_B6.js → use-members-Dad9xTF8.js} +1 -1
  228. package/dist/client/assets/{use-navigate-to-agent-yGdOMWOW.js → use-navigate-to-agent-Dq5Q0ICk.js} +1 -1
  229. package/dist/client/assets/{use-org-auth-client-BfcHu9OA.js → use-org-auth-client-Deql-sZk.js} +1 -1
  230. package/dist/client/assets/{use-org-notice-CGWZZ-Tj.js → use-org-notice-CviLgl-A.js} +1 -1
  231. package/dist/client/assets/{use-org-sso-BD6r6b1F.js → use-org-sso-0iLkTuBt.js} +1 -1
  232. package/dist/client/assets/{use-organization-roles-CSUyN-QR.js → use-organization-roles-DjJJheT3.js} +1 -1
  233. package/dist/client/assets/{use-organization-settings-zsIQ5yKP.js → use-organization-settings-BaVwqjP2.js} +1 -1
  234. package/dist/client/assets/{use-panel-navigate-Bnu_Y_WK.js → use-panel-navigate-BCgywjZr.js} +1 -1
  235. package/dist/client/assets/{use-registry-connections-D6NYr_lo.js → use-registry-connections-DffTM4pd.js} +1 -1
  236. package/dist/client/assets/{use-secrets-CEAwJE8l.js → use-secrets-DMdcT289.js} +1 -1
  237. package/dist/client/assets/{use-section-preview-base-CPX3fQrj.js → use-section-preview-base-Cwr2uSdH.js} +1 -1
  238. package/dist/client/assets/{use-status-sounds-BSHc34AF.js → use-status-sounds-Dkl514NB.js} +1 -1
  239. package/dist/client/assets/{use-tags-u-doSjgu.js → use-tags-DqshTwtF.js} +1 -1
  240. package/dist/client/assets/{use-view-mode-DIiapwc1.js → use-view-mode-LN9jF46v.js} +1 -1
  241. package/dist/client/assets/{use-virtual-mcp-Ck5PGc0k.js → use-virtual-mcp-M1aCpB-b.js} +1 -1
  242. package/dist/client/assets/useInfiniteQuery-C6mK09y1.js +1 -0
  243. package/dist/client/assets/useSuspenseInfiniteQuery-DTCW75kg.js +1 -0
  244. package/dist/client/assets/{users-BitUrleX.js → users-C9lNy-C1.js} +1 -1
  245. package/dist/client/assets/{variant-calendar-52K0113C.js → variant-calendar-C34nSSck.js} +1 -1
  246. package/dist/client/assets/{view-mode-toggle-tmEIJIQR.js → view-mode-toggle-B08Gh1w4.js} +1 -1
  247. package/dist/client/index.html +2 -2
  248. package/dist/server/cli.js +1 -1
  249. package/dist/server/server.js +1 -1
  250. package/package.json +1 -1
  251. package/dist/client/assets/api-keys-Cdmmw61O.js +0 -1
  252. package/dist/client/assets/app-editor-BNKwsB0C.js +0 -1
  253. package/dist/client/assets/block-document-B8RakH2B.js +0 -3
  254. package/dist/client/assets/page-seo-form-F8gftHfe.js +0 -1
  255. package/dist/client/assets/record-editor-DLoE_u56.js +0 -1
  256. package/dist/client/assets/redirect-editor-B9a7bR4b.js +0 -1
  257. package/dist/client/assets/registry-DJi9P9E9.js +0 -2
  258. package/dist/client/assets/settings-layout-BoOxkANz.js +0 -1
  259. package/dist/client/assets/store-registry-BQF4DMVv.js +0 -2
  260. package/dist/client/assets/useInfiniteQuery-ctaGuyQM.js +0 -1
  261. package/dist/client/assets/useSuspenseInfiniteQuery-IjFUp4RN.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-of2aPbXF.js","assets/index-D6kz3ebr.js","assets/index-DBDSE4L5.css","assets/chat-context-CvoU8WQ4.js","assets/use-panel-navigate-Bnu_Y_WK.js","assets/use-destination-route-DaFWrAHj.js","assets/autosend-D9JhT_oZ.js","assets/thread-intent-CqM5vUU9.js","assets/slugify-CEUa2lfQ.js","assets/hooks-BJUiYjpq.js","assets/use-mcp-client-BS1HAuw9.js","assets/auth-CNVXmSkG.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-pjl5bOdE.js","assets/task-board-F9nWsjW0.js","assets/schema-DQTSPDPc.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-Ck5PGc0k.js","assets/use-ai-providers-CBAbpFCs.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-w-PNw0gQ.js","assets/thread-route-B_3hJRNO.js","assets/dialog-B0OdXcqs.js","assets/Check-sicxXYN7.js","assets/Copy01-BzbXBjHv.js","assets/Download01-Db1D2BD0.js","assets/use-organization-settings-zsIQ5yKP.js","assets/ChevronUp-CBLrm_OT.js","assets/agent-icon-BMTcgZga.js","assets/AlertCircle-C2I0CPt8.js","assets/Tool01-DCz0PgHD.js","assets/ArrowUp-DF6vzMhN.js","assets/ArrowLeft-DiFtyxtp.js","assets/Tool02-Dx9QVS5U.js","assets/ArrowRight-Cr3akrFT.js","assets/TrendUp01-DjG8w8m_.js","assets/ZoomOut-B_xPvOLH.js","assets/Users03-DPq3XXBm.js","assets/CheckCircle-Cbkf0Hrm.js","assets/ChevronRight-r0gLJbn2.js","assets/ChevronSelectorVertical-CejccrOe.js","assets/DotsVertical-Cyt1EoXA.js","assets/UserSquare-Bi0Jy-6E.js","assets/CreditCard01-C8AQ6_dn.js","assets/Settings02-5WiTDc8b.js","assets/Eye-QPQVcqGb.js","assets/Share07-DzTdSg05.js","assets/GitBranch01-D3Ep4J5o.js","assets/Globe01-dlVOEKaQ.js","assets/XClose-hM3AAAai.js","assets/HardDrive-W8kLhAmw.js","assets/Image01-B1m-gUl3.js","assets/Key01-DquPZpqN.js","assets/Link01-ClTL5UTN.js","assets/LinkExternal01-BepJT7Oz.js","assets/Monitor01-Bndg-M3Y.js","assets/Sun-Bxqb4eKN.js","assets/Package-B2Up-gTH.js","assets/Palette-BsEqDIgy.js","assets/Play-DZtU_bVy.js","assets/Plus-5jblmb5M.js","assets/SearchLg-DFeP1_X8.js","assets/SearchMd-CnBFXj_Z.js","assets/Shield01-qqcKLTxE.js","assets/Stars01-CFR1c-1g.js","assets/Trash01-D5ciFh4O.js","assets/Upload01-Dbydv0Li.js","assets/User01-Dq0QszR-.js","assets/Users01-C_RVSWfd.js","assets/XCircle-CiIZAkGm.js","assets/Zap-Bb7Qo7M3.js","assets/scroll-area-Bk3bop_C.js","assets/select-VruWLBER.js","assets/input-SHpohkkd.js","assets/dropdown-menu-CoV3z2Yq.js","assets/safe-image-url-D5z803Ot.js","assets/page-seo-form-F8gftHfe.js","assets/label-rD90jMRy.js","assets/switch-D5mDYZzD.js","assets/use-section-preview-base-CPX3fQrj.js","assets/automation-runs-2af22T9w.js","assets/useInfiniteQuery-ctaGuyQM.js","assets/infiniteQueryObserver-Dld3rVqh.js","assets/use-connection-Cxk618DD.js","assets/table-Co1Yo9Ou.js","assets/empty-state-UGFooPJ_.js","assets/use-infinite-scroll-UlP3mdDG.js","assets/use-members-BPrB4_B6.js","assets/use-org-auth-client-BfcHu9OA.js","assets/use-automations-HZOOTOR3.js","assets/useSuspenseInfiniteQuery-IjFUp4RN.js","assets/avatar-CPkw3h7t.js","assets/format-time-BtXRrtv4.js","assets/differenceInSeconds-C3x8sHUj.js","assets/use-copy-JToNQsYl.js","assets/markdown-DOFXhXXc.js","assets/monaco-editor-BncUqSbn.js","assets/editor-DDZRpuBY.js","assets/mcp-app-renderer-DzI0XDOX.js","assets/types-CaQxQn--.js","assets/shell-layout-DtX3xYLo.js","assets/project-icon-DB0uWZzs.js","assets/github-repo-CTPv5ZM2.js","assets/source-system-tabs-CnEGUb4r.js","assets/command-CqNTTNRi.js","assets/index-ObR7HuX3.js","assets/integration-icon-BQARLIol.js","assets/required-auth-layout-BkCbiYhR.js","assets/use-org-sso-BD6r6b1F.js","assets/use-org-notice-CGWZZ-Tj.js","assets/shell-layout-CuFt8bor.css","assets/use-navigate-to-agent-yGdOMWOW.js","assets/use-mcp-prompts-Bqus7nV6.js","assets/form-TWkufiDd.js","assets/file-type-icon-DnRMRlEa.js","assets/drawer-C2s6Up5H.js","assets/collection-search-CJb7f2bn.js","assets/tabs-CzhgwOMh.js","assets/toggle-group-C6RmEYNw.js","assets/task-route-C50QtiSH.js","assets/extract-connection-data-BPXLZ9J6.js","assets/metadata-dUsYcpuu.js","assets/connection-DtCer1Uy.js","assets/connection-card-BzEzwA5b.js","assets/use-registry-connections-D6NYr_lo.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-D5yUmTuo.js","assets/connection-form-helpers-swpd49hK.js","assets/authenticate-and-persist-oauth-DZYDyEg2.js","assets/mcp-oauth-DHIeN6FN.js","assets/collection-tabs-BxnrIEJp.js","assets/badge-C_ARXG3i.js","assets/use-file-configs-BszfQ6Ii.js","assets/site-slug-uya6Wp4-.js","assets/popover-DClv4J5a.js","assets/github-icon-DMu-fvNj.js","assets/get-initials-D-f_fDFw.js","assets/select-model-R6GRqP4o.js","assets/checkbox-Cgrb5XJJ.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-D1UH1rlz.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-BSHc34AF.js","assets/toolbar-DalvtXvG.js","assets/use-mcp-tools-CcPY1kUa.js","assets/skill-preview-Cn_VmuJU.js","assets/use-date-fns-locale-BC9XewCs.js","assets/alert-dialog-BikX6FFY.js","assets/use-debounced-autosave-ChhxmJyP.js","assets/search-input-Cr1xDzOR.js","assets/use-mcp-auth-status-Dm4k96-0.js","assets/breadcrumb-CsyYyKv7.js","assets/repository-import-picker-Ds-7ia8x.js","assets/repository-picker-zcqpFECf.js","assets/use-debounced-value-B2sataBb.js","assets/use-secrets-CEAwJE8l.js","assets/client-icons-B-EXG49U.js","assets/connect-layout-TQ2j2S05.js","assets/self-tool-result-B6OwqL4s.js","assets/provision-repo-scoped-github-connection-WQFARyHG.js","assets/track-IbgYjppW.js","assets/use-tags-u-doSjgu.js","assets/toolbar-icon-button-aV5MA64L.js","assets/automation-list-row-Dj0Hlwog.js","assets/site-error--i37Vnuw.js","assets/cards-C17dmtwv.js","assets/file-explorer-CDJlhfne.js","assets/app-editor-BNKwsB0C.js","assets/post-editor-CKi-qWNG.js","assets/multi-select-BuWqwtfL.js","assets/block-document-B8RakH2B.js","assets/primitives-DpTtwzO3.js","assets/use-autosave-Cd2yn2WA.js","assets/record-editor-DLoE_u56.js","assets/category-editor-DRxFVwt9.js","assets/bulk-category-panel-8YfIcV58.js","assets/index-DeOJD6d8.js","assets/seo-editor-BdFo1CDL.js","assets/variant-calendar-52K0113C.js","assets/view-mode-toggle-tmEIJIQR.js","assets/post-calendar-BqjLapsw.js","assets/alert-BrLgpHg1.js","assets/redirect-editor-B9a7bR4b.js","assets/project-app-view-BxEzaMDJ.js","assets/index-Bf3UYpNv.js","assets/empty-state-CZg3u6TE.js","assets/e2e-tab-H0hc-BZ9.js","assets/analytics-tab-CsPoqNEM.js","assets/chart-HqfMLVT_.js","assets/index-CNT4COX0.js","assets/AreaChart-DvG2Chn9.js","assets/cdn-tab-xbZtzilg.js","assets/ErrorBarContext-BdZSwiSN.js","assets/Sector-DnHG75nj.js"])))=>i.map(i=>d[i]);
2
- import{n as Vs,r as T,ac as vN,ad as yN,ae as Tt,af as ns,ag as Ae,ah as Hr,ai as oi,aj as Kh,ak as wu,al as _N,am as ji,an as LN,ao as c6,c as F,G as Ue,l as re,j as o,E as tn,b as ae,t as ye,a3 as Go,J as Za,h as et,a1 as He,a2 as Ke,a4 as We,ap as nn,M as Wu,B as me,aq as T2,ar as d6,v as ro,as as Ls,at as ja,au as H4,d as Ks,a7 as us,e as Ds,o as qe,av as wN,C as na,aw as SN,ax as u6,ay as kN,az as er,aA as x1,aB as Kn,aC as jN,aD as b1,aE as CN,aF as NN,aG as VN,aH as TN,aI as A2,aJ as P2,aK as h6,aL as E2,x as Wf,K as tt,aM as AN,aN as PN,aO as EN,aP as f6,aQ as iu,m as Yt,a as On,I as qf,z as qu,Y as Ci,aR as Wh,u as pr,f as ia,aS as RN,aT as K4,aU as Am,aa as m6,a9 as Pm,aV as p6,aW as g6,aX as x6,aY as DN,aZ as MN,L as Io,a_ as b6,p as IN,a$ as Hd,b0 as ru,b1 as ou,b2 as ON,b3 as $N,b4 as BN,b5 as zN,b6 as FN,b7 as UN,b8 as en,b9 as v6,ba as y6,bb as Dn,P as En,bc as Gi,ab as _6,bd as HN,be as Nt,bf as L6,bg as w6,bh as S6,bi as k6,bj as j6,bk as C6,bl as KN,bm as WN,bn as qN,bo as GN,bp as N6,bq as Ws,N as ei,br as V6,bs as YN,bt as QN,bu as T6,bv as XN,bw as JN,bx as ZN,by as eV,bz as Em,bA as Aa,bB as A6,bC as tV,bD as sV,bE as nV,bF as iV,bG as rV,bH as oV,bI as R2,bJ as aV,bK as lV,bL as cV}from"./index-D6kz3ebr.js";import{i as Gf,n as dV}from"./ArrowUp-DF6vzMhN.js";import{u as el,a as ai,b as Ts,c as on,d as P6,s as uV,e as hV,f as fV,g as mV,h as pV,i as gV,j as xV,k as D2,l as E6,T as bV,A as vV,m as yV,n as _V,D as LV,C as wV,t as SV,o as kV,p as jV}from"./chat-context-CvoU8WQ4.js";import{c as Yf,s as Gu,g as Br,P as qh,d as M2,t as Qf,a as CV,M as NV,i as VV,b as Ni,e as id,f as TV,D as AV,h as PV,j as EV,k as Uc,l as RV,m as DV,u as Xf,E as MV,n as Yu,o as IV,F as OV,p as Jf,q as Zf,r as R6,S as $V,v as BV,w as zV,x as FV,y as W4,z as UV,A as D6,O as HV,B as q4,C as sr,G as KV,T as Ir,H as WV,I as rr,J as Oo,K as Rm,L as Dm,N as M6,Q as qV,R as I6,U as GV,V as li,W as YV,X as QV,Y as O6,Z as Vr,_ as XV,$ as JV,a0 as $6,a1 as ya,a2 as G4,a3 as ZV,a4 as eT,a5 as Y4,a6 as tT,a7 as Su,a8 as tl,a9 as cr,aa as Gh,ab as I2,ac as O2,ad as sT,ae as nT,af as iT,ag as rT,ah as oT,ai as aT,aj as lT,ak as e9,al as $2,am as B2,an as z2,ao as cT,ap as B6,aq as dT,ar as uT,as as hT,at as fT,au as Qu,av as mT,aw as pT,ax as gT,ay as xT}from"./automation-runs-2af22T9w.js";import{c as cs,d as Kt,b as zt,D as Ft,h as Mn,e as qn,i as bT}from"./dialog-B0OdXcqs.js";import{c as vT,b as F2,a as U2,D as H2,d as yT}from"./drawer-C2s6Up5H.js";import{C as _T}from"./collection-search-CJb7f2bn.js";import{a as ra,u as Cn,i as Mm,S as Xu,b as LT,c as wT,g as Yh,R as ST,d as kT,e as jT,W as Kd,C as CT}from"./use-mcp-client-BS1HAuw9.js";import{u as z6,g as t9,l as Im}from"./use-mcp-prompts-Bqus7nV6.js";import{t as hs,n as F6}from"./ChevronUp-CBLrm_OT.js";import{t as NT,z as VT,u as Ju,a as K2,b as s9,c as n9}from"./hooks-BJUiYjpq.js";import{K as TT,i as U6,u as oa,o as AT,f as PT}from"./shell-layout-DtX3xYLo.js";import{u as As,a as sl,b as W2,c as ET,d as RT}from"./use-virtual-mcp-Ck5PGc0k.js";import{w as DT,A as MT}from"./autosend-D9JhT_oZ.js";import{r as H6,d as i9,a as q2,p as IT,b as OT,s as $T,c as BT}from"./thread-intent-CqM5vUU9.js";import{i as gr}from"./ArrowRight-Cr3akrFT.js";import{t as r9,l as K6,m as G2,h as oo,o as W6,p as q6,q as G6,A as Kr,r as Y6,u as Hc,j as Wr,v as Q6,w as rd,x as zT,y as FT,c as X6,z as Qh,B as o9,f as Om,k as J6,C as UT,D as HT,g as Y2,E as a9,F as nl,G as KT,H as Q2,I as Z6,J as e8,K as $m,L as v1,M as Q4,N as Zu,O as WT,P as qT,Q as GT,R as YT,S as QT,T as XT,n as X2,U as X4,V as J2,W as t8,X as JT,Y as s8,Z as n8,_ as i8,$ as r8,a0 as ZT,a1 as Z2,a2 as eA,a3 as Vi,a4 as J4,a5 as tA,a6 as sA,d as o8,a7 as eg,a8 as od,a9 as Fo,aa as tg,ab as e0,ac as nA,i as l9,ad as iA,ae as sg,af as rA,ag as oA,ah as aA,ai as lA,aj as cA,ak as dA,al as zr,am as Z4,an as a8,ao as uA,ap as hA,aq as Ia,ar as ex,as as fA,at as mA,au as pA,av as l8,aw as gA,ax as c8,ay as xA,az as bA,aA as vA,aB as yA,aC as _A,aD as au,aE as LA,aF as wA,aG as d8,aH as ng,aI as SA,aJ as kA,aK as jA,aL as CA}from"./agent-icon-BMTcgZga.js";import{i as Gt}from"./Check-sicxXYN7.js";import{a as ni}from"./Image01-B1m-gUl3.js";import{i as Gn}from"./Upload01-Dbydv0Li.js";import{i as vn}from"./AlertCircle-C2I0CPt8.js";import{a as bn}from"./Copy01-BzbXBjHv.js";import{F as Bm,a as ig,b as rg,c as og,d as u8}from"./form-TWkufiDd.js";import{c as Rt,S as xs,b as bs,a as Ss,d as vs}from"./select-VruWLBER.js";import{i as c9}from"./ArrowLeft-DiFtyxtp.js";import{T as Pa,a as ad,b as or,c as t0}from"./tabs-CzhgwOMh.js";import{t as zm,i as ag}from"./Tool02-Dx9QVS5U.js";import{T as d9,a as Kc}from"./toggle-group-C6RmEYNw.js";import{I as vt}from"./input-SHpohkkd.js";import{u as lg,A as h8,j as NA,b as f8,k as VA,l as TA,m as AA,n as m8,a as PA,e as Fm,r as Um,p as EA,o as RA,s as DA,q as MA,v as IA,w as OA,x as $A,y as tx,z as BA,B as zA,C as sx,D as FA,S as ar,E as UA,F as HA,G as KA,h as WA,c as cg,H as Yo,I as un,T as Wn,t as dg,J as u9,f as Hm,K as p8,L as s0,M as ug,N as n0,O as g8,Q as x8,R as Km,U as b8,V as qA,W as v8,X as GA,Y as YA,Z as QA,_ as XA,$ as JA,a0 as ZA,a1 as eP,a2 as tP,a3 as y8,a4 as sP,i as nP,g as iP,a5 as rP,a6 as oP,a7 as aP,a8 as Wm,a9 as nx,aa as lP,ab as cP,ac as dP,ad as uP,ae as hP,af as h9}from"./task-route-C50QtiSH.js";import{s as ii,i as hg,c as _8}from"./XClose-hM3AAAai.js";import{M as fP,a as mP,m as f9,i as pP,g as L8,b as gP,N as xP,c as bP}from"./select-model-R6GRqP4o.js";import{a as ws,b as ks,P as js,c as vP}from"./popover-DClv4J5a.js";import{t as Fr}from"./Stars01-CFR1c-1g.js";import{b as yP,a as w8,u as i0,c as S8,d as _P}from"./use-organization-settings-zsIQ5yKP.js";import{u as m9,a as LP}from"./use-ai-providers-CBAbpFCs.js";import{g as k8,c as j8,u as r0,b as xn,L as fg,P as C8,s as N8,a as wP,f as SP,d as kP}from"./project-icon-DB0uWZzs.js";import{f as jP,a as CP,u as ku,b as o0,c as V8,d as NP,e as mg,g as T8,h as pg,i as VP,j as gg,k as ju,l as A8,m as TP,n as P8,o as AP}from"./folder-icon-D1UH1rlz.js";import{c as Ot,D as $t,b as Bt,a as Qe,d as _i,e as Li,f as wi,g as Xh,h as Uo,i as Dc,j as kd}from"./dropdown-menu-CoV3z2Yq.js";import{i as xg}from"./Link01-ClTL5UTN.js";import{s as Qt}from"./Plus-5jblmb5M.js";import{p as PP,q as EP}from"./question-004-sINsf4GQ.js";import{A as sn}from"./avatar-CPkw3h7t.js";import{u as bg,a as vg}from"./use-members-BPrB4_B6.js";import{i as Ns}from"./ChevronRight-r0gLJbn2.js";import{u as ld}from"./use-is-desktop-app-BNujXJc_.js";import{a as Di,b as E8,u as yg,c as R8}from"./use-panel-navigate-Bnu_Y_WK.js";import{i as xr}from"./CheckCircle-Cbkf0Hrm.js";import{i as RP}from"./XCircle-CiIZAkGm.js";import{I as ao}from"./integration-icon-BQARLIol.js";import{a as p9,u as D8,b as _g,c as DP,d as MP,p as IP,e as OP,f as $P,g as Lg,h as BP,i as zP}from"./use-navigate-to-agent-yGdOMWOW.js";import{e as a0}from"./backoff-CrEUbyZT.js";import{u as FP}from"./use-status-sounds-BSHc34AF.js";import{E as Ti}from"./empty-state-UGFooPJ_.js";import{b as UP,c as l0,d as M8,u as I8,r as HP}from"./thread-route-B_3hJRNO.js";import{g as aa,r as Un,h as wg,a as O8,b as $8}from"./github-repo-CTPv5ZM2.js";import{T as KP}from"./toolbar-DalvtXvG.js";import{i as Qo,a as WP}from"./Share07-DzTdSg05.js";import{i as jn}from"./Globe01-dlVOEKaQ.js";import{i as B8}from"./Monitor01-Bndg-M3Y.js";import{u as dr,a as Sg,b as z8}from"./use-connection-Cxk618DD.js";import{u as F8,a as U8}from"./use-mcp-tools-CcPY1kUa.js";import{g as H8}from"./types-CaQxQn--.js";import{F as Xo}from"./file-type-icon-DnRMRlEa.js";import{e as K8,s as kg,c as qP,b as GP}from"./TrendUp01-DjG8w8m_.js";import{i as Ai}from"./ZoomOut-B_xPvOLH.js";import{i as qr}from"./GitBranch01-D3Ep4J5o.js";import{a as jg}from"./Package-B2Up-gTH.js";import{i as Cg,r as YP,s as W8,a as q8}from"./source-system-tabs-CnEGUb4r.js";import{n as Cu}from"./Download01-Db1D2BD0.js";import{n as hn}from"./LinkExternal01-BepJT7Oz.js";import{D as Ca}from"./use-destination-route-DaFWrAHj.js";import{g as QP,s as XP,d as G8,a as JP,F as Y8,b as Q8,f as X8,S as J8,c as ZP}from"./skill-preview-Cn_VmuJU.js";import{i as g9}from"./Key01-DquPZpqN.js";import{p as Ng,b as cn,s as Wc,H as Nu,h as Vu,a as gc,c as Z8,d as e7}from"./location-oTTXFrSF.js";import{m as eE,a as tE,M as cd,b as sE,O as nE}from"./markdown-DOFXhXXc.js";import{g as iE}from"./extract-connection-data-BPXLZ9J6.js";import{g as x9,n as rE,a as ix,e as oE,u as aE,f as lE}from"./use-date-fns-locale-BC9XewCs.js";import{a as cE,i as rx}from"./mcp-oauth-DHIeN6FN.js";import{A as Gr,a as Yr,b as Qr,c as Xr,d as Jr,e as Zr,f as eo,g as to}from"./alert-dialog-BikX6FFY.js";import{T as Jo}from"./textarea-D5yUmTuo.js";import{c as t7,i as Vg,a as dE,b as uE}from"./UserSquare-Bi0Jy-6E.js";import{i as Oa}from"./Play-DZtU_bVy.js";import{s as rn}from"./Trash01-D5ciFh4O.js";import{u as Jh}from"./use-debounced-autosave-ChhxmJyP.js";import{S as il}from"./scroll-area-Bk3bop_C.js";import{i as Tu}from"./SearchMd-CnBFXj_Z.js";import{C as rl}from"./checkbox-Cgrb5XJJ.js";import{S as b9}from"./search-input-Cr1xDzOR.js";import{C as s7}from"./collection-tabs-BxnrIEJp.js";import{T as n7,u as i7}from"./use-mcp-auth-status-Dm4k96-0.js";import{g as hE}from"./connection-slug-CITJ0kGN.js";import{a as fE,i as mE}from"./Settings02-5WiTDc8b.js";import{S as lo}from"./switch-D5mDYZzD.js";import{i as c0}from"./DotsVertical-Cyt1EoXA.js";import{B as Zh,a as r7,b as o7,c as a7,d as l7,e as c7}from"./breadcrumb-CsyYyKv7.js";import{s as d7}from"./slugify-CEUa2lfQ.js";import{d as dd}from"./delay-CnY5UFtP.js";import{R as d0}from"./repository-import-picker-Ds-7ia8x.js";import{L as Mt}from"./label-rD90jMRy.js";import{s as u7}from"./User01-Dq0QszR-.js";import{t as v9}from"./Users01-C_RVSWfd.js";import{u as h7,a as f7}from"./use-secrets-CEAwJE8l.js";import{G as ur}from"./github-icon-DMu-fvNj.js";import{t as br,c as qc,m as pE,a as m7}from"./differenceInSeconds-C3x8sHUj.js";import{i as u0}from"./SearchLg-DFeP1_X8.js";import{C as gE,a as xE,b as bE}from"./client-icons-B-EXG49U.js";import{g as Rn}from"./get-initials-D-f_fDFw.js";import{S as as,D as p7,C as g7,R as vE,a as yE,i as x7,n as _E,b as LE}from"./task-board-F9nWsjW0.js";import{a as ud}from"./format-time-BtXRrtv4.js";import{u as b7,d as wE,c as SE,C as Tg,a as kE}from"./connect-layout-TQ2j2S05.js";import{u as Ag,a as jE,b as CE}from"./use-tags-u-doSjgu.js";import{u as y1}from"./use-copy-JToNQsYl.js";import{C as vr,a as Mi,b as Ii,c as ri,d as $s,e as fn,f as NE}from"./command-CqNTTNRi.js";import{u as VE}from"./use-org-auth-client-BfcHu9OA.js";import{t as TE}from"./decopilot-sse-pool-pjl5bOdE.js";import{p as AE,r as PE,G as EE,u as RE}from"./repository-picker-zcqpFECf.js";import{l as DE}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{i as y9}from"./ChevronSelectorVertical-CejccrOe.js";import{w as ox}from"./editor-DDZRpuBY.js";import{T as $o,p as v7,I as y7}from"./toolbar-icon-button-aV5MA64L.js";import{u as qm,C as ME,b as IE,p as _7,a as OE,s as Gm,n as $E}from"./self-tool-result-B6OwqL4s.js";import{M as hd}from"./monaco-editor-BncUqSbn.js";import{i as BE,a as _9,b as Pg}from"./Tool01-DCz0PgHD.js";import{a as Ym}from"./Palette-BsEqDIgy.js";import{s as zE}from"./safe-image-url-D5z803Ot.js";import{s as h0}from"./Eye-QPQVcqGb.js";import{u as L9}from"./use-debounced-value-B2sataBb.js";import{u as L7,a as Eg}from"./use-file-configs-BszfQ6Ii.js";import{u as w7}from"./useInfiniteQuery-ctaGuyQM.js";import{i as hr}from"./Zap-Bb7Qo7M3.js";import{r as S7}from"./site-slug-uya6Wp4-.js";import{B as FE}from"./badge-C_ARXG3i.js";import{u as f0,a as UE,b as HE,c as KE,d as WE}from"./use-automations-HZOOTOR3.js";import{A as qE}from"./automation-list-row-Dj0Hlwog.js";import{t as GE}from"./site-error--i37Vnuw.js";import{f as YE,p as QE,g as XE,u as JE,e as ZE,a as eR,F as m0,t as k7,S as tR,B as sR,b as j7,R as nR,c as iR}from"./cards-C17dmtwv.js";function C7(t,e){const s=Vs(e);return rR({filters:{...t,status:"pending"}},s).length}function ax(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function rR(t={},e){const s=Vs(e).getMutationCache(),n=T.useRef(t),i=T.useRef(null);return i.current===null&&(i.current=ax(s,t)),T.useEffect(()=>{n.current=t}),T.useSyncExternalStore(T.useCallback(r=>s.subscribe(()=>{const a=vN(i.current,ax(s,n.current));i.current!==a&&(i.current=a,yN.schedule(r))}),[s]),()=>i.current,()=>i.current)}const N7=Tt({connection_id:Ae().describe("Connection ID"),selected_tools:ns(Ae()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ns(Ae()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ns(Ae()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),_1=500,V7=200,Rg=200,oR=200,aR=20,lR=50,cR=100,dR=20,uR=100,hR=50,fR=100,mR=50,pR=8192,T7=N7.extend({selected_tools:ns(Ae()).max(_1).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ns(Ae()).max(_1).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ns(Ae()).max(_1).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),gR=Tt({connectionId:Ae(),toolName:Ae(),label:Ae(),icon:Ae().nullable().optional()}),xR=Tt({id:Ae().describe("Stable id; used as React key and ?tab= value"),title:Ae().describe("Tab label"),icon:Ae().optional().describe("Optional lucide icon name"),view:Tt({type:Kh("ext-app"),appId:Ae(),args:wu(Ae(),c6()).optional()})}),A7=oi(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations"]),bR=oi(["on","off"]),vR=new Map([["manual","on"],["auto","on"]]),yR=oi(["on","off","manual","auto"]);function _R(t){if(!t)return null;const e=vR.get(t);return e||(t==="on"||t==="off"?t:null)}const LR=Tt({defaultMainView:Tt({type:Ae(),id:Ae().optional(),toolName:Ae().optional()}).nullable().optional(),chatDefaultOpen:Hr().nullable().optional(),cmsDefaultOpen:Hr().nullable().optional(),cms:yR.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:ns(A7).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:ns(xR).max(dR).optional()});function p0(t){return _R(t?.cms)??"on"}function wR(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"site-editor"}}:{}}}const lx=Tt({tileId:Ae().optional(),connectionId:Ae().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Ae().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Ae().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:wu(Ae(),c6()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:ji().int().positive().optional(),maxHeight:ji().int().positive().optional()}),SR=Tt({banner:Ae().nullable().optional(),bannerColor:Ae().nullable().optional(),icon:Ae().nullable().optional(),themeColor:Ae().nullable().optional(),pinnedViews:ns(gR).max(cR).nullable().optional(),layout:LR.nullable().optional(),homeTile:lx.nullable().optional(),homeTiles:ns(lx).max(aR).nullable().optional(),homePrompts:ns(Ae()).max(lR).nullable().optional()}),g0=/^[A-Za-z_][A-Za-z0-9_]*$/,cx=Ae().min(1).regex(g0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),kR=LN("kind",[Tt({key:cx,kind:Kh("literal"),value:Ae().max(pR)}),Tt({key:cx,kind:Kh("secret"),secretId:Ae().min(1)})]),Dg=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,jR=Tt({host:Ae().min(1).regex(Dg).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Ae().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),CR=Tt({selected:Ae().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Ae().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Ae().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:ns(kR).max(fR).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:ns(jR).max(mR).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),NR=Tt({url:Ae().describe("GitHub repository URL"),owner:Ae().describe("Repository owner"),name:Ae().describe("Repository name"),installationId:ji().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Ae().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:Ae().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),VR=oi(["agent-sandbox","local-api"]),TR={sandboxHandle:Ae().describe("Provider-specific handle"),previewUrl:Ae().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Ae().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:ji().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Tt({packageManager:Ae().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Ae().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Ae().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},P7=Tt(TR);function AR(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,i]of Object.entries(e))if(!(!i||typeof i!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=P7.parse(i)}catch{}return s}const PR=wu(Ae().describe("userId"),wu(Ae().describe("branch"),_N(VR,P7))),ER=Tt({id:Ae().describe("Stable identifier for this knowledge file"),name:Ae().describe("File name shown in the UI"),kind:oi(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Ae().describe("Org filesystem (Library) volume the file lives in"),path:Ae().describe("Path within the volume"),url:Ae().describe("Same-origin URL to read the file (display/download)"),contentType:Ae().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:ji().nullable().optional().describe("File size in bytes"),addedAt:Ae().describe("ISO timestamp when the file was attached")}),RR=ns(ER).max(uR).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),DR=oi(["smart","code-review","open"]),MR=DR.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),IR=Hr().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),OR=Hr().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),$R=Ae().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),BR=Tt({branch:Ae().describe("Git branch backing this release"),name:Ae().describe('User-facing name, e.g. "Black Friday 2026"'),color:Ae().describe("Dot color token shown in the version switcher"),createdBy:Ae().optional().describe("User ID who created the release"),createdAt:Ae().optional().describe("ISO 8601 creation timestamp")}),zR=ns(BR).max(hR).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),Mg={instructions:Ae().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:ns(Ae()).max(Rg).nullable().optional().describe("List of enabled plugin IDs"),subAgents:ns(Ae()).max(oR).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ae().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:SR.nullable().optional().describe("UI customization settings"),sidebarViews:ns(A7).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:Kh(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),githubRepo:NR.nullable().optional().describe("Linked GitHub repository"),runtime:CR.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:RR,siteSlug:Ae().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:MR,previewServerUrl:$R,productionUrl:Ae().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:Hr().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:IR,releases:zR,fastPreviewInPlace:OR},FR=Tt({id:Ae().describe("Unique identifier"),title:Ae().describe("Human-readable name"),description:Ae().nullable().describe("Description"),icon:Ae().nullable().describe("Icon URL"),created_at:Ae().describe("Creation timestamp"),updated_at:Ae().describe("Last update timestamp"),created_by:Ae().describe("User ID who created this item"),updated_by:Ae().optional().describe("User ID who last updated this item"),organization_id:Ae().describe("Organization ID this item belongs to"),status:oi(["active","inactive"]).describe("Current status"),pinned:Hr().describe("Whether this space is pinned to the sidebar"),metadata:Tt(Mg).extend({instructions:Ae().nullable().describe("Instructions also used as system prompt"),sandboxMap:PR.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:ns(N7).describe("Connections with their selected tools, resources, and prompts")}),E7=Tt({title:Ae().min(1).max(120).describe("Short label shown on the chip"),description:Ae().max(280).optional().describe("One-line subtitle shown under the title"),text:Ae().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});Tt({title:Ae().min(1).max(255).describe("Name for the virtual MCP"),description:Ae().max(500).nullable().optional().describe("Optional description"),icon:Ae().nullish().describe("Optional icon URL"),status:oi(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:Hr().optional().default(!1).describe("Pin to sidebar"),metadata:Tt(Mg).extend({enabled_plugins:ns(Ae()).max(Rg).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ns(T7).max(V7).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:ns(E7).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Tt({title:Ae().min(1).max(255).optional().describe("New name"),description:Ae().max(500).nullable().optional().describe("New description (null to clear)"),icon:Ae().nullish().describe("New icon URL"),status:oi(["active","inactive"]).optional().describe("New status"),pinned:Hr().optional().describe("Pin/unpin from sidebar"),metadata:Tt(Mg).extend({enabled_plugins:ns(Ae()).max(Rg).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ns(T7).max(V7).optional().describe("New connections (replaces existing)"),prompts:ns(E7).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});function Au(t,e){const s=x9(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,i=br(t,e?.in),r=i.getDay(),a=(r<n?7:0)+r-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function ef(t,e){return Au(t,{...e,weekStartsOn:1})}function R7(t,e){const s=br(t,e?.in),n=s.getFullYear(),i=qc(s,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=ef(i),a=qc(s,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=ef(a);return s.getTime()>=r.getTime()?n+1:s.getTime()>=l.getTime()?n:n-1}function dx(t,e){const s=br(t,e?.in);return s.setHours(0,0,0,0),s}function UR(t,e,s){const[n,i]=rE(s?.in,t,e),r=dx(n),a=dx(i),l=+r-ix(r),c=+a-ix(a);return Math.round((l-c)/pE)}function HR(t,e){const s=R7(t,e),n=qc(t,0);return n.setFullYear(s,0,4),n.setHours(0,0,0,0),ef(n)}function KR(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function WR(t){return!(!KR(t)&&typeof t!="number"||isNaN(+br(t)))}function qR(t,e){const s=br(t,e?.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}function GR(t,e){const s=br(t,e?.in);return UR(s,qR(s))+1}function YR(t,e){const s=br(t,e?.in),n=+ef(s)-+HR(s);return Math.round(n/m7)+1}function D7(t,e){const s=br(t,e?.in),n=s.getFullYear(),i=x9(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=qc(e?.in||t,0);a.setFullYear(n+1,0,r),a.setHours(0,0,0,0);const l=Au(a,e),c=qc(e?.in||t,0);c.setFullYear(n,0,r),c.setHours(0,0,0,0);const d=Au(c,e);return+s>=+l?n+1:+s>=+d?n:n-1}function QR(t,e){const s=x9(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=D7(t,e),r=qc(e?.in||t,0);return r.setFullYear(i,0,n),r.setHours(0,0,0,0),Au(r,e)}function XR(t,e){const s=br(t,e?.in),n=+Au(s,e)-+QR(s,e);return Math.round(n/m7)+1}function Ut(t,e){const s=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return s+n}const No={y(t,e){const s=t.getFullYear(),n=s>0?s:1-s;return Ut(e==="yy"?n%100:n,e.length)},M(t,e){const s=t.getMonth();return e==="M"?String(s+1):Ut(s+1,2)},d(t,e){return Ut(t.getDate(),e.length)},a(t,e){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];default:return s==="am"?"a.m.":"p.m."}},h(t,e){return Ut(t.getHours()%12||12,e.length)},H(t,e){return Ut(t.getHours(),e.length)},m(t,e){return Ut(t.getMinutes(),e.length)},s(t,e){return Ut(t.getSeconds(),e.length)},S(t,e){const s=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,s-3));return Ut(i,e.length)}},xc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ux={G:function(t,e,s){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return s.era(n,{width:"abbreviated"});case"GGGGG":return s.era(n,{width:"narrow"});default:return s.era(n,{width:"wide"})}},y:function(t,e,s){if(e==="yo"){const n=t.getFullYear(),i=n>0?n:1-n;return s.ordinalNumber(i,{unit:"year"})}return No.y(t,e)},Y:function(t,e,s,n){const i=D7(t,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return Ut(a,2)}return e==="Yo"?s.ordinalNumber(r,{unit:"year"}):Ut(r,e.length)},R:function(t,e){const s=R7(t);return Ut(s,e.length)},u:function(t,e){const s=t.getFullYear();return Ut(s,e.length)},Q:function(t,e,s){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Ut(n,2);case"Qo":return s.ordinalNumber(n,{unit:"quarter"});case"QQQ":return s.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(n,{width:"narrow",context:"formatting"});default:return s.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,s){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Ut(n,2);case"qo":return s.ordinalNumber(n,{unit:"quarter"});case"qqq":return s.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(n,{width:"narrow",context:"standalone"});default:return s.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,s){const n=t.getMonth();switch(e){case"M":case"MM":return No.M(t,e);case"Mo":return s.ordinalNumber(n+1,{unit:"month"});case"MMM":return s.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(n,{width:"narrow",context:"formatting"});default:return s.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,s){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return Ut(n+1,2);case"Lo":return s.ordinalNumber(n+1,{unit:"month"});case"LLL":return s.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(n,{width:"narrow",context:"standalone"});default:return s.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,s,n){const i=XR(t,n);return e==="wo"?s.ordinalNumber(i,{unit:"week"}):Ut(i,e.length)},I:function(t,e,s){const n=YR(t);return e==="Io"?s.ordinalNumber(n,{unit:"week"}):Ut(n,e.length)},d:function(t,e,s){return e==="do"?s.ordinalNumber(t.getDate(),{unit:"date"}):No.d(t,e)},D:function(t,e,s){const n=GR(t);return e==="Do"?s.ordinalNumber(n,{unit:"dayOfYear"}):Ut(n,e.length)},E:function(t,e,s){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return s.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,s,n){const i=t.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Ut(r,2);case"eo":return s.ordinalNumber(r,{unit:"day"});case"eee":return s.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(i,{width:"short",context:"formatting"});default:return s.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,s,n){const i=t.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Ut(r,e.length);case"co":return s.ordinalNumber(r,{unit:"day"});case"ccc":return s.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(i,{width:"narrow",context:"standalone"});case"cccccc":return s.day(i,{width:"short",context:"standalone"});default:return s.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,s){const n=t.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Ut(i,e.length);case"io":return s.ordinalNumber(i,{unit:"day"});case"iii":return s.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,s){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,s){const n=t.getHours();let i;switch(n===12?i=xc.noon:n===0?i=xc.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,s){const n=t.getHours();let i;switch(n>=17?i=xc.evening:n>=12?i=xc.afternoon:n>=4?i=xc.morning:i=xc.night,e){case"B":case"BB":case"BBB":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,s){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),s.ordinalNumber(n,{unit:"hour"})}return No.h(t,e)},H:function(t,e,s){return e==="Ho"?s.ordinalNumber(t.getHours(),{unit:"hour"}):No.H(t,e)},K:function(t,e,s){const n=t.getHours()%12;return e==="Ko"?s.ordinalNumber(n,{unit:"hour"}):Ut(n,e.length)},k:function(t,e,s){let n=t.getHours();return n===0&&(n=24),e==="ko"?s.ordinalNumber(n,{unit:"hour"}):Ut(n,e.length)},m:function(t,e,s){return e==="mo"?s.ordinalNumber(t.getMinutes(),{unit:"minute"}):No.m(t,e)},s:function(t,e,s){return e==="so"?s.ordinalNumber(t.getSeconds(),{unit:"second"}):No.s(t,e)},S:function(t,e){return No.S(t,e)},X:function(t,e,s){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return fx(n);case"XXXX":case"XX":return _a(n);default:return _a(n,":")}},x:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"x":return fx(n);case"xxxx":case"xx":return _a(n);default:return _a(n,":")}},O:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+hx(n,":");default:return"GMT"+_a(n,":")}},z:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+hx(n,":");default:return"GMT"+_a(n,":")}},t:function(t,e,s){const n=Math.trunc(+t/1e3);return Ut(n,e.length)},T:function(t,e,s){return Ut(+t,e.length)}};function hx(t,e=""){const s=t>0?"-":"+",n=Math.abs(t),i=Math.trunc(n/60),r=n%60;return r===0?s+String(i):s+String(i)+e+Ut(r,2)}function fx(t,e){return t%60===0?(t>0?"-":"+")+Ut(Math.abs(t)/60,2):_a(t,e)}function _a(t,e=""){const s=t>0?"-":"+",n=Math.abs(t),i=Ut(Math.trunc(n/60),2),r=Ut(n%60,2);return s+i+e+r}const mx=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},M7=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},JR=(t,e)=>{const s=t.match(/(P+)(p+)?/)||[],n=s[1],i=s[2];if(!i)return mx(t,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",mx(n,e)).replace("{{time}}",M7(i,e))},ZR={p:M7,P:JR},eD=/^D+$/,tD=/^Y+$/,sD=["D","DD","YY","YYYY"];function nD(t){return eD.test(t)}function iD(t){return tD.test(t)}function rD(t,e,s){const n=oD(t,e,s);if(console.warn(n),sD.includes(t))throw new RangeError(n)}function oD(t,e,s){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const aD=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,lD=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,cD=/^'([^]*?)'?$/,dD=/''/g,uD=/[a-zA-Z]/;function hD(t,e,s){const n=x9(),i=s?.locale??n.locale??oE,r=s?.firstWeekContainsDate??s?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=s?.weekStartsOn??s?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=br(t,s?.in);if(!WR(l))throw new RangeError("Invalid time value");let c=e.match(lD).map(h=>{const u=h[0];if(u==="p"||u==="P"){const f=ZR[u];return f(h,i.formatLong)}return h}).join("").match(aD).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const u=h[0];if(u==="'")return{isToken:!1,value:fD(h)};if(ux[u])return{isToken:!0,value:h};if(u.match(uD))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:h}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const d={firstWeekContainsDate:r,weekStartsOn:a,locale:i};return c.map(h=>{if(!h.isToken)return h.value;const u=h.value;(!s?.useAdditionalWeekYearTokens&&iD(u)||!s?.useAdditionalDayOfYearTokens&&nD(u))&&rD(u,e,String(t));const f=ux[u[0]];return f(l,u,i.localize,d)}).join("")}function fD(t){const e=t.match(cD);return e?e[1].replace(dD,"'"):t}const px=3,I7="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",mD="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function O7(t){const e=F.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:r,variant:a}=t,l=a===void 0?"pill":a,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=Br(c._meta);d=c.title??M2(c.name,S),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const h=d,u=c.description||null;if(l==="card"){let S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const k=r||i,j=i&&"bg-accent/40",C=(r||i)&&"cursor-not-allowed opacity-50";let V;e[7]!==j||e[8]!==C?(V=re(mD,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=V):V=e[9];let N;e[10]!==h?(N=o.jsx("span",{className:"font-medium truncate capitalize",children:h}),e[10]=h,e[11]=N):N=e[11];let A;e[12]!==i?(A=i&&o.jsx(et,{size:"xs"}),e[12]=i,e[13]=A):A=e[13];let P;e[14]!==N||e[15]!==A?(P=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,A]}),e[14]=N,e[15]=A,e[16]=P):P=e[16];let R;e[17]!==u?(R=u&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=R):R=e[18];let E;return e[19]!==P||e[20]!==R||e[21]!==S||e[22]!==k||e[23]!==V?(E=o.jsxs("button",{type:"button",onClick:S,disabled:k,className:V,children:[P,R]}),e[19]=P,e[20]=R,e[21]=S,e[22]=k,e[23]=V,e[24]=E):E=e[24],E}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const p=r||i,m=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==m||e[29]!==g?(x=re(I7,"hover:bg-muted/70 hover:text-foreground",m,g),e[28]=m,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==h?(b=o.jsx("span",{className:"capitalize",children:h}),e[31]=h,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&o.jsx(et,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let L;e[35]!==f||e[36]!==p||e[37]!==x||e[38]!==b||e[39]!==v?(L=o.jsx(He,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:p,className:x,children:[b,v]})}),e[35]=f,e[36]=p,e[37]=x,e[38]=b,e[39]=v,e[40]=L):L=e[40];const _=u??h;let y;e[41]!==_?(y=o.jsx(Ke,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:_})}),e[41]=_,e[42]=y):y=e[42];let w;return e[43]!==L||e[44]!==y?(w=o.jsxs(We,{delayDuration:400,children:[L,y]}),e[43]=L,e[44]=y,e[45]=w):w=e[45],w}function pD(t){const e=F.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:a}=t,l=ae(),[c,d]=T.useState(""),h=!!a;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(N=>{const A=c.toLowerCase();return N.prompt.name.toLowerCase().includes(A)||(N.prompt.title??"").toLowerCase().includes(A)||(N.prompt.description??"").toLowerCase().includes(A)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const f=u,p=Za();let m;e[3]!==f.length||e[4]!==c||e[5]!==l?(m=f.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:l("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=l,e[6]=m):m=e[6];let g;if(e[7]!==f||e[8]!==h||e[9]!==a?.name||e[10]!==i||e[11]!==r){let N;e[13]!==h||e[14]!==a?.name||e[15]!==i||e[16]!==r?(N=A=>o.jsx(O7,{item:A,variant:"card",onSelect:P=>{i(!1),r(P)},isLoading:a?.name===A.prompt.name,isDisabled:h&&a?.name!==A.prompt.name},A.prompt.name),e[13]=h,e[14]=a?.name,e[15]=i,e[16]=r,e[17]=N):N=e[17],g=f.map(N),e[7]=f,e[8]=h,e[9]=a?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==m||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[m,g]})}),e[18]=m,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==l?(v=l("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=l,e[22]=v):v=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=N=>{N.key==="Escape"&&d("")},e[23]=L):L=e[23];let _;e[24]!==c||e[25]!==v?(_=o.jsx(_T,{value:c,onChange:d,placeholder:v,onKeyDown:L}),e[24]=c,e[25]=v,e[26]=_):_=e[26];const y=_;if(p){let N;e[27]!==l?(N=l("chat.iceBreakers.allPromptsTitle"),e[27]=l,e[28]=N):N=e[28];let A;e[29]!==N?(A=o.jsx(vT,{className:"sr-only",children:o.jsx(F2,{children:N})}),e[29]=N,e[30]=A):A=e[30];let P;e[31]!==l?(P=l("chat.iceBreakers.promptsLabel"),e[31]=l,e[32]=P):P=e[32];let R;e[33]!==P?(R=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:P})}),e[33]=P,e[34]=R):R=e[34];let E;e[35]!==b||e[36]!==y||e[37]!==R||e[38]!==A?(E=o.jsxs(U2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[A,R,y,b]}),e[35]=b,e[36]=y,e[37]=R,e[38]=A,e[39]=E):E=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==E?(I=o.jsx(Go,{delayDuration:400,children:o.jsx(H2,{open:n,onOpenChange:i,children:E})}),e[40]=i,e[41]=n,e[42]=E,e[43]=I):I=e[43],I}let w;e[44]!==l?(w=l("chat.iceBreakers.allPromptsTitle"),e[44]=l,e[45]=w):w=e[45];let S;e[46]!==w?(S=o.jsx(cs,{className:"sr-only",children:o.jsx(Kt,{children:w})}),e[46]=w,e[47]=S):S=e[47];let k;e[48]!==l?(k=l("chat.iceBreakers.promptsLabel"),e[48]=l,e[49]=k):k=e[49];let j;e[50]!==k?(j=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let C;e[52]!==b||e[53]!==y||e[54]!==j||e[55]!==S?(C=o.jsxs(zt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,y,b]}),e[52]=b,e[53]=y,e[54]=j,e[55]=S,e[56]=C):C=e[56];let V;return e[57]!==i||e[58]!==n||e[59]!==C?(V=o.jsx(Go,{delayDuration:400,children:o.jsx(Ft,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=V):V=e[60],V}function gD(t){const e=F.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,a=ae(),[l,c]=T.useState(!1);if(s.length===0)return null;let d,h,u,f,p;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==a){const b=s.slice(0,px),v=s.slice(px),L=!!i;let _;e[10]!==L||e[11]!==i?.name||e[12]!==n?(_=w=>o.jsx(O7,{item:w,onSelect:n,isLoading:i?.name===w.prompt.name,isDisabled:L&&i?.name!==w.prompt.name},w.prompt.name),e[10]=L,e[11]=i?.name,e[12]=n,e[13]=_):_=e[13];const y=b.map(_);d=Go,p=400,e[14]!==r?(h=re("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=h):h=e[15],u=y,f=v.length>0&&o.jsx("button",{type:"button",disabled:L,onClick:()=>c(!0),className:re(I7,"hover:bg-muted/70 hover:text-foreground",L&&"opacity-50 cursor-not-allowed"),children:a("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=a,e[5]=d,e[6]=h,e[7]=u,e[8]=f,e[9]=p}else d=e[5],h=e[6],u=e[7],f=e[8],p=e[9];let m;e[16]!==h||e[17]!==u||e[18]!==f?(m=o.jsxs("div",{className:h,children:[u,f]}),e[16]=h,e[17]=u,e[18]=f,e[19]=m):m=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==l||e[23]!==n?(g=o.jsx(pD,{items:s,open:l,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=l,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==p||e[27]!==m||e[28]!==g?(x=o.jsxs(d,{delayDuration:p,children:[m,g]}),e[25]=d,e[26]=p,e[27]=m,e[28]=g,e[29]=x):x=e[29],x}function xD(){return null}function bD(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function vD(t){const e=F.c(31),{connectionId:s}=t,n=ae(),{sendMessage:i}=ai(),{org:r}=Ue();let a;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const l=Cn(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=z6(c);let h;e[6]!==d?.prompts?(h=d?.prompts??[],e[6]=d?.prompts,e[7]=h):h=e[7];const u=h;let f;e[8]!==u?(f=u.map(yD),e[8]=u,e[9]=f):f=e[9];const p=f;let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m={stage:"idle"},e[10]=m):m=e[10];const[g,x]=T.useReducer(bD,m),[b,v]=T.useState(null);let L;e[11]!==l||e[12]!==i||e[13]!==n?(L=async(P,R)=>{if(!l){ye.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const E=await t9(l,P.name,R);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[Yf({id:P.name,name:Gu(P.name,Br(P._meta)),metadata:E.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]};await i(I)}catch(E){console.error("[ice-breakers] Failed to fetch prompt:",E),ye.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=l,e[12]=i,e[13]=n,e[14]=L):L=e[14];const _=L;let y;e[15]!==_?(y=async P=>{if(P.arguments&&P.arguments.length>0){x({type:"SELECT_PROMPT",prompt:P}),v(P);return}x({type:"START_LOADING",prompt:P}),await _(P)},e[15]=_,e[16]=y):y=e[16];const w=y;let S;e[17]!==b||e[18]!==_?(S=async P=>{b&&(x({type:"START_LOADING",prompt:b,arguments:P}),v(null),await _(b,P))},e[17]=b,e[18]=_,e[19]=S):S=e[19];const k=S;if(p.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==w||e[21]!==p||e[22]!==j?(C=o.jsx(gD,{items:p,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=p,e[22]=j,e[23]=C):C=e[23];let V;e[24]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{v(null),x({type:"RESET"})},e[24]=V):V=e[24];let N;e[25]!==b||e[26]!==k?(N=o.jsx(qh,{prompt:b,setPrompt:V,onSubmit:k}),e[25]=b,e[26]=k,e[27]=N):N=e[27];let A;return e[28]!==C||e[29]!==N?(A=o.jsxs(o.Fragment,{children:[C,N]}),e[28]=C,e[29]=N,e[30]=A):A=e[30],A}function yD(t){return{prompt:t}}function _D(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:n}=el(),{org:i}=Ue();let r;e[0]!==i.id?(r=ra(i.id),e[0]=i.id,e[1]=r):r=e[1];const a=r.id,l=n?.id??a;let c;e[2]!==s?(c=re("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=l??"default";let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(xD,{}),e[4]=h):h=e[4];let u;e[5]!==l?(u=o.jsx(vD,{connectionId:l}),e[5]=l,e[6]=u):u=e[6];let f;e[7]!==d||e[8]!==u?(f=o.jsx(tn,{fallback:null,children:o.jsx(T.Suspense,{fallback:h,children:u},d)}),e[7]=d,e[8]=u,e[9]=f):f=e[9];let p;return e[10]!==c||e[11]!==f?(p=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=p):p=e[12],p}const L1="cubic-bezier(0.645, 0.045, 0.355, 1)",LD=44,wD={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},SD={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},kD={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Zo(t){const e=F.c(69),{icon:s,label:n,count:i,title:r,footerLeft:a,footerRight:l,children:c,defaultExpanded:d,variant:h,onClose:u}=t,f=h===void 0?"default":h,p=ae(),[m,g]=T.useState(d),[x,b]=T.useState(!1);let v;e[0]!==u?(v=()=>{b(!0),u?.()},e[0]=u,e[1]=v):v=e[1];const L=v;if(x)return null;const _=SD[f],y=wD[f];let w;e[2]!==_||e[3]!==y?(w=re("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",_,y),e[2]=_,e[3]=y,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(jD),e[5]=S):S=e[5];const k=m&&"rounded-b-none",j=!m&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=re("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=C):C=e[8];const V=kD[f];let N;e[9]!==V?(N=re("shrink-0",V),e[9]=V,e[10]=N):N=e[10];let A;e[11]!==s||e[12]!==N?(A=o.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=A):A=e[13];let P;e[14]!==n?(P=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=P):P=e[15];let R;e[16]!==i?(R=i?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=R):R=e[17];const E=m?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==E?(I=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(hs,{size:16,style:{transform:E,transition:`transform 180ms ${L1}`}})}),e[18]=E,e[19]=I):I=e[19];let D;e[20]!==p?(D=p("chat.collapsibleHighlight.closeLabel"),e[20]=p,e[21]=D):D=e[21];let O;e[22]!==p?(O=p("chat.collapsibleHighlight.closeTitle"),e[22]=p,e[23]=O):O=e[23];let B,M;e[24]!==L?(B=le=>{le.stopPropagation(),L()},M=le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),L())},e[24]=L,e[25]=B,e[26]=M):(B=e[25],M=e[26]);let z;e[27]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(nn,{size:16}),e[27]=z):z=e[27];let $;e[28]!==D||e[29]!==O||e[30]!==B||e[31]!==M?($=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:O,onClick:B,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:z}),e[28]=D,e[29]=O,e[30]=B,e[31]=M,e[32]=$):$=e[32];let U;e[33]!==m||e[34]!==A||e[35]!==P||e[36]!==R||e[37]!==I||e[38]!==$||e[39]!==C?(U=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":m,onClick:S,className:C,children:[A,P,R,I,$]}),e[33]=m,e[34]=A,e[35]=P,e[36]=R,e[37]=I,e[38]=$,e[39]=C,e[40]=U):U=e[40];const H=m?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${L1}`},e[41]=H,e[42]=W):W=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K={overflow:"hidden",minHeight:0},e[43]=K):K=e[43];const G=m?1:0;let Y;e[44]!==G?(Y={opacity:G,transition:`opacity 120ms ${L1}`,maxHeight:"60vh"},e[44]=G,e[45]=Y):Y=e[45];let Z;e[46]!==r?(Z=r?o.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:o.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:r})}):o.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=r,e[47]=Z):Z=e[47];let te;e[48]!==c||e[49]!==r?(te=c?o.jsx("div",{className:re("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=te):te=e[50];let X;e[51]!==Z||e[52]!==te?(X=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[Z,te]}),e[51]=Z,e[52]=te,e[53]=X):X=e[53];let ee;e[54]!==a||e[55]!==l?(ee=a||l?o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:a}),o.jsx("div",{className:"flex items-center gap-2",children:l})]})}):null,e[54]=a,e[55]=l,e[56]=ee):ee=e[56];let J;e[57]!==Y||e[58]!==X||e[59]!==ee?(J=o.jsx("div",{style:K,children:o.jsxs("div",{className:"flex flex-col",style:Y,children:[X,ee]})}),e[57]=Y,e[58]=X,e[59]=ee,e[60]=J):J=e[60];let Q;e[61]!==W||e[62]!==J?(Q=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:J}),e[61]=W,e[62]=J,e[63]=Q):Q=e[63];let oe;return e[64]!==U||e[65]!==Q||e[66]!==w||e[67]!==f?(oe=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:w,children:[U,Q]}),e[64]=U,e[65]=Q,e[66]=w,e[67]=f,e[68]=oe):oe=e[68],oe}function jD(t){return!t}const CD=Tt({content:Ae().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:oi(["pending","in_progress","completed"]),activeForm:Ae().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),$7=Tt({todos:ns(CD)}),ND="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";NT({description:ND,inputSchema:VT($7),execute:async({todos:t})=>({ok:!0,count:t.length})});const VD="tool-todo_write",TD=new Set(["input-available","output-available"]);function AD(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let i=n.length-1;i>=0;i--){const r=n[i];if(r.type!==VD||typeof r.state!="string"||!TD.has(r.state))continue;const a=$7.safeParse(r.input);if(a.success)return a.data.todos}}return[]}function B7(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const n="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:n,friendlyName:Qf(CV(n)),input:s.input})}return e}function z7(t){return t.at(-1)}function F7(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function PD(t){return t?t.message.startsWith("[CREDITS]"):!1}const ED="[SUBSCRIPTION_REQUIRED]";function U7(t){return t?.message.startsWith(ED)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const RD={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function DD(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&PD(s))return{...RD,isCreditExhausted:!0};const a=e.at(-1),l=a?.role==="assistant"?a.parts:[],c=l,h=!!c.filter(_=>_.type==="tool-user_ask").filter(_=>_.state!=="output-available").length,u=F7(l),f=B7(c),p=AD(e),m=i?null:U7(s),g=!i&&!!s&&!m,x=f.length>0||i&&r,b=u.length>0,L=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(h||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:m,hasTodos:p.length>0,showError:g,showWarning:L,hasApprovals:x,hasPlans:b,isWaitingForUserInput:h,todos:p}}function H7(){const t=F.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=ai(),a=s??null,l=n??null;let c;return t[0]!==i||t[1]!==r||t[2]!==e||t[3]!==a||t[4]!==l?(c=DD({messages:e,error:a,finishReason:l,isStreaming:i,isWaitingForApprovals:r}),t[0]=i,t[1]=r,t[2]=e,t[3]=a,t[4]=l,t[5]=c):c=t[5],c}function MD(){const t=H7();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}const gx="start-task",ID=`Turn the report below into a running task. The user pressed "Start task", which authorizes delegation.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-D_5Mw5mz.js","assets/index-BQrXYHq8.js","assets/index-DVOqYnNc.css","assets/chat-context-CNfzERFI.js","assets/use-panel-navigate-BCgywjZr.js","assets/use-destination-route-D6cSISdD.js","assets/autosend-DwiQt7Hp.js","assets/thread-intent-Bs2zwccc.js","assets/slugify-CEUa2lfQ.js","assets/hooks-CsAfHnwZ.js","assets/use-mcp-client-DOWZTxzf.js","assets/auth-mD7u-8Dc.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-BKKbLnQj.js","assets/task-board-Y16rTsTT.js","assets/schema-CRVQdEkJ.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-M1aCpB-b.js","assets/use-ai-providers-Dviyjy6N.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-D-6EFthp.js","assets/thread-route-7UJtJt_K.js","assets/dialog-4-8ZKkTU.js","assets/Check-DP-GgTkq.js","assets/Copy01-DSogth1g.js","assets/Download01-BS_WlExa.js","assets/use-organization-settings-BaVwqjP2.js","assets/ChevronUp-NbusZS2V.js","assets/agent-icon-DEB76nEG.js","assets/AlertCircle-Dn2LzgCm.js","assets/Tool01-Ci448Aet.js","assets/ArrowUp-C639yND1.js","assets/ArrowLeft-CR4qoLXz.js","assets/Tool02-DiUGHbsi.js","assets/ArrowRight-DMcdWoqA.js","assets/TrendUp01-BuuwfsCN.js","assets/ZoomOut-DVGJ65sx.js","assets/Users03-DeLCL3rd.js","assets/CheckCircle-BWifOun7.js","assets/ChevronRight-YI71RlIj.js","assets/ChevronSelectorVertical-t-xj8puk.js","assets/DotsVertical-D3y9ry8A.js","assets/UserSquare-DsDbJW8O.js","assets/CreditCard01-BZJO-bzS.js","assets/Settings02-C_hf-cvI.js","assets/Eye-a7O0RJR_.js","assets/Share07-CIXJRI7f.js","assets/GitBranch01-BRixRiL-.js","assets/Globe01-BlolZAbP.js","assets/XClose-pz5VhGt8.js","assets/HardDrive-DBwa73-Y.js","assets/Image01-VrGlYNYd.js","assets/Key01-DOTGSU1P.js","assets/Link01-BTPLMWJL.js","assets/LinkExternal01-Lt28tIPJ.js","assets/Monitor01-BY8ASxwP.js","assets/Sun-DSykKOZ-.js","assets/Package-dzgX9LxL.js","assets/Palette-Crv7MRNs.js","assets/Play-CrHqV07_.js","assets/Plus-BbNbMcZp.js","assets/SearchLg-D48hKTmL.js","assets/SearchMd-Dd-_aqng.js","assets/Shield01-B5MEXmYj.js","assets/Stars01-CIhmnYwE.js","assets/Trash01-8pnJyNzG.js","assets/Upload01-DHWZ0LJK.js","assets/User01-B36CpY2j.js","assets/Users01-DNjzWOys.js","assets/XCircle-Dh1Q5jf-.js","assets/Zap-7WzpzN1h.js","assets/scroll-area-DEm8VUVS.js","assets/select-Dy0mCkHM.js","assets/input-qeaSKkDL.js","assets/dropdown-menu-CYjkjxzI.js","assets/safe-image-url-D5z803Ot.js","assets/page-seo-form-CNEivUHF.js","assets/label-2w5sLZrP.js","assets/switch-BnmWU4VE.js","assets/use-section-preview-base-Cwr2uSdH.js","assets/automation-runs-DHixRXVQ.js","assets/useInfiniteQuery-C6mK09y1.js","assets/infiniteQueryObserver-DoVQcRsV.js","assets/use-connection-fouxnnWP.js","assets/table-KAgZfIp5.js","assets/empty-state-Djp5Qrmx.js","assets/use-infinite-scroll-BQ5AKvaC.js","assets/use-members-Dad9xTF8.js","assets/use-org-auth-client-Deql-sZk.js","assets/use-automations-sMEuHhLU.js","assets/useSuspenseInfiniteQuery-DTCW75kg.js","assets/avatar-TxNHOaZo.js","assets/format-time-BtXRrtv4.js","assets/differenceInSeconds-C3x8sHUj.js","assets/use-copy-DWPBkf_8.js","assets/markdown-BfU9Q14B.js","assets/monaco-editor-COQ5T_AM.js","assets/editor-Bvcuzd-o.js","assets/mcp-app-renderer-31nL2thK.js","assets/types-C7H-jvYH.js","assets/shell-layout-CotO2kr7.js","assets/project-icon-BFxISnLs.js","assets/github-repo-CTPv5ZM2.js","assets/source-system-tabs-CnEGUb4r.js","assets/command-FZrYmBJm.js","assets/index-acrOElZ3.js","assets/integration-icon-BndzYdzO.js","assets/required-auth-layout-DLzQMK2l.js","assets/use-org-sso-0iLkTuBt.js","assets/use-org-notice-CviLgl-A.js","assets/shell-layout-CuFt8bor.css","assets/use-navigate-to-agent-Dq5Q0ICk.js","assets/use-mcp-prompts-l34GNVIi.js","assets/form-DaQjjTxU.js","assets/file-type-icon-D1-w6wZy.js","assets/drawer-CT1GhzaI.js","assets/collection-search-Cnw9syfX.js","assets/tabs-BC4Wj_kt.js","assets/toggle-group-Diok74bY.js","assets/task-route-CmhiLHqL.js","assets/extract-connection-data-Mn0BJca1.js","assets/metadata-dUsYcpuu.js","assets/connection-BoN2o4Cn.js","assets/connection-card-DAWGXfZx.js","assets/use-registry-connections-DffTM4pd.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-CiyC7MI9.js","assets/connection-form-helpers-3H2I2sjs.js","assets/authenticate-and-persist-oauth-Cb1VPfbU.js","assets/mcp-oauth-KMXzsvi6.js","assets/collection-tabs-0q04uQ8E.js","assets/badge-C5ldr2h3.js","assets/use-file-configs-cX-RxRlm.js","assets/site-slug-uya6Wp4-.js","assets/popover-wqdxNGOt.js","assets/github-icon-fZjpu2Cy.js","assets/get-initials-D-f_fDFw.js","assets/select-model-DpTTzy_N.js","assets/checkbox-BLlbj82t.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-CT3Do-ro.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-Dkl514NB.js","assets/toolbar-B_18C3DR.js","assets/use-mcp-tools-DtR_LDJa.js","assets/skill-preview-Wnefbpcm.js","assets/use-date-fns-locale-b4nMMivC.js","assets/alert-dialog-BZAsgwQj.js","assets/use-debounced-autosave-C1YtdIK-.js","assets/search-input-C0ULLiZH.js","assets/use-mcp-auth-status-B54cY0IQ.js","assets/breadcrumb-DZWD8NyH.js","assets/repository-import-picker-DzCXGQBU.js","assets/repository-picker-BlNupbcV.js","assets/use-debounced-value-Bw89OGDR.js","assets/use-secrets-DMdcT289.js","assets/client-icons-CC68pbc1.js","assets/connect-layout-Cj7kYzPZ.js","assets/self-tool-result-CaFwP-iH.js","assets/provision-repo-scoped-github-connection-WQFARyHG.js","assets/track-BDpi6fse.js","assets/use-tags-DqshTwtF.js","assets/toolbar-icon-button-kSF0Tiq-.js","assets/automation-list-row-DmZ6OQPy.js","assets/site-error--i37Vnuw.js","assets/cards-ahWPrDYX.js","assets/file-explorer-HB3Kjc_j.js","assets/app-editor-BZA5-H8D.js","assets/post-editor-DKXuicWV.js","assets/multi-select-DHeAu7TI.js","assets/block-document-DzTTwdPj.js","assets/primitives-C5_v8n2J.js","assets/use-autosave-DYGkUibZ.js","assets/record-editor-BNIadC-Z.js","assets/category-editor-CVQOrSGs.js","assets/bulk-category-panel-pNvZGXoC.js","assets/index-BbF94fPM.js","assets/seo-editor-87YPoabW.js","assets/variant-calendar-C34nSSck.js","assets/view-mode-toggle-B08Gh1w4.js","assets/post-calendar-ChmrbB0W.js","assets/alert-Dl94NWJF.js","assets/redirect-editor-DQa7nNe7.js","assets/project-app-view-DKi7PUJM.js","assets/index-DeRHV1NZ.js","assets/empty-state-Cnutw7Rx.js","assets/e2e-tab-DG1u-6iR.js","assets/analytics-tab-DV5GngUD.js","assets/chart-yjAjx-Cm.js","assets/index-UTNjrPGP.js","assets/AreaChart-BiimE_rJ.js","assets/cdn-tab-DnFT0Npy.js","assets/ErrorBarContext-D_bPFmDB.js","assets/Sector-BOhRmviT.js"])))=>i.map(i=>d[i]);
2
+ import{n as Vs,r as T,ac as vN,ad as yN,ae as Tt,af as ns,ag as Ae,ah as Hr,ai as oi,aj as Kh,ak as wu,al as _N,am as ji,an as LN,ao as c6,c as F,G as Ue,l as re,j as o,E as tn,b as ae,t as ye,a3 as Go,J as Za,h as et,a1 as He,a2 as Ke,a4 as We,ap as nn,M as Wu,B as me,aq as T2,ar as d6,v as ro,as as Ls,at as ja,au as H4,d as Ks,a7 as us,e as Ds,o as qe,av as wN,C as na,aw as SN,ax as u6,ay as kN,az as er,aA as x1,aB as Kn,aC as jN,aD as b1,aE as CN,aF as NN,aG as VN,aH as TN,aI as A2,aJ as P2,aK as h6,aL as E2,x as Wf,K as tt,aM as AN,aN as PN,aO as EN,aP as f6,aQ as iu,m as Yt,a as On,I as qf,z as qu,Y as Ci,aR as Wh,u as pr,f as ia,aS as RN,aT as K4,aU as Am,aa as m6,a9 as Pm,aV as p6,aW as g6,aX as x6,aY as DN,aZ as MN,L as Io,a_ as b6,p as IN,a$ as Hd,b0 as ru,b1 as ou,b2 as ON,b3 as $N,b4 as BN,b5 as zN,b6 as FN,b7 as UN,b8 as en,b9 as v6,ba as y6,bb as Dn,P as En,bc as Gi,ab as _6,bd as HN,be as Nt,bf as L6,bg as w6,bh as S6,bi as k6,bj as j6,bk as C6,bl as KN,bm as WN,bn as qN,bo as GN,bp as N6,bq as Ws,N as ei,br as V6,bs as YN,bt as QN,bu as T6,bv as XN,bw as JN,bx as ZN,by as eV,bz as Em,bA as Aa,bB as A6,bC as tV,bD as sV,bE as nV,bF as iV,bG as rV,bH as oV,bI as R2,bJ as aV,bK as lV,bL as cV}from"./index-BQrXYHq8.js";import{i as Gf,n as dV}from"./ArrowUp-C639yND1.js";import{u as el,a as ai,b as Ts,c as on,d as P6,s as uV,e as hV,f as fV,g as mV,h as pV,i as gV,j as xV,k as D2,l as E6,T as bV,A as vV,m as yV,n as _V,D as LV,C as wV,t as SV,o as kV,p as jV}from"./chat-context-CNfzERFI.js";import{c as Yf,s as Gu,g as Br,P as qh,d as M2,t as Qf,a as CV,M as NV,i as VV,b as Ni,e as id,f as TV,D as AV,h as PV,j as EV,k as Uc,l as RV,m as DV,u as Xf,E as MV,n as Yu,o as IV,F as OV,p as Jf,q as Zf,r as R6,S as $V,v as BV,w as zV,x as FV,y as W4,z as UV,A as D6,O as HV,B as q4,C as sr,G as KV,T as Ir,H as WV,I as rr,J as Oo,K as Rm,L as Dm,N as M6,Q as qV,R as I6,U as GV,V as li,W as YV,X as QV,Y as O6,Z as Vr,_ as XV,$ as JV,a0 as $6,a1 as ya,a2 as G4,a3 as ZV,a4 as eT,a5 as Y4,a6 as tT,a7 as Su,a8 as tl,a9 as cr,aa as Gh,ab as I2,ac as O2,ad as sT,ae as nT,af as iT,ag as rT,ah as oT,ai as aT,aj as lT,ak as e9,al as $2,am as B2,an as z2,ao as cT,ap as B6,aq as dT,ar as uT,as as hT,at as fT,au as Qu,av as mT,aw as pT,ax as gT,ay as xT}from"./automation-runs-DHixRXVQ.js";import{c as cs,d as Kt,b as zt,D as Ft,h as Mn,e as qn,i as bT}from"./dialog-4-8ZKkTU.js";import{c as vT,b as F2,a as U2,D as H2,d as yT}from"./drawer-CT1GhzaI.js";import{C as _T}from"./collection-search-Cnw9syfX.js";import{a as ra,u as Cn,i as Mm,S as Xu,b as LT,c as wT,g as Yh,R as ST,d as kT,e as jT,W as Kd,C as CT}from"./use-mcp-client-DOWZTxzf.js";import{u as z6,g as t9,l as Im}from"./use-mcp-prompts-l34GNVIi.js";import{t as hs,n as F6}from"./ChevronUp-NbusZS2V.js";import{t as NT,z as VT,u as Ju,a as K2,b as s9,c as n9}from"./hooks-CsAfHnwZ.js";import{K as TT,i as U6,u as oa,o as AT,f as PT}from"./shell-layout-CotO2kr7.js";import{u as As,a as sl,b as W2,c as ET,d as RT}from"./use-virtual-mcp-M1aCpB-b.js";import{w as DT,A as MT}from"./autosend-DwiQt7Hp.js";import{r as H6,d as i9,a as q2,p as IT,b as OT,s as $T,c as BT}from"./thread-intent-Bs2zwccc.js";import{i as gr}from"./ArrowRight-DMcdWoqA.js";import{t as r9,l as K6,m as G2,h as oo,o as W6,p as q6,q as G6,A as Kr,r as Y6,u as Hc,j as Wr,v as Q6,w as rd,x as zT,y as FT,c as X6,z as Qh,B as o9,f as Om,k as J6,C as UT,D as HT,g as Y2,E as a9,F as nl,G as KT,H as Q2,I as Z6,J as e8,K as $m,L as v1,M as Q4,N as Zu,O as WT,P as qT,Q as GT,R as YT,S as QT,T as XT,n as X2,U as X4,V as J2,W as t8,X as JT,Y as s8,Z as n8,_ as i8,$ as r8,a0 as ZT,a1 as Z2,a2 as eA,a3 as Vi,a4 as J4,a5 as tA,a6 as sA,d as o8,a7 as eg,a8 as od,a9 as Fo,aa as tg,ab as e0,ac as nA,i as l9,ad as iA,ae as sg,af as rA,ag as oA,ah as aA,ai as lA,aj as cA,ak as dA,al as zr,am as Z4,an as a8,ao as uA,ap as hA,aq as Ia,ar as ex,as as fA,at as mA,au as pA,av as l8,aw as gA,ax as c8,ay as xA,az as bA,aA as vA,aB as yA,aC as _A,aD as au,aE as LA,aF as wA,aG as d8,aH as ng,aI as SA,aJ as kA,aK as jA,aL as CA}from"./agent-icon-DEB76nEG.js";import{i as Gt}from"./Check-DP-GgTkq.js";import{a as ni}from"./Image01-VrGlYNYd.js";import{i as Gn}from"./Upload01-DHWZ0LJK.js";import{i as vn}from"./AlertCircle-Dn2LzgCm.js";import{a as bn}from"./Copy01-DSogth1g.js";import{F as Bm,a as ig,b as rg,c as og,d as u8}from"./form-DaQjjTxU.js";import{c as Rt,S as xs,b as bs,a as Ss,d as vs}from"./select-Dy0mCkHM.js";import{i as c9}from"./ArrowLeft-CR4qoLXz.js";import{T as Pa,a as ad,b as or,c as t0}from"./tabs-BC4Wj_kt.js";import{t as zm,i as ag}from"./Tool02-DiUGHbsi.js";import{T as d9,a as Kc}from"./toggle-group-Diok74bY.js";import{I as vt}from"./input-qeaSKkDL.js";import{u as lg,A as h8,j as NA,b as f8,k as VA,l as TA,m as AA,n as m8,a as PA,e as Fm,r as Um,p as EA,o as RA,s as DA,q as MA,v as IA,w as OA,x as $A,y as tx,z as BA,B as zA,C as sx,D as FA,S as ar,E as UA,F as HA,G as KA,h as WA,c as cg,H as Yo,I as un,T as Wn,t as dg,J as u9,f as Hm,K as p8,L as s0,M as ug,N as n0,O as g8,Q as x8,R as Km,U as b8,V as qA,W as v8,X as GA,Y as YA,Z as QA,_ as XA,$ as JA,a0 as ZA,a1 as eP,a2 as tP,a3 as y8,a4 as sP,i as nP,g as iP,a5 as rP,a6 as oP,a7 as aP,a8 as Wm,a9 as nx,aa as lP,ab as cP,ac as dP,ad as uP,ae as hP,af as h9}from"./task-route-CmhiLHqL.js";import{s as ii,i as hg,c as _8}from"./XClose-pz5VhGt8.js";import{M as fP,a as mP,m as f9,i as pP,g as L8,b as gP,N as xP,c as bP}from"./select-model-DpTTzy_N.js";import{a as ws,b as ks,P as js,c as vP}from"./popover-wqdxNGOt.js";import{t as Fr}from"./Stars01-CIhmnYwE.js";import{b as yP,a as w8,u as i0,c as S8,d as _P}from"./use-organization-settings-BaVwqjP2.js";import{u as m9,a as LP}from"./use-ai-providers-Dviyjy6N.js";import{g as k8,c as j8,u as r0,b as xn,L as fg,P as C8,s as N8,a as wP,f as SP,d as kP}from"./project-icon-BFxISnLs.js";import{f as jP,a as CP,u as ku,b as o0,c as V8,d as NP,e as mg,g as T8,h as pg,i as VP,j as gg,k as ju,l as A8,m as TP,n as P8,o as AP}from"./folder-icon-CT3Do-ro.js";import{c as Ot,D as $t,b as Bt,a as Qe,d as _i,e as Li,f as wi,g as Xh,h as Uo,i as Dc,j as kd}from"./dropdown-menu-CYjkjxzI.js";import{i as xg}from"./Link01-BTPLMWJL.js";import{s as Qt}from"./Plus-BbNbMcZp.js";import{p as PP,q as EP}from"./question-004-sINsf4GQ.js";import{A as sn}from"./avatar-TxNHOaZo.js";import{u as bg,a as vg}from"./use-members-Dad9xTF8.js";import{i as Ns}from"./ChevronRight-YI71RlIj.js";import{u as ld}from"./use-is-desktop-app-BNujXJc_.js";import{a as Di,b as E8,u as yg,c as R8}from"./use-panel-navigate-BCgywjZr.js";import{i as xr}from"./CheckCircle-BWifOun7.js";import{i as RP}from"./XCircle-Dh1Q5jf-.js";import{I as ao}from"./integration-icon-BndzYdzO.js";import{a as p9,u as D8,b as _g,c as DP,d as MP,p as IP,e as OP,f as $P,g as Lg,h as BP,i as zP}from"./use-navigate-to-agent-Dq5Q0ICk.js";import{e as a0}from"./backoff-CrEUbyZT.js";import{u as FP}from"./use-status-sounds-Dkl514NB.js";import{E as Ti}from"./empty-state-Djp5Qrmx.js";import{b as UP,c as l0,d as M8,u as I8,r as HP}from"./thread-route-7UJtJt_K.js";import{g as aa,r as Un,h as wg,a as O8,b as $8}from"./github-repo-CTPv5ZM2.js";import{T as KP}from"./toolbar-B_18C3DR.js";import{i as Qo,a as WP}from"./Share07-CIXJRI7f.js";import{i as jn}from"./Globe01-BlolZAbP.js";import{i as B8}from"./Monitor01-BY8ASxwP.js";import{u as dr,a as Sg,b as z8}from"./use-connection-fouxnnWP.js";import{u as F8,a as U8}from"./use-mcp-tools-DtR_LDJa.js";import{g as H8}from"./types-C7H-jvYH.js";import{F as Xo}from"./file-type-icon-D1-w6wZy.js";import{e as K8,s as kg,c as qP,b as GP}from"./TrendUp01-BuuwfsCN.js";import{i as Ai}from"./ZoomOut-DVGJ65sx.js";import{i as qr}from"./GitBranch01-BRixRiL-.js";import{a as jg}from"./Package-dzgX9LxL.js";import{i as Cg,r as YP,s as W8,a as q8}from"./source-system-tabs-CnEGUb4r.js";import{n as Cu}from"./Download01-BS_WlExa.js";import{n as hn}from"./LinkExternal01-Lt28tIPJ.js";import{D as Ca}from"./use-destination-route-D6cSISdD.js";import{g as QP,s as XP,d as G8,a as JP,F as Y8,b as Q8,f as X8,S as J8,c as ZP}from"./skill-preview-Wnefbpcm.js";import{i as g9}from"./Key01-DOTGSU1P.js";import{p as Ng,b as cn,s as Wc,H as Nu,h as Vu,a as gc,c as Z8,d as e7}from"./location-oTTXFrSF.js";import{m as eE,a as tE,M as cd,b as sE,O as nE}from"./markdown-BfU9Q14B.js";import{g as iE}from"./extract-connection-data-Mn0BJca1.js";import{g as x9,n as rE,a as ix,e as oE,u as aE,f as lE}from"./use-date-fns-locale-b4nMMivC.js";import{a as cE,i as rx}from"./mcp-oauth-KMXzsvi6.js";import{A as Gr,a as Yr,b as Qr,c as Xr,d as Jr,e as Zr,f as eo,g as to}from"./alert-dialog-BZAsgwQj.js";import{T as Jo}from"./textarea-CiyC7MI9.js";import{c as t7,i as Vg,a as dE,b as uE}from"./UserSquare-DsDbJW8O.js";import{i as Oa}from"./Play-CrHqV07_.js";import{s as rn}from"./Trash01-8pnJyNzG.js";import{u as Jh}from"./use-debounced-autosave-C1YtdIK-.js";import{S as il}from"./scroll-area-DEm8VUVS.js";import{i as Tu}from"./SearchMd-Dd-_aqng.js";import{C as rl}from"./checkbox-BLlbj82t.js";import{S as b9}from"./search-input-C0ULLiZH.js";import{C as s7}from"./collection-tabs-0q04uQ8E.js";import{T as n7,u as i7}from"./use-mcp-auth-status-B54cY0IQ.js";import{g as hE}from"./connection-slug-CITJ0kGN.js";import{a as fE,i as mE}from"./Settings02-C_hf-cvI.js";import{S as lo}from"./switch-BnmWU4VE.js";import{i as c0}from"./DotsVertical-D3y9ry8A.js";import{B as Zh,a as r7,b as o7,c as a7,d as l7,e as c7}from"./breadcrumb-DZWD8NyH.js";import{s as d7}from"./slugify-CEUa2lfQ.js";import{d as dd}from"./delay-CnY5UFtP.js";import{R as d0}from"./repository-import-picker-DzCXGQBU.js";import{L as Mt}from"./label-2w5sLZrP.js";import{s as u7}from"./User01-B36CpY2j.js";import{t as v9}from"./Users01-DNjzWOys.js";import{u as h7,a as f7}from"./use-secrets-DMdcT289.js";import{G as ur}from"./github-icon-fZjpu2Cy.js";import{t as br,c as qc,m as pE,a as m7}from"./differenceInSeconds-C3x8sHUj.js";import{i as u0}from"./SearchLg-D48hKTmL.js";import{C as gE,a as xE,b as bE}from"./client-icons-CC68pbc1.js";import{g as Rn}from"./get-initials-D-f_fDFw.js";import{S as as,D as p7,C as g7,R as vE,a as yE,i as x7,n as _E,b as LE}from"./task-board-Y16rTsTT.js";import{a as ud}from"./format-time-BtXRrtv4.js";import{u as b7,d as wE,c as SE,C as Tg,a as kE}from"./connect-layout-Cj7kYzPZ.js";import{u as Ag,a as jE,b as CE}from"./use-tags-DqshTwtF.js";import{u as y1}from"./use-copy-DWPBkf_8.js";import{C as vr,a as Mi,b as Ii,c as ri,d as $s,e as fn,f as NE}from"./command-FZrYmBJm.js";import{u as VE}from"./use-org-auth-client-Deql-sZk.js";import{t as TE}from"./decopilot-sse-pool-BKKbLnQj.js";import{p as AE,r as PE,G as EE,u as RE}from"./repository-picker-BlNupbcV.js";import{l as DE}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{i as y9}from"./ChevronSelectorVertical-t-xj8puk.js";import{w as ox}from"./editor-Bvcuzd-o.js";import{T as $o,p as v7,I as y7}from"./toolbar-icon-button-kSF0Tiq-.js";import{u as qm,C as ME,b as IE,p as _7,a as OE,s as Gm,n as $E}from"./self-tool-result-CaFwP-iH.js";import{M as hd}from"./monaco-editor-COQ5T_AM.js";import{i as BE,a as _9,b as Pg}from"./Tool01-Ci448Aet.js";import{a as Ym}from"./Palette-Crv7MRNs.js";import{s as zE}from"./safe-image-url-D5z803Ot.js";import{s as h0}from"./Eye-a7O0RJR_.js";import{u as L9}from"./use-debounced-value-Bw89OGDR.js";import{u as L7,a as Eg}from"./use-file-configs-cX-RxRlm.js";import{u as w7}from"./useInfiniteQuery-C6mK09y1.js";import{i as hr}from"./Zap-7WzpzN1h.js";import{r as S7}from"./site-slug-uya6Wp4-.js";import{B as FE}from"./badge-C5ldr2h3.js";import{u as f0,a as UE,b as HE,c as KE,d as WE}from"./use-automations-sMEuHhLU.js";import{A as qE}from"./automation-list-row-DmZ6OQPy.js";import{t as GE}from"./site-error--i37Vnuw.js";import{f as YE,p as QE,g as XE,u as JE,e as ZE,a as eR,F as m0,t as k7,S as tR,B as sR,b as j7,R as nR,c as iR}from"./cards-ahWPrDYX.js";function C7(t,e){const s=Vs(e);return rR({filters:{...t,status:"pending"}},s).length}function ax(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function rR(t={},e){const s=Vs(e).getMutationCache(),n=T.useRef(t),i=T.useRef(null);return i.current===null&&(i.current=ax(s,t)),T.useEffect(()=>{n.current=t}),T.useSyncExternalStore(T.useCallback(r=>s.subscribe(()=>{const a=vN(i.current,ax(s,n.current));i.current!==a&&(i.current=a,yN.schedule(r))}),[s]),()=>i.current,()=>i.current)}const N7=Tt({connection_id:Ae().describe("Connection ID"),selected_tools:ns(Ae()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ns(Ae()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ns(Ae()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),_1=500,V7=200,Rg=200,oR=200,aR=20,lR=50,cR=100,dR=20,uR=100,hR=50,fR=100,mR=50,pR=8192,T7=N7.extend({selected_tools:ns(Ae()).max(_1).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:ns(Ae()).max(_1).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:ns(Ae()).max(_1).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),gR=Tt({connectionId:Ae(),toolName:Ae(),label:Ae(),icon:Ae().nullable().optional()}),xR=Tt({id:Ae().describe("Stable id; used as React key and ?tab= value"),title:Ae().describe("Tab label"),icon:Ae().optional().describe("Optional lucide icon name"),view:Tt({type:Kh("ext-app"),appId:Ae(),args:wu(Ae(),c6()).optional()})}),A7=oi(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations"]),bR=oi(["on","off"]),vR=new Map([["manual","on"],["auto","on"]]),yR=oi(["on","off","manual","auto"]);function _R(t){if(!t)return null;const e=vR.get(t);return e||(t==="on"||t==="off"?t:null)}const LR=Tt({defaultMainView:Tt({type:Ae(),id:Ae().optional(),toolName:Ae().optional()}).nullable().optional(),chatDefaultOpen:Hr().nullable().optional(),cmsDefaultOpen:Hr().nullable().optional(),cms:yR.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:ns(A7).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:ns(xR).max(dR).optional()});function p0(t){return _R(t?.cms)??"on"}function wR(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"site-editor"}}:{}}}const lx=Tt({tileId:Ae().optional(),connectionId:Ae().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:Ae().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Ae().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:wu(Ae(),c6()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:ji().int().positive().optional(),maxHeight:ji().int().positive().optional()}),SR=Tt({banner:Ae().nullable().optional(),bannerColor:Ae().nullable().optional(),icon:Ae().nullable().optional(),themeColor:Ae().nullable().optional(),pinnedViews:ns(gR).max(cR).nullable().optional(),layout:LR.nullable().optional(),homeTile:lx.nullable().optional(),homeTiles:ns(lx).max(aR).nullable().optional(),homePrompts:ns(Ae()).max(lR).nullable().optional()}),g0=/^[A-Za-z_][A-Za-z0-9_]*$/,cx=Ae().min(1).regex(g0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),kR=LN("kind",[Tt({key:cx,kind:Kh("literal"),value:Ae().max(pR)}),Tt({key:cx,kind:Kh("secret"),secretId:Ae().min(1)})]),Dg=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,jR=Tt({host:Ae().min(1).regex(Dg).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Ae().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),CR=Tt({selected:Ae().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Ae().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Ae().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:ns(kR).max(fR).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:ns(jR).max(mR).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),NR=Tt({url:Ae().describe("GitHub repository URL"),owner:Ae().describe("Repository owner"),name:Ae().describe("Repository name"),installationId:ji().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Ae().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:Ae().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),VR=oi(["agent-sandbox","local-api"]),TR={sandboxHandle:Ae().describe("Provider-specific handle"),previewUrl:Ae().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:Ae().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:ji().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:Tt({packageManager:Ae().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Ae().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Ae().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},P7=Tt(TR);function AR(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,s={};for(const[n,i]of Object.entries(e))if(!(!i||typeof i!="object")&&!(n!=="agent-sandbox"&&n!=="local-api"))try{s[n]=P7.parse(i)}catch{}return s}const PR=wu(Ae().describe("userId"),wu(Ae().describe("branch"),_N(VR,P7))),ER=Tt({id:Ae().describe("Stable identifier for this knowledge file"),name:Ae().describe("File name shown in the UI"),kind:oi(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Ae().describe("Org filesystem (Library) volume the file lives in"),path:Ae().describe("Path within the volume"),url:Ae().describe("Same-origin URL to read the file (display/download)"),contentType:Ae().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:ji().nullable().optional().describe("File size in bytes"),addedAt:Ae().describe("ISO timestamp when the file was attached")}),RR=ns(ER).max(uR).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),DR=oi(["smart","code-review","open"]),MR=DR.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),IR=Hr().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),OR=Hr().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),$R=Ae().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),BR=Tt({branch:Ae().describe("Git branch backing this release"),name:Ae().describe('User-facing name, e.g. "Black Friday 2026"'),color:Ae().describe("Dot color token shown in the version switcher"),createdBy:Ae().optional().describe("User ID who created the release"),createdAt:Ae().optional().describe("ISO 8601 creation timestamp")}),zR=ns(BR).max(hR).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),Mg={instructions:Ae().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:ns(Ae()).max(Rg).nullable().optional().describe("List of enabled plugin IDs"),subAgents:ns(Ae()).max(oR).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:Ae().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:SR.nullable().optional().describe("UI customization settings"),sidebarViews:ns(A7).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:Kh(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),githubRepo:NR.nullable().optional().describe("Linked GitHub repository"),runtime:CR.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:RR,siteSlug:Ae().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:MR,previewServerUrl:$R,productionUrl:Ae().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:Hr().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:IR,releases:zR,fastPreviewInPlace:OR},FR=Tt({id:Ae().describe("Unique identifier"),title:Ae().describe("Human-readable name"),description:Ae().nullable().describe("Description"),icon:Ae().nullable().describe("Icon URL"),created_at:Ae().describe("Creation timestamp"),updated_at:Ae().describe("Last update timestamp"),created_by:Ae().describe("User ID who created this item"),updated_by:Ae().optional().describe("User ID who last updated this item"),organization_id:Ae().describe("Organization ID this item belongs to"),status:oi(["active","inactive"]).describe("Current status"),pinned:Hr().describe("Whether this space is pinned to the sidebar"),metadata:Tt(Mg).extend({instructions:Ae().nullable().describe("Instructions also used as system prompt"),sandboxMap:PR.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:ns(N7).describe("Connections with their selected tools, resources, and prompts")}),E7=Tt({title:Ae().min(1).max(120).describe("Short label shown on the chip"),description:Ae().max(280).optional().describe("One-line subtitle shown under the title"),text:Ae().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});Tt({title:Ae().min(1).max(255).describe("Name for the virtual MCP"),description:Ae().max(500).nullable().optional().describe("Optional description"),icon:Ae().nullish().describe("Optional icon URL"),status:oi(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:Hr().optional().default(!1).describe("Pin to sidebar"),metadata:Tt(Mg).extend({enabled_plugins:ns(Ae()).max(Rg).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ns(T7).max(V7).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:ns(E7).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});Tt({title:Ae().min(1).max(255).optional().describe("New name"),description:Ae().max(500).nullable().optional().describe("New description (null to clear)"),icon:Ae().nullish().describe("New icon URL"),status:oi(["active","inactive"]).optional().describe("New status"),pinned:Hr().optional().describe("Pin/unpin from sidebar"),metadata:Tt(Mg).extend({enabled_plugins:ns(Ae()).max(Rg).nullable().optional().describe("List of enabled plugin IDs")}).loose().superRefine((t,e)=>{"sandboxMap"in t&&e.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:ns(T7).max(V7).optional().describe("New connections (replaces existing)"),prompts:ns(E7).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});function Au(t,e){const s=x9(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,i=br(t,e?.in),r=i.getDay(),a=(r<n?7:0)+r-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function ef(t,e){return Au(t,{...e,weekStartsOn:1})}function R7(t,e){const s=br(t,e?.in),n=s.getFullYear(),i=qc(s,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=ef(i),a=qc(s,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=ef(a);return s.getTime()>=r.getTime()?n+1:s.getTime()>=l.getTime()?n:n-1}function dx(t,e){const s=br(t,e?.in);return s.setHours(0,0,0,0),s}function UR(t,e,s){const[n,i]=rE(s?.in,t,e),r=dx(n),a=dx(i),l=+r-ix(r),c=+a-ix(a);return Math.round((l-c)/pE)}function HR(t,e){const s=R7(t,e),n=qc(t,0);return n.setFullYear(s,0,4),n.setHours(0,0,0,0),ef(n)}function KR(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function WR(t){return!(!KR(t)&&typeof t!="number"||isNaN(+br(t)))}function qR(t,e){const s=br(t,e?.in);return s.setFullYear(s.getFullYear(),0,1),s.setHours(0,0,0,0),s}function GR(t,e){const s=br(t,e?.in);return UR(s,qR(s))+1}function YR(t,e){const s=br(t,e?.in),n=+ef(s)-+HR(s);return Math.round(n/m7)+1}function D7(t,e){const s=br(t,e?.in),n=s.getFullYear(),i=x9(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=qc(e?.in||t,0);a.setFullYear(n+1,0,r),a.setHours(0,0,0,0);const l=Au(a,e),c=qc(e?.in||t,0);c.setFullYear(n,0,r),c.setHours(0,0,0,0);const d=Au(c,e);return+s>=+l?n+1:+s>=+d?n:n-1}function QR(t,e){const s=x9(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=D7(t,e),r=qc(e?.in||t,0);return r.setFullYear(i,0,n),r.setHours(0,0,0,0),Au(r,e)}function XR(t,e){const s=br(t,e?.in),n=+Au(s,e)-+QR(s,e);return Math.round(n/m7)+1}function Ut(t,e){const s=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return s+n}const No={y(t,e){const s=t.getFullYear(),n=s>0?s:1-s;return Ut(e==="yy"?n%100:n,e.length)},M(t,e){const s=t.getMonth();return e==="M"?String(s+1):Ut(s+1,2)},d(t,e){return Ut(t.getDate(),e.length)},a(t,e){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];default:return s==="am"?"a.m.":"p.m."}},h(t,e){return Ut(t.getHours()%12||12,e.length)},H(t,e){return Ut(t.getHours(),e.length)},m(t,e){return Ut(t.getMinutes(),e.length)},s(t,e){return Ut(t.getSeconds(),e.length)},S(t,e){const s=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,s-3));return Ut(i,e.length)}},xc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ux={G:function(t,e,s){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return s.era(n,{width:"abbreviated"});case"GGGGG":return s.era(n,{width:"narrow"});default:return s.era(n,{width:"wide"})}},y:function(t,e,s){if(e==="yo"){const n=t.getFullYear(),i=n>0?n:1-n;return s.ordinalNumber(i,{unit:"year"})}return No.y(t,e)},Y:function(t,e,s,n){const i=D7(t,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return Ut(a,2)}return e==="Yo"?s.ordinalNumber(r,{unit:"year"}):Ut(r,e.length)},R:function(t,e){const s=R7(t);return Ut(s,e.length)},u:function(t,e){const s=t.getFullYear();return Ut(s,e.length)},Q:function(t,e,s){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Ut(n,2);case"Qo":return s.ordinalNumber(n,{unit:"quarter"});case"QQQ":return s.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(n,{width:"narrow",context:"formatting"});default:return s.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,s){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Ut(n,2);case"qo":return s.ordinalNumber(n,{unit:"quarter"});case"qqq":return s.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(n,{width:"narrow",context:"standalone"});default:return s.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,s){const n=t.getMonth();switch(e){case"M":case"MM":return No.M(t,e);case"Mo":return s.ordinalNumber(n+1,{unit:"month"});case"MMM":return s.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(n,{width:"narrow",context:"formatting"});default:return s.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,s){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return Ut(n+1,2);case"Lo":return s.ordinalNumber(n+1,{unit:"month"});case"LLL":return s.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(n,{width:"narrow",context:"standalone"});default:return s.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,s,n){const i=XR(t,n);return e==="wo"?s.ordinalNumber(i,{unit:"week"}):Ut(i,e.length)},I:function(t,e,s){const n=YR(t);return e==="Io"?s.ordinalNumber(n,{unit:"week"}):Ut(n,e.length)},d:function(t,e,s){return e==="do"?s.ordinalNumber(t.getDate(),{unit:"date"}):No.d(t,e)},D:function(t,e,s){const n=GR(t);return e==="Do"?s.ordinalNumber(n,{unit:"dayOfYear"}):Ut(n,e.length)},E:function(t,e,s){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return s.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,s,n){const i=t.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Ut(r,2);case"eo":return s.ordinalNumber(r,{unit:"day"});case"eee":return s.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(i,{width:"short",context:"formatting"});default:return s.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,s,n){const i=t.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Ut(r,e.length);case"co":return s.ordinalNumber(r,{unit:"day"});case"ccc":return s.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(i,{width:"narrow",context:"standalone"});case"cccccc":return s.day(i,{width:"short",context:"standalone"});default:return s.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,s){const n=t.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Ut(i,e.length);case"io":return s.ordinalNumber(i,{unit:"day"});case"iii":return s.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(n,{width:"short",context:"formatting"});default:return s.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,s){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,s){const n=t.getHours();let i;switch(n===12?i=xc.noon:n===0?i=xc.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,s){const n=t.getHours();let i;switch(n>=17?i=xc.evening:n>=12?i=xc.afternoon:n>=4?i=xc.morning:i=xc.night,e){case"B":case"BB":case"BBB":return s.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(i,{width:"narrow",context:"formatting"});default:return s.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,s){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),s.ordinalNumber(n,{unit:"hour"})}return No.h(t,e)},H:function(t,e,s){return e==="Ho"?s.ordinalNumber(t.getHours(),{unit:"hour"}):No.H(t,e)},K:function(t,e,s){const n=t.getHours()%12;return e==="Ko"?s.ordinalNumber(n,{unit:"hour"}):Ut(n,e.length)},k:function(t,e,s){let n=t.getHours();return n===0&&(n=24),e==="ko"?s.ordinalNumber(n,{unit:"hour"}):Ut(n,e.length)},m:function(t,e,s){return e==="mo"?s.ordinalNumber(t.getMinutes(),{unit:"minute"}):No.m(t,e)},s:function(t,e,s){return e==="so"?s.ordinalNumber(t.getSeconds(),{unit:"second"}):No.s(t,e)},S:function(t,e){return No.S(t,e)},X:function(t,e,s){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return fx(n);case"XXXX":case"XX":return _a(n);default:return _a(n,":")}},x:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"x":return fx(n);case"xxxx":case"xx":return _a(n);default:return _a(n,":")}},O:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+hx(n,":");default:return"GMT"+_a(n,":")}},z:function(t,e,s){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+hx(n,":");default:return"GMT"+_a(n,":")}},t:function(t,e,s){const n=Math.trunc(+t/1e3);return Ut(n,e.length)},T:function(t,e,s){return Ut(+t,e.length)}};function hx(t,e=""){const s=t>0?"-":"+",n=Math.abs(t),i=Math.trunc(n/60),r=n%60;return r===0?s+String(i):s+String(i)+e+Ut(r,2)}function fx(t,e){return t%60===0?(t>0?"-":"+")+Ut(Math.abs(t)/60,2):_a(t,e)}function _a(t,e=""){const s=t>0?"-":"+",n=Math.abs(t),i=Ut(Math.trunc(n/60),2),r=Ut(n%60,2);return s+i+e+r}const mx=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},M7=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},JR=(t,e)=>{const s=t.match(/(P+)(p+)?/)||[],n=s[1],i=s[2];if(!i)return mx(t,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",mx(n,e)).replace("{{time}}",M7(i,e))},ZR={p:M7,P:JR},eD=/^D+$/,tD=/^Y+$/,sD=["D","DD","YY","YYYY"];function nD(t){return eD.test(t)}function iD(t){return tD.test(t)}function rD(t,e,s){const n=oD(t,e,s);if(console.warn(n),sD.includes(t))throw new RangeError(n)}function oD(t,e,s){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const aD=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,lD=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,cD=/^'([^]*?)'?$/,dD=/''/g,uD=/[a-zA-Z]/;function hD(t,e,s){const n=x9(),i=s?.locale??n.locale??oE,r=s?.firstWeekContainsDate??s?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=s?.weekStartsOn??s?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,l=br(t,s?.in);if(!WR(l))throw new RangeError("Invalid time value");let c=e.match(lD).map(h=>{const u=h[0];if(u==="p"||u==="P"){const f=ZR[u];return f(h,i.formatLong)}return h}).join("").match(aD).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const u=h[0];if(u==="'")return{isToken:!1,value:fD(h)};if(ux[u])return{isToken:!0,value:h};if(u.match(uD))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:h}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const d={firstWeekContainsDate:r,weekStartsOn:a,locale:i};return c.map(h=>{if(!h.isToken)return h.value;const u=h.value;(!s?.useAdditionalWeekYearTokens&&iD(u)||!s?.useAdditionalDayOfYearTokens&&nD(u))&&rD(u,e,String(t));const f=ux[u[0]];return f(l,u,i.localize,d)}).join("")}function fD(t){const e=t.match(cD);return e?e[1].replace(dD,"'"):t}const px=3,I7="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",mD="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function O7(t){const e=F.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:r,variant:a}=t,l=a===void 0?"pill":a,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=Br(c._meta);d=c.title??M2(c.name,S),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const h=d,u=c.description||null;if(l==="card"){let S;e[4]!==n||e[5]!==c?(S=()=>n(c),e[4]=n,e[5]=c,e[6]=S):S=e[6];const k=r||i,j=i&&"bg-accent/40",C=(r||i)&&"cursor-not-allowed opacity-50";let V;e[7]!==j||e[8]!==C?(V=re(mD,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=V):V=e[9];let N;e[10]!==h?(N=o.jsx("span",{className:"font-medium truncate capitalize",children:h}),e[10]=h,e[11]=N):N=e[11];let A;e[12]!==i?(A=i&&o.jsx(et,{size:"xs"}),e[12]=i,e[13]=A):A=e[13];let P;e[14]!==N||e[15]!==A?(P=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,A]}),e[14]=N,e[15]=A,e[16]=P):P=e[16];let R;e[17]!==u?(R=u&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=R):R=e[18];let E;return e[19]!==P||e[20]!==R||e[21]!==S||e[22]!==k||e[23]!==V?(E=o.jsxs("button",{type:"button",onClick:S,disabled:k,className:V,children:[P,R]}),e[19]=P,e[20]=R,e[21]=S,e[22]=k,e[23]=V,e[24]=E):E=e[24],E}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const p=r||i,m=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==m||e[29]!==g?(x=re(I7,"hover:bg-muted/70 hover:text-foreground",m,g),e[28]=m,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==h?(b=o.jsx("span",{className:"capitalize",children:h}),e[31]=h,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&o.jsx(et,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let L;e[35]!==f||e[36]!==p||e[37]!==x||e[38]!==b||e[39]!==v?(L=o.jsx(He,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:p,className:x,children:[b,v]})}),e[35]=f,e[36]=p,e[37]=x,e[38]=b,e[39]=v,e[40]=L):L=e[40];const _=u??h;let y;e[41]!==_?(y=o.jsx(Ke,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:_})}),e[41]=_,e[42]=y):y=e[42];let w;return e[43]!==L||e[44]!==y?(w=o.jsxs(We,{delayDuration:400,children:[L,y]}),e[43]=L,e[44]=y,e[45]=w):w=e[45],w}function pD(t){const e=F.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:a}=t,l=ae(),[c,d]=T.useState(""),h=!!a;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(N=>{const A=c.toLowerCase();return N.prompt.name.toLowerCase().includes(A)||(N.prompt.title??"").toLowerCase().includes(A)||(N.prompt.description??"").toLowerCase().includes(A)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const f=u,p=Za();let m;e[3]!==f.length||e[4]!==c||e[5]!==l?(m=f.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:l("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=l,e[6]=m):m=e[6];let g;if(e[7]!==f||e[8]!==h||e[9]!==a?.name||e[10]!==i||e[11]!==r){let N;e[13]!==h||e[14]!==a?.name||e[15]!==i||e[16]!==r?(N=A=>o.jsx(O7,{item:A,variant:"card",onSelect:P=>{i(!1),r(P)},isLoading:a?.name===A.prompt.name,isDisabled:h&&a?.name!==A.prompt.name},A.prompt.name),e[13]=h,e[14]=a?.name,e[15]=i,e[16]=r,e[17]=N):N=e[17],g=f.map(N),e[7]=f,e[8]=h,e[9]=a?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==m||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[m,g]})}),e[18]=m,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==l?(v=l("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=l,e[22]=v):v=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=N=>{N.key==="Escape"&&d("")},e[23]=L):L=e[23];let _;e[24]!==c||e[25]!==v?(_=o.jsx(_T,{value:c,onChange:d,placeholder:v,onKeyDown:L}),e[24]=c,e[25]=v,e[26]=_):_=e[26];const y=_;if(p){let N;e[27]!==l?(N=l("chat.iceBreakers.allPromptsTitle"),e[27]=l,e[28]=N):N=e[28];let A;e[29]!==N?(A=o.jsx(vT,{className:"sr-only",children:o.jsx(F2,{children:N})}),e[29]=N,e[30]=A):A=e[30];let P;e[31]!==l?(P=l("chat.iceBreakers.promptsLabel"),e[31]=l,e[32]=P):P=e[32];let R;e[33]!==P?(R=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:P})}),e[33]=P,e[34]=R):R=e[34];let E;e[35]!==b||e[36]!==y||e[37]!==R||e[38]!==A?(E=o.jsxs(U2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[A,R,y,b]}),e[35]=b,e[36]=y,e[37]=R,e[38]=A,e[39]=E):E=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==E?(I=o.jsx(Go,{delayDuration:400,children:o.jsx(H2,{open:n,onOpenChange:i,children:E})}),e[40]=i,e[41]=n,e[42]=E,e[43]=I):I=e[43],I}let w;e[44]!==l?(w=l("chat.iceBreakers.allPromptsTitle"),e[44]=l,e[45]=w):w=e[45];let S;e[46]!==w?(S=o.jsx(cs,{className:"sr-only",children:o.jsx(Kt,{children:w})}),e[46]=w,e[47]=S):S=e[47];let k;e[48]!==l?(k=l("chat.iceBreakers.promptsLabel"),e[48]=l,e[49]=k):k=e[49];let j;e[50]!==k?(j=o.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:o.jsx("span",{className:"text-sm font-medium text-foreground",children:k})}),e[50]=k,e[51]=j):j=e[51];let C;e[52]!==b||e[53]!==y||e[54]!==j||e[55]!==S?(C=o.jsxs(zt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,y,b]}),e[52]=b,e[53]=y,e[54]=j,e[55]=S,e[56]=C):C=e[56];let V;return e[57]!==i||e[58]!==n||e[59]!==C?(V=o.jsx(Go,{delayDuration:400,children:o.jsx(Ft,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=V):V=e[60],V}function gD(t){const e=F.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,a=ae(),[l,c]=T.useState(!1);if(s.length===0)return null;let d,h,u,f,p;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==a){const b=s.slice(0,px),v=s.slice(px),L=!!i;let _;e[10]!==L||e[11]!==i?.name||e[12]!==n?(_=w=>o.jsx(O7,{item:w,onSelect:n,isLoading:i?.name===w.prompt.name,isDisabled:L&&i?.name!==w.prompt.name},w.prompt.name),e[10]=L,e[11]=i?.name,e[12]=n,e[13]=_):_=e[13];const y=b.map(_);d=Go,p=400,e[14]!==r?(h=re("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=h):h=e[15],u=y,f=v.length>0&&o.jsx("button",{type:"button",disabled:L,onClick:()=>c(!0),className:re(I7,"hover:bg-muted/70 hover:text-foreground",L&&"opacity-50 cursor-not-allowed"),children:a("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=a,e[5]=d,e[6]=h,e[7]=u,e[8]=f,e[9]=p}else d=e[5],h=e[6],u=e[7],f=e[8],p=e[9];let m;e[16]!==h||e[17]!==u||e[18]!==f?(m=o.jsxs("div",{className:h,children:[u,f]}),e[16]=h,e[17]=u,e[18]=f,e[19]=m):m=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==l||e[23]!==n?(g=o.jsx(pD,{items:s,open:l,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=l,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==p||e[27]!==m||e[28]!==g?(x=o.jsxs(d,{delayDuration:p,children:[m,g]}),e[25]=d,e[26]=p,e[27]=m,e[28]=g,e[29]=x):x=e[29],x}function xD(){return null}function bD(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function vD(t){const e=F.c(31),{connectionId:s}=t,n=ae(),{sendMessage:i}=ai(),{org:r}=Ue();let a;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const l=Cn(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:d}=z6(c);let h;e[6]!==d?.prompts?(h=d?.prompts??[],e[6]=d?.prompts,e[7]=h):h=e[7];const u=h;let f;e[8]!==u?(f=u.map(yD),e[8]=u,e[9]=f):f=e[9];const p=f;let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m={stage:"idle"},e[10]=m):m=e[10];const[g,x]=T.useReducer(bD,m),[b,v]=T.useState(null);let L;e[11]!==l||e[12]!==i||e[13]!==n?(L=async(P,R)=>{if(!l){ye.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const E=await t9(l,P.name,R);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[Yf({id:P.name,name:Gu(P.name,Br(P._meta)),metadata:E.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]};await i(I)}catch(E){console.error("[ice-breakers] Failed to fetch prompt:",E),ye.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=l,e[12]=i,e[13]=n,e[14]=L):L=e[14];const _=L;let y;e[15]!==_?(y=async P=>{if(P.arguments&&P.arguments.length>0){x({type:"SELECT_PROMPT",prompt:P}),v(P);return}x({type:"START_LOADING",prompt:P}),await _(P)},e[15]=_,e[16]=y):y=e[16];const w=y;let S;e[17]!==b||e[18]!==_?(S=async P=>{b&&(x({type:"START_LOADING",prompt:b,arguments:P}),v(null),await _(b,P))},e[17]=b,e[18]=_,e[19]=S):S=e[19];const k=S;if(p.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==w||e[21]!==p||e[22]!==j?(C=o.jsx(gD,{items:p,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=p,e[22]=j,e[23]=C):C=e[23];let V;e[24]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{v(null),x({type:"RESET"})},e[24]=V):V=e[24];let N;e[25]!==b||e[26]!==k?(N=o.jsx(qh,{prompt:b,setPrompt:V,onSubmit:k}),e[25]=b,e[26]=k,e[27]=N):N=e[27];let A;return e[28]!==C||e[29]!==N?(A=o.jsxs(o.Fragment,{children:[C,N]}),e[28]=C,e[29]=N,e[30]=A):A=e[30],A}function yD(t){return{prompt:t}}function _D(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:n}=el(),{org:i}=Ue();let r;e[0]!==i.id?(r=ra(i.id),e[0]=i.id,e[1]=r):r=e[1];const a=r.id,l=n?.id??a;let c;e[2]!==s?(c=re("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=l??"default";let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(xD,{}),e[4]=h):h=e[4];let u;e[5]!==l?(u=o.jsx(vD,{connectionId:l}),e[5]=l,e[6]=u):u=e[6];let f;e[7]!==d||e[8]!==u?(f=o.jsx(tn,{fallback:null,children:o.jsx(T.Suspense,{fallback:h,children:u},d)}),e[7]=d,e[8]=u,e[9]=f):f=e[9];let p;return e[10]!==c||e[11]!==f?(p=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=p):p=e[12],p}const L1="cubic-bezier(0.645, 0.045, 0.355, 1)",LD=44,wD={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-warning/5 after:pointer-events-none after:-z-10"},SD={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},kD={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Zo(t){const e=F.c(69),{icon:s,label:n,count:i,title:r,footerLeft:a,footerRight:l,children:c,defaultExpanded:d,variant:h,onClose:u}=t,f=h===void 0?"default":h,p=ae(),[m,g]=T.useState(d),[x,b]=T.useState(!1);let v;e[0]!==u?(v=()=>{b(!0),u?.()},e[0]=u,e[1]=v):v=e[1];const L=v;if(x)return null;const _=SD[f],y=wD[f];let w;e[2]!==_||e[3]!==y?(w=re("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",_,y),e[2]=_,e[3]=y,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(jD),e[5]=S):S=e[5];const k=m&&"rounded-b-none",j=!m&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=re("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=C):C=e[8];const V=kD[f];let N;e[9]!==V?(N=re("shrink-0",V),e[9]=V,e[10]=N):N=e[10];let A;e[11]!==s||e[12]!==N?(A=o.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=A):A=e[13];let P;e[14]!==n?(P=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=P):P=e[15];let R;e[16]!==i?(R=i?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=R):R=e[17];const E=m?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==E?(I=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(hs,{size:16,style:{transform:E,transition:`transform 180ms ${L1}`}})}),e[18]=E,e[19]=I):I=e[19];let D;e[20]!==p?(D=p("chat.collapsibleHighlight.closeLabel"),e[20]=p,e[21]=D):D=e[21];let O;e[22]!==p?(O=p("chat.collapsibleHighlight.closeTitle"),e[22]=p,e[23]=O):O=e[23];let B,M;e[24]!==L?(B=le=>{le.stopPropagation(),L()},M=le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),L())},e[24]=L,e[25]=B,e[26]=M):(B=e[25],M=e[26]);let z;e[27]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(nn,{size:16}),e[27]=z):z=e[27];let $;e[28]!==D||e[29]!==O||e[30]!==B||e[31]!==M?($=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:O,onClick:B,onKeyDown:M,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:z}),e[28]=D,e[29]=O,e[30]=B,e[31]=M,e[32]=$):$=e[32];let U;e[33]!==m||e[34]!==A||e[35]!==P||e[36]!==R||e[37]!==I||e[38]!==$||e[39]!==C?(U=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":m,onClick:S,className:C,children:[A,P,R,I,$]}),e[33]=m,e[34]=A,e[35]=P,e[36]=R,e[37]=I,e[38]=$,e[39]=C,e[40]=U):U=e[40];const H=m?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${L1}`},e[41]=H,e[42]=W):W=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K={overflow:"hidden",minHeight:0},e[43]=K):K=e[43];const G=m?1:0;let Y;e[44]!==G?(Y={opacity:G,transition:`opacity 120ms ${L1}`,maxHeight:"60vh"},e[44]=G,e[45]=Y):Y=e[45];let Z;e[46]!==r?(Z=r?o.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:o.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:r})}):o.jsx("div",{className:"border-t border-dashed border-border/60"}),e[46]=r,e[47]=Z):Z=e[47];let te;e[48]!==c||e[49]!==r?(te=c?o.jsx("div",{className:re("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=te):te=e[50];let X;e[51]!==Z||e[52]!==te?(X=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[Z,te]}),e[51]=Z,e[52]=te,e[53]=X):X=e[53];let ee;e[54]!==a||e[55]!==l?(ee=a||l?o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-3 pb-6",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{children:a}),o.jsx("div",{className:"flex items-center gap-2",children:l})]})}):null,e[54]=a,e[55]=l,e[56]=ee):ee=e[56];let J;e[57]!==Y||e[58]!==X||e[59]!==ee?(J=o.jsx("div",{style:K,children:o.jsxs("div",{className:"flex flex-col",style:Y,children:[X,ee]})}),e[57]=Y,e[58]=X,e[59]=ee,e[60]=J):J=e[60];let Q;e[61]!==W||e[62]!==J?(Q=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:J}),e[61]=W,e[62]=J,e[63]=Q):Q=e[63];let oe;return e[64]!==U||e[65]!==Q||e[66]!==w||e[67]!==f?(oe=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:w,children:[U,Q]}),e[64]=U,e[65]=Q,e[66]=w,e[67]=f,e[68]=oe):oe=e[68],oe}function jD(t){return!t}const CD=Tt({content:Ae().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:oi(["pending","in_progress","completed"]),activeForm:Ae().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),$7=Tt({todos:ns(CD)}),ND="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";NT({description:ND,inputSchema:VT($7),execute:async({todos:t})=>({ok:!0,count:t.length})});const VD="tool-todo_write",TD=new Set(["input-available","output-available"]);function AD(t){for(let e=t.length-1;e>=0;e--){const s=t[e];if(s.role!=="assistant")continue;const n=s.parts;if(Array.isArray(n))for(let i=n.length-1;i>=0;i--){const r=n[i];if(r.type!==VD||typeof r.state!="string"||!TD.has(r.state))continue;const a=$7.safeParse(r.input);if(a.success)return a.data.todos}}return[]}function B7(t){const e=[];for(const s of t)if("state"in s&&s.state==="approval-requested"&&"approval"in s&&s.approval?.id&&"toolCallId"in s&&s.toolCallId){const n="toolName"in s&&typeof s.toolName=="string"?s.toolName:s.type.startsWith("tool-")?s.type.replace("tool-",""):"Tool";e.push({approvalId:s.approval.id,toolCallId:s.toolCallId,toolName:n,friendlyName:Qf(CV(n)),input:s.input})}return e}function z7(t){return t.at(-1)}function F7(t){const e=[];for(const s of t)s.type==="tool-propose_plan"&&s.state==="input-available"&&e.push({toolCallId:s.toolCallId,plan:s.input.plan,state:s.state});return e}function PD(t){return t?t.message.startsWith("[CREDITS]"):!1}const ED="[SUBSCRIPTION_REQUIRED]";function U7(t){return t?.message.startsWith(ED)?t.message.includes("used its free task executions")?"trial_exhausted":t.message.includes("used its monthly task executions")?"monthly_exhausted":t.message.includes("reached its execution limit")?"runs_exhausted":null:null}const RD={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function DD(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&PD(s))return{...RD,isCreditExhausted:!0};const a=e.at(-1),l=a?.role==="assistant"?a.parts:[],c=l,h=!!c.filter(_=>_.type==="tool-user_ask").filter(_=>_.state!=="output-available").length,u=F7(l),f=B7(c),p=AD(e),m=i?null:U7(s),g=!i&&!!s&&!m,x=f.length>0||i&&r,b=u.length>0,L=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(h||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:m,hasTodos:p.length>0,showError:g,showWarning:L,hasApprovals:x,hasPlans:b,isWaitingForUserInput:h,todos:p}}function H7(){const t=F.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=ai(),a=s??null,l=n??null;let c;return t[0]!==i||t[1]!==r||t[2]!==e||t[3]!==a||t[4]!==l?(c=DD({messages:e,error:a,finishReason:l,isStreaming:i,isWaitingForApprovals:r}),t[0]=i,t[1]=r,t[2]=e,t[3]=a,t[4]=l,t[5]=c):c=t[5],c}function MD(){const t=H7();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}const gx="start-task",ID=`Turn the report below into a running task. The user pressed "Start task", which authorizes delegation.
3
3
 
4
4
  1. Read the report and any attached screenshots. Carry the reporter's own words into the task description, plus the URL of any attachment.
5
5
  2. Call TASK_BOARD_ITEM_LIST. Its \`repos\` are this organization's repositories — the only valid values for a task's repo, so pick the one the report is about and never invent a name. Its \`items\` tell you whether an open task already covers this report: if one does, link it and stop.
@@ -628,10 +628,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
628
628
  22% { opacity: 0; }
629
629
  }
630
630
  `}),e[27]=y):y=e[27];let w;return e[28]!==_||e[29]!==u?(w=o.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[u,_,y]}),e[28]=_,e[29]=u,e[30]=w):w=e[30],w}function ch(t){const e=F.c(10),{phase:s,current:n,children:i}=t,r=s-n,a=r<0,l=r===0,c=a?90:r*-22,d=a?.94:1-Math.max(r,0)*.04,h=a?0:l?1:r===1?.8:.55,u=a?10:30-r,f=!l;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=re("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=p):p=e[0];const m=`translateY(${c}px) scale(${d})`,g=l?"auto":"none";let x;e[1]!==h||e[2]!==m||e[3]!==g||e[4]!==u?(x={transform:m,opacity:h,zIndex:u,transitionDuration:"1000ms",pointerEvents:g},e[1]=h,e[2]=m,e[3]=g,e[4]=u,e[5]=x):x=e[5];let b;return e[6]!==i||e[7]!==f||e[8]!==x?(b=o.jsx("div",{"aria-hidden":f,className:p,style:x,children:i}),e[6]=i,e[7]=f,e[8]=x,e[9]=b):b=e[9],b}function W9(t){const e=F.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let i,r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:re("size-2.5 rounded-full",Jn)}),r=o.jsx("div",{className:re("size-2.5 rounded-full",Jn)}),a=o.jsx("div",{className:re("size-2.5 rounded-full",Jn)}),e[0]=i,e[1]=r,e[2]=a):(i=e[0],r=e[1],a=e[2]);let l;e[3]!==n?(l=n&&o.jsx("div",{className:re("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",tr)}),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==l?(c=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[i,r,a,l]}),e[5]=l,e[6]=c):c=e[6],c}function kte(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(W9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsx("div",{className:"flex flex-1 px-8 py-5",children:o.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:vte.map(jte)})})]}),t[1]=s):s=t[1],s}function jte(t,e){if(e===nk)return o.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return o.jsx("div",{className:re("relative rounded-md",Jn),children:o.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${ik}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function Cte(){const t=F.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(W9,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:re("w-[18%] rounded-md",tr),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=n):n=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=i):i=t[3];let r;return t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[n,o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[i,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[o.jsx("div",{className:re("rounded-md",tr),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),o.jsx("div",{className:re("rounded-md",tr),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=r):r=t[4],r}function Nte(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(W9,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:o.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:Lte.map(Vte)})})]}),t[1]=s):s=t[1],s}function Vte(t,e){return o.jsx("div",{className:re("aspect-square rounded-md",wte[e]?"bg-chart-2/70":Jn),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function Tte(){const t=F.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(W9,{showUrl:!0}),t[0]=e):e=t[0];let s,n,i,r,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),n=o.jsx("div",{className:re("h-1.5 w-[70%] rounded-sm",Jn)}),i=o.jsx("div",{className:re("h-1.5 w-[55%] rounded-sm",Jn)}),r=o.jsx("div",{className:re("h-1.5 w-[80%] rounded-sm",Jn)}),a=o.jsx("div",{className:re("h-1.5 w-[50%] rounded-sm",Jn)}),t[1]=s,t[2]=n,t[3]=i,t[4]=r,t[5]=a):(s=t[1],n=t[2],i=t[3],r=t[4],a=t[5]);let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,n,i,r,a,o.jsx("div",{className:"mt-auto",children:o.jsx("div",{className:re("h-4 rounded-md",Jn)})})]}),t[6]=l):l=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:o.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[o.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),o.jsx("div",{className:re("h-1.5 w-[55%] rounded-sm",tr)})]})}),t[7]=c):c=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[o.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),o.jsx("div",{className:re("h-4 w-10 rounded-full",tr)}),o.jsx("div",{className:re("h-4 w-14 rounded-full",tr)})]}),t[8]=d):d=t[8];let h;t[9]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs("div",{className:re("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",tr),children:[o.jsx("div",{className:re("h-1.5 w-[50%] rounded-sm",Jn)}),o.jsx("div",{className:re("h-1 w-[75%] rounded-sm",Jn)})]}),t[9]=h):h=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1",children:[l,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[c,o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[d,o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[h,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[o.jsx("div",{className:re("rounded-md",tr)}),o.jsx("div",{className:re("rounded-md",tr)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function zc(t){const e=F.c(52),s=ae();if(t.kind==="starting"){let p;return e[0]!==t.claimPhase||e[1]!==t.progress?(p=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsx(Ste,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=p):p=e[2],p}if(t.kind==="errored"){const p=t.error.code===rp.githubNotAuthenticated,m=t.error.code===rp.githubConnectionMissing;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(na,{className:"size-12 text-destructive"}),e[3]=g):g=e[3];let x;e[4]!==s?(x=s("sandbox.stateCard.erroredHeadline"),e[4]=s,e[5]=x):x=e[5];let b;e[6]!==x?(b=o.jsx("h3",{className:"text-lg font-medium",children:x}),e[6]=x,e[7]=b):b=e[7];let v;e[8]!==m||e[9]!==p||e[10]!==t.error.message||e[11]!==s?(v=m?s("sandbox.stateCard.githubConnectionMissingMessage"):p?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[8]=m,e[9]=p,e[10]=t.error.message,e[11]=s,e[12]=v):v=e[12];let L;e[13]!==v?(L=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:v}),e[13]=v,e[14]=L):L=e[14];let _;e[15]!==m||e[16]!==p||e[17]!==t.connectionsHref||e[18]!==s?(_=(p||m)&&t.connectionsHref&&o.jsx(me,{asChild:!0,children:o.jsx("a",{href:t.connectionsHref,children:s(m?"sandbox.stateCard.linkRepoAgain":"sandbox.stateCard.reconnectGithub")})}),e[15]=m,e[16]=p,e[17]=t.connectionsHref,e[18]=s,e[19]=_):_=e[19];const y=t.onRetry;let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Dn,{className:"size-4"}),e[20]=w):w=e[20];let S;e[21]!==s?(S=s("sandbox.stateCard.retry"),e[21]=s,e[22]=S):S=e[22];let k;e[23]!==t.onRetry||e[24]!==S?(k=o.jsxs(me,{variant:"outline",onClick:y,children:[w," ",S]}),e[23]=t.onRetry,e[24]=S,e[25]=k):k=e[25];let j;e[26]!==_||e[27]!==k?(j=o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[_,k]}),e[26]=_,e[27]=k,e[28]=j):j=e[28];let C;return e[29]!==j||e[30]!==b||e[31]!==L?(C=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[g,b,L,j]})}),e[29]=j,e[30]=b,e[31]=L,e[32]=C):C=e[32],C}let n;e[33]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(iA,{className:"size-12 text-blue-500"}),e[33]=n):n=e[33];let i;e[34]!==s?(i=s("sandbox.stateCard.suspendedHeadline"),e[34]=s,e[35]=i):i=e[35];let r;e[36]!==i?(r=o.jsx("h3",{className:"text-lg font-medium",children:i}),e[36]=i,e[37]=r):r=e[37];let a;e[38]!==s?(a=s("sandbox.stateCard.resumeToContinue"),e[38]=s,e[39]=a):a=e[39];let l;e[40]!==a?(l=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:a}),e[40]=a,e[41]=l):l=e[41];const c=t.onResume;let d;e[42]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-4"}),e[42]=d):d=e[42];let h;e[43]!==s?(h=s("sandbox.stateCard.resume"),e[43]=s,e[44]=h):h=e[44];let u;e[45]!==t.onResume||e[46]!==h?(u=o.jsxs(me,{onClick:c,className:"mt-2",children:[d," ",h]}),e[45]=t.onResume,e[46]=h,e[47]=u):u=e[47];let f;return e[48]!==r||e[49]!==l||e[50]!==u?(f=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,r,l,u]})}),e[48]=r,e[49]=l,e[50]=u,e[51]=f):f=e[51],f}function Z3(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function Ate(t){if(!t)return null;try{const e=JSON.parse(t);if(!e||typeof e!="object"||Array.isArray(e)||typeof e.path!="string"||!e.path.startsWith("/"))return null;const s=typeof e.pageKey=="string"?e.pageKey:null,n={};if(e.params&&typeof e.params=="object")for(const[i,r]of Object.entries(e.params))typeof r=="string"&&(n[i]=r);return{path:e.path,pageKey:s,params:n}}catch{return null}}function e4(t){try{return Ate(localStorage.getItem(t))}catch{return null}}function Pte(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function rk(t){switch(t.lifecycle.phase){case"cloning":case"checking-out":return{step:"cloning",status:"doing"};case"clone-failed":return{step:"cloning",status:"failed"};case"installing":return{step:"install",status:"doing"};case"install-failed":return{step:"install",status:"failed"};case"starting":return{step:"dev",status:"doing"};case"running":return{step:"dev",status:"done"};case"start-failed":return{step:"dev",status:"failed"};case"crashed":return{step:"dev",status:"failed"};case"idle":return t.claimPhase&&t.claimPhase.kind!=="ready"&&t.claimPhase.kind!=="failed"?{step:"provision",status:"doing"}:{step:"cloning",status:"doing"}}}const Bb="site-links",Ete=/details?page|\bpdp\b/i,Rte=/listingpage|\bplp\b/i;function Dte(t,e,s){const n=new Set;for(const l of s)Ete.test(l)&&n.add("product"),Rte.test(l)&&n.add("category");const i=vf(Ko(t)),r=i[i.length-1],a=i[i.length-2];return r?.type==="text"&&r.text==="/p"&&a?.type==="param"&&a.name===e&&n.add("product"),e==="*"&&i.some(l=>l.type==="param"&&l.name==="*")&&n.add("category"),n}const Mte=["rosa","preto","pink","black"];function dh(t,e){const s=e.trim();return s?t(s):Mte.flatMap(n=>t(n))}function Ite(t,e){const s=e.trim(),n=[];/^\d+$/.test(s)&&n.push({resolveType:t,props:{ids:[s]}});const r=s.includes("-")&&!/\s/.test(s)?s.replace(/-+/g," "):s;return n.push({resolveType:t,props:{query:r,count:10}}),n}const ok=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function t4(t){return t.split("/")[0]??""}function Ote(t){const e=new Set;for(const s of t){const n=t4(s);ok.has(n)&&e.add(n)}return e}function $te(t,e){const s=t4(t);return!ok.has(s)||e.size===0?!0:e.has(s)}const Bte=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>dh(s=>Ite(t,s),e),optionsFromPayload:uh},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>dh(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:uh},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>dh(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:uh},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>dh(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:uh},{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:qte}];function zte(t,e,s=new Set){const n=[...e],i=l=>{const c=[];for(const d of Bte){if(d.kind!==l)continue;const h=n.find(u=>d.test(u)&&$te(u,s));h&&c.push({cand:d,resolveType:h})}return c.find(d=>s.has(t4(d.resolveType)))??c[0]},r=(l,c,d)=>({kind:l.kind,id:`${l.kind}:${c}`,resolveType:c,clientFilter:l.clientFilter,isFallback:d,buildRequests:h=>l.buildRequests(c,h),optionsFromPayload:l.optionsFromPayload}),a=[];for(const l of["product","category"]){if(!t.has(l))continue;const c=i(l);c&&a.push(r(c.cand,c.resolveType,!1))}return t.size>0&&a.push(Fte(t.has("category")?"category":"product")),a}function Fte(t){return{kind:t,id:Bb,resolveType:Bb,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>Jte(e,s)}}function Na(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Ute(t,e,s){const n=new Set,i=new Set,r=a=>{if(Array.isArray(a)){for(const d of a)r(d);return}const l=Na(a);if(!l)return;const c=l.__resolveType;if(typeof c=="string"){if(s(c))n.add(c);else if(c in e&&!i.has(c)){i.add(c);const d=Na(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),r(e[c])}}for(const d of Object.values(l))r(d)};return r(t),n}function ak(t){const e=new Set,s=[];for(const n of t)for(const i of n)e.has(i.value)||(e.add(i.value),s.push(i));return s}function lk(t){try{return decodeURIComponent(t)}catch{return t}}function Hte(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kte(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=Hte(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function ck(t,e,s){if(typeof t!="string"||!t)return null;let n;try{n=new URL(t,"https://placeholder.invalid").pathname}catch{return null}n=n.replace(/\/+$/,"");const i=vf(Ko(e)),{pattern:r,order:a}=Kte(i),l=a.indexOf(s);if(l===-1)return null;const c=n.match(r);if(!c)return null;const d=c[l+1]?.replace(/^\/+|\/+$/g,"");return d?lk(d):null}function uh(t,e){const s=Na(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],i=[],r=new Set;for(const a of n){const l=Na(a);if(!l)continue;const c=ck(l.url,e.template,e.paramName);if(!c||r.has(c))continue;r.add(c);const d=Na(l.isVariantOf),h=typeof d?.name=="string"&&d.name||typeof l.name=="string"&&l.name||c,u=Array.isArray(l.image)?Na(l.image[0]):null,f=typeof u?.url=="string"?u.url:void 0;i.push({value:c,label:h,image:f})}return i}function Wte(t){if(typeof t!="string"||!t)return null;let e;try{e=new URL(t,"https://placeholder.invalid").pathname}catch{return null}const s=e.replace(/^\/+|\/+$/g,"");return s?lk(s):null}function qte(t){const e=[],s=new Set,n=(i,r)=>{const a=Na(i);if(!a)return;const l=typeof a.name=="string"&&a.name?a.name:"",c=l?[...r,l]:r,d=Wte(a.url);if(d&&!s.has(d)&&(s.add(d),e.push({value:d,label:c.join(" › ")||d})),Array.isArray(a.children))for(const h of a.children)n(h,c)};if(Array.isArray(t))for(const i of t)n(i,[]);return e}const Gte=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 Yte(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function Qte(t){if(typeof t!="string"||!t)return[];const e=[],s=/<a\b[^>]*?\bhref="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi;let n,i=0;for(;(n=s.exec(t))!==null&&i++<5e3;){const r=n[1]??"",a=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:r,text:a})}return e}function Xte(t){if(typeof t!="string"||!t)return[];const e=[],s=new Set,n=/"@type":"Product"[\s\S]{0,600}?(?:"url"|\burl):"([^"]+)"[\s\S]{0,300}?(?:"name"|\bname):"([^"]+)"/g,i=/(?:"image"|\bimage):\s*\[\s*\{[\s\S]{0,400}?(?:"url"|\burl):"([^"]+)"/;let r,a=0;for(;(r=n.exec(t))!==null&&a++<3e3;){const l=(r[1]??"").replace(/\\\//g,"/");if(!l||s.has(l))continue;s.add(l);const c=t.slice(r.index,r.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:l,name:r[2]??"",image:c||void 0})}return e}function Jte(t,e){const s=[],n=new Set,i=(r,a,l,c)=>{if(s.length>=200)return;const d=ck(r,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||l==="category"&&Gte.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:a&&a.length<=80?a:Yte(d),kind:l,image:c}))};for(const{url:r,name:a,image:l}of Xte(t))i(r,a,"product",l);for(const{href:r,text:a}of Qte(t))r.startsWith("/")&&!r.startsWith("//")&&i(r,a,"category");return s}function Pd(t,e,s=50){const n=e.trim().toLowerCase();return(n?t.filter(r=>r.label.toLowerCase().includes(n)||r.value.toLowerCase().includes(n)):t).slice(0,s)}const dk=1e4;function Zte(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 ese(t,{resolveType:e,props:s}){const n=await fetch(wS(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(dk)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function zb(t,e){const s=await fetch(LS(t,e),{signal:AbortSignal.timeout(dk)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function tse(t,e,s){const n=e.optionsFromPayload(await zb(t,"/"),s),i=n.find(a=>a.kind==="category");if(!i)return n;const r=Dr(s.template,{[s.paramName]:i.value});if(r==="/")return n;try{const a=e.optionsFromPayload(await zb(t,r),s).filter(l=>l.kind==="product");return ak([n,a])}catch{return n}}function sse(t,e,s){return tt.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function nse(t,e,s,n){if(e.homepageLinks)return tse(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const r=await Promise.allSettled(i.map(l=>ese(t,l))),a=r.filter(l=>l.status==="fulfilled").map(l=>l.value);if(a.length===0){const l=r.find(c=>c.status==="rejected");throw l?l.reason:new Error("Failed to fetch options")}return ak(a.map(l=>e.optionsFromPayload(l,n)))}function Tp(t,e,s,n,i){return{queryKey:sse(t,e,s),queryFn:()=>nse(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function Ed(t){const e=F.c(16),{heading:s,iconKind:n,options:i,template:r,paramName:a,keyPrefix:l,onSelect:c}=t;if(i.length===0)return null;let d;if(e[0]!==n||e[1]!==l||e[2]!==c||e[3]!==i||e[4]!==a||e[5]!==r){let u;e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==a||e[11]!==r?(u=f=>o.jsxs($s,{value:`${l}:${f.value}`,className:"gap-3 py-2",onSelect:()=>c(f.value),children:[n==="product"&&o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:f.image?o.jsx("img",{src:f.image,alt:"",referrerPolicy:"no-referrer",className:"h-full w-full object-cover"}):o.jsx(sg,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:f.label}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Dr(r,{[a]:f.value})})]})]},`${l}:${f.value}`),e[7]=n,e[8]=l,e[9]=c,e[10]=a,e[11]=r,e[12]=u):u=e[12],d=i.map(u),e[0]=n,e[1]=l,e[2]=c,e[3]=i,e[4]=a,e[5]=r,e[6]=d}else d=e[6];let h;return e[13]!==s||e[14]!==d?(h=o.jsx(fn,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=h):h=e[15],h}function Fb(t){const e=F.c(2),{text:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function ise(t){const e=F.c(52),{sources:s,template:n,paramName:i,value:r,sandboxRef:a,onCommit:l}=t,c=ae(),[d,h]=T.useState(!1),[u,f]=T.useState(""),[p,m]=T.useState(""),g=T.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=Zte(c),L=[...new Set(s.map(Te=>b[Te.kind].noun))].join(" or ");let _;e[0]!==c||e[1]!==L?(_=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:L}),e[0]=c,e[1]=L,e[2]=_):_=e[2];const y=_,w={template:n,paramName:i};let S;e[3]!==u?(S=(Te,we)=>({source:Te,query:we,options:Te.clientFilter?Pd(we.data??[],u):we.data??[]}),e[3]=u,e[4]=S):S=e[4];const k=S,j=s.filter(hse),C=s.filter(use),V=qm({queries:j.map(Te=>Tp(a,Te,p,w,d))});let N;e[5]!==V||e[6]!==k?(N=(Te,we)=>k(Te,V[we]),e[5]=V,e[6]=k,e[7]=N):N=e[7];const A=j.map(N),P=A.length===0||A.every(dse),R=qm({queries:C.map(Te=>Tp(a,Te,p,w,d&&P))});let E;e[8]!==R||e[9]!==k?(E=(Te,we)=>k(Te,R[we]),e[8]=R,e[9]=k,e[10]=E):E=e[10];const I=C.map(E),D=P?I:A,O=D.length===1&&D[0]?.source.homepageLinks?D[0]:null,M=O&&!O.query.isLoading&&!O.query.isError?O?.query.data??[]:[],z=Pd(M.filter(cse),u),$=Pd(M.filter(lse),u),U=z.length>0&&$.length>0,H=Te=>{h(Te),g.current&&clearTimeout(g.current),f(Te?r:""),m(Te?r:"")};let W;e[11]===Symbol.for("react.memo_cache_sentinel")?(W=Te=>{f(Te),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{m(Te)},300)},e[11]=W):W=e[11];const K=W,G=Te=>{l(Te),H(!1)},Y=TS(u),Z=Dr(n,{[i]:Y}),te=Ft,X=zt,ee="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",J=ase;let Q;e[12]!==x||e[13]!==c?(Q=c("sandbox.pathParamPickerChip.pickValueTitle",{paramLabel:x}),e[12]=x,e[13]=c,e[14]=Q):Q=e[14];let oe;e[15]!==Q?(oe=o.jsx(cs,{className:"sr-only",children:o.jsx(Kt,{children:Q})}),e[15]=Q,e[16]=oe):oe=e[16];let le;e[17]===Symbol.for("react.memo_cache_sentinel")?(le=o.jsx(sg,{size:16,className:"shrink-0 text-foreground"}),e[17]=le):le=e[17];let de;e[18]!==c?(de=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=de):de=e[19];let se;e[20]!==x?(se=o.jsx("span",{className:"rounded-sm bg-violet-500/15 px-1 py-0.5 font-mono text-[12px] text-violet-600 dark:text-violet-400",children:x}),e[20]=x,e[21]=se):se=e[21];let ie;e[22]!==de||e[23]!==se?(ie=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[le,o.jsxs("span",{className:"text-sm font-medium text-foreground",children:[de," ",se]})]}),e[22]=de,e[23]=se,e[24]=ie):ie=e[24];const he=vr,ue=!1,ce="min-h-0 flex-1";let ne;e[25]!==y||e[26]!==u?(ne=o.jsx(Mi,{autoFocus:!0,placeholder:y,value:u,onValueChange:K}),e[25]=y,e[26]=u,e[27]=ne):ne=e[27];const q=Ii,fe="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let ge;e[28]!==c?(ge=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=ge):ge=e[29];let _e;e[30]!==ge?(_e=o.jsx(ri,{children:ge}),e[30]=ge,e[31]=_e):_e=e[31];const Le=Y&&o.jsx(fn,{className:"shrink-0",children:o.jsxs($s,{value:`__raw__:${Y}`,className:"gap-3 py-2",onSelect:()=>G(Y),children:[o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:o.jsx(gr,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:Y,paramLabel:x})}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:Z})]})]})}),je=U?o.jsxs("div",{className:"flex min-h-0 flex-1",children:[o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto border-r border-border",children:o.jsx(Ed,{heading:b.category.heading,iconKind:"category",options:z,template:n,paramName:i,keyPrefix:`${O?.source.id}:cat`,onSelect:G})}),o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:o.jsx(Ed,{heading:b.product.heading,iconKind:"product",options:$,template:n,paramName:i,keyPrefix:`${O?.source.id}:prod`,onSelect:G})})]}):o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:D.map(Te=>{const{source:we,query:Ne,options:Oe}=Te,{noun:nt}=b[we.kind];if(Ne.isLoading)return o.jsx(Fb,{text:c("sandbox.pathParamPickerChip.loading",{noun:nt})},we.id);if(Ne.isError)return o.jsx(Fb,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},we.id);if(we.homepageLinks){const Fe=Ne.data??[];return o.jsxs(T.Fragment,{children:[o.jsx(Ed,{heading:b.category.heading,iconKind:"category",options:Pd(Fe.filter(ose),u),template:n,paramName:i,keyPrefix:`${we.id}:cat`,onSelect:G}),o.jsx(Ed,{heading:b.product.heading,iconKind:"product",options:Pd(Fe.filter(rse),u),template:n,paramName:i,keyPrefix:`${we.id}:prod`,onSelect:G})]},we.id)}return o.jsx(Ed,{heading:D.length>1?b[we.kind].heading:void 0,iconKind:we.kind,options:Oe,template:n,paramName:i,keyPrefix:we.id,onSelect:G},we.id)})});let Ce;e[32]!==q||e[33]!==_e||e[34]!==Le||e[35]!==je?(Ce=o.jsxs(q,{className:fe,children:[_e,Le,je]}),e[32]=q,e[33]=_e,e[34]=Le,e[35]=je,e[36]=Ce):Ce=e[36];let Pe;e[37]!==he||e[38]!==ne||e[39]!==Ce?(Pe=o.jsxs(he,{shouldFilter:ue,className:ce,children:[ne,Ce]}),e[37]=he,e[38]=ne,e[39]=Ce,e[40]=Pe):Pe=e[40];let pe;e[41]!==X||e[42]!==oe||e[43]!==ie||e[44]!==Pe||e[45]!==J?(pe=o.jsxs(X,{className:ee,onClick:J,children:[oe,ie,Pe]}),e[41]=X,e[42]=oe,e[43]=ie,e[44]=Pe,e[45]=J,e[46]=pe):pe=e[46];let ke;return e[47]!==te||e[48]!==H||e[49]!==d||e[50]!==pe?(ke=o.jsx(te,{open:d,onOpenChange:H,children:pe}),e[47]=te,e[48]=H,e[49]=d,e[50]=pe,e[51]=ke):ke=e[51],o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",title:c("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:x}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-sm bg-violet-500/15 px-1 py-0.5 text-[12px] text-violet-600 hover:bg-violet-500/25 dark:text-violet-400",onClick:Te=>{Te.stopPropagation(),H(!0)},children:r||x}),ke]})}function rse(t){return t.kind==="product"}function ose(t){return t.kind!=="product"}function ase(t){return t.stopPropagation()}function lse(t){return t.kind==="product"}function cse(t){return t.kind!=="product"}function dse(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function use(t){return t.isFallback}function hse(t){return!t.isFallback}function fse(t){const e=F.c(8),{sources:s,template:n,paramName:i,sandboxRef:r,onFill:a}=t;let l,c;if(e[0]!==i||e[1]!==r||e[2]!==s||e[3]!==n){const p={template:n,paramName:i},m=s.filter(mse);c=qm,l=m.map(g=>Tp(r,g,"",p,!0)),e[0]=i,e[1]=r,e[2]=s,e[3]=n,e[4]=l,e[5]=c}else l=e[4],c=e[5];let d;e[6]!==l?(d={queries:l},e[6]=l,e[7]=d):d=e[7];const h=c(d),[u,f]=T.useState(!1);if(!u)for(const p of h){if(p.isLoading)break;const m=p.data?.[0];if(m){f(!0),queueMicrotask(()=>a(m.value));break}}return null}function mse(t){return!t.isFallback}function pse(t){const e=F.c(31),{name:s,value:n,onCommit:i}=t,r=ae(),[a,l]=T.useState(n),[c,d]=T.useState(!1),h=T.useRef(!1);let u;e[0]!==s||e[1]!==r?(u=s==="*"?r("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=r,e[2]=u):u=e[2];const f=u,p=a||f;let m;e[3]!==p?(m=o.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:p}),e[3]=p,e[4]=m):m=e[4];let g;e[5]!==f||e[6]!==r?(g=r("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=r,e[7]=g):g=e[7];let x,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=k=>l(k.target.value),b=()=>d(!0),e[8]=x,e[9]=b):(x=e[8],b=e[9]);let v;e[10]!==n?(v=k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(h.current=!0,l(n),k.currentTarget.blur())},e[10]=n,e[11]=v):v=e[11];let L;e[12]!==a||e[13]!==i||e[14]!==n?(L=()=>{if(d(!1),h.current){h.current=!1;return}const k=TS(a);l(k),k!==n&&i(k)},e[12]=a,e[13]=i,e[14]=n,e[15]=L):L=e[15];let _;e[16]!==a||e[17]!==f||e[18]!==g||e[19]!==v||e[20]!==L?(_=o.jsx("input",{type:"text",value:a,placeholder:f,title:g,spellCheck:!1,className:"absolute inset-0 rounded-sm bg-violet-500/15 px-1 text-[12px] text-violet-600 outline-none placeholder:text-violet-500/60 focus:bg-violet-500/25 dark:text-violet-400",onClick:gse,onChange:x,onFocus:b,onKeyDown:v,onBlur:L}),e[16]=a,e[17]=f,e[18]=g,e[19]=v,e[20]=L,e[21]=_):_=e[21];let y;e[22]!==m||e[23]!==_?(y=o.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[m,_]}),e[22]=m,e[23]=_,e[24]=y):y=e[24];let w;e[25]!==c||e[26]!==r?(w=c&&o.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-[10px] text-muted-foreground",children:[o.jsx(rA,{size:10}),r("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=r,e[27]=w):w=e[27];let S;return e[28]!==w||e[29]!==y?(S=o.jsxs(o.Fragment,{children:[y,w]}),e[28]=w,e[29]=y,e[30]=S):S=e[30],S}function gse(t){return t.stopPropagation()}function xse(t){if(t.activeGlobalSectionName)return t.activeGlobalSectionName;const e=t.iframeBase;if(!e)return t.noServerLabel;try{const s=new URL(e),n=t.resolvedPath==="/"?"":t.resolvedPath;return`${s.host}${n}`}catch{return e}}function bse(t){return t.showPreviewToolbar&&t.contentEditingEnabled}const Ub={resolveType:"website/pages/Page.tsx",seoResolveType:"website/sections/Seo/SeoV2.tsx"};function s4(t){return`pages-${encodeURIComponent(t)}-${crypto.randomUUID()}`}function uk(t,e){return{name:t,path:e,sections:[],seo:{__resolveType:Ub.seoResolveType},__resolveType:Ub.resolveType}}const vse=700;function V0({orgSlug:t,virtualMcpId:e,branch:s}){const n=Vs(),i=Ts()?.taskId??null,r=N0(e),a=_n(e).runtime==="cms";return Ds({mutationKey:rf(t,e,s),scope:{id:rf(t,e,s).join(":")},mutationFn:async({blockKey:l,data:c})=>{if(a){const f=await N_({orgSlug:t,virtualMcpId:e,branch:s},{set:{[l]:c}});return Hg(n,{orgSlug:t,virtualMcpId:e,branch:s},f),await n.invalidateQueries({queryKey:j0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),f}const d=C0(r,G8(l)),h=JSON.stringify(c,null,2),u=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/write`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:d,content:h})});return u.ok?u.json():S9(u,"Write")},onMutate:async({blockKey:l,data:c})=>{const d=`${t}/${e}/${s}`,h=tt.decofile(d);await n.cancelQueries({queryKey:h});const u=n.getQueryData(h),f=!!u&&l in u,p=u?.[l];return n.setQueryData(h,m=>({...m??{},[l]:c})),{queryKey:h,blockKey:l,hadKey:f,previousValue:p}},onError:(l,c,d)=>{d&&n.setQueryData(d.queryKey,h=>{if(!h)return h;if(!d.hadKey){const{[d.blockKey]:u,...f}=h;return f}return{...h,[d.blockKey]:d.previousValue}})},onSuccess:(l,{blockKey:c,data:d})=>{const h=`${t}/${e}/${s}`;n.setQueryData(tt.decofile(h),u=>({...u??{},[c]:d}))}})}function n4(t,e){const s=F.c(16),n=V0(t),i=ae();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r=new Map,s[0]=r):r=s[0];const a=T.useRef(r);let l;s[1]===Symbol.for("react.memo_cache_sentinel")?(l=new Map,s[1]=l):l=s[1];const c=T.useRef(l);let d;s[2]!==e||s[3]!==n||s[4]!==i?(d=v=>{const L=a.current.get(v);if(!L)return;const _=typeof L=="function"?L():L;a.current.delete(v),_&&n.mutate({blockKey:v,data:_},{onSuccess:()=>e?.onSaved?.(),onError:y=>ye.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:y.message}))})},s[2]=e,s[3]=n,s[4]=i,s[5]=d):d=s[5];const h=d;let u;s[6]!==h?(u=()=>{for(const v of c.current.values())clearTimeout(v);c.current.clear();for(const v of[...a.current.keys()])h(v)},s[6]=h,s[7]=u):u=s[7];const f=u;let p,m;s[8]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{const v=c.current;return()=>{for(const L of v.values())clearTimeout(L)}},m=[],s[8]=p,s[9]=m):(p=s[8],m=s[9]),T.useEffect(p,m);let g;s[10]!==h?(g=(v,L)=>{a.current.set(v,L);const _=c.current.get(v);_&&clearTimeout(_),c.current.set(v,setTimeout(()=>{c.current.delete(v),h(v)},vse))},s[10]=h,s[11]=g):g=s[11];const x=g;let b;return s[12]!==f||s[13]!==x||s[14]!==n.isPending?(b={save:x,flush:f,isPending:n.isPending},s[12]=f,s[13]=x,s[14]=n.isPending,s[15]=b):b=s[15],b}function yse(t){const e=F.c(5);let s;e[0]!==t?(s=t??{orgSlug:"",virtualMcpId:"",branch:""},e[0]=t,e[1]=s):s=e[1];const n=V0(s);let i;return e[2]!==t||e[3]!==n?(i={mutationFn:async r=>{const{name:a,path:l,template:c}=r;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const d=s4(a),h=c?{...c,name:a,path:l}:uk(a,l);return await n.mutateAsync({blockKey:d,data:h}),{key:d,name:a,path:l}}},e[2]=t,e[3]=n,e[4]=i):i=e[4],Ds(i)}const Wo="__blank__";function hk(t){const e=F.c(65),{id:s,value:n,onChange:i,templates:r,disabled:a}=t,l=ae(),[c,d]=T.useState(!1);let h;if(e[0]!==r||e[1]!==n){let O;e[3]!==n?(O=B=>B.key===n,e[3]=n,e[4]=O):O=e[4],h=r.find(O),e[0]=r,e[1]=n,e[2]=h}else h=e[2];const u=h;let f;e[5]!==u?.name||e[6]!==l?(f=u?.name??l("sectionsEditor.pageTemplateSelect.blankPageDefaultLabel"),e[5]=u?.name,e[6]=l,e[7]=f):f=e[7];let p;e[8]!==f?(p=o.jsx("span",{className:"truncate",children:f}),e[8]=f,e[9]=p):p=e[9];let m;e[10]!==u?(m=u?.path?o.jsx("span",{className:"truncate text-muted-foreground",children:u.path}):null,e[10]=u,e[11]=m):m=e[11];let g;e[12]!==p||e[13]!==m?(g=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[p,m]}),e[12]=p,e[13]=m,e[14]=g):g=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(y9,{className:"shrink-0 opacity-50"}),e[15]=x):x=e[15];let b;e[16]!==a||e[17]!==s||e[18]!==c||e[19]!==g?(b=o.jsx(ws,{asChild:!0,children:o.jsxs(me,{id:s,type:"button",variant:"outline",role:"combobox","aria-expanded":c,disabled:a,className:"w-full justify-between font-normal",children:[g,x]})}),e[16]=a,e[17]=s,e[18]=c,e[19]=g,e[20]=b):b=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v={width:"var(--radix-popover-trigger-width)"},e[21]=v):v=e[21];let L;e[22]!==l?(L=l("sectionsEditor.pageTemplateSelect.searchPlaceholder"),e[22]=l,e[23]=L):L=e[23];let _;e[24]!==L?(_=o.jsx(Mi,{placeholder:L,className:"h-9"}),e[24]=L,e[25]=_):_=e[25];let y;e[26]!==l?(y=l("sectionsEditor.pageTemplateSelect.noPagesFoundMessage"),e[26]=l,e[27]=y):y=e[27];let w;e[28]!==y?(w=o.jsx(ri,{children:y}),e[28]=y,e[29]=w):w=e[29];let S;e[30]!==l?(S=l("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[30]=l,e[31]=S):S=e[31];let k;e[32]!==i?(k=()=>{i(Wo),d(!1)},e[32]=i,e[33]=k):k=e[33];let j;e[34]!==l?(j=l("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[34]=l,e[35]=j):j=e[35];const C=n===Wo?"opacity-100":"opacity-0";let V;e[36]!==C?(V=re("ml-auto",C),e[36]=C,e[37]=V):V=e[37];let N;e[38]!==V?(N=o.jsx(Gt,{className:V}),e[38]=V,e[39]=N):N=e[39];let A;e[40]!==S||e[41]!==k||e[42]!==j||e[43]!==N?(A=o.jsxs($s,{value:S,onSelect:k,children:[j,N]}),e[40]=S,e[41]=k,e[42]=j,e[43]=N,e[44]=A):A=e[44];let P;if(e[45]!==i||e[46]!==r||e[47]!==n){let O;e[49]!==i||e[50]!==n?(O=B=>o.jsxs($s,{value:`${B.name} ${B.path}`,onSelect:()=>{i(B.key),d(!1)},children:[o.jsxs("div",{className:"flex min-w-0 flex-col",children:[o.jsx("span",{className:"truncate",children:B.name}),o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:B.path})]}),o.jsx(Gt,{className:re("ml-auto",n===B.key?"opacity-100":"opacity-0")})]},B.key),e[49]=i,e[50]=n,e[51]=O):O=e[51],P=r.map(O),e[45]=i,e[46]=r,e[47]=n,e[48]=P}else P=e[48];let R;e[52]!==A||e[53]!==P?(R=o.jsxs(fn,{children:[A,P]}),e[52]=A,e[53]=P,e[54]=R):R=e[54];let E;e[55]!==w||e[56]!==R?(E=o.jsxs(Ii,{onWheel:_se,children:[w,R]}),e[55]=w,e[56]=R,e[57]=E):E=e[57];let I;e[58]!==_||e[59]!==E?(I=o.jsx(ks,{className:"p-0",style:v,children:o.jsxs(vr,{children:[_,E]})}),e[58]=_,e[59]=E,e[60]=I):I=e[60];let D;return e[61]!==c||e[62]!==I||e[63]!==b?(D=o.jsxs(js,{open:c,onOpenChange:d,children:[b,I]}),e[61]=c,e[62]=I,e[63]=b,e[64]=D):D=e[64],D}function _se(t){const e=t.deltaMode===1?16:1;t.currentTarget.scrollTop=t.currentTarget.scrollTop+t.deltaY*e}function Lse(t){const e=F.c(89),{open:s,onOpenChange:n,isPending:i,error:r,templates:a,onSubmit:l}=t,c=i===void 0?!1:i,d=ae();let h;e[0]!==d?(h=d("sectionsEditor.createPageModal.defaultPageName"),e[0]=d,e[1]=h):h=e[1];const[u,f]=T.useState(h);let p;e[2]!==d?(p=d("sectionsEditor.createPageModal.defaultPagePath"),e[2]=d,e[3]=p):p=e[3];const[m,g]=T.useState(p),[x,b]=T.useState(Wo),[v,L]=T.useState(null),[_,y]=T.useState(s);s!==_&&(y(s),s&&(f(d("sectionsEditor.createPageModal.defaultPageName")),g(d("sectionsEditor.createPageModal.defaultPagePath")),b(Wo),L(null)));const w=!!a?.length;let S;e[4]!==c||e[5]!==n?(S=de=>{!de&&!c&&(L(null),n(!1))},e[4]=c,e[5]=n,e[6]=S):S=e[6];const k=S;let j;e[7]!==c||e[8]!==u||e[9]!==l||e[10]!==m||e[11]!==w||e[12]!==x?(j=async de=>{de.preventDefault();const se=u.trim(),ie=m.trim();if(!se||!ie||c)return;const he=U9(ie);if(he){L(he);return}L(null),await l({name:se,path:ie,templateKey:w&&x!==Wo?x:null})},e[7]=c,e[8]=u,e[9]=l,e[10]=m,e[11]=w,e[12]=x,e[13]=j):j=e[13];const C=j,V=v??r;let N;e[14]!==d?(N=d("sectionsEditor.createPageModal.title"),e[14]=d,e[15]=N):N=e[15];let A;e[16]!==N?(A=o.jsx(cs,{children:o.jsx(Kt,{children:N})}),e[16]=N,e[17]=A):A=e[17];let P;e[18]!==d?(P=d("sectionsEditor.createPageModal.nameLabel"),e[18]=d,e[19]=P):P=e[19];let R;e[20]!==P?(R=o.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:P}),e[20]=P,e[21]=R):R=e[21];let E;e[22]===Symbol.for("react.memo_cache_sentinel")?(E=de=>f(de.target.value),e[22]=E):E=e[22];let I;e[23]!==d?(I=d("sectionsEditor.createPageModal.namePlaceholder"),e[23]=d,e[24]=I):I=e[24];let D;e[25]!==c||e[26]!==u||e[27]!==I?(D=o.jsx(vt,{id:"new-page-name",value:u,onChange:E,placeholder:I,autoFocus:!0,disabled:c}),e[25]=c,e[26]=u,e[27]=I,e[28]=D):D=e[28];let O;e[29]!==D||e[30]!==R?(O=o.jsxs("div",{className:"space-y-1.5",children:[R,D]}),e[29]=D,e[30]=R,e[31]=O):O=e[31];let B;e[32]!==d?(B=d("sectionsEditor.createPageModal.pathLabel"),e[32]=d,e[33]=B):B=e[33];let M;e[34]!==B?(M=o.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:B}),e[34]=B,e[35]=M):M=e[35];let z;e[36]===Symbol.for("react.memo_cache_sentinel")?(z=de=>g(de.target.value),e[36]=z):z=e[36];let $;e[37]!==d?($=d("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=d,e[38]=$):$=e[38];let U;e[39]!==c||e[40]!==m||e[41]!==$?(U=o.jsx(vt,{id:"new-page-path",value:m,onChange:z,placeholder:$,disabled:c}),e[39]=c,e[40]=m,e[41]=$,e[42]=U):U=e[42];let H;e[43]!==M||e[44]!==U?(H=o.jsxs("div",{className:"space-y-1.5",children:[M,U]}),e[43]=M,e[44]=U,e[45]=H):H=e[45];let W;e[46]!==c||e[47]!==w||e[48]!==d||e[49]!==x||e[50]!==a?(W=w&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"new-page-template",className:"text-xs font-medium text-muted-foreground",children:d("sectionsEditor.createPageModal.templateLabel")}),o.jsx(hk,{id:"new-page-template",value:x,onChange:b,templates:a??[],disabled:c})]}),e[46]=c,e[47]=w,e[48]=d,e[49]=x,e[50]=a,e[51]=W):W=e[51];let K;e[52]!==V?(K=V&&o.jsx("p",{className:"text-xs text-destructive",children:V}),e[52]=V,e[53]=K):K=e[53];let G;e[54]!==O||e[55]!==H||e[56]!==W||e[57]!==K?(G=o.jsxs("div",{className:"space-y-4 py-4",children:[O,H,W,K]}),e[54]=O,e[55]=H,e[56]=W,e[57]=K,e[58]=G):G=e[58];let Y;e[59]!==n?(Y=()=>n(!1),e[59]=n,e[60]=Y):Y=e[60];let Z;e[61]!==d?(Z=d("sectionsEditor.createPageModal.cancelButton"),e[61]=d,e[62]=Z):Z=e[62];let te;e[63]!==c||e[64]!==Y||e[65]!==Z?(te=o.jsx(me,{type:"button",variant:"outline",onClick:Y,disabled:c,children:Z}),e[63]=c,e[64]=Y,e[65]=Z,e[66]=te):te=e[66];let X;e[67]!==c||e[68]!==u||e[69]!==m?(X=!u.trim()||!m.trim()||c,e[67]=c,e[68]=u,e[69]=m,e[70]=X):X=e[70];let ee;e[71]!==c||e[72]!==d?(ee=c?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),d("sectionsEditor.createPageModal.creatingButton")]}):d("sectionsEditor.createPageModal.createButton"),e[71]=c,e[72]=d,e[73]=ee):ee=e[73];let J;e[74]!==X||e[75]!==ee?(J=o.jsx(me,{type:"submit",disabled:X,children:ee}),e[74]=X,e[75]=ee,e[76]=J):J=e[76];let Q;e[77]!==te||e[78]!==J?(Q=o.jsxs(qn,{children:[te,J]}),e[77]=te,e[78]=J,e[79]=Q):Q=e[79];let oe;e[80]!==C||e[81]!==G||e[82]!==Q||e[83]!==A?(oe=o.jsx(zt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:C,children:[A,G,Q]})}),e[80]=C,e[81]=G,e[82]=Q,e[83]=A,e[84]=oe):oe=e[84];let le;return e[85]!==k||e[86]!==s||e[87]!==oe?(le=o.jsx(Ft,{open:s,onOpenChange:k,children:oe}),e[85]=k,e[86]=s,e[87]=oe,e[88]=le):le=e[88],le}const wse={loaders:"loader",actions:"action"},fk=new Set(["workflows"]);function mk(t){return wse[t]}function pk(t,e,s){const n=t.manifest?.blocks??{};for(const[i,r]of Object.entries(n))if(i.includes(s)&&e in r)return!0;return!1}function Sse(t,e,s){return/\.tsx?$/.test(e)?!0:pk(t,e,s)}function kse(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[i,r]of Object.entries(n))if(i.includes(e))for(const a of Object.keys(r))s.add(a);return s}function jse(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function gk(t,e){const s=t.manifest?.blocks??{},n=[],i=new Set;for(const[r,a]of Object.entries(s))if(r.includes(e))for(const l of Object.keys(a))i.add(l);for(const r of i){if(r.toLowerCase().includes("preview")||MS.has(r)||fk.has(i4(r))||jse(r,i))continue;const a=da(r,t);if(a.hidden)continue;const l=a.title&&a.title!==r?a.title:gs(r);n.push({resolveType:r,title:l})}return n.sort((r,a)=>r.title.localeCompare(a.title))}function Hb(t,e){return gk(t,e).length}function i4(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const Cse={deco:"Deco",std:"Deco Standard",website:"Website"};function Nse(t){return Cse[t]??t}function xk(t){const e=i4(t);let n=t.split("/").filter(Boolean).slice(t.startsWith("deco-sites/")?2:1);return(n[0]==="loaders"||n[0]==="actions")&&(n=n.slice(1)),[e,...n.slice(0,-1)]}function bk(t,e,s){const n=[];for(const[i,r]of Object.entries(e)){if(Sse(t,i,s)||F9(i)||!r||typeof r!="object"||Array.isArray(r))continue;const a=r,l=a.__resolveType;typeof l=="string"&&(MS.has(l)||fk.has(i4(l))||pk(t,l,s)&&n.push({key:i,resolveType:l,title:typeof a.name=="string"&&a.name?a.name:i}))}return n.sort((i,r)=>i.title.localeCompare(r.title))}function vk(t,e){const s=t[e],n=typeof s?.__resolveType=="string"?s.__resolveType:"",{__resolveType:i,...r}=s??{},a=typeof s?.name=="string"&&s.name?s.name:e;return{resolveType:n,props:r,title:a}}const Vse={target:null,editSeoPageKey:null,variantOverride:null};function Tse(t,e){switch(e.type){case"select":return{...t,target:e.target,variantOverride:null,editSeoPageKey:null};case"edit-seo":return{...t,target:e.target,editSeoPageKey:e.target.key,variantOverride:null};case"consume-edit-seo":return{...t,editSeoPageKey:null};case"variant-override":return{...t,variantOverride:e.params}}}const yk=T.createContext(null);function Kb(t){const e=F.c(9),{children:s}=t,[n,i]=T.useReducer(Tse,Vse);let r,a,l,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u=>i({type:"select",target:u}),a=u=>i({type:"edit-seo",target:u}),l=()=>i({type:"consume-edit-seo"}),c=u=>i({type:"variant-override",params:u}),e[0]=r,e[1]=a,e[2]=l,e[3]=c):(r=e[0],a=e[1],l=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:r,editSeo:a,consumeEditSeo:l,setVariantOverride:c},e[4]=n,e[5]=d):d=e[5];let h;return e[6]!==s||e[7]!==d?(h=o.jsx(yk,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=h):h=e[8],h}function _k(){const t=T.use(yk);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}function r4(t){return(e,s)=>{JP(e),t(e,s)}}const Ase="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function q9(t){return As(t)?.metadata?.fieldDescriptionTooltips??!1}function o4(t){const e=F.c(9),{description:s,virtualMcpId:n,children:i}=t,r=q9(n);if(!s||!r)return i;let a;e[0]!==i?(a=T.cloneElement(i,{className:re(i.props.className,Ase)}),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==a?(l=o.jsx(He,{asChild:!0,children:a}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==s?(c=o.jsx(Ke,{className:"max-w-64",children:s}),e[4]=s,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=o.jsxs(We,{delayDuration:300,children:[l,c]}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function Us(t){const e=F.c(17),{htmlFor:s,label:n,description:i,labelClassName:r,virtualMcpId:a}=t;if(!q9(a)){let h;e[0]!==s||e[1]!==n||e[2]!==r?(h=o.jsx(Mt,{htmlFor:s,className:r,children:n}),e[0]=s,e[1]=n,e[2]=r,e[3]=h):h=e[3];let u;e[4]!==i?(u=i&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[4]=i,e[5]=u):u=e[5];let f;return e[6]!==h||e[7]!==u?(f=o.jsxs("div",{className:"space-y-0.5",children:[h,u]}),e[6]=h,e[7]=u,e[8]=f):f=e[8],f}let c;e[9]!==s||e[10]!==n||e[11]!==r?(c=o.jsx(Mt,{htmlFor:s,className:r,children:n}),e[9]=s,e[10]=n,e[11]=r,e[12]=c):c=e[12];let d;return e[13]!==i||e[14]!==c||e[15]!==a?(d=o.jsx(o4,{description:i,virtualMcpId:a,children:c}),e[13]=i,e[14]=c,e[15]=a,e[16]=d):d=e[16],d}const Pse=li.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(s=>e.updateAttributes(s,{textAlign:t})).some(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:s})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?s.unsetTextAlign():s.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var Ese=Pse;const Rse=20,Lk=(t,e=0)=>{const s=[];return!t.children.length||e>Rse||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...Lk(n,e+1))}),s},Dse=t=>{if(!t.children.length)return;const e=Lk(t);e&&e.forEach(s=>{var n;const i=s.getAttribute("style"),r=(n=s.parentElement)===null||n===void 0||(n=n.closest("span"))===null||n===void 0?void 0:n.getAttribute("style");s.setAttribute("style",`${r};${i}`)})},wk=fT.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Dse(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",cr(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(s,n)=>{if(!s.isInline)return!0;s.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(r=>!!r))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),Mse=li.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=(e=Qu(t,"background-color"))!==null&&e!==void 0?e:t.style.backgroundColor;return s?.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Sk=li.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=(e=Qu(t,"color"))!==null&&e!==void 0?e:t.style.color;return s?.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Ise=li.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=Qu(t,"font-family"))!==null&&e!==void 0?e:t.style.fontFamily},renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),kk=li.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=Qu(t,"font-size"))!==null&&e!==void 0?e:t.style.fontSize},renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Ose=li.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=Qu(t,"line-height"))!==null&&e!==void 0?e:t.style.lineHeight},renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});li.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(Mse.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(Sk.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Ise.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(kk.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Ose.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(wk.configure(this.options.textStyle)),t}});const $se=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function Bse(t){const e=F.c(30),{editor:s,currentColor:n,open:i,onOpenChange:r}=t,a=ae(),[l,c]=T.useState("#000000");let d;e[0]!==s||e[1]!==r?(d=w=>{s.chain().focus().setColor(w).run(),r(!1)},e[0]=s,e[1]=r,e[2]=d):d=e[2];const h=d;let u;e[3]!==s||e[4]!==r?(u=()=>{s.chain().focus().unsetColor().run(),r(!1)},e[3]=s,e[4]=r,e[5]=u):u=e[5];const f=u,p=i||n!==null;let m;e[6]!==a?(m=a("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=a,e[7]=m):m=e[7];let g;e[8]!==r||e[9]!==i?(g=()=>r(!i),e[8]=r,e[9]=i,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ym,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let v;e[12]!==b?(v=o.jsxs("span",{className:"relative flex flex-col items-center",children:[x,o.jsx("span",{className:"mt-0.5 h-0.5 w-3.5 rounded-full",style:{backgroundColor:b}})]}),e[12]=b,e[13]=v):v=e[13];let L;e[14]!==p||e[15]!==m||e[16]!==g||e[17]!==v?(L=o.jsx(Xt,{active:p,label:m,onClick:g,children:v}),e[14]=p,e[15]=m,e[16]=g,e[17]=v,e[18]=L):L=e[18];let _;e[19]!==h||e[20]!==f||e[21]!==n||e[22]!==l||e[23]!==r||e[24]!==i||e[25]!==a?(_=i&&o.jsxs("div",{tabIndex:-1,className:"absolute left-0 top-full z-20 mt-1.5 flex w-56 flex-col gap-2 rounded-md border bg-popover p-2 shadow-md",onBlur:w=>{w.currentTarget.contains(w.relatedTarget)||r(!1)},children:[o.jsx("div",{className:"grid grid-cols-6 gap-1",children:$se.map(w=>o.jsx("button",{type:"button","aria-label":w,"aria-pressed":n===w,onMouseDown:Use,onClick:()=>h(w),className:re("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===w&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:w}},w))}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("label",{className:"flex flex-1 items-center gap-1.5 rounded bg-muted/40 px-2 py-1 text-xs text-muted-foreground cursor-pointer",children:[o.jsx("input",{type:"color",value:l,onMouseDown:Fse,onChange:w=>c(w.target.value),onBlur:()=>h(l),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),a("sectionsEditor.richTextColorControl.customLabel")]}),o.jsx("button",{type:"button",onMouseDown:zse,onClick:f,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors cursor-pointer hover:bg-muted hover:text-foreground",children:a("sectionsEditor.richTextColorControl.defaultLabel")})]})]}),e[19]=h,e[20]=f,e[21]=n,e[22]=l,e[23]=r,e[24]=i,e[25]=a,e[26]=_):_=e[26];let y;return e[27]!==_||e[28]!==L?(y=o.jsxs("div",{className:"relative",children:[L,_]}),e[27]=_,e[28]=L,e[29]=y):y=e[29],y}function zse(t){return t.preventDefault()}function Fse(t){return t.stopPropagation()}function Use(t){return t.preventDefault()}const hh=[1,2,3,4,5,6];function Hse(t){const e=new DOMParser().parseFromString(t,"text/html").body,s=Array.from(e.children);return s.length===0?e.innerHTML:s.map(n=>n.innerHTML).join("<br>")}const Kse=8,Wse=128,qse=16,Wb=1;function Gse({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r,inline:a=!1}){const l=ae(),c=typeof e=="string"?e:"",d=T.useRef(s);d.current=s;const[h,u]=T.useState(!1),[f,p]=T.useState(!1),m=Xf({extensions:[Jf.configure({heading:a?!1:{levels:[...hh]},bulletList:a?!1:void 0,orderedList:a?!1:void 0,listItem:a?!1:void 0,blockquote:a?!1:void 0,link:{HTMLAttributes:{}}}),...a?[]:[Ese.configure({types:["heading","paragraph"]})],wk,kk,Sk],content:c||"",editorProps:{attributes:{class:re("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:y})=>{const w=y.getHTML(),S=a?Hse(w):w;d.current(S==="<p></p>"||S===""?"":S)}}),g=O6({editor:m,selector:({editor:y})=>({bold:y?.isActive("bold")??!1,italic:y?.isActive("italic")??!1,underline:y?.isActive("underline")??!1,strike:y?.isActive("strike")??!1,headingLevel:hh.find(w=>y?.isActive("heading",{level:w})??!1)??0,fontSize:y?.getAttributes("textStyle").fontSize??null,color:y?.getAttributes("textStyle").color??null,bulletList:y?.isActive("bulletList")??!1,orderedList:y?.isActive("orderedList")??!1,link:y?.isActive("link")??!1,alignLeft:y?.isActive({textAlign:"left"})??!1,alignCenter:y?.isActive({textAlign:"center"})??!1,alignRight:y?.isActive({textAlign:"right"})??!1,alignJustify:y?.isActive({textAlign:"justify"})??!1})});if(!m)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=y=>{const w=m.chain().focus();if(y==="paragraph"){w.setParagraph().run();return}const S=hh.find(k=>`h${k}`===y);S&&w.setHeading({level:S}).run()},v=g.fontSize?parseInt(g.fontSize,10):NaN,L=Number.isFinite(v)?v:qse,_=y=>{const w=Math.min(Wse,Math.max(Kse,y));m.chain().focus().setFontSize(`${w}px`).run()};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(Us,{htmlFor:n,label:i,description:t.description,virtualMcpId:r?.virtualMcpId}),o.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[o.jsx(Xt,{active:g.bold,label:l("sectionsEditor.richTextField.bold"),onClick:()=>m.chain().focus().toggleBold().run(),children:o.jsx(n8,{size:14})}),o.jsx(Xt,{active:g.italic,label:l("sectionsEditor.richTextField.italic"),onClick:()=>m.chain().focus().toggleItalic().run(),children:o.jsx(i8,{size:14})}),o.jsx(Xt,{active:g.underline,label:l("sectionsEditor.richTextField.underline"),onClick:()=>m.chain().focus().toggleUnderline().run(),children:o.jsx(oA,{size:14})}),o.jsx(Xt,{active:g.strike,label:l("sectionsEditor.richTextField.strikethrough"),onClick:()=>m.chain().focus().toggleStrike().run(),children:o.jsx(r8,{size:14})}),!a&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs(xs,{value:x,onValueChange:b,children:[o.jsx(bs,{size:"sm","aria-label":l("sectionsEditor.richTextField.styleLabel"),onMouseDown:y=>y.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:o.jsx(Ss,{})}),o.jsxs(vs,{children:[o.jsx(Rt,{value:"paragraph",children:l("sectionsEditor.richTextField.styleParagraph")}),hh.map(y=>o.jsx(Rt,{value:`h${y}`,children:l("sectionsEditor.richTextField.styleHeading",{level:y})},y))]})]})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx(Xt,{active:!1,label:l("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>_(L-Wb),children:o.jsx(aA,{size:14})}),o.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:L}),o.jsx(Xt,{active:!1,label:l("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>_(L+Wb),children:o.jsx(Qt,{size:14})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Bse,{editor:m,currentColor:g.color,open:f,onOpenChange:p}),!a&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Xt,{active:g.bulletList,label:l("sectionsEditor.richTextField.bulletList"),onClick:()=>m.chain().focus().toggleBulletList().run(),children:o.jsx(hg,{size:14})}),o.jsx(Xt,{active:g.orderedList,label:l("sectionsEditor.richTextField.orderedList"),onClick:()=>m.chain().focus().toggleOrderedList().run(),children:o.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Aq,{editor:m,active:g.link,open:h,onOpenChange:u}),!a&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Xt,{active:g.alignLeft,label:l("sectionsEditor.richTextField.alignLeft"),onClick:()=>m.chain().focus().setTextAlign("left").run(),children:o.jsx(BE,{size:14})}),o.jsx(Xt,{active:g.alignCenter,label:l("sectionsEditor.richTextField.alignCenter"),onClick:()=>m.chain().focus().setTextAlign("center").run(),children:o.jsx(lA,{size:14})}),o.jsx(Xt,{active:g.alignRight,label:l("sectionsEditor.richTextField.alignRight"),onClick:()=>m.chain().focus().setTextAlign("right").run(),children:o.jsx(cA,{size:14})}),o.jsx(Xt,{active:g.alignJustify,label:l("sectionsEditor.richTextField.alignJustify"),onClick:()=>m.chain().focus().setTextAlign("justify").run(),children:o.jsx(dA,{size:14})})]})]}),o.jsx(Zf,{editor:m})]})]})}const Pc=t=>String(t).padStart(2,"0"),Yse="1900-01-01",Qse="2099-12-31",Xse="1900-01-01T00:00",Jse="2099-12-31T23:59";function Zse(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const s=new Date(t);return Number.isNaN(s.getTime())?"":`${s.getUTCFullYear()}-${Pc(s.getUTCMonth()+1)}-${Pc(s.getUTCDate())}`}function ene(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function tne(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Pc(e.getMonth()+1)}-${Pc(e.getDate())}T${Pc(e.getHours())}:${Pc(e.getMinutes())}`}function sne(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function nne(t){const e=F.c(41),{id:s,withTime:n,value:i,onChange:r,calendarLabel:a}=t,[l,c]=T.useState(!1);let d;e[0]!==n?(d=O=>n?tne(O):Zse(O),e[0]=n,e[1]=d):d=e[1];const h=d;let u;e[2]!==n?(u=O=>n?sne(O):ene(O),e[2]=n,e[3]=u):u=e[3];const f=u;let p;e[4]!==h||e[5]!==i?(p=()=>h(i),e[4]=h,e[5]=i,e[6]=p):p=e[6];const[m,g]=T.useState(p),[x,b]=T.useState(i);if(i!==x){b(i);const O=h(i);O!==m&&g(O)}let v;e[7]!==r||e[8]!==f?(v=O=>{g(O.target.value),r(f(O.target.value))},e[7]=r,e[8]=f,e[9]=v):v=e[9];const L=v;let _;if(e[10]!==i){const O=i?new Date(i):null;_=O&&!Number.isNaN(O.getTime())?O:null,e[10]=i,e[11]=_}else _=e[11];const y=_;let w;e[12]!==r||e[13]!==y||e[14]!==h||e[15]!==n?(w=O=>{if(!O)return;n&&y?O.setHours(y.getHours(),y.getMinutes(),0,0):O.setHours(0,0,0,0);const B=O.toISOString();g(h(B)),b(B),r(B),c(!1)},e[12]=r,e[13]=y,e[14]=h,e[15]=n,e[16]=w):w=e[16];const S=w,k=n?"datetime-local":"date",j=n?Xse:Yse,C=n?Jse:Qse;let V;e[17]!==h||e[18]!==i?(V=()=>g(h(i)),e[17]=h,e[18]=i,e[19]=V):V=e[19];let N;e[20]!==L||e[21]!==s||e[22]!==m||e[23]!==V||e[24]!==k||e[25]!==j||e[26]!==C?(N=o.jsx(vt,{id:s,type:k,min:j,max:C,value:m,onChange:L,onBlur:V,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=L,e[21]=s,e[22]=m,e[23]=V,e[24]=k,e[25]=j,e[26]=C,e[27]=N):N=e[27];let A;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(od,{className:"h-4 w-4"}),e[28]=A):A=e[28];let P;e[29]!==a?(P=o.jsx(ws,{asChild:!0,children:o.jsx(me,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":a,children:A})}),e[29]=a,e[30]=P):P=e[30];const R=y??void 0;let E;e[31]!==S||e[32]!==R?(E=o.jsx(ks,{className:"w-auto p-0",align:"end",onCloseAutoFocus:ine,children:o.jsx(e9,{mode:"single",selected:R,onSelect:S,initialFocus:!0})}),e[31]=S,e[32]=R,e[33]=E):E=e[33];let I;e[34]!==l||e[35]!==P||e[36]!==E?(I=o.jsxs(js,{open:l,onOpenChange:c,children:[P,E]}),e[34]=l,e[35]=P,e[36]=E,e[37]=I):I=e[37];let D;return e[38]!==N||e[39]!==I?(D=o.jsxs("div",{className:"flex gap-1",children:[N,I]}),e[38]=N,e[39]=I,e[40]=D):D=e[40],D}function ine(t){return t.preventDefault()}function fh(t){const e=F.c(76),{schema:s,value:n,onChange:i,path:r,label:a,sandbox:l}=t,c=ae(),d=typeof n=="string"?n:"",h=s.format;if(h==="rich-text"||h==="rich-text-inline"||h==="html"){const L=h==="rich-text-inline";let _;return e[0]!==a||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==s||e[5]!==L||e[6]!==n?(_=o.jsx(Gse,{schema:s,value:n,onChange:i,path:r,label:a,sandbox:l,inline:L}),e[0]=a,e[1]=i,e[2]=r,e[3]=l,e[4]=s,e[5]=L,e[6]=n,e[7]=_):_=e[7],_}if(h==="textarea"||h==="markdown"){const L=l?.virtualMcpId;let _;e[8]!==a||e[9]!==r||e[10]!==s.description||e[11]!==L?(_=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:L}),e[8]=a,e[9]=r,e[10]=s.description,e[11]=L,e[12]=_):_=e[12];let y;e[13]!==i?(y=k=>i(k.target.value),e[13]=i,e[14]=y):y=e[14];let w;e[15]!==r||e[16]!==d||e[17]!==y?(w=o.jsx(Jo,{id:r,value:d,onChange:y,rows:4}),e[15]=r,e[16]=d,e[17]=y,e[18]=w):w=e[18];let S;return e[19]!==_||e[20]!==w?(S=o.jsxs("div",{className:"space-y-2",children:[_,w]}),e[19]=_,e[20]=w,e[21]=S):S=e[21],S}const u=h==="date-time"||h==="datetime";if(h==="date"||u){const L=l?.virtualMcpId;let _;e[22]!==a||e[23]!==r||e[24]!==s.description||e[25]!==L?(_=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:L}),e[22]=a,e[23]=r,e[24]=s.description,e[25]=L,e[26]=_):_=e[26];let y;e[27]!==c?(y=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=y):y=e[28];let w;e[29]!==u||e[30]!==i||e[31]!==r||e[32]!==d||e[33]!==y?(w=o.jsx(nne,{id:r,withTime:u,value:d,onChange:i,calendarLabel:y}),e[29]=u,e[30]=i,e[31]=r,e[32]=d,e[33]=y,e[34]=w):w=e[34];let S;return e[35]!==_||e[36]!==w?(S=o.jsxs("div",{className:"space-y-2",children:[_,w]}),e[35]=_,e[36]=w,e[37]=S):S=e[37],S}if(h==="color-input"||h==="color"){const L=l?.virtualMcpId;let _;e[38]!==a||e[39]!==r||e[40]!==s.description||e[41]!==L?(_=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:L}),e[38]=a,e[39]=r,e[40]=s.description,e[41]=L,e[42]=_):_=e[42];const y=d||"#000000";let w;e[43]!==i?(w=N=>i(N.target.value),e[43]=i,e[44]=w):w=e[44];let S;e[45]!==y||e[46]!==w?(S=o.jsx("input",{type:"color",value:y,onChange:w,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=y,e[46]=w,e[47]=S):S=e[47];let k;e[48]!==i?(k=N=>i(N.target.value),e[48]=i,e[49]=k):k=e[49];let j;e[50]!==r||e[51]!==d||e[52]!==k?(j=o.jsx(vt,{id:r,value:d,onChange:k,placeholder:"#000000",className:"h-10 flex-1"}),e[50]=r,e[51]=d,e[52]=k,e[53]=j):j=e[53];let C;e[54]!==S||e[55]!==j?(C=o.jsxs("div",{className:"flex items-center gap-2",children:[S,j]}),e[54]=S,e[55]=j,e[56]=C):C=e[56];let V;return e[57]!==_||e[58]!==C?(V=o.jsxs("div",{className:"space-y-2",children:[_,C]}),e[57]=_,e[58]=C,e[59]=V):V=e[59],V}const f=l?.virtualMcpId;let p;e[60]!==a||e[61]!==r||e[62]!==s.description||e[63]!==f?(p=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:f}),e[60]=a,e[61]=r,e[62]=s.description,e[63]=f,e[64]=p):p=e[64];const m=h==="url"?"url":"text";let g;e[65]!==i?(g=L=>i(L.target.value),e[65]=i,e[66]=g):g=e[66];const x=s.default!=null?String(s.default):void 0;let b;e[67]!==r||e[68]!==d||e[69]!==m||e[70]!==g||e[71]!==x?(b=o.jsx(vt,{id:r,type:m,value:d,onChange:g,placeholder:x,className:"h-10"}),e[67]=r,e[68]=d,e[69]=m,e[70]=g,e[71]=x,e[72]=b):b=e[72];let v;return e[73]!==p||e[74]!==b?(v=o.jsxs("div",{className:"space-y-2",children:[p,b]}),e[73]=p,e[74]=b,e[75]=v):v=e[75],v}const rne=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,one=/^[+-]?\d*$/;function ane(t,e){return(e?one:rne).test(t)}function lne(t){const e=F.c(16),{schema:s,value:n,onChange:i,path:r,label:a,sandbox:l}=t,c=typeof n=="number"?String(n):"",[d,h]=T.useState(c),[u,f]=T.useState(c);c!==u&&(f(c),d!==""&&c!==""&&Number(d)===Number(c)||h(c));const p=l?.virtualMcpId;let m;e[0]!==a||e[1]!==r||e[2]!==s.description||e[3]!==p?(m=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:p}),e[0]=a,e[1]=r,e[2]=s.description,e[3]=p,e[4]=m):m=e[4];const g=s.type==="integer"?"numeric":"decimal";let x;e[5]!==i||e[6]!==s.type?(x=L=>{const _=L.target.value,y=s.type==="integer";if(_!==""&&!ane(_,y))return;h(_);const w=Number(_);i(_===""||Number.isNaN(w)?void 0:w)},e[5]=i,e[6]=s.type,e[7]=x):x=e[7];let b;e[8]!==r||e[9]!==d||e[10]!==g||e[11]!==x?(b=o.jsx(vt,{id:r,type:"text",inputMode:g,value:d,onChange:x,className:"h-10"}),e[8]=r,e[9]=d,e[10]=g,e[11]=x,e[12]=b):b=e[12];let v;return e[13]!==m||e[14]!==b?(v=o.jsxs("div",{className:"space-y-2",children:[m,b]}),e[13]=m,e[14]=b,e[15]=v):v=e[15],v}function cne(t){const e=F.c(14),{value:s,onChange:n,path:i,label:r,schema:a,sandbox:l}=t,c=typeof s=="boolean"?s:!1,d=l?.virtualMcpId;let h;e[0]!==r||e[1]!==i||e[2]!==a.description||e[3]!==d?(h=o.jsx(Us,{htmlFor:i,label:r,description:a.description,virtualMcpId:d}),e[0]=r,e[1]=i,e[2]=a.description,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==n?(u=m=>n(m),e[5]=n,e[6]=u):u=e[6];let f;e[7]!==c||e[8]!==i||e[9]!==u?(f=o.jsx(lo,{id:i,checked:c,onCheckedChange:u}),e[7]=c,e[8]=i,e[9]=u,e[10]=f):f=e[10];let p;return e[11]!==h||e[12]!==f?(p=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h,f]}),e[11]=h,e[12]=f,e[13]=p):p=e[13],p}const a4="__enum_empty__",jk="__enum_clear__";function l4(t){return t===""?a4:String(t)}function dne(t,e){if(t===a4)return"";const s=e.find(n=>l4(n)===t);return s!==void 0?s:t}function une(t,e){if(t!==jk)return dne(t,e)}function hne(t,e){return t==null?e.some(s=>s==="")?a4:void 0:l4(t)}function fne(t){return t===""?"":String(t)}function mne(t){const e=F.c(39),{schema:s,value:n,onChange:i,path:r,label:a,required:l,sandbox:c}=t,d=ae();let h;e[0]!==s.enum?(h=s.enum??[],e[0]=s.enum,e[1]=h):h=e[1];const u=h;let f;e[2]!==u||e[3]!==n?(f=hne(n,u),e[2]=u,e[3]=n,e[4]=f):f=e[4];const p=f;let m;e[5]!==u||e[6]!==l?(m=!l&&!u.some(gne),e[5]=u,e[6]=l,e[7]=m):m=e[7];const g=m,x=c?.virtualMcpId;let b;e[8]!==a||e[9]!==r||e[10]!==s.description||e[11]!==x?(b=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:x}),e[8]=a,e[9]=r,e[10]=s.description,e[11]=x,e[12]=b):b=e[12];let v;e[13]!==i||e[14]!==u?(v=V=>i(une(V,u)),e[13]=i,e[14]=u,e[15]=v):v=e[15];let L;e[16]!==d?(L=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=L):L=e[17];let _;e[18]!==L?(_=o.jsx(Ss,{placeholder:L}),e[18]=L,e[19]=_):_=e[19];let y;e[20]!==r||e[21]!==_?(y=o.jsx(bs,{id:r,className:"h-10 w-full min-w-0",children:_}),e[20]=r,e[21]=_,e[22]=y):y=e[22];let w;e[23]!==g||e[24]!==d?(w=g&&o.jsx(Rt,{value:jk,className:"text-muted-foreground",children:d("sectionsEditor.enumField.clearOption")}),e[23]=g,e[24]=d,e[25]=w):w=e[25];let S;e[26]!==u?(S=u.map(pne),e[26]=u,e[27]=S):S=e[27];let k;e[28]!==w||e[29]!==S?(k=o.jsxs(vs,{children:[w,S]}),e[28]=w,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==p||e[32]!==k||e[33]!==v||e[34]!==y?(j=o.jsxs(xs,{value:p,onValueChange:v,children:[y,k]}),e[31]=p,e[32]=k,e[33]=v,e[34]=y,e[35]=j):j=e[35];let C;return e[36]!==j||e[37]!==b?(C=o.jsxs("div",{className:"space-y-2",children:[b,j]}),e[36]=j,e[37]=b,e[38]=C):C=e[38],C}function pne(t){const e=l4(t);return o.jsx(Rt,{value:e,children:fne(t)},e)}function gne(t){return t===""}const Ck={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function Nk(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function mu(t){return Nk(t)?.variants?.[0]?.rule?.__resolveType===xd}function qb(t){return{__resolveType:ea,variants:[{value:t,rule:{__resolveType:xd}}]}}function Vk(t){return mu(t)?Nk(t)?.variants?.[0]?.value:t}function Ec(t){return mu(t)?Vk(t):t}function c4(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Cs(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function xne(t){return t.includes("flags/multivariate")}function bne(t){return gs(t)}function vne(t){const e=t.title?Sp(t.title)?.blockId:void 0;return e||(t.title&&!t.title.includes("/")?t.title:kp(t.resolveType)??gs(t.resolveType))}function yne(t,e){const s=[...t],n=new Set(s.map(r=>r.resolveType)),i=(r,a)=>{!r||n.has(r)||(n.add(r),s.push({resolveType:r,title:a??bne(r)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const r=c4(e.editorValue);r?.includes("/")&&i(r)}return s}function _ne(t,e,s){const n=e[0]?.resolveType??"";if(s)return s;if(!t||typeof t!="object"||Array.isArray(t))return n;const i=t,r=i.__resolveType;if(typeof r=="string"){if(ti(r)){const u=e.find(f=>f.resolveType===r);return u?u.resolveType:r}const d=e.find(u=>Pb(u.resolveType,r));if(d)return d.resolveType;const h=e.find(u=>u.resolveType===r);if(h)return h.resolveType;if(r.includes("/"))return r}const a=typeof i.type=="string"?i.type:void 0;if(a){const d=e.find(h=>h.discriminatorValue===a||h.resolveType===a||Pb(h.resolveType,a));if(d)return d.resolveType}let l=n,c=-1;for(const d of e){if(!d.schema?.properties)continue;const u=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>i[f]!==void 0).length;u>0&&u>c&&(c=u,l=d.resolveType)}return c>0,l}function Gb(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=c4(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=In(n,e);return i||(n.includes("/")?null:s??null)}function Lne(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const s={...t.properties};return delete s[e],{...t,properties:s}}function Tk(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Cs(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function wne(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=c4(s);return n&&xne(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function d4(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return"";const e=t;if(Array.isArray(e.variants)){const s=e.variants,n=s.find(r=>r.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const i=s.find(r=>typeof r.value=="string");if(i)return i.value}return typeof e.src=="string"?e.src:typeof e.url=="string"?e.url:typeof e.value=="string"?e.value:""}const Sne=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),kne=5,jne=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function Yb(t){const{start:e,end:s}=t,n=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!n&&!i)return null;const r=c=>{if(!c)return null;const d=new Date(c);return Number.isNaN(d.getTime())?null:jne.format(d)},a=r(n),l=r(i);return a&&l?`${a} → ${l}`:a?`From ${a}`:l?`Until ${l}`:null}function ed(t,e=0){if(!t)return"Default";if(e>kne)return"...";const s=t.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(s)||s==="")return"Default";switch(s){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:i,tablet:r,desktop:a,devices:l=[]}=t,c=[...l];return i&&c.push("Mobile"),r&&c.push("Tablet"),a&&c.push("Desktop"),c.length>0?c.map(Sne).join(" & "):gs(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return Yb(t)??gs(s);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:i}=t;return typeof i=="number"?`${Math.ceil(i*100)}% of sessions`:gs(s)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:i,match:r}=t,a=[];return i&&a.push(i),r&&a.push(r),a.length>0?a.join(" - "):gs(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:r,pathname:a}=i??{};return r&&a?`Pathname ${r} ${a}`:gs(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:r}=t,a=d=>[d.city,d.regionCode,d.country].filter(Boolean).join(" - "),l=i?.[0];if(l){const d=(i?.length??0)-1;return`${a(l)}${d>0?` +${d}`:""}`}const c=r?.[0];if(c){const d=(r?.length??0)-1;return`Except ${a(c)}${d>0?` +${d}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:i,op:r="AND"}=t;if(i&&i.length>0){const a=r==="OR"?"OR":"AND";return i.map(l=>ed(l,e+1)).join(` ${a} `)}return gs(s)}default:{const i=Yb(t);return i||gs(s)||"Default"}}}function Ak(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Pk(t,e){if(e.length===0)return 0;const s=Ak(t);for(let r=0;r<e.length;r++){const a=e[r].discriminators;if(a&&Object.keys(a).length>0&&Object.entries(a).every(([c,d])=>s[c]===d))return r}let n=0,i=-1;for(let r=0;r<e.length;r++){const a=e[r],l=new Set(Object.keys(a.discriminators??{})),d=a.propertyKeys.filter(h=>!l.has(h)).filter(h=>s[h]!==void 0&&s[h]!==null&&s[h]!=="").length;d>i&&(i=d,n=r)}return n}function Cne(t,e){const s=Ak(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}const Nne="$live/matchers/MatchAlways.ts";function Vne(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType===F3||i.rule?.__resolveType===Nne)??e.find(i=>i.value!=null);if(n&&n.value!=null)return n.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function Ap(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ap);const e=t;if(e.__resolveType){const s=Vne(e);return s===void 0?t:Ap(s)}return Ek(e)}function Ek(t){const e={};for(const[s,n]of Object.entries(t))e[s]=Ap(n);return e}function Tne(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function Rk(t){return t==null?"":Array.isArray(t)?t.map(Rk).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Cf(t,e){if(!t.includes("{"))return;const s=Ek(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,r,a)=>{const l=(r??a??"").trim();return Rk(Tne(s,l))}).trim()||void 0}function Ane(t){return t.replace(/<[^>]*>/g,"").trim()}function Pne(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function Ene(t){return/^Option \d+$/.test(t)}function Rne(t,e){if(e.includes("{"))return Cf(e,t);const s=t[e];if(typeof s=="string"&&s)return s;if(Array.isArray(s)){const n=s.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(n)return n}}function Dk(t,e,s){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let n=Ec(t);const i=Tk(n);if(i&&(n=i,n=Ec(n)),s?.titleBy){const a=Rne(n,s.titleBy);if(a)return a}if(s?.inlineUnionBranches?.length){const a=Pk(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),l=s.inlineUnionBranches[a]?.title;if(l&&!Ene(l)){const c=Cf(l,n);if(c)return c;if(!l.includes("{"))return l}}for(const a of["name","label","title","alt","text","href","id","key"]){const l=n[a];if(typeof l=="string"&&l.trim()){const c=s?.properties?.[a]?.format;if(c==="rich-text"||c==="html"){const d=Ane(l);if(d)return d;continue}return l}if(Array.isArray(l)){const c=l.map(d=>d==null?"":String(d)).filter(Boolean).join(",");if(c)return c}}const r=n.__resolveType;if(typeof r=="string"&&r)return r.includes("/matchers/")?ed(n):gs(r);if(s?.title){const a=Cf(s.title,n);if(a)return a;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function Nf(t,e){return t.map((s,n)=>Dk(s,n,e))}function Mk(t,e,s){return Dk(t,e,s)}function Dne(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const s=e.properties;return s?.mobile?"{{{image.mobile}}}":s?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function Qb(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=Dne(e);if(!s)return;const n=Cf(s,t);if(!n)return;const i=d4(n)||n;return zE(i)}function u4(t){return t===io||t===ea}function G9(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function Vf(t,e){const s=t.__resolveType??"";if(!s)return null;if(Cs(s)){const n=t.section??{};return Ik(n,e)}if(u4(s)){const n=t.variants?.[0]?.value;return n?Vf(n,e):null}return!ti(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:G9(s,e)}function Ik(t,e){const s=t.__resolveType??"";if(!s)return null;if(u4(s)){const n=t.variants?.[0]?.value;return n?Vf(n,e):null}return!ti(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:G9(s,e)}function Ok(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!ti(n)||!Object.hasOwn(e,n))return null;const i=G9(n,e);return i?{blockKey:n,...i}:null}function d3e(t,e){if(!e.isSavedBlock)return null;if(e.isHidden){const r=(Cs(t.__resolveType)?t.section:t)?.variants?.[0]?.value;if(!r)return null;const a=r.__resolveType??"";return Cs(a)?r.section?.__resolveType??a??null:a||null}return(e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType)||null}function Mne(t,e,s){if(e.isMultivariate)return null;if(e.isSavedBlock&&!e.isHidden){const n=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return G9(n,s)}if(e.isHidden){const r=(Cs(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t,a=r.__resolveType??"",l=Cs(a)?r.section?.__resolveType??a:a;return u4(l)?null:Vf(r,s)}if(e.isLazy||Cs(t.__resolveType)){const n=t.section??{};return Ik(n,s)}return Vf(t,s)}function kn(t){return typeof t=="string"?t:t.label}function vd(t){return typeof t=="object"}function Xb(t){return vd(t)?t.arrayLabel:void 0}function Jb(t){return vd(t)?t.fieldKey:void 0}function Ine(t){return vd(t)?t.ownerPath:void 0}function Zb(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function $u(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function qa(t){return t.normalize("NFC").trim()}function One(t,e){return e.length>0&&qa(kn(e[0]))===qa(t)?e:[t,...e]}function $ne(t,e){return e.map(s=>{if(!vd(s))return s;const n=s.ownerPath??[];return n[0]===t?s:{...s,ownerPath:[t,...n]}})}function ss(t,e){return qa(t)===qa(e)}function Tf(t,e){return qa(t).replace(/\s+/g,"").toLowerCase()===qa(e).replace(/\s+/g,"").toLowerCase()}function Bne(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||ss(e,t)||s?.arrayKey!=null&&ss(e,s.arrayKey)}function mh(t,e,s,n,i){const r=qa(s);if(t.some(l=>ss(kn(l),r)||ss(kn(l),s)))return t;const a={label:s,itemIndex:n};return Bne(e,s,i)&&(a.arrayLabel=e),i?.arrayKey&&(a.fieldKey=i.arrayKey),[...t,a]}function zne(t,e){return t.slice(0,t.length-e.length)}function Fne(t,e,s,n){if(s.length===0)return s;const i=s[0];if(vd(i))return s;const r=n??Ga(t,e),a=kn(i);return ss(a,r)||ss(a,t)?s.slice(1):s}function Ga(t,e){return e.title??$u(t)}function Bu(t,e,s){const n=s[t];if(!n)return $u(t);const i=Ga(t,n);return e.some(a=>{if(a===t)return!1;const l=s[a];return l!=null&&Ga(a,l)===i})?$u(t):i}function u3e(t,e){return e.isMultivariateSectionTop?0:t-2}function h3e(t,e){return e<=0?[]:t.slice(0,e)}function Fc(t,e){return t.type==="array"&&t.items||K9(t)?!0:Array.isArray(e)}function $k(t,e=0){if(e>6||!t.properties)return!1;for(const s of Object.keys(t.properties)){const n=t.properties[s];if(n&&(Fc(n)||n.type==="object"&&$k(n,e+1)))return!0}return!1}function Bk(t,e=0){if(e>6||t==null||typeof t!="object")return!1;if(Array.isArray(t))return t.some(s=>s!=null&&typeof s=="object"&&!Array.isArray(s));for(const[s,n]of Object.entries(t))if(!s.startsWith("__")&&Bk(n,e+1))return!0;return!1}function Une(t,e,s={}){const n=t.filter(i=>{const r=e[i];if(!r)return!1;if(r.type==="object"&&$k(r))return!0;const a=s[i];return a!=null&&typeof a=="object"&&!Array.isArray(a)?Bk(a):!1});return n.length>1?new Set(n):new Set}function ev(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Hne(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=Mk(t,e);return s===`Item ${e+1}`?void 0:s}function pu(t,e,s={n:4e3},n=0){if(n>4||s.n<=0||t==null||typeof t!="object")return!1;if(Array.isArray(t)){for(let i=0;i<t.length;i++){const r=t[i];if(--s.n<=0)return!1;const a=Hne(r,i);if(a&&ss(a,e)||pu(r,e,s,n+1))return!0}return!1}for(const[i,r]of Object.entries(t))if(!i.startsWith("__")){if(--s.n<=0)return!1;if((Array.isArray(r)||r!=null&&typeof r=="object")&&(Tf($u(i),e)||Tf(i,e))||pu(r,e,s,n+1))return!0}return!1}function Pp(t,e,s,n=0){if(!s||n>4||t==null||typeof t!="object")return!1;const i=t.__resolveType;if(typeof i!="string"||!i)return!1;const r=In(i,s)?.properties;if(!r)return!1;const a=Object.keys(r);for(const l of a){const c=r[l];if(!c)continue;if(Fc(c)){const h=Bu(l,a,r);if(ss(h,e)||ss(l,e))return!0}const d=t[l];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&Pp(d,e,s,n+1))return!0}return!1}function Va(t,e,s,n,i,r){if(n.length===0)return null;const a=kn(n[0]),l=Jb(n[0]);if(l!=null)for(const b of t){const v=e[b];if(!(!v||!Fc(v,s[b]))&&b===l)return b}const c=n.flatMap(b=>Ine(b)??[]);if(c.length>0){const b=t.filter(v=>e[v]?.type==="block-ref"&&c.includes(v));if(b.length===1)return b[0]}for(const b of t){const v=e[b];if(!v||!Fc(v,s[b]))continue;const L=Bu(b,t,e);if(ss(a,L)||ss(a,b)||n.some(_=>{if(ss(kn(_),L)||ss(kn(_),b))return!0;const y=Xb(_);return y!=null&&(ss(y,L)||ss(y,b))}))return b}for(const b of t){const v=e[b];if(!v||!Fc(v,s[b]))continue;const L=s[b];if(!Array.isArray(L))continue;if(Nf(L,v.items).some(y=>ss(y,a)))return b}let d=null,h=!1,u=null,f=!1;for(const b of t){const v=e[b];if(v?.type!=="object"||!v.properties)continue;const L=Object.keys(v.properties),_=ev(s[b]),y=Bu(b,t,e);if((ss(a,y)||ss(a,b))&&Va(L,v.properties,_,n.slice(1),i,r)!=null){d===null?d=b:h=!0;continue}Va(L,v.properties,_,n,i,r)!=null&&(u===null?u=b:f=!0)}if(d!==null)return h?null:d;if(u!==null)return f?null:u;for(const b of t){const v=e[b];if(v?.type!=="inline-union"||!v.inlineUnionBranches?.length)continue;const L=ev(s[b]),_=Ga(b,v);for(const y of v.inlineUnionBranches){const w=y.schema?.properties;if(!w)continue;const S=Object.keys(w);if(Va(S,w,L,n,i,r)||(ss(a,_)||ss(a,b))&&Va(S,w,L,n.slice(1),i,r))return b}}let p=null;const m=[],g=n.map(Xb).filter(b=>b!=null),x=n.map(Jb).filter(b=>b!=null);for(const b of t){const v=e[b];if(v?.type!=="block-ref")continue;const L=Ga(b,v);if(a!==L&&a!==b){const _=s[b],w=(i?Ok(_,i):null)?.data??_;(pu(w,a)||x.some(S=>pu(w,S)||Pp(w,S,r))||g.some(S=>pu(w,S)||Pp(w,S,r)))&&m.push(b);continue}if(n.length>1){const _=s[b];if(_&&typeof _=="object"&&!Array.isArray(_)){const y=kn(n[1]);if(Object.keys(_).some(S=>!S.startsWith("__")&&(Tf($u(S),y)||Tf(S,y))))return b}}p||(p=b)}return p||(m.length===1?m[0]:(m.length>1,null))}function Kne(t,e,s,n,i,r){return Va(t,e,s,n,i,r)}function Wne(t,e,s,n,i,r,a){if(i.length===0||!s.properties)return!1;const l=Object.keys(s.properties);if(Va(l,s.properties,n,i,r,a))return!0;const c=kn(i[0]);return!ss(c,e)&&!ss(c,t)?!1:i.length>1||Va(l,s.properties,n,i.slice(1),r,a)!==null}function tv(t,e,s,n,i){if(!vd(s))return-1;if(s.fieldKey!=null&&i!=null)return s.fieldKey!==i?-1:s.itemIndex>=0&&s.itemIndex<t.length?s.itemIndex:-1;const r=Nf(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&ss(r[s.itemIndex],s.label))return s.itemIndex;if(n!=null&&n===s.itemIndex&&n>=0&&n<t.length)return n;const a=n!=null?r[n]:void 0;return a!==void 0&&ss(a,s.label)?n:r.findIndex(l=>ss(l,s.label))}function qne(t,e,s,n,i,r){if(e.length===0)return null;for(let l=0;l<e.length;l++){const c=e[l],d=tv(s,n,c,i,r);if(d>=0)return{index:d,innerPath:e.slice(l+1),crumbIndex:l}}const a=e.findIndex(l=>ss(kn(l),t));if(a>=0&&e.length>a+1){const l=e[a+1],c=tv(s,n,l,i,r);if(c>=0)return{index:c,innerPath:e.slice(a+2),crumbIndex:a+1}}return null}function Q1(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===io}function Gne(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>Q1(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>Q1(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>Q1(s.resolveType)):!1}function Yne(t,e){if(e==="global"||e==="sections"||K9(t))return!0;const s=t.type==="array"?t.items:void 0;return s?Gne(s):!1}function sv(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function zk(t){return t.map((e,s)=>({...e,index:s}))}function Qne(t,e){if(e===t.length)return t;if(e<t.length)return zk(t.slice(0,e));const s=Array.from({length:e-t.length},(n,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...s]}function Xne(t,e){const s=t.findIndex(r=>r.index===e),n=t.map(r=>r.index>e?{...r,index:r.index+1}:r),i={id:crypto.randomUUID(),index:e+1};return s===-1?[...n,i]:[...n.slice(0,s+1),i,...n.slice(s+1)]}function Jne(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const Zne="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",eie="w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-6 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-6 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",tie="w-6 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100";function nv(t,e){return re("h-6 shrink-0 overflow-hidden",e?Zne:t?tie:eie)}function sie(t){const e=F.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(o9,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n&&o.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=n,e[2]=r):r=e[2];let a;e[3]!==s?(a=o.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=a):a=e[4];let l;return e[5]!==r||e[6]!==a?(l=o.jsxs(o.Fragment,{children:[i,o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[r,a]})]}),e[5]=r,e[6]=a,e[7]=l):l=e[7],l}function nie(t){const e=F.c(67),{sortableId:s,labelText:n,imageSrc:i,hidden:r,onToggleHidden:a,onOpen:l,onDuplicate:c,onRemove:d}=t,h=ae();let u;e[0]!==s?(u={id:s,animateLayoutChanges:aie},e[0]=s,e[1]=u):u=e[1];const{attributes:f,listeners:p,setNodeRef:m,transform:g,isDragging:x}=f3(u);let b;e[2]!==g?(b=fr.Transform.toString(g?{...g,x:0}:null),e[2]=g,e[3]=b):b=e[3];const v=x?0:void 0;let L;e[4]!==b||e[5]!==v?(L={transform:b,opacity:v},e[4]=b,e[5]=v,e[6]=L):L=e[6];const _=L;let y;e[7]!==l?(y=Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),l())},e[7]=l,e[8]=y):y=e[8];const w=x?"cursor-grabbing":"cursor-pointer";let S;e[9]!==w?(S=re("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",w),e[9]=w,e[10]=S):S=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(o9,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let j;e[12]!==i?(j=i&&o.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=j):j=e[13];const C=r&&"line-through opacity-50";let V;e[14]!==C?(V=re("min-w-0 flex-1 truncate text-sm",C),e[14]=C,e[15]=V):V=e[15];let N;e[16]!==n||e[17]!==V?(N=o.jsx("span",{className:V,children:n}),e[16]=n,e[17]=V,e[18]=N):N=e[18];let A;e[19]!==r||e[20]!==a||e[21]!==h?(A=a&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":h(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:re(nv(r===!0,r===!0)),onClick:Y=>{Y.stopPropagation(),a()},onPointerDown:oie,children:r?o.jsx(mE,{size:14}):o.jsx(h0,{size:14})})}),o.jsx(Ke,{side:"bottom",children:h(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[19]=r,e[20]=a,e[21]=h,e[22]=A):A=e[22];let P;e[23]!==n||e[24]!==h?(P=h("sectionsEditor.arrayField.openActionsFor",{label:n}),e[23]=n,e[24]=h,e[25]=P):P=e[25];let R;e[26]!==r?(R=re(nv(r===!0,!1),"data-[state=open]:ml-0 data-[state=open]:w-6 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]"),e[26]=r,e[27]=R):R=e[27];let E;e[28]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Vi,{size:14}),e[28]=E):E=e[28];let I;e[29]!==P||e[30]!==R?(I=o.jsx($t,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":P,className:R,onClick:rie,onPointerDown:iie,children:E})}),e[29]=P,e[30]=R,e[31]=I):I=e[31];let D;e[32]!==c?(D=Y=>{Y.stopPropagation(),c()},e[32]=c,e[33]=D):D=e[33];let O;e[34]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(bn,{size:14}),e[34]=O):O=e[34];let B;e[35]!==h?(B=h("sectionsEditor.arrayField.duplicate"),e[35]=h,e[36]=B):B=e[36];let M;e[37]!==D||e[38]!==B?(M=o.jsxs(Qe,{onClick:D,children:[O,B]}),e[37]=D,e[38]=B,e[39]=M):M=e[39];let z;e[40]!==d?(z=Y=>{Y.stopPropagation(),d()},e[40]=d,e[41]=z):z=e[41];let $;e[42]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(rn,{size:14}),e[42]=$):$=e[42];let U;e[43]!==h?(U=h("sectionsEditor.arrayField.delete"),e[43]=h,e[44]=U):U=e[44];let H;e[45]!==z||e[46]!==U?(H=o.jsxs(Qe,{className:"text-destructive focus:text-destructive",onClick:z,children:[$,U]}),e[45]=z,e[46]=U,e[47]=H):H=e[47];let W;e[48]!==M||e[49]!==H?(W=o.jsxs(Bt,{align:"end",children:[M,H]}),e[48]=M,e[49]=H,e[50]=W):W=e[50];let K;e[51]!==I||e[52]!==W?(K=o.jsxs(Ot,{children:[I,W]}),e[51]=I,e[52]=W,e[53]=K):K=e[53];let G;return e[54]!==f||e[55]!==n||e[56]!==p||e[57]!==l||e[58]!==m||e[59]!==_||e[60]!==N||e[61]!==A||e[62]!==K||e[63]!==y||e[64]!==S||e[65]!==j?(G=o.jsxs("div",{ref:m,style:_,...f,...p,role:"button",tabIndex:0,onClick:l,onKeyDown:y,className:S,title:n,children:[k,j,N,A,K]}),e[54]=f,e[55]=n,e[56]=p,e[57]=l,e[58]=m,e[59]=_,e[60]=N,e[61]=A,e[62]=K,e[63]=y,e[64]=S,e[65]=j,e[66]=G):G=e[66],G}function iie(t){return t.stopPropagation()}function rie(t){return t.stopPropagation()}function oie(t){return t.stopPropagation()}function aie(){return!1}function lie(t,e,s,n,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const r=t.__resolveType;if(typeof r=="string"&&s){const a=In(r,s);if(a?.properties&&Object.keys(a.properties).length>0)return a}}if(s&&n&&i){const a=In(n,s)?.properties?.[i]?.items;if(a?.properties&&Object.keys(a.properties).length>0)return{...a,titleBy:a.titleBy??e?.titleBy}}return e}function cie(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function ph({schema:t,value:e,onChange:s,path:n,label:i,breadcrumbPath:r=[],onBreadcrumbChange:a,hasSiblingDrillDownFields:l,meta:c,decofile:d,onSaveReferencedBlock:h,containerResolveType:u,previewBaseUrl:f,onAddSectionItem:p,onRequestAddSection:m,sandbox:g}){const x=ae(),b=q9(g?.virtualMcpId),v=Array.isArray(e)?e:[],L=t.items,_=cie(n),y={arrayKey:_,hasSiblingDrillDownFields:l,itemLabelFromSchema:!!(L?.titleBy||L?.inlineUnionBranches?.length)},w=Yne(t,_),S=!w&&L?.type==="object",[k,j]=T.useState(null),C=qne(i,r,v,L,k,_),V=C?.index??null;C===null?k!==null&&j(null):C.index!==k&&j(C.index);const[N,A]=T.useState(()=>sv(v.length)),[P,R]=T.useState(null),[E,I]=T.useState(n),[D,O]=T.useState(v.length),B=T.useRef(!1),M=T.useRef(null);E!==n?(I(n),O(v.length),A(sv(v.length)),j(null)):D!==v.length&&(O(v.length),A(ie=>Qne(ie,v.length)));const z=(ie,he)=>Mk(Ec(ie),he,L),$=ie=>{if(B.current)return;const he=z(v[ie],ie);j(ie),a?.(mh(r,i,he,ie,y))},U=ie=>{const he=[...v,ie];s(he);const ue=he.length-1;j(ue);const ce=z(ie,ue);a?.(mh(r,i,ce,ue,y))},H=()=>{const ie=L?.type,he=L?.default!==void 0?L.default:ie==="object"?{}:ie==="block-ref"?(()=>{const q=L?.anyOfRefs?.[0]?.resolveType;return typeof q!="string"||fu(q)?{}:{__resolveType:q}})():ie==="number"||ie==="integer"?0:ie==="boolean"?!1:ie==="array"?[]:"",ue=[...v,he];s(ue);const ce=ue.length-1;j(ce);const ne=z(he,ce);a?.(mh(r,i,ne,ce,y))},W=()=>{if(w){if(!f){ye.error(x("sectionsEditor.arrayField.startPreviewServer"));return}if(m){m({append:U});return}ye.error(x("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}H()},K=ie=>{const he=v[ie],ue=typeof structuredClone=="function"?structuredClone(he):JSON.parse(JSON.stringify(he??null)),ce=[...v.slice(0,ie+1),ue,...v.slice(ie+1)];s(ce),A(ne=>Xne(ne,ie))},G=ie=>{const he=v[ie],ue=[...v];ue[ie]=mu(he)?Vk(he):qb(he),s(ue)},Y=ie=>{s(v.filter((he,ue)=>ue!==ie)),A(he=>Jne(he,ie))},Z=(ie,he)=>{const ue=[...v];if(ue[ie]=mu(v[ie])?qb(he):he,s(ue),ie===V&&C){const ce=z(v[ie],ie),ne=z(ue[ie],ie);if(M.current={path:n,index:ie,label:ne},ce!==ne){const q=[...r];q[C.crumbIndex]=Zb(r[C.crumbIndex],ne,ie),a?.(q)}}},te=r3(Qc(_0,{activationConstraint:{distance:8}}),Qc(y0,{coordinateGetter:m3})),X=N.map(ie=>ie.id),ee=ie=>{R(String(ie.active.id))},J=ie=>{R(null);const{active:he,over:ue}=ie;if(!ue||he.id===ue.id)return;const ce=X.indexOf(String(he.id)),ne=X.indexOf(String(ue.id));ce===-1||ne===-1||(A(q=>zk(Xc([...q],ce,ne))),s(Xc([...v],ce,ne)),B.current=!0,requestAnimationFrame(()=>{B.current=!1}))},Q=()=>{R(null)},oe=P?N.find(ie=>ie.id===P):null,le=oe!=null?v[oe.index]:void 0,de=oe!=null&&le!==void 0?Nf(v,L)[oe.index]:null,se=oe!=null&&le!==void 0?Qb(Ec(le),L):void 0;if(V!==null&&V<v.length){const ie=Ec(v[V]),he=lie(ie,L,c,u,_),ue=()=>{if(!C)return mh(r,i,z(ie,V),V,y);const ce=r.slice(0,C.crumbIndex+1),ne=M.current,q=ne?.path===n&&ne.index===V?ne.label:z(ie,V);return ce[C.crumbIndex]=Zb(ce[C.crumbIndex],q,V),ce};return o.jsx("div",{className:"min-w-0",children:he?.type==="object"&&he.properties?o.jsx(Bi,{schema:he,value:ie,onChange:ce=>Z(V,ce),basePath:`${n}.${V}`,breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:ce=>{a?.([...ue(),...ce])},meta:c,decofile:d,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:p,onRequestAddSection:m,sandbox:g}):he?Ya({schema:he,value:ie,onChange:ce=>Z(V,ce),path:`${n}.${V}`,required:!0,label:he.title&&!he.title.includes("{{")?he.title:z(ie,V),breadcrumbPath:C?.innerPath??[],onBreadcrumbChange:ce=>{a?.([...ue(),...ce])},meta:c,decofile:d,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:p,onRequestAddSection:m,sandbox:g}):null})}return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx(o4,{description:t.description,virtualMcpId:g?.virtualMcpId,children:o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:i})}),v.length>0&&o.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:v.length})]}),!b&&t.description&&o.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:t.description}),v.length>0&&o.jsx("div",{className:re(P&&"cursor-grabbing"),children:o.jsxs(c3,{sensors:te,collisionDetection:jL,onDragStart:ee,onDragEnd:J,onDragCancel:Q,children:[o.jsx(h3,{items:X,strategy:u3,children:o.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const ie=Nf(v,L);return N.map(he=>{const ue=v[he.index];if(ue===void 0)return null;const ce=ie[he.index]??z(ue,he.index),ne=Qb(Ec(ue),L);return o.jsx(nie,{sortableId:he.id,labelText:ce,imageSrc:ne,hidden:mu(ue),onToggleHidden:S?()=>G(he.index):void 0,onOpen:()=>$(he.index),onDuplicate:()=>K(he.index),onRemove:()=>Y(he.index)},he.id)})})()})}),Kn.createPortal(o.jsx(d3,{dropAnimation:Ck,children:de?o.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:o.jsx(sie,{labelText:de,imageSrc:se})}):null}),document.body)]})}),o.jsxs("button",{type:"button",onClick:W,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30 disabled:pointer-events-none disabled:opacity-50",children:[o.jsx(Qt,{size:14}),x(w?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function die(t){const e=F.c(53),{schema:s,value:n,onChange:i,path:r,label:a,breadcrumbPath:l,onBreadcrumbChange:c,focused:d,meta:h,decofile:u,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:m,onRequestAddSection:g,sandbox:x}=t;let b;e[0]!==l?(b=l===void 0?[]:l,e[0]=l,e[1]=b):b=e[1];const v=b,[L,_]=T.useState(!1),y=q9(x?.virtualMcpId);let w;e[2]!==n?(w=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=w):w=e[3];const S=w;if(!s.properties)return null;let k;e[4]!==v||e[5]!==u||e[6]!==h||e[7]!==S||e[8]!==m||e[9]!==c||e[10]!==i||e[11]!==g||e[12]!==f||e[13]!==r||e[14]!==p||e[15]!==x||e[16]!==s?(k=o.jsx(Bi,{schema:s,value:S,onChange:i,basePath:r,breadcrumbPath:v,onBreadcrumbChange:c,meta:h,decofile:u,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:m,onRequestAddSection:g,sandbox:x}),e[4]=v,e[5]=u,e[6]=h,e[7]=S,e[8]=m,e[9]=c,e[10]=i,e[11]=g,e[12]=f,e[13]=r,e[14]=p,e[15]=x,e[16]=s,e[17]=k):k=e[17];const j=k;if(d)return j;let C;e[18]!==r?(C=r.split(".").pop()??r,e[18]=r,e[19]=C):C=e[19];const V=C;let N;e[20]!==v||e[21]!==u||e[22]!==V||e[23]!==a||e[24]!==h||e[25]!==S||e[26]!==s?(N=Wne(V,a,s,S,v,u,h),e[20]=v,e[21]=u,e[22]=V,e[23]=a,e[24]=h,e[25]=S,e[26]=s,e[27]=N):N=e[27];const P=L||N,R=`${r}-fields`;let E;e[28]===Symbol.for("react.memo_cache_sentinel")?(E=()=>_(uie),e[28]=E):E=e[28];let I;e[29]!==P?(I=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:P?o.jsx(hs,{size:16}):o.jsx(Ns,{size:16})}),e[29]=P,e[30]=I):I=e[30];const D=x?.virtualMcpId;let O;e[31]!==a?(O=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:a}),e[31]=a,e[32]=O):O=e[32];let B;e[33]!==s.description||e[34]!==O||e[35]!==D?(B=o.jsx(o4,{description:s.description,virtualMcpId:D,children:O}),e[33]=s.description,e[34]=O,e[35]=D,e[36]=B):B=e[36];let M;e[37]!==R||e[38]!==P||e[39]!==B||e[40]!==I?(M=o.jsxs("button",{type:"button","aria-expanded":P,"aria-controls":R,onClick:E,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[I,B]}),e[37]=R,e[38]=P,e[39]=B,e[40]=I,e[41]=M):M=e[41];let z;e[42]!==s.description||e[43]!==y?(z=!y&&s.description&&o.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:s.description}),e[42]=s.description,e[43]=y,e[44]=z):z=e[44];let $;e[45]!==R||e[46]!==j||e[47]!==P?($=P&&o.jsx("div",{id:R,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:j}),e[45]=R,e[46]=j,e[47]=P,e[48]=$):$=e[48];let U;return e[49]!==M||e[50]!==z||e[51]!==$?(U=o.jsxs("div",{className:"min-w-0 space-y-2",children:[M,z,$]}),e[49]=M,e[50]=z,e[51]=$,e[52]=U):U=e[52],U}function uie(t){return!t}function f3e(t,e,s,n,i){const r={...t[e]};if(i.length>1){const a=r.sections,l=[...a?.variants??[]];l[n]&&(l[n]={...l[n],value:s}),r.sections={...a,variants:l}}else r.sections=s;return r}function m3e(t){return structuredClone(t)}function p3e(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function Fk(t){const e=t.replace(/[^A-Za-z0-9_ -]/g,"").replace(/\s+/g," ").trim();return/^[A-Za-z]/.test(e)?e:e?`Block ${e}`:""}function h4(t,e){const s=t.trim();return s?s.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,s)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_ -]*$/.test(s)?null:"Use letters, numbers, spaces, hyphens, or underscores. Must start with a letter.":"Block name is required."}function f4(t){const e=F.c(61),{open:s,onOpenChange:n,defaultBlockId:i,isPending:r,onSubmit:a}=t,l=i===void 0?"":i,c=r===void 0?!1:r,[d,h]=T.useState(l),[u,f]=T.useState(s);s!==u&&(f(s),s&&h(l));let p;e[0]!==c||e[1]!==n?(p=z=>{!z&&!c&&n(!1)},e[0]=c,e[1]=n,e[2]=p):p=e[2];const m=p;let g;e[3]!==d||e[4]!==c||e[5]!==a?(g=async z=>{z.preventDefault();const $=d.trim();!$||c||await a($)},e[3]=d,e[4]=c,e[5]=a,e[6]=g):g=e[6];const x=g,b=ae();let v;e[7]!==b?(v=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=v):v=e[8];let L;e[9]!==v?(L=o.jsx(Kt,{children:v}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==b?(_=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=_):_=e[12];let y;e[13]!==_?(y=o.jsx(Mn,{children:_}),e[13]=_,e[14]=y):y=e[14];let w;e[15]!==L||e[16]!==y?(w=o.jsxs(cs,{children:[L,y]}),e[15]=L,e[16]=y,e[17]=w):w=e[17];let S;e[18]!==b?(S=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=z=>h(z.target.value),e[22]=j):j=e[22];let C;e[23]!==b?(C=b("sectionsEditor.makeReusableModal.blockNamePlaceholder"),e[23]=b,e[24]=C):C=e[24];let V;e[25]!==d||e[26]!==c||e[27]!==C?(V=o.jsx(vt,{id:"block-id",value:d,onChange:j,placeholder:C,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=C,e[28]=V):V=e[28];let N;e[29]!==k||e[30]!==V?(N=o.jsxs("div",{className:"py-4 space-y-2",children:[k,V]}),e[29]=k,e[30]=V,e[31]=N):N=e[31];let A;e[32]!==n?(A=()=>n(!1),e[32]=n,e[33]=A):A=e[33];let P;e[34]!==b?(P=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=P):P=e[35];let R;e[36]!==c||e[37]!==A||e[38]!==P?(R=o.jsx(me,{type:"button",variant:"outline",onClick:A,disabled:c,children:P}),e[36]=c,e[37]=A,e[38]=P,e[39]=R):R=e[39];let E;e[40]!==d||e[41]!==c?(E=!d.trim()||c,e[40]=d,e[41]=c,e[42]=E):E=e[42];let I;e[43]!==c||e[44]!==b?(I=c?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=I):I=e[45];let D;e[46]!==E||e[47]!==I?(D=o.jsx(me,{type:"submit",disabled:E,children:I}),e[46]=E,e[47]=I,e[48]=D):D=e[48];let O;e[49]!==R||e[50]!==D?(O=o.jsxs(qn,{children:[R,D]}),e[49]=R,e[50]=D,e[51]=O):O=e[51];let B;e[52]!==x||e[53]!==N||e[54]!==O||e[55]!==w?(B=o.jsx(zt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:x,children:[w,N,O]})}),e[52]=x,e[53]=N,e[54]=O,e[55]=w,e[56]=B):B=e[56];let M;return e[57]!==m||e[58]!==s||e[59]!==B?(M=o.jsx(Ft,{open:s,onOpenChange:m,children:B}),e[57]=m,e[58]=s,e[59]=B,e[60]=M):M=e[60],M}function hie(t){if(!t?.properties)return{};const e={};for(const[s,n]of Object.entries(t.properties))s.startsWith("__")||s==="@type"||(n.default!==void 0?e[s]=n.default:n.type==="boolean"?e[s]=!1:n.type==="string"?e[s]="":n.type==="number"||n.type==="integer"?e[s]=0:n.type==="object"&&(e[s]={}));return e}function fie(t){const e=F.c(13),{blockKey:s}=t,n=ae();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(jn,{size:11}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("sectionsEditor.anyOfField.global"),e[1]=n,e[2]=r):r=e[2];let a;e[3]!==r?(a=o.jsx(He,{asChild:!0,children:o.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[i,r]})}),e[3]=r,e[4]=a):a=e[4];let l;e[5]!==s||e[6]!==n?(l=n("sectionsEditor.anyOfField.globalLoaderTooltip",{blockKey:s}),e[5]=s,e[6]=n,e[7]=l):l=e[7];let c;e[8]!==l?(c=o.jsx(Ke,{side:"top",className:"max-w-[260px]",children:l}),e[8]=l,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=o.jsxs(We,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d}function mie(t){const e=F.c(36),{path:s,open:n,onOpenChange:i,title:r,nested:a,nestedBlockRef:l,globalBlockKey:c,onDetach:d,onMakeGlobal:h}=t,u=ae(),f=`${s}-loader-config`,p=l&&"ml-1";let m;e[0]!==p?(m=re("rounded-lg border border-border/80 bg-muted/30",p),e[0]=p,e[1]=m):m=e[1];let g;e[2]!==i||e[3]!==n?(g=()=>i(!n),e[2]=i,e[3]=n,e[4]=g):g=e[4];let x;e[5]!==n?(x=o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?o.jsx(hs,{size:16}):o.jsx(Ns,{size:16})}),e[5]=n,e[6]=x):x=e[6];let b;e[7]!==r?(b=o.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:r}),e[7]=r,e[8]=b):b=e[8];let v;e[9]!==c?(v=c&&o.jsx(fie,{blockKey:c}),e[9]=c,e[10]=v):v=e[10];let L;e[11]!==b||e[12]!==v?(L=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,v]}),e[11]=b,e[12]=v,e[13]=L):L=e[13];let _;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==L?(_=o.jsxs("button",{type:"button","aria-expanded":n,"aria-controls":f,onClick:g,className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg px-3 py-2.5 text-left",children:[x,L]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=L,e[19]=_):_=e[19];let y;e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==u?(y=(d||h)&&o.jsxs(Ot,{children:[o.jsx($t,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":u("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:o.jsx(Vi,{size:16})})}),o.jsxs(Bt,{align:"end",className:"w-48",children:[c&&d&&o.jsxs(Qe,{onClick:d,children:[o.jsx(zr,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.detach")]}),!c&&h&&o.jsxs(Qe,{onClick:h,children:[o.jsx(jn,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=h,e[23]=u,e[24]=y):y=e[24];let w;e[25]!==_||e[26]!==y?(w=o.jsxs("div",{className:"group flex w-full min-w-0 items-center gap-1 rounded-lg pr-2 transition-colors hover:bg-accent/50",children:[_,y]}),e[25]=_,e[26]=y,e[27]=w):w=e[27];let S;e[28]!==f||e[29]!==a||e[30]!==n?(S=n&&o.jsx("div",{id:f,className:"border-t border-border/60 px-4 pb-4 pt-3",children:o.jsx("div",{className:"border-l border-border/80 pl-4",children:a})}),e[28]=f,e[29]=a,e[30]=n,e[31]=S):S=e[31];let k;return e[32]!==w||e[33]!==S||e[34]!==m?(k=o.jsxs("div",{className:m,children:[w,S]}),e[32]=w,e[33]=S,e[34]=m,e[35]=k):k=e[35],k}function iv(t){const e=F.c(42),{schema:s,value:n,onChange:i,path:r,label:a,breadcrumbPath:l,onBreadcrumbChange:c,meta:d,decofile:h,onSaveReferencedBlock:u,sandbox:f,previewBaseUrl:p,onRequestAddSection:m}=t,g=ae(),x=(s.anyOfRefs??[]).filter(xie),b=h&&n?Ok(n,h):null,v=b?.data??n,L=b?null:Tk(v),_=L??v,y=yne(x,{savedBlockKey:b?.blockKey,editorValue:v}),w=y.length>0?_ne(v,y,b?.blockKey):y[0]?.resolveType??"",k=s.type==="block-ref"&&y.some(gie);let j;e[0]!==a||e[1]!==r?(j=a??(r.includes(".")?r.split(".")[0]:r),e[0]=a,e[1]=r,e[2]=j):j=e[2];const C=j;let V;e[3]!==l?(V=l??[],e[3]=l,e[4]=V):V=e[4];const N=V,A=k&&N.length>0&&kn(N[0])===C,P=A?N.slice(1):N,R=A?te=>{c?.([C,...te])}:c,[E,I]=T.useState(w),[D,O]=T.useState(w);D!==w&&(O(w),I(w));const[B,M]=T.useState(()=>wne(v,b?.blockKey)),[z,$]=T.useState(!1);if(y.length>0){const te=E||w;let X;e[5]!==te?(X=Pe=>Pe.resolveType===te,e[5]=te,e[6]=X):X=e[6];const ee=y.find(X),J=Gb(v,d,ee?.schema),Q=Lne(J??ee?.schema??null,s.discriminatorKey),oe=s.discriminatorKey,le=Pe=>{I(Pe);const pe=y.find(nt=>nt.resolveType===Pe),ke=Gb(v,d,pe?.schema),Te=new Set(Object.keys((ke??pe?.schema)?.properties??{})),we=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},Ne=Object.fromEntries(Object.entries(we).filter(nt=>{const[Fe]=nt;return Te.has(Fe)})),Oe={...hie(pe?.schema),...Ne};if(oe){const nt=pe?.discriminatorValue??Pe;i({...Oe,[oe]:nt});return}if(fu(Pe)){i(Oe);return}i({...Oe,__resolveType:Pe})};let de;e[7]!==te||e[8]!==oe||e[9]!==i?(de=Pe=>{if(oe||!fu(te)||Pe===null||typeof Pe!="object"||Array.isArray(Pe)){i(Pe);return}const{__resolveType:pe,...ke}=Pe;i(ke)},e[7]=te,e[8]=oe,e[9]=i,e[10]=de):de=e[10];const se=de,ie=Q?.properties?o.jsx(Bi,{schema:Q,value:_,onChange:Pe=>{if(b&&u){u(b.blockKey,Pe);return}if(L){i({...v,section:Pe});return}se(Pe)},basePath:r,breadcrumbPath:P,onBreadcrumbChange:R,meta:d,decofile:h,onSaveReferencedBlock:u,sandbox:f,previewBaseUrl:p,onRequestAddSection:m}):null;if(k&&ie&&P.length>0){let Pe;return e[11]!==ie?(Pe=o.jsx("div",{className:"min-w-0",children:ie}),e[11]=ie,e[12]=Pe):Pe=e[12],Pe}let he;e[13]!==r?(he=r.includes("."),e[13]=r,e[14]=he):he=e[14];const ue=he,ce=b?()=>{const{name:Pe,...pe}=b.data;i(pe)}:void 0,ne=!b&&!L&&!!u&&k&&!fu(te)&&te.includes("/"),q=_&&typeof _=="object"&&!Array.isArray(_)?_:{},fe=Pe=>{if(!u)return;const pe=Pe.trim(),ke=h4(pe,h??{});if(ke){ye.error(ke);return}u(pe,{...q,__resolveType:te,name:pe}),i({__resolveType:pe}),$(!1),ye.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:pe}))},ge=f?.virtualMcpId;let _e;e[15]!==a||e[16]!==r||e[17]!==s.description||e[18]!==ge?(_e=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:ge}),e[15]=a,e[16]=r,e[17]=s.description,e[18]=ge,e[19]=_e):_e=e[19];let Le;e[20]!==g?(Le=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=Le):Le=e[21];let je;e[22]!==Le?(je=o.jsx(Ss,{placeholder:Le}),e[22]=Le,e[23]=je):je=e[23];let Ce;return e[24]!==r||e[25]!==je?(Ce=o.jsx(bs,{id:r,className:"w-full min-w-0",children:je}),e[24]=r,e[25]=je,e[26]=Ce):Ce=e[26],o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[_e,o.jsxs(xs,{value:te||void 0,onValueChange:le,children:[Ce,o.jsx(vs,{children:y.map(pie)})]})]}),ie&&(k?o.jsx(mie,{path:r,open:B,onOpenChange:M,title:g(ue?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:ie,nestedBlockRef:ue,globalBlockKey:b?.blockKey,onDetach:ce,onMakeGlobal:ne?()=>$(!0):void 0}):ie),ne&&o.jsx(f4,{open:z,onOpenChange:$,defaultBlockId:Fk(gs(te)),onSubmit:fe})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const U=f?.virtualMcpId;let H;e[27]!==a||e[28]!==r||e[29]!==s.description||e[30]!==U?(H=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:U}),e[27]=a,e[28]=r,e[29]=s.description,e[30]=U,e[31]=H):H=e[31];const W=n!=null?String(n):"";let K;e[32]!==i?(K=te=>i(te.target.value),e[32]=i,e[33]=K):K=e[33];const G=s.description??"";let Y;e[34]!==r||e[35]!==W||e[36]!==K||e[37]!==G?(Y=o.jsx("input",{id:r,type:"text",value:W,onChange:K,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:G}),e[34]=r,e[35]=W,e[36]=K,e[37]=G,e[38]=Y):Y=e[38];let Z;return e[39]!==H||e[40]!==Y?(Z=o.jsxs("div",{className:"space-y-1.5",children:[H,Y]}),e[39]=H,e[40]=Y,e[41]=Z):Z=e[41],Z}function pie(t){const e=vne(t);return o.jsx(Rt,{value:t.resolveType,children:e},t.resolveType)}function gie(t){return t.resolveType.includes("/")&&!fu(t.resolveType)}function xie(t){return t.resolveType!==""}const X1=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function bie(t){const e={};if(typeof t!="string")return e;const s=/<symbol\b((?:[^>"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/symbol>/gi;for(const n of t.matchAll(s)){const i=n[1]??"",r=n[2]??"",a=X1(i,"id");if(!a)continue;const l=X1(i,"viewBox"),c=X1(i,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',l?`viewBox="${l}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[a]=`<svg ${d}>${r}</svg>`}return e}async function vie(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return bie(await e.text())}function yie(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)if(typeof s=="string")e.push({value:s,label:s});else if(s&&typeof s=="object"&&"value"in s){const n=s;e.push({value:String(n.value),label:typeof n.label=="string"?n.label:String(n.value),image:typeof n.image=="string"?n.image:void 0,icon:typeof n.icon=="string"?n.icon:void 0})}return e}function _ie(t){if(!Array.isArray(t))return[];const e=[];for(const s of t)typeof s=="string"&&e.push({value:s,label:s});return e}function Lie(t,e){return t.length>0?t:e}function wie(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function Sie({loaderPath:t,isIconSelect:e,enumFallbackCount:s,trimmedSearch:n,optionValues:i,optionsSettled:r}){return!!t&&!e&&s===0&&r&&n.length>0&&!i.includes(n)}function Uk(t,e){const n=`<style>${e?`svg{color:${e}}`:""}.fill-current{fill:currentColor}.stroke-current{stroke:currentColor}.text-current{color:currentColor}</style>`,i=t.replace(/(<svg[^>]*>)/i,`$1${n}`);return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function kie(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function jie(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return Uk(t.icon,e)}async function Cie(t,e,s){const n={};s&&(n.term=s);const r=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,a=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Failed to fetch dynamic options: ${a.status}`);const l=await a.json();return yie(l)}function rv(t){const e=F.c(9),{option:s,className:n,fg:i}=t;let r;e[0]!==i||e[1]!==s?(r=jie(s,i),e[0]=i,e[1]=s,e[2]=r):r=e[2];const a=r;if(!a)return null;const l=s.image?"rounded object-cover":"object-contain";let c;e[3]!==n||e[4]!==l?(c=re("shrink-0",l,n),e[3]=n,e[4]=l,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsx("img",{src:a,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Nie(t){const e=F.c(53),{schema:s,value:n,onChange:i,path:r,label:a,sandbox:l}=t,c=ae(),d=s.options,h=l?.previewUrl,[u,f]=T.useState(!1),[p,m]=T.useState(""),[g,x]=T.useState(""),b=T.useRef(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=se=>{m(se),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(se)},300)},e[0]=v):v=e[0];const L=v,_=l?`${l.orgSlug}/${l.virtualMcpId}/${l.branch}`:"",y=typeof n=="string"?n:"",w=s.format==="icon-select";let S;e[1]!==g||e[2]!==d||e[3]!==_?(S=tt.sandboxInvoke(_,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=_,e[4]=S):S=e[4];let k;e[5]!==g||e[6]!==d||e[7]!==h?(k=()=>Cie(h,d,g||void 0),e[5]=g,e[6]=d,e[7]=h,e[8]=k):k=e[8];const j=!!h&&!!d&&(u||!!y);let C;e[9]!==S||e[10]!==k||e[11]!==j?(C={queryKey:S,queryFn:k,enabled:j,staleTime:6e4,retry:1},e[9]=S,e[10]=k,e[11]=j,e[12]=C):C=e[12];const V=Yt(C),N=V.data??[];let A;e[13]!==_?(A=tt.sandboxSprite(_),e[13]=_,e[14]=A):A=e[14];let P;e[15]!==h||e[16]!==l?(P=()=>vie(kS({orgSlug:l.orgSlug,virtualMcpId:l.virtualMcpId,branch:l.branch,threadId:l.threadId,previewUrl:h},"/sprites.svg")),e[15]=h,e[16]=l,e[17]=P):P=e[17];const R=w&&!!l&&(u||!!y)&&(!d||V.isFetched&&N.length===0);let E;e[18]!==A||e[19]!==P||e[20]!==R?(E={queryKey:A,queryFn:P,enabled:R,staleTime:3e5,retry:1},e[18]=A,e[19]=P,e[20]=R,e[21]=E):E=e[21];const I=Yt(E),D=_ie(s.enum),O=I.data??{},B=kie(),M=Object.fromEntries(Object.entries(O).map(se=>{const[ie,he]=se;return[ie,Uk(he,B)]})),z=w&&Object.keys(M).length>0?D.map(se=>({...se,previewSrc:M[se.value]})):D,$=Lie(N,z),U=wie($,p);let H;e[22]!==y?(H=se=>se.value===y,e[22]=y,e[23]=H):H=e[23];const W=$.find(H),K=p.trim(),G=V.isFetched&&!V.isFetching&&p===g,Y=Sie({loaderPath:d,isIconSelect:w,enumFallbackCount:D.length,trimmedSearch:K,optionValues:$.map(Vie),optionsSettled:G});if((!h||!d)&&D.length===0){const se=l?.virtualMcpId;let ie;e[24]!==a||e[25]!==r||e[26]!==s.description||e[27]!==se?(ie=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:se}),e[24]=a,e[25]=r,e[26]=s.description,e[27]=se,e[28]=ie):ie=e[28];let he;e[29]!==i?(he=ne=>i(ne.target.value),e[29]=i,e[30]=he):he=e[30];let ue;e[31]!==y||e[32]!==r||e[33]!==he?(ue=o.jsx(vt,{id:r,type:"text",value:y,onChange:he}),e[31]=y,e[32]=r,e[33]=he,e[34]=ue):ue=e[34];let ce;return e[35]!==ie||e[36]!==ue?(ce=o.jsxs("div",{className:"space-y-2",children:[ie,ue]}),e[35]=ie,e[36]=ue,e[37]=ce):ce=e[37],ce}const te=l?.virtualMcpId;let X;e[38]!==a||e[39]!==r||e[40]!==s.description||e[41]!==te?(X=o.jsx(Us,{htmlFor:r,label:a,description:s.description,virtualMcpId:te}),e[38]=a,e[39]=r,e[40]=s.description,e[41]=te,e[42]=X):X=e[42];const ee=W?o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(rv,{option:W,className:"h-6 w-6",fg:B}),o.jsx("span",{className:"truncate",children:W.label??W.value})]}):y?o.jsx("span",{className:"truncate",children:y}):o.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let J;e[43]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(y9,{className:"size-4 shrink-0 opacity-50"}),e[43]=J):J=e[43];let Q;e[44]!==u||e[45]!==ee?(Q=o.jsx(ws,{asChild:!0,children:o.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":u,className:"h-10 w-full justify-between font-normal",children:[ee,J]})}),e[44]=u,e[45]=ee,e[46]=Q):Q=e[46];let oe;e[47]===Symbol.for("react.memo_cache_sentinel")?(oe={width:"var(--radix-popover-trigger-width)"},e[47]=oe):oe=e[47];let le;e[48]!==c?(le=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=le):le=e[49];let de;return e[50]!==p||e[51]!==le?(de=o.jsx(Mi,{placeholder:le,className:"h-9",value:p,onValueChange:L}),e[50]=p,e[51]=le,e[52]=de):de=e[52],o.jsxs("div",{className:"space-y-2",children:[X,o.jsxs(js,{open:u,onOpenChange:f,children:[Q,o.jsx(ks,{className:"p-0",style:oe,children:o.jsxs(vr,{shouldFilter:!1,children:[de,o.jsxs(Ii,{children:[!Y&&o.jsx(ri,{children:V.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),o.jsx(fn,{children:U.map(se=>o.jsxs($s,{value:se.value,className:"cursor-pointer",onSelect:()=>{i(se.value===y?"":se.value),f(!1)},children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(rv,{option:se,className:re(se.image?"h-9 w-9":"h-6 w-6"),fg:B}),o.jsx("span",{className:"truncate",children:se.label??se.value})]}),o.jsx(Gt,{className:re("ml-auto size-4 shrink-0",y===se.value?"opacity-100":"opacity-0")})]},se.value))}),Y&&o.jsx(fn,{children:o.jsx($s,{value:K,className:"cursor-pointer",onSelect:()=>{i(K),m(""),x(""),f(!1)},children:o.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:K})})})})]})]})})]})]})}function Vie(t){return t.value}function Hk(t){const e=F.c(17),{org:s}=Ue(),n=us();let i,r,a,l;e[0]!==s.id||e[1]!==t.configId||e[2]!==t.imageOnly||e[3]!==t.search?(r=t.search?.trim()||void 0,i=t.imageOnly??!1,l=w7,a=tt.filePickerObjects(s.id,t.configId,r,i),e[0]=s.id,e[1]=t.configId,e[2]=t.imageOnly,e[3]=t.search,e[4]=i,e[5]=r,e[6]=a,e[7]=l):(i=e[4],r=e[5],a=e[6],l=e[7]);const c=t.enabled!==!1&&!!t.configId;let d;e[8]!==i||e[9]!==t.configId||e[10]!==r||e[11]!==n?(d=async u=>{const{pageParam:f}=u;return await n.call("FILE_OBJECTS_LIST",{configId:t.configId,cursor:f??void 0,search:r,imageOnly:i||void 0})},e[8]=i,e[9]=t.configId,e[10]=r,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==a||e[14]!==c||e[15]!==d?(h={queryKey:a,enabled:c,staleTime:3e4,initialPageParam:null,queryFn:d,getNextPageParam:Tie},e[13]=a,e[14]=c,e[15]=d,e[16]=h):h=e[16],l(h)}function Tie(t){return t.nextCursor??void 0}function Y9(){const t=F.c(2),{org:e}=Ue();let s;return t[0]!==e?(s={mutationFn:async n=>{const i=n.file.type||"application/octet-stream",r=await fetch(`/api/${encodeURIComponent(e.slug)}/file-configs/${encodeURIComponent(n.configId)}/upload?filename=${encodeURIComponent(n.file.name)}`,{method:"POST",headers:{"Content-Type":i},body:n.file});if(!r.ok){const a=await r.text().catch(Aie);let l=`${r.status} ${r.statusText}`;try{const c=JSON.parse(a);c.message&&(l=c.message)}catch{a&&(l=a.slice(0,200))}throw new Error(`Upload failed: ${l}`)}return await r.json()}},t[0]=e,t[1]=s):s=t[1],Ds(s)}function Aie(){return""}function Pie(){const t=F.c(8),{org:e}=Ue(),s=us(),n=Vs();let i;t[0]!==s?(i=l=>s.call("FILE_OBJECT_DELETE",l),t[0]=s,t[1]=i):i=t[1];let r;t[2]!==e||t[3]!==n?(r=(l,c)=>{n.invalidateQueries({queryKey:tt.filePickerObjectsByConfig(e.id,c.configId)})},t[2]=e,t[3]=n,t[4]=r):r=t[4];let a;return t[5]!==i||t[6]!==r?(a={mutationFn:i,onSuccess:r},t[5]=i,t[6]=r,t[7]=a):a=t[7],Ds(a)}function m4(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function Kk(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function Af(t){const e=t.split("/");return e[e.length-1]??t}function Wk(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const Q9="file-picker:last-config-id";function qk(t){const e=F.c(31),s=ae(),n=t.open,i=t.onOpenChange;let r;e[0]!==t.mode||e[1]!==s?(r=t.mode==="image"?s("filePicker.filePickerDialog.pickAnImage"):s("filePicker.filePickerDialog.pickAFile"),e[0]=t.mode,e[1]=s,e[2]=r):r=e[2];let a;e[3]!==r?(a=o.jsx(Kt,{children:r}),e[3]=r,e[4]=a):a=e[4];let l;e[5]!==s?(l=s("filePicker.filePickerDialog.description"),e[5]=s,e[6]=l):l=e[6];let c;e[7]!==l?(c=o.jsx(Mn,{children:l}),e[7]=l,e[8]=c):c=e[8];let d;e[9]!==a||e[10]!==c?(d=o.jsxs(cs,{children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11];let h;e[12]!==s?(h=b=>{const{error:v}=b;return o.jsx(Eie,{error:v??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=h):h=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(en,{className:"h-64 w-full"}),e[14]=u):u=e[14];let f;e[15]!==t?(f=b=>{t.onSelect(b),t.onOpenChange(!1)},e[15]=t,e[16]=f):f=e[16];let p;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==f?(p=o.jsx(T.Suspense,{fallback:u,children:o.jsx(Rie,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:f})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=f,e[20]=p):p=e[20];let m;e[21]!==p||e[22]!==h?(m=o.jsx(tn,{fallback:h,children:p}),e[21]=p,e[22]=h,e[23]=m):m=e[23];let g;e[24]!==m||e[25]!==d?(g=o.jsxs(zt,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[d,m]}),e[24]=m,e[25]=d,e[26]=g):g=e[26];let x;return e[27]!==t.onOpenChange||e[28]!==t.open||e[29]!==g?(x=o.jsx(Ft,{open:n,onOpenChange:i,children:g}),e[27]=t.onOpenChange,e[28]=t.open,e[29]=g,e[30]=x):x=e[30],x}function Eie(t){const e=F.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(vn,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=o.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,o.jsx("span",{className:"text-sm font-medium",children:s.message})]}),e[1]=s.message,e[2]=i):i=e[2],i}function Rie(t){const e=F.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,r=L7();if(r.length===0){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Iie,{}),e[0]=m):m=e[0],m}if(n){let m;if(e[1]!==r||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],m=r.find(x),e[1]=r,e[2]=n,e[3]=m}else m=e[3];const g=m;if(g){let x;return e[6]!==g||e[7]!==s||e[8]!==i?(x=o.jsx(J1,{config:g,mode:s,onSelect:i}),e[6]=g,e[7]=s,e[8]=i,e[9]=x):x=e[9],x}}if(r.length===1){const m=r[0];let g;return e[10]!==m||e[11]!==s||e[12]!==i?(g=o.jsx(J1,{config:m,mode:s,onSelect:i}),e[10]=m,e[11]=s,e[12]=i,e[13]=g):g=e[13],g}let a;e[14]===Symbol.for("react.memo_cache_sentinel")?(a=typeof window<"u"?window.localStorage.getItem(Q9):null,e[14]=a):a=e[14];const l=a;let c;e[15]!==r?(c=r.find(m=>m.id===l)?.id??r[0].id,e[15]=r,e[16]=c):c=e[16];const d=c;let h;e[17]!==r?(h=r.map(Die),e[17]=r,e[18]=h):h=e[18];let u;e[19]!==h?(u=o.jsx(t0,{className:"self-start",children:h}),e[19]=h,e[20]=u):u=e[20];let f;if(e[21]!==r||e[22]!==s||e[23]!==i){let m;e[25]!==s||e[26]!==i?(m=g=>o.jsx(Pa,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:o.jsx(J1,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=m):m=e[27],f=r.map(m),e[21]=r,e[22]=s,e[23]=i,e[24]=f}else f=e[24];let p;return e[28]!==d||e[29]!==u||e[30]!==f?(p=o.jsxs(ad,{defaultValue:d,onValueChange:Mie,className:"min-h-0 flex-1 flex flex-col",children:[u,f]}),e[28]=d,e[29]=u,e[30]=f,e[31]=p):p=e[31],p}function Die(t){return o.jsx(or,{value:t.id,children:t.name},t.id)}function Mie(t){typeof window<"u"&&window.localStorage.setItem(Q9,t)}function Iie(){const t=F.c(12),e=ae();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:o.jsx(Gn,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noBucketConfigured"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"font-medium text-sm",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let a;t[7]!==r?(a=o.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:r}),t[7]=r,t[8]=a):a=t[8];let l;return t[9]!==i||t[10]!==a?(l=o.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[s,o.jsxs("div",{children:[i,a]})]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}function J1({config:t,mode:e,onSelect:s}){const n=ae(),[i,r]=T.useState(""),a=L9(i,300),l=Hk({configId:t.id,search:a,imageOnly:e==="image"}),c=Y9(),[d,h]=T.useState(!1),u=T.useRef(null),f=e==="image"?"image/*":void 0;async function p(S){if(!S)return;const k=Array.from(S);if(k.length===0)return;let j=null;const C=[];for(const V of k)try{const N=await c.mutateAsync({configId:t.id,file:V});j??=N.publicUrl}catch(N){C.push(`${V.name} (${N instanceof Error?N.message:"upload failed"})`)}await l.refetch(),C.length>0&&ye.error(C.length===k.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:C.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:C.join("; ")})),j&&s(j)}function m(S){S.preventDefault(),h(!0)}function g(){h(!1)}function x(S){S.preventDefault(),S.stopPropagation(),h(!1),p(S.dataTransfer.files)}const v=(l.data?.pages??[]).flatMap(S=>S.items),L=v.filter(S=>e==="image"?m4(S.key):!0),_=a.trim(),y=v.length>0||i.trim().length>0,w=i!==a||l.isFetching&&!l.isFetchingNextPage;return o.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[o.jsxs("button",{type:"button",onClick:()=>u.current?.click(),onDragOver:m,onDragLeave:g,onDrop:x,className:re("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",d&&"border-primary bg-primary/5",c.isPending&&"opacity-60 pointer-events-none"),children:[o.jsx(Gn,{size:18,className:"text-muted-foreground"}),o.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),o.jsx("input",{ref:u,type:"file",accept:f,multiple:!0,className:"hidden",onChange:S=>{const k=Array.from(S.target.files??[]);S.target.value="",p(k)}})]}),y?o.jsx(b9,{value:i,onChange:r,isSearching:w,placeholder:n(e==="image"?"filePicker.filePickerDialog.searchImagesPlaceholder":"filePicker.filePickerDialog.searchFilesPlaceholder"),className:"shrink-0"}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[L.length===0?_?o.jsx(Bie,{query:_}):e==="image"&&v.length>0?o.jsx($ie,{}):o.jsx(Oie,{}):e==="image"?o.jsx(zie,{items:L,onSelect:s}):o.jsx(Fie,{items:L,onSelect:s}),l.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(me,{type:"button",variant:"outline",size:"sm",disabled:l.isFetchingNextPage,onClick:()=>l.fetchNextPage(),children:l.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function Oie(){const t=F.c(12),e=ae();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ni,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noFilesYet"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.dropFileToGetStarted"),t[5]=e,t[6]=r):r=t[6];let a;t[7]!==r?(a=o.jsx("p",{className:"text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=a):a=t[8];let l;return t[9]!==i||t[10]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,i,a]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}function $ie(){const t=F.c(12),e=ae();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ni,{size:18,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("filePicker.filePickerDialog.noImagesYet"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("filePicker.filePickerDialog.noImagesFormatDesc"),t[5]=e,t[6]=r):r=t[6];let a;t[7]!==r?(a=o.jsx("p",{className:"text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=a):a=t[8];let l;return t[9]!==i||t[10]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[s,i,a]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}function Bie(t){const e=F.c(13),{query:s}=t,n=ae();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ni,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s||e[2]!==n?(r=n("filePicker.filePickerDialog.noMatches",{query:s}),e[1]=s,e[2]=n,e[3]=r):r=e[3];let a;e[4]!==r?(a=o.jsx("p",{className:"text-sm font-medium",children:r}),e[4]=r,e[5]=a):a=e[5];let l;e[6]!==n?(l=n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore"),e[6]=n,e[7]=l):l=e[7];let c;e[8]!==l?(c=o.jsx("p",{className:"text-xs text-muted-foreground",children:l}),e[8]=l,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d}function zie(t){const e=F.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let a;e[3]!==n?(a=l=>o.jsx(Gk,{item:l,variant:"image",onSelect:n},l.key),e[3]=n,e[4]=a):a=e[4],i=s.map(a),e[0]=s,e[1]=n,e[2]=i}else i=e[2];let r;return e[5]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=r):r=e[6],r}function Fie(t){const e=F.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let a;e[3]!==n?(a=l=>o.jsx("li",{children:o.jsx(Gk,{item:l,variant:"row",onSelect:n})},l.key),e[3]=n,e[4]=a):a=e[4],i=s.map(a),e[0]=s,e[1]=n,e[2]=i}else i=e[2];let r;return e[5]!==i?(r=o.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=r):r=e[6],r}function Gk(t){const e=F.c(58),{item:s,variant:n,onSelect:i}=t;let r;e[0]!==s.key?(r=Kk(s.key),e[0]=s.key,e[1]=r):r=e[1];const a=r;if(n==="image"){let L;e[2]!==s.publicUrl||e[3]!==i?(L=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=L):L=e[4];let _;e[5]!==s.key||e[6]!==s.publicUrl?(_=o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:Uie}),e[5]=s.key,e[6]=s.publicUrl,e[7]=_):_=e[7];let y;e[8]!==s.key||e[9]!==L||e[10]!==_?(y=o.jsx("button",{type:"button",onClick:L,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:_}),e[8]=s.key,e[9]=L,e[10]=_,e[11]=y):y=e[11];let w;e[12]!==a?(w=o.jsx("span",{className:"pointer-events-none absolute left-1.5 top-1.5 rounded bg-background/80 px-1.5 py-0.5 text-[10px] font-medium uppercase text-foreground opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100",children:a}),e[12]=a,e[13]=w):w=e[13];let S;e[14]!==s||e[15]!==i?(S=o.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(ov,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=S):S=e[16];let k;e[17]!==s.key?(k=Af(s.key),e[17]=s.key,e[18]=k):k=e[18];let j;e[19]!==k?(j=o.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx("p",{className:"truncate text-xs text-white",children:k})}),e[19]=k,e[20]=j):j=e[20];let C;return e[21]!==y||e[22]!==w||e[23]!==S||e[24]!==j?(C=o.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[y,w,S,j]}),e[21]=y,e[22]=w,e[23]=S,e[24]=j,e[25]=C):C=e[25],C}let l;e[26]!==s.publicUrl||e[27]!==i?(l=()=>i(s.publicUrl),e[26]=s.publicUrl,e[27]=i,e[28]=l):l=e[28];let c;e[29]!==s.key?(c=o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:m4(s.key)?o.jsx(ni,{size:16,className:"text-muted-foreground"}):o.jsx(Ai,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=Af(s.key),e[31]=s.key,e[32]=d):d=e[32];let h;e[33]!==d?(h=o.jsx("p",{className:"truncate text-sm font-medium",children:d}),e[33]=d,e[34]=h):h=e[34];let u;e[35]!==s.key?(u=o.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:s.key}),e[35]=s.key,e[36]=u):u=e[36];let f;e[37]!==h||e[38]!==u?(f=o.jsxs("div",{className:"min-w-0 flex-1",children:[h,u]}),e[37]=h,e[38]=u,e[39]=f):f=e[39];let p;e[40]!==a?(p=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:a}),e[40]=a,e[41]=p):p=e[41];let m;e[42]!==s.size?(m=Wk(s.size),e[42]=s.size,e[43]=m):m=e[43];let g;e[44]!==m?(g=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:m}),e[44]=m,e[45]=g):g=e[45];let x;e[46]!==g||e[47]!==l||e[48]!==c||e[49]!==f||e[50]!==p?(x=o.jsxs("button",{type:"button",onClick:l,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[c,f,p,g]}),e[46]=g,e[47]=l,e[48]=c,e[49]=f,e[50]=p,e[51]=x):x=e[51];let b;e[52]!==s||e[53]!==i?(b=o.jsx(ov,{item:s,onSelect:i}),e[52]=s,e[53]=i,e[54]=b):b=e[54];let v;return e[55]!==x||e[56]!==b?(v=o.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[x,b]}),e[55]=x,e[56]=b,e[57]=v):v=e[57],v}function Uie(t){t.target.style.display="none"}function ov(t){const e=F.c(39),{item:s,onSelect:n}=t,i=ae(),[r,a]=T.useState(!1);let l;e[0]!==s.publicUrl||e[1]!==i?(l=async function(C){C.preventDefault(),C.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),a(!0),window.setTimeout(()=>a(!1),1500)}catch{ye.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=l):l=e[2];const c=l;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(c0,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx($t,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:Wie,"aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==s.publicUrl||e[9]!==n?(f=()=>n(s.publicUrl),e[8]=s.publicUrl,e[9]=n,e[10]=f):f=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Gt,{size:14}),e[11]=p):p=e[11];let m;e[12]!==i?(m=i("filePicker.filePickerDialog.useThis"),e[12]=i,e[13]=m):m=e[13];let g;e[14]!==f||e[15]!==m?(g=o.jsxs(Qe,{onClick:f,children:[p,m]}),e[14]=f,e[15]=m,e[16]=g):g=e[16];let x;e[17]!==r?(x=r?o.jsx(Gt,{size:14}):o.jsx(bn,{size:14}),e[17]=r,e[18]=x):x=e[18];let b;e[19]!==r||e[20]!==i?(b=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[19]=r,e[20]=i,e[21]=b):b=e[21];let v;e[22]!==c||e[23]!==b||e[24]!==x?(v=o.jsxs(Qe,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=v):v=e[25];const L=s.publicUrl;let _;e[26]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(hn,{size:14}),e[26]=_):_=e[26];let y;e[27]!==i?(y=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=y):y=e[28];let w;e[29]!==s.publicUrl||e[30]!==y?(w=o.jsx(Qe,{asChild:!0,children:o.jsxs("a",{href:L,target:"_blank",rel:"noreferrer",onClick:Hie,children:[_,y]})}),e[29]=s.publicUrl,e[30]=y,e[31]=w):w=e[31];let S;e[32]!==v||e[33]!==w||e[34]!==g?(S=o.jsxs(Bt,{align:"end",onClick:Kie,children:[g,v,w]}),e[32]=v,e[33]=w,e[34]=g,e[35]=S):S=e[35];let k;return e[36]!==S||e[37]!==u?(k=o.jsxs(Ot,{children:[u,S]}),e[36]=S,e[37]=u,e[38]=k):k=e[38],k}function Hie(t){return t.stopPropagation()}function Kie(t){return t.stopPropagation()}function Wie(t){return t.stopPropagation()}function Yk(){const t=F.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:o.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:[o.jsx(Gn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function Qk(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Xk(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const qie=["low","medium","high","original"];function Jk(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function Zk(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=Gie(t);for(const n of s){const i=n.indexOf("=");if((i>=0?n.slice(0,i):n)===e)return i>=0?n.slice(i+1):""}return null}}function ej(t,e,s){const n=t.indexOf("#"),i=n>=0?t.slice(n):"",r=n>=0?t.slice(0,n):t,a=r.indexOf("?"),l=a>=0?r.slice(0,a):r,c=(a>=0?r.slice(a+1).split("&"):[]).filter(Boolean).filter(d=>{const h=d.indexOf("=");return(h>=0?d.slice(0,h):d)!==e});return s!==void 0&&c.push(`${e}=${s}`),`${l}${c.length?`?${c.join("&")}`:""}${i}`}function Gie(t){const e=t.indexOf("#"),s=e>=0?t.slice(0,e):t,n=s.indexOf("?");return n<0?[]:s.slice(n+1).split("&").filter(Boolean)}function Yie(t){if(!t)return;const e=Zk(t,"quality");return Jk(e)?e:void 0}function Qie(t,e){return ej(t,"quality",e)}function Xie(t){return t?Zk(t,"muted")!=="false":!0}function Jie(t,e){return ej(t,"muted",e?void 0:"false")}function tj(t){const e=F.c(36),{value:s,onChange:n,showMuted:i}=t,r=i===void 0?!1:i,a=ae(),l=T.useId();let c;e[0]!==s?(c=Yie(s),e[0]=s,e[1]=c):c=e[1];const d=c;let h;e[2]!==s?(h=Xie(s),e[2]=s,e[3]=h):h=e[3];const u=h;let f;e[4]!==a?(f=a("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=a,e[5]=f):f=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(c0,{size:14}),e[6]=p):p=e[6];let m;e[7]!==f?(m=o.jsx(ws,{asChild:!0,children:o.jsx(me,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":f,children:p})}),e[7]=f,e[8]=m):m=e[8];let g;e[9]!==a?(g=a("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=a,e[10]=g):g=e[10];let x;e[11]!==g?(x=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let v;e[13]!==n||e[14]!==s?(v=j=>n(Qie(s,Jk(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=v):v=e[15];let L;e[16]===Symbol.for("react.memo_cache_sentinel")?(L=qie.map(Zie),e[16]=L):L=e[16];let _;e[17]!==v||e[18]!==b?(_=o.jsx(d9,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:v,children:L}),e[17]=v,e[18]=b,e[19]=_):_=e[19];let y;e[20]!==_||e[21]!==x?(y=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,_]}),e[20]=_,e[21]=x,e[22]=y):y=e[22];let w;e[23]!==u||e[24]!==l||e[25]!==n||e[26]!==r||e[27]!==a||e[28]!==s?(w=r&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(Mt,{htmlFor:l,className:"text-xs text-muted-foreground",children:a("sectionsEditor.mediaTransformControls.mutedLabel")}),o.jsx(lo,{id:l,checked:u,onCheckedChange:j=>n(Jie(s,j))})]}),e[23]=u,e[24]=l,e[25]=n,e[26]=r,e[27]=a,e[28]=s,e[29]=w):w=e[29];let S;e[30]!==y||e[31]!==w?(S=o.jsx(ks,{align:"end",className:"w-auto min-w-52 p-3",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[y,w]})}),e[30]=y,e[31]=w,e[32]=S):S=e[32];let k;return e[33]!==S||e[34]!==m?(k=o.jsxs(js,{children:[m,S]}),e[33]=S,e[34]=m,e[35]=k):k=e[35],k}function Zie(t){return o.jsx(Kc,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function sj(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function av(t){const e=F.c(2),{ext:s}=t;if(!s)return null;let n;return e[0]!==s?(n=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function ere(t){const e=F.c(81),{schema:s,value:n,onChange:i,path:r,label:a,sandbox:l}=t,c=ae(),d=s.format==="video-uri",h=d4(n),[u,f]=T.useState(!1),[p,m]=T.useState(!1),g=h?Qk(h):"",x=g?Xk(g):"",b=Eg(),v=Y9();let L;e[0]!==b.data?.configs?(L=b.data?.configs??[],e[0]=b.data?.configs,e[1]=L):L=e[1];const _=l?.siteSlug;let y;e[2]!==L||e[3]!==_?(y=h9(L,_),e[2]=L,e[3]=_,e[4]=y):y=e[4];const w=y;let S;e[5]!==b.data?.configs||e[6]!==d||e[7]!==w?.id||e[8]!==i||e[9]!==f||e[10]!==c||e[11]!==v?(S=async function(J){if(!J)return;let Q=Array.from(J);if(Q.length===0)return;if(d&&(Q=Q.filter(tre),Q.length===0)){ye.error(c("sectionsEditor.fileField.videoFileError"));return}const oe=sj(b.data?.configs??[],w?.id,typeof window<"u"?window.localStorage.getItem(Q9):null);if(!oe){f(!0);return}try{const le=await v.mutateAsync({configId:oe,file:Q[0]});i(le.publicUrl),Q.length>1&&ye.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:Q[0].name}))}catch(le){const de=le;ye.error(de instanceof Error?de.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=w?.id,e[8]=i,e[9]=f,e[10]=c,e[11]=v,e[12]=S):S=e[12];const k=S;let j;e[13]!==m?(j=function(J){J.preventDefault(),J.dataTransfer.types.includes("Files")&&m(!0)},e[13]=m,e[14]=j):j=e[14];const C=j;let V;e[15]!==m?(V=function(J){J.currentTarget===J.target&&m(!1)},e[15]=m,e[16]=V):V=e[16];const N=V;let A;e[17]!==k||e[18]!==m?(A=function(J){J.preventDefault(),J.stopPropagation(),m(!1),k(J.dataTransfer.files)},e[17]=k,e[18]=m,e[19]=A):A=e[19];const P=A,R=l?.virtualMcpId;let E;e[20]!==a||e[21]!==r||e[22]!==s.description||e[23]!==R?(E=o.jsx("div",{className:"min-w-0",children:o.jsx(Us,{htmlFor:r,label:a,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:R})}),e[20]=a,e[21]=r,e[22]=s.description,e[23]=R,e[24]=E):E=e[24];const I=p&&"border-primary ring-2 ring-primary/30",D=v.isPending&&"pointer-events-none opacity-60";let O;e[25]!==I||e[26]!==D?(O=re("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",I,D),e[25]=I,e[26]=D,e[27]=O):O=e[27];let B;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==h||e[33]!==c||e[34]!==v.isPending?(B=h?d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceVideoLabel"),className:"relative block h-40 w-full cursor-pointer overflow-hidden bg-black",children:[o.jsx("video",{src:h,preload:"metadata",className:"h-full w-full object-contain"},h),o.jsx(Yk,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx(Z4,{size:14,className:"shrink-0 text-muted-foreground"}),o.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:g}),o.jsx(av,{ext:x})]})]}):o.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceFileLabel"),className:"flex w-full cursor-pointer items-center gap-3 px-3 py-2.5 text-left hover:bg-muted/60",children:[o.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:o.jsx(Ai,{size:18,className:"text-muted-foreground"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:g}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:h})]}),o.jsx(av,{ext:x})]}):o.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[d?o.jsx(Z4,{size:20}):o.jsx(Ai,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:v.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.fileField.sizeLimit")})]}),e[28]=x,e[29]=g,e[30]=d,e[31]=f,e[32]=h,e[33]=c,e[34]=v.isPending,e[35]=B):B=e[35];let M;e[36]!==p||e[37]!==c?(M=p&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.fileField.dropToUpload")})}),e[36]=p,e[37]=c,e[38]=M):M=e[38];let z;e[39]!==N||e[40]!==C||e[41]!==P||e[42]!==O||e[43]!==B||e[44]!==M?(z=o.jsxs("div",{onDragOver:C,onDragLeave:N,onDrop:P,className:O,children:[B,M]}),e[39]=N,e[40]=C,e[41]=P,e[42]=O,e[43]=B,e[44]=M,e[45]=z):z=e[45];let $;e[46]!==i?($=ee=>i(ee.target.value),e[46]=i,e[47]=$):$=e[47];let U;e[48]!==r||e[49]!==h||e[50]!==$?(U=o.jsx(vt,{id:r,type:"url",value:h,onChange:$,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=r,e[49]=h,e[50]=$,e[51]=U):U=e[51];let H;e[52]!==f||e[53]!==h||e[54]!==c?(H=!h&&o.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[o.jsx(Gn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=h,e[54]=c,e[55]=H):H=e[55];let W;e[56]!==d||e[57]!==i||e[58]!==h?(W=d&&h&&o.jsx(tj,{value:h,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=h,e[59]=W):W=e[59];let K;e[60]!==i||e[61]!==h||e[62]!==c?(K=h&&o.jsx(me,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:o.jsx(rn,{size:14})}),e[60]=i,e[61]=h,e[62]=c,e[63]=K):K=e[63];let G;e[64]!==U||e[65]!==H||e[66]!==W||e[67]!==K?(G=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,H,W,K]}),e[64]=U,e[65]=H,e[66]=W,e[67]=K,e[68]=G):G=e[68];let Y;e[69]!==i?(Y=ee=>i(ee),e[69]=i,e[70]=Y):Y=e[70];const Z=w?.id??null;let te;e[71]!==u||e[72]!==f||e[73]!==Y||e[74]!==Z?(te=o.jsx(qk,{open:u,onOpenChange:f,mode:"any",onSelect:Y,lockedConfigId:Z}),e[71]=u,e[72]=f,e[73]=Y,e[74]=Z,e[75]=te):te=e[75];let X;return e[76]!==z||e[77]!==G||e[78]!==te||e[79]!==E?(X=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[E,z,G,te]}),e[76]=z,e[77]=G,e[78]=te,e[79]=E,e[80]=X):X=e[80],X}function tre(t){return t.type.startsWith("video/")}const sre=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function nre(t){const e=F.c(86),{schema:s,value:n,onChange:i,path:r,label:a,sandbox:l}=t,c=ae(),d=d4(n),[h,u]=T.useState(!1),[f,p]=T.useState(!1),[m,g]=T.useState(!1),[x,b]=T.useState(!1),v=d?Qk(d):"",L=v?Xk(v):"",_=Eg(),y=Y9();let w;e[0]!==_.data?.configs?(w=_.data?.configs??[],e[0]=_.data?.configs,e[1]=w):w=e[1];const S=l?.siteSlug;let k;e[2]!==w||e[3]!==S?(k=h9(w,S),e[2]=w,e[3]=S,e[4]=k):k=e[4];const j=k;let C;e[5]!==i||e[6]!==b||e[7]!==g?(C=function(se){g(!1),b(!1),i(se)},e[5]=i,e[6]=b,e[7]=g,e[8]=C):C=e[8];const V=C;let N;e[9]!==_.data?.configs||e[10]!==j?.id||e[11]!==u||e[12]!==V||e[13]!==c||e[14]!==y?(N=async function(se){if(!se)return;const ie=Array.from(se).filter(ire);if(ie.length===0){ye.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const he=sj(_.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(Q9):null);if(!he){u(!0);return}try{const ue=await y.mutateAsync({configId:he,file:ie[0]});V(ue.publicUrl),ie.length>1&&ye.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:ie[0].name}))}catch(ue){const ce=ue;ye.error(ce instanceof Error?ce.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=_.data?.configs,e[10]=j?.id,e[11]=u,e[12]=V,e[13]=c,e[14]=y,e[15]=N):N=e[15];const A=N;let P;e[16]!==p?(P=function(se){se.preventDefault(),se.dataTransfer.types.includes("Files")&&p(!0)},e[16]=p,e[17]=P):P=e[17];const R=P;let E;e[18]!==p?(E=function(se){se.currentTarget===se.target&&p(!1)},e[18]=p,e[19]=E):E=e[19];const I=E;let D;e[20]!==A||e[21]!==p?(D=function(se){se.preventDefault(),se.stopPropagation(),p(!1),A(se.dataTransfer.files)},e[20]=A,e[21]=p,e[22]=D):D=e[22];const O=D,B=l?.virtualMcpId;let M;e[23]!==a||e[24]!==r||e[25]!==s.description||e[26]!==B?(M=o.jsx("div",{className:"min-w-0",children:o.jsx(Us,{htmlFor:r,label:a,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:B})}),e[23]=a,e[24]=r,e[25]=s.description,e[26]=B,e[27]=M):M=e[27];const z=f&&"border-primary ring-2 ring-primary/30",$=y.isPending&&"pointer-events-none opacity-60";let U;e[28]!==z||e[29]!==$?(U=re("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",z,$),e[28]=z,e[29]=$,e[30]=U):U=e[30];let H;e[31]!==L||e[32]!==v||e[33]!==x||e[34]!==m||e[35]!==a||e[36]!==b||e[37]!==g||e[38]!==u||e[39]!==d||e[40]!==c||e[41]!==y.isPending?(H=d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>u(!0),"aria-label":c("sectionsEditor.imageField.replaceImage"),className:"relative block h-40 w-full cursor-pointer bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!x&&o.jsx("img",{src:d,alt:a,className:re("h-full w-full object-contain transition-opacity",!m&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[o.jsx(ni,{size:20}),o.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!m&&!x&&o.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),o.jsx(Yk,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:v}),L&&o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:L})]})]}):o.jsxs("button",{type:"button",onClick:()=>u(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[o.jsx(ni,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:y.isPending?c("sectionsEditor.imageField.uploading"):c("sectionsEditor.imageField.dropImageOrClickToBrowse")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[31]=L,e[32]=v,e[33]=x,e[34]=m,e[35]=a,e[36]=b,e[37]=g,e[38]=u,e[39]=d,e[40]=c,e[41]=y.isPending,e[42]=H):H=e[42];let W;e[43]!==f||e[44]!==c?(W=f&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.imageField.dropToUpload")})}),e[43]=f,e[44]=c,e[45]=W):W=e[45];let K;e[46]!==I||e[47]!==R||e[48]!==O||e[49]!==U||e[50]!==H||e[51]!==W?(K=o.jsxs("div",{onDragOver:R,onDragLeave:I,onDrop:O,className:U,children:[H,W]}),e[46]=I,e[47]=R,e[48]=O,e[49]=U,e[50]=H,e[51]=W,e[52]=K):K=e[52];let G;e[53]!==V?(G=de=>V(de.target.value),e[53]=V,e[54]=G):G=e[54];let Y;e[55]!==c?(Y=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=Y):Y=e[56];let Z;e[57]!==r||e[58]!==d||e[59]!==G||e[60]!==Y?(Z=o.jsx(vt,{id:r,type:"url",value:d,onChange:G,placeholder:Y,className:"h-9 min-w-0 flex-1"}),e[57]=r,e[58]=d,e[59]=G,e[60]=Y,e[61]=Z):Z=e[61];let te;e[62]!==u||e[63]!==d||e[64]!==c?(te=!d&&o.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:()=>u(!0),className:"h-9 shrink-0",children:[o.jsx(Gn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=u,e[63]=d,e[64]=c,e[65]=te):te=e[65];let X;e[66]!==V||e[67]!==d||e[68]!==c?(X=d&&o.jsxs(o.Fragment,{children:[o.jsx(tj,{value:d,onChange:V}),o.jsx(me,{type:"button",variant:"ghost",size:"sm",onClick:()=>V(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:o.jsx(rn,{size:14})})]}),e[66]=V,e[67]=d,e[68]=c,e[69]=X):X=e[69];let ee;e[70]!==Z||e[71]!==te||e[72]!==X?(ee=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[Z,te,X]}),e[70]=Z,e[71]=te,e[72]=X,e[73]=ee):ee=e[73];let J;e[74]!==V?(J=de=>V(de),e[74]=V,e[75]=J):J=e[75];const Q=j?.id??null;let oe;e[76]!==h||e[77]!==u||e[78]!==J||e[79]!==Q?(oe=o.jsx(qk,{open:h,onOpenChange:u,mode:"image",onSelect:J,lockedConfigId:Q}),e[76]=h,e[77]=u,e[78]=J,e[79]=Q,e[80]=oe):oe=e[80];let le;return e[81]!==M||e[82]!==K||e[83]!==ee||e[84]!==oe?(le=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[M,K,ee,oe]}),e[81]=M,e[82]=K,e[83]=ee,e[84]=oe,e[85]=le):le=e[85],le}function ire(t){return sre.has(t.type||"")}const rre="0 0 1080 1080",ore="matrix(1 0 0 1 540 540)",p4=[{code:"AC",name:"Acre",gTransform:"matrix(1 0 0 1 -248.53 -95.16)",pathTransform:"translate(-57.47, -224.1)",d:"M 30.47 237.77 L 28.39 237.73 L 28.93 235.92 L 28.72 235.09 L 28.47 234.6 L 27.22 233.9 L 27.08 233.45 L 27.35 232.3 L 26.58 230.35 L 25.49 229.71 L 19.89 228.46 L 12.55 228.27 L 12.82 227.71 L 15.31 225.45 L 16.2 224.22 L 16.49 223.02 L 16.27 221.79 L 15.59 220.88 L 14.76 220.44 L 13.08 217.49 L 12.31 217.05 L 11.41 216.86 L 10.28 215.73 L 9.36 213.35 L 7.36 211.82 L 6.38 208.2 L 5.51 206.56 L 3.63 205.48 L 3.55 204.31 L 4.36 204.41 L 4.78 203.89 L 4.85 203.22 L 4.65 202.8 L 2.53 201.87 L 2.17 201.21 L 0 199.32 L 0.04 198.95 L 0.66 198.9 L 1.16 197.58 L 1.15 196.27 L 4.16 195.88 L 4.66 195.49 L 4.44 194.14 L 3.27 192.57 L 3.27 192.57 L 21.22 200.05 L 44.88 205.71 L 57.02 208.85 L 83.46 223.02 L 111.97 235.15 L 111.97 235.15 L 114.94 236.41 L 114.94 236.41 L 114.64 236.89 L 113.07 237.55 L 110.98 239.14 L 108.12 241.93 L 106.47 242.79 L 105.81 242.61 L 104.28 242.79 L 104.23 243.35 L 102.31 244.65 L 100.23 245.64 L 98.79 247.47 L 98.35 248.65 L 97.74 248.93 L 96.57 248.18 L 95.81 248.05 L 93.44 248.1 L 92.76 248.36 L 92.13 248.81 L 91.77 249.67 L 89.33 253.15 L 85.56 254.4 L 84.72 255.09 L 82.78 255.6 L 81.75 255.63 L 81.83 253.52 L 80.47 253.72 L 76.92 252.95 L 71.68 252.48 L 66.59 252.86 L 65.93 252.28 L 63.66 252.11 L 60.1 253.94 L 57.37 254.56 L 55.69 253.89 L 54.29 252.45 L 52.65 253.61 L 52.69 236.06 L 52.74 234.96 L 53.21 234.25 L 53.28 231.9 L 53.02 231.02 L 53.99 229.84 L 54.47 228.7 L 53.31 228.9 L 50.34 231.49 L 48.74 232.5 L 46.68 234.88 L 44.73 235.55 L 44.08 236.63 L 42.27 237.62 z"},{code:"AL",name:"Alagoas",gTransform:"matrix(1 0 0 1 276.36 -86.82)",pathTransform:"translate(-582.36, -232.44)",d:"M 561.91 230.3 L 561.71 229.57 L 560.29 228.79 L 559.84 228.88 L 558.82 228.59 L 558.28 227.19 L 558.28 227.19 L 559.6 226.12 L 560.24 225.03 L 562.41 224.27 L 564.79 220.98 L 564.88 220.29 L 565.7 219.69 L 566.7 220.91 L 568.37 221.21 L 569.45 221.09 L 572 223.11 L 573.9 225.23 L 575.68 226.28 L 577.59 226.76 L 580.09 226.11 L 583.23 226.4 L 584.4 226.29 L 586.26 225.23 L 587.42 225.28 L 589.23 224.17 L 591.41 221.88 L 591.53 221.43 L 593.08 220.19 L 595.08 219.95 L 597.32 220.8 L 599.88 219.51 L 601.35 219.32 L 603.27 220.13 L 606.17 220.4 L 606.44 220.61 L 606.44 220.61 L 603.66 225.57 L 599.11 230.7 L 595.53 234.28 L 592.49 238.86 L 589.16 241.74 L 588.16 243.77 L 586.84 245.56 L 586.84 245.56 L 586.24 244.25 L 582.65 242.02 L 582.19 241.99 L 580.53 241.2 L 578.77 239.75 L 577.47 237.3 L 572.05 234.23 L 568.37 233.28 z"},{code:"AM",name:"Amazonas",gTransform:"matrix(1 0 0 1 -166.8 -178.05)",pathTransform:"translate(-139.2, -141.22)",d:"M 165.82 47.29 L 166.54 48.07 L 167.29 48.41 L 167.9 48.42 L 169.03 48 L 169.66 48.11 L 169.72 49.07 L 170.93 50.24 L 171.9 50.61 L 172.78 50.4 L 174.14 50.51 L 176.09 51.46 L 176.58 52.12 L 175.67 55.44 L 174.96 56.94 L 177.69 60.68 L 179.35 65.44 L 179.54 67.7 L 180.41 68.82 L 180.46 69.27 L 178.84 70.73 L 179.2 72.32 L 179.86 73.9 L 179.09 76.94 L 178.52 77.9 L 178.81 82.88 L 179.69 85.05 L 180.91 85.89 L 181.49 86.79 L 182.62 91.12 L 182.56 91.7 L 181.42 93.02 L 179.58 92.69 L 179.44 93.83 L 184.45 98.25 L 184.97 98.29 L 186.93 99.6 L 188.41 101.25 L 189.45 103.29 L 189.98 103.36 L 191.32 102.94 L 193.68 103.98 L 193.24 101.87 L 193.99 99.58 L 194.24 97.85 L 193.87 96.05 L 194.69 93.08 L 195.71 91.82 L 196.99 91.13 L 199.08 90.42 L 199.63 89.53 L 201.23 89.47 L 204.06 90.4 L 205.93 92.44 L 206.85 94.95 L 208.67 95.18 L 209.92 94.72 L 211.33 93.31 L 213.36 92.76 L 213.78 92.37 L 213.8 91.84 L 212.66 90.43 L 212.43 89.7 L 212.54 89.04 L 213.69 86.4 L 213.76 85.27 L 215.42 82.24 L 217.75 78.98 L 217.72 78.3 L 236.21 78.37 L 236.21 78.37 L 236.61 83.23 L 236.18 84.68 L 236.36 86.95 L 236.6 87.63 L 238.3 88.48 L 238.48 88.89 L 238.13 89.58 L 238.08 91.69 L 239.91 93.68 L 240.27 93.87 L 240.97 93.69 L 242.81 94.92 L 243.36 96.75 L 243.4 97.68 L 243.7 98.13 L 248.34 101.9 L 252.92 104.44 L 253.55 105.34 L 254.9 106.43 L 256.78 107.1 L 259.15 108.41 L 261.41 109.06 L 262.77 109.21 L 264.09 110.03 L 264.17 110.64 L 265.44 111.98 L 268.14 113.42 L 269.24 115.59 L 271.11 116.38 L 271.96 115.77 L 273.34 115.42 L 273.53 115.9 L 273.4 116.68 L 275.21 118.35 L 245.31 182.59 L 244.53 183.9 L 243.08 185.03 L 242.5 186 L 242.47 187.13 L 243.29 189.46 L 243.67 190.03 L 244.74 190.61 L 246.32 192.17 L 246.96 193.43 L 247.11 195.39 L 247.68 195.96 L 247.68 195.96 L 246.5 197.16 L 246.3 197.77 L 246.24 198.53 L 246.58 199.37 L 246.31 200.38 L 245.11 202.2 L 244.25 202.84 L 243.83 203.69 L 243.93 204.54 L 244.59 205.91 L 245.05 207.85 L 243.67 212.07 L 242.49 217.29 L 241.28 218.02 L 193.43 218.34 L 193.43 218.34 L 193.47 217.64 L 193.11 217.26 L 191.72 216.98 L 189.8 218.06 L 189.26 219.8 L 188.58 219.99 L 185.34 218.51 L 184.66 215.63 L 184.04 215.43 L 183.06 215.56 L 182.6 215.35 L 181.35 212.08 L 178.81 211.1 L 177.48 209.83 L 176.68 207.92 L 176.23 207.43 L 174.08 206.3 L 163.29 206.36 L 161.91 208.92 L 160.19 209.42 L 160.28 210.59 L 160.02 210.81 L 157.54 211.34 L 156.35 212.93 L 156.3 213.6 L 157.2 214.3 L 157.37 214.75 L 157.01 215.77 L 156.2 216.92 L 154.14 218.13 L 154.03 219.94 L 154.27 221.4 L 150.4 220.94 L 148.27 221.32 L 147.07 222.39 L 145.28 222.29 L 144.44 221.74 L 143.98 221.72 L 142.23 222.98 L 141.7 223.82 L 141.96 225.57 L 139.42 228.73 L 138.74 228.81 L 138.06 228.28 L 137.42 226.02 L 137.04 225.93 L 135.2 226.95 L 133.9 228.16 L 132.53 228.55 L 131.76 228.42 L 130.68 228.92 L 130.27 229.45 L 130.14 230.17 L 128.92 230.96 L 128.55 230.98 L 126.24 228.65 L 125.52 228.28 L 122.65 228.61 L 118.69 228.35 L 118.85 229.64 L 118.7 230.2 L 117.15 232.01 L 115.23 232.59 L 111.97 235.15 L 111.97 235.15 L 83.46 223.02 L 57.02 208.85 L 44.88 205.71 L 21.22 200.05 L 3.27 192.57 L 3.27 192.57 L 3.2 191.92 L 3.9 189 L 5.12 187.6 L 10.04 184.13 L 12.3 183.89 L 12.77 183.59 L 13.75 182.03 L 13.83 181 L 12.09 176.51 L 12.47 175.32 L 13.65 173.13 L 14.93 171.81 L 15.85 170.56 L 16.27 169.58 L 16.57 167.84 L 16.28 166.52 L 16.95 164.48 L 17.26 162.17 L 17.99 161.42 L 21.65 159.79 L 23.84 158.56 L 24.99 157.52 L 25.43 156.12 L 26.21 155.75 L 27.62 155.64 L 29.27 154.71 L 32.81 151.98 L 35.23 151.55 L 36.74 151.84 L 40.93 150.62 L 42.43 149.85 L 44.25 149.49 L 47.58 149.87 L 48.88 148.28 L 49.51 146.83 L 50.6 146.22 L 52.74 146.42 L 53.38 146.96 L 54.7 146.72 L 55.8 145.98 L 57.51 146.1 L 57.82 146.63 L 57.8 147.81 L 59.41 149.1 L 62.24 149.18 L 62.82 148.78 L 63.28 148 L 63.17 147.61 L 64.34 142.69 L 71.04 105.52 L 72.2 102.6 L 71.21 97.64 L 71.33 97.38 L 70.03 96.33 L 68.55 93.58 L 68.51 93.09 L 69.16 91.7 L 68.64 89.92 L 68.27 89.52 L 66.57 88.93 L 63.54 86.58 L 61.6 84.3 L 61.8 72.79 L 65.69 72.53 L 67.44 71.36 L 70.94 70.44 L 73.62 72.2 L 74.84 72.31 L 76.11 71.88 L 75.62 70.19 L 75.92 68.47 L 74.55 66.37 L 73.98 65.83 L 72.83 65.23 L 71.32 65.76 L 68.53 65.15 L 64.96 65.24 L 64.9 55.34 L 65.86 55.38 L 67.18 54.8 L 69.46 54.2 L 72.3 55.07 L 91.33 55.13 L 90.87 54.47 L 90.08 54.33 L 89.7 53.13 L 90.65 51.2 L 92.08 51.6 L 92.69 53.12 L 93.56 54.44 L 94.22 54.79 L 95.05 54.8 L 96.66 54.19 L 98.6 52.1 L 98.92 51.26 L 100.18 50.02 L 102.73 48.63 L 104.02 49.09 L 105.19 51.67 L 106.81 53.66 L 107.55 54.96 L 108.21 56.74 L 108.44 58.29 L 107.95 61.92 L 108.15 63.68 L 111.35 62.93 L 119.66 69.99 L 120.45 70.27 L 122.95 70.48 L 125.25 69.48 L 126.95 67.78 L 129.06 66.62 L 131.25 66.51 L 131.81 66.8 L 132.58 67.88 L 132.56 68.85 L 131.45 70.55 L 131.82 71.53 L 132.4 71.8 L 133.73 71.08 L 134.29 70.17 L 134.52 68.88 L 135.52 67.72 L 135.99 67.49 L 136.99 67.67 L 137.54 67.49 L 137.95 66.83 L 138.41 64.52 L 138.92 64.15 L 140.43 63.79 L 143.36 62.02 L 144.33 62.57 L 145.26 62.28 L 146.86 61.24 L 147.88 59.63 L 149.99 58.42 L 152.02 58.97 L 154.38 57.32 L 154.93 56.5 L 155.37 53.84 L 155.34 52.55 L 156.11 51.63 L 157.14 51.21 L 158.88 51.19 L 160.22 50.8 L 162.28 49.2 L 163.24 48.83 L 165.52 48.53 z"},{code:"AP",name:"Amapá",gTransform:"matrix(1 0 0 1 32.29 -262.31)",pathTransform:"translate(-338.29, -56.97)",d:"M 344.98 99.7 L 344.04 99.64 L 343.27000000000004 99.98 L 341.97 100.10000000000001 L 339.18 99.42 L 337.73 98.39 L 337.3 96.89 L 335.43 95.5 L 335.32 94.2 L 335.53 93.51 L 335.21999999999997 91.93 L 334.89 91.46000000000001 L 333.94 91.27000000000001 L 333.53 90.33000000000001 L 333.60999999999996 87.9 L 330.67999999999995 84.62 L 329.9 84.98 L 329.08 84.79 L 327.58 81.31 L 327.71 79.73 L 327.12 77.92 L 326.5 77.36 L 325.83 75.85 L 325.64 73.74 L 326.07 70.6 L 325.9 70.27 L 323.33 69.53999999999999 L 321.31 67.27999999999999 L 320.55 64.44999999999999 L 320.74 63.72999999999999 L 321.42 63.49999999999999 L 320.93 62.31999999999999 L 320.25 62.349999999999994 L 317.41 59.69 L 316.47 59.83 L 316.09000000000003 60.25 L 314.76000000000005 60.39 L 313.9200000000001 60.12 L 313.12000000000006 59.14 L 311.9800000000001 58.3 L 310.7900000000001 58.18 L 310.30000000000007 56.9 L 309.63000000000005 56.1 L 307.70000000000005 55.050000000000004 L 306.41 54.56 L 303.02000000000004 54.190000000000005 L 301.94000000000005 54.480000000000004 L 300.77000000000004 54.46 L 300.46000000000004 53.92 L 300.22 52.480000000000004 L 300.47 47.940000000000005 L 301.09000000000003 46.64000000000001 L 300.72 44.34000000000001 L 300.1 43.77000000000001 L 300.1 43.77000000000001 L 300.45000000000005 43.56000000000001 L 301.44000000000005 43.86000000000001 L 301.43000000000006 44.67000000000001 L 301.14000000000004 44.85000000000001 L 301.48 45.82000000000001 L 302.95000000000005 45.760000000000005 L 303.77000000000004 45.99 L 304.12000000000006 46.89 L 304.96000000000004 47.6 L 307.21000000000004 48.38 L 310.50000000000006 49.13 L 313.26000000000005 47.35 L 313.61000000000007 46.59 L 315.3400000000001 45.42 L 316.1700000000001 45.13 L 316.86000000000007 46.07 L 319.57000000000005 47.01 L 320.65000000000003 46.89 L 322.37000000000006 45.88 L 322.49000000000007 45.46 L 322.81000000000006 45.49 L 324.27000000000004 46.79 L 324.07000000000005 47.66 L 326.44000000000005 47.489999999999995 L 326.95000000000005 47.989999999999995 L 327.90000000000003 48.16 L 328.52000000000004 48.15 L 329.43000000000006 47.67 L 331.1000000000001 46.17 L 332.88000000000005 45.07 L 334.63000000000005 42.77 L 335.00000000000006 41.77 L 334.80000000000007 41.230000000000004 L 337.93000000000006 34.730000000000004 L 338.0400000000001 32.910000000000004 L 339.1500000000001 31.610000000000003 L 339.8800000000001 31.42 L 343.48000000000013 25.630000000000003 L 343.71000000000015 24.480000000000004 L 344.5500000000001 23.280000000000005 L 346.34000000000015 21.730000000000004 L 346.97000000000014 20.070000000000004 L 349.08000000000015 18.930000000000003 L 349.5500000000002 18.01 L 350.5900000000002 17.430000000000003 L 351.1500000000002 18.890000000000004 L 352.0300000000002 20.250000000000004 L 350.3600000000002 15.450000000000003 L 350.2900000000002 14.160000000000004 L 350.4700000000002 13.830000000000004 L 353.8400000000002 16.250000000000004 L 354.9800000000002 17.460000000000004 L 355.8900000000002 18.680000000000003 L 356.4100000000002 19.870000000000005 L 356.44000000000017 21.450000000000003 L 356.88000000000017 21.76 L 357.20000000000016 21.28 L 357.58000000000015 21.18 L 357.79000000000013 21.58 L 358.0000000000001 29.47 L 358.66000000000014 33.339999999999996 L 361.3700000000001 39.38999999999999 L 364.03000000000014 48.32999999999999 L 367.35000000000014 53.32999999999999 L 368.3600000000001 53.67999999999999 L 371.6300000000001 53.599999999999994 L 374.4100000000001 54.53999999999999 L 375.7000000000001 55.38999999999999 L 376.4700000000001 58.03999999999999 L 376.31000000000006 61.36999999999999 L 375.02000000000004 62.32999999999999 L 373.29 62.75999999999999 L 372.91 63.08999999999999 L 374.70000000000005 62.93999999999999 L 375.74000000000007 62.51999999999999 L 376.02000000000004 62.749999999999986 L 376.14000000000004 63.33999999999999 L 375.97 64.07 L 370.94000000000005 68.13 L 369.77000000000004 70.22999999999999 L 367.62000000000006 71.63999999999999 L 365.68000000000006 75.35999999999999 L 362.77000000000004 78.85999999999999 L 362.07000000000005 79.31999999999998 L 361.13000000000005 79.22999999999998 L 359.68000000000006 79.74999999999997 L 357.6000000000001 82.72999999999998 L 357.6000000000001 82.72999999999998 L 356.2600000000001 82.79999999999997 L 355.5100000000001 83.69999999999997 L 355.5100000000001 83.69999999999997 L 354.0400000000001 85.37999999999998 L 353.07000000000005 87.59999999999998 L 351.95000000000005 89.46999999999998 L 351.11000000000007 90.11999999999999 L 348.1000000000001 93.57 L 347.74000000000007 95.97 L 347.9100000000001 97.77 L 345.9600000000001 99.58 L 344.98 99.7 z M 368.34 52.71 L 367.89 52.38 L 366.78999999999996 50.52 L 366.85999999999996 49.64 L 367.09 49.230000000000004 L 368.75 48.78 L 369.18 49.17 L 370.01 51.440000000000005 L 369.02 52.540000000000006 L 368.34 52.71 z M 370.83 70.32 L 370.43 70.07 L 370.35 69.36 L 371.46000000000004 68.26 L 372.34000000000003 68.11 L 373.59000000000003 68.35 L 374.05 68.24 L 374.49 67.6 L 374.54 68.19 L 373.57 69.63 L 372.58 70.13 L 370.83 70.32 z M 374.27 67.45 L 373.49 67.22 L 373.49 66.66 L 374.21000000000004 65.61999999999999 L 375.46000000000004 65.52 L 375.64000000000004 65.86999999999999 L 375.54 66.38 L 374.27 67.45 z M 367.08 49.03 L 366.32 48.53 L 366.58 47.7 L 367.46 47.53 L 368.32 47.85 L 368.33 48.58 L 367.08 49.03 z"},{code:"BA",name:"Bahia",gTransform:"matrix(1 0 0 1 193.52 -26.39)",pathTransform:"translate(-499.52, -292.87)",d:"M 527.5 365.33 L 527.14 364.5 L 527.8199999999999 363.15 L 527.81 362.62 L 527.28 361.58 L 523.15 358.53 L 523 358.02 L 523.22 356.51 L 522.65 355.28 L 522 355.52 L 521.8 355.96999999999997 L 521.4599999999999 356.15 L 521.2399999999999 355.9 L 521.7699999999999 351.5 L 522.5899999999999 348.2 L 523.41 347.32 L 525.88 347.56 L 526.9 346.85 L 526.9 346.43 L 526.34 345.41 L 526.5 342.76000000000005 L 531.46 338.54 L 532.9300000000001 335.46000000000004 L 532.5100000000001 334.29 L 531.7300000000001 333.27000000000004 L 530.8400000000001 333.21000000000004 L 530.1100000000001 332.83000000000004 L 527.2800000000001 330.36 L 525.1600000000001 330.38 L 522.97 329.78 L 520.7 328.7 L 517.97 328.14 L 515.99 328 L 514.67 328.99 L 513.1999999999999 329.49 L 510.5899999999999 329.04 L 510.0199999999999 329.25 L 509.5799999999999 325.29 L 503.05999999999995 319.09000000000003 L 502.67999999999995 318.91 L 498.28999999999996 320.14000000000004 L 496.76 318.90000000000003 L 496.25 319.11 L 495.32 318.89 L 492.78 317.66999999999996 L 490.60999999999996 316.04999999999995 L 489.62999999999994 316.22999999999996 L 485.2799999999999 312.59999999999997 L 484.1799999999999 312.05999999999995 L 481.4499999999999 311.30999999999995 L 479.6799999999999 311.55999999999995 L 477.7999999999999 312.4599999999999 L 476.9899999999999 313.5799999999999 L 476.3499999999999 313.75999999999993 L 471.0199999999999 312.2899999999999 L 470.4099999999999 311.7999999999999 L 470.1499999999999 310.2999999999999 L 470.2899999999999 309.4099999999999 L 471.5799999999999 306.6699999999999 L 470.7199999999999 306.2099999999999 L 468.43999999999994 305.68999999999994 L 466.25999999999993 305.6499999999999 L 465.05999999999995 305.1499999999999 L 463.2699999999999 305.06999999999994 L 459.43999999999994 306.6499999999999 L 455.17999999999995 309.6799999999999 L 454.53999999999996 310.7899999999999 L 451.16999999999996 312.6599999999999 L 449.15 313.0599999999999 L 448.2 314.2399999999999 L 446.39 315.7899999999999 L 444.96 316.3099999999999 L 443.96 316.1599999999999 L 442.10999999999996 318.7399999999999 L 441.06999999999994 319.5099999999999 L 438.93999999999994 319.1299999999999 L 438.2199999999999 319.2599999999999 L 437.5299999999999 320.2599999999999 L 436.18999999999994 321.1799999999999 L 435.78999999999996 320.9399999999999 L 437.21999999999997 317.5099999999999 L 436.71 315.09999999999985 L 436.71 315.09999999999985 L 438.19 313.1299999999998 L 438.44 312.35999999999984 L 438.21 311.08999999999986 L 437.53999999999996 309.36999999999983 L 437.64 308.6999999999998 L 438.34999999999997 307.2799999999998 L 438.29999999999995 306.8199999999998 L 435.09 304.1999999999998 L 433.4 300.73999999999984 L 432.78 297.21999999999986 L 432.83 295.66999999999985 L 434.03 291.83999999999986 L 435.61999999999995 290.8099999999999 L 435.84999999999997 290.4299999999999 L 435.90999999999997 289.4899999999999 L 434.28 288.6499999999999 L 434.16999999999996 288.31999999999994 L 434.65 285.79999999999995 L 436.08 284.73999999999995 L 436.06 284.36999999999995 L 433.34 281.90999999999997 L 433.34 281.90999999999997 L 433.29999999999995 280.97999999999996 L 434.65999999999997 278.59999999999997 L 434.61999999999995 277.53 L 434.44999999999993 277.10999999999996 L 432.98999999999995 276.61999999999995 L 432.04999999999995 275.96999999999997 L 431.69999999999993 274.71 L 431.75999999999993 271.78999999999996 L 431.94999999999993 270.93999999999994 L 433.8999999999999 269.2699999999999 L 435.0399999999999 268.8499999999999 L 435.9999999999999 268.1299999999999 L 435.70999999999987 267.4999999999999 L 435.1299999999999 266.9799999999999 L 434.20999999999987 266.6899999999999 L 433.1799999999999 266.8699999999999 L 432.82999999999987 266.5399999999999 L 432.7399999999999 266.0399999999999 L 433.1599999999999 265.0799999999999 L 435.19999999999993 264.25999999999993 L 435.75999999999993 263.80999999999995 L 435.7199999999999 263.04999999999995 L 433.8399999999999 262.06999999999994 L 430.25999999999993 261.3999999999999 L 428.3999999999999 259.43999999999994 L 428.1699999999999 258.5199999999999 L 428.6699999999999 257.3599999999999 L 429.6799999999999 256.6299999999999 L 431.1999999999999 253.1499999999999 L 432.09999999999985 252.53999999999988 L 433.10999999999984 252.26999999999987 L 433.45999999999987 251.88999999999987 L 432.16999999999985 250.08999999999986 L 432.35999999999984 249.71999999999986 L 435.5699999999998 247.09999999999985 L 439.3899999999998 245.07999999999984 L 439.9499999999998 244.60999999999984 L 440.16999999999985 243.62999999999985 L 440.85999999999984 242.97999999999985 L 440.85999999999984 242.97999999999985 L 443.1899999999998 242.95999999999984 L 444.6299999999998 244.29999999999984 L 445.28999999999985 245.33999999999983 L 445.8199999999998 247.54999999999984 L 447.5799999999998 250.03999999999985 L 451.7599999999998 251.89999999999986 L 453.55999999999983 251.37999999999985 L 455.66999999999985 251.55999999999986 L 455.99999999999983 251.34999999999985 L 456.74999999999983 249.89999999999986 L 457.8899999999998 249.52999999999986 L 458.55999999999983 248.65999999999985 L 459.72999999999985 247.76999999999987 L 461.9399999999998 247.01999999999987 L 463.2699999999998 247.18999999999986 L 464.74999999999983 247.71999999999986 L 466.09999999999985 247.29999999999987 L 469.0699999999999 244.87999999999988 L 472.01999999999987 239.82999999999987 L 472.7399999999999 238.96999999999986 L 472.9799999999999 238.04999999999987 L 473.2799999999999 235.48999999999987 L 473.1599999999999 234.32999999999987 L 470.9199999999999 229.89999999999986 L 470.9699999999999 228.96999999999986 L 474.2099999999999 227.31999999999985 L 476.1599999999999 227.29999999999984 L 477.6599999999999 227.75999999999985 L 478.06999999999994 228.68999999999986 L 478.38999999999993 228.86999999999986 L 480.50999999999993 228.43999999999986 L 481.8999999999999 227.89999999999986 L 483.2299999999999 228.27999999999986 L 484.9399999999999 229.26999999999987 L 484.8099999999999 229.91999999999987 L 484.9999999999999 230.20999999999987 L 485.8199999999999 230.48999999999987 L 488.8199999999999 230.37999999999985 L 490.2899999999999 229.73999999999987 L 491.9899999999999 229.63999999999987 L 492.8099999999999 228.41999999999987 L 494.3199999999999 227.07999999999987 L 497.0499999999999 226.73999999999987 L 497.8199999999999 226.37999999999985 L 498.6299999999999 225.39999999999986 L 500.7999999999999 225.40999999999985 L 501.4199999999999 226.03999999999985 L 501.7299999999999 226.08999999999986 L 503.5899999999999 224.27999999999986 L 503.4899999999999 221.87999999999985 L 505.4799999999999 221.49999999999986 L 506.2699999999999 221.67999999999986 L 507.31999999999994 221.01999999999987 L 508.81999999999994 218.70999999999987 L 509.2799999999999 217.55999999999986 L 509.2799999999999 217.55999999999986 L 510.1699999999999 217.95999999999987 L 511.3299999999999 217.68999999999986 L 513.53 217.97999999999985 L 516.35 219.36999999999983 L 516.7900000000001 219.87999999999982 L 516.7300000000001 222.60999999999981 L 517.4500000000002 224.5499999999998 L 519.6600000000002 225.4599999999998 L 519.9300000000002 227.4599999999998 L 519.0100000000002 229.13999999999982 L 520.8400000000003 229.75999999999982 L 521.8000000000003 229.53999999999982 L 522.6200000000003 228.61999999999983 L 525.4900000000004 227.73999999999984 L 526.2600000000003 224.15999999999983 L 526.7600000000003 223.28999999999982 L 527.5100000000003 223.12999999999982 L 528.2900000000003 223.65999999999983 L 528.9200000000003 223.70999999999984 L 531.3100000000003 222.68999999999983 L 532.4100000000003 221.44999999999982 L 532.5800000000003 220.85999999999981 L 532.3300000000003 219.4999999999998 L 532.6200000000002 219.2499999999998 L 534.8600000000002 218.7999999999998 L 535.6300000000002 216.7499999999998 L 537.2800000000002 216.3099999999998 L 539.8100000000002 214.8499999999998 L 540.4000000000002 214.7499999999998 L 541.8900000000002 215.3099999999998 L 542.7200000000003 216.7499999999998 L 544.0800000000003 217.5599999999998 L 546.4400000000003 218.3399999999998 L 549.4300000000003 218.7399999999998 L 551.0100000000003 219.88999999999982 L 551.5500000000003 221.53999999999982 L 551.9400000000003 221.80999999999983 L 552.3700000000002 221.65999999999983 L 552.6600000000002 219.90999999999983 L 553.0900000000001 219.46999999999983 L 554.0900000000001 219.45999999999984 L 554.5400000000002 219.77999999999983 L 554.5600000000002 220.40999999999983 L 553.9400000000002 221.28999999999982 L 554.3900000000002 222.11999999999983 L 554.8900000000002 222.48999999999984 L 556.9900000000002 223.34999999999985 L 557.0100000000002 224.28999999999985 L 558.2300000000002 227.33999999999986 L 558.2300000000002 227.33999999999986 L 558.7700000000002 228.73999999999987 L 559.7900000000002 229.02999999999986 L 560.2400000000002 228.93999999999986 L 561.6700000000002 229.72999999999985 L 561.8700000000002 230.44999999999985 L 561.8700000000002 230.44999999999985 L 561.2000000000003 231.60999999999984 L 561.4100000000003 233.74999999999983 L 562.6900000000003 236.24999999999983 L 564.6800000000003 238.19999999999982 L 565.4300000000003 239.34999999999982 L 565.3500000000003 242.46999999999983 L 564.6900000000003 244.08999999999983 L 564.6000000000003 244.96999999999983 L 565.3600000000002 247.71999999999983 L 565.0600000000003 248.29999999999984 L 564.3700000000002 248.84999999999985 L 561.8200000000003 249.84999999999985 L 560.6900000000003 249.09999999999985 L 558.9800000000002 249.08999999999986 L 558.6600000000002 249.38999999999987 L 558.0700000000002 250.96999999999989 L 558.0900000000001 251.7399999999999 L 559.0400000000002 253.3399999999999 L 560.1400000000002 253.9999999999999 L 560.6600000000002 255.4899999999999 L 562.0900000000001 256.9999999999999 L 562.2400000000001 257.3899999999999 L 562.1100000000001 258.8099999999999 L 561.7700000000001 259.1999999999999 L 561.8900000000001 259.6199999999999 L 562.4800000000001 260.1399999999999 L 564.4100000000001 261.0599999999999 L 564.8900000000001 261.76999999999987 L 565.4300000000001 262.10999999999984 L 566.98 262.74999999999983 L 569.87 261.86999999999983 L 569.87 261.86999999999983 L 570.51 261.84999999999985 L 570.87 262.2599999999999 L 566.79 271.08999999999986 L 562.9599999999999 276.27999999999986 L 561.93 278.60999999999984 L 556.9 284.34999999999985 L 554.4499999999999 285.60999999999984 L 553.5799999999999 285.59999999999985 L 553.8799999999999 284.16999999999985 L 554.2499999999999 284.01999999999987 L 554.3899999999999 282.91999999999985 L 553.9399999999998 280.98999999999984 L 552.0699999999998 280.73999999999984 L 551.6399999999999 279.4399999999998 L 550.9599999999999 278.6899999999998 L 550.5899999999999 279.28999999999985 L 550.1299999999999 281.61999999999983 L 549.6299999999999 282.48999999999984 L 549.0799999999999 282.86999999999983 L 548.52 282.5799999999998 L 548.03 280.8399999999998 L 548.14 280.5199999999998 L 548.4499999999999 280.3899999999998 L 548.42 279.99999999999983 L 547.55 281.28999999999985 L 548.4799999999999 282.97999999999985 L 548.9399999999999 283.20999999999987 L 549.31 283.0599999999999 L 550.4599999999999 283.3199999999999 L 549.9999999999999 285.1299999999999 L 548.7899999999998 286.27999999999986 L 548.5399999999998 288.09999999999985 L 547.2899999999998 289.0699999999999 L 546.9399999999998 289.7399999999999 L 546.7399999999998 290.57999999999987 L 546.9199999999997 291.4299999999999 L 545.5699999999997 291.0399999999999 L 545.3599999999997 291.4299999999999 L 544.9999999999997 293.9499999999999 L 545.3599999999997 293.22999999999985 L 546.1099999999997 293.4399999999998 L 546.3499999999997 293.97999999999985 L 546.1199999999997 294.3899999999999 L 546.1799999999996 295.0099999999999 L 546.4799999999996 295.3099999999999 L 546.8099999999996 296.3099999999999 L 545.7699999999996 298.8199999999999 L 546.3399999999997 302.2599999999999 L 545.7899999999997 302.7499999999999 L 545.2199999999997 302.52999999999986 L 545.0799999999997 303.65999999999985 L 545.6699999999997 304.11999999999983 L 546.8799999999998 302.3999999999998 L 546.4099999999997 300.1899999999998 L 547.2299999999998 299.5799999999998 L 547.4799999999998 300.11999999999983 L 547.4199999999998 301.8799999999998 L 546.4599999999998 304.48999999999984 L 545.7199999999998 309.91999999999985 L 545.2099999999998 311.72999999999985 L 545.4099999999999 314.1999999999999 L 546.1899999999998 317.0499999999999 L 546.3799999999999 321.5899999999999 L 547.2499999999999 327.99999999999994 L 548.2399999999999 331.41999999999996 L 546.0299999999999 338.08 L 544.6799999999998 344.72999999999996 L 544.2099999999998 345.73999999999995 L 544.0499999999998 348.59999999999997 L 542.9899999999999 352.32 L 542.8999999999999 354.65 L 543.2899999999998 359.07 L 544.1799999999998 360.78 L 541.9399999999998 363.76 L 540.1299999999999 364.43 L 539.1899999999998 365.07 L 536.4699999999998 368.96 L 535.9 371 L 535.9 371 L 527.81 365.86 L 527.5 365.33 z M 549.78 287.33 L 549.55 286.13 L 550.29 285.71999999999997 L 551.3499999999999 284.67999999999995 L 551.5099999999999 284.03999999999996 L 551.1399999999999 283.30999999999995 L 551.8999999999999 283.44999999999993 L 552.7199999999999 284.49999999999994 L 552.67 285.0299999999999 L 549.78 287.33 z M 547.25 294.18 L 546.62 294.15000000000003 L 546.63 293.48 L 546.89 293.12 L 546.09 292.9 L 545.6700000000001 292.5 L 545.8000000000001 291.43 L 547.6700000000001 291.28000000000003 L 547.83 291.48 L 547.94 292.61 L 547.25 294.18 z"},{code:"CE",name:"Ceará",gTransform:"matrix(1 0 0 1 235.04 -154.64)",pathTransform:"translate(-541.04, -164.62)",d:"M 573.79 156.85 L 568.9 158.44 L 566.29 160.45 L 562.99 167.14 L 562.15 168.26 L 561.28 168.83 L 560.63 170.5 L 560.78 171.24 L 559.38 173.68 L 557.92 175.19 L 557.35 176.29 L 556.32 176.55 L 555.54 176.04 L 555.03 176.11 L 554.19 176.99 L 552.78 179.24 L 552.44 181.21 L 553.08 181.38 L 553.74 181 L 553.74 181 L 553.66 181.54 L 552.82 182.69 L 551.79 185.69 L 552.31 187 L 551.65 188.31 L 550.56 188.94 L 550.39 189.32 L 550.27 190.25 L 550.51 190.66 L 551.09 190.95 L 551.44 191.67 L 551.42 193.33 L 552.66 194.22 L 553.35 194.3 L 553.69 195.49 L 552.08 198.98 L 550.89 200.1 L 551.06 200.35 L 551.06 200.35 L 549.47 200.84 L 548.4 201.67 L 546.86 203.96 L 545.21 204.01 L 544.58 202.37 L 543.8 201.8 L 542.44 201.32 L 541.43 200.25 L 540.97 199.26 L 539.14 198.43 L 536.29 196.53 L 533.21 196.11 L 531.92 196.21 L 529.78 197.01 L 528.15 197.2 L 527.26 196.96 L 522.33 196.76 L 522.33 196.76 L 522.39 195.44 L 521.71 194.76 L 521.63 193.79 L 522.77 190.68 L 524.27 188.43 L 524.28 187.74 L 523.51 186.58 L 520.95 186.11 L 519.64 185.46 L 518.63 182.79 L 517.58 177.59 L 516.82 175.02 L 517.06 174.57 L 516.12 166.41 L 516.01 166.03 L 515.09 165.34 L 515.89 164.76 L 516.48 163.18 L 515.88 160.19 L 514.88 158.18 L 515.36 156.58 L 514.57 152.71 L 515.31 151.35 L 515.33 150.59 L 513.97 149 L 513.53 147.27 L 510.38 140.85 L 508.58 136.13 L 508.29 134.84 L 508.47 133.38 L 510.05 131.41 L 511.14 129.56 L 511.25 128.76 L 511.25 128.76 L 511.44 128.62 L 511.4 128 L 511 127.34 L 511.65 126.53 L 518.39 126.31 L 521.28 125.88 L 523.35 125.22 L 530.75 126.01 L 532.87 127.13 L 534.81 128.63 L 538.93 130.81 L 540.39 131.33 L 545.21 134.33 L 546.42 134.53 L 548.64 136.82 L 551.63 138.93 L 554.2 139.65 L 556.64 142.56 L 557.86 143.17 L 560.82 146.98 L 564.98 150.06 L 566.44 152.06 L 567.48 153.05 L 568.98 153.87 L 570.13 153.9 L 572.5 154.82 L 573.29 155.49 z"},{code:"DF",name:"Distrito Federal",gTransform:"matrix(1 0 0 1 103.1 10.18)",pathTransform:"translate(-409.11, -329.45)",d:"M 416.71 333.87 L 402.02 333.85 L 401.5 330.59 L 402.42 328.76 L 402.8 325.03 L 414.75 325.04 L 416.58 327.02 L 416.64 329.23 L 416.05 330.42 L 415.84 332.86 z"},{code:"ES",name:"Espírito Santo",gTransform:"matrix(1 0 0 1 212.62 72.56)",pathTransform:"translate(-518.62, -391.82)",d:"M 501.63 411.37 L 501.34 411.23 L 501.78 408.89 L 502.35 407.59 L 501.76 404.47 L 501.92 404.05 L 503.64 401.99 L 508.79 402.02 L 509.34 401.7 L 510.31 398.46 L 511.42 397.19 L 512.3 394.9 L 512.54 393.18 L 512.8 392.74 L 514.04 391.88 L 515.75 389.79 L 516.29 386.82 L 516 384.39 L 514.73 381.58 L 513.63 380.31 L 513.11 380.22 L 512.66 380.51 L 511.9 380.23 L 511.41 379.52 L 511.84 378.97 L 513.32 378.88 L 514.12 379.23 L 515.09 379.26 L 516.04 379.02 L 516.36 378.6 L 516.19 376.88 L 514.88 376.53 L 514.67 376.12 L 514.97 374.58 L 515 372.66 L 514.48 372 L 513.15 371.33 L 512.85 370.63 L 514.02 368.7 L 516.19 367.39 L 516.5 367.37 L 517.55 368.11 L 518.68 368.22 L 518.7 367.41 L 517.03 365.14 L 518.37 365.27 L 520.55 364.98 L 521.39 364.37 L 522.47 364.05 L 524.05 363.97 L 526.59 364.78 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.5 365.33 L 527.8 365.86 L 535.9 371 L 535.9 371 L 534.97 374.35 L 534.66 377.21 L 534.78 380.8 L 535.5 386.95 L 535.19 389.42 L 533.7 392.6 L 530.95 393.99 L 530.4 394.59 L 528.73 397.92 L 527.75 401.72 L 526.98 403.19 L 526.15 402.51 L 525.27 402.38 L 524.98 403.66 L 526.33 404.18 L 524.39 408.42 L 520.94 412.26 L 520.7 411.99 L 518.84 412.65 L 518.04 413.88 L 517.98 415.27 L 517.56 416.52 L 515.97 418.54 L 515.68 419.67 L 515.68 419.67 L 514.06 418.61 L 511.07 418.98 L 506.73 417.97 L 504.23 416.84 L 503.56 412.13 z"},{code:"GO",name:"Goiás",gTransform:"matrix(1 0 0 1 75.37 14.13)",pathTransform:"translate(-381.37, -333.38)",d:"M 416.71 333.87 L 415.84 332.86 L 416.05 330.42 L 416.64 329.23 L 416.58 327.02 L 414.75 325.04 L 402.8 325.03 L 402.42 328.76 L 401.5 330.59 L 402.02 333.85 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.71 333.87 L 416.18 335.39 L 416.49 336.96 L 415.81 338.55 L 414.77 339.8 L 414.36 341.27 L 415.21 342.48 L 416.06 342.82 L 417.48 343.85 L 419.13 348.41 L 419.13 349.01 L 416.81 351.72 L 413.57 354.73 L 413.14 356.87 L 414.23 357.98 L 415.13 357.51 L 416.71 358.08 L 417.18 358.69 L 417.36 359.69 L 417.19 360.4 L 416.46 361.3 L 415.95 363.19 L 417.14 366.65 L 414.05 368.71 L 412.89 368.91 L 412.03 369.81 L 411.55 370.93 L 406.66 373.67 L 405.96 372.9 L 401.61 371.04 L 401.06 371.52 L 400.48 371.61 L 398.73 371.62 L 397.25 371.34 L 393.39 371.5 L 391.38 370.61 L 387.25 373.25 L 384.34 376.17 L 384.01 376.17 L 382.7 374.75 L 381.18 374.45 L 377.99 376.09 L 374.28 375.47 L 371.8 376.43 L 369.57 376.97 L 368.16 379.07 L 366.95 381.53 L 367.01 382.53 L 366.17 383.83 L 365.35 384.11 L 364.51 383.95 L 364.06 384.09 L 363.12 384.83 L 361.48 386.93 L 360.91 388.83 L 361.47 389.44 L 361.46 389.78 L 361.1 390.01 L 360.24 389.55 L 360.24 389.55 L 360 389.1 L 357.34 386.86 L 354.19 386.25 L 352.57 384.7 L 350.67 384.27 L 349.18 384.23 L 345.83 382.89 L 345.15 382.04 L 342.08 380.48 L 341.41 379.87 L 339.97 379.16 L 338.83 378.99 L 336.13 377.31 L 333.35 377.47 L 329.55 376.77 L 329.42 376.44 L 329.68 375.6 L 330.25 374.43 L 331.56 372.67 L 331.48 372.25 L 329.23 371.35 L 328.09 372.02 L 327.43 371.83 L 327.15 371.42 L 326.92 370.31 L 327.18 367.73 L 326.99 365.96 L 326.99 365.96 L 326.04 363.76 L 325.86 360.33 L 324.45 358.14 L 324.29 357.43 L 324.69 354.02 L 327.24 350.17 L 327.62 347.26 L 328.32 346.49 L 330.34 345.65 L 332.26 343.88 L 333.51 341.86 L 333.84 339.91 L 334.34 338.9 L 335.62 337.86 L 336.44 336.43 L 336.52 334.89 L 338.27 333.92 L 339.67 331.3 L 342.32 331.17 L 345.04 330.31 L 345.36 330.03 L 347.34 325.84 L 348.05 324.88 L 348.69 320.78 L 349.07 320.04 L 350.99 318.1 L 352.64 317.09 L 353.71 316.83 L 354.94 317.51 L 356.15 316.78 L 357.54 315.35 L 358.38 312.42 L 359.55 309.55 L 359.54 308.75 L 359.06 307.61 L 359.64 304.87 L 361.24 301.78 L 361.12 296.6 L 362.33 295.82 L 363.36 293.19 L 365.36 290.02 L 365.75 288.95 L 365.59 286.23 L 365.94 285.33 L 366.91 284.47 L 367.18 283.34 L 367.1 282.71 L 367.1 282.71 L 367.44 282.26 L 367.64 280.38 L 368.3 279.15 L 370.11 277.06 L 370.67 276.76 L 370.64 278.47 L 369.42 280.35 L 368.9 282.69 L 371.3 283.09 L 373.5 284.12 L 377.43 284.52 L 380.52 286.23 L 384.59 287.66 L 385.22 287.43 L 386.85 281.49 L 388.32 279.1 L 389.5 278.13 L 390.65 279.44 L 391.69 281.32 L 392.8 285.03 L 393.41 288.13 L 394.55 288.18 L 395.3 287.43 L 395.6 286.43 L 396.16 285.89 L 398.92 286.23 L 403.45 285.7 L 403.67 286.44 L 403.11 288 L 406.24 289.47 L 409.59 290.15 L 410.28 290.07 L 410.79 286.77 L 411.34 286.8 L 412.85 289.42 L 413.31 289.66 L 415.09 288.76 L 417.61 286.68 L 422.14 285.68 L 423.69 285.68 L 426.25 284.58 L 427.99 283.24 L 433.35 281.82 L 433.35 281.82 L 436.07 284.28 L 436.09 284.66 L 434.66 285.72 L 434.18 288.24 L 434.28 288.57 L 435.91 289.41 L 435.85 290.35 L 435.62 290.73 L 434.03 291.76 L 432.84 295.59 L 432.79 297.14 L 433.41 300.66 L 435.11 304.12 L 438.32 306.74 L 438.37 307.21 L 437.65 308.63 L 437.55 309.3 L 438.22 311.02 L 438.45 312.3 L 438.2 313.07 L 436.72 315.04 L 436.72 315.04 L 435.72 316.05 L 432.49 315.71 L 431.59 313.95 L 429.17 312.47 L 428 313.96 L 428.58 317.73 L 428.01 318.27 L 427.61 318.4 L 424.83 317.26 L 423.66 317.49 L 423.29 317.77 L 422.57 320.95 L 423.29 321.05 L 423.78 322.21 L 423.21 323.15 L 422.48 323.85 L 422.52 325.75 L 422.94 326.36 L 423.47 326.55 L 424.16 330.81 L 423.63 331.34 L 420.27 332.24 L 417.98 333.75 z"},{code:"MA",name:"Maranhão",gTransform:"matrix(1 0 0 1 142.22 -148.63)",pathTransform:"translate(-448.22, -170.64)",d:"M 458.57 128.92 L 458.53 129.25 L 456.48999999999995 131.4 L 456.05999999999995 131.57 L 456.0199999999999 133.01 L 457.98999999999995 131.31 L 458.66999999999996 130.1 L 460.78999999999996 128.51999999999998 L 461.67999999999995 127.37999999999998 L 462.7099999999999 121.04999999999998 L 463.8599999999999 120.34999999999998 L 464.9699999999999 120.22999999999998 L 466.63999999999993 119.30999999999997 L 467.2899999999999 119.17999999999998 L 467.7499999999999 119.29999999999998 L 467.82999999999987 120.92999999999998 L 467.6299999999999 121.37999999999998 L 466.20999999999987 123.24999999999999 L 462.9999999999999 124.99999999999999 L 462.9699999999999 125.71999999999998 L 463.69999999999993 125.83999999999999 L 464.1499999999999 125.02999999999999 L 465.2999999999999 124.71999999999998 L 465.5199999999999 125.54999999999998 L 464.92999999999995 126.05999999999999 L 465.17999999999995 126.35999999999999 L 469.38999999999993 121.38999999999999 L 470.24999999999994 121.71999999999998 L 472.8299999999999 120.78999999999998 L 476.86999999999995 121.21999999999998 L 476.40999999999997 118.80999999999999 L 477.02 118.57999999999998 L 479.44 118.65999999999998 L 481.21999999999997 119.03999999999998 L 483.84999999999997 120.08999999999997 L 484.89 120.19999999999997 L 487.03999999999996 121.57999999999997 L 488.43999999999994 121.60999999999997 L 489.69999999999993 122.90999999999997 L 491.5899999999999 124.22999999999996 L 494.0899999999999 124.80999999999996 L 495.24999999999994 124.61999999999996 L 495.80999999999995 125.37999999999997 L 496.1499999999999 125.42999999999996 L 497.7399999999999 125.33999999999996 L 500.1999999999999 125.99999999999996 L 500.45999999999987 125.09999999999995 L 499.78999999999985 124.62999999999995 L 501.45999999999987 124.24999999999996 L 502.02999999999986 124.35999999999996 L 501.9399999999999 124.77999999999996 L 501.9399999999999 124.77999999999996 L 501.4799999999999 126.20999999999997 L 501.7099999999999 126.92999999999996 L 502.3399999999999 127.46999999999997 L 501.9599999999999 128.99999999999997 L 500.1699999999999 131.26999999999998 L 496.0399999999999 135.23999999999998 L 492.7199999999999 135.7 L 491.9199999999999 135.54 L 488.9999999999999 138.94 L 489.0399999999999 140.74 L 488.1599999999999 142.57000000000002 L 486.2699999999999 144.42000000000002 L 485.44999999999993 146.4 L 484.80999999999995 146.57 L 484.03999999999996 147.62 L 484.4 149.54 L 485.63 150.37 L 486.01 151.65 L 485.73 153.11 L 484.59000000000003 155.98000000000002 L 486.17 158.79000000000002 L 486.72 161.77 L 486.61 164.20000000000002 L 486.40000000000003 164.75000000000003 L 482.3 169.17000000000002 L 482.13 171.65 L 482.25 173.76000000000002 L 482.76 176.06000000000003 L 484.53999999999996 178.10000000000002 L 486.15 179.01000000000002 L 486.32 179.51000000000002 L 486.45 180.35000000000002 L 486.06 182.55 L 485.77 182.99 L 485.65 184.20000000000002 L 485.15 185.66000000000003 L 483.94 186.97000000000003 L 481.65 187.26000000000002 L 481 186.98000000000002 L 480.17 187.02 L 477.74 187.88000000000002 L 476.22 187.99000000000004 L 473.72 186.17000000000004 L 472.71000000000004 185.96000000000004 L 471.25000000000006 186.15000000000003 L 470.24000000000007 186.75000000000003 L 469.12000000000006 187.01000000000002 L 468.89000000000004 186.71 L 468.05000000000007 186.95000000000002 L 467.55000000000007 187.17000000000002 L 465.6500000000001 189.08 L 465.6600000000001 189.54000000000002 L 465.0300000000001 190.41000000000003 L 463.0200000000001 192.41000000000003 L 460.6800000000001 193.32000000000002 L 457.8100000000001 195.88000000000002 L 456.48000000000013 196.41000000000003 L 455.4300000000001 196.45000000000002 L 453.73000000000013 197.98000000000002 L 452.65000000000015 198.34000000000003 L 450.04000000000013 198.66000000000003 L 447.3200000000001 199.42000000000002 L 445.1900000000001 201.37 L 444.2100000000001 204.34 L 443.8200000000001 207.31 L 443.1900000000001 209.63 L 441.7400000000001 212.37 L 441.4400000000001 212.59 L 441.10000000000014 213.41 L 440.97000000000014 214.93 L 439.77000000000015 217.41 L 438.07000000000016 218.81 L 437.34000000000015 220.81 L 438.0500000000001 222.75 L 438.52000000000015 225.93 L 440.25000000000017 228.99 L 440.21000000000015 229.51000000000002 L 439.45000000000016 230.91000000000003 L 439.32000000000016 237.27000000000004 L 438.1700000000002 239.72000000000003 L 437.9100000000002 240.78000000000003 L 437.8600000000002 242.70000000000002 L 437.8600000000002 242.70000000000002 L 436.5800000000002 242.04000000000002 L 435.9700000000002 241.22000000000003 L 435.1500000000002 240.77000000000004 L 434.1600000000002 240.48000000000005 L 432.3800000000002 240.68000000000004 L 431.67000000000024 240.50000000000003 L 430.3200000000002 238.50000000000003 L 429.3300000000002 235.64000000000001 L 427.2000000000002 234.02 L 427.06000000000023 232.37 L 428.7000000000002 230.56 L 428.62000000000023 230.03 L 424.74000000000024 228.08 L 424.12000000000023 227.03 L 424.06000000000023 225.37 L 423.31000000000023 223.78 L 422.37000000000023 223.09 L 420.29000000000025 222.81 L 420.09000000000026 222.39000000000001 L 420.35000000000025 221.68 L 422.98000000000025 219.14000000000001 L 422.61000000000024 217.83 L 423.34000000000026 215.15 L 424.03000000000026 213.72 L 424.60000000000025 213.17 L 425.9400000000002 212.63 L 429.3300000000002 212.28 L 428.9400000000002 210.93 L 429.5800000000002 207.68 L 429.5000000000002 205.92000000000002 L 427.7000000000002 204.71 L 423.43000000000023 205.65 L 421.28000000000026 206.99 L 419.0100000000003 203.97 L 418.10000000000025 203.12 L 415.10000000000025 198.97 L 414.22000000000025 199.04 L 413.3800000000003 197.6 L 413.9900000000003 196.41 L 413.8800000000003 195.53 L 413.6300000000003 195.19 L 412.2600000000003 194.95 L 411.84000000000026 195.22 L 409.91000000000025 193.89 L 410.09000000000026 193.17999999999998 L 411.85000000000025 192.51999999999998 L 413.60000000000025 190.48 L 413.85000000000025 188.89 L 413.5700000000003 187.89 L 413.8800000000003 185.52999999999997 L 415.65000000000026 179.36999999999998 L 415.66000000000025 178.93999999999997 L 414.98000000000025 177.79999999999998 L 414.7500000000002 176.71999999999997 L 414.9600000000002 172.99999999999997 L 414.3200000000002 171.49999999999997 L 413.8500000000002 168.00999999999996 L 413.0100000000002 166.97999999999996 L 409.61000000000024 165.53999999999996 L 408.3900000000002 165.51999999999995 L 408.11000000000024 165.19999999999996 L 408.03000000000026 164.16999999999996 L 407.4400000000003 163.47999999999996 L 405.7000000000003 163.18999999999997 L 404.7400000000003 163.70999999999998 L 403.3400000000003 163.61999999999998 L 400.56000000000034 162.10999999999999 L 399.70000000000033 162.04999999999998 L 397.74000000000035 162.57999999999998 L 395.12000000000035 164.42999999999998 L 394.5900000000004 165.06999999999996 L 394.5900000000004 165.06999999999996 L 394.10000000000036 164.98999999999995 L 408.81000000000034 153.15999999999994 L 411.16000000000037 153.38999999999993 L 412.3300000000004 152.46999999999994 L 413.8800000000004 150.29999999999995 L 414.3100000000004 149.14999999999995 L 415.8600000000004 147.97999999999996 L 416.4800000000004 145.09999999999997 L 417.6000000000004 144.63999999999996 L 420.0400000000004 142.31999999999996 L 420.51000000000045 141.10999999999996 L 420.80000000000047 139.20999999999995 L 422.4000000000005 134.51999999999995 L 424.36000000000047 132.97999999999996 L 425.8400000000005 131.21999999999997 L 426.67000000000047 129.76999999999998 L 427.13000000000045 128.48999999999998 L 426.95000000000044 126.66999999999999 L 427.74000000000046 125.85999999999999 L 426.70000000000044 124.27999999999999 L 430.38000000000045 121.18999999999998 L 430.25000000000045 119.54999999999998 L 430.75000000000045 117.16999999999999 L 432.49000000000046 115.6 L 432.8500000000005 114.89 L 433.75000000000045 111.87 L 433.83000000000044 110.26 L 433.40000000000043 109.73 L 432.4100000000004 109.89 L 432.14000000000044 109.4 L 432.19000000000045 108.78 L 433.33000000000044 108.63 L 433.90000000000043 107.89 L 434.6100000000004 103.5 L 434.4500000000004 102.12 L 434.9200000000004 101.09 L 435.6900000000004 100.64 L 435.6900000000004 100.64 L 436.3200000000004 100.64 L 436.5600000000004 100.4 L 436.5000000000004 99.86 L 436.8400000000004 99.11 L 437.42000000000036 98.58 L 438.76000000000033 99.56 L 439.2100000000003 101.4 L 440.4000000000003 101.52000000000001 L 441.1700000000003 100.16000000000001 L 441.7800000000003 103.09000000000002 L 442.7700000000003 103.13000000000002 L 443.06000000000034 102.64000000000003 L 443.13000000000034 101.70000000000003 L 443.98000000000036 101.66000000000003 L 445.67000000000036 102.19000000000003 L 446.17000000000036 102.88000000000002 L 444.74000000000035 104.58000000000003 L 445.41000000000037 105.28000000000003 L 445.43000000000035 105.83000000000003 L 446.6400000000003 103.79000000000002 L 447.13000000000034 102.25000000000001 L 447.5800000000003 102.25000000000001 L 447.9800000000003 103.27000000000001 L 447.9800000000003 103.85000000000001 L 447.1100000000003 104.77000000000001 L 446.8400000000003 105.76 L 446.9200000000003 108.47 L 447.1800000000003 108.8 L 447.6500000000003 108.92 L 448.2300000000003 108.78 L 449.1900000000003 107.85 L 448.72000000000025 106.85 L 448.86000000000024 106.25 L 450.18000000000023 104.82 L 451.23000000000025 104.57 L 453.36000000000024 105.16 L 454.86000000000024 104.05 L 454.91000000000025 104.97 L 454.55000000000024 105.17999999999999 L 453.42000000000024 106.71 L 454.0100000000002 107.28999999999999 L 454.11000000000024 106.91999999999999 L 455.36000000000024 106.32 L 455.9400000000002 107.11 L 455.80000000000024 108.32 L 457.43000000000023 110.07 L 458.29000000000025 109.63 L 459.87000000000023 110.3 L 460.6400000000002 112.7 L 460.5300000000002 113.65 L 458.3400000000002 116.38000000000001 L 457.9600000000002 117.27000000000001 L 458.06000000000023 117.93 L 458.66000000000025 116.9 L 460.41000000000025 115.22 L 461.24000000000024 115.19 L 462.11000000000024 116 L 462.6300000000002 117.89 L 462.36000000000024 119.12 L 461.3900000000002 119.31 L 460.36000000000024 120.22 L 459.2000000000002 121.71 L 459.2700000000002 122.47999999999999 L 458.1100000000002 124.82999999999998 L 457.4900000000002 128.35 L 457.70000000000016 128.69 L 458.57 128.92 z M 459.09 129.37 L 459.03 128.58 L 459.55999999999995 127.05000000000001 L 459.1499999999999 125.98000000000002 L 459.2799999999999 125.32000000000002 L 460.18999999999994 124.08000000000003 L 460.73999999999995 123.89000000000003 L 460.78999999999996 126.24000000000002 L 460.56999999999994 127.58000000000003 L 459.7699999999999 128.18000000000004 L 459.09 129.37 z M 452.79 103.61 L 452.35 103.15 L 452.27000000000004 102.55000000000001 L 453.07000000000005 101.43 L 453.91 101.4 L 454.59000000000003 101.82000000000001 L 454.69000000000005 102.16000000000001 L 454.50000000000006 102.52000000000001 L 452.79 103.61 z M 456.29 107.79 L 456 107.49000000000001 L 456.06 106.96000000000001 L 457.12 106.07000000000001 L 457.6 106.14 L 458.1 106.99 L 457.96000000000004 107.6 L 457.56000000000006 107.42999999999999 L 456.29 107.79 z M 442.13 102.98 L 441.92 102.93 L 442.87 99.35000000000001 L 443.17 99.44000000000001 L 443.2 99.67000000000002 L 442.78999999999996 102.73000000000002 L 442.13 102.98 z"},{code:"MG",name:"Minas Gerais",gTransform:"matrix(1 0 0 1 139.79 56.66)",pathTransform:"translate(-445.79, -375.93)",d:"M 527.5 365.33 L 526.59 364.78 L 524.05 363.97 L 522.47 364.05 L 521.39 364.37 L 520.55 364.98 L 518.37 365.27 L 517.03 365.14 L 518.7 367.41 L 518.68 368.22 L 517.55 368.11 L 516.5 367.37 L 516.19 367.39 L 514.02 368.7 L 512.85 370.63 L 513.15 371.33 L 514.48 372 L 515 372.66 L 514.97 374.58 L 514.67 376.12 L 514.88 376.53 L 516.19 376.88 L 516.36 378.6 L 516.04 379.02 L 515.09 379.26 L 514.12 379.23 L 513.32 378.88 L 511.84 378.97 L 511.41 379.52 L 511.9 380.23 L 512.66 380.51 L 513.11 380.22 L 513.63 380.31 L 514.73 381.58 L 516 384.39 L 516.29 386.82 L 515.75 389.79 L 514.04 391.88 L 512.8 392.74 L 512.54 393.18 L 512.3 394.9 L 511.42 397.19 L 510.31 398.46 L 509.34 401.7 L 508.79 402.02 L 503.64 401.99 L 501.92 404.05 L 501.76 404.47 L 502.35 407.59 L 501.78 408.89 L 501.34 411.23 L 501.63 411.37 L 501.63 411.37 L 499.1 413.72 L 497.86 413.99 L 497.3 414.49 L 498.04 415.19 L 495.68 421.24 L 493.78 424.95 L 493.69 425.7 L 495.13 425.83 L 495.42 426.44 L 495.21 426.96 L 492.68 427.94 L 483.17 432.47 L 481.8 432.67 L 481.82 432.21 L 481.33 432.04 L 478.8 431.77 L 478.23 431.83 L 476.61 432.77 L 475.36 432.93 L 472.16 433.01 L 471.8 432.69 L 471.29 432.77 L 467.19 434.55 L 466.14 435.32 L 464.43 436.09 L 463.93 435.81 L 461.34 435.98 L 458.43 437.32 L 456.01 438.06 L 455.33 438.55 L 455.33 438.55 L 454.08 439.28 L 451.88 439.5 L 449.95 440.52 L 448.72 441.76 L 446.93 442.43 L 444.55 442.68 L 442.21 442.6 L 442.2 442.11 L 442.55 441.62 L 442.46 441.27 L 441.27 441.6 L 441.09 443.9 L 441.33 444.13 L 441.28 444.97 L 440.53 445.95 L 439.23 446.27 L 438.66 445.84 L 435.05 446.84 L 434.86 446.31 L 432.85 446.55 L 431.73 446.3 L 429.7 442.99 L 430.92 442.28 L 430.4 440.57 L 428.6 439.74 L 426.81 438.51 L 426.1 436.9 L 426.63 435.34 L 426.82 431.89 L 426.56 428.95 L 428.42 426.23 L 429.12 424.05 L 429.17 422.78 L 428.94 422.41 L 425.24 421.09 L 424.24 421.14 L 423.96 421.5 L 423.18 421.81 L 421.57 421.86 L 421.6 421.01 L 420.77 419.02 L 419.47 417.23 L 419.1 415.02 L 418.79 414.4 L 418 413.66 L 418.19 411.72 L 419.71 409.69 L 419.77 409.13 L 419.37 407.58 L 417.49 406.37 L 416.91 405.76 L 417.2 403.39 L 417.77 402.38 L 417.57 401.34 L 414.3 397.99 L 413 398.28 L 412.15 398.92 L 410.5 398.14 L 408.12 398.25 L 407.81 398.86 L 408.01 399.32 L 407.57 400.31 L 404.79 400.99 L 403.68 400.56 L 402.17 399.11 L 401.16 400.36 L 392.98 401.04 L 392.52 401.52 L 392.04 402.71 L 392.31 405.25 L 391.9 405.69 L 390.71 405.17 L 390.7 402.39 L 390.45 401.43 L 390.09 401.04 L 389.53 400.99 L 389.27 401.18 L 388.86 402.31 L 388.19 403.25 L 387.65 403.57 L 387.03 403.55 L 385.82 401.45 L 385.49 400.03 L 385.63 399.12 L 383.95 398.33 L 381.77 396.91 L 379.78 397.5 L 378.16 397.28 L 376.49 397.63 L 372.2 396.67 L 369.65 396.59 L 367.92 395.04 L 367.17 394.9 L 365.67 395.51 L 364.24 397.2 L 362.32 397.57 L 360.17 398.68 L 358.95 399.81 L 358.95 399.81 L 359.26 397.19 L 358.67 393.98 L 359.66 389.8 L 360.24 389.55 L 360.24 389.55 L 361.1 390.01 L 361.46 389.78 L 361.47 389.44 L 360.91 388.83 L 361.48 386.93 L 363.12 384.83 L 364.06 384.09 L 364.51 383.95 L 365.35 384.11 L 366.17 383.83 L 367.01 382.53 L 366.95 381.53 L 368.16 379.07 L 369.57 376.97 L 371.8 376.43 L 374.28 375.47 L 377.99 376.09 L 381.18 374.45 L 382.7 374.75 L 384.01 376.17 L 384.34 376.17 L 387.25 373.25 L 391.38 370.61 L 393.39 371.5 L 397.25 371.34 L 398.73 371.62 L 400.48 371.61 L 401.06 371.52 L 401.61 371.04 L 405.96 372.9 L 406.66 373.67 L 411.55 370.93 L 412.03 369.81 L 412.89 368.91 L 414.05 368.71 L 417.14 366.65 L 415.95 363.19 L 416.46 361.3 L 417.19 360.4 L 417.36 359.69 L 417.18 358.69 L 416.71 358.08 L 415.13 357.51 L 414.23 357.98 L 413.14 356.87 L 413.57 354.73 L 416.81 351.72 L 419.13 349.01 L 419.13 348.41 L 417.48 343.85 L 416.06 342.82 L 415.21 342.48 L 414.36 341.27 L 414.77 339.8 L 415.81 338.55 L 416.49 336.96 L 416.18 335.39 L 416.71 333.87 L 417.98 333.75 L 420.27 332.24 L 423.63 331.34 L 424.16 330.81 L 423.47 326.55 L 422.94 326.36 L 422.52 325.75 L 422.48 323.85 L 423.21 323.15 L 423.78 322.21 L 423.29 321.05 L 422.57 320.95 L 423.29 317.77 L 423.66 317.49 L 424.83 317.26 L 427.61 318.4 L 428.01 318.27 L 428.58 317.73 L 428 313.96 L 429.17 312.47 L 431.59 313.95 L 432.49 315.71 L 435.72 316.05 L 436.72 315.04 L 436.72 315.04 L 437.23 317.45 L 435.8 320.89 L 436.2 321.12 L 437.54 320.21 L 438.24 319.21 L 438.96 319.08 L 441.09 319.46 L 442.13 318.69 L 443.98 316.12 L 444.97 316.27 L 446.4 315.74 L 448.21 314.19 L 449.16 313.02 L 451.18 312.61 L 454.55 310.75 L 455.19 309.64 L 459.46 306.61 L 463.28 305.03 L 465.08 305.12 L 466.28 305.62 L 468.46 305.65 L 470.74 306.18 L 471.59 306.64 L 470.3 309.38 L 470.15 310.27 L 470.41 311.76 L 471.02 312.26 L 476.35 313.72 L 476.99 313.55 L 477.8 312.43 L 479.68 311.54 L 481.45 311.28 L 484.18 312.03 L 485.28 312.57 L 489.63 316.21 L 490.61 316.03 L 492.78 317.65 L 495.31 318.87 L 496.24 319.09 L 496.75 318.88 L 498.28 320.12 L 502.67 318.89 L 503.05 319.07 L 509.57 325.27 L 510.01 329.23 L 510.58 329.02 L 513.19 329.47 L 514.66 328.97 L 515.98 327.98 L 517.97 328.13 L 520.7 328.69 L 522.96 329.77 L 525.15 330.38 L 527.27 330.35 L 530.1 332.82 L 530.83 333.2 L 531.72 333.27 L 532.5 334.29 L 532.92 335.46 L 531.45 338.54 L 526.49 342.76 L 526.34 345.41 L 526.9 346.43 L 526.9 346.85 L 525.88 347.56 L 523.4 347.32 L 522.58 348.2 L 521.76 351.5 L 521.23 355.9 L 521.45 356.15 L 521.8 355.96 L 522 355.51 L 522.64 355.27 L 523.22 356.5 L 523 358.01 L 523.15 358.52 L 527.29 361.58 L 527.82 362.62 L 527.83 363.15 L 527.15 364.5 z"},{code:"MS",name:"Mato Grosso do Sul",gTransform:"matrix(1 0 0 1 -2.22 90.13)",pathTransform:"translate(-303.77, -409.4)",d:"M 358.95 399.81 L 358.55 402.27 L 358.27 402.67 L 356.77 403.45 L 355.45 403.49 L 354.98 403.71 L 353.76 404.74 L 351.77 407.42 L 351.04 408.07 L 350.03 408.37 L 349.41 410.05 L 349.25 412.98 L 346.66 416.62 L 345.7 417.14 L 345.47 417.52 L 345.78 419.45 L 345.7 420.4 L 344.49 422.74 L 342.49 425 L 342.84 425.85 L 342.56 427.06 L 341.12 428.09 L 340.72 429.3 L 338.99 430.99 L 337.73 433.43 L 335.78 435.3 L 328.22 439.83 L 326.96 440.97 L 326.22 442.51 L 325.38 443.59 L 325.38 443.59 L 319.97 445.86 L 318.86 446.68 L 317.93 449.01 L 317.95 450.16 L 316.5 453.72 L 315.83 454.4 L 314.17 455.41 L 313.06 455.73 L 312.73 456.08 L 311.16 464 L 310.8 464.82 L 308.42 466.38 L 308.42 466.38 L 305.87 464.05 L 302.46 462.16 L 298.47 464.13 L 297.79 464.88 L 296.13 465.37 L 293.55 465.8 L 291.19 465.34 L 290.18 464.69 L 289.71 460.42 L 289.39 459.72 L 288.49 458.77 L 288.26 456.3 L 288.77 454.96 L 288.13 454.17 L 288.04 453.73 L 288.04 450.86 L 287.15 448.89 L 286.55 446.15 L 286.5 445.43 L 287.09 444.07 L 287.11 442.46 L 285.54 441.37 L 285.16 440.57 L 285 438.41 L 283.35 436.59 L 281.18 436.33 L 279.67 436.64 L 277.84 436.35 L 275.38 434.39 L 274.82 432.9 L 273.28 433.23 L 271.11 435.97 L 270.11 435.37 L 268.39 436.18 L 267.31 436.34 L 265.57 435.65 L 263.01 435.16 L 259.55 435.39 L 255.89 434.68 L 255.41 433.77 L 253.42 433.64 L 252.53 434.16 L 250.03 433.28 L 250.94 426.01 L 250.51 423.63 L 251.11 422.21 L 252.09 420.75 L 252.69 414.72 L 252.03 412.39 L 251.98 410.66 L 251.22 409.7 L 250.79 409.61 L 250.3 410.26 L 249.66 407 L 248.87 405.13 L 247.66 403.11 L 247.31 401.28 L 251.34 398.98 L 252.1 398.1 L 247.9 394.24 L 253.28 382.82 L 254.4 382.76 L 254.12 380.63 L 253.38 380.5 L 256.61 370.17 L 257.27 369.01 L 254.18 363.16 L 254.21 361.25 L 254.21 361.25 L 254.91 361.45 L 255.93 362.55 L 258.08 364.07 L 263.7 362.1 L 265.75 360.1 L 267.77 357.15 L 267.86 355.98 L 269.26 354.53 L 271.85 354.56 L 273.41 354.34 L 274.18 354.68 L 275.84 354.17 L 277.19 352.92 L 279.21 352.43 L 280.48 352.63 L 281.24 353.78 L 284.03 355.03 L 286.65 355.5 L 287.3 355.85 L 287.57 356.71 L 288.35 357.73 L 291.38 358.89 L 292.64 360 L 293.88 360.57 L 298.4 359.94 L 299.66 359.14 L 300.15 358.29 L 301.58 357.68 L 304.02 357.75 L 305.61 358.79 L 305.91 360.16 L 306.15 360.41 L 307.14 360.45 L 309.27 359.57 L 310.28 359.63 L 315.9 353.62 L 317.24 353.49 L 316.01 360.1 L 314.21 360.8 L 312.55 363.63 L 312.36 364.09 L 312.51 364.62 L 313.81 364.73 L 315.55 366 L 320.17 366.27 L 320.74 365.7 L 323.4 365.62 L 324.27 365.7 L 325.44 366.27 L 326.99 365.96 L 326.99 365.96 L 327.18 367.73 L 326.92 370.31 L 327.15 371.42 L 327.43 371.83 L 328.09 372.02 L 329.23 371.35 L 331.48 372.25 L 331.56 372.67 L 330.25 374.43 L 329.68 375.6 L 329.42 376.44 L 329.55 376.77 L 333.35 377.47 L 336.13 377.31 L 338.83 378.99 L 339.97 379.16 L 341.41 379.87 L 342.08 380.48 L 345.15 382.04 L 345.83 382.89 L 349.18 384.23 L 350.67 384.27 L 352.57 384.7 L 354.19 386.25 L 357.34 386.86 L 360 389.1 L 360.24 389.55 L 360.24 389.55 L 359.66 389.8 L 358.67 393.98 L 359.26 397.19 z"},{code:"MT",name:"Mato Grosso",gTransform:"matrix(1 0 0 1 -23.8 -38.15)",pathTransform:"translate(-282.2, -281.12)",d:"M 206.96 296.05 L 208.43 294.62 L 212.54 292.05 L 213.06 289.6 L 214.49 285.82 L 215.42 284.74 L 217.06 284.21 L 217.49 283.8 L 218.07 282.96 L 218.59 280.71 L 220.25 278.7 L 220.81 276.46 L 220.88 274.75 L 220.3 273.26 L 220.34 271.21 L 218.81 267.87 L 217.91 267.9 L 217.33 267.39 L 216.9 264.14 L 217.04 262.82 L 218.4 261.74 L 219.8 259.99 L 219.97 259.24 L 218.56 255.65 L 217.49 255.22 L 216.38 255.11 L 212.88 255.2 L 211.66 254.09 L 211.9 253.53 L 194.74 253.48 L 195.64 244.48 L 194.14 241.73 L 193.87 239.97 L 193.9 239.17 L 194.9 235.65 L 194.52 233.72 L 195.46 232.05 L 194.63 229.78 L 194.48 228.39 L 194.22 227.78 L 193.44 227.31 L 193.38 226.96 L 194.67 221.97 L 195.43 220.55 L 194.83 219.31 L 193.43 218.34 L 193.43 218.34 L 241.28 218.02 L 242.49 217.29 L 243.67 212.07 L 245.05 207.85 L 244.59 205.91 L 243.93 204.54 L 243.83 203.69 L 244.25 202.84 L 245.11 202.2 L 246.31 200.38 L 246.58 199.37 L 246.24 198.53 L 246.3 197.77 L 246.5 197.16 L 247.68 195.96 L 247.68 195.96 L 248.85 197.04 L 251.3 201.1 L 251.7 202.86 L 253.07 206.82 L 254.39 208.75 L 255.16 210.37 L 254.93 212.81 L 255.41 215.21 L 256.14 217.41 L 257.67 218.52 L 260.67 221.27 L 264.05 222.97 L 264.28 223.91 L 264.24 225.01 L 264.47 225.5 L 265.42 225.9 L 266.24 225.73 L 267.87 226.18 L 268.41 226.9 L 268.61 227.98 L 268.96 228.3 L 270.33 227.85 L 274.02 229.34 L 308.06 231.76 L 371.03 235.24 L 371.03 235.24 L 370.38 236.26 L 369.82 238.15 L 368.72 239.4 L 368.28 242.54 L 367.85 243.39 L 367.48 243.66 L 365.54 248.95 L 365 251.92 L 364.96 254.87 L 363.08 260.86 L 363.14 261.72 L 364.53 263.06 L 364.37 263.93 L 363.55 264.82 L 363.5 265.32 L 364.6 267.57 L 364.13 270.88 L 364.14 272.45 L 364.66 273.03 L 365.1 276.08 L 364.36 278.84 L 365.34 282.18 L 366.3 282.69 L 367.1 282.71 L 367.1 282.71 L 367.18 283.34 L 366.91 284.47 L 365.94 285.33 L 365.59 286.23 L 365.75 288.95 L 365.36 290.02 L 363.36 293.19 L 362.33 295.82 L 361.12 296.6 L 361.24 301.78 L 359.64 304.87 L 359.06 307.61 L 359.54 308.75 L 359.55 309.55 L 358.38 312.42 L 357.54 315.35 L 356.15 316.78 L 354.94 317.51 L 353.71 316.83 L 352.64 317.09 L 350.99 318.1 L 349.07 320.04 L 348.69 320.78 L 348.05 324.88 L 347.34 325.84 L 345.36 330.03 L 345.04 330.31 L 342.32 331.17 L 339.67 331.3 L 338.27 333.92 L 336.52 334.89 L 336.44 336.43 L 335.62 337.86 L 334.34 338.9 L 333.84 339.91 L 333.51 341.86 L 332.26 343.88 L 330.34 345.65 L 328.32 346.49 L 327.62 347.26 L 327.24 350.17 L 324.69 354.02 L 324.29 357.43 L 324.45 358.14 L 325.86 360.33 L 326.04 363.76 L 326.99 365.96 L 326.99 365.96 L 325.44 366.27 L 324.27 365.7 L 323.4 365.62 L 320.74 365.7 L 320.17 366.27 L 315.55 366 L 313.81 364.73 L 312.51 364.62 L 312.36 364.09 L 312.55 363.63 L 314.21 360.8 L 316.01 360.1 L 317.24 353.49 L 315.9 353.62 L 310.28 359.63 L 309.27 359.57 L 307.14 360.45 L 306.15 360.41 L 305.91 360.16 L 305.61 358.79 L 304.02 357.75 L 301.58 357.68 L 300.15 358.29 L 299.66 359.14 L 298.4 359.94 L 293.88 360.57 L 292.64 360 L 291.38 358.89 L 288.35 357.73 L 287.57 356.71 L 287.3 355.85 L 286.65 355.5 L 284.03 355.03 L 281.24 353.78 L 280.48 352.63 L 279.21 352.43 L 277.19 352.92 L 275.84 354.17 L 274.18 354.68 L 273.41 354.34 L 271.85 354.56 L 269.26 354.53 L 267.86 355.98 L 267.77 357.15 L 265.75 360.1 L 263.7 362.1 L 258.08 364.07 L 255.93 362.55 L 254.91 361.45 L 254.21 361.25 L 254.21 361.25 L 253.55 360.58 L 253.23 359.78 L 253.77 359.07 L 251.33 356.92 L 250.05 357.55 L 249.53 357.5 L 248.36 356.82 L 247.91 356.12 L 245.89 354.71 L 244 353.95 L 243.7 353.63 L 243.4 352.51 L 243.17 349.58 L 242.56 347.81 L 242.37 344.15 L 243.25 342.51 L 244.39 341.42 L 244.73 339.64 L 244.68 337.75 L 243.72 337.81 L 243.32 338.41 L 242.94 338.57 L 216.08 337.49 L 215.03 324.84 L 209.66 318.71 L 214.54 318.65 L 214.19 311.1 L 211.55 305.78 L 211.06 303.81 L 211.32 302.75 L 211.93 302.2 L 212.58 300.92 L 211.14 297.99 L 208.03 296.95 z"},{code:"PA",name:"Pará",gTransform:"matrix(1 0 0 1 29.16 -180.48)",pathTransform:"translate(-335.15, -138.78)",d:"M 371.03 235.24 L 308.05999999999995 231.76000000000002 L 274.0199999999999 229.34000000000003 L 270.3299999999999 227.85000000000002 L 268.9599999999999 228.3 L 268.6099999999999 227.99 L 268.4099999999999 226.9 L 267.8599999999999 226.18 L 266.2299999999999 225.73000000000002 L 265.4099999999999 225.9 L 264.4599999999999 225.51000000000002 L 264.2299999999999 225.01000000000002 L 264.2699999999999 223.91000000000003 L 264.0399999999999 222.97000000000003 L 260.6599999999999 221.27000000000004 L 257.6599999999999 218.51000000000005 L 256.1199999999999 217.40000000000003 L 255.3999999999999 215.20000000000005 L 254.9199999999999 212.81000000000006 L 255.1499999999999 210.37000000000006 L 254.37999999999988 208.74000000000007 L 253.04999999999987 206.81000000000006 L 251.67999999999986 202.86000000000007 L 251.28999999999988 201.10000000000008 L 248.8399999999999 197.04000000000008 L 247.65999999999988 195.96000000000006 L 247.65999999999988 195.96000000000006 L 247.0899999999999 195.40000000000006 L 246.93999999999988 193.44000000000005 L 246.2999999999999 192.18000000000006 L 244.7099999999999 190.62000000000006 L 243.6399999999999 190.04000000000005 L 243.2699999999999 189.47000000000006 L 242.43999999999988 187.13000000000005 L 242.46999999999989 186.00000000000006 L 243.0499999999999 185.03000000000006 L 244.4999999999999 183.90000000000006 L 245.2799999999999 182.59000000000006 L 275.1799999999999 118.35000000000007 L 273.3699999999999 116.68000000000006 L 273.4999999999999 115.90000000000006 L 273.3099999999999 115.42000000000006 L 271.9199999999999 115.77000000000005 L 271.0699999999999 116.38000000000005 L 269.1999999999999 115.60000000000005 L 268.09999999999985 113.43000000000005 L 265.40999999999985 111.98000000000005 L 264.1399999999999 110.64000000000004 L 264.0599999999999 110.04000000000005 L 262.7399999999999 109.22000000000006 L 261.3699999999999 109.07000000000005 L 259.1199999999999 108.42000000000004 L 256.7399999999999 107.11000000000004 L 254.8599999999999 106.44000000000004 L 253.5099999999999 105.35000000000004 L 252.8799999999999 104.45000000000003 L 248.2999999999999 101.91000000000003 L 243.6599999999999 98.14000000000003 L 243.3599999999999 97.70000000000003 L 243.3199999999999 96.77000000000002 L 242.7699999999999 94.94000000000003 L 240.9299999999999 93.71000000000002 L 240.2299999999999 93.90000000000002 L 239.8699999999999 93.70000000000002 L 238.03999999999988 91.72000000000001 L 238.0899999999999 89.61000000000001 L 238.43999999999988 88.92000000000002 L 238.25999999999988 88.51000000000002 L 236.56999999999988 87.66000000000003 L 236.32999999999987 86.98000000000002 L 236.14999999999986 84.71000000000002 L 236.57999999999987 83.26000000000002 L 236.17999999999986 78.40000000000002 L 236.17999999999986 78.40000000000002 L 234.58999999999986 61.43000000000002 L 234.58999999999986 61.43000000000002 L 235.33999999999986 61.75000000000002 L 235.76999999999987 62.33000000000002 L 235.74999999999986 62.81000000000002 L 236.19999999999985 63.210000000000015 L 237.11999999999983 63.490000000000016 L 238.48999999999984 62.780000000000015 L 238.95999999999984 61.97000000000001 L 241.66999999999985 62.20000000000001 L 242.47999999999985 61.15000000000001 L 241.93999999999986 59.34000000000001 L 243.72999999999985 58.98000000000001 L 245.13999999999984 57.35000000000001 L 247.77999999999983 58.36000000000001 L 249.65999999999983 58.39000000000001 L 250.19999999999982 56.870000000000005 L 253.52999999999983 55.25000000000001 L 255.49999999999983 55.64000000000001 L 256.65999999999985 55.53000000000001 L 257.14999999999986 55.28000000000001 L 258.34999999999985 53.80000000000001 L 258.74999999999983 52.40000000000001 L 260.2099999999998 51.30000000000001 L 261.0699999999998 51.19000000000001 L 261.7199999999998 51.65000000000001 L 263.8299999999998 50.52000000000001 L 264.23999999999984 50.63000000000001 L 264.60999999999984 51.62000000000001 L 265.33999999999986 52.070000000000014 L 267.36999999999983 52.55000000000001 L 268.97999999999985 52.80000000000001 L 269.53999999999985 52.20000000000001 L 271.20999999999987 51.81000000000001 L 271.98999999999984 52.09000000000001 L 272.80999999999983 52.08000000000001 L 273.66999999999985 51.74000000000001 L 275.90999999999985 52.040000000000006 L 280.57999999999987 53.42000000000001 L 281.53999999999985 53.28000000000001 L 282.53999999999985 52.41000000000001 L 282.5099999999999 50.13000000000001 L 280.4399999999999 47.63000000000001 L 279.1999999999999 47.00000000000001 L 279.6899999999999 45.32000000000001 L 280.9999999999999 43.870000000000005 L 281.27999999999986 42.760000000000005 L 281.58999999999986 42.59 L 282.29999999999984 42.78 L 283.1299999999998 43.54 L 285.47999999999985 44.65 L 297.09999999999985 42.32 L 298.66999999999985 44.01 L 299.6899999999998 44.07 L 300.1299999999998 43.78 L 300.1299999999998 43.78 L 300.74999999999983 44.35 L 301.11999999999983 46.65 L 300.49999999999983 47.949999999999996 L 300.24999999999983 52.489999999999995 L 300.48999999999984 53.92999999999999 L 300.79999999999984 54.46999999999999 L 301.96999999999986 54.489999999999995 L 303.04999999999984 54.199999999999996 L 306.4399999999998 54.56999999999999 L 307.72999999999985 55.059999999999995 L 309.65999999999985 56.10999999999999 L 310.32999999999987 56.90999999999999 L 310.8199999999999 58.18999999999999 L 312.0099999999999 58.30999999999999 L 313.14999999999986 59.14999999999999 L 313.9499999999999 60.12999999999999 L 314.78999999999985 60.39999999999999 L 316.11999999999983 60.25999999999999 L 316.49999999999983 59.83999999999999 L 317.4399999999998 59.69999999999999 L 320.2799999999998 62.359999999999985 L 320.9599999999998 62.329999999999984 L 321.4499999999998 63.509999999999984 L 320.7699999999998 63.73999999999998 L 320.5799999999998 64.45999999999998 L 321.3399999999998 67.28999999999998 L 323.3599999999998 69.54999999999998 L 325.9299999999998 70.27999999999999 L 326.0999999999998 70.60999999999999 L 325.6699999999998 73.74999999999999 L 325.8599999999998 75.85999999999999 L 326.5299999999998 77.36999999999999 L 327.1499999999998 77.92999999999999 L 327.7399999999998 79.74 L 327.6099999999998 81.32 L 329.1099999999998 84.8 L 329.9299999999998 84.99 L 330.70999999999975 84.63 L 333.63999999999976 87.91 L 333.5599999999998 90.34 L 333.9699999999998 91.28 L 334.9199999999998 91.47 L 335.2499999999998 91.94 L 335.5599999999998 93.52 L 335.3499999999998 94.21 L 335.4599999999998 95.50999999999999 L 337.3299999999998 96.89999999999999 L 337.7599999999998 98.39999999999999 L 339.2099999999998 99.42999999999999 L 341.99999999999983 100.11 L 343.29999999999984 99.99 L 344.0699999999998 99.64999999999999 L 345.0099999999998 99.71 L 345.0099999999998 99.71 L 344.47999999999985 100.44999999999999 L 344.76999999999987 102.03999999999999 L 344.59999999999985 102.57 L 343.30999999999983 103.67999999999999 L 341.91999999999985 103.85 L 341.41999999999985 103.66999999999999 L 340.57999999999987 102.87999999999998 L 339.91999999999985 102.72999999999998 L 336.53999999999985 104.30999999999997 L 336.16999999999985 104.84999999999998 L 334.5699999999998 105.56999999999998 L 333.9399999999998 105.54999999999998 L 332.3899999999998 106.13999999999999 L 332.42999999999984 106.71999999999998 L 338.8899999999998 105.65999999999998 L 339.7699999999998 106.31999999999998 L 339.8999999999998 106.77999999999997 L 339.8999999999998 107.43999999999997 L 339.2799999999998 107.93999999999997 L 339.5799999999998 108.29999999999997 L 340.2099999999998 108.09999999999997 L 341.0699999999998 107.09999999999997 L 342.0899999999998 107.08999999999996 L 342.6199999999998 106.81999999999996 L 343.2199999999998 106.93999999999997 L 344.2899999999998 106.51999999999997 L 345.4299999999998 105.94999999999997 L 348.70999999999975 103.60999999999997 L 350.20999999999975 103.25999999999998 L 352.0499999999997 102.44999999999997 L 355.20999999999975 100.60999999999997 L 355.7499999999998 99.60999999999997 L 356.4199999999998 99.08999999999997 L 358.50999999999976 98.07999999999997 L 359.1699999999998 97.35999999999997 L 358.9199999999998 96.68999999999997 L 359.12999999999977 96.27999999999997 L 360.25999999999976 95.99999999999997 L 361.34999999999974 96.05999999999997 L 361.75999999999976 96.26999999999997 L 362.13999999999976 100.06999999999996 L 361.6199999999998 102.64999999999996 L 361.94999999999976 104.26999999999997 L 362.75999999999976 105.86999999999996 L 364.06999999999977 107.21999999999996 L 364.3699999999998 108.85999999999996 L 364.2499999999998 109.32999999999996 L 362.4099999999998 111.16999999999996 L 361.93999999999977 111.29999999999995 L 361.06999999999977 110.77999999999996 L 359.2499999999998 110.25999999999996 L 357.9899999999998 109.94999999999996 L 357.0599999999998 110.08999999999996 L 354.9299999999998 109.04999999999995 L 354.6699999999998 107.92999999999995 L 353.7899999999998 107.39999999999995 L 351.5099999999998 111.21999999999994 L 350.8999999999998 113.58999999999995 L 351.5799999999998 116.55999999999995 L 352.05999999999983 117.19999999999995 L 352.97999999999985 117.81999999999995 L 351.96999999999986 116.67999999999995 L 351.53999999999985 113.98999999999995 L 351.65999999999985 113.46999999999996 L 354.22999999999985 109.24999999999996 L 356.53999999999985 110.42999999999996 L 356.64999999999986 110.87999999999997 L 359.17999999999984 113.32999999999997 L 358.92999999999984 115.34999999999997 L 358.1899999999998 115.89999999999996 L 358.5899999999998 118.22999999999996 L 359.1099999999998 119.35999999999996 L 360.2299999999998 120.10999999999996 L 360.9699999999998 120.25999999999996 L 361.4899999999998 120.74999999999996 L 361.1499999999998 120.10999999999996 L 360.3799999999998 119.86999999999996 L 359.17999999999984 118.82999999999996 L 358.9599999999998 118.14999999999995 L 359.2999999999998 113.94999999999995 L 360.1199999999998 112.75999999999995 L 361.5499999999998 113.48999999999995 L 362.37999999999977 114.68999999999996 L 362.2899999999998 115.47999999999996 L 363.4899999999998 116.33999999999996 L 363.7399999999998 116.04999999999995 L 362.7399999999998 114.78999999999995 L 361.81999999999977 112.68999999999996 L 361.81999999999977 112.24999999999996 L 364.07999999999976 109.92999999999996 L 365.69999999999976 110.01999999999997 L 367.62999999999977 110.65999999999997 L 367.96999999999974 111.21999999999997 L 367.35999999999973 111.80999999999997 L 367.6799999999997 112.08999999999997 L 368.15999999999974 112.11999999999998 L 369.1899999999997 111.94999999999997 L 370.5199999999997 111.04999999999997 L 374.6099999999997 110.08999999999997 L 375.37999999999965 110.28999999999998 L 377.11999999999966 111.34999999999998 L 380.2899999999997 110.92999999999998 L 381.3599999999997 110.51999999999998 L 382.37999999999965 109.50999999999998 L 383.3599999999997 108.91999999999997 L 385.0999999999997 108.40999999999997 L 385.86999999999966 108.47999999999996 L 385.92999999999967 109.22999999999996 L 383.88999999999965 113.24999999999996 L 383.64999999999964 114.74999999999996 L 383.18999999999966 115.81999999999995 L 382.3599999999997 116.84999999999995 L 382.3499999999997 117.72999999999995 L 382.92999999999967 119.14999999999995 L 382.6099999999997 121.61999999999995 L 383.48999999999967 120.42999999999995 L 383.49999999999966 119.02999999999994 L 385.0399999999997 116.02999999999994 L 386.1699999999997 112.83999999999995 L 387.2899999999997 111.27999999999994 L 387.55999999999966 111.00999999999995 L 388.31999999999965 110.95999999999995 L 388.89999999999964 110.60999999999996 L 390.71999999999963 110.37999999999995 L 391.5999999999996 109.02999999999996 L 393.1099999999996 107.33999999999996 L 394.46999999999963 105.07999999999996 L 394.9899999999996 104.61999999999996 L 395.77999999999963 105.10999999999996 L 396.39999999999964 104.64999999999996 L 398.01999999999964 106.98999999999997 L 399.20999999999964 107.57999999999997 L 399.1599999999996 106.83999999999997 L 398.8099999999996 106.08999999999997 L 399.4299999999996 105.07999999999997 L 402.9399999999996 104.56999999999996 L 401.9099999999996 104.24999999999997 L 398.39999999999964 104.70999999999997 L 398.08999999999963 104.49999999999997 L 398.37999999999965 102.06999999999996 L 398.88999999999965 101.77999999999996 L 399.55999999999966 102.15999999999995 L 400.57999999999964 102.26999999999995 L 401.64999999999964 99.16999999999996 L 400.96999999999963 97.77999999999996 L 400.9999999999996 97.09999999999995 L 402.1699999999996 95.28999999999995 L 405.0099999999996 92.80999999999995 L 405.3699999999996 92.72999999999995 L 406.4799999999996 93.86999999999995 L 409.4099999999996 91.77999999999994 L 409.8699999999996 91.70999999999995 L 410.2699999999996 92.15999999999995 L 410.3699999999996 92.72999999999995 L 410.0499999999996 93.39999999999995 L 411.1199999999996 93.23999999999995 L 411.9299999999996 92.65999999999995 L 412.2899999999996 91.87999999999995 L 412.9199999999996 91.68999999999996 L 413.1999999999996 91.83999999999996 L 413.9399999999996 93.22999999999996 L 415.2699999999996 94.42999999999996 L 415.4699999999996 93.86999999999996 L 415.35999999999956 93.48999999999997 L 414.4 93 L 414.26 92.71 L 414.13 91.50999999999999 L 414.3 91.08999999999999 L 414.74 90.89999999999999 L 417.02 91.16 L 418.2 91.81 L 418.82 92.83 L 420.45 93.53999999999999 L 422.09999999999997 92.75999999999999 L 422.62999999999994 94.89999999999999 L 422.12999999999994 95.21 L 422.09999999999997 95.8 L 423.02 95.28 L 424.18 92.93 L 424.56 93.16000000000001 L 424.33 94.49000000000001 L 424.74 94.93 L 427.25 94.67 L 427.7 95.32000000000001 L 428.15999999999997 97.00000000000001 L 427.55999999999995 97.95000000000002 L 428.40999999999997 97.45000000000002 L 428.66999999999996 97.82000000000002 L 430.55999999999995 97.96000000000002 L 434.0899999999999 96.72000000000003 L 433.7799999999999 98.30000000000003 L 433.0299999999999 100.13000000000002 L 434.49999999999994 99.64000000000003 L 435.0899999999999 99.02000000000002 L 435.7199999999999 100.64000000000003 L 435.7199999999999 100.64000000000003 L 434.94999999999993 101.09000000000003 L 434.4799999999999 102.12000000000003 L 434.63999999999993 103.50000000000003 L 433.92999999999995 107.89000000000003 L 433.35999999999996 108.63000000000002 L 432.21999999999997 108.78000000000003 L 432.16999999999996 109.40000000000003 L 432.43999999999994 109.89000000000003 L 433.42999999999995 109.73000000000003 L 433.85999999999996 110.26000000000003 L 433.78 111.87000000000003 L 432.88 114.89000000000003 L 432.52 115.60000000000002 L 430.78 117.17000000000002 L 430.28 119.55000000000001 L 430.40999999999997 121.19000000000001 L 426.72999999999996 124.28000000000002 L 427.77 125.86000000000001 L 426.97999999999996 126.67000000000002 L 427.15999999999997 128.49 L 426.7 129.77 L 425.87 131.22 L 424.39 132.98 L 422.43 134.51999999999998 L 420.83 139.20999999999998 L 420.53999999999996 141.10999999999999 L 420.06999999999994 142.32 L 417.62999999999994 144.64 L 416.50999999999993 145.1 L 415.88999999999993 147.98 L 414.3399999999999 149.14999999999998 L 413.9099999999999 150.29999999999998 L 412.3599999999999 152.46999999999997 L 411.1899999999999 153.38999999999996 L 408.83999999999986 153.15999999999997 L 394.1299999999999 164.98999999999998 L 394.6199999999999 165.07 L 394.6199999999999 165.07 L 396.9099999999999 165.88 L 398.7799999999999 165.64 L 400.06999999999994 165.76 L 401.0899999999999 167.42 L 401.4799999999999 167.73 L 402.3499999999999 167.86999999999998 L 403.6099999999999 169.03999999999996 L 403.5699999999999 169.66999999999996 L 403.1999999999999 170.33999999999995 L 402.47999999999985 170.70999999999995 L 401.5099999999998 170.77999999999994 L 401.2199999999998 171.05999999999995 L 401.3099999999998 172.46999999999994 L 402.31999999999977 173.80999999999995 L 401.39999999999975 176.55999999999995 L 400.75999999999976 177.03999999999994 L 399.2999999999998 177.49999999999994 L 399.0499999999998 177.95999999999995 L 399.3399999999998 179.15999999999994 L 399.1499999999998 180.49999999999994 L 397.8499999999998 180.64999999999995 L 396.3399999999998 181.98999999999995 L 395.4899999999998 183.25999999999996 L 395.63999999999976 184.76999999999995 L 395.39999999999975 185.26999999999995 L 392.89999999999975 186.46999999999994 L 389.4899999999997 187.60999999999993 L 387.0199999999997 189.38999999999993 L 386.8299999999997 189.73999999999992 L 387.2599999999997 191.92999999999992 L 387.3199999999997 194.5999999999999 L 386.03999999999974 196.6999999999999 L 384.6299999999997 198.3799999999999 L 384.47999999999973 198.9499999999999 L 384.64999999999975 199.8299999999999 L 385.2399999999997 200.7899999999999 L 386.90999999999974 202.52999999999992 L 387.65999999999974 202.8499999999999 L 387.8099999999997 203.14999999999992 L 387.1499999999997 207.1899999999999 L 385.3899999999997 212.33999999999992 L 384.3099999999997 213.14999999999992 L 382.60999999999973 216.38999999999993 L 382.4299999999997 217.37999999999994 L 381.4899999999997 218.91999999999993 L 380.7499999999997 219.76999999999992 L 379.6999999999997 219.92999999999992 L 378.3299999999997 220.8499999999999 L 377.2999999999997 222.7699999999999 L 376.08999999999975 224.4499999999999 L 374.90999999999974 225.5399999999999 L 373.75999999999976 227.11999999999992 L 372.62999999999977 231.57999999999993 L 371.03 235.24 z M 392.19 104.93 L 387.67 106.89 L 384.28000000000003 107.41 L 382.26000000000005 107.1 L 381.61000000000007 108.22999999999999 L 379.7700000000001 109.41999999999999 L 379.05000000000007 108.80999999999999 L 378.44000000000005 107.27999999999999 L 378.21000000000004 107.55999999999999 L 378.63000000000005 108.78999999999999 L 378.2900000000001 109.6 L 377.5800000000001 110.00999999999999 L 373.8100000000001 108.36999999999999 L 373.0100000000001 109.08999999999999 L 368.8200000000001 110.35 L 365.6200000000001 109.78 L 364.8100000000001 109.17 L 364.5700000000001 107.32000000000001 L 364.3400000000001 106.91000000000001 L 363.2300000000001 105.89000000000001 L 362.1700000000001 104.29000000000002 L 361.9600000000001 102.51000000000002 L 362.4800000000001 99.76000000000002 L 363.1000000000001 99.38000000000002 L 364.86000000000007 99.74000000000002 L 365.7900000000001 98.99000000000002 L 365.87000000000006 98.43000000000002 L 364.57000000000005 98.86000000000003 L 363.35 98.73000000000003 L 362.41 98.02000000000004 L 362.23 96.97000000000004 L 362.57 91.89000000000004 L 363.3 91.13000000000004 L 363.65000000000003 91.88000000000004 L 365.41 92.48000000000003 L 365.96000000000004 92.42000000000003 L 365.50000000000006 92.00000000000003 L 364.2300000000001 91.78000000000003 L 363.3300000000001 89.62000000000003 L 363.6900000000001 87.94000000000003 L 364.5800000000001 85.97000000000003 L 365.9100000000001 84.64000000000003 L 366.87000000000006 84.07000000000004 L 368.21000000000004 83.58000000000004 L 369.53000000000003 83.45000000000005 L 372.99 83.97000000000004 L 380.2 85.74000000000004 L 383.9 85.28000000000004 L 384.01 84.98000000000005 L 385.15 84.36000000000004 L 387.31 83.99000000000004 L 390.2 84.28000000000004 L 393 85.10000000000004 L 399.48 85.95000000000003 L 400.11 86.42000000000003 L 400.06 87.65000000000003 L 399.36 88.39000000000003 L 398.68 89.89000000000003 L 398.32 92.54000000000003 L 397.46 95.84000000000003 L 396.16999999999996 96.52000000000004 L 395.81999999999994 97.21000000000004 L 396.04999999999995 98.40000000000003 L 394.06999999999994 100.98000000000003 L 392.67999999999995 104.48000000000003 L 392.19 104.93 z M 344.98 104.76 L 344.23 104.25 L 345.33000000000004 102 L 345.24000000000007 100.21 L 345.49000000000007 100 L 347.82000000000005 99.52 L 348.72 98.66 L 348.87 98.16 L 348.67 95.82 L 349.53000000000003 93.24 L 350.79 91.75 L 353.08000000000004 90.28 L 355.95000000000005 90.08 L 356.6700000000001 92.44 L 355.57000000000005 94.63 L 354.72 97.67 L 353.62 98.34 L 352.28000000000003 100.37 L 351.50000000000006 101.09 L 346.56000000000006 104.4 L 344.98 104.76 z M 373.46 81.86 L 372.43 81.61 L 369.98 81.69 L 369.19 81.53 L 368.9 81.27 L 368.52 80.17999999999999 L 368.53 78.94 L 370.03999999999996 78.52 L 371.92999999999995 78.56 L 374.11999999999995 77.27 L 378.92999999999995 76.67 L 379.69999999999993 76.93 L 380.37999999999994 77.61000000000001 L 380.19999999999993 78.63000000000001 L 377.63999999999993 80.02000000000001 L 375.85999999999996 82.50000000000001 L 374.76 83 L 373.46 81.86 z M 378.25 81.86 L 380.11 80.66 L 382.09000000000003 80.69 L 383.74 81.31 L 384.27 82.3 L 384.32 82.92 L 383.44 83.69 L 380.59 83.97 L 379.41999999999996 84.28999999999999 L 377.15999999999997 83.39999999999999 L 376.96 82.86999999999999 L 378.25 81.86 z M 361.27 86.25 L 360.77 85.99 L 360.15999999999997 86.03 L 358.61999999999995 85.34 L 358.8299999999999 84.18 L 359.4699999999999 83.26 L 361.38999999999993 82.86 L 363.74999999999994 81.96 L 365.06999999999994 82.03999999999999 L 365.86999999999995 82.72 L 365.9599999999999 82.85 L 364.0299999999999 84.46 L 362.9599999999999 84.8 L 361.27 86.25 z M 370.69 76.56 L 369.87 76.26 L 369.7 74.60000000000001 L 369.84999999999997 74.00000000000001 L 371.02 72.69000000000001 L 373.46999999999997 71.77000000000001 L 373.71999999999997 71.89000000000001 L 374.24999999999994 72.57000000000002 L 374.28999999999996 73.46000000000002 L 372.34 75.45000000000002 L 370.69 76.56 z M 356.86 96.78 L 356.72 96.37 L 356.91 95.44 L 357.95000000000005 92.63 L 360.54 90.94 L 361.26000000000005 90.66 L 361.95000000000005 90.8 L 361.79 92.59 L 360.23 93.03 L 358.61 95.22 L 356.86 96.78 z M 367.77 79.21 L 366.58 78.89999999999999 L 366.28 78.41999999999999 L 367.15999999999997 77.46 L 367.86999999999995 73.50999999999999 L 368.75999999999993 72.27999999999999 L 369.04999999999995 72.40999999999998 L 369.11999999999995 72.72999999999998 L 369.09999999999997 75.20999999999998 L 369.7 77.07999999999998 L 369.38 77.95999999999998 L 368.35 78.35999999999999 L 367.77 79.21 z M 352.96 89.4 L 352.69 89.21000000000001 L 352.81 88.60000000000001 L 353.36 88.24000000000001 L 354.55 86.53000000000002 L 355.31 84.99000000000001 L 356.04 84.33000000000001 L 357.49 83.79 L 357.29 85.28 L 356.89000000000004 86.28 L 355.17 87.94 L 352.96 89.4 z M 366.83 82.37 L 366.22999999999996 82.22 L 365.39 81.51 L 364.43 79.87 L 364.38 79.49000000000001 L 364.61 79.2 L 365.42 78.62 L 367.27000000000004 79.46000000000001 L 367.56000000000006 79.89000000000001 L 367.80000000000007 81.98000000000002 L 366.83 82.37 z M 361.45 112.93 L 360.8 112.82000000000001 L 359.92 112.30000000000001 L 359.23 112.76 L 358.48 112.48 L 356.8 110.74000000000001 L 356.8 110.13000000000001 L 358.08 110.12 L 361.14 111.44 L 361.45 112.93 z M 340.3 107.39 L 340.34000000000003 106.36 L 340.14000000000004 106.06 L 340.74000000000007 105.07000000000001 L 343.1000000000001 104.19000000000001 L 343.88000000000005 104.57000000000001 L 344.75000000000006 105.43 L 344.46000000000004 105.78 L 343.43000000000006 106.25 L 340.89000000000004 106.66 L 340.3 107.39 z M 353 100.7 L 352.82 100.67 L 352.83 100.32000000000001 L 353.37 99.38000000000001 L 355.16 97.76 L 355.58000000000004 96.52000000000001 L 355.63000000000005 95.22000000000001 L 355.87000000000006 94.92000000000002 L 356.19000000000005 95.36000000000001 L 356.19000000000005 96.87000000000002 L 355.30000000000007 99.60000000000002 L 354.68000000000006 100.25000000000003 L 353 100.7 z M 359.3 90.8 L 360.95 87.84 L 361.83 87.63000000000001 L 362.53999999999996 87.82000000000001 L 362.80999999999995 88.69000000000001 L 362.22999999999996 89.4 L 359.3 90.8 z M 390.72 109.77 L 389.88000000000005 109.42 L 389.5400000000001 108.36 L 390.5800000000001 106.64 L 391.6500000000001 106.31 L 391.8400000000001 106.41 L 391.8200000000001 107.14999999999999 L 391.0800000000001 109.38999999999999 L 390.72 109.77 z M 357.24 90.3 L 356.7 90.1 L 357.02 88.05999999999999 L 358.34999999999997 86.24999999999999 L 358.58 86.28999999999999 L 359.87 87.16999999999999 L 359.86 87.41999999999999 L 358.31 88.05999999999999 L 357.24 90.3 z M 359.47 95.33 L 360.19000000000005 95.36 L 359.7900000000001 95.81 L 358.8500000000001 96.12 L 358.74000000000007 97.24000000000001 L 357.95000000000005 97.95 L 356.26000000000005 98.79 L 356.1 98.61 L 356.37 97.78 L 356.84000000000003 97.15 L 358.57000000000005 95.48 L 359.47 95.33 z M 336.91 105.54 L 336.36 105.35000000000001 L 336.29 105.00000000000001 L 336.72 104.60000000000001 L 340.28000000000003 103.00000000000001 L 340.82000000000005 103.70000000000002 L 340.81000000000006 103.90000000000002 L 339.4100000000001 104.63000000000002 L 336.91 105.54 z M 400.44 100.76 L 399.41 100.57000000000001 L 398.59000000000003 99.78 L 399.46000000000004 98.53 L 400.8 98.52 L 400.99 99.71 L 400.89 100.3 L 400.44 100.76 z M 363.19 81.86 L 360.83 82.56 L 360.24 82.57000000000001 L 360.06 82.36000000000001 L 361.09 81.32000000000001 L 362.13 80.81 L 363.17 80.98 L 363.61 81.32000000000001 L 363.76 81.55000000000001 L 363.61 81.76 L 363.19 81.86 z M 357.92 90.45 L 357.84000000000003 89.69 L 358.09000000000003 89.19 L 360.57000000000005 87.73 L 359.6700000000001 89.73 L 358.86000000000007 90.36 L 357.92 90.45 z M 360.06 94.98 L 359.61 94.86 L 359.54 94.63 L 360.32 93.13 L 361.51 93.14999999999999 L 361.39 94.49999999999999 L 360.06 94.98 z M 388.1 110.81 L 387.82000000000005 110.58 L 388.72 108.98 L 389.40000000000003 108.58 L 389.63000000000005 109.33 L 390.14000000000004 109.7 L 389.88000000000005 110.22 L 389.45000000000005 110.56 L 388.82000000000005 110.38 L 388.1 110.81 z M 361.44 87.49 L 360.55 87.42 L 360.57 87.23 L 362.93 85.39 L 362.97 86.35 L 362.74 86.97999999999999 L 362.49 87.32 L 361.44 87.49 z M 428.9 97.71 L 428.52 97.17999999999999 L 428.71 96.41999999999999 L 429.72999999999996 95.50999999999999 L 429.97999999999996 95.66 L 430.21 97.41 L 428.9 97.71 z"},{code:"PB",name:"Paraíba",gTransform:"matrix(1 0 0 1 275.13 -126.21)",pathTransform:"translate(-581.13, -193.05)",d:"M 610.43 199.15 L 607.93 197.09 L 607.11 196.83 L 604.46 196.62 L 602.15 197.69 L 600.67 198.97 L 600.22 200.77 L 598.32 201.8 L 596.31 202.25 L 595.17 202.23 L 595.17 202.83 L 594.37 203.36 L 592.19 203.65 L 588.31 203.39 L 586.7 204.27 L 586.15 204.91 L 584.33 205.01 L 583.44 205.7 L 582.9 206.46 L 583.29 207.19 L 583.3 207.73 L 582.9 208.21 L 581.12 209.74 L 579.78 209.9 L 578.13 210.74 L 576.53 209.95 L 575.58 209.01 L 575.23 206.77 L 575.47 206.28 L 575.29 205.98 L 574.15 205.66 L 573.71 205.95 L 572.2 206.2 L 572.24 205.75 L 574.77 203.11 L 574.94 202.68 L 574.22 200.81 L 574.18 200.34 L 574.55 199.56 L 577.55 198.49 L 577.66 198.19 L 577.16 196.8 L 573.66 194.88 L 572.18 195.29 L 569.96 196.55 L 569.03 198.06 L 567.55 198.93 L 566.5 199.24 L 563.8 201.12 L 562.28 202.76 L 560.65 202.99 L 558.02 203.96 L 557.25 203.63 L 557.3 202.95 L 556.67 201.71 L 556.29 201.63 L 555.36 202.36 L 553.85 202.68 L 552.86 202.35 L 551.46 200.44 L 551.06 200.35 L 551.06 200.35 L 550.89 200.1 L 552.08 198.98 L 553.69 195.49 L 553.35 194.3 L 552.66 194.22 L 551.42 193.33 L 551.44 191.67 L 551.09 190.95 L 550.51 190.66 L 550.27 190.25 L 550.39 189.32 L 550.56 188.94 L 551.65 188.31 L 552.31 187 L 551.79 185.69 L 552.82 182.69 L 553.66 181.54 L 553.74 181 L 553.74 181 L 554.31 180.54 L 556.24 182.18 L 557.14 182.6 L 560.02 183.21 L 561.18 182.08 L 564.41 180.42 L 565.23 179.71 L 565.33 178.67 L 565.74 177.72 L 568.92 176.51 L 570.35 176.39 L 573.61 175.35 L 574.25 175.43 L 574.78 175.87 L 574.79 177.06 L 571.8 180.27 L 571.36 181.23 L 570.98 182.97 L 570.57 183.35 L 569.72 183.6 L 569.51 183.91 L 569.43 185.63 L 572.96 186.15 L 573.28 186.38 L 573.59 187.76 L 573.88 187.99 L 577.03 186.73 L 578.8 186.65 L 580.75 186.95 L 581.64 188.12 L 581.12 189.66 L 581.95 190.4 L 584.3 189.47 L 584.8 188.73 L 585.35 187.52 L 584.88 186.58 L 584.72 185.16 L 585.2 184.57 L 586.21 184.89 L 585.68 183.36 L 584.96 182.58 L 585.27 181.1 L 587.09 179.75 L 588.47 179.7 L 588.89 180.09 L 588.79 181.09 L 589.41 181.58 L 592.83 181.98 L 593.36 182.33 L 599.19 181.94 L 601.36 182.24 L 603.82 183.34 L 604.86 182.94 L 608.36 183.15 L 609.29 182.91 L 609.29 182.91 L 609.38 185.31 L 610.83 189.7 L 610.89 190.34 L 610.71 191.28 L 610.34 191.73 L 610.31 192.61 L 610.89 191.87 L 611.4 190.37 L 611.41 192.35 L 612 193.36 L 611.73 198.54 L 611.37 199.14 z"},{code:"PE",name:"Pernambuco",gTransform:"matrix(1 0 0 1 254.6 -106.99)",pathTransform:"translate(-560.6, -212.26)",d:"M 558.28 227.19 L 557.06 224.15 L 557.05 223.21 L 554.94 222.35 L 554.44 221.98 L 553.99 221.15 L 554.6 220.26 L 554.58 219.64 L 554.13 219.32 L 553.13 219.33 L 552.7 219.77 L 552.41 221.51 L 551.98 221.66 L 551.59 221.4 L 551.05 219.75 L 549.47 218.6 L 546.48 218.2 L 544.12 217.43 L 542.77 216.62 L 541.94 215.18 L 540.45 214.62 L 539.86 214.73 L 537.33 216.19 L 535.68 216.63 L 534.91 218.68 L 532.68 219.13 L 532.39 219.38 L 532.64 220.74 L 532.47 221.33 L 531.37 222.57 L 528.98 223.6 L 528.34 223.54 L 527.57 223.01 L 526.81 223.18 L 526.31 224.05 L 525.54 227.62 L 522.67 228.5 L 521.85 229.42 L 520.89 229.65 L 519.05 229.03 L 519.97 227.35 L 519.71 225.35 L 517.5 224.44 L 516.78 222.5 L 516.84 219.77 L 516.4 219.26 L 513.59 217.88 L 511.39 217.59 L 510.23 217.85 L 509.33 217.45 L 509.33 217.45 L 511.95 216.18 L 513.92 214.47 L 514.46 213.6 L 516.75 212.27 L 517.72 211.99 L 521.61 208.12 L 522.35 206.36 L 522.41 204.09 L 522.12 203.55 L 520.5 201.97 L 520.57 199.78 L 519.97 198.65 L 519.91 197.7 L 520.02 197.25 L 520.54 196.92 L 522.33 196.76 L 522.33 196.76 L 527.26 196.96 L 528.15 197.2 L 529.78 197.01 L 531.92 196.21 L 533.21 196.11 L 536.29 196.53 L 539.14 198.43 L 540.97 199.26 L 541.43 200.25 L 542.44 201.32 L 543.8 201.8 L 544.58 202.37 L 545.21 204.01 L 546.86 203.96 L 548.4 201.67 L 549.47 200.84 L 551.06 200.35 L 551.06 200.35 L 551.46 200.44 L 552.86 202.35 L 553.85 202.68 L 555.36 202.36 L 556.29 201.63 L 556.67 201.71 L 557.3 202.95 L 557.25 203.63 L 558.02 203.96 L 560.65 202.99 L 562.28 202.76 L 563.8 201.12 L 566.5 199.24 L 567.55 198.93 L 569.03 198.06 L 569.96 196.55 L 572.18 195.29 L 573.66 194.88 L 577.16 196.8 L 577.66 198.19 L 577.55 198.49 L 574.55 199.56 L 574.18 200.34 L 574.22 200.81 L 574.94 202.68 L 574.77 203.11 L 572.24 205.75 L 572.2 206.2 L 573.71 205.95 L 574.15 205.66 L 575.29 205.98 L 575.47 206.28 L 575.23 206.77 L 575.58 209.01 L 576.53 209.95 L 578.13 210.74 L 579.78 209.9 L 581.12 209.74 L 582.9 208.21 L 583.3 207.73 L 583.29 207.19 L 582.9 206.46 L 583.44 205.7 L 584.33 205.01 L 586.15 204.91 L 586.7 204.27 L 588.31 203.39 L 592.19 203.65 L 594.37 203.36 L 595.17 202.83 L 595.17 202.23 L 596.31 202.25 L 598.32 201.8 L 600.22 200.77 L 600.67 198.97 L 602.15 197.69 L 604.46 196.62 L 607.11 196.83 L 607.93 197.09 L 610.43 199.15 L 610.43 199.15 L 611.31 199.38 L 611.86 200.6 L 610.59 202.32 L 610.48 202.87 L 610.49 203.35 L 611.19 203.72 L 611.46 204.22 L 611.65 205.28 L 609.69 211.66 L 606.44 220.61 L 606.44 220.61 L 606.17 220.4 L 603.27 220.13 L 601.35 219.32 L 599.88 219.51 L 597.32 220.8 L 595.08 219.95 L 593.08 220.19 L 591.53 221.43 L 591.41 221.88 L 589.23 224.17 L 587.42 225.28 L 586.26 225.23 L 584.4 226.29 L 583.23 226.4 L 580.09 226.11 L 577.59 226.76 L 575.68 226.28 L 573.9 225.23 L 572 223.11 L 569.45 221.09 L 568.37 221.21 L 566.7 220.91 L 565.7 219.69 L 564.88 220.29 L 564.79 220.98 L 562.41 224.27 L 560.24 225.03 L 559.6 226.12 z"},{code:"PI",name:"Piauí",gTransform:"matrix(1 0 0 1 174.84 -130.97)",pathTransform:"translate(-480.85, -188.29)",d:"M 505.7 126.91 L 507.01 127.03 L 507.7 126.8 L 509.94 127.31 L 510.93 128.16 L 511.25 128.76 L 511.25 128.76 L 511.14 129.56 L 510.05 131.41 L 508.47 133.38 L 508.29 134.84 L 508.58 136.13 L 510.38 140.85 L 513.53 147.27 L 513.97 149 L 515.33 150.59 L 515.31 151.35 L 514.57 152.71 L 515.36 156.58 L 514.88 158.18 L 515.88 160.19 L 516.48 163.18 L 515.89 164.76 L 515.09 165.34 L 516.01 166.03 L 516.12 166.41 L 517.06 174.57 L 516.82 175.02 L 517.58 177.59 L 518.63 182.79 L 519.64 185.46 L 520.95 186.11 L 523.51 186.58 L 524.28 187.74 L 524.27 188.43 L 522.77 190.68 L 521.63 193.79 L 521.71 194.76 L 522.39 195.44 L 522.33 196.76 L 522.33 196.76 L 520.54 196.92 L 520.02 197.25 L 519.91 197.7 L 519.97 198.65 L 520.57 199.78 L 520.5 201.97 L 522.12 203.55 L 522.41 204.09 L 522.35 206.36 L 521.61 208.12 L 517.72 211.99 L 516.75 212.27 L 514.46 213.6 L 513.92 214.47 L 511.95 216.18 L 509.33 217.45 L 509.33 217.45 L 508.88 218.61 L 507.38 220.91 L 506.33 221.58 L 505.54 221.4 L 503.54 221.78 L 503.65 224.18 L 501.79 225.98 L 501.47 225.93 L 500.85 225.31 L 498.69 225.3 L 497.87 226.28 L 497.1 226.64 L 494.37 226.98 L 492.86 228.32 L 492.04 229.54 L 490.34 229.64 L 488.86 230.28 L 485.86 230.39 L 485.04 230.11 L 484.85 229.83 L 484.98 229.17 L 483.27 228.19 L 481.94 227.8 L 480.55 228.35 L 478.42 228.78 L 478.1 228.6 L 477.69 227.67 L 476.19 227.21 L 474.24 227.23 L 471 228.88 L 470.94 229.81 L 473.18 234.25 L 473.3 235.4 L 473.01 237.97 L 472.76 238.88 L 472.04 239.74 L 469.09 244.79 L 466.12 247.21 L 464.77 247.63 L 463.29 247.1 L 461.95 246.93 L 459.75 247.68 L 458.58 248.57 L 457.91 249.44 L 456.77 249.82 L 456.02 251.27 L 455.69 251.48 L 453.58 251.3 L 451.78 251.82 L 447.6 249.97 L 445.83 247.48 L 445.3 245.27 L 444.64 244.23 L 443.2 242.89 L 440.87 242.91 L 440.87 242.91 L 437.93 242.7 L 437.93 242.7 L 437.98 240.78 L 438.24 239.72 L 439.39 237.27 L 439.52 230.91 L 440.28 229.51 L 440.31 229 L 438.58 225.94 L 438.11 222.75 L 437.41 220.81 L 438.14 218.81 L 439.84 217.41 L 441.04 214.93 L 441.17 213.42 L 441.51 212.59 L 441.81 212.38 L 443.25 209.64 L 443.88 207.32 L 444.27 204.35 L 445.25 201.37 L 447.38 199.42 L 450.1 198.66 L 452.71 198.35 L 453.78 197.98 L 455.48 196.45 L 456.53 196.41 L 457.87 195.89 L 460.73 193.32 L 463.07 192.41 L 465.08 190.41 L 465.71 189.54 L 465.71 189.08 L 467.61 187.16 L 468.11 186.94 L 468.95 186.7 L 469.18 187 L 470.3 186.74 L 471.3 186.14 L 472.76 185.95 L 473.77 186.16 L 476.28 187.98 L 477.79 187.88 L 480.23 187.02 L 481.06 186.98 L 481.71 187.26 L 483.99 186.97 L 485.2 185.66 L 485.7 184.2 L 485.82 182.99 L 486.11 182.55 L 486.5 180.35 L 486.37 179.5 L 486.2 179 L 484.59 178.09 L 482.81 176.06 L 482.3 173.76 L 482.19 171.65 L 482.36 169.17 L 486.46 164.74 L 486.67 164.19 L 486.77 161.76 L 486.22 158.78 L 484.64 155.98 L 485.78 153.11 L 486.06 151.64 L 485.68 150.37 L 484.45 149.53 L 484.1 147.61 L 484.87 146.56 L 485.51 146.39 L 486.33 144.41 L 488.22 142.56 L 489.1 140.73 L 489.06 138.94 L 491.98 135.53 L 492.79 135.69 L 496.1 135.23 L 500.23 131.26 L 502.02 128.99 L 502.41 127.46 L 501.77 126.93 L 501.55 126.21 L 502.01 124.77 L 502.01 124.77 L 502.74 124.89 L 504.21 125.76 L 504.72 126.27 L 504.59 126.58 z"},{code:"PR",name:"Paraná",gTransform:"matrix(1 0 0 1 47.59 157)",pathTransform:"translate(-353.59, -476.27)",d:"M 396.75 499.4 L 391.51 499.37 L 391.18 499.81 L 389.44 500.05 L 388.68 499.98 L 388.57 499.59 L 387 500.16 L 385.65 501.59 L 382.3 503.72 L 380.86 503.56 L 379.63 502.94 L 376.5 500.34 L 375.47 499.95 L 374.71 499.94 L 371.87 500.67 L 369.54 500.84 L 368.73 500.81 L 367.31 500.05 L 366.2 500.19 L 364.67 500.84 L 364.08 502.31 L 363.35 503.18 L 361.48 504.16 L 357.91 503.75 L 355.91 504.9 L 355.19 505.67 L 354.5 507.26 L 355.35 510.25 L 354.48 511.11 L 353.56 511.13 L 352.81 511.51 L 352.64 512 L 351.31 510.11 L 347.06 510.24 L 343.3 509.81 L 341.72 508.63 L 341.56 508.22 L 340.53 507.59 L 336.27 507.23 L 330.98 505.55 L 328.64 506.12 L 325.95 506.09 L 323.93 504.68 L 323.61 504.17 L 322.55 503.93 L 322.02 503.92 L 321.31 504.29 L 317.68 504.27 L 317.68 504.27 L 317.46 503.06 L 314.93 498.88 L 314.95 496.29 L 313.96 493.41 L 310.54 491.04 L 309.45 492.17 L 307.33 492.06 L 306.23 492.49 L 305.16 493.39 L 303.7 492.31 L 302.88 492.37 L 302.6 490.17 L 303.26 488.6 L 304.33 487.33 L 305.55 485.15 L 305.61 484.81 L 305.12 484.06 L 305.14 482.82 L 306.04 479.18 L 307.3 476.16 L 307.05 473.86 L 308.33 471.48 L 308.12 470.46 L 307.28 469.58 L 306.97 467.98 L 307.63 466.92 L 308.42 466.38 L 308.42 466.38 L 310.8 464.82 L 311.16 464 L 312.73 456.08 L 313.06 455.73 L 314.17 455.41 L 315.83 454.4 L 316.5 453.72 L 317.95 450.16 L 317.93 449.01 L 318.86 446.68 L 319.97 445.86 L 325.38 443.59 L 325.38 443.59 L 328.64 441.3 L 332.47 441.95 L 336.48 441.84 L 339.75 442.13 L 340.96 441.51 L 341.31 440.91 L 342.04 440.54 L 343.21 440.83 L 344.69 441.61 L 347.21 442.07 L 349.85 443.16 L 351.16 443.29 L 352.23 442.75 L 354.81 442.74 L 355.59 443.74 L 357.34 444.58 L 360.85 445.38 L 361.48 445.89 L 362.19 447.21 L 363.92 447.28 L 364.34 446.94 L 365.99 447.09 L 366.65 447.63 L 371.96 447.76 L 374.93 446.91 L 376.06 448.46 L 379.65 451.29 L 380.54 453.05 L 380.55 455.79 L 380.16 456.37 L 380 457.18 L 380.38 459.02 L 381.68 460.53 L 381.6 462.29 L 381.24 462.85 L 382.73 465.85 L 383.94 467 L 384.61 467.28 L 385.11 467.96 L 385.06 468.85 L 385.98 470.82 L 386.58 471.11 L 386.83 471.55 L 386.58 472.6 L 385.31 474.73 L 385.63 476.77 L 386.23 477.15 L 387.24 477.36 L 389.62 477.24 L 393.04 476.71 L 393.54 477.1 L 395.12 476.91 L 396.71 477.04 L 398.32 478.3 L 398.18 478.71 L 397.29 479.36 L 396.6 482.66 L 396.95 483.44 L 398.02 483.97 L 398.67 483.12 L 399.77 480.36 L 400.53 480.19 L 402.67 480.77 L 402.27 482.72 L 403 486.02 L 404.42 486.6 L 404.58 487.92 L 404.58 487.92 L 403.23 488.94 L 402.62 490.42 L 402.07 490.3 L 402.34 488.36 L 403.78 487.41 L 402.37 487.69 L 401.48 488.18 L 400.61 488.16 L 400.27 487.77 L 399.7 487.6 L 399.16 487.97 L 398.88 488.9 L 399.4 489.7 L 398.67 490.66 L 398.37 490.76 L 395.89 490.23 L 395.1 489.69 L 394.65 489.81 L 394.47 490.71 L 394.81 491.08 L 396.42 491.64 L 397.82 491.39 L 399.95 491.99 L 400.22 492.47 L 399.25 493.15 L 397.71 495.93 L 396.47 496.7 L 394.05 497.27 L 393.85 497.72 L 396.8 497.52 L 396.95 498.71 z"},{code:"RJ",name:"Rio de Janeiro",gTransform:"matrix(1 0 0 1 179.27 113.69)",pathTransform:"translate(-485.28, -432.95)",d:"M 468.35 450.28 L 468.28000000000003 449.5 L 468.66 449.23 L 471.85 449.45000000000005 L 474.44 448.86000000000007 L 471.91 447.31000000000006 L 470.51000000000005 446.81000000000006 L 467.70000000000005 447.49000000000007 L 466.34000000000003 449.0900000000001 L 465.31000000000006 449.4100000000001 L 464.61000000000007 449.36000000000007 L 463.26000000000005 447.2100000000001 L 462.78000000000003 447.2100000000001 L 461.88000000000005 447.6300000000001 L 460.9200000000001 448.6900000000001 L 457.7700000000001 449.4900000000001 L 457.4300000000001 450.40000000000015 L 457.2400000000001 452.3000000000001 L 459.4300000000001 452.4300000000001 L 460.5000000000001 453.4400000000001 L 459.35000000000014 454.5200000000001 L 458.41000000000014 454.3500000000001 L 456.9900000000001 454.5200000000001 L 456.9900000000001 454.5200000000001 L 456.5100000000001 454.2600000000001 L 454.8800000000001 452.5300000000001 L 454.8300000000001 452.12000000000006 L 455.9200000000001 448.62000000000006 L 457.01000000000005 447.4700000000001 L 459.36000000000007 446.4600000000001 L 459.86000000000007 446.61000000000007 L 462.63000000000005 446.25000000000006 L 464.13000000000005 445.5400000000001 L 465.78000000000003 443.3900000000001 L 465.03000000000003 441.7500000000001 L 463.33000000000004 441.7400000000001 L 460.18000000000006 442.2700000000001 L 458.4100000000001 441.8800000000001 L 457.18000000000006 440.29000000000013 L 456.62000000000006 439.1200000000001 L 455.3500000000001 438.5800000000001 L 455.3500000000001 438.5800000000001 L 456.0300000000001 438.0900000000001 L 458.4500000000001 437.3500000000001 L 461.3600000000001 436.0100000000001 L 463.9400000000001 435.8400000000001 L 464.4400000000001 436.11000000000007 L 466.16000000000014 435.3400000000001 L 467.21000000000015 434.5700000000001 L 471.3000000000001 432.7800000000001 L 471.8200000000001 432.7100000000001 L 472.1800000000001 433.0200000000001 L 475.3800000000001 432.9500000000001 L 476.6300000000001 432.7800000000001 L 478.2600000000001 431.8400000000001 L 478.8300000000001 431.7800000000001 L 481.36000000000007 432.05000000000007 L 481.8500000000001 432.2200000000001 L 481.8300000000001 432.6900000000001 L 483.2100000000001 432.4900000000001 L 492.7200000000001 427.96000000000015 L 495.25000000000006 426.97000000000014 L 495.46000000000004 426.45000000000016 L 495.18000000000006 425.84000000000015 L 493.74000000000007 425.71000000000015 L 493.83000000000004 424.96000000000015 L 495.72 421.25000000000017 L 498.08000000000004 415.21000000000015 L 497.35 414.50000000000017 L 497.91 414.01000000000016 L 499.15000000000003 413.7400000000002 L 501.68 411.38000000000017 L 501.68 411.38000000000017 L 503.61 412.14000000000016 L 504.28000000000003 416.85000000000014 L 506.78000000000003 417.98000000000013 L 511.11 418.9900000000001 L 514.1 418.6200000000001 L 515.72 419.6800000000001 L 515.72 419.6800000000001 L 515.64 420.9500000000001 L 514.6999999999999 422.5600000000001 L 514.4799999999999 424.6900000000001 L 515.6199999999999 431.4700000000001 L 515.1199999999999 432.1500000000001 L 512.0399999999998 433.9000000000001 L 506.0699999999998 435.8400000000001 L 503.23999999999984 437.5600000000001 L 499.73999999999984 441.2500000000001 L 499.6299999999998 442.91000000000014 L 499.9399999999998 444.10000000000014 L 499.74999999999983 445.72000000000014 L 499.0199999999998 447.20000000000016 L 497.1999999999998 447.71000000000015 L 490.6499999999998 447.54000000000013 L 484.8599999999998 448.2400000000001 L 482.4699999999998 447.78000000000014 L 481.9799999999998 447.40000000000015 L 481.9199999999998 446.72000000000014 L 482.94999999999976 445.2400000000001 L 483.6199999999998 443.79000000000013 L 483.5299999999998 443.17000000000013 L 482.74999999999983 442.9900000000001 L 479.9599999999998 444.1400000000001 L 479.6999999999998 444.8300000000001 L 480.0099999999998 445.6200000000001 L 481.3899999999998 446.79000000000013 L 481.6399999999998 447.76000000000016 L 481.04999999999984 448.28000000000014 L 479.41999999999985 448.79000000000013 L 477.84999999999985 448.76000000000016 L 469.80999999999983 449.83000000000015 L 468.35 450.28 z M 463.24 452.27 L 462.57 451.29999999999995 L 464.68 449.74999999999994 L 466.54 450.68999999999994 L 466.97 451.38999999999993 L 464.51000000000005 451.88999999999993 L 464.1 451.5399999999999 L 463.63 451.5399999999999 L 463.24 452.27 z"},{code:"RN",name:"Rio Grande do Norte",gTransform:"matrix(1 0 0 1 274.86 -145.63)",pathTransform:"translate(-580.87, -173.63)",d:"M 609.29 182.91 L 608.36 183.15 L 604.86 182.94 L 603.82 183.34 L 601.36 182.24 L 599.19 181.94 L 593.36 182.33 L 592.83 181.98 L 589.41 181.58 L 588.79 181.09 L 588.89 180.09 L 588.47 179.7 L 587.09 179.75 L 585.27 181.1 L 584.96 182.58 L 585.68 183.36 L 586.21 184.89 L 585.2 184.57 L 584.72 185.16 L 584.88 186.58 L 585.35 187.52 L 584.8 188.73 L 584.3 189.47 L 581.95 190.4 L 581.12 189.66 L 581.64 188.12 L 580.75 186.95 L 578.8 186.65 L 577.03 186.73 L 573.88 187.99 L 573.59 187.76 L 573.28 186.38 L 572.96 186.15 L 569.43 185.63 L 569.51 183.91 L 569.72 183.6 L 570.57 183.35 L 570.98 182.97 L 571.36 181.23 L 571.8 180.27 L 574.79 177.06 L 574.78 175.87 L 574.25 175.43 L 573.61 175.35 L 570.35 176.39 L 568.92 176.51 L 565.74 177.72 L 565.33 178.67 L 565.23 179.71 L 564.41 180.42 L 561.18 182.08 L 560.02 183.21 L 557.14 182.6 L 556.24 182.18 L 554.31 180.54 L 553.74 181 L 553.74 181 L 553.08 181.38 L 552.44 181.21 L 552.78 179.24 L 554.19 176.99 L 555.03 176.11 L 555.54 176.04 L 556.32 176.55 L 557.35 176.29 L 557.92 175.19 L 559.38 173.68 L 560.78 171.24 L 560.63 170.5 L 561.28 168.83 L 562.15 168.26 L 562.99 167.14 L 566.29 160.45 L 568.9 158.44 L 573.79 156.85 L 573.79 156.85 L 574.26 157.61 L 575.12 158.36 L 578.25 158.35 L 579.47 158.76 L 581.16 160.51 L 582.48 161.01 L 585.81 160.69 L 588.69 161.21 L 591.23 160.97 L 593.56 160.24 L 598.06 161.16 L 599.33 161.2 L 601.28 162.06 L 602.3 162.88 L 602.94 163.82 L 605.25 168.56 L 605.75 170.35 L 605.71 171.1 L 607.19 176.48 L 607.4 178.16 L 608.12 178.7 L 609.08 181.39 z"},{code:"RO",name:"Rondônia",gTransform:"matrix(1 0 0 1 -139.57 -68.08)",pathTransform:"translate(-166.43, -251.18)",d:"M 187.32 290.95 L 186.03 289.5 L 185.59 287.62 L 184.03 287.1 L 183.17 287.42 L 181.36 287.5 L 177.29 285.69 L 177.28 285.29 L 176.62 284.68 L 175.35 285.27 L 173.37 283.59 L 171.85 282.62 L 170.99 281.16 L 170.71 279.77 L 169.67 279.38 L 167.9 280.5 L 166.68 280.47 L 165.27 279.67 L 164.4 278.34 L 161.27 276.76 L 159.31 276.59 L 158.17 277.13 L 157.27 277.98 L 155.84 277.81 L 155.53 277.51 L 153.39 277 L 150.33 276.72 L 149.57 276.29 L 148.39 275.1 L 148.09 273.13 L 146.51 272.64 L 144.62 271.67 L 143.8 269.95 L 143.51 269.75 L 140.79 269.47 L 140.41 269.12 L 139.57 265.41 L 138.69 264.52 L 138.21 265.68 L 137.55 265.36 L 137.28 264.72 L 137.9 263.19 L 137.06 261.67 L 135.7 261.28 L 134.44 257.81 L 134.27 256.15 L 135.82 253.24 L 135.61 251.58 L 134.45 249.61 L 133.7 247.45 L 133.64 245.16 L 134.26 244.66 L 134.64 243.29 L 135.68 242.24 L 136.04 240.77 L 135.8 239.28 L 135.38 238.39 L 135.29 236.86 L 135.83 235.21 L 134.66 233.03 L 133.64 232.65 L 132.55 233.63 L 132.49 234.14 L 131.65 235.1 L 131.08 235.1 L 128.9 234.08 L 123.72 234.16 L 118.11 235.94 L 116.42 235.93 L 114.94 236.41 L 114.94 236.41 L 111.97 235.15 L 111.97 235.15 L 115.23 232.59 L 117.15 232.01 L 118.7 230.2 L 118.85 229.64 L 118.69 228.35 L 122.65 228.61 L 125.52 228.28 L 126.24 228.65 L 128.55 230.98 L 128.92 230.96 L 130.14 230.17 L 130.27 229.45 L 130.68 228.92 L 131.76 228.42 L 132.53 228.55 L 133.9 228.16 L 135.2 226.95 L 137.04 225.93 L 137.42 226.02 L 138.06 228.28 L 138.74 228.81 L 139.42 228.73 L 141.96 225.57 L 141.7 223.82 L 142.23 222.98 L 143.98 221.72 L 144.44 221.74 L 145.28 222.29 L 147.07 222.39 L 148.27 221.32 L 150.4 220.94 L 154.27 221.4 L 154.03 219.94 L 154.14 218.13 L 156.2 216.92 L 157.01 215.77 L 157.37 214.75 L 157.2 214.3 L 156.3 213.6 L 156.35 212.93 L 157.54 211.34 L 160.02 210.81 L 160.28 210.59 L 160.19 209.42 L 161.91 208.92 L 163.29 206.36 L 174.08 206.3 L 176.23 207.43 L 176.68 207.92 L 177.48 209.83 L 178.81 211.1 L 181.35 212.08 L 182.6 215.35 L 183.06 215.56 L 184.04 215.43 L 184.66 215.63 L 185.34 218.51 L 188.58 219.99 L 189.26 219.8 L 189.8 218.06 L 191.72 216.98 L 193.11 217.26 L 193.47 217.64 L 193.43 218.34 L 193.43 218.34 L 194.83 219.31 L 195.43 220.55 L 194.67 221.97 L 193.38 226.96 L 193.44 227.31 L 194.22 227.78 L 194.48 228.39 L 194.63 229.78 L 195.46 232.05 L 194.52 233.72 L 194.9 235.65 L 193.9 239.17 L 193.87 239.97 L 194.14 241.73 L 195.64 244.48 L 194.74 253.48 L 211.9 253.53 L 211.66 254.09 L 212.88 255.2 L 216.38 255.11 L 217.49 255.22 L 218.56 255.65 L 219.97 259.24 L 219.8 259.99 L 218.4 261.74 L 217.04 262.82 L 216.9 264.14 L 217.33 267.39 L 217.91 267.9 L 218.81 267.87 L 220.34 271.21 L 220.3 273.26 L 220.88 274.75 L 220.81 276.46 L 220.25 278.7 L 218.59 280.71 L 218.07 282.96 L 217.49 283.8 L 217.06 284.21 L 215.42 284.74 L 214.49 285.82 L 213.06 289.6 L 212.54 292.05 L 208.43 294.62 L 206.96 296.05 L 206.96 296.05 L 206.22 296.01 L 203.63 294.46 L 202.36 293.03 L 195.28 293.99 L 193.96 293.56 L 193.71 293.26 L 190.33 293.92 L 189.85 293.76 L 189.33 292.41 z"},{code:"RR",name:"Roraima",gTransform:"matrix(1 0 0 1 -116.08 -267.27)",pathTransform:"translate(-189.92, -51.99)",d:"M 234.61 61.4 L 236.21 78.37 L 236.21 78.37 L 217.72 78.3 L 217.75 78.98 L 215.42 82.24 L 213.76 85.27 L 213.69 86.4 L 212.54 89.04 L 212.43 89.7 L 212.66 90.43 L 213.8 91.84 L 213.78 92.37 L 213.36 92.76 L 211.33 93.31 L 209.92 94.72 L 208.67 95.18 L 206.85 94.95 L 205.93 92.44 L 204.06 90.4 L 201.23 89.47 L 199.63 89.53 L 199.08 90.42 L 196.99 91.13 L 195.71 91.82 L 194.69 93.08 L 193.87 96.05 L 194.24 97.85 L 193.99 99.58 L 193.24 101.87 L 193.68 103.98 L 191.32 102.94 L 189.98 103.36 L 189.45 103.29 L 188.41 101.25 L 186.93 99.6 L 184.97 98.29 L 184.45 98.25 L 179.44 93.83 L 179.58 92.69 L 181.42 93.02 L 182.56 91.7 L 182.62 91.12 L 181.49 86.79 L 180.91 85.89 L 179.69 85.05 L 178.81 82.88 L 178.52 77.9 L 179.09 76.94 L 179.86 73.9 L 179.2 72.32 L 178.84 70.73 L 180.46 69.27 L 180.41 68.82 L 179.54 67.7 L 179.35 65.44 L 177.69 60.68 L 174.96 56.94 L 175.67 55.44 L 176.58 52.12 L 176.09 51.46 L 174.14 50.51 L 172.78 50.4 L 171.9 50.61 L 170.93 50.24 L 169.72 49.07 L 169.66 48.11 L 169.03 48 L 167.9 48.42 L 167.29 48.41 L 166.54 48.07 L 165.82 47.29 L 165.82 47.29 L 166.12 46.83 L 166.35 44.55 L 166.05 44.33 L 162.68 44.1 L 158.93 44.24 L 155.62 43.54 L 155.42 42.94 L 156.22 41.18 L 156.34 39.7 L 155.61 37.93 L 153.67 34.39 L 152.94 32.33 L 152.47 28.61 L 153.26 27.13 L 153.18 26.17 L 151.34 24.17 L 149.18 23.11 L 146.37 20.33 L 145.31 18.52 L 145.02 17.56 L 143.88 16.91 L 143.63 16.52 L 143.66 15.68 L 143.95 15.35 L 144.85 15.42 L 145.97 16.08 L 146.91 17.81 L 147.52 17.9 L 150.91 17.4 L 152.26 17.5 L 154.17 18.09 L 154.78 19.29 L 155.33 21.22 L 155.87 21.57 L 156.83 21.49 L 157.57 20.84 L 158.52 20.44 L 161.7 20.6 L 162.17 20.65 L 163.48 21.86 L 164.08 22.01 L 164.6 21.87 L 165.21 20.31 L 166.52 20.45 L 167.97 21.38 L 171.9 25.95 L 172.95 26.52 L 173.66 26.63 L 175.17 25.95 L 175.91 24.82 L 176.01 23.98 L 175.18 21.22 L 175.54 19.48 L 176 19.2 L 177.93 19.15 L 178.94 18.05 L 180.49 16.96 L 181.24 17.01 L 185.14 18.35 L 185.73 18.18 L 186.53 17.46 L 187.56 17.16 L 188.69 17.51 L 189.72 17.3 L 191.06 16.02 L 192.06 15.77 L 193.21 16 L 194.32 15.93 L 195 15.08 L 195.05 13.73 L 198.08 11.92 L 200.41 12.11 L 203.17 11.72 L 204.06 10.59 L 204.15 9.88 L 204.74 8.76 L 205.49 8.63 L 207.34 7.73 L 208.44 6.69 L 209.55 4.98 L 208.35 1.42 L 207.18 1.06 L 207.82 0.88 L 209.25 0.95 L 210.05 1.27 L 213.62 1.17 L 214.68 0.22 L 215.42 0 L 216.79 0.42 L 217.32 1.73 L 218.36 2.53 L 218.84 3.9 L 218.17 8.8 L 217.45 10.18 L 216.2 10.88 L 216.26 11.71 L 217.87 12.12 L 219.49 11.9 L 221.84 12.71 L 223.66 13.81 L 222.78 15.24 L 222.77 16.39 L 225.11 19.81 L 225.31 21.36 L 223.8 24.28 L 221.92 25.69 L 221.2 27.19 L 221.47 27.58 L 221.53 29.75 L 220.06 32.16 L 219.16 34.93 L 218.85 37.5 L 218.76 40.17 L 219.74 42.04 L 220.25 43.8 L 220.24 45.2 L 221.81 46.23 L 222.71 46.43 L 222.84 47.11 L 222.38 52.26 L 222.5 53 L 224.31 53.29 L 223.65 54.46 L 224.11 54.96 L 226.26 55.7 L 227.72 57.62 L 230.38 60.36 z"},{code:"RS",name:"Rio Grande do Sul",gTransform:"matrix(1 0 0 1 11.62 259.25)",pathTransform:"translate(-317.63, -578.5)",d:"M 321.99 638.52 L 321.63 638.53 L 319.69 637.42 L 319.49 636.96 L 320.01 632.69 L 319.55 628.44 L 319.7 627.37 L 320.33 626.13 L 323.17 623.75 L 324 622.19 L 326.3 619.63 L 324.84 617.98 L 323.77 617.36 L 321.52 616.76 L 319.2 614.51 L 317.99 612.89 L 317.89 611.3 L 317.46 610.12 L 316.23 608.09 L 314.17 605.85 L 313.5 605.26 L 311.11 604.05 L 309.66 604.26 L 307.76 602.75 L 306.24 601.12 L 304.99 600.34 L 304.85 598.64 L 302.95 596.48 L 299.63 596.02 L 298.71 595.55 L 296.98 593.89 L 295.22 594.02 L 293.05 592.64 L 291.14 588.93 L 290.03 587.44 L 287.5 585.32 L 286.8 585.4 L 286.13 587.19 L 283.54 589.43 L 280.87 589.55 L 280.97 586.69 L 281.37 585.41 L 280.98 584.41 L 277.33 580.12 L 274.96 578.35 L 272.78 576.29 L 271.03 574.18 L 268.34 571.97 L 266.44 571.83 L 264.29 572.04 L 263.15 573.4 L 263.09 574.36 L 262.06 575.33 L 260.95 575.35 L 260.37 574.87 L 257.21 575.01 L 256.56 574.53 L 256.4 573.62 L 255.91 573.4 L 256.76 573.18 L 257.8 572.46 L 260.32 569.69 L 260.43 567.85 L 261.03 566.6 L 261.85 566.15 L 263.14 566.08 L 263.78 565.82 L 264.7 564.82 L 270.15 558.34 L 270.78 556.92 L 270.95 555.81 L 271.77 554.74 L 272.97 553.89 L 274.34 553.48 L 276.3 549.26 L 276.4 548.65 L 276.71 548.28 L 278.35 547.42 L 279.98 545.62 L 280.83 544.47 L 281.34 543.18 L 282.68 541.08 L 283.61 540.79 L 285.18 540.97 L 285.73 541.76 L 286.2 540.48 L 285.99 539.9 L 284.64 539.08 L 284.59 538.72 L 284.94 538.39 L 286.02 538.01 L 286.84 537.05 L 289.63 536.1 L 290.68 535.03 L 290.78 534.11 L 291.6 533.2 L 293.81 532.05 L 296.28 531.65 L 298.05 529.84 L 298.2 528.78 L 299.52 526.42 L 299.85 526.38 L 299.9 526.74 L 300.19 526.94 L 301.52 526.77 L 303.96 525.64 L 306.64 525.05 L 307.85 524.48 L 309.95 522.13 L 310.45 522.14 L 311.12 521.75 L 312.13 520.4 L 314.44 519.67 L 314.74 520.05 L 314.74 520.05 L 318.26 520.44 L 321.52 519.29 L 322.08 518.48 L 323.43 519.06 L 323.28 519.98 L 326.36 519.95 L 327.99 520.94 L 330.55 520.57 L 332.47 521.72 L 335.05 521.31 L 336.59 521.49 L 339.39 521.33 L 341.65 522.25 L 344.13 523.65 L 345.13 526.09 L 346.72 526.28 L 346.81 525.8 L 348.62 525.45 L 354.18 528.99 L 355.55 530.54 L 356.26 530.51 L 357.82 531.49 L 360.85 534.98 L 362.49 537.19 L 362.97 538.67 L 365.14 541.33 L 366.31 541.88 L 373 542.94 L 375.11 542.54 L 378.46 542.88 L 379.34 545.22 L 377.26 546.8 L 375.99 547.21 L 375.26 549.07 L 375.48 551.26 L 375.1 552.82 L 374.58 554.12 L 373.4 554.32 L 372.11 556.01 L 372.08 557.42 L 373.88 558.59 L 374.15 558.39 L 373.87 557.42 L 373.88 556.46 L 375.37 555.64 L 376.95 556.28 L 377.68 557.19 L 378.85 558.04 L 379.3 558.01 L 379.3 558.01 L 377.9 559.74 L 374 566.78 L 369.79 578.38 L 363.49 588.86 L 358.05 595.52 L 351.54 601.48 L 345.45 605.16 L 342.35 609.47 L 342.17 609.04 L 342.82 607.46 L 343.16 605.28 L 341.98 603.57 L 342.08 603.15 L 343.01 602.98 L 344.02 603.38 L 344.58 603.96 L 345.6 604 L 348.18 602.59 L 349 601.91 L 351.85 598.2 L 352.6 597.51 L 353.05 597.7 L 354.07 597.51 L 355.12 596.67 L 356.05 595.4 L 356.42 593.92 L 356.6 592.99 L 356.37 590.89 L 356.57 589.52 L 358.14 589.45 L 358.88 589.75 L 359.15 590.58 L 359.5 590.32 L 359.21 588.92 L 359.72 586.85 L 360.2 586.28 L 362.94 584.69 L 363.67 583.61 L 364.14 580.86 L 363.93 578.58 L 364.49 577.9 L 364.99 578.7 L 365.36 578.73 L 365.79 578.31 L 366.26 575.23 L 366.16 574.79 L 365.21 573.57 L 364.54 573.54 L 364.28 574.23 L 364.45 574.62 L 364.31 575.19 L 363.96 575.39 L 362.45 575.37 L 360.44 575.77 L 360.1 577.38 L 359.57 577.43 L 358.76 576.99 L 358.86 575.28 L 358.04 574.39 L 357 574.72 L 356.4 574.24 L 355.67 572.98 L 355.27 571.53 L 355.39 570.96 L 354.75 570.27 L 354.14 572.98 L 354.58 575.23 L 355.83 577.34 L 355.26 578.15 L 354.52 580.69 L 354.9 583.72 L 354.72 584.49 L 354.24 584.12 L 354.5 583.88 L 354.47 583.17 L 354 581.89 L 353.55 581.5 L 353.02 582.16 L 352.99 583.53 L 351.58 586.8 L 351.53 588.69 L 351.75 589.21 L 351.03 589.91 L 349.42 590.55 L 348.81 592.13 L 344.72 593.7 L 344 594.23 L 343.47 595.82 L 343.37 598.09 L 342.4 600.36 L 340.04 601.66 L 339.93 603.42 L 340.41 604.25 L 340.66 605.27 L 339.71 605.83 L 339.46 607.34 L 339.89 607.94 L 340.57 607.8 L 341.87 608.43 L 342.02 609.34 L 339.89 610.99 L 337.57 615.51 L 335.64 622.39 L 333.63 626.88 L 331.95 629.4 L 324.16 636.93 z"},{code:"SC",name:"Santa Catarina",gTransform:"matrix(1 0 0 1 51.41 209.71)",pathTransform:"translate(-357.4, -528.97)",d:"M 379.3 558.01 L 378.85 558.04 L 377.68 557.1899999999999 L 376.95 556.27 L 375.36 555.64 L 373.88 556.46 L 373.87 557.4200000000001 L 374.15 558.3900000000001 L 373.88 558.5900000000001 L 372.08 557.4200000000002 L 372.12 556.0100000000002 L 373.4 554.3200000000002 L 374.58 554.1200000000001 L 375.10999999999996 552.8100000000002 L 375.47999999999996 551.2600000000002 L 375.25999999999993 549.0700000000002 L 375.98999999999995 547.2100000000002 L 377.25999999999993 546.7900000000002 L 379.3399999999999 545.2100000000002 L 378.4599999999999 542.8700000000001 L 375.1099999999999 542.5300000000001 L 372.9999999999999 542.9300000000001 L 366.3099999999999 541.8700000000001 L 365.14999999999986 541.3300000000002 L 362.97999999999985 538.6700000000002 L 362.48999999999984 537.1900000000002 L 360.85999999999984 534.9800000000001 L 357.82999999999987 531.4900000000001 L 356.2599999999999 530.5000000000001 L 355.5499999999999 530.5300000000001 L 354.1799999999999 528.9800000000001 L 348.6199999999999 525.4400000000002 L 346.8099999999999 525.7800000000002 L 346.7199999999999 526.2600000000002 L 345.1199999999999 526.0700000000002 L 344.1199999999999 523.6300000000001 L 341.64999999999986 522.2400000000001 L 339.3799999999999 521.3100000000002 L 336.58999999999986 521.4700000000001 L 335.04999999999984 521.2900000000002 L 332.45999999999987 521.7000000000002 L 330.54999999999984 520.5500000000002 L 327.97999999999985 520.9100000000002 L 326.34999999999985 519.9300000000002 L 323.26999999999987 519.9600000000002 L 323.41999999999985 519.0300000000002 L 322.0699999999998 518.4500000000002 L 321.5099999999998 519.2600000000001 L 318.24999999999983 520.4200000000001 L 314.72999999999985 520.0300000000001 L 314.72999999999985 520.0300000000001 L 316.17999999999984 517.1000000000001 L 316.90999999999985 515.0100000000001 L 316.32999999999987 511.7600000000001 L 316.7399999999999 508.5500000000001 L 316.6999999999999 506.0000000000001 L 317.65999999999985 504.2500000000001 L 317.65999999999985 504.2500000000001 L 321.28999999999985 504.2700000000001 L 321.99999999999983 503.8900000000001 L 322.5299999999998 503.9000000000001 L 323.5899999999998 504.1400000000001 L 323.8999999999998 504.6500000000001 L 325.9299999999998 506.0600000000001 L 328.6099999999998 506.0900000000001 L 330.94999999999976 505.5100000000001 L 336.2399999999998 507.1900000000001 L 340.4999999999998 507.5500000000001 L 341.51999999999975 508.1800000000001 L 341.68999999999977 508.59000000000015 L 343.25999999999976 509.77000000000015 L 347.02999999999975 510.19000000000017 L 351.27999999999975 510.0600000000002 L 352.60999999999973 511.96000000000015 L 352.78999999999974 511.46000000000015 L 353.52999999999975 511.08000000000015 L 354.44999999999976 511.0600000000002 L 355.31999999999977 510.20000000000016 L 354.46999999999974 507.21000000000015 L 355.15999999999974 505.63000000000017 L 355.87999999999977 504.8500000000002 L 357.87999999999977 503.7100000000002 L 361.44999999999976 504.1100000000002 L 363.31999999999977 503.14000000000016 L 364.0499999999998 502.27000000000015 L 364.63999999999976 500.79000000000013 L 366.16999999999973 500.14000000000016 L 367.27999999999975 500.00000000000017 L 368.69999999999976 500.76000000000016 L 369.50999999999976 500.79000000000013 L 371.83999999999975 500.6200000000001 L 374.6799999999997 499.8900000000001 L 375.4299999999997 499.9000000000001 L 376.46999999999974 500.30000000000007 L 379.58999999999975 502.9000000000001 L 380.81999999999977 503.5200000000001 L 382.25999999999976 503.6800000000001 L 385.6099999999998 501.5500000000001 L 386.9599999999998 500.1200000000001 L 388.5199999999998 499.5500000000001 L 388.6399999999998 499.9400000000001 L 389.3999999999998 500.0100000000001 L 391.1399999999998 499.7800000000001 L 391.4699999999998 499.3400000000001 L 396.7099999999998 499.37000000000006 L 396.7099999999998 499.37000000000006 L 396.3199999999998 500.69000000000005 L 396.8299999999998 502.34000000000003 L 396.7599999999998 502.73 L 395.2599999999998 503.87 L 394.2799999999998 503.39 L 393.4599999999998 500.86 L 393.4399999999998 501.98 L 394.0299999999998 504.70000000000005 L 395.7399999999998 506.36000000000007 L 396.2999999999998 507.31000000000006 L 395.2899999999998 509.6000000000001 L 395.12999999999977 511.9200000000001 L 395.2299999999998 512.35 L 395.9899999999998 513.08 L 396.2499999999998 518.94 L 396.5599999999998 519.49 L 396.9899999999998 519.69 L 397.75999999999976 519.1800000000001 L 398.1099999999998 519.9000000000001 L 398.2099999999998 520.7700000000001 L 397.7399999999998 520.83 L 397.3099999999998 520.5500000000001 L 396.1199999999998 521.1800000000001 L 395.7799999999998 525.0200000000001 L 396.3499999999998 527.6100000000001 L 395.7799999999998 528.3600000000001 L 396.0899999999998 530.2900000000001 L 396.99999999999983 532.1700000000001 L 396.1399999999998 534.5100000000001 L 395.61999999999983 538.5200000000001 L 393.90999999999985 543.2 L 393.5699999999999 543.1 L 393.20999999999987 542.34 L 393.41999999999985 541.37 L 392.49999999999983 540.19 L 392.23999999999984 540.5200000000001 L 392.41999999999985 542.95 L 393.57999999999987 543.7800000000001 L 392.65999999999985 545.44 L 391.01999999999987 546.09 L 386.8899999999999 549.13 L 384.08999999999986 551.6899999999999 L 380.33999999999986 556.13 L 379.3 558.01 z M 397.18 531.46 L 397.03000000000003 530.99 L 397.28000000000003 529.24 L 398.04 526.84 L 397.64000000000004 525.6600000000001 L 397.80000000000007 524.6400000000001 L 399.20000000000005 523.8800000000001 L 399.4200000000001 523.94 L 400.0800000000001 524.8800000000001 L 399.5400000000001 527.44 L 398.7200000000001 528.3000000000001 L 398.1300000000001 529.5200000000001 L 398.3300000000001 530.69 L 397.18 531.46 z M 396.73 507.09 L 394.86 505.07 L 397.41 502.63 L 397.66 502.67 L 398.31 503.72 L 397.45 505.04 L 396.73 507.09 z"},{code:"SE",name:"Sergipe",gTransform:"matrix(1 0 0 1 266.49 -72.82)",pathTransform:"translate(-572.49, -246.44)",d:"M 569.94 261.69 L 567.04 262.58 L 565.49 261.94 L 564.95 261.6 L 564.47 260.88 L 562.55 259.96 L 561.95 259.44 L 561.83 259.03 L 562.17 258.64 L 562.3 257.22 L 562.15 256.83 L 560.72 255.32 L 560.2 253.83 L 559.11 253.16 L 558.15 251.56 L 558.13 250.79 L 558.72 249.21 L 559.04 248.91 L 560.74 248.92 L 561.87 249.67 L 564.42 248.68 L 565.11 248.13 L 565.41 247.55 L 564.65 244.8 L 564.73 243.92 L 565.39 242.3 L 565.47 239.19 L 564.72 238.04 L 562.73 236.09 L 561.46 233.59 L 561.24 231.45 L 561.91 230.3 L 561.91 230.3 L 568.37 233.28 L 572.05 234.23 L 577.47 237.3 L 578.77 239.75 L 580.53 241.2 L 582.19 241.99 L 582.65 242.02 L 586.24 244.25 L 586.84 245.56 L 586.84 245.56 L 584.46 246.32 L 579.89 249.26 L 578.92 250.15 L 577.37 252.36 L 577.05 252.34 L 577.16 251.24 L 576.11 249.42 L 575.12 249.58 L 575.46 250.74 L 576.7 250.74 L 576.93 250.98 L 576.41 252.95 L 575.14 255.04 L 574.61 254.69 L 574.24 254.02 L 573.25 253.86 L 573.45 254.54 L 574.58 255.16 L 574.32 256.93 L 573.46 258.08 L 572.53 260.11 L 571.75 260.26 L 571.45 259.8 L 571.93 258.4 L 572.34 258.27 L 572.65 257.84 L 573.02 256.8 L 572.21 256.43 L 572.31 257.11 L 571.86 258.24 L 571.38 258.74 L 571.12 259.83 L 571.4 260.55 L 571.14 261.07 z"},{code:"SP",name:"São Paulo",gTransform:"matrix(1 0 0 1 89.6 122.15)",pathTransform:"translate(-395.6, -441.42)",d:"M 404.58 487.92 L 404.41999999999996 486.59000000000003 L 402.99999999999994 486.02000000000004 L 402.2699999999999 482.72 L 402.6699999999999 480.77000000000004 L 400.5299999999999 480.19000000000005 L 399.7699999999999 480.36000000000007 L 398.6699999999999 483.13000000000005 L 398.0099999999999 483.9800000000001 L 396.9499999999999 483.4500000000001 L 396.59999999999985 482.67000000000013 L 397.28999999999985 479.3700000000001 L 398.17999999999984 478.7100000000001 L 398.3199999999998 478.3100000000001 L 396.7099999999998 477.04000000000013 L 395.11999999999983 476.91000000000014 L 393.53999999999985 477.10000000000014 L 393.03999999999985 476.72000000000014 L 389.6299999999998 477.2500000000001 L 387.24999999999983 477.3700000000001 L 386.23999999999984 477.16000000000014 L 385.6399999999998 476.77000000000015 L 385.30999999999983 474.73000000000013 L 386.5899999999998 472.6100000000001 L 386.8399999999998 471.5600000000001 L 386.5899999999998 471.1200000000001 L 385.9899999999998 470.8200000000001 L 385.06999999999977 468.8500000000001 L 385.12999999999977 467.9600000000001 L 384.62999999999977 467.2800000000001 L 383.95999999999975 466.99000000000007 L 382.7499999999998 465.8500000000001 L 381.25999999999976 462.8400000000001 L 381.6199999999998 462.2900000000001 L 381.69999999999976 460.5300000000001 L 380.39999999999975 459.0100000000001 L 380.01999999999975 457.17000000000013 L 380.18999999999977 456.3600000000001 L 380.57999999999976 455.78000000000014 L 380.5599999999998 453.04000000000013 L 379.6699999999998 451.28000000000014 L 376.0799999999998 448.45000000000016 L 374.9499999999998 446.90000000000015 L 371.9799999999998 447.76000000000016 L 366.6699999999998 447.63000000000017 L 366.00999999999976 447.09000000000015 L 364.3599999999998 446.95000000000016 L 363.93999999999977 447.29000000000013 L 362.21999999999974 447.22000000000014 L 361.4999999999997 445.90000000000015 L 360.8699999999997 445.39000000000016 L 357.35999999999973 444.59000000000015 L 355.60999999999973 443.75000000000017 L 354.82999999999976 442.75000000000017 L 352.2499999999998 442.76000000000016 L 351.1799999999998 443.3000000000002 L 349.8599999999998 443.1700000000002 L 347.2199999999998 442.0800000000002 L 344.6899999999998 441.62000000000023 L 343.2099999999998 440.8300000000002 L 342.0399999999998 440.5400000000002 L 341.3099999999998 440.9100000000002 L 340.9699999999998 441.5100000000002 L 339.7599999999998 442.1300000000002 L 336.47999999999985 441.8400000000002 L 332.46999999999986 441.9500000000002 L 328.6399999999999 441.30000000000024 L 325.3899999999999 443.59000000000026 L 325.3899999999999 443.59000000000026 L 326.22999999999985 442.5100000000003 L 326.95999999999987 440.97000000000025 L 328.21999999999986 439.83000000000027 L 335.77999999999986 435.29000000000025 L 337.72999999999985 433.42000000000024 L 338.98999999999984 430.99000000000024 L 340.71999999999986 429.30000000000024 L 341.11999999999983 428.09000000000026 L 342.55999999999983 427.0600000000003 L 342.8399999999998 425.84000000000026 L 342.4899999999998 425.0000000000003 L 344.4899999999998 422.7400000000003 L 345.69999999999976 420.4000000000003 L 345.76999999999975 419.4600000000003 L 345.45999999999975 417.5300000000003 L 345.68999999999977 417.1400000000003 L 346.64999999999975 416.62000000000035 L 349.2499999999998 412.98000000000036 L 349.4099999999998 410.05000000000035 L 350.0299999999998 408.37000000000035 L 351.0399999999998 408.07000000000033 L 351.7699999999998 407.43000000000035 L 353.7599999999998 404.75000000000034 L 354.97999999999985 403.73000000000036 L 355.4499999999999 403.50000000000034 L 356.7599999999999 403.4600000000003 L 358.2599999999999 402.68000000000035 L 358.53999999999985 402.28000000000037 L 358.9399999999998 399.8200000000004 L 358.9399999999998 399.8200000000004 L 360.15999999999985 398.6900000000004 L 362.30999999999983 397.5800000000004 L 364.22999999999985 397.2100000000004 L 365.65999999999985 395.5200000000004 L 367.15999999999985 394.91000000000037 L 367.90999999999985 395.05000000000035 L 369.6399999999999 396.60000000000036 L 372.1899999999999 396.68000000000035 L 376.4799999999999 397.6400000000003 L 378.1499999999999 397.2800000000003 L 379.7699999999999 397.50000000000034 L 381.7699999999999 396.91000000000037 L 383.94999999999993 398.3300000000004 L 385.61999999999995 399.1200000000004 L 385.48999999999995 400.0400000000004 L 385.81999999999994 401.46000000000043 L 387.0299999999999 403.5500000000004 L 387.6599999999999 403.5800000000004 L 388.19999999999993 403.2600000000004 L 388.86999999999995 402.3200000000004 L 389.28 401.1900000000004 L 389.53999999999996 401.0000000000004 L 390.09 401.0500000000004 L 390.45 401.4400000000004 L 390.7 402.4000000000004 L 390.71 405.18000000000035 L 391.90999999999997 405.7100000000003 L 392.32 405.26000000000033 L 392.05 402.7200000000003 L 392.54 401.5300000000003 L 392.99 401.0500000000003 L 401.17 400.3800000000003 L 402.18 399.1300000000003 L 403.68 400.59000000000026 L 404.8 401.02000000000027 L 407.58 400.33000000000027 L 408.02 399.34000000000026 L 407.82 398.8800000000003 L 408.13 398.27000000000027 L 410.51 398.16000000000025 L 412.17 398.9400000000002 L 413.02000000000004 398.30000000000024 L 414.33000000000004 398.0100000000002 L 417.59000000000003 401.36000000000024 L 417.79 402.40000000000026 L 417.22 403.41000000000025 L 416.93 405.78000000000026 L 417.51 406.39000000000027 L 419.4 407.60000000000025 L 419.79999999999995 409.15000000000026 L 419.73999999999995 409.71000000000026 L 418.21999999999997 411.74000000000024 L 418.03999999999996 413.68000000000023 L 418.83 414.42000000000024 L 419.14 415.03000000000026 L 419.51 417.24000000000024 L 420.81 419.04000000000025 L 421.64 421.03000000000026 L 421.61 421.8800000000003 L 423.22 421.83000000000027 L 424 421.52000000000027 L 424.28 421.16000000000025 L 425.28 421.11000000000024 L 428.97999999999996 422.43000000000023 L 429.21 422.80000000000024 L 429.15999999999997 424.0700000000002 L 428.46 426.2500000000002 L 426.59999999999997 428.97000000000025 L 426.85999999999996 431.91000000000025 L 426.66999999999996 435.36000000000024 L 426.14 436.92000000000024 L 426.86 438.52000000000027 L 428.64 439.7600000000003 L 430.45 440.59000000000026 L 430.96 442.3100000000003 L 429.75 443.0100000000003 L 431.77 446.3200000000003 L 432.9 446.5700000000003 L 434.90999999999997 446.33000000000027 L 435.09 446.86000000000024 L 438.71 445.86000000000024 L 439.27 446.28000000000026 L 440.58 445.96000000000026 L 441.33 444.98000000000025 L 441.38 444.14000000000027 L 441.14 443.90000000000026 L 441.31 441.60000000000025 L 442.5 441.27000000000027 L 442.59 441.6200000000003 L 442.23999999999995 442.1100000000003 L 442.24999999999994 442.5900000000003 L 444.5899999999999 442.6700000000003 L 446.9799999999999 442.4200000000003 L 448.7699999999999 441.7500000000003 L 449.99999999999994 440.5100000000003 L 451.92999999999995 439.4900000000003 L 454.13999999999993 439.27000000000027 L 455.37999999999994 438.54000000000025 L 455.37999999999994 438.54000000000025 L 456.6499999999999 439.08000000000027 L 457.2099999999999 440.2500000000003 L 458.43999999999994 441.84000000000026 L 460.2099999999999 442.23000000000025 L 463.3599999999999 441.7000000000003 L 465.0599999999999 441.71000000000026 L 465.8099999999999 443.35000000000025 L 464.1599999999999 445.5000000000002 L 462.6599999999999 446.2100000000002 L 459.88999999999993 446.5700000000002 L 459.38999999999993 446.42000000000024 L 457.0399999999999 447.43000000000023 L 455.94999999999993 448.5800000000002 L 454.85999999999996 452.0800000000002 L 454.90999999999997 452.49000000000024 L 456.53999999999996 454.22000000000025 L 457.02 454.48000000000025 L 457.02 454.48000000000025 L 456.96 454.68000000000023 L 455.27 455.10000000000025 L 454.21 454.28000000000026 L 452.72999999999996 455.39000000000027 L 452.29999999999995 456.04000000000025 L 452.56999999999994 456.2600000000003 L 451.80999999999995 456.90000000000026 L 448.5899999999999 458.4500000000003 L 446.3399999999999 459.15000000000026 L 446.05999999999995 459.59000000000026 L 446.09999999999997 460.55000000000024 L 446.59999999999997 462.10000000000025 L 446.28 462.52000000000027 L 444.88 462.78000000000026 L 444.18 462.14000000000027 L 442.84000000000003 461.85000000000025 L 439.72 461.35000000000025 L 438.86 461.5000000000002 L 437.54 461.8400000000002 L 435.81 462.6600000000002 L 435.31 463.1700000000002 L 434.1 465.32000000000016 L 432.79 465.89000000000016 L 432.29 465.77000000000015 L 432.87 465.3000000000001 L 432.39 464.0800000000001 L 431.21999999999997 463.2300000000001 L 430.39 464.4600000000001 L 430.65 465.2100000000001 L 430.34999999999997 465.8200000000001 L 422.72999999999996 470.0600000000001 L 421.78 470.8800000000001 L 421.46999999999997 472.04000000000013 L 418.2 475.04000000000013 L 414.95 476.9900000000001 L 413.03 477.5200000000001 L 408.53 480.7300000000001 L 406.2 482.69000000000005 L 405.53 482.77000000000004 L 405.09 483.39000000000004 L 405.98999999999995 483.82000000000005 L 406.65 483.88000000000005 L 407.58 483.52000000000004 L 407.58 484.28000000000003 L 406.96 485.59000000000003 L 405.64 486.44000000000005 L 404.58 487.92 z M 448.89 464.91 L 447.34999999999997 464.26000000000005 L 446.18999999999994 464.44000000000005 L 445.69999999999993 464.06000000000006 L 445.79999999999995 463.2800000000001 L 446.74999999999994 462.6300000000001 L 447.8399999999999 460.7800000000001 L 448.55999999999995 461.0300000000001 L 449.21999999999997 461.68000000000006 L 449.34999999999997 464.5900000000001 L 448.89 464.91 z"},{code:"TO",name:"Tocantins",gTransform:"matrix(1 0 0 1 95.98 -93.17)",pathTransform:"translate(-401.98, -226.09)",d:"M 433.35 281.82 L 427.99 283.24 L 426.25 284.58 L 423.69 285.68 L 422.14 285.68 L 417.61 286.68 L 415.09 288.76 L 413.31 289.66 L 412.85 289.42 L 411.34 286.8 L 410.79 286.77 L 410.28 290.07 L 409.59 290.15 L 406.24 289.47 L 403.11 288 L 403.67 286.44 L 403.45 285.7 L 398.92 286.23 L 396.16 285.89 L 395.6 286.43 L 395.3 287.43 L 394.55 288.18 L 393.41 288.13 L 392.8 285.03 L 391.69 281.32 L 390.65 279.44 L 389.5 278.13 L 388.32 279.1 L 386.85 281.49 L 385.22 287.43 L 384.59 287.66 L 380.52 286.23 L 377.43 284.52 L 373.5 284.12 L 371.3 283.09 L 368.9 282.69 L 369.42 280.35 L 370.64 278.47 L 370.67 276.76 L 370.11 277.06 L 368.3 279.15 L 367.64 280.38 L 367.44 282.26 L 367.1 282.71 L 367.1 282.71 L 366.3 282.69 L 365.34 282.18 L 364.36 278.84 L 365.1 276.08 L 364.66 273.03 L 364.14 272.45 L 364.13 270.88 L 364.6 267.57 L 363.5 265.32 L 363.55 264.82 L 364.37 263.93 L 364.53 263.06 L 363.14 261.72 L 363.08 260.86 L 364.96 254.87 L 365 251.92 L 365.54 248.95 L 367.48 243.66 L 367.85 243.39 L 368.28 242.54 L 368.72 239.4 L 369.82 238.15 L 370.38 236.26 L 371.03 235.24 L 371.03 235.24 L 372.65 231.55 L 373.78 227.1 L 374.93 225.52 L 376.12 224.42 L 377.33 222.74 L 378.36 220.82 L 379.73 219.9 L 380.78 219.74 L 381.51 218.89 L 382.45 217.35 L 382.63 216.36 L 384.33 213.12 L 385.42 212.32 L 387.18 207.17 L 387.84 203.13 L 387.69 202.83 L 386.95 202.51 L 385.28 200.77 L 384.68 199.82 L 384.52 198.94 L 384.66 198.37 L 386.07 196.68 L 387.36 194.58 L 387.3 191.91 L 386.87 189.73 L 387.06 189.38 L 389.53 187.6 L 392.94 186.46 L 395.44 185.25 L 395.68 184.75 L 395.53 183.24 L 396.39 181.97 L 397.9 180.63 L 399.19 180.48 L 399.38 179.14 L 399.09 177.94 L 399.34 177.48 L 400.8 177.02 L 401.44 176.54 L 402.37 173.79 L 401.35 172.45 L 401.26 171.05 L 401.55 170.77 L 402.52 170.69 L 403.24 170.32 L 403.61 169.66 L 403.64 169.02 L 402.38 167.85 L 401.51 167.71 L 401.12 167.4 L 400.1 165.74 L 398.81 165.62 L 396.94 165.87 L 394.65 165.06 L 394.65 165.06 L 395.18 164.42 L 397.8 162.57 L 399.76 162.04 L 400.63 162.09 L 403.41 163.61 L 404.81 163.69 L 405.76 163.17 L 407.5 163.46 L 408.09 164.15 L 408.17 165.18 L 408.45 165.5 L 409.67 165.53 L 413.07 166.96 L 413.91 167.99 L 414.38 171.49 L 415.02 172.99 L 414.81 176.71 L 415.04 177.79 L 415.71 178.92 L 415.7 179.36 L 413.93 185.51 L 413.62 187.88 L 413.9 188.88 L 413.65 190.47 L 411.9 192.51 L 410.14 193.18 L 409.96 193.89 L 411.9 195.21 L 412.32 194.94 L 413.69 195.18 L 413.94 195.53 L 414.05 196.41 L 413.43 197.6 L 414.28 199.04 L 415.16 198.97 L 418.16 203.13 L 419.07 203.98 L 421.35 207 L 423.49 205.66 L 427.76 204.72 L 429.56 205.94 L 429.64 207.69 L 429 210.94 L 429.39 212.29 L 426 212.64 L 424.66 213.18 L 424.09 213.73 L 423.41 215.16 L 422.68 217.84 L 423.05 219.14 L 420.42 221.69 L 420.16 222.39 L 420.36 222.81 L 422.44 223.1 L 423.38 223.79 L 424.12 225.38 L 424.18 227.04 L 424.8 228.08 L 428.68 230.03 L 428.77 230.56 L 427.13 232.37 L 427.26 234.02 L 429.4 235.64 L 430.39 238.51 L 431.73 240.51 L 432.44 240.69 L 434.22 240.48 L 435.22 240.78 L 436.04 241.22 L 436.65 242.04 L 437.93 242.7 L 437.93 242.7 L 440.87 242.91 L 440.87 242.91 L 440.18 243.56 L 439.96 244.54 L 439.4 245.01 L 435.58 247.03 L 432.37 249.65 L 432.18 250.02 L 433.47 251.82 L 433.11 252.21 L 432.1 252.48 L 431.2 253.09 L 429.68 256.58 L 428.67 257.3 L 428.17 258.46 L 428.4 259.38 L 430.26 261.33 L 433.85 262 L 435.72 262.99 L 435.77 263.75 L 435.21 264.2 L 433.17 265.01 L 432.74 265.97 L 432.83 266.47 L 433.18 266.8 L 434.21 266.62 L 435.13 266.91 L 435.71 267.42 L 436 268.06 L 435.04 268.77 L 433.89 269.19 L 431.94 270.86 L 431.75 271.71 L 431.7 274.63 L 432.05 275.88 L 432.99 276.54 L 434.04 276.78 L 434.45 277.03 L 434.62 277.45 L 434.67 278.51 L 433.31 280.89 z"}];function are({selected:t,onSelect:e}){const s=ae(),[n,i]=T.useState(rre),r=a=>{if(a)try{const l=a.getBBox();if(!l.width||!l.height)return;const c=Math.max(l.width,l.height)*.04,d=`${l.x-c} ${l.y-c} ${l.width+c*2} ${l.height+c*2}`;i(h=>h===d?h:d)}catch{}};return o.jsx("svg",{ref:r,viewBox:n,role:"group","aria-label":s("sectionsEditor.brazilMap.ariaLabel"),className:"h-72 w-full rounded-md border border-border/60 bg-muted/20",children:o.jsx("g",{transform:ore,children:p4.map(a=>{const l=a.code===t;return o.jsx("g",{transform:a.gTransform,children:o.jsx("path",{d:a.d,transform:a.pathTransform,role:"button",tabIndex:0,"aria-label":a.name,"aria-pressed":l,onClick:()=>e(a.code),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),e(a.code))},className:re("cursor-pointer stroke-background outline-none transition-colors [stroke-width:1] [vector-effect:non-scaling-stroke]","hover:fill-primary/50 focus-visible:fill-primary/50",l?"fill-primary":"fill-muted-foreground/40")})},a.code)})})})}const lre=[{code:"AF",name:"Afghanistan"},{code:"AX",name:"Åland Islands"},{code:"AL",name:"Albania"},{code:"DZ",name:"Algeria"},{code:"AS",name:"American Samoa"},{code:"AD",name:"Andorra"},{code:"AO",name:"Angola"},{code:"AI",name:"Anguilla"},{code:"AQ",name:"Antarctica"},{code:"AG",name:"Antigua & Barbuda"},{code:"AR",name:"Argentina"},{code:"AM",name:"Armenia"},{code:"AW",name:"Aruba"},{code:"AU",name:"Australia"},{code:"AT",name:"Austria"},{code:"AZ",name:"Azerbaijan"},{code:"BS",name:"Bahamas"},{code:"BH",name:"Bahrain"},{code:"BD",name:"Bangladesh"},{code:"BB",name:"Barbados"},{code:"BY",name:"Belarus"},{code:"BE",name:"Belgium"},{code:"BZ",name:"Belize"},{code:"BJ",name:"Benin"},{code:"BM",name:"Bermuda"},{code:"BT",name:"Bhutan"},{code:"BO",name:"Bolivia"},{code:"BA",name:"Bosnia & Herzegovina"},{code:"BW",name:"Botswana"},{code:"BV",name:"Bouvet Island"},{code:"BR",name:"Brazil"},{code:"VG",name:"British Virgin Islands"},{code:"BN",name:"Brunei"},{code:"BG",name:"Bulgaria"},{code:"BF",name:"Burkina Faso"},{code:"BI",name:"Burundi"},{code:"KH",name:"Cambodia"},{code:"CM",name:"Cameroon"},{code:"CA",name:"Canada"},{code:"CV",name:"Cape Verde"},{code:"BQ",name:"Caribbean Netherlands"},{code:"KY",name:"Cayman Islands"},{code:"CF",name:"Central African Republic"},{code:"TD",name:"Chad"},{code:"IO",name:"Chagos Archipelago"},{code:"CL",name:"Chile"},{code:"CN",name:"China mainland"},{code:"CX",name:"Christmas Island"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CO",name:"Colombia"},{code:"KM",name:"Comoros"},{code:"CG",name:"Congo - Brazzaville"},{code:"CD",name:"Congo - Kinshasa"},{code:"CK",name:"Cook Islands"},{code:"CR",name:"Costa Rica"},{code:"CI",name:"Côte d’Ivoire"},{code:"HR",name:"Croatia"},{code:"CU",name:"Cuba"},{code:"CW",name:"Curaçao"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czechia"},{code:"DK",name:"Denmark"},{code:"DJ",name:"Djibouti"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"EC",name:"Ecuador"},{code:"EG",name:"Egypt"},{code:"SV",name:"El Salvador"},{code:"GQ",name:"Equatorial Guinea"},{code:"ER",name:"Eritrea"},{code:"EE",name:"Estonia"},{code:"SZ",name:"Eswatini"},{code:"ET",name:"Ethiopia"},{code:"FK",name:"Falkland Islands"},{code:"FO",name:"Faroe Islands"},{code:"FJ",name:"Fiji"},{code:"FI",name:"Finland"},{code:"FR",name:"France"},{code:"GF",name:"French Guiana"},{code:"PF",name:"French Polynesia"},{code:"TF",name:"French Southern Territories"},{code:"GA",name:"Gabon"},{code:"GM",name:"Gambia"},{code:"GE",name:"Georgia"},{code:"DE",name:"Germany"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GR",name:"Greece"},{code:"GL",name:"Greenland"},{code:"GD",name:"Grenada"},{code:"GP",name:"Guadeloupe"},{code:"GU",name:"Guam"},{code:"GT",name:"Guatemala"},{code:"GG",name:"Guernsey"},{code:"GN",name:"Guinea"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HT",name:"Haiti"},{code:"HM",name:"Heard & McDonald Islands"},{code:"HN",name:"Honduras"},{code:"HK",name:"Hong Kong"},{code:"HU",name:"Hungary"},{code:"IS",name:"Iceland"},{code:"IN",name:"India"},{code:"ID",name:"Indonesia"},{code:"IR",name:"Iran"},{code:"IQ",name:"Iraq"},{code:"IE",name:"Ireland"},{code:"IM",name:"Isle of Man"},{code:"IL",name:"Israel"},{code:"IT",name:"Italy"},{code:"JM",name:"Jamaica"},{code:"JP",name:"Japan"},{code:"JE",name:"Jersey"},{code:"JO",name:"Jordan"},{code:"KZ",name:"Kazakhstan"},{code:"KE",name:"Kenya"},{code:"KI",name:"Kiribati"},{code:"KW",name:"Kuwait"},{code:"KG",name:"Kyrgyzstan"},{code:"LA",name:"Laos"},{code:"LV",name:"Latvia"},{code:"LB",name:"Lebanon"},{code:"LS",name:"Lesotho"},{code:"LR",name:"Liberia"},{code:"LY",name:"Libya"},{code:"LI",name:"Liechtenstein"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"MO",name:"Macao"},{code:"MG",name:"Madagascar"},{code:"MW",name:"Malawi"},{code:"MY",name:"Malaysia"},{code:"MV",name:"Maldives"},{code:"ML",name:"Mali"},{code:"MT",name:"Malta"},{code:"MH",name:"Marshall Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MU",name:"Mauritius"},{code:"YT",name:"Mayotte"},{code:"MX",name:"Mexico"},{code:"FM",name:"Micronesia"},{code:"MD",name:"Moldova"},{code:"MC",name:"Monaco"},{code:"MN",name:"Mongolia"},{code:"ME",name:"Montenegro"},{code:"MS",name:"Montserrat"},{code:"MA",name:"Morocco"},{code:"MZ",name:"Mozambique"},{code:"MM",name:"Myanmar (Burma)"},{code:"NA",name:"Namibia"},{code:"NR",name:"Nauru"},{code:"NP",name:"Nepal"},{code:"NL",name:"Netherlands"},{code:"NC",name:"New Caledonia"},{code:"NZ",name:"New Zealand"},{code:"NI",name:"Nicaragua"},{code:"NE",name:"Niger"},{code:"NG",name:"Nigeria"},{code:"NU",name:"Niue"},{code:"NF",name:"Norfolk Island"},{code:"KP",name:"North Korea"},{code:"MK",name:"North Macedonia"},{code:"MP",name:"Northern Mariana Islands"},{code:"NO",name:"Norway"},{code:"OM",name:"Oman"},{code:"PK",name:"Pakistan"},{code:"PW",name:"Palau"},{code:"PS",name:"Palestinian Territories"},{code:"PA",name:"Panama"},{code:"PG",name:"Papua New Guinea"},{code:"PY",name:"Paraguay"},{code:"PE",name:"Peru"},{code:"PH",name:"Philippines"},{code:"PN",name:"Pitcairn Islands"},{code:"PL",name:"Poland"},{code:"PT",name:"Portugal"},{code:"PR",name:"Puerto Rico"},{code:"QA",name:"Qatar"},{code:"RE",name:"Réunion"},{code:"RO",name:"Romania"},{code:"RU",name:"Russia"},{code:"RW",name:"Rwanda"},{code:"WS",name:"Samoa"},{code:"SM",name:"San Marino"},{code:"ST",name:"São Tomé & Príncipe"},{code:"SA",name:"Saudi Arabia"},{code:"SN",name:"Senegal"},{code:"RS",name:"Serbia"},{code:"SC",name:"Seychelles"},{code:"SL",name:"Sierra Leone"},{code:"SG",name:"Singapore"},{code:"SX",name:"Sint Maarten"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"GS",name:"So. Georgia & So. Sandwich Isl."},{code:"SB",name:"Solomon Islands"},{code:"SO",name:"Somalia"},{code:"ZA",name:"South Africa"},{code:"KR",name:"South Korea"},{code:"SS",name:"South Sudan"},{code:"ES",name:"Spain"},{code:"LK",name:"Sri Lanka"},{code:"BL",name:"St. Barthélemy"},{code:"SH",name:"St. Helena"},{code:"KN",name:"St. Kitts & Nevis"},{code:"LC",name:"St. Lucia"},{code:"MF",name:"St. Martin"},{code:"PM",name:"St. Pierre & Miquelon"},{code:"VC",name:"St. Vincent & Grenadines"},{code:"SD",name:"Sudan"},{code:"SR",name:"Suriname"},{code:"SJ",name:"Svalbard & Jan Mayen"},{code:"SE",name:"Sweden"},{code:"CH",name:"Switzerland"},{code:"SY",name:"Syria"},{code:"TW",name:"Taiwan"},{code:"TJ",name:"Tajikistan"},{code:"TZ",name:"Tanzania"},{code:"TH",name:"Thailand"},{code:"TL",name:"Timor-Leste"},{code:"TG",name:"Togo"},{code:"TK",name:"Tokelau"},{code:"TO",name:"Tonga"},{code:"T1",name:"Tor network (Cloudflare)"},{code:"TT",name:"Trinidad & Tobago"},{code:"TN",name:"Tunisia"},{code:"TR",name:"Türkiye"},{code:"TM",name:"Turkmenistan"},{code:"TC",name:"Turks & Caicos Islands"},{code:"TV",name:"Tuvalu"},{code:"UM",name:"U.S. Outlying Islands"},{code:"VI",name:"U.S. Virgin Islands"},{code:"UG",name:"Uganda"},{code:"UA",name:"Ukraine"},{code:"AE",name:"United Arab Emirates"},{code:"GB",name:"United Kingdom"},{code:"US",name:"United States"},{code:"XX",name:"Unknown (Cloudflare could not determine)"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VU",name:"Vanuatu"},{code:"VA",name:"Vatican City"},{code:"VE",name:"Venezuela"},{code:"VN",name:"Vietnam"},{code:"WF",name:"Wallis & Futuna"},{code:"EH",name:"Western Sahara"},{code:"YE",name:"Yemen"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}],cre="BR";function dre(t){if(!t)return!1;const e=Object.keys(t).sort();return e.length===3&&e[0]==="city"&&e[1]==="country"&&e[2]==="regionCode"}function ure(t){const e=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return{city:typeof e.city=="string"?e.city:"",regionCode:typeof e.regionCode=="string"?e.regionCode:"",country:typeof e.country=="string"?e.country:""}}function hre(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function lv(t){const e=F.c(37),{id:s,options:n,value:i,placeholder:r,emptyMessage:a,onChange:l}=t,[c,d]=T.useState(!1);let h;if(e[0]!==n||e[1]!==i){let S;e[3]!==i?(S=k=>k.value===i,e[3]=i,e[4]=S):S=e[4],h=n.find(S),e[0]=n,e[1]=i,e[2]=h}else h=e[2];const u=h;let f;e[5]!==r||e[6]!==u?(f=u?o.jsx("span",{className:"truncate",children:u.label}):o.jsx("span",{className:"text-muted-foreground",children:r}),e[5]=r,e[6]=u,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(y9,{className:"size-4 shrink-0 opacity-50"}),e[8]=p):p=e[8];let m;e[9]!==s||e[10]!==c||e[11]!==f?(m=o.jsx(ws,{asChild:!0,children:o.jsxs(me,{id:s,variant:"outline",role:"combobox","aria-expanded":c,className:"h-10 w-full justify-between font-normal",children:[f,p]})}),e[9]=s,e[10]=c,e[11]=f,e[12]=m):m=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g={width:"var(--radix-popover-trigger-width)"},e[13]=g):g=e[13];let x;e[14]!==r?(x=o.jsx(Mi,{placeholder:r,className:"h-9"}),e[14]=r,e[15]=x):x=e[15];let b;e[16]!==a?(b=o.jsx(ri,{children:a}),e[16]=a,e[17]=b):b=e[17];let v;if(e[18]!==l||e[19]!==n||e[20]!==i){let S;e[22]!==l||e[23]!==i?(S=k=>o.jsxs($s,{value:`${k.label} ${k.value}`,onSelect:()=>{l(k.value===i?"":k.value),d(!1)},children:[o.jsx("span",{className:"truncate",children:k.label}),o.jsx(Gt,{className:re("ml-auto size-4 shrink-0",i===k.value?"opacity-100":"opacity-0")})]},k.value),e[22]=l,e[23]=i,e[24]=S):S=e[24],v=n.map(S),e[18]=l,e[19]=n,e[20]=i,e[21]=v}else v=e[21];let L;e[25]!==v?(L=o.jsx(fn,{children:v}),e[25]=v,e[26]=L):L=e[26];let _;e[27]!==b||e[28]!==L?(_=o.jsxs(Ii,{children:[b,L]}),e[27]=b,e[28]=L,e[29]=_):_=e[29];let y;e[30]!==_||e[31]!==x?(y=o.jsx(ks,{className:"p-0",style:g,children:o.jsxs(vr,{children:[x,_]})}),e[30]=_,e[31]=x,e[32]=y):y=e[32];let w;return e[33]!==c||e[34]!==y||e[35]!==m?(w=o.jsxs(js,{open:c,onOpenChange:d,children:[m,y]}),e[33]=c,e[34]=y,e[35]=m,e[36]=w):w=e[36],w}const fre=lre.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),mre=p4.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function nj(t){const e=F.c(66),{schema:s,value:n,onChange:i,path:r,sandbox:a}=t,l=ae();let c;e[0]!==n?(c=ure(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:h,regionCode:u,country:f}=d;let p;e[2]!==s.properties?(p=s.properties??{},e[2]=s.properties,e[3]=p):p=e[3];const m=p;let g;e[4]!==m.country?.title||e[5]!==l?(g=m.country?.title??l("sectionsEditor.locationField.countryDefault"),e[4]=m.country?.title,e[5]=l,e[6]=g):g=e[6];const x=g;let b;e[7]!==m.regionCode?.title||e[8]!==l?(b=m.regionCode?.title??l("sectionsEditor.locationField.regionDefault"),e[7]=m.regionCode?.title,e[8]=l,e[9]=b):b=e[9];const v=b;let L;e[10]!==m.city?.title||e[11]!==l?(L=m.city?.title??l("sectionsEditor.locationField.cityDefault"),e[10]=m.city?.title,e[11]=l,e[12]=L):L=e[12];const _=L;let y;e[13]!==d||e[14]!==i?(y=j=>{i(hre(d,j))},e[13]=d,e[14]=i,e[15]=y):y=e[15];const w=y,S=f===cre;let k;if(e[16]!==h||e[17]!==_||e[18]!==f||e[19]!==x||e[20]!==w||e[21]!==S||e[22]!==r||e[23]!==u||e[24]!==v||e[25]!==a?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==l){let j;e[30]!==u?(j=U=>U.code===u,e[30]=u,e[31]=j):j=e[31];const C=p4.find(j),V=`${r}.country`;let N;e[32]!==s.title||e[33]!==l?(N=s.title??l("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=l,e[34]=N):N=e[34];const A=a?.virtualMcpId;let P;e[35]!==s.description||e[36]!==N||e[37]!==A||e[38]!==V?(P=o.jsx(Us,{htmlFor:V,label:N,description:s.description,virtualMcpId:A}),e[35]=s.description,e[36]=N,e[37]=A,e[38]=V,e[39]=P):P=e[39];const R=`${r}.country`;let E;e[40]!==x||e[41]!==R?(E=o.jsx(Mt,{htmlFor:R,className:"text-xs",children:x}),e[40]=x,e[41]=R,e[42]=E):E=e[42];const I=`${r}.country`;let D;e[43]!==l?(D=l("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=l,e[44]=D):D=e[44];let O;e[45]!==l?(O=l("sectionsEditor.locationField.noCountryFound"),e[45]=l,e[46]=O):O=e[46];let B;e[47]!==w?(B=U=>w({country:U,regionCode:"",city:""}),e[47]=w,e[48]=B):B=e[48];let M;e[49]!==f||e[50]!==I||e[51]!==D||e[52]!==O||e[53]!==B?(M=o.jsx(lv,{id:I,options:fre,value:f,placeholder:D,emptyMessage:O,onChange:B}),e[49]=f,e[50]=I,e[51]=D,e[52]=O,e[53]=B,e[54]=M):M=e[54];let z;e[55]!==E||e[56]!==M?(z=o.jsxs("div",{className:"space-y-1.5",children:[E,M]}),e[55]=E,e[56]=M,e[57]=z):z=e[57];let $;e[58]!==f||e[59]!==w||e[60]!==S||e[61]!==r||e[62]!==u||e[63]!==v||e[64]!==l?($=f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Mt,{htmlFor:`${r}.regionCode`,className:"text-xs",children:v}),S?o.jsxs("div",{className:"space-y-2",children:[o.jsx(are,{selected:u,onSelect:U=>w({regionCode:U===u?"":U,city:""})}),o.jsx(lv,{id:`${r}.regionCode`,options:mre,value:u,placeholder:l("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:l("sectionsEditor.locationField.noStateFound"),onChange:U=>w({regionCode:U,city:""})})]}):o.jsxs(o.Fragment,{children:[o.jsx(vt,{id:`${r}.regionCode`,type:"text",value:u,placeholder:l("sectionsEditor.locationField.regionCodePlaceholder"),onChange:U=>w({regionCode:U.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=f,e[59]=w,e[60]=S,e[61]=r,e[62]=u,e[63]=v,e[64]=l,e[65]=$):$=e[65],k=o.jsxs("div",{className:"space-y-4",children:[P,z,$,f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Mt,{htmlFor:`${r}.city`,className:"text-xs",children:_}),o.jsx(vt,{id:`${r}.city`,type:"text",value:h,placeholder:S&&C?l("sectionsEditor.locationField.cityPlaceholderWithState",{state:C.name}):l("sectionsEditor.locationField.cityPlaceholder"),onChange:U=>w({city:U.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:l("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=h,e[17]=_,e[18]=f,e[19]=x,e[20]=w,e[21]=S,e[22]=r,e[23]=u,e[24]=v,e[25]=a?.virtualMcpId,e[26]=s.description,e[27]=s.title,e[28]=l,e[29]=k}else k=e[29];return k}function pre(t){const e=t.schema;if(!e?.properties)return null;const s=new Set(Object.keys(t.discriminators??{}));if(s.size===0)return e;const n={};for(const[i,r]of Object.entries(e.properties))s.has(i)||(n[i]=r);return Object.keys(n).length===0?null:{...e,properties:n}}function gre(t){const e=F.c(52),s=ae(),{schema:n,value:i,onChange:r,path:a,label:l}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==i?(c=n.inlineUnionBranches??[],d=Pk(i,c.map(xre)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const h=d,[u,f]=T.useState(h),[p,m]=T.useState(h);p!==h&&(m(h),f(h));const g=Math.min(u,c.length-1),x=c[g];let b;e[4]!==c||e[5]!==r?(b=D=>{const O=Number(D);f(O),r({...c[O]?.discriminators??{}})},e[4]=c,e[5]=r,e[6]=b):b=e[6];const v=b;if(c.length===0)return null;let L;e[7]!==x?(L=x?pre(x):null,e[7]=x,e[8]=L):L=e[8];const _=L;let y;if(e[9]!==x?.schema?.properties||e[10]!==i){let D;e[12]!==x?.schema?.properties?(D=x?.schema?.properties??{},e[12]=x?.schema?.properties,e[13]=D):D=e[13],y=Cne(i,Object.keys(D)),e[9]=x?.schema?.properties,e[10]=i,e[11]=y}else y=e[11];const w=y;let S;e[14]!==l||e[15]!==a||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(S=l&&o.jsx(Us,{htmlFor:a,label:l,description:n.description,virtualMcpId:t.sandbox?.virtualMcpId}),e[14]=l,e[15]=a,e[16]=t.sandbox?.virtualMcpId,e[17]=n.description,e[18]=S):S=e[18];const k=String(g);let j;e[19]!==s?(j=s("sectionsEditor.inlineUnionField.selectPlaceholder"),e[19]=s,e[20]=j):j=e[20];let C;e[21]!==j?(C=o.jsx(Ss,{placeholder:j}),e[21]=j,e[22]=C):C=e[22];let V;e[23]!==a||e[24]!==C?(V=o.jsx(bs,{id:a,className:"w-full min-w-0",children:C}),e[23]=a,e[24]=C,e[25]=V):V=e[25];let N;if(e[26]!==c||e[27]!==s){let D;e[29]!==s?(D=(O,B)=>o.jsx(Rt,{value:String(B),children:Pne(O.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:B+1})},O.title),e[29]=s,e[30]=D):D=e[30],N=c.map(D),e[26]=c,e[27]=s,e[28]=N}else N=e[28];let A;e[31]!==N?(A=o.jsx(vs,{children:N}),e[31]=N,e[32]=A):A=e[32];let P;e[33]!==v||e[34]!==A||e[35]!==k||e[36]!==V?(P=o.jsxs(xs,{value:k,onValueChange:v,children:[V,A]}),e[33]=v,e[34]=A,e[35]=k,e[36]=V,e[37]=P):P=e[37];let R;e[38]!==P||e[39]!==S?(R=o.jsxs("div",{className:"space-y-1.5",children:[S,P]}),e[38]=P,e[39]=S,e[40]=R):R=e[40];let E;e[41]!==x||e[42]!==_||e[43]!==r||e[44]!==a||e[45]!==w||e[46]!==t||e[47]!==i?(E=x&&(dre(x.schema?.properties)?o.jsx(nj,{...t,schema:x.schema,onChange:D=>r({...w,...D,...x.discriminators??{}})}):_?o.jsx(Bi,{schema:_,value:i,onChange:D=>r({...D,...x.discriminators??{}}),basePath:a,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:t.meta,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,sandbox:t.sandbox,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection}):null),e[41]=x,e[42]=_,e[43]=r,e[44]=a,e[45]=w,e[46]=t,e[47]=i,e[48]=E):E=e[48];let I;return e[49]!==R||e[50]!==E?(I=o.jsxs("div",{className:"space-y-3",children:[R,E]}),e[49]=R,e[50]=E,e[51]=I):I=e[51],I}function xre(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const bre={lat:-21.9,lng:-41.42},Ep=1e5;let gh=null;function vre(t){return gh||(gh=new Promise((e,s)=>{if(typeof window>"u"){s(new Error("Google Maps requires a browser environment"));return}const n=window;if(n.google?.maps){e(n.google.maps);return}const i=()=>{const l=window.google?.maps;l?e(l):s(new Error("Google Maps script loaded without google.maps"))},r=document.querySelector("script[data-google-maps-loader]");if(r){r.addEventListener("load",i),r.addEventListener("error",()=>s(new Error("Failed to load Google Maps")));return}const a=document.createElement("script");a.src=`https://maps.googleapis.com/maps/api/js?key=${t}&v=weekly&libraries=maps`,a.async=!0,a.defer=!0,a.dataset.googleMapsLoader="true",a.addEventListener("load",i),a.addEventListener("error",()=>s(new Error("Failed to load Google Maps"))),document.head.appendChild(a)}),gh)}function yre(t){if(typeof t!="string"||!t)return null;const e=t.split(",").map(Number),[s,n,i]=e;return!Number.isFinite(s)||!Number.isFinite(n)?null:{lat:s,lng:n,radius:Number.isFinite(i)?i:Ep}}function _re({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r}){const a=Em().googleMapsApiKey,l=T.useRef(s);l.current=s;const c=T.useRef(yre(e)),[d,h]=T.useState(null),u=T.useRef(null),f=p=>{if(!p||!a)return;const m={disposed:!1,circle:null,listeners:[]};return vre(a).then(g=>{if(m.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:bre,v=x?.radius??Ep,L=new g.Map(p,{center:b,zoom:v?Math.round(Math.log2(768e4/v))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),_=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:L,center:b,radius:v});m.circle=_;const y=()=>{const S=_.getCenter(),k=_.getRadius();S&&l.current(`${S.lat()},${S.lng()},${k}`)},w=S=>{S&&m.listeners.push(S)};w(L.addListener("click",S=>{S.latLng&&(_.setCenter({lat:S.latLng.lat(),lng:S.latLng.lng()}),_.getRadius()||_.setRadius(Ep),y())})),w(_.addListener("radius_changed",y)),w(_.addListener("dragend",y))},g=>{m.disposed||h(g instanceof Error?g.message:"Failed to load map")}),()=>{m.disposed=!0;for(const g of m.listeners)try{g?.remove()}catch{}if(m.listeners=[],m.circle){try{m.circle.setMap(null)}catch{}m.circle=null}}};return u.current||(u.current=f),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Us,{htmlFor:n,label:i,description:t.description,virtualMcpId:r?.virtualMcpId}),a?d?o.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:d}):o.jsx("div",{ref:u.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):o.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["The map picker is unavailable — set"," ",o.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const Lre="oklch(0.65 0.15 160)",wre="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]",ij="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",g3e="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function cv(t){return t.map(e=>e.label).join(`
631
- `)}function dv(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Sre(t,e){const s=new Map;for(const n of t){const i=s.get(n.label);i?i.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function kre(t){return t.map((e,s)=>({...e,index:s}))}function rj(t){const e=F.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:a,onDelete:l}=t,c=ae(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let h;e[0]!==d?(h=re("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=h):h=e[1];let u;e[2]!==h?(u=o.jsx(o9,{className:h}),e[2]=h,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(zr,{className:"h-4 w-4 shrink-0",style:{color:Lre}}),e[4]=f):f=e[4];let p;e[5]!==s?(p=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=p):p=e[6];let m;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==l||e[11]!==a||e[12]!==r||e[13]!==c?(m=!i&&o.jsxs(Ot,{children:[o.jsx($t,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:Cre,onPointerDown:jre,children:o.jsx(Vi,{size:14})})}),o.jsxs(Bt,{align:"end",children:[r&&o.jsxs(Qe,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(a8,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Qe,{onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(bn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Qe,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(rn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=l,e[11]=a,e[12]=r,e[13]=c,e[14]=m):m=e[14];let g;return e[15]!==u||e[16]!==p||e[17]!==m?(g=o.jsxs(o.Fragment,{children:[u,f,p,m]}),e[15]=u,e[16]=p,e[17]=m,e[18]=g):g=e[18],g}function jre(t){return t.stopPropagation()}function Cre(t){return t.stopPropagation()}function Nre(t){const e=F.c(27),{entry:s,selected:n,canDelete:i,onSelect:r,onRename:a,onDuplicate:l,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:Vre},e[0]=s.id,e[1]=d):d=e[1];const{attributes:h,listeners:u,setNodeRef:f,transform:p,isDragging:m}=f3(d);let g;e[2]!==p?(g=fr.Transform.toString(p?{...p,x:0}:null),e[2]=p,e[3]=g):g=e[3];const x=m?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let L;e[7]!==r?(L=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())},e[7]=r,e[8]=L):L=e[8];const _=m?"cursor-grabbing":"cursor-grab",y=n?ij:wre;let w;e[9]!==_||e[10]!==y?(w=re("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",_,y),e[9]=_,e[10]=y,e[11]=w):w=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==l||e[16]!==a?(S=o.jsx(rj,{label:s.label,canDelete:i,onRename:a,onDuplicate:l,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=l,e[16]=a,e[17]=S):S=e[17];let k;return e[18]!==h||e[19]!==u||e[20]!==r||e[21]!==f||e[22]!==v||e[23]!==L||e[24]!==w||e[25]!==S?(k=o.jsx("div",{ref:f,style:v,...h,...u,onClick:r,onKeyDown:L,className:w,children:S}),e[18]=h,e[19]=u,e[20]=r,e[21]=f,e[22]=v,e[23]=L,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function Vre(){return!1}function Tre(t){const e=F.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:a,onDuplicate:l,onDelete:c,onRemoveAll:d,onReorder:h,onAdd:u}=t,f=ae(),p=n.length>1;let m;e[0]!==n?(m=()=>dv(n),e[0]=n,e[1]=m):m=e[1];const[g,x]=T.useState(m),[b,v]=T.useState(null),[L,_]=T.useState(s),[y,w]=T.useState(n.length);let S;e[2]!==n?(S=()=>cv(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=T.useState(S),C=T.useRef(!1),V=cv(n);L!==s?(_(s),w(n.length),j(V),x(dv(n))):(y!==n.length||k!==V)&&(w(n.length),j(V),x(ue=>Sre(ue,n)));let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N={activationConstraint:{distance:8}},e[4]=N):N=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A={coordinateGetter:m3},e[5]=A):A=e[5];const P=r3(Qc(_0,N),Qc(y0,A));let R;e[6]!==g?(R=g.map(Are),e[6]=g,e[7]=R):R=e[7];const E=R;let I;e[8]!==g?(I=ue=>{const ce=String(ue.active.id);v(g.find(ne=>ne.id===ce)??null)},e[8]=g,e[9]=I):I=e[9];const D=I;let O;e[10]!==E||e[11]!==h?(O=ue=>{v(null);const{active:ce,over:ne}=ue;if(!ne||ce.id===ne.id)return;const q=E.indexOf(String(ce.id)),fe=E.indexOf(String(ne.id));q===-1||fe===-1||(x(ge=>kre(Xc([...ge],q,fe))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),h(q,fe))},e[10]=E,e[11]=h,e[12]=O):O=e[12];const B=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const z=M;let $,U,H,W,K,G,Y,Z,te,X,ee,J,Q;if(e[14]!==p||e[15]!==g||e[16]!==E||e[17]!==B||e[18]!==D||e[19]!==u||e[20]!==c||e[21]!==l||e[22]!==d||e[23]!==a||e[24]!==r||e[25]!==i||e[26]!==P||e[27]!==f){const ue=Oe=>{C.current||r(Oe)};ee="space-y-1 border-b p-2";let ce;e[41]!==f?(ce=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ce):ce=e[42];let ne;e[43]!==ce?(ne=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ce}),e[43]=ce,e[44]=ne):ne=e[44];let q;e[45]!==f?(q=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=q):q=e[46];let fe;e[47]===Symbol.for("react.memo_cache_sentinel")?(fe=o.jsx(Qt,{size:14}),e[47]=fe):fe=e[47];let ge;e[48]!==u||e[49]!==q?(ge=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":q,className:"size-6",onClick:u,children:fe})}),e[48]=u,e[49]=q,e[50]=ge):ge=e[50];let _e;e[51]!==f?(_e=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=_e):_e=e[52];let Le;e[53]!==_e?(Le=o.jsx(Ke,{children:_e}),e[53]=_e,e[54]=Le):Le=e[54];let je;e[55]!==ge||e[56]!==Le?(je=o.jsxs(We,{children:[ge,Le]}),e[55]=ge,e[56]=Le,e[57]=je):je=e[57];let Ce;e[58]!==f?(Ce=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Ce):Ce=e[59];let Pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Pe=o.jsx(rn,{size:14}),e[60]=Pe):Pe=e[60];let pe;e[61]!==d||e[62]!==Ce?(pe=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":Ce,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Pe})}),e[61]=d,e[62]=Ce,e[63]=pe):pe=e[63];let ke;e[64]!==f?(ke=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=ke):ke=e[65];let Te;e[66]!==ke?(Te=o.jsx(Ke,{children:ke}),e[66]=ke,e[67]=Te):Te=e[67];let we;e[68]!==pe||e[69]!==Te?(we=o.jsxs(We,{children:[pe,Te]}),e[68]=pe,e[69]=Te,e[70]=we):we=e[70];let Ne;e[71]!==je||e[72]!==we?(Ne=o.jsxs("div",{className:"flex items-center gap-0.5",children:[je,we]}),e[71]=je,e[72]=we,e[73]=Ne):Ne=e[73],e[74]!==ne||e[75]!==Ne?(J=o.jsxs("div",{className:"flex items-center justify-between",children:[ne,Ne]}),e[74]=ne,e[75]=Ne,e[76]=J):J=e[76],U=c3,G=P,Y=jL,Z=D,te=B,X=z,$=h3,W=E,K=u3,Q="space-y-0.5",H=g.map(Oe=>o.jsx(Nre,{entry:Oe,selected:Oe.index===i,canDelete:p,onSelect:()=>ue(Oe.index),onRename:a?()=>a(Oe.index):void 0,onDuplicate:()=>l(Oe.index),onDelete:()=>c(Oe.index)},Oe.id)),e[14]=p,e[15]=g,e[16]=E,e[17]=B,e[18]=D,e[19]=u,e[20]=c,e[21]=l,e[22]=d,e[23]=a,e[24]=r,e[25]=i,e[26]=P,e[27]=f,e[28]=$,e[29]=U,e[30]=H,e[31]=W,e[32]=K,e[33]=G,e[34]=Y,e[35]=Z,e[36]=te,e[37]=X,e[38]=ee,e[39]=J,e[40]=Q}else $=e[28],U=e[29],H=e[30],W=e[31],K=e[32],G=e[33],Y=e[34],Z=e[35],te=e[36],X=e[37],ee=e[38],J=e[39],Q=e[40];let oe;e[77]!==H||e[78]!==Q?(oe=o.jsx("div",{className:Q,children:H}),e[77]=H,e[78]=Q,e[79]=oe):oe=e[79];let le;e[80]!==$||e[81]!==W||e[82]!==K||e[83]!==oe?(le=o.jsx($,{items:W,strategy:K,children:oe}),e[80]=$,e[81]=W,e[82]=K,e[83]=oe,e[84]=le):le=e[84];let de;e[85]!==b||e[86]!==p?(de=b?o.jsx("div",{className:re("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",ij),children:o.jsx(rj,{label:b.label,canDelete:p,dragging:!0})}):null,e[85]=b,e[86]=p,e[87]=de):de=e[87];let se;e[88]!==de?(se=Kn.createPortal(o.jsx(d3,{dropAnimation:Ck,children:de}),document.body),e[88]=de,e[89]=se):se=e[89];let ie;e[90]!==U||e[91]!==G||e[92]!==Y||e[93]!==Z||e[94]!==te||e[95]!==X||e[96]!==le||e[97]!==se?(ie=o.jsxs(U,{sensors:G,collisionDetection:Y,onDragStart:Z,onDragEnd:te,onDragCancel:X,children:[le,se]}),e[90]=U,e[91]=G,e[92]=Y,e[93]=Z,e[94]=te,e[95]=X,e[96]=le,e[97]=se,e[98]=ie):ie=e[98];let he;return e[99]!==ee||e[100]!==J||e[101]!==ie?(he=o.jsxs("div",{className:ee,children:[J,ie]}),e[99]=ee,e[100]=J,e[101]=ie,e[102]=he):he=e[102],he}function Are(t){return t.id}const Pre=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Ere={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function Z1(t){return nl(t)!==void 0}function g4(t,e){if(e){if(Z1(e))return e;const s=Ere[e];if(s&&Z1(s))return s}for(const[s,n]of Pre)if(s.test(t)&&Z1(n))return n;return"FilterLines"}function Rre(t){return nl(t)??ag}function em(t){const e=F.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let a;e[0]!==s?(a=Rre(s),e[0]=s,e[1]=a):a=e[1];const l=a,c=r==="sm"?"size-7":"size-9",d=r==="sm"?16:18;let h;e[2]!==c||e[3]!==i?(h=re("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=h):h=e[4];let u;e[5]!==l||e[6]!==d?(u=o.jsx(l,{size:d,className:"text-muted-foreground"}),e[5]=l,e[6]=d,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=o.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function x3e(t,e){return Aee(t,e).map(s=>{const n=e[s.blockKey]??{},i=KS(Ree(s.blockKey),e,t);return{blockKey:s.blockKey,title:Wa(s.blockKey,n),description:ed(i),iconName:g4(s.matcherResolveType)}})}const oj="Users03";function Dre(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function Mre(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,r]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const a of Object.keys(r)){if(a.toLowerCase().includes("always")||n.has(a))continue;n.add(a);const l=da(a,t);s.push({resolveType:a,title:l.title??gs(a),description:l.description,iconName:g4(a,l.icon)})}return s}function Ire(t,e){if(!t)return oj;const s=e.find(n=>n.resolveType===t);return s?s.iconName:g4(t)}function Ore(t){const e=F.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:a,onSelect:l,onSelectGlobal:c}=t,d=a===void 0?[]:a,[h,u]=T.useState(!1),f=ae(),m=(i?d.find(J=>J.blockKey===i):void 0)?.iconName??Ire(s,r),g=nl(m);let x;e[0]!==l||e[1]!==u?(x=J=>{l(J),u(!1)},e[0]=l,e[1]=u,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==u?(v=J=>{c?.(J),u(!1)},e[3]=c,e[4]=u,e[5]=v):v=e[5];const L=v;let _;e[6]!==u?(_=()=>u(!0),e[6]=u,e[7]=_):_=e[7];let y;e[8]!==g?(y=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=y):y=e[9];let w;e[10]!==n?(w=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(hs,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==_||e[14]!==y||e[15]!==w?(k=o.jsxs("button",{type:"button",onClick:_,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[y,w,S]}),e[13]=_,e[14]=y,e[15]=w,e[16]=k):k=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let C;e[19]!==f?(C=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=C):C=e[20];let V;e[21]!==f?(V=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=V):V=e[22];let N;e[23]!==V?(N=o.jsx(Mi,{placeholder:V}),e[23]=V,e[24]=N):N=e[24];let A;e[25]!==f?(A=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=A):A=e[26];let P;e[27]!==A?(P=o.jsx(ri,{children:A}),e[27]=A,e[28]=P):P=e[28];let R;e[29]!==f?(R=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=R):R=e[30];let E;e[31]!==f?(E=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=E):E=e[32];const I=`${R} ${E}`;let D;e[33]!==b?(D=()=>b(""),e[33]=b,e[34]=D):D=e[34];const O=!s&&!i&&"bg-accent/60";let B;e[35]!==O?(B=re("gap-2.5",O),e[35]=O,e[36]=B):B=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(em,{iconName:oj,size:"sm"}),e[37]=M):M=e[37];let z;e[38]!==f?(z=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=z):z=e[39];let $;e[40]!==z?($=o.jsx("span",{className:"text-sm",children:z}),e[40]=z,e[41]=$):$=e[41];let U;e[42]!==f?(U=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=U):U=e[43];let H;e[44]!==U?(H=o.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[44]=U,e[45]=H):H=e[45];let W;e[46]!==$||e[47]!==H?(W=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[$,H]}),e[46]=$,e[47]=H,e[48]=W):W=e[48];let K;e[49]!==I||e[50]!==D||e[51]!==B||e[52]!==W?(K=o.jsxs($s,{value:I,onSelect:D,className:B,children:[M,W]}),e[49]=I,e[50]=D,e[51]=B,e[52]=W,e[53]=K):K=e[53];let G;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let J;e[59]!==i||e[60]!==s||e[61]!==b?(J=Q=>o.jsxs($s,{value:`${Q.title} ${Q.resolveType} ${Q.description??""}`,onSelect:()=>b(Q.resolveType),className:re("gap-2.5",!i&&s===Q.resolveType&&"bg-accent/60"),children:[o.jsx(em,{iconName:Q.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm",children:Q.title}),Q.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Q.description})]})]},Q.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=J):J=e[62],G=r.map(J),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=G}else G=e[58];let Y;e[63]!==K||e[64]!==G?(Y=o.jsxs(fn,{children:[K,G]}),e[63]=K,e[64]=G,e[65]=Y):Y=e[65];let Z;e[66]!==i||e[67]!==d||e[68]!==L||e[69]!==f?(Z=d.length>0&&o.jsx(fn,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(J=>o.jsxs($s,{value:`${J.title} ${J.blockKey} ${J.description??""}`,onSelect:()=>L(J.blockKey),className:re("gap-2.5",i===J.blockKey&&"bg-accent/60"),children:[o.jsx(em,{iconName:J.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:J.title}),J.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.blockKey))}),e[66]=i,e[67]=d,e[68]=L,e[69]=f,e[70]=Z):Z=e[70];let te;e[71]!==P||e[72]!==Y||e[73]!==Z?(te=o.jsxs(Ii,{children:[P,Y,Z]}),e[71]=P,e[72]=Y,e[73]=Z,e[74]=te):te=e[74];let X;e[75]!==h||e[76]!==u||e[77]!==C||e[78]!==N||e[79]!==te||e[80]!==j?(X=o.jsxs(NE,{open:h,onOpenChange:u,title:j,description:C,className:"sm:max-w-lg",filter:Dre,children:[N,te]}),e[75]=h,e[76]=u,e[77]=C,e[78]=N,e[79]=te,e[80]=j,e[81]=X):X=e[81];let ee;return e[82]!==X||e[83]!==k?(ee=o.jsxs(o.Fragment,{children:[k,X]}),e[82]=X,e[83]=k,e[84]=ee):ee=e[84],ee}const $re="website/sections/Rendering/Lazy.tsx";function Pf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function x4(t){if(!Pf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Cs(e)}function Bre(t){return t!=null}function Rp(t){if(t==null)return t;if(x4(t)){const e=t.section;return e==null?null:Pf(e)?e:{}}return Pf(t)?t:void 0}function zre(t,e){return t===null?null:x4(e)?{...e,section:t}:t}function b3e(t){return{__resolveType:t}}function v3e(t,e){if(!Bre(e))return null;if(t){const s=Rp(e)??{};return{__resolveType:$re,section:s}}return x4(e)?Rp(e)??null:Pf(e)?e:null}const Fre="General";function td(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function aj(t,e){return t===ta?Fre:e}function lj(t){const e=_f(t),s=new Set,n=[];for(const i of e)td(i.resolveType)&&(ti(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:aj(i.resolveType,i.title),description:i.description})));return n}function b4(t){const e=yf(t),s=In(e,t),n=lj(s?.properties?.seo);return n.length>0?n:Ure(t)}function Ure(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const r of Object.keys(i)){if(!td(r))continue;const a=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:aj(r,a)})}return s}function cj(t){const e=b4(t),s=e.find(n=>n.resolveType===ta);return s?s.resolveType:e[0]?.resolveType??ta}function dj(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=In(s,t),i=lj(n?.properties?.seo);if(i.length>0)return i}return b4(t)}function Hre(t,e){const s=dj(t,e),n=s.find(i=>i.resolveType===ta);return n?n.resolveType:s[0]?.resolveType??cj(t)}function Kre(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:cj(t)}function Wre(t,e,s){const n=s.__resolveType;return typeof n=="string"&&td(n)?n:Hre(t,e)}const qre=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),ta="website/sections/Seo/SeoV2.tsx",Gre=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function gu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Yre(t){return typeof t.__resolveType=="string"&&td(t.__resolveType)?!0:Gre.some(e=>e in t)}function Qre(t,e){for(const[s,n]of Object.entries(t)){if(!gu(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&qre.has(r))continue;const a=i.seo;if(gu(a)){const l=a;if(Yre(l))return{blockKey:s,kind:"nested",seoData:l,blockData:i,seoResolveType:e?Wre(e,i,l):typeof l.__resolveType=="string"&&td(l.__resolveType)?l.__resolveType:ta}}}for(const[s,n]of Object.entries(t)){if(!gu(n))continue;const i=n;if(typeof i.__resolveType=="string"&&td(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Xre(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function y3e(t,e,s){if(e.kind==="site"){const c=Qre(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?dj(s,c.blockData):void 0,build:d=>Xre(c,d)}:null}const n=t[e.pageKey];if(!gu(n))return null;const i=n,r=i.seo,a=Rp(r),l=a&&gu(a)?a:void 0;return{blockKey:e.pageKey,seoData:l,rawSeoData:r,seoResolveType:s?Kre(s,l):typeof l?.__resolveType=="string"?l.__resolveType:ta,seoTypeOptions:s?b4(s):void 0,build:c=>({...i,seo:c===null?null:zre(c,r)})}}const v4=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],Jre=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Zre=["jsonLD","title","description","noIndexing","configJsonLD"];function uj(t){return t===ta||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function eoe(t){switch(t){case"general":return v4;case"pdp":return Jre;case"plp":return Zre;default:return null}}function hj(t,e){const s=eoe(uj(e));if(!s||!t.properties)return t;const n={};for(const i of s){const r=t.properties[i];r&&(n[i]=r)}return{...t,properties:n}}function toe(){return v4.filter(t=>t!=="type")}function soe(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function noe(t,e){return t[e]===void 0}function ioe(t){const e=F.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:a}=t,l=ae(),d=hj(s,ta).properties??{},h=toe();let u;e[0]!==r?(u=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=u):u=e[1];const f=u,[p,m]=T.useState(a);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=T.useState(g);p!==a&&(m(a),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:noe(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const L=v;let _;e[6]!==i||e[7]!==r||e[8]!==n?(_=(j,C)=>{b(N=>({...N,[j]:C}));const V={...n};if(C)delete V[j];else{const N=r?.[j];V[j]=N??(j==="type"?"website":"")}i(V)},e[6]=i,e[7]=r,e[8]=n,e[9]=_):_=e[9];const y=_,w="min-w-0 space-y-6",S=v4.map(j=>{const C=d[j];if(!C)return null;const V=f&&h.includes(j),N=V&&L(j),A=N?r?.[j]??n[j]:n[j],P=C.title??soe(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:re(N&&"pointer-events-none opacity-60"),children:Ya({schema:C,value:A,onChange:R=>{N||i({...n,[j]:R})},path:j,label:P,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:roe})}),V&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(lo,{id:`seo-use-default-${j}`,checked:N,onCheckedChange:R=>y(j,R)}),o.jsx(Mt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:l("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==a||e[11]!==S?(k=o.jsx("div",{className:w,children:S},a),e[10]=a,e[11]=S,e[12]=k):k=e[12],k}function roe(){}function ooe(t){const e=F.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:a,onBreadcrumbChange:l,siteDefaultSeo:c}=t;if(uj(n)==="general"){let g;e[0]!==a?(g=b=>a(b),e[0]=a,e[1]=g):g=e[1];let x;return e[2]!==r||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=o.jsx(ioe,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let h;e[8]!==n||e[9]!==s?(h=hj(s,n),e[8]=n,e[9]=s,e[10]=h):h=e[10];const u=h;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const p=l??aoe;let m;return e[12]!==u||e[13]!==r||e[14]!==a||e[15]!==p||e[16]!==i?(m=o.jsx(Bi,{schema:u,value:i,onChange:a,basePath:"",breadcrumbPath:f,onBreadcrumbChange:p},r),e[12]=u,e[13]=r,e[14]=a,e[15]=p,e[16]=i,e[17]=m):m=e[17],m}function aoe(){}function loe(t){const e=F.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:a,onSaveReferencedBlock:l,sandbox:c}=t,d=ae();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=T.useState(h);let p;e[1]!==u||e[2]!==d?(p=u.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(Qh,{className:"size-3.5"})}),u.map((x,b)=>{const v=b===u.length-1,L=kn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,b+1)),title:L,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",v?"font-medium text-foreground":"text-muted-foreground"),children:L})]},`${L}-${b}`)})]}),e[1]=u,e[2]=d,e[3]=p):p=e[3];let m;e[4]!==u||e[5]!==a||e[6]!==r||e[7]!==i||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==n?(m=o.jsx(Bi,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:u,onBreadcrumbChange:f,meta:r,decofile:a,onSaveReferencedBlock:l,sandbox:c}),e[4]=u,e[5]=a,e[6]=r,e[7]=i,e[8]=l,e[9]=c,e[10]=s,e[11]=n,e[12]=m):m=e[12];let g;return e[13]!==p||e[14]!==m?(g=o.jsxs("div",{className:"space-y-2",children:[p,m]}),e[13]=p,e[14]=m,e[15]=g):g=e[15],g}function _3e(t){const e=F.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:a,breadcrumbPath:l,emptyMessage:c,beforeForm:d,seoResolveType:h,siteDefaultSeo:u,meta:f,decofile:p,onSaveReferencedBlock:m,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==l?(v=l===void 0?[]:l,e[0]=l,e[1]=v):v=e[1];const L=v;let _;e[2]!==s||e[3]!==L||e[4]!==p||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==a||e[9]!==r||e[10]!==b||e[11]!==m||e[12]!==x||e[13]!==g||e[14]!==h||e[15]!==u?(_=s&&n?h?o.jsx(ooe,{schema:s,resolveType:h,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:a,siteDefaultSeo:u}):o.jsx(Bi,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:L,onBreadcrumbChange:a,meta:f,decofile:p,onSaveReferencedBlock:m,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=L,e[4]=p,e[5]=i,e[6]=n,e[7]=f,e[8]=a,e[9]=r,e[10]=b,e[11]=m,e[12]=x,e[13]=g,e[14]=h,e[15]=u,e[16]=_):_=e[16];const y=_;let w;e[17]!==c||e[18]!==y?(w=y??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=y,e[19]=w):w=e[19];let S;return e[20]!==d||e[21]!==w?(S=o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,w]})}),e[20]=d,e[21]=w,e[22]=S):S=e[22],S}const L3e="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function w3e(t,e){return ute(t,e,ed)}function S3e(t){const e=F.c(69),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,a=ae(),[l,c]=T.useState(n),[d,h]=T.useState(i),[u,f]=T.useState(s),[p,m]=T.useState(null),g=T.useRef(!1),[x,b]=T.useState(null);u!==s&&(f(s),c(n),h(i),m(null),b(null));let v;e[0]!==i||e[1]!==d?(v=()=>{if(g.current){g.current=!1;return}const ee=d.trim();if(ee===i.trim()){h(i),b(null);return}const J=U9(ee);if(J){b(J),h(i);return}b(null),m(ee)},e[0]=i,e[1]=d,e[2]=v):v=e[2];const L=v;let _;e[3]!==r||e[4]!==p?(_=()=>{p!==null&&(h(p),r("path",p),m(null))},e[3]=r,e[4]=p,e[5]=_):_=e[5];const y=_;let w;e[6]!==i?(w=()=>{h(i),m(null)},e[6]=i,e[7]=w):w=e[7];const S=w;let k;e[8]!==r?(k=ee=>{c(ee.target.value),r("name",ee.target.value)},e[8]=r,e[9]=k):k=e[9];let j;e[10]!==a?(j=a("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=a,e[11]=j):j=e[11];let C;e[12]!==l||e[13]!==k||e[14]!==j?(C=o.jsx("input",{type:"text",value:l,onChange:k,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:j}),e[12]=l,e[13]=k,e[14]=j,e[15]=C):C=e[15];let V;e[16]===Symbol.for("react.memo_cache_sentinel")?(V=ee=>{h(ee.target.value),b(null)},e[16]=V):V=e[16];let N;e[17]!==i?(N=ee=>{ee.key==="Enter"?(ee.preventDefault(),ee.currentTarget.blur()):ee.key==="Escape"&&(ee.preventDefault(),g.current=!0,h(i),b(null),ee.currentTarget.blur())},e[17]=i,e[18]=N):N=e[18];let A;e[19]!==a?(A=a("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[19]=a,e[20]=A):A=e[20];let P;e[21]!==L||e[22]!==d||e[23]!==N||e[24]!==A?(P=o.jsx("input",{type:"text",value:d,onChange:V,onBlur:L,onKeyDown:N,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:A}),e[21]=L,e[22]=d,e[23]=N,e[24]=A,e[25]=P):P=e[25];let R;e[26]!==x?(R=x&&o.jsx("p",{className:"text-xs text-destructive",children:x}),e[26]=x,e[27]=R):R=e[27];const E=p!==null;let I;e[28]!==S?(I=ee=>{ee||S()},e[28]=S,e[29]=I):I=e[29];let D;e[30]!==a?(D=a("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[30]=a,e[31]=D):D=e[31];let O;e[32]!==D?(O=o.jsx(Xr,{children:D}),e[32]=D,e[33]=O):O=e[33];const B=p??"";let M;e[34]!==i||e[35]!==a||e[36]!==B?(M=a("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:B}),e[34]=i,e[35]=a,e[36]=B,e[37]=M):M=e[37];let z;e[38]!==M?(z=o.jsx(Jr,{children:M}),e[38]=M,e[39]=z):z=e[39];let $;e[40]!==O||e[41]!==z?($=o.jsxs(Qr,{children:[O,z]}),e[40]=O,e[41]=z,e[42]=$):$=e[42];let U;e[43]!==a?(U=a("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[43]=a,e[44]=U):U=e[44];let H;e[45]!==U?(H=o.jsx(eo,{children:U}),e[45]=U,e[46]=H):H=e[46];let W;e[47]!==y?(W=ee=>{ee.preventDefault(),y()},e[47]=y,e[48]=W):W=e[48];let K;e[49]!==a?(K=a("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[49]=a,e[50]=K):K=e[50];let G;e[51]!==W||e[52]!==K?(G=o.jsx(to,{onClick:W,children:K}),e[51]=W,e[52]=K,e[53]=G):G=e[53];let Y;e[54]!==H||e[55]!==G?(Y=o.jsxs(Zr,{children:[H,G]}),e[54]=H,e[55]=G,e[56]=Y):Y=e[56];let Z;e[57]!==$||e[58]!==Y?(Z=o.jsxs(Yr,{children:[$,Y]}),e[57]=$,e[58]=Y,e[59]=Z):Z=e[59];let te;e[60]!==E||e[61]!==I||e[62]!==Z?(te=o.jsx(Gr,{open:E,onOpenChange:I,children:Z}),e[60]=E,e[61]=I,e[62]=Z,e[63]=te):te=e[63];let X;return e[64]!==P||e[65]!==R||e[66]!==te||e[67]!==C?(X=o.jsxs("div",{className:"space-y-1",children:[C,P,R,te]}),e[64]=P,e[65]=R,e[66]=te,e[67]=C,e[68]=X):X=e[68],X}function k3e(t){const e=F.c(13),{onClick:s}=t,n=ae();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(kg,{size:14}),e[2]=r):r=e[2];let a;e[3]!==s||e[4]!==i?(a=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[3]=s,e[4]=i,e[5]=a):a=e[5];let l;e[6]!==n?(l=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=l):l=e[7];let c;e[8]!==l?(c=o.jsx(Ke,{side:"bottom",children:l}),e[8]=l,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=o.jsxs(We,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d}const uv=new WeakMap;function coe(t,e){let s=uv.get(e);s||(s=new Map,uv.set(e,s));let n=s.get(t);return n===void 0&&(n=In(t,e),s.set(t,n)),n}function doe(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function uoe(t,e){return{__resolveType:e,variants:[{rule:Jc(),value:structuredClone(t)},{rule:Jc(),value:structuredClone(t)}]}}function hoe(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>J3(n.rule));return s?s.value:e[e.length-1]?.value}function foe(t){const e=[...t.variants],s=e[e.length-1],n={rule:Jc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function moe(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function poe(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function goe(t,e,s){return e<t?t-1:Math.min(t,s-1)}function xoe(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[i]=n.splice(e,1);return i?(n.splice(s,0,i),{...t,variants:n}):t}function boe(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function hv(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const fv=new WeakMap;function voe(t){let e=fv.get(t);return e||(e=Mre(t),fv.set(t,e)),e}function fj(t){const e=F.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=ae(),{value:a,onChange:l,meta:c,path:d}=i,[h,u]=T.useState(0);if(!doe(a)){let B;e[0]!==r?(B=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=B):B=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(kg,{size:14}),e[2]=M):M=e[2];let z;e[3]!==r?(z=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=r,e[4]=z):z=e[4];let $;return e[5]!==z?($=o.jsx(Ke,{children:z}),e[5]=z,e[6]=$):$=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":B,onClick:()=>{l(uoe(a,s)),u(0)},children:M})}),$]}),n(i)]})}const f=a,p=f.variants,m=Math.min(h,p.length-1);let g;e[7]!==r?(g=(B,M)=>({index:M,label:ed(B.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=r,e[8]=g):g=e[8];const x=p.map(g),b=p[m],v=b?.rule??{},L=v.__resolveType??"",_=b?.value,y=c?voe(c):[],w=L&&c?coe(L,c):null,{__resolveType:S,...k}=v,j=()=>{l(hoe(f)),u(0)},C=()=>{const B=foe(f);l(B),u(B.variants.length-1)},V=B=>{const M=moe(f,B);M&&(l(M),u(goe(m,B,M.variants.length)))},N=B=>{const M=poe(f,B);l(M),u(B+1)},A=(B,M)=>{const z=xoe(f,B,M);l(z),m===B&&u(M)},P=B=>{const M=B?Dee(B,c):{__resolveType:F3};l(hv(f,m,M))},R=B=>{const M=B,z=L?{...M,__resolveType:L}:{...M};l(hv(f,m,z))},E=B=>{l(boe(f,m,B))},I=`${d}-${f.__resolveType}`;let D;e[9]!==r?(D=r("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=r,e[10]=D):D=e[10];let O;return e[11]!==D?(O=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:D}),e[11]=D,e[12]=O):O=e[12],o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[o.jsx(Tre,{listKey:I,variants:x,selectedIndex:m,onSelect:u,onDuplicate:N,onDelete:V,onRemoveAll:j,onReorder:A,onAdd:C}),o.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[O,o.jsx(Ore,{currentRt:L,currentLabel:ed(v),matchers:y,onSelect:P}),w&&o.jsx("div",{className:"pt-1",children:o.jsx(loe,{schema:w,value:k,onChange:R,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${m}-${L}`)})]}),n({...i,value:_,onChange:E})]})]})}const yoe="website/loaders/secret.ts";function xu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function _oe(){return{__resolveType:yoe,name:"",encrypted:""}}function Loe(t){const{value:e,...s}=t;return s}function tm(t){const e=F.c(53),{schema:s,value:n,onChange:i,label:r,path:a,sandbox:l}=t,c=ae();if(typeof n=="string"||n==null&&!xu(n)){const C=typeof n=="string"?n:"",V=l?.virtualMcpId;let N;e[0]!==r||e[1]!==a||e[2]!==s.description||e[3]!==V?(N=o.jsx(Us,{htmlFor:a,label:r,description:s.description,virtualMcpId:V}),e[0]=r,e[1]=a,e[2]=s.description,e[3]=V,e[4]=N):N=e[4];let A;e[5]!==c?(A=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=A):A=e[6];let P;e[7]!==i?(P=I=>i(I.target.value),e[7]=i,e[8]=P):P=e[8];let R;e[9]!==a||e[10]!==C||e[11]!==A||e[12]!==P?(R=o.jsx(vt,{id:a,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:A,onChange:P,className:"h-10"}),e[9]=a,e[10]=C,e[11]=A,e[12]=P,e[13]=R):R=e[13];let E;return e[14]!==N||e[15]!==R?(E=o.jsxs("div",{className:"space-y-2",children:[N,R]}),e[14]=N,e[15]=R,e[16]=E):E=e[16],E}let d;e[17]!==n?(d=xu(n)?n:_oe(),e[17]=n,e[18]=d):d=e[18];const h=d,u=typeof h.name=="string"?h.name:"",f=typeof h.encrypted=="string"&&h.encrypted,p=`${a}-name`,m=l?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==p||e[22]!==m?(g=o.jsx(Us,{htmlFor:p,label:r,description:s.description,virtualMcpId:m}),e[19]=r,e[20]=s.description,e[21]=p,e[22]=m,e[23]=g):g=e[23];const x=`${a}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==h||e[27]!==i?(v=C=>i({...h,name:C.target.value}),e[26]=h,e[27]=i,e[28]=v):v=e[28];let L;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==v?(L=o.jsx(vt,{id:x,value:u,placeholder:b,onChange:v,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=v,e[33]=L):L=e[33];const _=`${a}-value`;let y;e[34]!==f||e[35]!==c?(y=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=y):y=e[36];let w;e[37]!==h||e[38]!==f||e[39]!==i?(w=C=>{const V=C.target.value;if(!V){i(f?Loe(h):h);return}i({...h,value:V})},e[37]=h,e[38]=f,e[39]=i,e[40]=w):w=e[40];let S;e[41]!==y||e[42]!==w||e[43]!==_?(S=o.jsx(vt,{id:_,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:y,onChange:w,className:"h-10"}),e[41]=y,e[42]=w,e[43]=_,e[44]=S):S=e[44];let k;e[45]!==f||e[46]!==c?(k=f&&o.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=k):k=e[47];let j;return e[48]!==S||e[49]!==k||e[50]!==g||e[51]!==L?(j=o.jsxs("div",{className:"space-y-2",children:[g,L,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=L,e[52]=j):j=e[52],j}function woe(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),i=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],r=[],a=d=>{d?.type==="object"&&d.properties&&r.push(d)};for(const d of s){const h=d.schema;if(h&&(h.type==="array"&&a(h.items),h.properties))for(const u of Object.values(h.properties))u?.type==="array"&&a(u.items)}if(r.length===0)return;if(i.length===0)return r.length===1?r[0]:void 0;let l,c=-1;for(const d of r){const h=d.properties??{},u=i.filter(f=>f in h).length*2+(d.titleBy?1:0);u>c&&(c=u,l=d)}return c>=2?l:void 0}function Soe(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,i]of Object.entries(e))n.startsWith("__")||(typeof i=="string"?s[n]={type:"string"}:typeof i=="number"?s[n]={type:"number"}:typeof i=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const koe=new Set(["__resolveType","@type"]);function joe(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function Coe(t){if(K9(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function mv(t){if(t.type==="array"&&t.items)return t;const e=t.items??Coe(t);return e?{...t,type:"array",items:e}:null}function Noe(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function mj(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const i=In(n,s);return i?o.jsx(Bi,{schema:i,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function Ya(t){const{schema:e,value:s}=t;if(jf(s)){const a=lte(s),l=mv(e);if(a!==null&&l)return o.jsx(ph,{...t,schema:l,value:a,onChange:c=>t.onChange(cte(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&K9(e)){const a=mv(e);if(a)return o.jsx(ph,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!jf(s)&&e.type==="block-ref"){const a=woe(e,s)??Soe(s);if(a){const l={...e,type:"array",items:a};return o.jsx(ph,{...t,schema:l,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(joe(e)){const a=e.anyOfRefs[0],l=a.schema?.properties?.variants?.items?.properties?.value,c=l&&l.type!=="block-ref"?l:e.plainSchema??l?.plainSchema??{type:"string"},d=h=>Ya({...h,schema:c});return o.jsx(fj,{...t,multivariateResolveType:a.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?o.jsx(iv,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(gre,{...t},t.path);if(e.format==="image-uri")return o.jsx(nre,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return o.jsx(ere,{...t},t.path);if(e.format==="map")return o.jsx(_re,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return o.jsx(Nie,{...t},t.path);if(e.format==="location")return o.jsx(nj,{...t},t.path);if(e.enum&&e.enum.length>0)return o.jsx(mne,{...t},t.path);if(e.type==="anyOf")return o.jsx(iv,{...t},t.path);if(xu(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(tm,{...t},t.path);if(!e.format&&!e.enum){const a=mj(t);if(a)return a}const n=s??Noe(e.type,e.default);if(n==null)return xu(s)?o.jsx(tm,{...t},t.path):null;if(xu(n))return o.jsx(tm,{...t,value:n},t.path);const i={...t,value:n},r=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(r==="array"||Array.isArray(n))return o.jsx(ph,{...i},t.path);switch(r){case"boolean":return o.jsx(cne,{...i},t.path);case"number":case"integer":return o.jsx(lne,{...i},t.path);case"string":{const a=e.format;return a==="color-input"||a==="color"?o.jsx(fh,{...i},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(fh,{...i},t.path):o.jsx(fh,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?o.jsx(die,{...i},t.path):null;default:return o.jsx(fh,{...i},t.path)}}function Voe(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Ya({...t,schema:e});const s=mj(t);return s||Ya(e?{...t,schema:e}:t)}function Bi({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}){const p=ae(),m=t.properties;if(!m)return t.type==="inline-union"?Ya({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}):null;if(ate(e)&&m.variants){const N=m.variants.items?.properties?.value;return o.jsx(fj,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:A=>Voe(A,N)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(m).filter(N=>!koe.has(N)&&m[N]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sectionsEditor.sectionsEditor.noEditableFields")});const v=(N,A)=>{if(A===void 0){const{[N]:P,...R}=g;s(R);return}s({...g,[N]:A})},L=typeof g.__resolveType=="string"?g.__resolveType:void 0,_=x.filter(N=>{const A=m[N];return A!=null&&Fc(A,g[N])}).length>1,y=Une(x,m,g),w=i.length>0?Kne(x,m,g,i,l,a):null,S=w?m[w]:null,k=w&&S?[w]:x,j=w&&S?Fne(w,S,i,Bu(w,x,m)):i,C=zne(i,j),V=C.length>0&&r?N=>r([...C,...N]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:k.map(N=>{const A=m[N];if(!A)return null;const P=n?`${n}.${N}`:N,R=Bu(N,x,m),E=Ga(N,A),O=(C.length===0&&x.some(B=>{const M=m[B];return B!==N&&M!=null&&Ga(B,M)===E})||C.length===0&&y.has(N))&&V?A.type==="block-ref"?B=>V($ne(N,B)):B=>V(One(R,B)):V;return Ya({schema:A,value:g[N],onChange:B=>v(N,B),path:P,label:R,required:b.has(N),breadcrumbPath:j,onBreadcrumbChange:O,hasSiblingDrillDownFields:_,focused:w===N,meta:a,decofile:l,onSaveReferencedBlock:c,containerResolveType:L,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f})})})}function Toe(t){const e=F.c(3),{isPending:s,isError:n}=t;if(n){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(vn,{size:13}),"Couldn't save"]}),e[0]=r):r=e[0],r}if(s){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(et,{className:"size-[13px]"}),"Saving…"]}),e[1]=r):r=e[1],r}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o.jsx(Gt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const pv=3e4;function Aoe(t,e,s,n){const i=new URL(`/deco/invoke/${e}`,t);return i.searchParams.set("__cb",n.toString(36)),i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",`run-${n.toString(36)}`),i.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),i.href}async function Poe(t,{resolveType:e,props:s}){let n;try{n=await fetch(wS(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(pv)})}catch(l){throw l instanceof DOMException&&l.name==="TimeoutError"?new Error(`Run timed out after ${pv/1e3}s — the block may be slow or the preview unresponsive.`):l}const i=await n.text();let r=null,a=!1;try{r=i?JSON.parse(i):null,a=!0}catch{}if(!n.ok){const l=a&&r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:i||`Run failed (${n.status})`;throw new Error(l)}return a?r:i}function Eoe(t){const e=F.c(2);let s;return e[0]!==t?(s={mutationFn:n=>Poe(t,n)},e[0]=t,e[1]=s):s=e[1],Ds(s)}function pj({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:a,target:l,initialValue:c,isCreating:d,onCreate:h,onSaveReferencedBlock:u,onBack:f,showRun:p=!0}){const m=Ts()?.taskId??null,g=ae(),x=ho(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=In(l.resolveType,i),L=!v&&fee(l.resolveType,i),_=L?mee(c):null,y=v??_,[w,S]=T.useState(c),[k,j]=T.useState([]),[C,V]=T.useState(0),[N,A]=T.useState(!1),[P,R]=T.useState(null),[E,I]=T.useState(!1),[D,O]=T.useState(!1),[B,M]=T.useState(!1),z=P!==null,{save:$,flush:U,isPending:H}=n4({orgSlug:t,virtualMcpId:e,branch:s}),W=Eoe({orgSlug:t,virtualMcpId:e,branch:s,threadId:m});T.useEffect(()=>()=>{U()},[]);const K=mk(a),G=l.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??l.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,threadId:m,previewUrl:n??void 0,siteSlug:b},Z=de=>{S(de),l.mode==="saved"&&$(l.blockKey,{__resolveType:l.resolveType,...de})},te=()=>{z?(R(null),A(!1),V(de=>de+1)):R(JSON.stringify(w,null,2))},X=de=>{const se=de??"";try{const ie=JSON.parse(se);if(ie&&typeof ie=="object"&&!Array.isArray(ie)){A(!1),Z(ie);return}A(!0)}catch{A(!0)}},ee=async de=>{const se=h4(de,r);if(se){ye.error(se);return}await h(de,{__resolveType:l.resolveType,...w}),I(!1)},J=()=>{O(!0),W.mutate({resolveType:l.resolveType,props:w})},Q=()=>{n&&window.open(Aoe(n,l.resolveType,w,Date.now()),"_blank","noopener")},oe=[l.title,...k],le=de=>{j(k.slice(0,de)),V(se=>se+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(c9,{size:14})}),o.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:oe.map((de,se)=>{const ie=se===oe.length-1,he=kn(de);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[se>0&&o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>le(se),title:he,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ie?"font-medium text-foreground":"text-muted-foreground"),children:he})]},`${he}-${se}`)})}),l.mode==="saved"&&o.jsx(Toe,{isPending:H,isError:!1}),p&&o.jsxs(me,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:J,disabled:W.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[W.isPending?o.jsx(et,{className:"size-3.5"}):o.jsx(Oa,{size:14}),g("sandbox.runnableBlockEditor.run")]}),l.mode==="available"&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:o.jsx(J2,{size:14})})}),o.jsx(Ke,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:z?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:te,"aria-label":g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":z,children:z?o.jsx(nn,{size:14}):o.jsx(rd,{size:14})})}),o.jsx(Ke,{side:"bottom",children:g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:l.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:K}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:G,singular:K})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:re("relative min-h-0 flex-1",D&&B&&"hidden"),children:[o.jsx(il,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[_&&y===_&&o.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:K})}),y?o.jsx(Bi,{schema:y,value:w,onChange:de=>Z(de),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:u,sandbox:Y},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:L?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),P!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[N&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(hd,{language:"json",height:"100%",code:P,onChange:X,onSave:de=>{X(de),U()}})})]})]}),D&&o.jsx(Roe,{singular:K,result:{isPending:W.isPending,error:W.error,data:W.data,hasRun:W.status!=="idle"},expanded:B,onToggleExpand:()=>M(de=>!de),onOpenInNewTab:n?Q:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(f4,{open:E,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:ee})]})}function Roe(t){const e=F.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:a,onClose:l}=t,c=ae();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const h=d,u=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==u?(f=re("flex min-h-0 flex-col border-t",u),e[2]=u,e[3]=f):f=e[3];let p;e[4]!==c?(p=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=p):p=e[5];let m;e[6]!==p?(m=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p}),e[6]=p,e[7]=m):m=e[7];let g;e[8]!==a||e[9]!==s||e[10]!==c?(g=a&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(hn,{size:14})})}),o.jsx(Ke,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=a,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==i||e[13]!==c?(x=c(i?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=i,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==i?(b=i?o.jsx(uA,{size:14}):o.jsx(s8,{size:14}),e[15]=i,e[16]=b):b=e[16];let v;e[17]!==i||e[18]!==r||e[19]!==x||e[20]!==b?(v=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:r,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=r,e[19]=x,e[20]=b,e[21]=v):v=e[21];let L;e[22]!==i||e[23]!==c?(L=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=L):L=e[24];let _;e[25]!==L?(_=o.jsx(Ke,{side:"bottom",children:L}),e[25]=L,e[26]=_):_=e[26];let y;e[27]!==_||e[28]!==v?(y=o.jsxs(We,{children:[v,_]}),e[27]=_,e[28]=v,e[29]=y):y=e[29];let w;e[30]!==c?(w=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=w):w=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(nn,{size:14}),e[32]=S):S=e[32];let k;e[33]!==l||e[34]!==w?(k=o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":w,children:S}),e[33]=l,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==y||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,y,k]}),e[36]=y,e[37]=k,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==m?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[m,j]}),e[40]=j,e[41]=m,e[42]=C):C=e[42];let V;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==h||e[47]!==s||e[48]!==c?(V=o.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?o.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[o.jsx(et,{className:"size-4"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?o.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[o.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),o.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?o.jsx(hd,{language:"json",height:"100%",code:h,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=h,e[47]=s,e[48]=c,e[49]=V):V=e[49];let N;return e[50]!==C||e[51]!==V||e[52]!==f?(N=o.jsxs("div",{className:f,children:[C,V]}),e[50]=C,e[51]=V,e[52]=f,e[53]=N):N=e[53],N}function Doe(t){const e=F.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,blockKey:c}=t,d=ae();let h;e[0]!==i||e[1]!==s||e[2]!==n?(h={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=h):h=e[3];const u=V0(h);let f;e[4]!==u?(f=r4((y,w)=>u.mutate({blockKey:y,data:w})),e[4]=u,e[5]=f):f=e[5];const p=f;let m;e[6]!==c||e[7]!==l?(m=vk(l,c),e[6]=c,e[7]=l,e[8]=m):m=e[8];const{resolveType:g,props:x,title:b}=m;if(!g){let y;e[9]!==d?(y=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=y):y=e[10];let w;return e[11]!==y?(w=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:y}),e[11]=y,e[12]=w):w=e[12],w}const v=`loader:${c}`;let L;e[13]!==c||e[14]!==g||e[15]!==b?(L={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=L):L=e[16];let _;return e[17]!==i||e[18]!==l||e[19]!==a||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==u.isPending||e[24]!==p||e[25]!==v||e[26]!==L||e[27]!==n?(_=o.jsx(pj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,kind:"loaders",target:L,initialValue:x,isCreating:u.isPending,onCreate:Moe,onSaveReferencedBlock:p,showRun:!1},v),e[17]=i,e[18]=l,e[19]=a,e[20]=s,e[21]=r,e[22]=x,e[23]=u.isPending,e[24]=p,e[25]=v,e[26]=L,e[27]=n,e[28]=_):_=e[28],_}async function Moe(){}function Ioe(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function gv(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:Ioe(t.error)}}function Ooe(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 $oe(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=Ooe(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const s=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return s&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(i=>i.status==="error"&&!i.hasData&&i.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:s?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 Boe="https://github.com/decocms/blocks";function zoe(){const t=F.c(14),e=ae();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(hA,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=r):r=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(hn,{size:14}),t[7]=a):a=t[7];let l;t[8]!==r?(l=o.jsx(me,{size:"sm",asChild:!0,children:o.jsxs("a",{href:Boe,target:"_blank",rel:"noreferrer",children:[r,a]})}),t[8]=r,t[9]=l):l=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==l?(c=o.jsx(Ti,{className:"h-full w-full",image:s,title:n,description:i,actions:l}),t[10]=n,t[11]=i,t[12]=l,t[13]=c):c=t[13],c}function Foe(t){const e=F.c(15),{source:s,onRetry:n}=t,i=ae();let r;e[0]!==s||e[1]!==i?(r=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=r):r=e[2];const a=r;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(vn,{size:48,className:"text-muted-foreground"}),e[3]=l):l=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let h;e[8]!==n||e[9]!==d?(h=o.jsx(me,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=h):h=e[10];let u;return e[11]!==a||e[12]!==c||e[13]!==h?(u=o.jsx(Ti,{image:l,title:c,description:a,actions:h}),e[11]=a,e[12]=c,e[13]=h,e[14]=u):u=e[14],u}const Uoe=T.lazy(()=>Ws(()=>import("./sections-editor-of2aPbXF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor})));function xv(t){const e=F.c(49),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:a}=Ue(),{currentBranch:l,taskId:c}=on(),d=ci(),h=la(),u=_k(),f=d.lifecycle.phase==="running",p=h.previewUrl;let m;e[0]!==l||e[1]!==a||e[2]!==p||e[3]!==c||e[4]!==s?(m=l?{orgSlug:a.slug,virtualMcpId:s,branch:l,threadId:c??null,previewUrl:p}:null,e[0]=l,e[1]=a,e[2]=p,e[3]=c,e[4]=s,e[5]=m):m=e[5];const g=m;let x;e[6]!==f?(x={fetchEnabled:f},e[6]=f,e[7]=x):x=e[7];const b=z9(g,x);let v;e[8]!==f?(v={fetchEnabled:f},e[8]=f,e[9]=v):v=e[9];const L=Q3(g,v),_=$oe({lifecyclePhase:d.lifecycle.phase,decofile:gv(b),meta:gv(L),hasEditableContent:FS(b.data,L.data),fastPreviewActive:_n(s).runtime==="cms"}),y=Hoe;if(_.kind==="loading"){let M;return e[10]===Symbol.for("react.memo_cache_sentinel")?(M=y(o.jsx(Aa,{})),e[10]=M):M=e[10],M}if(_.kind==="empty"){let M;return e[11]===Symbol.for("react.memo_cache_sentinel")?(M=y(o.jsx(zoe,{})),e[11]=M):M=e[11],M}if(_.kind==="error"){let M;e[12]!==b||e[13]!==h||e[14]!==L||e[15]!==_.source?(M=()=>{if(_.source==="sandbox"){h.retry();return}Promise.all([b.refetch(),L.refetch()])},e[12]=b,e[13]=h,e[14]=L,e[15]=_.source,e[16]=M):M=e[16];const z=M;let $;return e[17]!==z||e[18]!==_.source?($=y(o.jsx(Foe,{source:_.source,onRetry:z})),e[17]=z,e[18]=_.source,e[19]=$):$=e[19],$}let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=M=>y(o.jsx("div",{className:"h-full min-h-0",children:M})),e[20]=w):w=e[20];const S=w,k=u.state.target;if(k?.kind==="loader"&&b.data&&L.data){const M=l??"",z=p??null;let $;return e[21]!==b.data||e[22]!==L.data||e[23]!==a.slug||e[24]!==M||e[25]!==z||e[26]!==k.key||e[27]!==s?($=S(o.jsx(Doe,{orgSlug:a.slug,virtualMcpId:s,branch:M,previewUrl:z,meta:L.data,decofile:b.data,blockKey:k.key})),e[21]=b.data,e[22]=L.data,e[23]=a.slug,e[24]=M,e[25]=z,e[26]=k.key,e[27]=s,e[28]=$):$=e[28],$}let j;e[29]!==l||e[30]!==a.slug||e[31]!==k||e[32]!==s?(j=k||!l?null:e4(Z3(a.slug,s,l)),e[29]=l,e[30]=a.slug,e[31]=k,e[32]=s,e[33]=j):j=e[33];const C=j;let V="/",N=null,A=null;k?.kind==="page"?(V=k.path,N=k.key):k?.kind==="section"?A=k.key:C&&(V=C.path,N=C.pageKey);const P=N?`page:${N}`:A?`section:${A}`:`path:${V}`;let R;e[34]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})}),e[34]=R):R=e[34];const E=l??"",I=p??void 0,D=A?null:r,O=!!N&&u.state.editSeoPageKey===N;let B;return e[35]!==A||e[36]!==N||e[37]!==V||e[38]!==P||e[39]!==i||e[40]!==a.slug||e[41]!==D||e[42]!==O||e[43]!==E||e[44]!==I||e[45]!==s||e[46]!==u.consumeEditSeo||e[47]!==u.setVariantOverride?(B=S(o.jsx(T.Suspense,{fallback:R,children:o.jsx(Uoe,{orgSlug:a.slug,virtualMcpId:s,branch:E,previewReady:!0,previewUrl:I,currentPath:V,activePageBlockKey:N,activeGlobalBlockKey:A,externalSelection:D,initialEditSeo:O,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride,onViewJsonFile:i},P)})),e[35]=A,e[36]=N,e[37]=V,e[38]=P,e[39]=i,e[40]=a.slug,e[41]=D,e[42]=O,e[43]=E,e[44]=I,e[45]=s,e[46]=u.consumeEditSeo,e[47]=u.setVariantOverride,e[48]=B):B=e[48],B}function Hoe(t){return o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function bv(t){const e=F.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,a=ae(),{org:l}=Ue(),{currentBranch:c,taskId:d}=on(),u=la().previewUrl;let f;e[0]!==c||e[1]!==l.slug||e[2]!==u||e[3]!==d||e[4]!==s?(f=c?{orgSlug:l.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:u}:null,e[0]=c,e[1]=l.slug,e[2]=u,e[3]=d,e[4]=s,e[5]=f):f=e[5];const m=z9(f),g=c??"";let x;e[6]!==l.slug||e[7]!==g||e[8]!==s?(x={orgSlug:l.slug,virtualMcpId:s,branch:g},e[6]=l.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:v}=n4(x),L=m.data?.[n],_=m.data===void 0&&m.isLoading,y=m.data!==void 0&&L===void 0,w=!c||y||_;let S;e[10]!==L?(S=L===void 0?"":JSON.stringify(L,null,2),e[10]=L,e[11]=S):S=e[11];const k=S;let j;e[12]!==n||e[13]!==w||e[14]!==b?(j=B=>{if(w)return;let M;try{M=JSON.parse(B)}catch{return}M===null||typeof M!="object"||Array.isArray(M)||b(n,M)},e[12]=n,e[13]=w,e[14]=b,e[15]=j):j=e[15];const C=j;let V;e[16]!==v?(V=()=>({flush:v}),e[16]=v,e[17]=V):V=e[17],T.useImperativeHandle(r,V);let N;e[18]!==a?(N=a("sectionsEditor.pageJsonDialog.titleShort"),e[18]=a,e[19]=N):N=e[19];let A;e[20]!==N?(A=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N}),e[20]=N,e[21]=A):A=e[21];let P;e[22]!==a?(P=a("sectionsEditor.pageJsonDialog.close"),e[22]=a,e[23]=P):P=e[23];let R;e[24]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx(nn,{size:14}),e[24]=R):R=e[24];let E;e[25]!==i||e[26]!==P?(E=o.jsx(me,{variant:"ghost",size:"icon",onClick:i,"aria-label":P,className:"size-7 shrink-0",children:R}),e[25]=i,e[26]=P,e[27]=E):E=e[27];let I;e[28]!==E||e[29]!==A?(I=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[A,E]}),e[28]=E,e[29]=A,e[30]=I):I=e[30];let D;e[31]!==m.data||e[32]!==v||e[33]!==k||e[34]!==_||e[35]!==y||e[36]!==n||e[37]!==w||e[38]!==C||e[39]!==a?(D=_?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})}):y?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",a("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(hd,{code:k,language:"json",readOnly:w,height:"100%",onChange:B=>C(B??""),onSave:B=>{C(B),v()}},`${n}:${m.data===void 0?"loading":"ready"}`)}),e[31]=m.data,e[32]=v,e[33]=k,e[34]=_,e[35]=y,e[36]=n,e[37]=w,e[38]=C,e[39]=a,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D?(O=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[I,D]}),e[41]=I,e[42]=D,e[43]=O):O=e[43],O}function gj(t){return t.contentEditingEnabled&&!t.isMobile}function Koe(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function Woe(t){return gj({contentEditingEnabled:q8(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function qoe(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}const Goe=500,Yoe={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},vv=1,sm=["desktop","mobile","tablet"],yv={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function _v(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Qoe(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 xh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function nm(t,e){try{return new URL(t,e).href}catch{return null}}function Xoe(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),r=i.split("/").filter(Boolean),a=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let h=40;return d===0?h+=30:/[\s/-]/.test(c[d-1]??"")&&(h+=20),h+=Math.round(s.length/c.length*20),h};let l=Math.max(a(n),a(i));return r.at(-1)===s?l=Math.max(l,95):r.includes(s)&&(l=Math.max(l,90)),l}function Joe(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Zoe({virtualMcpId:t}){const e=ae(),s=ld(),n=Za(),i=YZ(),{currentBranch:r,taskId:a}=on(),l=_k(),c=ho(),d=_n(t),h=p0(c?.entity?.id===t?c.entity.metadata?.ui?.layout??null:null),u=q8(h),f=gj({contentEditingEnabled:u,isMobile:n}),[p,m]=T.useState(()=>Woe({cmsMode:h,isMobile:n})),[g,x]=T.useState("desktop"),[b,v]=T.useState(null),[L,_]=T.useState(null),y=T.useRef(null),w=T.useRef(null),[S,k]=T.useState(!1),j=T.useRef(null),C=()=>{j.current?.flush(),k(!1)},V=()=>k(ve=>(ve&&j.current?.flush(),!ve)),[N,A]=T.useState({width:0,height:0}),[P,R]=T.useState(null),[E,I]=T.useState(!1),[D,O]=T.useState(""),B=T.useRef(null),[M,z]=T.useState(!1),[$,U]=T.useState(),[H,W]=T.useState(null),[K,G]=T.useState(null),[Y,Z]=T.useState(null),[te,X]=T.useState("/"),[ee,J]=T.useState(null),[Q,oe]=T.useState({}),[le,de]=T.useState(!1),se=T.useRef(null),ie=()=>{de(!0),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>de(!1),15e3)},he=()=>{se.current&&(clearTimeout(se.current),se.current=null),de(!1)},{org:ue}=Ue(),ce=ci(),ne=la(),q=ne.vmEntry,fe=ne.previewUrl,ge=ce.lifecycle.phase,_e=ge==="running",Le=c?.entity?.id===t?q2(c.entity.metadata):null,je=c?.entity?.id===t&&d.runtime==="cms",Ce=d.projectDefault==="cms",Pe=Kee({sandboxUrl:fe,previewServerUrl:Le,fastPreviewActive:je}),pe=t&&r?{orgSlug:ue.slug,virtualMcpId:t,branch:r,threadId:a??null,previewUrl:fe}:null,ke=z9(pe,{fetchEnabled:_e}),Te=Q3(pe,{fetchEnabled:_e}),we=ke.data,Ne=Te.data,Oe=we?wf(we).sort((ve,Ee)=>ve.name.localeCompare(Ee.name)):[],nt=t&&r?{orgSlug:ue.slug,virtualMcpId:t,branch:r}:null,Fe=yse(nt),yt=we&&Ne?Y3(we,Ne):[],it=we&&Ne?bk(Ne,we,"loaders"):[],st=D?(()=>{const ve=D.toLowerCase();return Oe.map(Ee=>({page:Ee,score:Xoe(Ee.name,Ee.path,ve)})).filter(({score:Ee})=>Ee>0).sort((Ee,gt)=>gt.score-Ee.score||Ee.page.path.length-gt.page.path.length).map(({page:Ee})=>Ee)})():Oe,ft=yt.filter(ve=>{if(!D)return!0;const Ee=D.toLowerCase();return ve.name.toLowerCase().includes(Ee)||ve.key.toLowerCase().includes(Ee)||ve.resolveType.toLowerCase().includes(Ee)}),_t=f?it:[],mt=_t.filter(ve=>{if(!D)return!0;const Ee=D.toLowerCase();return ve.title.toLowerCase().includes(Ee)||ve.key.toLowerCase().includes(Ee)||ve.resolveType.toLowerCase().includes(Ee)}),Ze=K?it.find(ve=>ve.key===K)??null:null,rt=Ko,xt=H||K?null:jp(Oe,te,ee),be=H?H.name:Ze?.title??xt?.name,Re=xt?.key??null,Me=xt?.path??null,dt=(Re?Q[Re]:void 0)??{},ut=Dr(te,dt),ht={};if(_e&&fe&&Ne&&we){const ve=kse(Ne,"loaders"),Ee=Re?we[Re]:void 0,gt=Ute(Ee,we,os=>ve.has(os)),St=Ote(gt);for(const os of vf(te)){if(os.type!=="param")continue;const mn=Dte(te,os.name,gt),Gs=zte(mn,ve,St);Gs.length>0&&(ht[os.name]=Gs)}}const ct=t&&r?{orgSlug:ue.slug,virtualMcpId:t,branch:r,threadId:a??null}:null,lt=we&&Re?tk(we,Re,0):[],Ge=we?QS(lt,we):[],wt=Ge.map(ve=>ve.isSavedBlock?ve.label:""),Pt=Ge.map(ve=>ve.isSavedBlock?"global":ve.isMultivariate?"variant":"normal"),Zt=lt.map(ve=>Np(ve,we??{})),Dt=T.useRef(null),$e=T.useRef(null),Lt=ce.status.state==="paused",Se=ce.phase,Ye=rk({claimPhase:Se,lifecycle:ce.lifecycle}),ot=ne.previewState,es=ne.userStopped,xe=X3(ue.slug,t??"",r??""),{url:De}=YS(je&&t&&r?{orgSlug:ue.slug,virtualMcpId:t,branch:r,previewServerUrl:Le??null,path:ut}:null),Je=Ce&&d.runtime==="sandbox",Ie=zZ({previewState:ot,progressStatus:Ye.status,previewServerUrl:Le,fastPreviewActive:je,fastPreviewReady:!!De,codingSession:Je}),pt=Ie.mode!=="none",Et=Ie.mode==="production"&&Ie.iframeBase?xh(Ie.iframeBase):null,at=!s,rs=Ie.mode==="production"?Et:xh(fe),_r=c?.entity?.id===t&&c.entity.metadata?.fastPreviewInPlace===!0,It=Ie.mode==="production"&&je&&_r&&f&&p==="blocks",zi=T.useRef(null);let Fi=zi.current;It?Fi===null&&De!==null&&(Fi=zi.current=De):zi.current=De;const fo=It?Fi:De,qs=Qoe(Ie.mode==="sandbox"?ah(_v(Y??nm(ut,Ie.iframeBase)??Ie.iframeBase,g),l.state.variantOverride??[]):Ie.mode==="production"&&at?ah(_v(GS(Y??fo??nm(ut,Ie.iframeBase)??Ie.iframeBase,Ie.showWakingPill?Uee:null),g),l.state.variantOverride??[]):null);T.useEffect(()=>{},[s,Et,P]);const Lr="sandbox.preview.openInNewTab",di=De??(Ie.iframeBase?nm(ut,Ie.iframeBase):null),mo=Ie.mode==="production"?di?ah(di,l.state.variantOverride??[]):null:qs??Ie.iframeBase,po=async()=>{const ve=mo;if(ve){window.open(ve,"_blank","noopener");return}},ui=t&&r?Z3(ue.slug,t,r):null,hi=ve=>{ui&&Pte(ui,ve)},fs=l.state.target;T.useEffect(()=>{if(!(!fs||!Pe||!Ne))if(fs.kind==="page"){const ve=Q[fs.key]??{};$e.current=Dr(fs.path,ve),W(null),G(null),Z(null),J(fs.key),X(fs.path),hi({path:fs.path,pageKey:fs.key,params:ve})}else if(fs.kind==="loader")$e.current=null,W(null),G(fs.key),Z(null);else{const ve=yt.find(Ee=>Ee.key===fs.key);if(ve){$e.current=null;const Ee=yf(Ne);G(null),W(ve),Z(Mb(Pe,Ee,ve.key))}}},[fs,Pe,Ne,Q]),T.useEffect(()=>{!Re||Me===null||fs?.kind==="page"&&fs.key===Re&&fs.path===Me||l.selectTarget({kind:"page",key:Re,path:Me})},[Re,Me,fs]);const[fi,go]=T.useState(null);if(ot.kind==="iframe"&&fi!==ot.previewUrl){const ve=fi!==null;go(ot.previewUrl);const Ee=ui?e4(ui):null;if(Ee){if($e.current=Dr(Ee.path,Ee.params),X(Ee.path),J(Ee.pageKey),Z(null),W(null),G(null),Ee.pageKey&&Object.keys(Ee.params).length>0){const gt=Ee.pageKey;oe(St=>({...St,[gt]:Ee.params}))}}else ve&&($e.current=null,X("/"),Z(null),J(null),W(null),G(null))}Dt.current=qs;const mi=KZ({iframeRef:y,src:Ie.mode==="sandbox"?qs:null,active:Ie.mode==="sandbox"}),wr=T.useRef(null);T.useEffect(()=>{if(!De||!qs||wr.current===De)return;wr.current=De;const ve=y.current;ve&&ve.getAttribute("src")!==qs&&(ie(),ve.src=qs)},[De,qs]);const Sr=()=>{const ve=y.current?.contentWindow,Ee=rs;if(!ve||!Ee||!we||!Re)return;const gt=we[Re];if(!gt||typeof gt!="object")return;const St=Hee({previewBaseUrl:Ee,pageBlock:gt,decofile:we,path:ut,pathTemplate:te});if(!St)return;const os=ah(St.src,l.state.variantOverride??[]);ve.postMessage({type:"cms-editor::render",src:os,body:St.body},Ee)},pi=T.useRef(null);T.useEffect(()=>{if(!It||H||K||!Re||!we){pi.current=null;return}const ve=JSON.stringify({page:Re,path:ut,pathTemplate:te,decofile:we});if(pi.current===ve)return;const Ee=pi.current===null;pi.current=ve,!Ee&&Sr()},[we,It,H,K,Re,ut,te]);const ua=T.useRef(null);T.useEffect(()=>{if(!It||H||K||!Re||!we){ua.current=null;return}const ve=JSON.stringify(l.state.variantOverride??null),Ee=ua.current;ua.current={page:Re,sig:ve},!(!Ee||Ee.page!==Re||Ee.sig===ve)&&Sr()},[l.state.variantOverride,It,H,K,Re]);const xo=!!t&&!!r&&!ce.notFound&&!es&&!Lt&&(Se?.kind==="ready"||ge!=="idle"),Es=qoe({editingMode:p,sandboxDisplay:Ie.mode==="sandbox",blocksEditingEnabled:f});T.useEffect(()=>{const ve=rs;if(!ve)return;const Ee=gt=>{if(gt.origin===ve)if(gt.data?.type==="visual-editor::element-clicked"){const St=Qee.safeParse(gt.data.payload);St.success&&v(St.data)}else if(gt.data?.type==="cms-editor::section-clicked"){const St=Zee.safeParse(gt.data.payload);St.success&&_({index:St.data.sectionIndex,seq:St.data.clickSeq})}else gt.data?.type==="cms-editor::render-start"?ie():gt.data?.type==="cms-editor::render-end"?(he(),y.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:wt,kinds:Pt,keys:Zt},ve)):gt.data?.type==="cms-editor::render-error"&&he()};return window.addEventListener("message",Ee),()=>window.removeEventListener("message",Ee)},[rs,wt,Pt,Zt]);const ha=()=>{const ve=y.current?.contentWindow,Ee=xh(fe);!ve||!Ee||ve.postMessage({type:"visual-editor::activate",script:Xee},Ee)},bo=()=>{const ve=y.current?.contentWindow,Ee=xh(fe);!ve||!Ee||ve.postMessage({type:"visual-editor::deactivate"},Ee)},Ui=()=>{const ve=y.current?.contentWindow,Ee=rs;!ve||!Ee||(ve.postMessage(Ie.mode==="production"?{type:"editor::inject",args:{script:Ob}}:{type:"visual-editor::activate",script:Ob},Ee),ve.postMessage({type:"cms-editor::set-labels",labels:wt,kinds:Pt,keys:Zt},Ee))},wd=()=>{const ve=y.current?.contentWindow,Ee=rs;!ve||!Ee||ve.postMessage({type:"cms-editor::deactivate"},Ee)},Hi=ve=>{if(ve==="blocks"&&!f)return;const Ee=p;!n&&ve!==Ee&&(ve==="blocks"?w.current?.resize("30%"):w.current?.collapse()),ve!=="blocks"&&C(),m(ve),v(null),_(null),ve!=="blocks"&&G(null),Ee==="visual"&&bo(),ve==="visual"&&ha(),Ee==="blocks"&&ve!=="blocks"&&wd(),ve==="blocks"&&Ui()},vo=()=>{Hi(Koe(p,f))},yo=()=>{if(!y.current||!qs)return;ie();const ve=y.current;ve.src=qs};uz(()=>{const ve=y.current;if(!ve)return;ie();const Ee=document.activeElement,gt=ve.tabIndex;ve.tabIndex=-1,ve.style.pointerEvents="none",ve.blur(),Joe(ve,Dt.current);let St;const os=()=>{clearTimeout(St),ve.tabIndex=gt,ve.style.pointerEvents="";const mn=document.activeElement;(!mn||mn===document.body||mn===ve)&&Ee?.focus(),ve.removeEventListener("load",os)};ve.addEventListener("load",os),St=setTimeout(os,3e3)});const _o=()=>{const ve=sm.indexOf(g);x(sm[(ve+1)%sm.length])},Ki=(ve,Ee)=>{if(!Re)return;const gt=Re,St={...dt,[ve]:Ee};$e.current=Dr(te,St),oe(os=>({...os,[gt]:St})),hi({path:te,pageKey:gt,params:St})},kr=xse({iframeBase:Ie.iframeBase,resolvedPath:ut,activeGlobalSectionName:H?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Wi=ve=>{const Ee=Q[ve.key]??{},gt=Dr(ve.path,Ee);(H||rt(gt)!==rt(ut))&&ie(),$e.current=gt,W(null),G(null),Z(null),_(null),J(ve.key),X(ve.path),hi({path:ve.path,pageKey:ve.key,params:Ee}),l.selectTarget({kind:"page",key:ve.key,path:ve.path})},Lo=ve=>{if(!Pe||!Ne){ye.error(e("sandbox.preview.previewMetadataNotReady"));return}ie(),$e.current=null;const Ee=yf(Ne),gt=Mb(Pe,Ee,ve.key);W(ve),G(null),Z(gt),_(null),l.selectTarget({kind:"section",key:ve.key})},i1=ve=>{f&&(W(null),G(ve.key),Z(null),Hi("blocks"),l.selectTarget({kind:"loader",key:ve.key}))},wo=async({name:ve,path:Ee,templateKey:gt})=>{if(!t||!r)return;const St=U9(Ee);if(St){U(St);return}const os=Ee.trim().startsWith("/")?Ee.trim():`/${Ee.trim()}`;if(Oe.some(Gs=>rt(Gs.path)===rt(os))){U(e("sandbox.preview.pageAlreadyExists",{path:os}));return}let mn;if(gt&&(mn=we?.[gt],!mn)){U(e("sandbox.preview.templateNoLongerExists"));return}U(void 0);try{const Gs=await Fe.mutateAsync({name:ve,path:os,template:mn});z(!1),ye.success(e("sandbox.preview.pageCreated",{name:ve})),await dd(Goe),Wi({key:Gs.key,name:Gs.name,path:Gs.path}),Hi("blocks")}catch(Gs){U(Gs instanceof Error?Gs.message:e("sandbox.preview.failedToCreatePage"))}},jr=pt&&(xo||Ie.mode==="production"),So=bse({showPreviewToolbar:jr,contentEditingEnabled:u}),gi=jr?o.jsxs(o.Fragment,{children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx($o,{onClick:yo,"aria-label":e("sandbox.preview.refresh"),children:o.jsx(Dn,{size:16})})}),o.jsx(Ke,{side:"bottom",children:e("sandbox.preview.refresh")})]}),So?o.jsxs("div",{ref:B,className:"relative min-w-0 w-64 shrink",children:[o.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[o.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>I(ve=>!ve),children:[H&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[o.jsx(Wr,{size:11}),"Global"]}),Ze&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(Ia,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:re("text-[13px] font-medium text-foreground",be==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:be??kr}),!H&&!K&&be!=null&&te&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:vf(te).map((ve,Ee)=>{if(ve.type==="text")return o.jsx("span",{className:re(Ee===0?"min-w-0 truncate":"shrink-0"),children:ve.text},`text-${Ee}`);const gt=ht[ve.name];return gt&&ct?o.jsx(ise,{sources:gt,template:te,paramName:ve.name,value:dt[ve.name]??"",sandboxRef:ct,onCommit:St=>Ki(ve.name,St)},`${Re}:${ve.name}`):o.jsx(pse,{name:ve.name,value:dt[ve.name]??"",onCommit:St=>Ki(ve.name,St)},`${Re}:${ve.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>I(ve=>!ve),"aria-label":e("sandbox.preview.choosePage"),"aria-expanded":E,children:o.jsx(hs,{size:12,className:re("shrink-0 text-muted-foreground transition-transform",E&&"rotate-180")})})]}),E&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(u0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:D,onChange:ve=>O(ve.target.value),onKeyDown:ve=>{if(ve.key!=="Enter")return;const Ee=D.trim();if(!Ee)return;const gt=st.find(St=>rt(St.path)===rt(Ee));gt&&(ve.preventDefault(),I(!1),O(""),Wi(gt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),o.jsx("div",{className:"p-1.5 border-b",children:o.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ve=>{ve.preventDefault(),I(!1),O(""),U(void 0),z(!0)},children:[o.jsx(Qt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),st.length===0&&ft.length===0&&mt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Oe.length===0&&yt.length===0&&_t.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[st.length>0&&o.jsx("div",{className:"p-1.5",children:st.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Ee=>{Ee.preventDefault(),I(!1),O(""),Wi(ve)},children:[o.jsx(zr,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.path})]},ve.key))}),ft.length>0&&o.jsxs("div",{className:re("p-1.5",st.length>0&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),ft.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Ee=>{Ee.preventDefault(),I(!1),O(""),Lo(ve)},children:[o.jsx(Wr,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]}),mt.length>0&&o.jsxs("div",{className:re("p-1.5",(st.length>0||ft.length>0)&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),mt.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Ee=>{Ee.preventDefault(),I(!1),O(""),i1(ve)},children:[o.jsx(Ia,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]})]})]})]}):o.jsx("span",{className:"min-w-0 truncate px-2 text-[13px] text-muted-foreground",children:kr}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx($o,{"aria-label":e(Lr),onClick:()=>{po()},children:o.jsx(hn,{size:16})})}),o.jsx(Ke,{side:"bottom",children:e(Lr)})]})]}):null,Cr=gi?o.jsx("div",{className:"flex min-w-0 items-center gap-0.5",children:gi}):null,ko=Ie.mode==="sandbox",xi=Yoe[g],bi=g==="desktop"&&(N.width===0||N.width>=xi.width+2*vv),Nr=bi?1:Math.min(N.width>0?N.width/(xi.width+2*vv):1,1),jo=bi?{width:"100%",height:"100%"}:{width:`${xi.width}px`,height:N.height>0?`${N.height/Nr}px`:`${xi.height}px`,transform:`scale(${Nr})`,transformOrigin:"top center"},Sd=pt?o.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:o.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[ko&&o.jsxs(o.Fragment,{children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx($o,{onClick:vo,"aria-pressed":Es==="visual","aria-label":e("sandbox.preview.visualEditor"),active:Es==="visual",className:"rounded-full",children:o.jsx(ex,{size:16})})}),o.jsx(Ke,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx($o,{onClick:_o,"aria-label":e(yv[g]),className:"rounded-full",children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[g==="mobile"&&o.jsx(fA,{size:16}),g==="tablet"&&o.jsx(mA,{size:16}),g==="desktop"&&o.jsx(pA,{size:16})]},g)})}),o.jsx(Ke,{side:"top",children:e(yv[g])})]})]})}):null,Co=!!K&&Es==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[ct&&Object.entries(ht).map(([ve,Ee])=>(dt[ve]??"")===""?o.jsx(fse,{sources:Ee,template:te,paramName:ve,sandboxRef:ct,onFill:gt=>Ki(ve,gt)},`${Re}:${ve}`):null),i?Cr&&o.jsx(GZ,{children:Cr}):gi&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex-1"}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:gi}),o.jsx("div",{className:"flex-1"})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:Co?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(xv,{virtualMcpId:t,externalSelection:L,onViewJsonFile:V}),S&&Re&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(bv,{ref:j,virtualMcpId:t,pageKey:Re,onClose:C})})]}):o.jsxs(np,{orientation:"horizontal",disabled:Es!=="blocks",children:[o.jsx(Ac,{ref:w,id:"preview-blocks-editor",defaultSize:Es==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Es==="blocks"&&o.jsx(xv,{virtualMcpId:t,externalSelection:L,onViewJsonFile:V})}),Es==="blocks"&&o.jsx(ip,{withHandle:!0}),o.jsx(Ac,{id:"preview-canvas",defaultSize:Es==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(np,{orientation:"horizontal",disabled:!(S&&Re),children:[S&&Re&&o.jsxs(o.Fragment,{children:[o.jsx(Ac,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(bv,{ref:j,virtualMcpId:t,pageKey:Re,onClose:C})}),o.jsx(ip,{withHandle:!0})]}),o.jsx(Ac,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:ve=>{if(!ve)return;const Ee=()=>A(St=>St.width===ve.clientWidth&&St.height===ve.clientHeight?St:{width:ve.clientWidth,height:ve.clientHeight});Ee();const gt=new ResizeObserver(Ee);return gt.observe(ve),()=>gt.disconnect()},className:re("h-full relative overflow-clip flex justify-center",pt&&!bi&&"bg-muted/30"),children:[(le||xe)&&pt&&o.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),Ie.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"starting",progress:Ye,claimPhase:Se})}),ot.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"suspended",onResume:ne.resume})}),ot.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"errored",error:ot.error,onRetry:ne.retry,connectionsHref:`/${ue.slug}/settings/connections`})}),Ie.showWakingPill&&o.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 border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[o.jsx(et,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Es==="visual"&&!b&&o.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-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[o.jsx(ex,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Es==="visual"&&b&&o.jsx(gte,{element:b,onDismiss:()=>v(null)}),Sd,pt&&qs&&o.jsx("div",{className:re("shrink-0",!bi&&"border-x border-border bg-background shadow-sm"),style:jo,children:o.jsx("iframe",{ref:y,src:qs,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:mi.handleError,onLoad:()=>{if(mi.handleLoad(),he(),Ie.mode!=="sandbox"){Ie.mode==="production"&&!Ie.showWakingPill&&Es==="blocks"&&Ui();return}if(qe("vm_preview_loaded",{view_mode:Es,vm_id:q?.sandboxHandle??null}),!H)try{const ve=y.current?.contentWindow?.location?.pathname;if(!ve)return;const Ee=$e.current;if(Ee!==null&&($e.current=null,rt(ve)!==rt(Ee))||rt(ve)===rt(ut))return;X(ve),hi({path:ve,pageKey:ee,params:dt})}catch{}Es==="visual"&&ha(),Es==="blocks"&&Ui()}},Ie.iframeBase)})]})})]})})]})}),o.jsx(Lse,{open:M,onOpenChange:z,isPending:Fe.isPending,error:$,templates:Oe,onSubmit:wo})]})}function eae(t){const e=F.c(22),{virtualMcpId:s}=t,n=ae(),i=As(s),{activeTask:r,taskId:a,currentBranch:l}=on(),c=oL(a),[d,h]=T.useState(!1);if(aL({threadId:a,sandboxBranch:r?.branch??l,agentHasRepo:xn(i?.metadata),threadHasRepo:xn(c)||xn(r?.metadata)})==="none"){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(ur,{className:"size-7 text-foreground"})}),e[0]=p):p=e[0];let m;e[1]!==n?(m=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=m):m=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>h(!0),b=o.jsx(ur,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let L;e[9]!==v?(L=o.jsxs(me,{onClick:x,children:[b,v]}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==m||e[12]!==g||e[13]!==L?(_=o.jsx(Ti,{className:"h-full",image:p,title:m,description:g,actions:L}),e[11]=m,e[12]=g,e[13]=L,e[14]=_):_=e[14];let y;e[15]!==d?(y=o.jsx(d0,{open:d,onOpenChange:h,mode:"agent"}),e[15]=d,e[16]=y):y=e[16];let w;return e[17]!==_||e[18]!==y?(w=o.jsxs(o.Fragment,{children:[_,y]}),e[17]=_,e[18]=y,e[19]=w):w=e[19],w}let f;return e[20]!==s?(f=o.jsx(Zoe,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}function tae(t){const e=F.c(14),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,enabled:a}=t,l=a===void 0?!0:a;let c;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c=tt.sandboxRepoDir(s,n,i,r),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==r||e[8]!==n?(d=async()=>{const f=no({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},"config"),p=await fetch(f);return p.ok?(await p.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=r,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==l||e[11]!==c||e[12]!==d?(h={queryKey:c,queryFn:d,enabled:l,staleTime:1/0},e[10]=l,e[11]=c,e[12]=d,e[13]=h):h=e[13],Yt(h).data??null}const sae=T.lazy(()=>Ws(()=>import("./file-explorer-CDJlhfne.js"),__vite__mapDeps([168,1,2,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,98,101,92,102,103,104,105,106,107,108,109,110,111,74,149,147,96,142,115,81,82,83,84,85,86,87,88,89,90,91,93,94,95,97,99,100,112,113,114,78,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,143,144,145,146,148,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.FileExplorer})));function nae(t){const e=F.c(26),{openPath:s}=t,n=ae(),i=ho(),{org:r}=Ue(),{currentBranch:a,taskId:l}=on(),c=i?.entity?.id??null,d=ld(),h=la(),u=ci();h.vmEntry,u.lifecycle.phase;const f=d,p=c??"",m=a??"",g=l??null,x=f;let b;e[0]!==r.slug||e[1]!==p||e[2]!==m||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:p,branch:m,threadId:g,enabled:x},e[0]=r.slug,e[1]=p,e[2]=m,e[3]=g,e[4]=x,e[5]=b):b=e[5],tae(b);const v=null;if(!c||!a){let k;e[6]!==n?(k=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=k):k=e[7];let j;e[8]!==n?(j=n("mainPanelTabs.codeTab.noSandboxToBrowseDescription"),e[8]=n,e[9]=j):j=e[9];let C;return e[10]!==k||e[11]!==j?(C=o.jsx(Ti,{className:"h-full",title:k,description:j}),e[10]=k,e[11]=j,e[12]=C):C=e[12],C}let L;e[13]!==v||e[14]!==n?(L=v,e[13]=v,e[14]=n,e[15]=L):L=e[15];let _;e[16]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})}),e[16]=_):_=e[16];const y=l??null;let w;e[17]!==a||e[18]!==s||e[19]!==r.slug||e[20]!==y||e[21]!==c?(w=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(T.Suspense,{fallback:_,children:o.jsx(sae,{orgSlug:r.slug,virtualMcpId:c,branch:a,threadId:y,openPath:s})})}),e[17]=a,e[18]=s,e[19]=r.slug,e[20]=y,e[21]=c,e[22]=w):w=e[22];let S;return e[23]!==L||e[24]!==w?(S=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[L,w]}),e[23]=L,e[24]=w,e[25]=S):S=e[25],S}function iae(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function rae(t,e,s){return typeof t!="string"?null:iae(In(t,e),s)}function xj(t,e,s){if(!e||typeof t!="string")return!1;const n=rae(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function oae({orgSlug:t,virtualMcpId:e,branch:s}){const n=Vs(),i=Ts()?.taskId??null,r=N0(e),a=_n(e).runtime==="cms";return Ds({mutationKey:rf(t,e,s),mutationFn:async({blockKey:l})=>{if(a){const h=await N_({orgSlug:t,virtualMcpId:e,branch:s},{delete:[l]});return Hg(n,{orgSlug:t,virtualMcpId:e,branch:s},h),await n.invalidateQueries({queryKey:j0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=C0(r,G8(l)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():S9(d,"Delete")},onMutate:async({blockKey:l})=>{const c=`${t}/${e}/${s}`,d=tt.decofile(c);await n.cancelQueries({queryKey:d});const h=n.getQueryData(d),u=!!h&&l in h,f=h?.[l];return n.setQueryData(d,p=>{if(!p)return p;const{[l]:m,...g}=p;return g}),{queryKey:d,blockKey:l,hadKey:u,previousValue:f}},onError:(l,c,d)=>{d&&n.setQueryData(d.queryKey,h=>d.hadKey?{...h??{},[d.blockKey]:d.previousValue}:h)},onSuccess:()=>{n.invalidateQueries({queryKey:tt.liveMeta(t,e,s)})}})}function wc(t){const e=F.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let r;e[0]!==i||e[1]!==n||e[2]!==s?(r=s?"No results match your search.":o.jsxs(o.Fragment,{children:[o.jsx("div",{children:n}),o.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3];let a;return e[4]!==r?(a=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=a):a=e[5],a}function X9(t,e){return`${t}-${e}`}function bj(t,e){return`site/apps/${t}/${e}.ts`}function vj(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function aae(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function lae(t){return t==="local"?"Custom":"Installed"}function yj(t,e,s){const n=new Set([X9(t,e),e].map(r=>r.toLowerCase())),i=bj(t,e);for(const[r,a]of Object.entries(s)){if(r.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(n.has(r.toLowerCase())||l.__resolveType===i)return r}return null}function cae(t,e){const s=t.vendor.alias,n=t.name,i=yj(s,n,e);return{id:X9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:bj(s,n),blockKey:i,installed:i!==null}}function dae(t,e,s){if(t===G3)return null;const n=vj(t);if(!n)return null;const{vendor:i,app:r}=n,a=yj(i,r,s),l=da(t,e);return{id:X9(i,r),app:r,vendor:i,title:l.title??r,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function uae(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Zc(t,e)||!VS(n))return null;const i=vj(n)??aae(t);if(!i)return null;const r=da(n,s),{vendor:a,app:l}=i;return{id:X9(a,l),app:l,vendor:a,title:r.title??Sf(t,e,s),description:r.description??"",category:lae(a),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function hae(t,e,s){const n=new Map;for(const r of t){const a=cae(r,s);n.set(a.id,a)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const a=dae(r,e,s);!a||n.has(a.id)||n.set(a.id,a)}for(const[r,a]of Object.entries(s)){if(r.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=uae(r,a,e);!l||n.has(l.id)||n.set(l.id,l)}return[...n.values()].sort(fae)}function fae(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function mae(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function pae(t,e,s){const n=F.c(12),i=s?.enabled??!0;let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=tt.decoApps(),n[0]=r):r=n[0];let a;n[1]!==i?(a={queryKey:r,queryFn:mae,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=a):a=n[2];const l=Yt(a);let c;n[3]!==e||n[4]!==t||n[5]!==l.data?(c=t&&e?hae(l.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=l.data,n[6]=c):c=n[6];const d=c,h=l.isLoading&&!l.isError;let u;return n[7]!==d||n[8]!==l.isError||n[9]!==l.refetch||n[10]!==h?(u={catalog:d,isLoading:h,isError:l.isError,refetch:l.refetch},n[7]=d,n[8]=l.isError,n[9]=l.refetch,n[10]=h,n[11]=u):u=n[11],u}const gae=["sections","apps","loaders","actions"];function xae(t){const e=F.c(59),{active:s,counts:n,showBlog:i,onSelect:r}=t,a=ae();let l;e[0]!==a?(l=a("sandbox.collectionsSidebar.content"),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:o.jsx("span",{className:"text-sm font-medium",children:l})}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==a?(d=a("sandbox.collectionsSidebar.pages"),e[4]=a,e[5]=d):d=e[5];const h=s==="pages";let u;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==h?(u=o.jsx(zn,{id:"pages",icon:zr,label:d,count:n.pages,active:h,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=h,e[10]=u):u=e[10];let f;e[11]!==a?(f=a("sandbox.collectionsSidebar.redirects"),e[11]=a,e[12]=f):f=e[12];const p=s==="redirects";let m;e[13]!==n.redirects||e[14]!==r||e[15]!==f||e[16]!==p?(m=o.jsx(zn,{id:"redirects",icon:l8,label:f,count:n.redirects,active:p,onSelect:r}),e[13]=n.redirects,e[14]=r,e[15]=f,e[16]=p,e[17]=m):m=e[17];let g;e[18]!==a?(g=a("sandbox.collectionsSidebar.site"),e[18]=a,e[19]=g):g=e[19];const x=s==="site";let b;e[20]!==r||e[21]!==x||e[22]!==g?(b=o.jsx(zn,{id:"site",icon:q6,label:g,active:x,onSelect:r}),e[20]=r,e[21]=x,e[22]=g,e[23]=b):b=e[23];let v;e[24]!==a?(v=a("sandbox.collectionsSidebar.seo"),e[24]=a,e[25]=v):v=e[25];const L=s==="seo";let _;e[26]!==r||e[27]!==v||e[28]!==L?(_=o.jsx(zn,{id:"seo",icon:c8,label:v,active:L,onSelect:r}),e[26]=r,e[27]=v,e[28]=L,e[29]=_):_=e[29];let y;e[30]!==a?(y=a("sandbox.collectionsSidebar.calendar"),e[30]=a,e[31]=y):y=e[31];const w=s==="calendar";let S;e[32]!==r||e[33]!==y||e[34]!==w?(S=o.jsx(zn,{id:"calendar",icon:od,label:y,active:w,onSelect:r}),e[32]=r,e[33]=y,e[34]=w,e[35]=S):S=e[35];let k;e[36]!==s||e[37]!==n||e[38]!==r?(k=o.jsx(bae,{active:s,counts:n,onSelect:r}),e[36]=s,e[37]=n,e[38]=r,e[39]=k):k=e[39];let j;e[40]!==s||e[41]!==n.authors||e[42]!==n.categories||e[43]!==n.posts||e[44]!==r||e[45]!==i||e[46]!==a?(j=i&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[o.jsx(Hc,{size:13,className:"shrink-0"}),a("sandbox.collectionsSidebar.blog")]}),o.jsx(zn,{id:"posts",icon:Ai,label:a("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(zn,{id:"authors",icon:v9,label:a("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(zn,{id:"categories",icon:eg,label:a("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(zn,{id:"post-schedule",icon:gA,label:a("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:r})]}),e[40]=s,e[41]=n.authors,e[42]=n.categories,e[43]=n.posts,e[44]=r,e[45]=i,e[46]=a,e[47]=j):j=e[47];let C;e[48]!==b||e[49]!==_||e[50]!==S||e[51]!==k||e[52]!==j||e[53]!==u||e[54]!==m?(C=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,m,b,_,S,k,j]}),e[48]=b,e[49]=_,e[50]=S,e[51]=k,e[52]=j,e[53]=u,e[54]=m,e[55]=C):C=e[55];let V;return e[56]!==c||e[57]!==C?(V=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,C]}),e[56]=c,e[57]=C,e[58]=V):V=e[58],V}function bae(t){const e=F.c(52),{active:s,counts:n,onSelect:i}=t,r=ae();let a;e[0]!==s?(a=gae.includes(s),e[0]=s,e[1]=a):a=e[1];const l=a,[c,d]=T.useState(!1),h=c||l;let u,f;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=re("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer","text-muted-foreground hover:bg-muted hover:text-foreground"),f=o.jsx(xA,{size:16,className:"shrink-0"}),e[2]=u,e[3]=f):(u=e[2],f=e[3]);let p;e[4]!==r?(p=r("sandbox.collectionsSidebar.advanced"),e[4]=r,e[5]=p):p=e[5];let m;e[6]!==p?(m=o.jsx("span",{className:"flex-1 truncate",children:p}),e[6]=p,e[7]=m):m=e[7];const g=h&&"rotate-180";let x;e[8]!==g?(x=re("shrink-0 text-muted-foreground/70 transition-transform",g),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==x?(b=o.jsx(hs,{size:16,className:x}),e[10]=x,e[11]=b):b=e[11];let v;e[12]!==m||e[13]!==b?(v=o.jsxs($2,{className:u,children:[f,m,b]}),e[12]=m,e[13]=b,e[14]=v):v=e[14];let L;e[15]!==r?(L=r("sandbox.collectionsSidebar.sections"),e[15]=r,e[16]=L):L=e[16];const _=s==="sections";let y;e[17]!==n.sections||e[18]!==i||e[19]!==L||e[20]!==_?(y=o.jsx(zn,{id:"sections",icon:Wr,label:L,count:n.sections,active:_,onSelect:i,indent:!0}),e[17]=n.sections,e[18]=i,e[19]=L,e[20]=_,e[21]=y):y=e[21];let w;e[22]!==r?(w=r("sandbox.collectionsSidebar.apps"),e[22]=r,e[23]=w):w=e[23];const S=s==="apps";let k;e[24]!==n.apps||e[25]!==i||e[26]!==w||e[27]!==S?(k=o.jsx(zn,{id:"apps",icon:_8,label:w,count:n.apps,active:S,onSelect:i,indent:!0}),e[24]=n.apps,e[25]=i,e[26]=w,e[27]=S,e[28]=k):k=e[28];let j;e[29]!==r?(j=r("sandbox.collectionsSidebar.loaders"),e[29]=r,e[30]=j):j=e[30];const C=s==="loaders";let V;e[31]!==n.loaders||e[32]!==i||e[33]!==j||e[34]!==C?(V=o.jsx(zn,{id:"loaders",icon:Ia,label:j,count:n.loaders,active:C,onSelect:i,indent:!0}),e[31]=n.loaders,e[32]=i,e[33]=j,e[34]=C,e[35]=V):V=e[35];let N;e[36]!==r?(N=r("sandbox.collectionsSidebar.actions"),e[36]=r,e[37]=N):N=e[37];const A=s==="actions";let P;e[38]!==n.actions||e[39]!==i||e[40]!==N||e[41]!==A?(P=o.jsx(zn,{id:"actions",icon:hr,label:N,count:n.actions,active:A,onSelect:i,indent:!0}),e[38]=n.actions,e[39]=i,e[40]=N,e[41]=A,e[42]=P):P=e[42];let R;e[43]!==y||e[44]!==k||e[45]!==V||e[46]!==P?(R=o.jsxs(B2,{className:"flex flex-col gap-0.5 pt-0.5",children:[y,k,V,P]}),e[43]=y,e[44]=k,e[45]=V,e[46]=P,e[47]=R):R=e[47];let E;return e[48]!==h||e[49]!==R||e[50]!==v?(E=o.jsxs(z2,{open:h,onOpenChange:d,children:[v,R]}),e[48]=h,e[49]=R,e[50]=v,e[51]=E):E=e[51],E}function zn(t){const e=F.c(19),{id:s,icon:n,label:i,count:r,active:a,onSelect:l,indent:c}=t;let d;e[0]!==s||e[1]!==l?(d=()=>l(s),e[0]=s,e[1]=l,e[2]=d):d=e[2];const h=c&&"pl-6",u=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let f;e[3]!==h||e[4]!==u?(f=re("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",h,u),e[3]=h,e[4]=u,e[5]=f):f=e[5];let p;e[6]!==n?(p=o.jsx(n,{size:16,className:"shrink-0"}),e[6]=n,e[7]=p):p=e[7];let m;e[8]!==i?(m=o.jsx("span",{className:"flex-1 truncate",children:i}),e[8]=i,e[9]=m):m=e[9];let g;e[10]!==a||e[11]!==r?(g=r!==void 0&&o.jsx("span",{className:re("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:r}),e[10]=a,e[11]=r,e[12]=g):g=e[12];let x;return e[13]!==d||e[14]!==f||e[15]!==p||e[16]!==m||e[17]!==g?(x=o.jsxs("button",{type:"button",onClick:d,className:f,children:[p,m,g]}),e[13]=d,e[14]=f,e[15]=p,e[16]=m,e[17]=g,e[18]=x):x=e[18],x}function vae(t){const e=F.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:r,connectionsHref:a}=t;switch(s.kind){case"starting":{let l;e[0]!==n||e[1]!==i?(l=rk({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=l):l=e[2];let c;return e[3]!==n||e[4]!==l?(c=o.jsx(zc,{kind:"starting",progress:l,claimPhase:n}),e[3]=n,e[4]=l,e[5]=c):c=e[5],c}case"suspended":{let l;return e[6]!==r?(l=o.jsx(zc,{kind:"suspended",onResume:r}),e[6]=r,e[7]=l):l=e[7],l}case"errored":{let l;return e[8]!==a||e[9]!==r||e[10]!==s.error?(l=o.jsx(zc,{kind:"errored",error:s.error,onRetry:r,connectionsHref:a}),e[8]=a,e[9]=r,e[10]=s.error,e[11]=l):l=e[11],l}}}const yae=new Set(["clone-failed","install-failed","start-failed","crashed"]);function _ae(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!yae.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Lv(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let i=2;i<1e3;i++){const r=`${s} (copy ${i})`;if(!t.has(r))return r}return`${s} (copy ${Date.now()})`}function Lae(t,e){const s=Ko,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let r=2;r<1e3;r++){const a=`${n}-copy-${r}`;if(!t.has(s(a)))return a}return`${n}-copy-${Date.now()}`}function wae(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let i=2;i<1e3;i++){const r=`${s}_copy_${i}`;if(!Object.hasOwn(t,r))return r}return`${s}_copy_${Date.now()}`}function Sae(t){const e=s4(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function kae(t,e){return uk(t,e)}const jae=1e3;function Cae(t,e){for(let s=0;s<jae;s++){const n=s4(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Nae={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Vae={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Tae={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Aae(t){const e=F.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:a,error:l,templates:c,validate:d,onSubmit:h,onOpenChange:u}=t,f=a===void 0?!1:a,p=ae(),[m,g]=T.useState(i),[x,b]=T.useState(r),[v,L]=T.useState(Wo),[_,y]=T.useState(null),[w,S]=T.useState(s);s!==w&&(S(s),s&&(g(i),b(r),L(Wo),y(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==u?(j=he=>{!he&&!f&&(y(null),u(!1))},e[0]=f,e[1]=u,e[2]=j):j=e[2];const C=j;let V;e[3]!==f||e[4]!==m||e[5]!==h||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(V=async he=>{he.preventDefault();const ue=m.trim(),ce=x.trim();if(!ue||!ce||f)return;const ne=U9(ce);if(ne){y(ne);return}const q=d?.({name:ue,path:ce});if(q){y(q);return}y(null),await h({name:ue,path:ce,templateKey:k&&v!==Wo?v:null})},e[3]=f,e[4]=m,e[5]=h,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=V):V=e[10];const N=V,A=_??l,P=Nae[n];let R;e[11]!==p||e[12]!==P?(R=p(P),e[11]=p,e[12]=P,e[13]=R):R=e[13];let E;e[14]!==R?(E=o.jsx(cs,{children:o.jsx(Kt,{children:R})}),e[14]=R,e[15]=E):E=e[15];let I;e[16]!==f||e[17]!==k||e[18]!==p||e[19]!==v||e[20]!==c?(I=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:p("sandbox.pageFormDialog.labelTemplate")}),o.jsx(hk,{id:"page-form-template",value:v,onChange:L,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=p,e[19]=v,e[20]=c,e[21]=I):I=e[21];let D;e[22]!==p?(D=p("sandbox.pageFormDialog.labelName"),e[22]=p,e[23]=D):D=e[23];let O;e[24]!==D?(O=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:D}),e[24]=D,e[25]=O):O=e[25];let B;e[26]===Symbol.for("react.memo_cache_sentinel")?(B=he=>g(he.target.value),e[26]=B):B=e[26];let M;e[27]!==p?(M=p("sandbox.pageFormDialog.placeholderName"),e[27]=p,e[28]=M):M=e[28];let z;e[29]!==f||e[30]!==m||e[31]!==M?(z=o.jsx(vt,{id:"page-form-name",value:m,onChange:B,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=m,e[31]=M,e[32]=z):z=e[32];let $;e[33]!==z||e[34]!==O?($=o.jsxs("div",{className:"space-y-1.5",children:[O,z]}),e[33]=z,e[34]=O,e[35]=$):$=e[35];let U;e[36]!==p?(U=p("sandbox.pageFormDialog.labelPath"),e[36]=p,e[37]=U):U=e[37];let H;e[38]!==U?(H=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=H):H=e[39];let W;e[40]===Symbol.for("react.memo_cache_sentinel")?(W=he=>b(he.target.value),e[40]=W):W=e[40];let K;e[41]!==p?(K=p("sandbox.pageFormDialog.placeholderPath"),e[41]=p,e[42]=K):K=e[42];let G;e[43]!==f||e[44]!==x||e[45]!==K?(G=o.jsx(vt,{id:"page-form-path",value:x,onChange:W,placeholder:K,disabled:f}),e[43]=f,e[44]=x,e[45]=K,e[46]=G):G=e[46];let Y;e[47]!==H||e[48]!==G?(Y=o.jsxs("div",{className:"space-y-1.5",children:[H,G]}),e[47]=H,e[48]=G,e[49]=Y):Y=e[49];let Z;e[50]!==A?(Z=A&&o.jsx("p",{className:"text-xs text-destructive",children:A}),e[50]=A,e[51]=Z):Z=e[51];let te;e[52]!==$||e[53]!==Y||e[54]!==Z||e[55]!==I?(te=o.jsxs("div",{className:"space-y-4 py-4",children:[I,$,Y,Z]}),e[52]=$,e[53]=Y,e[54]=Z,e[55]=I,e[56]=te):te=e[56];let X;e[57]!==u?(X=()=>u(!1),e[57]=u,e[58]=X):X=e[58];let ee;e[59]!==p?(ee=p("sandbox.pageFormDialog.buttonCancel"),e[59]=p,e[60]=ee):ee=e[60];let J;e[61]!==f||e[62]!==X||e[63]!==ee?(J=o.jsx(me,{type:"button",variant:"outline",onClick:X,disabled:f,children:ee}),e[61]=f,e[62]=X,e[63]=ee,e[64]=J):J=e[64];let Q;e[65]!==f||e[66]!==m||e[67]!==x?(Q=!m.trim()||!x.trim()||f,e[65]=f,e[66]=m,e[67]=x,e[68]=Q):Q=e[68];let oe;e[69]!==f||e[70]!==n||e[71]!==p?(oe=f?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),p(Tae[n])]}):p(Vae[n]),e[69]=f,e[70]=n,e[71]=p,e[72]=oe):oe=e[72];let le;e[73]!==Q||e[74]!==oe?(le=o.jsx(me,{type:"submit",disabled:Q,children:oe}),e[73]=Q,e[74]=oe,e[75]=le):le=e[75];let de;e[76]!==J||e[77]!==le?(de=o.jsxs(qn,{children:[J,le]}),e[76]=J,e[77]=le,e[78]=de):de=e[78];let se;e[79]!==N||e[80]!==te||e[81]!==de||e[82]!==E?(se=o.jsx(zt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[E,te,de]})}),e[79]=N,e[80]=te,e[81]=de,e[82]=E,e[83]=se):se=e[83];let ie;return e[84]!==C||e[85]!==s||e[86]!==se?(ie=o.jsx(Ft,{open:s,onOpenChange:C,children:se}),e[84]=C,e[85]=s,e[86]=se,e[87]=ie):ie=e[87],ie}const Pae=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],wv={from:"",to:"",type:"temporary",discardQueryParameters:!1};function Eae(t){const e=F.c(111),{open:s,isPending:n,error:i,onSubmit:r,onOpenChange:a}=t,l=n===void 0?!1:n,c=ae(),[d,h]=T.useState(wv),[u,f]=T.useState(null),[p,m]=T.useState(s);s!==p&&(m(s),s&&(h(wv),f(null)));let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=je=>h(Ce=>({...Ce,...je})),e[0]=g):g=e[0];const x=g;let b;e[1]!==l||e[2]!==a?(b=je=>{!je&&!l&&(f(null),a(!1))},e[1]=l,e[2]=a,e[3]=b):b=e[3];const v=b;let L;e[4]!==l||e[5]!==r||e[6]!==d||e[7]!==c?(L=async je=>{je.preventDefault();const Ce=d.from.trim(),Pe=d.to.trim();if(!Ce||!Pe||l){f(c("sandbox.redirectFormDialog.errorRequired"));return}f(null),await r({...d,from:Ce,to:Pe})},e[4]=l,e[5]=r,e[6]=d,e[7]=c,e[8]=L):L=e[8];const _=L,y=u??i;let w;e[9]!==l||e[10]!==d.from||e[11]!==d.to?(w=!!d.from.trim()&&!!d.to.trim()&&!l,e[9]=l,e[10]=d.from,e[11]=d.to,e[12]=w):w=e[12];const S=w;let k;e[13]!==c?(k=c("sandbox.redirectFormDialog.title"),e[13]=c,e[14]=k):k=e[14];let j;e[15]!==k?(j=o.jsx(cs,{children:o.jsx(Kt,{children:k})}),e[15]=k,e[16]=j):j=e[16];let C;e[17]!==c?(C=c("sandbox.redirectEditor.fromLabel"),e[17]=c,e[18]=C):C=e[18];let V;e[19]!==C?(V=o.jsx(Mt,{htmlFor:"redirect-form-from",children:C}),e[19]=C,e[20]=V):V=e[20];const N=d.from;let A;e[21]===Symbol.for("react.memo_cache_sentinel")?(A=je=>x({from:je.target.value}),e[21]=A):A=e[21];let P;e[22]!==c?(P=c("sandbox.redirectEditor.fromPlaceholder"),e[22]=c,e[23]=P):P=e[23];let R;e[24]!==l||e[25]!==d.from||e[26]!==P?(R=o.jsx(vt,{id:"redirect-form-from",value:N,onChange:A,placeholder:P,autoFocus:!0,disabled:l}),e[24]=l,e[25]=d.from,e[26]=P,e[27]=R):R=e[27];let E;e[28]!==R||e[29]!==V?(E=o.jsxs("div",{className:"space-y-1.5",children:[V,R]}),e[28]=R,e[29]=V,e[30]=E):E=e[30];let I;e[31]!==c?(I=c("sandbox.redirectEditor.toLabel"),e[31]=c,e[32]=I):I=e[32];let D;e[33]!==I?(D=o.jsx(Mt,{htmlFor:"redirect-form-to",children:I}),e[33]=I,e[34]=D):D=e[34];const O=d.to;let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=je=>x({to:je.target.value}),e[35]=B):B=e[35];let M;e[36]!==c?(M=c("sandbox.redirectEditor.toPlaceholder"),e[36]=c,e[37]=M):M=e[37];let z;e[38]!==l||e[39]!==d.to||e[40]!==M?(z=o.jsx(vt,{id:"redirect-form-to",value:O,onChange:B,placeholder:M,disabled:l}),e[38]=l,e[39]=d.to,e[40]=M,e[41]=z):z=e[41];let $;e[42]!==D||e[43]!==z?($=o.jsxs("div",{className:"space-y-1.5",children:[D,z]}),e[42]=D,e[43]=z,e[44]=$):$=e[44];let U;e[45]!==c?(U=c("sandbox.redirectEditor.typeLabel"),e[45]=c,e[46]=U):U=e[46];let H;e[47]!==U?(H=o.jsx(Mt,{htmlFor:"redirect-form-type",children:U}),e[47]=U,e[48]=H):H=e[48];const W=d.type;let K;e[49]===Symbol.for("react.memo_cache_sentinel")?(K=je=>x({type:je}),e[49]=K):K=e[49];let G;e[50]!==c?(G=c("sandbox.redirectEditor.typePlaceholder"),e[50]=c,e[51]=G):G=e[51];let Y;e[52]!==G?(Y=o.jsx(bs,{id:"redirect-form-type",className:"w-full",children:o.jsx(Ss,{placeholder:G})}),e[52]=G,e[53]=Y):Y=e[53];let Z;e[54]!==c?(Z=Pae.map(je=>o.jsx(Rt,{value:je.value,children:c(je.labelKey,{status:IS[je.value]})},je.value)),e[54]=c,e[55]=Z):Z=e[55];let te;e[56]!==Z?(te=o.jsx(vs,{children:Z}),e[56]=Z,e[57]=te):te=e[57];let X;e[58]!==l||e[59]!==d.type||e[60]!==Y||e[61]!==te?(X=o.jsxs(xs,{value:W,onValueChange:K,disabled:l,children:[Y,te]}),e[58]=l,e[59]=d.type,e[60]=Y,e[61]=te,e[62]=X):X=e[62];let ee;e[63]!==H||e[64]!==X?(ee=o.jsxs("div",{className:"space-y-1.5",children:[H,X]}),e[63]=H,e[64]=X,e[65]=ee):ee=e[65];let J;e[66]===Symbol.for("react.memo_cache_sentinel")?(J=je=>x({discardQueryParameters:je===!0}),e[66]=J):J=e[66];let Q;e[67]!==l||e[68]!==d.discardQueryParameters?(Q=o.jsx(rl,{checked:d.discardQueryParameters,disabled:l,onCheckedChange:J}),e[67]=l,e[68]=d.discardQueryParameters,e[69]=Q):Q=e[69];let oe;e[70]!==c?(oe=c("sandbox.redirectEditor.discardQueryParameters"),e[70]=c,e[71]=oe):oe=e[71];let le;e[72]!==oe?(le=o.jsx("span",{className:"text-sm",children:oe}),e[72]=oe,e[73]=le):le=e[73];let de;e[74]!==Q||e[75]!==le?(de=o.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[Q,le]}),e[74]=Q,e[75]=le,e[76]=de):de=e[76];let se;e[77]!==y?(se=y&&o.jsx("p",{className:"text-xs text-destructive",children:y}),e[77]=y,e[78]=se):se=e[78];let ie;e[79]!==E||e[80]!==$||e[81]!==ee||e[82]!==de||e[83]!==se?(ie=o.jsxs("div",{className:"space-y-4 py-4",children:[E,$,ee,de,se]}),e[79]=E,e[80]=$,e[81]=ee,e[82]=de,e[83]=se,e[84]=ie):ie=e[84];let he;e[85]!==a?(he=()=>a(!1),e[85]=a,e[86]=he):he=e[86];let ue;e[87]!==c?(ue=c("sandbox.redirectFormDialog.cancel"),e[87]=c,e[88]=ue):ue=e[88];let ce;e[89]!==l||e[90]!==he||e[91]!==ue?(ce=o.jsx(me,{type:"button",variant:"outline",onClick:he,disabled:l,children:ue}),e[89]=l,e[90]=he,e[91]=ue,e[92]=ce):ce=e[92];const ne=!S;let q;e[93]!==l||e[94]!==c?(q=l?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),c("sandbox.redirectFormDialog.pending")]}):c("sandbox.redirectFormDialog.submit"),e[93]=l,e[94]=c,e[95]=q):q=e[95];let fe;e[96]!==ne||e[97]!==q?(fe=o.jsx(me,{type:"submit",disabled:ne,children:q}),e[96]=ne,e[97]=q,e[98]=fe):fe=e[98];let ge;e[99]!==ce||e[100]!==fe?(ge=o.jsxs(qn,{children:[ce,fe]}),e[99]=ce,e[100]=fe,e[101]=ge):ge=e[101];let _e;e[102]!==_||e[103]!==ie||e[104]!==ge||e[105]!==j?(_e=o.jsx(zt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:_,children:[j,ie,ge]})}),e[102]=_,e[103]=ie,e[104]=ge,e[105]=j,e[106]=_e):_e=e[106];let Le;return e[107]!==v||e[108]!==s||e[109]!==_e?(Le=o.jsx(Ft,{open:s,onOpenChange:v,children:_e}),e[107]=v,e[108]=s,e[109]=_e,e[110]=Le):Le=e[110],Le}function Rae(t){const e=F.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:a,onOpenChange:l}=t,c=r===void 0?!1:r,d=ae(),[h,u]=T.useState(i),[f,p]=T.useState(s);s!==f&&(p(s),s&&u(i));let m;e[0]!==c||e[1]!==l?(m=W=>{!W&&!c&&l(!1)},e[0]=c,e[1]=l,e[2]=m):m=e[2];const g=m;let x;e[3]!==c||e[4]!==h||e[5]!==a?(x=async W=>{W.preventDefault();const K=h.trim();!K||c||await a(K)},e[3]=c,e[4]=h,e[5]=a,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let L;e[9]!==v?(L=o.jsx(Kt,{children:v}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==d?(_=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=_):_=e[12];let y;e[13]!==_?(y=o.jsx(Mn,{children:_}),e[13]=_,e[14]=y):y=e[14];let w;e[15]!==L||e[16]!==y?(w=o.jsxs(cs,{children:[L,y]}),e[15]=L,e[16]=y,e[17]=w):w=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=W=>u(W.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==h?(C=o.jsx(vt,{id:"section-rename-name",value:h,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=h,e[25]=C):C=e[25];let V;e[26]!==k||e[27]!==C?(V=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=V):V=e[28];let N;e[29]!==d?(N=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=N):N=e[30];let A;e[31]!==N?(A=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:N}),e[31]=N,e[32]=A):A=e[32];let P;e[33]!==n?(P=o.jsx(vt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=P):P=e[34];let R;e[35]!==A||e[36]!==P?(R=o.jsxs("div",{className:"space-y-1.5",children:[A,P]}),e[35]=A,e[36]=P,e[37]=R):R=e[37];let E;e[38]!==V||e[39]!==R?(E=o.jsxs("div",{className:"space-y-4 py-4",children:[V,R]}),e[38]=V,e[39]=R,e[40]=E):E=e[40];let I;e[41]!==l?(I=()=>l(!1),e[41]=l,e[42]=I):I=e[42];let D;e[43]!==d?(D=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=D):D=e[44];let O;e[45]!==c||e[46]!==I||e[47]!==D?(O=o.jsx(me,{type:"button",variant:"outline",onClick:I,disabled:c,children:D}),e[45]=c,e[46]=I,e[47]=D,e[48]=O):O=e[48];let B;e[49]!==c||e[50]!==h?(B=!h.trim()||c,e[49]=c,e[50]=h,e[51]=B):B=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let z;e[55]!==B||e[56]!==M?(z=o.jsx(me,{type:"submit",disabled:B,children:M}),e[55]=B,e[56]=M,e[57]=z):z=e[57];let $;e[58]!==O||e[59]!==z?($=o.jsxs(qn,{children:[O,z]}),e[58]=O,e[59]=z,e[60]=$):$=e[60];let U;e[61]!==b||e[62]!==E||e[63]!==$||e[64]!==w?(U=o.jsx(zt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[w,E,$]})}),e[61]=b,e[62]=E,e[63]=$,e[64]=w,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=o.jsx(Ft,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function Dae(t){const e=F.c(7),{type:s}=t,n=IS[s];let i;e[0]!==n?(i=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=i):i=e[1];const r=s==="permanent"?"Permanent":"Temporary";let a;e[2]!==r?(a=o.jsx(Ke,{side:"left",children:r}),e[2]=r,e[3]=a):a=e[3];let l;return e[4]!==i||e[5]!==a?(l=o.jsxs(We,{children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],l}const im={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},y4=["posts","authors","categories"],bu={posts:"post",authors:"author",categories:"category"};function ka(t){return y4.includes(t)}const _4={posts:"post",authors:"author",categories:"category"},_j={posts:im.post,authors:im.author,categories:im.category},Mae=Object.fromEntries(Object.entries(_j).map(([t,e])=>[e,t]));function Iae(t){return typeof t=="string"?Mae[t]??null:null}function sa(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ls(t){return typeof t=="string"?t:""}function Oae(t,e){switch(t){case"posts":return{label:ls(e.title)||"Untitled post",subtitle:ls(e.slug)};case"authors":return{label:ls(e.name)||"Unnamed author",subtitle:ls(e.email)};case"categories":return{label:ls(e.name)||"Unnamed category",subtitle:ls(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Lj(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=sa(n);if(!i)continue;const r=Iae(i.__resolveType);if(!r)continue;const a=sa(i[_4[r]])??{},{label:l,subtitle:c}=Oae(r,a);e[r].push({key:s,kind:r,label:l,subtitle:c})}for(const s of y4)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function $ae(t,e){return Lj(t)[e]}function zu(t,e){return $ae(t,e).map(s=>({key:s.key,payload:Xd(sa(t[s.key])??void 0,e)}))}const Sv=Object.freeze({});function Xd(t,e){return t?sa(t[_4[e]])??Sv:Sv}function Sc(t,e,s){return{name:t,__resolveType:_j[e],[_4[e]]:s}}function j3e({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=f=>typeof f=="string"?f:ls(sa(f)?.[s]),a=f=>typeof f=="string"?f:ls(sa(f)?.name),l=f=>{const p=r(f),m=p?t.find(({payload:x})=>ls(x[s])===p):void 0;if(m)return m;const g=a(f);return g?t.find(({payload:x})=>ls(x.name)===g):void 0},c=t.map(({key:f,payload:p})=>({value:f,label:ls(p.name)||ls(p[s])||f})),d=new Map,h=[];return i.forEach((f,p)=>{const m=l(f);if(m){h.includes(m.key)||h.push(m.key);return}const g=`unresolved:${p}`;d.set(g,f),h.push(g),c.push({value:g,label:a(f)||r(f)||"Unknown"})}),{options:c,selectedValues:h,refsForValues:f=>f.map(p=>{const m=t.find(g=>g.key===p);return m?n(m.payload):d.get(p)}).filter(p=>p!==void 0)}}function Qa(t){return Array.isArray(t)?t:[]}function Ur(t){if(typeof t=="string")return t;const e=sa(t);return e?ls(e.slug):""}function Bae(t){if(typeof t=="string")return t;const e=sa(t);return e?ls(e.email):""}function wj(t){const e=[];return ls(t.title).trim()||e.push("Title"),ls(t.slug).trim()||e.push("Slug"),Qa(t.categories).map(Ur).filter(Boolean).length===0&&e.push("Category"),ls(t.excerpt).trim()||e.push("Excerpt"),ls(t.image).trim()||e.push("Cover image"),e}const Sj=8;function kj(t){const e=ls(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function C3e(t,e){return e!=="published"||kj(t)==="published"?!1:wj(t).length>0}function zae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Sj).toISOString()}function N3e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=ls(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?zae(s):n}}function jj(t){return zu(t,"posts").map(({key:e,payload:s})=>({key:e,title:ls(s.title)||"Untitled post",slug:ls(s.slug),date:ls(s.date),scheduledDatetime:ls(s.scheduledDatetime),categorySlugs:Qa(s.categories).map(Ur).filter(Boolean),authorEmails:Qa(s.authors).map(Bae).filter(Boolean),missing:wj(s),status:kj(s)}))}function Fae(t,e){const s=Qa(t.categories);return s.some(n=>Ur(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function Uae(t,e){const s=Qa(t.categories);return s.length===1&&Ur(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function V3e(t,e,s){const n=Qa(t.categories);if(!n.some(l=>Ur(l)===e))return t;const i=n.map(l=>{const c=Ur(l);return c===e||c===s.slug?{name:s.name,slug:s.slug}:l}),r=new Set,a=i.filter(l=>{const c=Ur(l);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:a}}function Hae(t,e){const s=Qa(t.categories);return s.some(n=>Ur(n)===e)?{...t,categories:s.filter(n=>Ur(n)!==e)}:t}function kv(t){return{...t,dateModified:new Date().toISOString()}}function Dp(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function rm(t,e){const s=`collections/blog/${e}/${Dp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Cj(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Dp(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Dp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Kae={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},jv="Box";function Wae(t){return t.startsWith("site/")?"site":"app"}function qae(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Rd(...t){for(const e of t)if(e!==void 0)return e}function T3e(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const r of Object.keys(i)){if(!Qae(r)||e.has(r))continue;e.add(r);const a=da(r,t),l=Gae(r),c=Kae[l],d=Wae(r),h=(d==="site"?Rd(a.title,c?.title):Rd(c?.title,a.title))??l,u=d==="site"?Rd(a.description,c?.description):Rd(c?.description,a.description),f=d==="site"?a.icon:void 0,p=f&&qae(f)?f:void 0,m=p!==void 0?c?.iconName??jv:Rd(f,c?.iconName)??jv;s.push({resolveType:r,title:h,description:u,iconName:m,iconUrl:p,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function Gae(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Yae=["blog/sections/blocks/","site/sections/Blog/Post/"];function Qae(t){return Yae.some(e=>t.startsWith(e))}const A3e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],P3e=["January","February","March","April","May","June","July","August","September","October","November","December"],Nj=1440*60*1e3;function Ra(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function E3e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function R3e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Ef(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function Mp(t,e){return Math.round((Ra(t).getTime()-Ra(e).getTime())/Nj)}function Xae(t){const e=(t.getTime()-Ra(t).getTime())/Nj;return Math.min(Math.max(e,0),1)}function Cv(t,e){return Mp(t,e)+Xae(t)}function D3e(t){const e=Ef(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(Ef(e,n*7+r));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function M3e(t,e){const s=Ra(t[0]),n=Ef(s,7),i=s.getTime(),r=n.getTime(),a=[];for(const d of e){const h=Ra(d.start),u=Ra(d.end);if(u.getTime()<s.getTime()||h.getTime()>=n.getTime())continue;const f=h.getTime()<s.getTime()?s:h,p=u.getTime()>=n.getTime()?Ef(n,-1):u,m=Mp(f,s),g=Mp(p,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),v=Cv(new Date(x),s),L=Math.max(Cv(new Date(b),s)-v,0);L<=0||a.push({variant:d,startCol:m,span:g,leftUnits:v,widthUnits:L})}a.sort((d,h)=>d.startCol-h.startCol||h.span-d.span||d.variant.blockKey.localeCompare(h.variant.blockKey));const l=[],c=[];for(const d of a){let h=l.findIndex(u=>u<=d.startCol);h===-1&&(h=l.length,l.push(0)),l[h]=d.startCol+d.span,c.push({...d,lane:h})}return c}function Rf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const Vj=/^(\d{4})-(\d{2})-(\d{2})$/;function Df(t){const e=t.trim();if(!e)return null;const s=Vj.exec(e);if(s){const i=Number(s[1]),r=Number(s[2])-1,a=Number(s[3]),l=new Date(i,r,a);return l.getMonth()===r&&l.getDate()===a?l:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:Ra(n)}function Jae(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Sj);return{...Cj("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Rf(t)}}function Zae(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(Vj.test(e))return Df(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function ele(t,e){const s=Zae(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===Rf(s)&&(i.date=Rf(n)),i}function tle(t){return Df(t.scheduledDatetime)??Df(t.date)}function I3e(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:Df(i.scheduledDatetime)!==null},a=tle(i);if(!a){s.push(r);continue}const l=Rf(a),c=e.get(l);c?c.push(r):e.set(l,[r])}const n=(i,r)=>Number(r.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(r.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const sle="0.161.0",nle="0.162.0",O3e="deno task update";function Nv(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Vv(t,e){const s=Nv(t),n=Nv(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const r=s[i]-n[i];if(r!==0)return r}return 0}const Tj=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function ile(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=Tj.exec(s)?.[1];if(n)return n}return null}function rle(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=Tj.exec(n)?.[1];if(i)return i}return null}function ole(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=ile(t.denoJson)??rle(t.meta);return!e||Vv(e,sle)<0?{kind:"outdated",version:e}:Vv(e,nle)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function $3e(t){return t.kind==="publish-only"||t.kind==="full"}function B3e(t){return t.kind==="full"}function ale(t){const e=F.c(16),s=As(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=N0(t.virtualMcpId),i=Ts()?.taskId??null;let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r=tt.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=r):r=e[3];let a;e[4]!==n||e[5]!==t||e[6]!==i?(a=async()=>{const f=await O3({...t,threadId:i},C0(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=a):a=e[7];const l=s==="deno";let c;e[8]!==r||e[9]!==a||e[10]!==l?(c={queryKey:r,queryFn:a,enabled:l,staleTime:3e5},e[8]=r,e[9]=a,e[10]=l,e[11]=c):c=e[11];const{data:d}=Yt(c),h=d??null;let u;return e[12]!==s||e[13]!==t.meta||e[14]!==h?(u=ole({packageManager:s,denoJson:h,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=h,e[15]=u):u=e[15],u}function lle({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=ae(),a=n[s],l=a===void 0,c=l?"":JSON.stringify(a,null,2),[d,h]=T.useState(!1),[u,f]=T.useState(c),[p,m]=T.useState(!1),g=!i||l,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},v=async L=>{if(!i||p)return;let _;try{_=JSON.parse(L)}catch{ye.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}m(!0);try{await i(_),ye.success(r("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(y){ye.error(r("sectionsEditor.pageJsonDialog.saveError",{error:y instanceof Error?y.message:String(y)}))}finally{m(!1)}};return o.jsx(Ft,{open:t,onOpenChange:e,children:o.jsxs(zt,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(cs,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(Kt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(me,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(xr,{size:12}):o.jsx(bn,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(me,{size:"sm",onClick:()=>v(u),disabled:!x||p,className:"h-7 text-xs",children:r(p?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),l?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",r("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"h-[70vh]",children:o.jsx(hd,{code:c,language:"json",readOnly:g,height:"100%",onChange:L=>f(L??""),onSave:L=>{v(L)}})})]})})}function yi(t){const e=F.c(46),{icon:s,logoUrl:n,title:i,subtitle:r,active:a,accent:l,variantCount:c,trailing:d,selectable:h,selectionActive:u,selected:f,invalid:p,invalidReason:m,onToggleSelect:g,onClick:x,menu:b}=t,v=ae(),L=l==="global";let _;e[0]!==s||e[1]!==a||e[2]!==L||e[3]!==n||e[4]!==c?(_=c&&c>1?o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(Ke,{side:"right",children:[c," variants"]})]})}):n?o.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):o.jsx("span",{className:re("flex size-8 shrink-0 items-center justify-center rounded-lg",L?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:re("shrink-0",!L&&(a?"text-accent-foreground":"text-muted-foreground")),style:L?{color:z3}:void 0})}),e[0]=s,e[1]=a,e[2]=L,e[3]=n,e[4]=c,e[5]=_):_=e[5];const y=_,w=a?L?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":L?"hover:bg-global-section/10":"hover:bg-muted";let S;e[6]!==w?(S=re("group relative flex min-w-0 items-center rounded-md transition-colors",w),e[6]=w,e[7]=S):S=e[7];let k;e[8]!==g||e[9]!==h||e[10]!==f||e[11]!==u||e[12]!==v||e[13]!==i?(k=h&&o.jsx("span",{className:re("flex shrink-0 items-center pl-2.5 transition-opacity",f||u?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:cle,children:o.jsx(rl,{checked:f,onCheckedChange:()=>g?.(),"aria-label":v("sandbox.itemRow.selectItem",{title:i})})}),e[8]=g,e[9]=h,e[10]=f,e[11]=u,e[12]=v,e[13]=i,e[14]=k):k=e[14];const j=p&&!a&&"text-destructive";let C;e[15]!==j?(C=re("block truncate text-sm font-medium",j),e[15]=j,e[16]=C):C=e[16];let V;e[17]!==C||e[18]!==i?(V=o.jsx("span",{className:C,children:i}),e[17]=C,e[18]=i,e[19]=V):V=e[19];const N=a?"text-accent-foreground/70":"text-muted-foreground";let A;e[20]!==N?(A=re("block truncate text-xs",N),e[20]=N,e[21]=A):A=e[21];let P;e[22]!==r||e[23]!==A?(P=o.jsx("span",{className:A,children:r}),e[22]=r,e[23]=A,e[24]=P):P=e[24];let R;e[25]!==P||e[26]!==V?(R=o.jsxs("span",{className:"min-w-0 flex-1",children:[V,P]}),e[25]=P,e[26]=V,e[27]=R):R=e[27];let E;e[28]!==a||e[29]!==p||e[30]!==m?(E=p&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx("span",{className:re("flex shrink-0 items-center",a?"text-accent-foreground":"text-destructive"),children:o.jsx(vn,{size:14})})}),m&&o.jsx(Ke,{side:"bottom",children:m})]}),e[28]=a,e[29]=p,e[30]=m,e[31]=E):E=e[31];let I;e[32]!==x||e[33]!==y||e[34]!==R||e[35]!==E||e[36]!==d?(I=o.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[y,R,E,d]}),e[32]=x,e[33]=y,e[34]=R,e[35]=E,e[36]=d,e[37]=I):I=e[37];let D;e[38]!==a||e[39]!==b?(D=b&&o.jsx("div",{className:re("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:b}),e[38]=a,e[39]=b,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D||e[43]!==S||e[44]!==k?(O=o.jsxs("div",{className:S,children:[k,I,D]}),e[41]=I,e[42]=D,e[43]=S,e[44]=k,e[45]=O):O=e[45],O}function cle(t){return t.stopPropagation()}function Bo(t){const e=F.c(10),{icon:s,title:n,description:i}=t;let r;e[0]!==s?(r=s&&o.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==n?(a=o.jsx("div",{children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==i?(l=i&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==a||e[8]!==l?(c=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[r,a,l]}),e[6]=r,e[7]=a,e[8]=l,e[9]=c):c=e[9],c}const dle={loaders:Ia,actions:hr},ule={loaders:"Loaders",actions:"Actions"},hle={analytics:GP,blog:Hc,commerce:qP,site:bA,website:jn};function fle(t,e){return e===0?hle[t.toLowerCase()]??Qo:Qo}function bh(t,e){return e===0?Nse(t):t}function mle(t){const e=F.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,kind:c}=t,d=ae();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=T.useState(h),[p,m]=T.useState(null),[g,x]=T.useState(""),[b,v]=T.useState(Lle),[L,_]=T.useState(c);L!==c&&(_(c),f([]),m(null),x(""),v(new Set));let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=U=>{v(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},e[1]=y):y=e[1];const w=y;let S;e[2]!==i||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=S):S=e[5];const k=V0(S);let j;e[6]!==k?(j=r4((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const C=j;let V;e[8]!==c?(V=mk(c),e[8]=c,e[9]=V):V=e[9];const N=V,A=dle[c];let P,R,E,I,D,O,B;if(e[10]!==A||e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==a||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==p||e[23]!==N||e[24]!==d||e[25]!==n){E=Symbol.for("react.early_return_sentinel");e:{const U=[...bk(a,l,c).map(_le),...gk(a,c).map(yle)],H=g.trim().toLowerCase(),W=H.length>0,K=W?U.filter(pe=>pe.title.toLowerCase().includes(H)||pe.resolveType.toLowerCase().includes(H)):[],G=new Map,Y=[],Z=new Map;if(!W){for(const pe of U){const ke=pe.folderPath;if(!(ke.length<u.length)&&u.every((Te,we)=>ke[we]===Te))if(ke.length===u.length)if(pe.savedKey!==void 0){const Te=Z.get(pe.resolveType);Te?Te.push(pe):Z.set(pe.resolveType,[pe])}else Y.push(pe);else{const Te=ke[u.length],we=G.get(Te)??{count:0,savedCount:0};pe.savedKey!==void 0?we.savedCount=we.savedCount+1:we.count=we.count+1,G.set(Te,we)}}Y.sort(vle);for(const pe of Z.values())pe.sort(ble)}const te=[...Z.entries()].filter(pe=>{const[ke]=pe;return!Y.some(Te=>Te.resolveType===ke)}).flatMap(xle).sort(gle);let X;e[33]!==u?(X=(pe,ke)=>bh(pe.name,u.length).localeCompare(bh(ke.name,u.length)),e[33]=u,e[34]=X):X=e[34];const ee=[...G.entries()].map(ple).sort(X);let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=pe=>{m(pe.savedKey!==void 0?{mode:"saved",key:pe.savedKey}:{mode:"available",resolveType:pe.resolveType,title:pe.title})},e[35]=J):J=e[35];const Q=J;let oe;e[36]!==k||e[37]!==N||e[38]!==d?(oe=async(pe,ke)=>{await k.mutateAsync({blockKey:pe,data:ke}),ye.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:N,blockId:pe})),m({mode:"saved",key:pe})},e[36]=k,e[37]=N,e[38]=d,e[39]=oe):oe=e[39];const le=oe;let de;e[40]!==l||e[41]!==p?(de=wle(p,l),e[40]=l,e[41]=p,e[42]=de):de=e[42];const se=de;if(se){const pe=`${se.mode}:${se.mode==="saved"?se.blockKey:se.resolveType}`;let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=()=>m(null),e[43]=ke):ke=e[43];let Te;e[44]!==i||e[45]!==l||e[46]!==le||e[47]!==c||e[48]!==a||e[49]!==s||e[50]!==r||e[51]!==k.isPending||e[52]!==C||e[53]!==pe||e[54]!==se.editorTarget||e[55]!==se.initialValue||e[56]!==n?(Te=o.jsx(pj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,kind:c,target:se.editorTarget,initialValue:se.initialValue,isCreating:k.isPending,onCreate:le,onSaveReferencedBlock:C,onBack:ke},pe),e[44]=i,e[45]=l,e[46]=le,e[47]=c,e[48]=a,e[49]=s,e[50]=r,e[51]=k.isPending,e[52]=C,e[53]=pe,e[54]=se.editorTarget,e[55]=se.initialValue,e[56]=n,e[57]=Te):Te=e[57],E=Te;break e}B="flex h-full w-full min-w-0 flex-col";let ie;e[58]!==d?(ie=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ie):ie=e[59];let he;e[60]===Symbol.for("react.memo_cache_sentinel")?(he=()=>f([]),e[60]=he):he=e[60];const ue=u.length===0?"font-medium text-foreground":"text-muted-foreground";let ce;e[61]!==ue?(ce=re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ue),e[61]=ue,e[62]=ce):ce=e[62];const ne=ule[c];let q;e[63]!==ce||e[64]!==ne?(q=o.jsx("button",{type:"button",onClick:he,className:ce,children:ne}),e[63]=ce,e[64]=ne,e[65]=q):q=e[65];let fe;e[66]!==u?(fe=u.map((pe,ke)=>{const Te=ke===u.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,ke+1)),className:re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Te?"font-medium text-foreground":"text-muted-foreground"),children:bh(pe,ke)})]},`${pe}-${ke}`)}),e[66]=u,e[67]=fe):fe=e[67];let ge;e[68]!==ie||e[69]!==q||e[70]!==fe?(ge=o.jsxs("nav",{"aria-label":ie,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[q,fe]}),e[68]=ie,e[69]=q,e[70]=fe,e[71]=ge):ge=e[71];let _e;e[72]===Symbol.for("react.memo_cache_sentinel")?(_e=o.jsx(u0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=_e):_e=e[72];let Le;e[73]===Symbol.for("react.memo_cache_sentinel")?(Le=pe=>x(pe.target.value),e[73]=Le):Le=e[73];let je;e[74]!==c||e[75]!==d?(je=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=je):je=e[76];let Ce;e[77]!==c||e[78]!==d?(Ce=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Ce):Ce=e[79];let Pe;e[80]!==g||e[81]!==je||e[82]!==Ce?(Pe=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[_e,o.jsx("input",{type:"text",value:g,onChange:Le,placeholder:je,"aria-label":Ce,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=je,e[82]=Ce,e[83]=Pe):Pe=e[83],e[84]!==ge||e[85]!==Pe?(R=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ge,Pe]}),e[84]=ge,e[85]=Pe,e[86]=R):R=e[86],P=il,O="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",D=W?K.length===0?o.jsx(Bo,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):o.jsx("div",{className:"flex flex-col gap-1",children:K.map(pe=>o.jsx(yi,{icon:A,accent:pe.savedKey!==void 0?"global":void 0,title:pe.title,subtitle:pe.resolveType,active:!1,onClick:()=>Q(pe)},pe.savedKey??pe.resolveType))}):ee.length===0&&Y.length===0&&te.length===0?o.jsx(Bo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[ee.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:ee.map(pe=>{const ke=fle(pe.name,u.length);return o.jsxs("button",{type:"button",onClick:()=>f([...u,pe.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[o.jsx(ke,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:bh(pe.name,u.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[pe.count," ",pe.count===1?N:c,pe.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:pe.savedCount})]})]})]})]},pe.name)})}),(Y.length>0||te.length>0)&&o.jsxs("div",{className:re("flex flex-col gap-1",ee.length>0&&"mt-4"),children:[Y.map(pe=>{const ke=Z.get(pe.resolveType)??[],Te=b.has(pe.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(yi,{icon:A,title:pe.title,subtitle:pe.resolveType,active:!1,onClick:()=>Q(pe)}),ke.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>w(pe.resolveType),"aria-expanded":Te,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:z3},children:[Te?o.jsx(hs,{size:12,className:"shrink-0"}):o.jsx(Ns,{size:12,className:"shrink-0"}),d(Te?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ke.length,")"]}),Te&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ke.map(we=>o.jsx(yi,{icon:A,accent:"global",title:we.title,subtitle:we.resolveType,active:!1,onClick:()=>Q(we)},we.savedKey))})]})]},pe.resolveType)}),te.map(pe=>o.jsx(yi,{icon:A,accent:"global",title:pe.title,subtitle:pe.resolveType,active:!1,onClick:()=>Q(pe)},pe.savedKey))]})]})}e[10]=A,e[11]=i,e[12]=l,e[13]=c,e[14]=a,e[15]=b,e[16]=s,e[17]=u,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=p,e[23]=N,e[24]=d,e[25]=n,e[26]=P,e[27]=R,e[28]=E,e[29]=I,e[30]=D,e[31]=O,e[32]=B}else P=e[26],R=e[27],E=e[28],I=e[29],D=e[30],O=e[31],B=e[32];if(E!==Symbol.for("react.early_return_sentinel"))return E;let M;e[87]!==I||e[88]!==D?(M=o.jsx("div",{className:I,children:D}),e[87]=I,e[88]=D,e[89]=M):M=e[89];let z;e[90]!==P||e[91]!==M||e[92]!==O?(z=o.jsx(P,{className:O,children:M}),e[90]=P,e[91]=M,e[92]=O,e[93]=z):z=e[93];let $;return e[94]!==R||e[95]!==z||e[96]!==B?($=o.jsxs("div",{className:B,children:[R,z]}),e[94]=R,e[95]=z,e[96]=B,e[97]=$):$=e[97],$}function ple(t){const[e,s]=t;return{name:e,...s}}function gle(t,e){return t.title.localeCompare(e.title)}function xle(t){const[,e]=t;return e}function ble(t,e){return t.title.localeCompare(e.title)}function vle(t,e){return t.title.localeCompare(e.title)}function yle(t){return{resolveType:t.resolveType,title:t.title,folderPath:xk(t.resolveType)}}function _le(t){return{resolveType:t.resolveType,title:t.title,folderPath:xk(t.resolveType),savedKey:t.key}}function Lle(){return new Set}function wle(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:i}=vk(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function Sle(t){const e=F.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,resolveType:c,title:d,defaultBlockId:h,isCreating:u,onCreate:f,onSaveReferencedBlock:p}=t,m=ae(),g=ho(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,L]=T.useState(b);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[1]=_):_=e[1];const[y,w]=T.useState(_),[S,k]=T.useState(0),[j,C]=T.useState(!1);let V;e[2]!==a||e[3]!==c?(V=In(c,a),e[2]=a,e[3]=c,e[4]=V):V=e[4];const N=V,A=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,P=Ts()?.taskId??null,R=r??void 0;let E;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==R||e[9]!==P||e[10]!==n?(E={orgSlug:s,virtualMcpId:n,branch:i,threadId:P,previewUrl:R,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=R,e[9]=P,e[10]=n,e[11]=E):E=e[11];const I=E;let D,O,B,M,z,$,U,H;if(e[12]!==l||e[13]!==y||e[14]!==v||e[15]!==f||e[16]!==m||e[17]!==d){const ce=[d,...y],ne=fe=>{w(y.slice(0,fe)),k(kle)};let q;e[26]!==l||e[27]!==v||e[28]!==f?(q=async fe=>{const ge=h4(fe,l);if(ge){ye.error(ge);return}await f(fe,v),C(!1)},e[26]=l,e[27]=v,e[28]=f,e[29]=q):q=e[29],D=q,M="flex h-full w-full min-w-0",B="flex min-w-0 flex-1 flex-col",O="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==m?(z=m("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=m,e[31]=z):z=e[31],$="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ce.map((fe,ge)=>{const _e=ge===ce.length-1,Le=kn(fe);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ge>0&&o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ne(ge),title:Le,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",_e?"font-medium text-foreground":"text-muted-foreground"),children:Le})]},`${Le}-${ge}`)}),e[12]=l,e[13]=y,e[14]=v,e[15]=f,e[16]=m,e[17]=d,e[18]=D,e[19]=O,e[20]=B,e[21]=M,e[22]=z,e[23]=$,e[24]=U,e[25]=H}else D=e[18],O=e[19],B=e[20],M=e[21],z=e[22],$=e[23],U=e[24],H=e[25];let W;e[32]!==z||e[33]!==$||e[34]!==U?(W=o.jsx("nav",{"aria-label":z,className:$,children:U}),e[32]=z,e[33]=$,e[34]=U,e[35]=W):W=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=()=>C(!0),e[36]=K):K=e[36];let G;e[37]!==m?(G=m("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=m,e[38]=G):G=e[38];let Y;e[39]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(J2,{size:14}),e[39]=Y):Y=e[39];let Z;e[40]!==u||e[41]!==G?(Z=o.jsx(He,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:K,"aria-label":G,children:Y})}),e[40]=u,e[41]=G,e[42]=Z):Z=e[42];let te;e[43]!==m?(te=m("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=m,e[44]=te):te=e[44];let X;e[45]!==te?(X=o.jsx(Ke,{side:"bottom",children:te}),e[45]=te,e[46]=X):X=e[46];let ee;e[47]!==Z||e[48]!==X?(ee=o.jsxs(We,{children:[Z,X]}),e[47]=Z,e[48]=X,e[49]=ee):ee=e[49];let J;e[50]!==W||e[51]!==ee||e[52]!==H?(J=o.jsxs("div",{className:H,children:[W,ee]}),e[50]=W,e[51]=ee,e[52]=H,e[53]=J):J=e[53];const Q="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",oe=m("sandbox.availableSectionEditor.localEditsHint",{typeLabel:A});let le;e[54]!==oe?(le=o.jsx("p",{className:Q,children:oe}),e[54]=oe,e[55]=le):le=e[55];let de;e[56]!==O||e[57]!==J||e[58]!==le?(de=o.jsxs("div",{className:O,children:[J,le]}),e[56]=O,e[57]=J,e[58]=le,e[59]=de):de=e[59];let se;e[60]!==l||e[61]!==y||e[62]!==S||e[63]!==v||e[64]!==a||e[65]!==p||e[66]!==I||e[67]!==N||e[68]!==m?(se=o.jsx(il,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:N?o.jsx(Bi,{schema:N,value:v,onChange:ce=>L(ce),basePath:"",breadcrumbPath:y,onBreadcrumbChange:w,meta:a,decofile:l,onSaveReferencedBlock:p,sandbox:I},S):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=l,e[61]=y,e[62]=S,e[63]=v,e[64]=a,e[65]=p,e[66]=I,e[67]=N,e[68]=m,e[69]=se):se=e[69];let ie;e[70]!==B||e[71]!==de||e[72]!==se?(ie=o.jsxs("div",{className:B,children:[de,se]}),e[70]=B,e[71]=de,e[72]=se,e[73]=ie):ie=e[73];let he;e[74]!==h||e[75]!==D||e[76]!==u||e[77]!==j?(he=o.jsx(f4,{open:j,onOpenChange:C,defaultBlockId:h,isPending:u,onSubmit:D}),e[74]=h,e[75]=D,e[76]=u,e[77]=j,e[78]=he):he=e[78];let ue;return e[79]!==M||e[80]!==ie||e[81]!==he?(ue=o.jsxs("div",{className:M,children:[ie,he]}),e[79]=M,e[80]=ie,e[81]=he,e[82]=ue):ue=e[82],ue}function kle(t){return t+1}var jle=Object.prototype.toString,yd=Array.isArray||function(e){return jle.call(e)==="[object Array]"};function L4(t){return typeof t=="function"}function Cle(t){return yd(t)?"array":typeof t}function om(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Tv(t,e){return t!=null&&typeof t=="object"&&e in t}function Nle(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Vle=RegExp.prototype.test;function Tle(t,e){return Vle.call(t,e)}var Ale=/\S/;function Ple(t){return!Tle(Ale,t)}var Ele={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Rle(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return Ele[s]})}var Dle=/\s*/,Mle=/\s+/,Av=/\s*=/,Ile=/\s*\}/,Ole=/#|\^|\/|>|\{|&|=|!/;function $le(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],a=!1,l=!1,c="",d=0;function h(){if(a&&!l)for(;r.length;)delete i[r.pop()];else r=[];a=!1,l=!1}var u,f,p;function m(k){if(typeof k=="string"&&(k=k.split(Mle,2)),!yd(k)||k.length!==2)throw new Error("Invalid tags: "+k);u=new RegExp(om(k[0])+"\\s*"),f=new RegExp("\\s*"+om(k[1])),p=new RegExp("\\s*"+om("}"+k[1]))}m(e||Ri.tags);for(var g=new T0(t),x,b,v,L,_,y;!g.eos();){if(x=g.pos,v=g.scanUntil(u),v)for(var w=0,S=v.length;w<S;++w)L=v.charAt(w),Ple(L)?(r.push(i.length),c+=L):(l=!0,s=!0,c+=" "),i.push(["text",L,x,x+1]),x+=1,L===`
631
+ `)}function dv(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Sre(t,e){const s=new Map;for(const n of t){const i=s.get(n.label);i?i.push(n):s.set(n.label,[n])}return e.map(n=>({id:s.get(n.label)?.shift()?.id??crypto.randomUUID(),index:n.index,label:n.label}))}function kre(t){return t.map((e,s)=>({...e,index:s}))}function rj(t){const e=F.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:a,onDelete:l}=t,c=ae(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let h;e[0]!==d?(h=re("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=h):h=e[1];let u;e[2]!==h?(u=o.jsx(o9,{className:h}),e[2]=h,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(zr,{className:"h-4 w-4 shrink-0",style:{color:Lre}}),e[4]=f):f=e[4];let p;e[5]!==s?(p=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=p):p=e[6];let m;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==l||e[11]!==a||e[12]!==r||e[13]!==c?(m=!i&&o.jsxs(Ot,{children:[o.jsx($t,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:Cre,onPointerDown:jre,children:o.jsx(Vi,{size:14})})}),o.jsxs(Bt,{align:"end",children:[r&&o.jsxs(Qe,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(a8,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Qe,{onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(bn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Qe,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(rn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=l,e[11]=a,e[12]=r,e[13]=c,e[14]=m):m=e[14];let g;return e[15]!==u||e[16]!==p||e[17]!==m?(g=o.jsxs(o.Fragment,{children:[u,f,p,m]}),e[15]=u,e[16]=p,e[17]=m,e[18]=g):g=e[18],g}function jre(t){return t.stopPropagation()}function Cre(t){return t.stopPropagation()}function Nre(t){const e=F.c(27),{entry:s,selected:n,canDelete:i,onSelect:r,onRename:a,onDuplicate:l,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:Vre},e[0]=s.id,e[1]=d):d=e[1];const{attributes:h,listeners:u,setNodeRef:f,transform:p,isDragging:m}=f3(d);let g;e[2]!==p?(g=fr.Transform.toString(p?{...p,x:0}:null),e[2]=p,e[3]=g):g=e[3];const x=m?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const v=b;let L;e[7]!==r?(L=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())},e[7]=r,e[8]=L):L=e[8];const _=m?"cursor-grabbing":"cursor-grab",y=n?ij:wre;let w;e[9]!==_||e[10]!==y?(w=re("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",_,y),e[9]=_,e[10]=y,e[11]=w):w=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==l||e[16]!==a?(S=o.jsx(rj,{label:s.label,canDelete:i,onRename:a,onDuplicate:l,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=l,e[16]=a,e[17]=S):S=e[17];let k;return e[18]!==h||e[19]!==u||e[20]!==r||e[21]!==f||e[22]!==v||e[23]!==L||e[24]!==w||e[25]!==S?(k=o.jsx("div",{ref:f,style:v,...h,...u,onClick:r,onKeyDown:L,className:w,children:S}),e[18]=h,e[19]=u,e[20]=r,e[21]=f,e[22]=v,e[23]=L,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function Vre(){return!1}function Tre(t){const e=F.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:a,onDuplicate:l,onDelete:c,onRemoveAll:d,onReorder:h,onAdd:u}=t,f=ae(),p=n.length>1;let m;e[0]!==n?(m=()=>dv(n),e[0]=n,e[1]=m):m=e[1];const[g,x]=T.useState(m),[b,v]=T.useState(null),[L,_]=T.useState(s),[y,w]=T.useState(n.length);let S;e[2]!==n?(S=()=>cv(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=T.useState(S),C=T.useRef(!1),V=cv(n);L!==s?(_(s),w(n.length),j(V),x(dv(n))):(y!==n.length||k!==V)&&(w(n.length),j(V),x(ue=>Sre(ue,n)));let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N={activationConstraint:{distance:8}},e[4]=N):N=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A={coordinateGetter:m3},e[5]=A):A=e[5];const P=r3(Qc(_0,N),Qc(y0,A));let R;e[6]!==g?(R=g.map(Are),e[6]=g,e[7]=R):R=e[7];const E=R;let I;e[8]!==g?(I=ue=>{const ce=String(ue.active.id);v(g.find(ne=>ne.id===ce)??null)},e[8]=g,e[9]=I):I=e[9];const D=I;let O;e[10]!==E||e[11]!==h?(O=ue=>{v(null);const{active:ce,over:ne}=ue;if(!ne||ce.id===ne.id)return;const q=E.indexOf(String(ce.id)),fe=E.indexOf(String(ne.id));q===-1||fe===-1||(x(ge=>kre(Xc([...ge],q,fe))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),h(q,fe))},e[10]=E,e[11]=h,e[12]=O):O=e[12];const B=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const z=M;let $,U,H,W,K,G,Y,Z,te,X,ee,J,Q;if(e[14]!==p||e[15]!==g||e[16]!==E||e[17]!==B||e[18]!==D||e[19]!==u||e[20]!==c||e[21]!==l||e[22]!==d||e[23]!==a||e[24]!==r||e[25]!==i||e[26]!==P||e[27]!==f){const ue=Oe=>{C.current||r(Oe)};ee="space-y-1 border-b p-2";let ce;e[41]!==f?(ce=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ce):ce=e[42];let ne;e[43]!==ce?(ne=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ce}),e[43]=ce,e[44]=ne):ne=e[44];let q;e[45]!==f?(q=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=q):q=e[46];let fe;e[47]===Symbol.for("react.memo_cache_sentinel")?(fe=o.jsx(Qt,{size:14}),e[47]=fe):fe=e[47];let ge;e[48]!==u||e[49]!==q?(ge=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":q,className:"size-6",onClick:u,children:fe})}),e[48]=u,e[49]=q,e[50]=ge):ge=e[50];let _e;e[51]!==f?(_e=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=_e):_e=e[52];let Le;e[53]!==_e?(Le=o.jsx(Ke,{children:_e}),e[53]=_e,e[54]=Le):Le=e[54];let je;e[55]!==ge||e[56]!==Le?(je=o.jsxs(We,{children:[ge,Le]}),e[55]=ge,e[56]=Le,e[57]=je):je=e[57];let Ce;e[58]!==f?(Ce=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=Ce):Ce=e[59];let Pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(Pe=o.jsx(rn,{size:14}),e[60]=Pe):Pe=e[60];let pe;e[61]!==d||e[62]!==Ce?(pe=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":Ce,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Pe})}),e[61]=d,e[62]=Ce,e[63]=pe):pe=e[63];let ke;e[64]!==f?(ke=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=ke):ke=e[65];let Te;e[66]!==ke?(Te=o.jsx(Ke,{children:ke}),e[66]=ke,e[67]=Te):Te=e[67];let we;e[68]!==pe||e[69]!==Te?(we=o.jsxs(We,{children:[pe,Te]}),e[68]=pe,e[69]=Te,e[70]=we):we=e[70];let Ne;e[71]!==je||e[72]!==we?(Ne=o.jsxs("div",{className:"flex items-center gap-0.5",children:[je,we]}),e[71]=je,e[72]=we,e[73]=Ne):Ne=e[73],e[74]!==ne||e[75]!==Ne?(J=o.jsxs("div",{className:"flex items-center justify-between",children:[ne,Ne]}),e[74]=ne,e[75]=Ne,e[76]=J):J=e[76],U=c3,G=P,Y=jL,Z=D,te=B,X=z,$=h3,W=E,K=u3,Q="space-y-0.5",H=g.map(Oe=>o.jsx(Nre,{entry:Oe,selected:Oe.index===i,canDelete:p,onSelect:()=>ue(Oe.index),onRename:a?()=>a(Oe.index):void 0,onDuplicate:()=>l(Oe.index),onDelete:()=>c(Oe.index)},Oe.id)),e[14]=p,e[15]=g,e[16]=E,e[17]=B,e[18]=D,e[19]=u,e[20]=c,e[21]=l,e[22]=d,e[23]=a,e[24]=r,e[25]=i,e[26]=P,e[27]=f,e[28]=$,e[29]=U,e[30]=H,e[31]=W,e[32]=K,e[33]=G,e[34]=Y,e[35]=Z,e[36]=te,e[37]=X,e[38]=ee,e[39]=J,e[40]=Q}else $=e[28],U=e[29],H=e[30],W=e[31],K=e[32],G=e[33],Y=e[34],Z=e[35],te=e[36],X=e[37],ee=e[38],J=e[39],Q=e[40];let oe;e[77]!==H||e[78]!==Q?(oe=o.jsx("div",{className:Q,children:H}),e[77]=H,e[78]=Q,e[79]=oe):oe=e[79];let le;e[80]!==$||e[81]!==W||e[82]!==K||e[83]!==oe?(le=o.jsx($,{items:W,strategy:K,children:oe}),e[80]=$,e[81]=W,e[82]=K,e[83]=oe,e[84]=le):le=e[84];let de;e[85]!==b||e[86]!==p?(de=b?o.jsx("div",{className:re("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",ij),children:o.jsx(rj,{label:b.label,canDelete:p,dragging:!0})}):null,e[85]=b,e[86]=p,e[87]=de):de=e[87];let se;e[88]!==de?(se=Kn.createPortal(o.jsx(d3,{dropAnimation:Ck,children:de}),document.body),e[88]=de,e[89]=se):se=e[89];let ie;e[90]!==U||e[91]!==G||e[92]!==Y||e[93]!==Z||e[94]!==te||e[95]!==X||e[96]!==le||e[97]!==se?(ie=o.jsxs(U,{sensors:G,collisionDetection:Y,onDragStart:Z,onDragEnd:te,onDragCancel:X,children:[le,se]}),e[90]=U,e[91]=G,e[92]=Y,e[93]=Z,e[94]=te,e[95]=X,e[96]=le,e[97]=se,e[98]=ie):ie=e[98];let he;return e[99]!==ee||e[100]!==J||e[101]!==ie?(he=o.jsxs("div",{className:ee,children:[J,ie]}),e[99]=ee,e[100]=J,e[101]=ie,e[102]=he):he=e[102],he}function Are(t){return t.id}const Pre=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Ere={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",gift:"Gift01","user-check":"UserCheck01","user-x":"UserX01",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function Z1(t){return nl(t)!==void 0}function g4(t,e){if(e){if(Z1(e))return e;const s=Ere[e];if(s&&Z1(s))return s}for(const[s,n]of Pre)if(s.test(t)&&Z1(n))return n;return"FilterLines"}function Rre(t){return nl(t)??ag}function em(t){const e=F.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let a;e[0]!==s?(a=Rre(s),e[0]=s,e[1]=a):a=e[1];const l=a,c=r==="sm"?"size-7":"size-9",d=r==="sm"?16:18;let h;e[2]!==c||e[3]!==i?(h=re("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=h):h=e[4];let u;e[5]!==l||e[6]!==d?(u=o.jsx(l,{size:d,className:"text-muted-foreground"}),e[5]=l,e[6]=d,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=o.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function x3e(t,e){return Aee(t,e).map(s=>{const n=e[s.blockKey]??{},i=KS(Ree(s.blockKey),e,t);return{blockKey:s.blockKey,title:Wa(s.blockKey,n),description:ed(i),iconName:g4(s.matcherResolveType)}})}const oj="Users03";function Dre(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function Mre(t){const e=t.manifest?.blocks??{},s=[],n=new Set;for(const[i,r]of Object.entries(e))if(i.includes("matchers")&&!i.startsWith("$live/"))for(const a of Object.keys(r)){if(a.toLowerCase().includes("always")||n.has(a))continue;n.add(a);const l=da(a,t);s.push({resolveType:a,title:l.title??gs(a),description:l.description,iconName:g4(a,l.icon)})}return s}function Ire(t,e){if(!t)return oj;const s=e.find(n=>n.resolveType===t);return s?s.iconName:g4(t)}function Ore(t){const e=F.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:a,onSelect:l,onSelectGlobal:c}=t,d=a===void 0?[]:a,[h,u]=T.useState(!1),f=ae(),m=(i?d.find(J=>J.blockKey===i):void 0)?.iconName??Ire(s,r),g=nl(m);let x;e[0]!==l||e[1]!==u?(x=J=>{l(J),u(!1)},e[0]=l,e[1]=u,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==u?(v=J=>{c?.(J),u(!1)},e[3]=c,e[4]=u,e[5]=v):v=e[5];const L=v;let _;e[6]!==u?(_=()=>u(!0),e[6]=u,e[7]=_):_=e[7];let y;e[8]!==g?(y=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=y):y=e[9];let w;e[10]!==n?(w=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(hs,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==_||e[14]!==y||e[15]!==w?(k=o.jsxs("button",{type:"button",onClick:_,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[y,w,S]}),e[13]=_,e[14]=y,e[15]=w,e[16]=k):k=e[16];let j;e[17]!==f?(j=f("sectionsEditor.matcherPicker.chooseRuleTitle"),e[17]=f,e[18]=j):j=e[18];let C;e[19]!==f?(C=f("sectionsEditor.matcherPicker.chooseRuleDescription"),e[19]=f,e[20]=C):C=e[20];let V;e[21]!==f?(V=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=V):V=e[22];let N;e[23]!==V?(N=o.jsx(Mi,{placeholder:V}),e[23]=V,e[24]=N):N=e[24];let A;e[25]!==f?(A=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=A):A=e[26];let P;e[27]!==A?(P=o.jsx(ri,{children:A}),e[27]=A,e[28]=P):P=e[28];let R;e[29]!==f?(R=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=R):R=e[30];let E;e[31]!==f?(E=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=E):E=e[32];const I=`${R} ${E}`;let D;e[33]!==b?(D=()=>b(""),e[33]=b,e[34]=D):D=e[34];const O=!s&&!i&&"bg-accent/60";let B;e[35]!==O?(B=re("gap-2.5",O),e[35]=O,e[36]=B):B=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(em,{iconName:oj,size:"sm"}),e[37]=M):M=e[37];let z;e[38]!==f?(z=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=z):z=e[39];let $;e[40]!==z?($=o.jsx("span",{className:"text-sm",children:z}),e[40]=z,e[41]=$):$=e[41];let U;e[42]!==f?(U=f("sectionsEditor.matcherPicker.targetAllUsers"),e[42]=f,e[43]=U):U=e[43];let H;e[44]!==U?(H=o.jsx("span",{className:"text-xs text-muted-foreground",children:U}),e[44]=U,e[45]=H):H=e[45];let W;e[46]!==$||e[47]!==H?(W=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[$,H]}),e[46]=$,e[47]=H,e[48]=W):W=e[48];let K;e[49]!==I||e[50]!==D||e[51]!==B||e[52]!==W?(K=o.jsxs($s,{value:I,onSelect:D,className:B,children:[M,W]}),e[49]=I,e[50]=D,e[51]=B,e[52]=W,e[53]=K):K=e[53];let G;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let J;e[59]!==i||e[60]!==s||e[61]!==b?(J=Q=>o.jsxs($s,{value:`${Q.title} ${Q.resolveType} ${Q.description??""}`,onSelect:()=>b(Q.resolveType),className:re("gap-2.5",!i&&s===Q.resolveType&&"bg-accent/60"),children:[o.jsx(em,{iconName:Q.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"text-sm",children:Q.title}),Q.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Q.description})]})]},Q.resolveType),e[59]=i,e[60]=s,e[61]=b,e[62]=J):J=e[62],G=r.map(J),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=G}else G=e[58];let Y;e[63]!==K||e[64]!==G?(Y=o.jsxs(fn,{children:[K,G]}),e[63]=K,e[64]=G,e[65]=Y):Y=e[65];let Z;e[66]!==i||e[67]!==d||e[68]!==L||e[69]!==f?(Z=d.length>0&&o.jsx(fn,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(J=>o.jsxs($s,{value:`${J.title} ${J.blockKey} ${J.description??""}`,onSelect:()=>L(J.blockKey),className:re("gap-2.5",i===J.blockKey&&"bg-accent/60"),children:[o.jsx(em,{iconName:J.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:J.title}),J.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:J.description})]})]},J.blockKey))}),e[66]=i,e[67]=d,e[68]=L,e[69]=f,e[70]=Z):Z=e[70];let te;e[71]!==P||e[72]!==Y||e[73]!==Z?(te=o.jsxs(Ii,{children:[P,Y,Z]}),e[71]=P,e[72]=Y,e[73]=Z,e[74]=te):te=e[74];let X;e[75]!==h||e[76]!==u||e[77]!==C||e[78]!==N||e[79]!==te||e[80]!==j?(X=o.jsxs(NE,{open:h,onOpenChange:u,title:j,description:C,className:"sm:max-w-lg",filter:Dre,children:[N,te]}),e[75]=h,e[76]=u,e[77]=C,e[78]=N,e[79]=te,e[80]=j,e[81]=X):X=e[81];let ee;return e[82]!==X||e[83]!==k?(ee=o.jsxs(o.Fragment,{children:[k,X]}),e[82]=X,e[83]=k,e[84]=ee):ee=e[84],ee}const $re="website/sections/Rendering/Lazy.tsx";function Pf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function x4(t){if(!Pf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Cs(e)}function Bre(t){return t!=null}function Rp(t){if(t==null)return t;if(x4(t)){const e=t.section;return e==null?null:Pf(e)?e:{}}return Pf(t)?t:void 0}function zre(t,e){return t===null?null:x4(e)?{...e,section:t}:t}function b3e(t){return{__resolveType:t}}function v3e(t,e){if(!Bre(e))return null;if(t){const s=Rp(e)??{};return{__resolveType:$re,section:s}}return x4(e)?Rp(e)??null:Pf(e)?e:null}const Fre="General";function td(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function aj(t,e){return t===ta?Fre:e}function lj(t){const e=_f(t),s=new Set,n=[];for(const i of e)td(i.resolveType)&&(ti(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:aj(i.resolveType,i.title),description:i.description})));return n}function b4(t){const e=yf(t),s=In(e,t),n=lj(s?.properties?.seo);return n.length>0?n:Ure(t)}function Ure(t){const e=t.manifest?.blocks??{},s=[];for(const[n,i]of Object.entries(e))if(n.includes("sections"))for(const r of Object.keys(i)){if(!td(r))continue;const a=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:aj(r,a)})}return s}function cj(t){const e=b4(t),s=e.find(n=>n.resolveType===ta);return s?s.resolveType:e[0]?.resolveType??ta}function dj(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=In(s,t),i=lj(n?.properties?.seo);if(i.length>0)return i}return b4(t)}function Hre(t,e){const s=dj(t,e),n=s.find(i=>i.resolveType===ta);return n?n.resolveType:s[0]?.resolveType??cj(t)}function Kre(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:cj(t)}function Wre(t,e,s){const n=s.__resolveType;return typeof n=="string"&&td(n)?n:Hre(t,e)}const qre=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),ta="website/sections/Seo/SeoV2.tsx",Gre=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function gu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Yre(t){return typeof t.__resolveType=="string"&&td(t.__resolveType)?!0:Gre.some(e=>e in t)}function Qre(t,e){for(const[s,n]of Object.entries(t)){if(!gu(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&qre.has(r))continue;const a=i.seo;if(gu(a)){const l=a;if(Yre(l))return{blockKey:s,kind:"nested",seoData:l,blockData:i,seoResolveType:e?Wre(e,i,l):typeof l.__resolveType=="string"&&td(l.__resolveType)?l.__resolveType:ta}}}for(const[s,n]of Object.entries(t)){if(!gu(n))continue;const i=n;if(typeof i.__resolveType=="string"&&td(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Xre(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function y3e(t,e,s){if(e.kind==="site"){const c=Qre(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?dj(s,c.blockData):void 0,build:d=>Xre(c,d)}:null}const n=t[e.pageKey];if(!gu(n))return null;const i=n,r=i.seo,a=Rp(r),l=a&&gu(a)?a:void 0;return{blockKey:e.pageKey,seoData:l,rawSeoData:r,seoResolveType:s?Kre(s,l):typeof l?.__resolveType=="string"?l.__resolveType:ta,seoTypeOptions:s?b4(s):void 0,build:c=>({...i,seo:c===null?null:zre(c,r)})}}const v4=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],Jre=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Zre=["jsonLD","title","description","noIndexing","configJsonLD"];function uj(t){return t===ta||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function eoe(t){switch(t){case"general":return v4;case"pdp":return Jre;case"plp":return Zre;default:return null}}function hj(t,e){const s=eoe(uj(e));if(!s||!t.properties)return t;const n={};for(const i of s){const r=t.properties[i];r&&(n[i]=r)}return{...t,properties:n}}function toe(){return v4.filter(t=>t!=="type")}function soe(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function noe(t,e){return t[e]===void 0}function ioe(t){const e=F.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:a}=t,l=ae(),d=hj(s,ta).properties??{},h=toe();let u;e[0]!==r?(u=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=u):u=e[1];const f=u,[p,m]=T.useState(a);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=T.useState(g);p!==a&&(m(a),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:noe(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const L=v;let _;e[6]!==i||e[7]!==r||e[8]!==n?(_=(j,C)=>{b(N=>({...N,[j]:C}));const V={...n};if(C)delete V[j];else{const N=r?.[j];V[j]=N??(j==="type"?"website":"")}i(V)},e[6]=i,e[7]=r,e[8]=n,e[9]=_):_=e[9];const y=_,w="min-w-0 space-y-6",S=v4.map(j=>{const C=d[j];if(!C)return null;const V=f&&h.includes(j),N=V&&L(j),A=N?r?.[j]??n[j]:n[j],P=C.title??soe(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:re(N&&"pointer-events-none opacity-60"),children:Ya({schema:C,value:A,onChange:R=>{N||i({...n,[j]:R})},path:j,label:P,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:roe})}),V&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(lo,{id:`seo-use-default-${j}`,checked:N,onCheckedChange:R=>y(j,R)}),o.jsx(Mt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:l("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==a||e[11]!==S?(k=o.jsx("div",{className:w,children:S},a),e[10]=a,e[11]=S,e[12]=k):k=e[12],k}function roe(){}function ooe(t){const e=F.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:a,onBreadcrumbChange:l,siteDefaultSeo:c}=t;if(uj(n)==="general"){let g;e[0]!==a?(g=b=>a(b),e[0]=a,e[1]=g):g=e[1];let x;return e[2]!==r||e[3]!==s||e[4]!==c||e[5]!==g||e[6]!==i?(x=o.jsx(ioe,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let h;e[8]!==n||e[9]!==s?(h=hj(s,n),e[8]=n,e[9]=s,e[10]=h):h=e[10];const u=h;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const p=l??aoe;let m;return e[12]!==u||e[13]!==r||e[14]!==a||e[15]!==p||e[16]!==i?(m=o.jsx(Bi,{schema:u,value:i,onChange:a,basePath:"",breadcrumbPath:f,onBreadcrumbChange:p},r),e[12]=u,e[13]=r,e[14]=a,e[15]=p,e[16]=i,e[17]=m):m=e[17],m}function aoe(){}function loe(t){const e=F.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:a,onSaveReferencedBlock:l,sandbox:c}=t,d=ae();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=T.useState(h);let p;e[1]!==u||e[2]!==d?(p=u.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(Qh,{className:"size-3.5"})}),u.map((x,b)=>{const v=b===u.length-1,L=kn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,b+1)),title:L,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",v?"font-medium text-foreground":"text-muted-foreground"),children:L})]},`${L}-${b}`)})]}),e[1]=u,e[2]=d,e[3]=p):p=e[3];let m;e[4]!==u||e[5]!==a||e[6]!==r||e[7]!==i||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==n?(m=o.jsx(Bi,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:u,onBreadcrumbChange:f,meta:r,decofile:a,onSaveReferencedBlock:l,sandbox:c}),e[4]=u,e[5]=a,e[6]=r,e[7]=i,e[8]=l,e[9]=c,e[10]=s,e[11]=n,e[12]=m):m=e[12];let g;return e[13]!==p||e[14]!==m?(g=o.jsxs("div",{className:"space-y-2",children:[p,m]}),e[13]=p,e[14]=m,e[15]=g):g=e[15],g}function _3e(t){const e=F.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:a,breadcrumbPath:l,emptyMessage:c,beforeForm:d,seoResolveType:h,siteDefaultSeo:u,meta:f,decofile:p,onSaveReferencedBlock:m,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==l?(v=l===void 0?[]:l,e[0]=l,e[1]=v):v=e[1];const L=v;let _;e[2]!==s||e[3]!==L||e[4]!==p||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==a||e[9]!==r||e[10]!==b||e[11]!==m||e[12]!==x||e[13]!==g||e[14]!==h||e[15]!==u?(_=s&&n?h?o.jsx(ooe,{schema:s,resolveType:h,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:a,siteDefaultSeo:u}):o.jsx(Bi,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:L,onBreadcrumbChange:a,meta:f,decofile:p,onSaveReferencedBlock:m,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=L,e[4]=p,e[5]=i,e[6]=n,e[7]=f,e[8]=a,e[9]=r,e[10]=b,e[11]=m,e[12]=x,e[13]=g,e[14]=h,e[15]=u,e[16]=_):_=e[16];const y=_;let w;e[17]!==c||e[18]!==y?(w=y??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=y,e[19]=w):w=e[19];let S;return e[20]!==d||e[21]!==w?(S=o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[d,w]})}),e[20]=d,e[21]=w,e[22]=S):S=e[22],S}const L3e="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function w3e(t,e){return ute(t,e,ed)}function S3e(t){const e=F.c(69),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,a=ae(),[l,c]=T.useState(n),[d,h]=T.useState(i),[u,f]=T.useState(s),[p,m]=T.useState(null),g=T.useRef(!1),[x,b]=T.useState(null);u!==s&&(f(s),c(n),h(i),m(null),b(null));let v;e[0]!==i||e[1]!==d?(v=()=>{if(g.current){g.current=!1;return}const ee=d.trim();if(ee===i.trim()){h(i),b(null);return}const J=U9(ee);if(J){b(J),h(i);return}b(null),m(ee)},e[0]=i,e[1]=d,e[2]=v):v=e[2];const L=v;let _;e[3]!==r||e[4]!==p?(_=()=>{p!==null&&(h(p),r("path",p),m(null))},e[3]=r,e[4]=p,e[5]=_):_=e[5];const y=_;let w;e[6]!==i?(w=()=>{h(i),m(null)},e[6]=i,e[7]=w):w=e[7];const S=w;let k;e[8]!==r?(k=ee=>{c(ee.target.value),r("name",ee.target.value)},e[8]=r,e[9]=k):k=e[9];let j;e[10]!==a?(j=a("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=a,e[11]=j):j=e[11];let C;e[12]!==l||e[13]!==k||e[14]!==j?(C=o.jsx("input",{type:"text",value:l,onChange:k,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:j}),e[12]=l,e[13]=k,e[14]=j,e[15]=C):C=e[15];let V;e[16]===Symbol.for("react.memo_cache_sentinel")?(V=ee=>{h(ee.target.value),b(null)},e[16]=V):V=e[16];let N;e[17]!==i?(N=ee=>{ee.key==="Enter"?(ee.preventDefault(),ee.currentTarget.blur()):ee.key==="Escape"&&(ee.preventDefault(),g.current=!0,h(i),b(null),ee.currentTarget.blur())},e[17]=i,e[18]=N):N=e[18];let A;e[19]!==a?(A=a("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[19]=a,e[20]=A):A=e[20];let P;e[21]!==L||e[22]!==d||e[23]!==N||e[24]!==A?(P=o.jsx("input",{type:"text",value:d,onChange:V,onBlur:L,onKeyDown:N,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:A}),e[21]=L,e[22]=d,e[23]=N,e[24]=A,e[25]=P):P=e[25];let R;e[26]!==x?(R=x&&o.jsx("p",{className:"text-xs text-destructive",children:x}),e[26]=x,e[27]=R):R=e[27];const E=p!==null;let I;e[28]!==S?(I=ee=>{ee||S()},e[28]=S,e[29]=I):I=e[29];let D;e[30]!==a?(D=a("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[30]=a,e[31]=D):D=e[31];let O;e[32]!==D?(O=o.jsx(Xr,{children:D}),e[32]=D,e[33]=O):O=e[33];const B=p??"";let M;e[34]!==i||e[35]!==a||e[36]!==B?(M=a("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:B}),e[34]=i,e[35]=a,e[36]=B,e[37]=M):M=e[37];let z;e[38]!==M?(z=o.jsx(Jr,{children:M}),e[38]=M,e[39]=z):z=e[39];let $;e[40]!==O||e[41]!==z?($=o.jsxs(Qr,{children:[O,z]}),e[40]=O,e[41]=z,e[42]=$):$=e[42];let U;e[43]!==a?(U=a("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[43]=a,e[44]=U):U=e[44];let H;e[45]!==U?(H=o.jsx(eo,{children:U}),e[45]=U,e[46]=H):H=e[46];let W;e[47]!==y?(W=ee=>{ee.preventDefault(),y()},e[47]=y,e[48]=W):W=e[48];let K;e[49]!==a?(K=a("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[49]=a,e[50]=K):K=e[50];let G;e[51]!==W||e[52]!==K?(G=o.jsx(to,{onClick:W,children:K}),e[51]=W,e[52]=K,e[53]=G):G=e[53];let Y;e[54]!==H||e[55]!==G?(Y=o.jsxs(Zr,{children:[H,G]}),e[54]=H,e[55]=G,e[56]=Y):Y=e[56];let Z;e[57]!==$||e[58]!==Y?(Z=o.jsxs(Yr,{children:[$,Y]}),e[57]=$,e[58]=Y,e[59]=Z):Z=e[59];let te;e[60]!==E||e[61]!==I||e[62]!==Z?(te=o.jsx(Gr,{open:E,onOpenChange:I,children:Z}),e[60]=E,e[61]=I,e[62]=Z,e[63]=te):te=e[63];let X;return e[64]!==P||e[65]!==R||e[66]!==te||e[67]!==C?(X=o.jsxs("div",{className:"space-y-1",children:[C,P,R,te]}),e[64]=P,e[65]=R,e[66]=te,e[67]=C,e[68]=X):X=e[68],X}function k3e(t){const e=F.c(13),{onClick:s}=t,n=ae();let i;e[0]!==n?(i=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[0]=n,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(kg,{size:14}),e[2]=r):r=e[2];let a;e[3]!==s||e[4]!==i?(a=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[3]=s,e[4]=i,e[5]=a):a=e[5];let l;e[6]!==n?(l=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=l):l=e[7];let c;e[8]!==l?(c=o.jsx(Ke,{side:"bottom",children:l}),e[8]=l,e[9]=c):c=e[9];let d;return e[10]!==a||e[11]!==c?(d=o.jsxs(We,{children:[a,c]}),e[10]=a,e[11]=c,e[12]=d):d=e[12],d}const uv=new WeakMap;function coe(t,e){let s=uv.get(e);s||(s=new Map,uv.set(e,s));let n=s.get(t);return n===void 0&&(n=In(t,e),s.set(t,n)),n}function doe(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function uoe(t,e){return{__resolveType:e,variants:[{rule:Jc(),value:structuredClone(t)},{rule:Jc(),value:structuredClone(t)}]}}function hoe(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>J3(n.rule));return s?s.value:e[e.length-1]?.value}function foe(t){const e=[...t.variants],s=e[e.length-1],n={rule:Jc(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function moe(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function poe(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function goe(t,e,s){return e<t?t-1:Math.min(t,s-1)}function xoe(t,e,s){const n=[...t.variants];if(e===s||e<0||s<0||e>=n.length||s>=n.length)return t;const[i]=n.splice(e,1);return i?(n.splice(s,0,i),{...t,variants:n}):t}function boe(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function hv(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const fv=new WeakMap;function voe(t){let e=fv.get(t);return e||(e=Mre(t),fv.set(t,e)),e}function fj(t){const e=F.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=ae(),{value:a,onChange:l,meta:c,path:d}=i,[h,u]=T.useState(0);if(!doe(a)){let B;e[0]!==r?(B=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=B):B=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(kg,{size:14}),e[2]=M):M=e[2];let z;e[3]!==r?(z=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=r,e[4]=z):z=e[4];let $;return e[5]!==z?($=o.jsx(Ke,{children:z}),e[5]=z,e[6]=$):$=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":B,onClick:()=>{l(uoe(a,s)),u(0)},children:M})}),$]}),n(i)]})}const f=a,p=f.variants,m=Math.min(h,p.length-1);let g;e[7]!==r?(g=(B,M)=>({index:M,label:ed(B.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=r,e[8]=g):g=e[8];const x=p.map(g),b=p[m],v=b?.rule??{},L=v.__resolveType??"",_=b?.value,y=c?voe(c):[],w=L&&c?coe(L,c):null,{__resolveType:S,...k}=v,j=()=>{l(hoe(f)),u(0)},C=()=>{const B=foe(f);l(B),u(B.variants.length-1)},V=B=>{const M=moe(f,B);M&&(l(M),u(goe(m,B,M.variants.length)))},N=B=>{const M=poe(f,B);l(M),u(B+1)},A=(B,M)=>{const z=xoe(f,B,M);l(z),m===B&&u(M)},P=B=>{const M=B?Dee(B,c):{__resolveType:F3};l(hv(f,m,M))},R=B=>{const M=B,z=L?{...M,__resolveType:L}:{...M};l(hv(f,m,z))},E=B=>{l(boe(f,m,B))},I=`${d}-${f.__resolveType}`;let D;e[9]!==r?(D=r("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=r,e[10]=D):D=e[10];let O;return e[11]!==D?(O=o.jsx(Mt,{className:"text-xs text-muted-foreground",children:D}),e[11]=D,e[12]=O):O=e[12],o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-0",children:[o.jsx(Tre,{listKey:I,variants:x,selectedIndex:m,onSelect:u,onDuplicate:N,onDelete:V,onRemoveAll:j,onReorder:A,onAdd:C}),o.jsxs("div",{className:"space-y-4 px-2 pt-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[O,o.jsx(Ore,{currentRt:L,currentLabel:ed(v),matchers:y,onSelect:P}),w&&o.jsx("div",{className:"pt-1",children:o.jsx(loe,{schema:w,value:k,onChange:R,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${m}-${L}`)})]}),n({...i,value:_,onChange:E})]})]})}const yoe="website/loaders/secret.ts";function xu(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function _oe(){return{__resolveType:yoe,name:"",encrypted:""}}function Loe(t){const{value:e,...s}=t;return s}function tm(t){const e=F.c(53),{schema:s,value:n,onChange:i,label:r,path:a,sandbox:l}=t,c=ae();if(typeof n=="string"||n==null&&!xu(n)){const C=typeof n=="string"?n:"",V=l?.virtualMcpId;let N;e[0]!==r||e[1]!==a||e[2]!==s.description||e[3]!==V?(N=o.jsx(Us,{htmlFor:a,label:r,description:s.description,virtualMcpId:V}),e[0]=r,e[1]=a,e[2]=s.description,e[3]=V,e[4]=N):N=e[4];let A;e[5]!==c?(A=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=A):A=e[6];let P;e[7]!==i?(P=I=>i(I.target.value),e[7]=i,e[8]=P):P=e[8];let R;e[9]!==a||e[10]!==C||e[11]!==A||e[12]!==P?(R=o.jsx(vt,{id:a,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:A,onChange:P,className:"h-10"}),e[9]=a,e[10]=C,e[11]=A,e[12]=P,e[13]=R):R=e[13];let E;return e[14]!==N||e[15]!==R?(E=o.jsxs("div",{className:"space-y-2",children:[N,R]}),e[14]=N,e[15]=R,e[16]=E):E=e[16],E}let d;e[17]!==n?(d=xu(n)?n:_oe(),e[17]=n,e[18]=d):d=e[18];const h=d,u=typeof h.name=="string"?h.name:"",f=typeof h.encrypted=="string"&&h.encrypted,p=`${a}-name`,m=l?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==p||e[22]!==m?(g=o.jsx(Us,{htmlFor:p,label:r,description:s.description,virtualMcpId:m}),e[19]=r,e[20]=s.description,e[21]=p,e[22]=m,e[23]=g):g=e[23];const x=`${a}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==h||e[27]!==i?(v=C=>i({...h,name:C.target.value}),e[26]=h,e[27]=i,e[28]=v):v=e[28];let L;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==v?(L=o.jsx(vt,{id:x,value:u,placeholder:b,onChange:v,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=v,e[33]=L):L=e[33];const _=`${a}-value`;let y;e[34]!==f||e[35]!==c?(y=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=y):y=e[36];let w;e[37]!==h||e[38]!==f||e[39]!==i?(w=C=>{const V=C.target.value;if(!V){i(f?Loe(h):h);return}i({...h,value:V})},e[37]=h,e[38]=f,e[39]=i,e[40]=w):w=e[40];let S;e[41]!==y||e[42]!==w||e[43]!==_?(S=o.jsx(vt,{id:_,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:y,onChange:w,className:"h-10"}),e[41]=y,e[42]=w,e[43]=_,e[44]=S):S=e[44];let k;e[45]!==f||e[46]!==c?(k=f&&o.jsx("p",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.secretField.storedSecretMessage")}),e[45]=f,e[46]=c,e[47]=k):k=e[47];let j;return e[48]!==S||e[49]!==k||e[50]!==g||e[51]!==L?(j=o.jsxs("div",{className:"space-y-2",children:[g,L,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=L,e[52]=j):j=e[52],j}function woe(t,e){const s=t.anyOfRefs;if(!s?.length)return;const n=e.find(d=>d!=null&&typeof d=="object"&&!Array.isArray(d)),i=n?Object.keys(n).filter(d=>!d.startsWith("__")):[],r=[],a=d=>{d?.type==="object"&&d.properties&&r.push(d)};for(const d of s){const h=d.schema;if(h&&(h.type==="array"&&a(h.items),h.properties))for(const u of Object.values(h.properties))u?.type==="array"&&a(u.items)}if(r.length===0)return;if(i.length===0)return r.length===1?r[0]:void 0;let l,c=-1;for(const d of r){const h=d.properties??{},u=i.filter(f=>f in h).length*2+(d.titleBy?1:0);u>c&&(c=u,l=d)}return c>=2?l:void 0}function Soe(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const s={};for(const[n,i]of Object.entries(e))n.startsWith("__")||(typeof i=="string"?s[n]={type:"string"}:typeof i=="number"?s[n]={type:"number"}:typeof i=="boolean"&&(s[n]={type:"boolean"}));return Object.keys(s).length>0?{type:"object",properties:s}:void 0}const koe=new Set(["__resolveType","@type"]);function joe(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return!1;const e=t.anyOfRefs[0].schema;return!!(e?.properties?.variants||!e&&t.plainSchema)}function Coe(t){if(K9(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function mv(t){if(t.type==="array"&&t.items)return t;const e=t.items??Coe(t);return e?{...t,type:"array",items:e}:null}function Noe(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function mj(t){const{value:e,meta:s}=t;if(e===null||typeof e!="object"||Array.isArray(e))return null;const n=e.__resolveType;if(typeof n!="string"||!s)return null;const i=In(n,s);return i?o.jsx(Bi,{schema:i,value:e,onChange:t.onChange,basePath:t.path,breadcrumbPath:t.breadcrumbPath,onBreadcrumbChange:t.onBreadcrumbChange,meta:s,decofile:t.decofile,onSaveReferencedBlock:t.onSaveReferencedBlock,previewBaseUrl:t.previewBaseUrl,onAddSectionItem:t.onAddSectionItem,onRequestAddSection:t.onRequestAddSection,sandbox:t.sandbox},t.path):null}function Ya(t){const{schema:e,value:s}=t;if(jf(s)){const a=lte(s),l=mv(e);if(a!==null&&l)return o.jsx(ph,{...t,schema:l,value:a,onChange:c=>t.onChange(cte(s,c))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&K9(e)){const a=mv(e);if(a)return o.jsx(ph,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!jf(s)&&e.type==="block-ref"){const a=woe(e,s)??Soe(s);if(a){const l={...e,type:"array",items:a};return o.jsx(ph,{...t,schema:l,value:s,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||s!==null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.__resolveType=="string"&&e.anyOfRefs){if(joe(e)){const a=e.anyOfRefs[0],l=a.schema?.properties?.variants?.items?.properties?.value,c=l&&l.type!=="block-ref"?l:e.plainSchema??l?.plainSchema??{type:"string"},d=h=>Ya({...h,schema:c});return o.jsx(fj,{...t,multivariateResolveType:a.resolveType,renderInnerField:d},t.path)}return e.anyOfRefs?o.jsx(iv,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(gre,{...t},t.path);if(e.format==="image-uri")return o.jsx(nre,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return o.jsx(ere,{...t},t.path);if(e.format==="map")return o.jsx(_re,{...t},t.path);if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return o.jsx(Nie,{...t},t.path);if(e.format==="location")return o.jsx(nj,{...t},t.path);if(e.enum&&e.enum.length>0)return o.jsx(mne,{...t},t.path);if(e.type==="anyOf")return o.jsx(iv,{...t},t.path);if(xu(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(tm,{...t},t.path);if(!e.format&&!e.enum){const a=mj(t);if(a)return a}const n=s??Noe(e.type,e.default);if(n==null)return xu(s)?o.jsx(tm,{...t},t.path):null;if(xu(n))return o.jsx(tm,{...t,value:n},t.path);const i={...t,value:n},r=s==null?e.type??typeof n:Array.isArray(n)?"array":typeof n;if(r==="array"||Array.isArray(n))return o.jsx(ph,{...i},t.path);switch(r){case"boolean":return o.jsx(cne,{...i},t.path);case"number":case"integer":return o.jsx(lne,{...i},t.path);case"string":{const a=e.format;return a==="color-input"||a==="color"?o.jsx(fh,{...i},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(fh,{...i},t.path):o.jsx(fh,{...i},t.path)}case"object":return n!==null&&typeof n=="object"&&!Array.isArray(n)?o.jsx(die,{...i},t.path):null;default:return o.jsx(fh,{...i},t.path)}}function Voe(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Ya({...t,schema:e});const s=mj(t);return s||Ya(e?{...t,schema:e}:t)}function Bi({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}){const p=ae(),m=t.properties;if(!m)return t.type==="inline-union"?Ya({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}):null;if(ate(e)&&m.variants){const N=m.variants.items?.properties?.value;return o.jsx(fj,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:a,decofile:l,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:A=>Voe(A,N)},n)}const g=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},x=Object.keys(m).filter(N=>!koe.has(N)&&m[N]?.hidden!==!0),b=new Set(t.required??[]);if(x.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sectionsEditor.sectionsEditor.noEditableFields")});const v=(N,A)=>{if(A===void 0){const{[N]:P,...R}=g;s(R);return}s({...g,[N]:A})},L=typeof g.__resolveType=="string"?g.__resolveType:void 0,_=x.filter(N=>{const A=m[N];return A!=null&&Fc(A,g[N])}).length>1,y=Une(x,m,g),w=i.length>0?Kne(x,m,g,i,l,a):null,S=w?m[w]:null,k=w&&S?[w]:x,j=w&&S?Fne(w,S,i,Bu(w,x,m)):i,C=zne(i,j),V=C.length>0&&r?N=>r([...C,...N]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:k.map(N=>{const A=m[N];if(!A)return null;const P=n?`${n}.${N}`:N,R=Bu(N,x,m),E=Ga(N,A),O=(C.length===0&&x.some(B=>{const M=m[B];return B!==N&&M!=null&&Ga(B,M)===E})||C.length===0&&y.has(N))&&V?A.type==="block-ref"?B=>V($ne(N,B)):B=>V(One(R,B)):V;return Ya({schema:A,value:g[N],onChange:B=>v(N,B),path:P,label:R,required:b.has(N),breadcrumbPath:j,onBreadcrumbChange:O,hasSiblingDrillDownFields:_,focused:w===N,meta:a,decofile:l,onSaveReferencedBlock:c,containerResolveType:L,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f})})})}function Toe(t){const e=F.c(3),{isPending:s,isError:n}=t;if(n){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(vn,{size:13}),"Couldn't save"]}),e[0]=r):r=e[0],r}if(s){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(et,{className:"size-[13px]"}),"Saving…"]}),e[1]=r):r=e[1],r}let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o.jsx(Gt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const pv=3e4;function Aoe(t,e,s,n){const i=new URL(`/deco/invoke/${e}`,t);return i.searchParams.set("__cb",n.toString(36)),i.searchParams.set("__decoFBT","0"),i.searchParams.set("__d",`run-${n.toString(36)}`),i.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(s)))),i.href}async function Poe(t,{resolveType:e,props:s}){let n;try{n=await fetch(wS(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(pv)})}catch(l){throw l instanceof DOMException&&l.name==="TimeoutError"?new Error(`Run timed out after ${pv/1e3}s — the block may be slow or the preview unresponsive.`):l}const i=await n.text();let r=null,a=!1;try{r=i?JSON.parse(i):null,a=!0}catch{}if(!n.ok){const l=a&&r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:i||`Run failed (${n.status})`;throw new Error(l)}return a?r:i}function Eoe(t){const e=F.c(2);let s;return e[0]!==t?(s={mutationFn:n=>Poe(t,n)},e[0]=t,e[1]=s):s=e[1],Ds(s)}function pj({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:a,target:l,initialValue:c,isCreating:d,onCreate:h,onSaveReferencedBlock:u,onBack:f,showRun:p=!0}){const m=Ts()?.taskId??null,g=ae(),x=ho(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=In(l.resolveType,i),L=!v&&fee(l.resolveType,i),_=L?mee(c):null,y=v??_,[w,S]=T.useState(c),[k,j]=T.useState([]),[C,V]=T.useState(0),[N,A]=T.useState(!1),[P,R]=T.useState(null),[E,I]=T.useState(!1),[D,O]=T.useState(!1),[B,M]=T.useState(!1),z=P!==null,{save:$,flush:U,isPending:H}=n4({orgSlug:t,virtualMcpId:e,branch:s}),W=Eoe({orgSlug:t,virtualMcpId:e,branch:s,threadId:m});T.useEffect(()=>()=>{U()},[]);const K=mk(a),G=l.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??l.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,threadId:m,previewUrl:n??void 0,siteSlug:b},Z=de=>{S(de),l.mode==="saved"&&$(l.blockKey,{__resolveType:l.resolveType,...de})},te=()=>{z?(R(null),A(!1),V(de=>de+1)):R(JSON.stringify(w,null,2))},X=de=>{const se=de??"";try{const ie=JSON.parse(se);if(ie&&typeof ie=="object"&&!Array.isArray(ie)){A(!1),Z(ie);return}A(!0)}catch{A(!0)}},ee=async de=>{const se=h4(de,r);if(se){ye.error(se);return}await h(de,{__resolveType:l.resolveType,...w}),I(!1)},J=()=>{O(!0),W.mutate({resolveType:l.resolveType,props:w})},Q=()=>{n&&window.open(Aoe(n,l.resolveType,w,Date.now()),"_blank","noopener")},oe=[l.title,...k],le=de=>{j(k.slice(0,de)),V(se=>se+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(c9,{size:14})}),o.jsx("nav",{"aria-label":g("sandbox.runnableBlockEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:oe.map((de,se)=>{const ie=se===oe.length-1,he=kn(de);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[se>0&&o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>le(se),title:he,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ie?"font-medium text-foreground":"text-muted-foreground"),children:he})]},`${he}-${se}`)})}),l.mode==="saved"&&o.jsx(Toe,{isPending:H,isError:!1}),p&&o.jsxs(me,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:J,disabled:W.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[W.isPending?o.jsx(et,{className:"size-3.5"}):o.jsx(Oa,{size:14}),g("sandbox.runnableBlockEditor.run")]}),l.mode==="available"&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:o.jsx(J2,{size:14})})}),o.jsx(Ke,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:z?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:te,"aria-label":g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":z,children:z?o.jsx(nn,{size:14}):o.jsx(rd,{size:14})})}),o.jsx(Ke,{side:"bottom",children:g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:l.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:K}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:G,singular:K})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:re("relative min-h-0 flex-1",D&&B&&"hidden"),children:[o.jsx(il,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[_&&y===_&&o.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:g("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:K})}),y?o.jsx(Bi,{schema:y,value:w,onChange:de=>Z(de),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:u,sandbox:Y},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:L?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),P!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[N&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:g("sandbox.runnableBlockEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(hd,{language:"json",height:"100%",code:P,onChange:X,onSave:de=>{X(de),U()}})})]})]}),D&&o.jsx(Roe,{singular:K,result:{isPending:W.isPending,error:W.error,data:W.data,hasRun:W.status!=="idle"},expanded:B,onToggleExpand:()=>M(de=>!de),onOpenInNewTab:n?Q:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(f4,{open:E,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:ee})]})}function Roe(t){const e=F.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:a,onClose:l}=t,c=ae();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const h=d,u=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==u?(f=re("flex min-h-0 flex-col border-t",u),e[2]=u,e[3]=f):f=e[3];let p;e[4]!==c?(p=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=p):p=e[5];let m;e[6]!==p?(m=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p}),e[6]=p,e[7]=m):m=e[7];let g;e[8]!==a||e[9]!==s||e[10]!==c?(g=a&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(hn,{size:14})})}),o.jsx(Ke,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=a,e[9]=s,e[10]=c,e[11]=g):g=e[11];let x;e[12]!==i||e[13]!==c?(x=c(i?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=i,e[13]=c,e[14]=x):x=e[14];let b;e[15]!==i?(b=i?o.jsx(uA,{size:14}):o.jsx(s8,{size:14}),e[15]=i,e[16]=b):b=e[16];let v;e[17]!==i||e[18]!==r||e[19]!==x||e[20]!==b?(v=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:r,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=r,e[19]=x,e[20]=b,e[21]=v):v=e[21];let L;e[22]!==i||e[23]!==c?(L=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=L):L=e[24];let _;e[25]!==L?(_=o.jsx(Ke,{side:"bottom",children:L}),e[25]=L,e[26]=_):_=e[26];let y;e[27]!==_||e[28]!==v?(y=o.jsxs(We,{children:[v,_]}),e[27]=_,e[28]=v,e[29]=y):y=e[29];let w;e[30]!==c?(w=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=w):w=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(nn,{size:14}),e[32]=S):S=e[32];let k;e[33]!==l||e[34]!==w?(k=o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":w,children:S}),e[33]=l,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==y||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,y,k]}),e[36]=y,e[37]=k,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==m?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[m,j]}),e[40]=j,e[41]=m,e[42]=C):C=e[42];let V;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==h||e[47]!==s||e[48]!==c?(V=o.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?o.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[o.jsx(et,{className:"size-4"}),c("sandbox.runnableBlockEditor.running",{singular:s})]}):n.error?o.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[o.jsx("p",{className:"text-xs font-medium text-destructive",children:c("sandbox.runnableBlockEditor.failedToRun",{singular:s})}),o.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?o.jsx(hd,{language:"json",height:"100%",code:h,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=h,e[47]=s,e[48]=c,e[49]=V):V=e[49];let N;return e[50]!==C||e[51]!==V||e[52]!==f?(N=o.jsxs("div",{className:f,children:[C,V]}),e[50]=C,e[51]=V,e[52]=f,e[53]=N):N=e[53],N}function Doe(t){const e=F.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,blockKey:c}=t,d=ae();let h;e[0]!==i||e[1]!==s||e[2]!==n?(h={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=h):h=e[3];const u=V0(h);let f;e[4]!==u?(f=r4((y,w)=>u.mutate({blockKey:y,data:w})),e[4]=u,e[5]=f):f=e[5];const p=f;let m;e[6]!==c||e[7]!==l?(m=vk(l,c),e[6]=c,e[7]=l,e[8]=m):m=e[8];const{resolveType:g,props:x,title:b}=m;if(!g){let y;e[9]!==d?(y=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=y):y=e[10];let w;return e[11]!==y?(w=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:y}),e[11]=y,e[12]=w):w=e[12],w}const v=`loader:${c}`;let L;e[13]!==c||e[14]!==g||e[15]!==b?(L={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=L):L=e[16];let _;return e[17]!==i||e[18]!==l||e[19]!==a||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==u.isPending||e[24]!==p||e[25]!==v||e[26]!==L||e[27]!==n?(_=o.jsx(pj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,kind:"loaders",target:L,initialValue:x,isCreating:u.isPending,onCreate:Moe,onSaveReferencedBlock:p,showRun:!1},v),e[17]=i,e[18]=l,e[19]=a,e[20]=s,e[21]=r,e[22]=x,e[23]=u.isPending,e[24]=p,e[25]=v,e[26]=L,e[27]=n,e[28]=_):_=e[28],_}async function Moe(){}function Ioe(t){if(t instanceof Error&&"status"in t&&typeof t.status=="number")return t.status}function gv(t){return{status:t.status,hasData:t.data!==void 0,errorStatus:Ioe(t.error)}}function Ooe(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 $oe(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=Ooe(t.lifecyclePhase);if(e==="terminal-error")return{kind:"error",source:"sandbox"};if(e==="booting")return{kind:"loading"};const s=t.decofile.status==="error"&&!t.decofile.hasData||t.meta.status==="error"&&!t.meta.hasData;return s&&t.lifecyclePhase==="checking-out"?{kind:"loading"}:[t.decofile,t.meta].some(i=>i.status==="error"&&!i.hasData&&i.errorStatus===404)?{kind:"empty",reason:"framework-missing"}:s?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 Boe="https://github.com/decocms/blocks";function zoe(){const t=F.c(14),e=ae();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(hA,{size:48,className:"text-muted-foreground"}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("mainPanelTabs.blocksTabStates.emptyStateTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==e?(i=e("mainPanelTabs.blocksTabStates.emptyStateDescription"),t[3]=e,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("mainPanelTabs.blocksTabStates.setupContentEditing"),t[5]=e,t[6]=r):r=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(hn,{size:14}),t[7]=a):a=t[7];let l;t[8]!==r?(l=o.jsx(me,{size:"sm",asChild:!0,children:o.jsxs("a",{href:Boe,target:"_blank",rel:"noreferrer",children:[r,a]})}),t[8]=r,t[9]=l):l=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==l?(c=o.jsx(Ti,{className:"h-full w-full",image:s,title:n,description:i,actions:l}),t[10]=n,t[11]=i,t[12]=l,t[13]=c):c=t[13],c}function Foe(t){const e=F.c(15),{source:s,onRetry:n}=t,i=ae();let r;e[0]!==s||e[1]!==i?(r=i(s==="sandbox"?"mainPanelTabs.blocksTabStates.errorStateSandbox":"mainPanelTabs.blocksTabStates.errorStateData"),e[0]=s,e[1]=i,e[2]=r):r=e[2];const a=r;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(vn,{size:48,className:"text-muted-foreground"}),e[3]=l):l=e[3];let c;e[4]!==i?(c=i("mainPanelTabs.blocksTabStates.errorStateTitle"),e[4]=i,e[5]=c):c=e[5];let d;e[6]!==i?(d=i("mainPanelTabs.blocksTabStates.retry"),e[6]=i,e[7]=d):d=e[7];let h;e[8]!==n||e[9]!==d?(h=o.jsx(me,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=h):h=e[10];let u;return e[11]!==a||e[12]!==c||e[13]!==h?(u=o.jsx(Ti,{image:l,title:c,description:a,actions:h}),e[11]=a,e[12]=c,e[13]=h,e[14]=u):u=e[14],u}const Uoe=T.lazy(()=>Ws(()=>import("./sections-editor-D_5Mw5mz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor})));function xv(t){const e=F.c(49),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:a}=Ue(),{currentBranch:l,taskId:c}=on(),d=ci(),h=la(),u=_k(),f=d.lifecycle.phase==="running",p=h.previewUrl;let m;e[0]!==l||e[1]!==a||e[2]!==p||e[3]!==c||e[4]!==s?(m=l?{orgSlug:a.slug,virtualMcpId:s,branch:l,threadId:c??null,previewUrl:p}:null,e[0]=l,e[1]=a,e[2]=p,e[3]=c,e[4]=s,e[5]=m):m=e[5];const g=m;let x;e[6]!==f?(x={fetchEnabled:f},e[6]=f,e[7]=x):x=e[7];const b=z9(g,x);let v;e[8]!==f?(v={fetchEnabled:f},e[8]=f,e[9]=v):v=e[9];const L=Q3(g,v),_=$oe({lifecyclePhase:d.lifecycle.phase,decofile:gv(b),meta:gv(L),hasEditableContent:FS(b.data,L.data),fastPreviewActive:_n(s).runtime==="cms"}),y=Hoe;if(_.kind==="loading"){let M;return e[10]===Symbol.for("react.memo_cache_sentinel")?(M=y(o.jsx(Aa,{})),e[10]=M):M=e[10],M}if(_.kind==="empty"){let M;return e[11]===Symbol.for("react.memo_cache_sentinel")?(M=y(o.jsx(zoe,{})),e[11]=M):M=e[11],M}if(_.kind==="error"){let M;e[12]!==b||e[13]!==h||e[14]!==L||e[15]!==_.source?(M=()=>{if(_.source==="sandbox"){h.retry();return}Promise.all([b.refetch(),L.refetch()])},e[12]=b,e[13]=h,e[14]=L,e[15]=_.source,e[16]=M):M=e[16];const z=M;let $;return e[17]!==z||e[18]!==_.source?($=y(o.jsx(Foe,{source:_.source,onRetry:z})),e[17]=z,e[18]=_.source,e[19]=$):$=e[19],$}let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=M=>y(o.jsx("div",{className:"h-full min-h-0",children:M})),e[20]=w):w=e[20];const S=w,k=u.state.target;if(k?.kind==="loader"&&b.data&&L.data){const M=l??"",z=p??null;let $;return e[21]!==b.data||e[22]!==L.data||e[23]!==a.slug||e[24]!==M||e[25]!==z||e[26]!==k.key||e[27]!==s?($=S(o.jsx(Doe,{orgSlug:a.slug,virtualMcpId:s,branch:M,previewUrl:z,meta:L.data,decofile:b.data,blockKey:k.key})),e[21]=b.data,e[22]=L.data,e[23]=a.slug,e[24]=M,e[25]=z,e[26]=k.key,e[27]=s,e[28]=$):$=e[28],$}let j;e[29]!==l||e[30]!==a.slug||e[31]!==k||e[32]!==s?(j=k||!l?null:e4(Z3(a.slug,s,l)),e[29]=l,e[30]=a.slug,e[31]=k,e[32]=s,e[33]=j):j=e[33];const C=j;let V="/",N=null,A=null;k?.kind==="page"?(V=k.path,N=k.key):k?.kind==="section"?A=k.key:C&&(V=C.path,N=C.pageKey);const P=N?`page:${N}`:A?`section:${A}`:`path:${V}`;let R;e[34]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})}),e[34]=R):R=e[34];const E=l??"",I=p??void 0,D=A?null:r,O=!!N&&u.state.editSeoPageKey===N;let B;return e[35]!==A||e[36]!==N||e[37]!==V||e[38]!==P||e[39]!==i||e[40]!==a.slug||e[41]!==D||e[42]!==O||e[43]!==E||e[44]!==I||e[45]!==s||e[46]!==u.consumeEditSeo||e[47]!==u.setVariantOverride?(B=S(o.jsx(T.Suspense,{fallback:R,children:o.jsx(Uoe,{orgSlug:a.slug,virtualMcpId:s,branch:E,previewReady:!0,previewUrl:I,currentPath:V,activePageBlockKey:N,activeGlobalBlockKey:A,externalSelection:D,initialEditSeo:O,onExitSeo:u.consumeEditSeo,onVariantPreviewOverride:u.setVariantOverride,onViewJsonFile:i},P)})),e[35]=A,e[36]=N,e[37]=V,e[38]=P,e[39]=i,e[40]=a.slug,e[41]=D,e[42]=O,e[43]=E,e[44]=I,e[45]=s,e[46]=u.consumeEditSeo,e[47]=u.setVariantOverride,e[48]=B):B=e[48],B}function Hoe(t){return o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:t})}function bv(t){const e=F.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,a=ae(),{org:l}=Ue(),{currentBranch:c,taskId:d}=on(),u=la().previewUrl;let f;e[0]!==c||e[1]!==l.slug||e[2]!==u||e[3]!==d||e[4]!==s?(f=c?{orgSlug:l.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:u}:null,e[0]=c,e[1]=l.slug,e[2]=u,e[3]=d,e[4]=s,e[5]=f):f=e[5];const m=z9(f),g=c??"";let x;e[6]!==l.slug||e[7]!==g||e[8]!==s?(x={orgSlug:l.slug,virtualMcpId:s,branch:g},e[6]=l.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:v}=n4(x),L=m.data?.[n],_=m.data===void 0&&m.isLoading,y=m.data!==void 0&&L===void 0,w=!c||y||_;let S;e[10]!==L?(S=L===void 0?"":JSON.stringify(L,null,2),e[10]=L,e[11]=S):S=e[11];const k=S;let j;e[12]!==n||e[13]!==w||e[14]!==b?(j=B=>{if(w)return;let M;try{M=JSON.parse(B)}catch{return}M===null||typeof M!="object"||Array.isArray(M)||b(n,M)},e[12]=n,e[13]=w,e[14]=b,e[15]=j):j=e[15];const C=j;let V;e[16]!==v?(V=()=>({flush:v}),e[16]=v,e[17]=V):V=e[17],T.useImperativeHandle(r,V);let N;e[18]!==a?(N=a("sectionsEditor.pageJsonDialog.titleShort"),e[18]=a,e[19]=N):N=e[19];let A;e[20]!==N?(A=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N}),e[20]=N,e[21]=A):A=e[21];let P;e[22]!==a?(P=a("sectionsEditor.pageJsonDialog.close"),e[22]=a,e[23]=P):P=e[23];let R;e[24]===Symbol.for("react.memo_cache_sentinel")?(R=o.jsx(nn,{size:14}),e[24]=R):R=e[24];let E;e[25]!==i||e[26]!==P?(E=o.jsx(me,{variant:"ghost",size:"icon",onClick:i,"aria-label":P,className:"size-7 shrink-0",children:R}),e[25]=i,e[26]=P,e[27]=E):E=e[27];let I;e[28]!==E||e[29]!==A?(I=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[A,E]}),e[28]=E,e[29]=A,e[30]=I):I=e[30];let D;e[31]!==m.data||e[32]!==v||e[33]!==k||e[34]!==_||e[35]!==y||e[36]!==n||e[37]!==w||e[38]!==C||e[39]!==a?(D=_?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})}):y?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",a("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(hd,{code:k,language:"json",readOnly:w,height:"100%",onChange:B=>C(B??""),onSave:B=>{C(B),v()}},`${n}:${m.data===void 0?"loading":"ready"}`)}),e[31]=m.data,e[32]=v,e[33]=k,e[34]=_,e[35]=y,e[36]=n,e[37]=w,e[38]=C,e[39]=a,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D?(O=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[I,D]}),e[41]=I,e[42]=D,e[43]=O):O=e[43],O}function gj(t){return t.contentEditingEnabled&&!t.isMobile}function Koe(t,e){return t!=="visual"?"visual":e?"blocks":"preview"}function Woe(t){return gj({contentEditingEnabled:q8(t.cmsMode),isMobile:t.isMobile})?"blocks":"preview"}function qoe(t){return t.editingMode==="blocks"&&!t.blocksEditingEnabled||t.editingMode==="visual"&&!t.sandboxDisplay?"preview":t.editingMode}const Goe=500,Yoe={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},vv=1,sm=["desktop","mobile","tablet"],yv={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function _v(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Qoe(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 xh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function nm(t,e){try{return new URL(t,e).href}catch{return null}}function Xoe(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),r=i.split("/").filter(Boolean),a=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let h=40;return d===0?h+=30:/[\s/-]/.test(c[d-1]??"")&&(h+=20),h+=Math.round(s.length/c.length*20),h};let l=Math.max(a(n),a(i));return r.at(-1)===s?l=Math.max(l,95):r.includes(s)&&(l=Math.max(l,90)),l}function Joe(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Zoe({virtualMcpId:t}){const e=ae(),s=ld(),n=Za(),i=YZ(),{currentBranch:r,taskId:a}=on(),l=_k(),c=ho(),d=_n(t),h=p0(c?.entity?.id===t?c.entity.metadata?.ui?.layout??null:null),u=q8(h),f=gj({contentEditingEnabled:u,isMobile:n}),[p,m]=T.useState(()=>Woe({cmsMode:h,isMobile:n})),[g,x]=T.useState("desktop"),[b,v]=T.useState(null),[L,_]=T.useState(null),y=T.useRef(null),w=T.useRef(null),[S,k]=T.useState(!1),j=T.useRef(null),C=()=>{j.current?.flush(),k(!1)},V=()=>k(ve=>(ve&&j.current?.flush(),!ve)),[N,A]=T.useState({width:0,height:0}),[P,R]=T.useState(null),[E,I]=T.useState(!1),[D,O]=T.useState(""),B=T.useRef(null),[M,z]=T.useState(!1),[$,U]=T.useState(),[H,W]=T.useState(null),[K,G]=T.useState(null),[Y,Z]=T.useState(null),[te,X]=T.useState("/"),[ee,J]=T.useState(null),[Q,oe]=T.useState({}),[le,de]=T.useState(!1),se=T.useRef(null),ie=()=>{de(!0),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>de(!1),15e3)},he=()=>{se.current&&(clearTimeout(se.current),se.current=null),de(!1)},{org:ue}=Ue(),ce=ci(),ne=la(),q=ne.vmEntry,fe=ne.previewUrl,ge=ce.lifecycle.phase,_e=ge==="running",Le=c?.entity?.id===t?q2(c.entity.metadata):null,je=c?.entity?.id===t&&d.runtime==="cms",Ce=d.projectDefault==="cms",Pe=Kee({sandboxUrl:fe,previewServerUrl:Le,fastPreviewActive:je}),pe=t&&r?{orgSlug:ue.slug,virtualMcpId:t,branch:r,threadId:a??null,previewUrl:fe}:null,ke=z9(pe,{fetchEnabled:_e}),Te=Q3(pe,{fetchEnabled:_e}),we=ke.data,Ne=Te.data,Oe=we?wf(we).sort((ve,Ee)=>ve.name.localeCompare(Ee.name)):[],nt=t&&r?{orgSlug:ue.slug,virtualMcpId:t,branch:r}:null,Fe=yse(nt),yt=we&&Ne?Y3(we,Ne):[],it=we&&Ne?bk(Ne,we,"loaders"):[],st=D?(()=>{const ve=D.toLowerCase();return Oe.map(Ee=>({page:Ee,score:Xoe(Ee.name,Ee.path,ve)})).filter(({score:Ee})=>Ee>0).sort((Ee,gt)=>gt.score-Ee.score||Ee.page.path.length-gt.page.path.length).map(({page:Ee})=>Ee)})():Oe,ft=yt.filter(ve=>{if(!D)return!0;const Ee=D.toLowerCase();return ve.name.toLowerCase().includes(Ee)||ve.key.toLowerCase().includes(Ee)||ve.resolveType.toLowerCase().includes(Ee)}),_t=f?it:[],mt=_t.filter(ve=>{if(!D)return!0;const Ee=D.toLowerCase();return ve.title.toLowerCase().includes(Ee)||ve.key.toLowerCase().includes(Ee)||ve.resolveType.toLowerCase().includes(Ee)}),Ze=K?it.find(ve=>ve.key===K)??null:null,rt=Ko,xt=H||K?null:jp(Oe,te,ee),be=H?H.name:Ze?.title??xt?.name,Re=xt?.key??null,Me=xt?.path??null,dt=(Re?Q[Re]:void 0)??{},ut=Dr(te,dt),ht={};if(_e&&fe&&Ne&&we){const ve=kse(Ne,"loaders"),Ee=Re?we[Re]:void 0,gt=Ute(Ee,we,os=>ve.has(os)),St=Ote(gt);for(const os of vf(te)){if(os.type!=="param")continue;const mn=Dte(te,os.name,gt),Gs=zte(mn,ve,St);Gs.length>0&&(ht[os.name]=Gs)}}const ct=t&&r?{orgSlug:ue.slug,virtualMcpId:t,branch:r,threadId:a??null}:null,lt=we&&Re?tk(we,Re,0):[],Ge=we?QS(lt,we):[],wt=Ge.map(ve=>ve.isSavedBlock?ve.label:""),Pt=Ge.map(ve=>ve.isSavedBlock?"global":ve.isMultivariate?"variant":"normal"),Zt=lt.map(ve=>Np(ve,we??{})),Dt=T.useRef(null),$e=T.useRef(null),Lt=ce.status.state==="paused",Se=ce.phase,Ye=rk({claimPhase:Se,lifecycle:ce.lifecycle}),ot=ne.previewState,es=ne.userStopped,xe=X3(ue.slug,t??"",r??""),{url:De}=YS(je&&t&&r?{orgSlug:ue.slug,virtualMcpId:t,branch:r,previewServerUrl:Le??null,path:ut}:null),Je=Ce&&d.runtime==="sandbox",Ie=zZ({previewState:ot,progressStatus:Ye.status,previewServerUrl:Le,fastPreviewActive:je,fastPreviewReady:!!De,codingSession:Je}),pt=Ie.mode!=="none",Et=Ie.mode==="production"&&Ie.iframeBase?xh(Ie.iframeBase):null,at=!s,rs=Ie.mode==="production"?Et:xh(fe),_r=c?.entity?.id===t&&c.entity.metadata?.fastPreviewInPlace===!0,It=Ie.mode==="production"&&je&&_r&&f&&p==="blocks",zi=T.useRef(null);let Fi=zi.current;It?Fi===null&&De!==null&&(Fi=zi.current=De):zi.current=De;const fo=It?Fi:De,qs=Qoe(Ie.mode==="sandbox"?ah(_v(Y??nm(ut,Ie.iframeBase)??Ie.iframeBase,g),l.state.variantOverride??[]):Ie.mode==="production"&&at?ah(_v(GS(Y??fo??nm(ut,Ie.iframeBase)??Ie.iframeBase,Ie.showWakingPill?Uee:null),g),l.state.variantOverride??[]):null);T.useEffect(()=>{},[s,Et,P]);const Lr="sandbox.preview.openInNewTab",di=De??(Ie.iframeBase?nm(ut,Ie.iframeBase):null),mo=Ie.mode==="production"?di?ah(di,l.state.variantOverride??[]):null:qs??Ie.iframeBase,po=async()=>{const ve=mo;if(ve){window.open(ve,"_blank","noopener");return}},ui=t&&r?Z3(ue.slug,t,r):null,hi=ve=>{ui&&Pte(ui,ve)},fs=l.state.target;T.useEffect(()=>{if(!(!fs||!Pe||!Ne))if(fs.kind==="page"){const ve=Q[fs.key]??{};$e.current=Dr(fs.path,ve),W(null),G(null),Z(null),J(fs.key),X(fs.path),hi({path:fs.path,pageKey:fs.key,params:ve})}else if(fs.kind==="loader")$e.current=null,W(null),G(fs.key),Z(null);else{const ve=yt.find(Ee=>Ee.key===fs.key);if(ve){$e.current=null;const Ee=yf(Ne);G(null),W(ve),Z(Mb(Pe,Ee,ve.key))}}},[fs,Pe,Ne,Q]),T.useEffect(()=>{!Re||Me===null||fs?.kind==="page"&&fs.key===Re&&fs.path===Me||l.selectTarget({kind:"page",key:Re,path:Me})},[Re,Me,fs]);const[fi,go]=T.useState(null);if(ot.kind==="iframe"&&fi!==ot.previewUrl){const ve=fi!==null;go(ot.previewUrl);const Ee=ui?e4(ui):null;if(Ee){if($e.current=Dr(Ee.path,Ee.params),X(Ee.path),J(Ee.pageKey),Z(null),W(null),G(null),Ee.pageKey&&Object.keys(Ee.params).length>0){const gt=Ee.pageKey;oe(St=>({...St,[gt]:Ee.params}))}}else ve&&($e.current=null,X("/"),Z(null),J(null),W(null),G(null))}Dt.current=qs;const mi=KZ({iframeRef:y,src:Ie.mode==="sandbox"?qs:null,active:Ie.mode==="sandbox"}),wr=T.useRef(null);T.useEffect(()=>{if(!De||!qs||wr.current===De)return;wr.current=De;const ve=y.current;ve&&ve.getAttribute("src")!==qs&&(ie(),ve.src=qs)},[De,qs]);const Sr=()=>{const ve=y.current?.contentWindow,Ee=rs;if(!ve||!Ee||!we||!Re)return;const gt=we[Re];if(!gt||typeof gt!="object")return;const St=Hee({previewBaseUrl:Ee,pageBlock:gt,decofile:we,path:ut,pathTemplate:te});if(!St)return;const os=ah(St.src,l.state.variantOverride??[]);ve.postMessage({type:"cms-editor::render",src:os,body:St.body},Ee)},pi=T.useRef(null);T.useEffect(()=>{if(!It||H||K||!Re||!we){pi.current=null;return}const ve=JSON.stringify({page:Re,path:ut,pathTemplate:te,decofile:we});if(pi.current===ve)return;const Ee=pi.current===null;pi.current=ve,!Ee&&Sr()},[we,It,H,K,Re,ut,te]);const ua=T.useRef(null);T.useEffect(()=>{if(!It||H||K||!Re||!we){ua.current=null;return}const ve=JSON.stringify(l.state.variantOverride??null),Ee=ua.current;ua.current={page:Re,sig:ve},!(!Ee||Ee.page!==Re||Ee.sig===ve)&&Sr()},[l.state.variantOverride,It,H,K,Re]);const xo=!!t&&!!r&&!ce.notFound&&!es&&!Lt&&(Se?.kind==="ready"||ge!=="idle"),Es=qoe({editingMode:p,sandboxDisplay:Ie.mode==="sandbox",blocksEditingEnabled:f});T.useEffect(()=>{const ve=rs;if(!ve)return;const Ee=gt=>{if(gt.origin===ve)if(gt.data?.type==="visual-editor::element-clicked"){const St=Qee.safeParse(gt.data.payload);St.success&&v(St.data)}else if(gt.data?.type==="cms-editor::section-clicked"){const St=Zee.safeParse(gt.data.payload);St.success&&_({index:St.data.sectionIndex,seq:St.data.clickSeq})}else gt.data?.type==="cms-editor::render-start"?ie():gt.data?.type==="cms-editor::render-end"?(he(),y.current?.contentWindow?.postMessage({type:"cms-editor::set-labels",labels:wt,kinds:Pt,keys:Zt},ve)):gt.data?.type==="cms-editor::render-error"&&he()};return window.addEventListener("message",Ee),()=>window.removeEventListener("message",Ee)},[rs,wt,Pt,Zt]);const ha=()=>{const ve=y.current?.contentWindow,Ee=xh(fe);!ve||!Ee||ve.postMessage({type:"visual-editor::activate",script:Xee},Ee)},bo=()=>{const ve=y.current?.contentWindow,Ee=xh(fe);!ve||!Ee||ve.postMessage({type:"visual-editor::deactivate"},Ee)},Ui=()=>{const ve=y.current?.contentWindow,Ee=rs;!ve||!Ee||(ve.postMessage(Ie.mode==="production"?{type:"editor::inject",args:{script:Ob}}:{type:"visual-editor::activate",script:Ob},Ee),ve.postMessage({type:"cms-editor::set-labels",labels:wt,kinds:Pt,keys:Zt},Ee))},wd=()=>{const ve=y.current?.contentWindow,Ee=rs;!ve||!Ee||ve.postMessage({type:"cms-editor::deactivate"},Ee)},Hi=ve=>{if(ve==="blocks"&&!f)return;const Ee=p;!n&&ve!==Ee&&(ve==="blocks"?w.current?.resize("30%"):w.current?.collapse()),ve!=="blocks"&&C(),m(ve),v(null),_(null),ve!=="blocks"&&G(null),Ee==="visual"&&bo(),ve==="visual"&&ha(),Ee==="blocks"&&ve!=="blocks"&&wd(),ve==="blocks"&&Ui()},vo=()=>{Hi(Koe(p,f))},yo=()=>{if(!y.current||!qs)return;ie();const ve=y.current;ve.src=qs};uz(()=>{const ve=y.current;if(!ve)return;ie();const Ee=document.activeElement,gt=ve.tabIndex;ve.tabIndex=-1,ve.style.pointerEvents="none",ve.blur(),Joe(ve,Dt.current);let St;const os=()=>{clearTimeout(St),ve.tabIndex=gt,ve.style.pointerEvents="";const mn=document.activeElement;(!mn||mn===document.body||mn===ve)&&Ee?.focus(),ve.removeEventListener("load",os)};ve.addEventListener("load",os),St=setTimeout(os,3e3)});const _o=()=>{const ve=sm.indexOf(g);x(sm[(ve+1)%sm.length])},Ki=(ve,Ee)=>{if(!Re)return;const gt=Re,St={...dt,[ve]:Ee};$e.current=Dr(te,St),oe(os=>({...os,[gt]:St})),hi({path:te,pageKey:gt,params:St})},kr=xse({iframeBase:Ie.iframeBase,resolvedPath:ut,activeGlobalSectionName:H?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Wi=ve=>{const Ee=Q[ve.key]??{},gt=Dr(ve.path,Ee);(H||rt(gt)!==rt(ut))&&ie(),$e.current=gt,W(null),G(null),Z(null),_(null),J(ve.key),X(ve.path),hi({path:ve.path,pageKey:ve.key,params:Ee}),l.selectTarget({kind:"page",key:ve.key,path:ve.path})},Lo=ve=>{if(!Pe||!Ne){ye.error(e("sandbox.preview.previewMetadataNotReady"));return}ie(),$e.current=null;const Ee=yf(Ne),gt=Mb(Pe,Ee,ve.key);W(ve),G(null),Z(gt),_(null),l.selectTarget({kind:"section",key:ve.key})},i1=ve=>{f&&(W(null),G(ve.key),Z(null),Hi("blocks"),l.selectTarget({kind:"loader",key:ve.key}))},wo=async({name:ve,path:Ee,templateKey:gt})=>{if(!t||!r)return;const St=U9(Ee);if(St){U(St);return}const os=Ee.trim().startsWith("/")?Ee.trim():`/${Ee.trim()}`;if(Oe.some(Gs=>rt(Gs.path)===rt(os))){U(e("sandbox.preview.pageAlreadyExists",{path:os}));return}let mn;if(gt&&(mn=we?.[gt],!mn)){U(e("sandbox.preview.templateNoLongerExists"));return}U(void 0);try{const Gs=await Fe.mutateAsync({name:ve,path:os,template:mn});z(!1),ye.success(e("sandbox.preview.pageCreated",{name:ve})),await dd(Goe),Wi({key:Gs.key,name:Gs.name,path:Gs.path}),Hi("blocks")}catch(Gs){U(Gs instanceof Error?Gs.message:e("sandbox.preview.failedToCreatePage"))}},jr=pt&&(xo||Ie.mode==="production"),So=bse({showPreviewToolbar:jr,contentEditingEnabled:u}),gi=jr?o.jsxs(o.Fragment,{children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx($o,{onClick:yo,"aria-label":e("sandbox.preview.refresh"),children:o.jsx(Dn,{size:16})})}),o.jsx(Ke,{side:"bottom",children:e("sandbox.preview.refresh")})]}),So?o.jsxs("div",{ref:B,className:"relative min-w-0 w-64 shrink",children:[o.jsxs("div",{className:"flex h-7 w-full min-w-0 items-center rounded-md border border-border bg-background transition-colors duration-200 hover:bg-accent",children:[o.jsxs("div",{className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1 pl-2 pr-1",onClick:()=>I(ve=>!ve),children:[H&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[o.jsx(Wr,{size:11}),"Global"]}),Ze&&o.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",children:[o.jsx(Ia,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:re("text-[13px] font-medium text-foreground",be==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:be??kr}),!H&&!K&&be!=null&&te&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:vf(te).map((ve,Ee)=>{if(ve.type==="text")return o.jsx("span",{className:re(Ee===0?"min-w-0 truncate":"shrink-0"),children:ve.text},`text-${Ee}`);const gt=ht[ve.name];return gt&&ct?o.jsx(ise,{sources:gt,template:te,paramName:ve.name,value:dt[ve.name]??"",sandboxRef:ct,onCommit:St=>Ki(ve.name,St)},`${Re}:${ve.name}`):o.jsx(pse,{name:ve.name,value:dt[ve.name]??"",onCommit:St=>Ki(ve.name,St)},`${Re}:${ve.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>I(ve=>!ve),"aria-label":e("sandbox.preview.choosePage"),"aria-expanded":E,children:o.jsx(hs,{size:12,className:re("shrink-0 text-muted-foreground transition-transform",E&&"rotate-180")})})]}),E&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(u0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:D,onChange:ve=>O(ve.target.value),onKeyDown:ve=>{if(ve.key!=="Enter")return;const Ee=D.trim();if(!Ee)return;const gt=st.find(St=>rt(St.path)===rt(Ee));gt&&(ve.preventDefault(),I(!1),O(""),Wi(gt))},placeholder:e("sandbox.preview.searchPagesAndComponents"),className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),o.jsx("div",{className:"p-1.5 border-b",children:o.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ve=>{ve.preventDefault(),I(!1),O(""),U(void 0),z(!0)},children:[o.jsx(Qt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),st.length===0&&ft.length===0&&mt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Oe.length===0&&yt.length===0&&_t.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[st.length>0&&o.jsx("div",{className:"p-1.5",children:st.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Ee=>{Ee.preventDefault(),I(!1),O(""),Wi(ve)},children:[o.jsx(zr,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.path})]},ve.key))}),ft.length>0&&o.jsxs("div",{className:re("p-1.5",st.length>0&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalComponents")}),ft.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Ee=>{Ee.preventDefault(),I(!1),O(""),Lo(ve)},children:[o.jsx(Wr,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]}),mt.length>0&&o.jsxs("div",{className:re("p-1.5",(st.length>0||ft.length>0)&&"border-t"),children:[o.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:e("sandbox.preview.globalLoaders")}),mt.map(ve=>o.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Ee=>{Ee.preventDefault(),I(!1),O(""),i1(ve)},children:[o.jsx(Ia,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ve.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ve.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ve.key))]})]})]})]}):o.jsx("span",{className:"min-w-0 truncate px-2 text-[13px] text-muted-foreground",children:kr}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx($o,{"aria-label":e(Lr),onClick:()=>{po()},children:o.jsx(hn,{size:16})})}),o.jsx(Ke,{side:"bottom",children:e(Lr)})]})]}):null,Cr=gi?o.jsx("div",{className:"flex min-w-0 items-center gap-0.5",children:gi}):null,ko=Ie.mode==="sandbox",xi=Yoe[g],bi=g==="desktop"&&(N.width===0||N.width>=xi.width+2*vv),Nr=bi?1:Math.min(N.width>0?N.width/(xi.width+2*vv):1,1),jo=bi?{width:"100%",height:"100%"}:{width:`${xi.width}px`,height:N.height>0?`${N.height/Nr}px`:`${xi.height}px`,transform:`scale(${Nr})`,transformOrigin:"top center"},Sd=pt?o.jsx("div",{className:"absolute bottom-4 left-1/2 z-20 -translate-x-1/2 scale-125",children:o.jsxs("div",{className:"flex items-center gap-0.5 rounded-full border bg-background/60 p-1 shadow-lg backdrop-blur-md",children:[ko&&o.jsxs(o.Fragment,{children:[o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx($o,{onClick:vo,"aria-pressed":Es==="visual","aria-label":e("sandbox.preview.visualEditor"),active:Es==="visual",className:"rounded-full",children:o.jsx(ex,{size:16})})}),o.jsx(Ke,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx($o,{onClick:_o,"aria-label":e(yv[g]),className:"rounded-full",children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[g==="mobile"&&o.jsx(fA,{size:16}),g==="tablet"&&o.jsx(mA,{size:16}),g==="desktop"&&o.jsx(pA,{size:16})]},g)})}),o.jsx(Ke,{side:"top",children:e(yv[g])})]})]})}):null,Co=!!K&&Es==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[ct&&Object.entries(ht).map(([ve,Ee])=>(dt[ve]??"")===""?o.jsx(fse,{sources:Ee,template:te,paramName:ve,sandboxRef:ct,onFill:gt=>Ki(ve,gt)},`${Re}:${ve}`):null),i?Cr&&o.jsx(GZ,{children:Cr}):gi&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex-1"}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:gi}),o.jsx("div",{className:"flex-1"})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:Co?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(xv,{virtualMcpId:t,externalSelection:L,onViewJsonFile:V}),S&&Re&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(bv,{ref:j,virtualMcpId:t,pageKey:Re,onClose:C})})]}):o.jsxs(np,{orientation:"horizontal",disabled:Es!=="blocks",children:[o.jsx(Ac,{ref:w,id:"preview-blocks-editor",defaultSize:Es==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Es==="blocks"&&o.jsx(xv,{virtualMcpId:t,externalSelection:L,onViewJsonFile:V})}),Es==="blocks"&&o.jsx(ip,{withHandle:!0}),o.jsx(Ac,{id:"preview-canvas",defaultSize:Es==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(np,{orientation:"horizontal",disabled:!(S&&Re),children:[S&&Re&&o.jsxs(o.Fragment,{children:[o.jsx(Ac,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(bv,{ref:j,virtualMcpId:t,pageKey:Re,onClose:C})}),o.jsx(ip,{withHandle:!0})]}),o.jsx(Ac,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:ve=>{if(!ve)return;const Ee=()=>A(St=>St.width===ve.clientWidth&&St.height===ve.clientHeight?St:{width:ve.clientWidth,height:ve.clientHeight});Ee();const gt=new ResizeObserver(Ee);return gt.observe(ve),()=>gt.disconnect()},className:re("h-full relative overflow-clip flex justify-center",pt&&!bi&&"bg-muted/30"),children:[(le||xe)&&pt&&o.jsx("div",{className:"absolute inset-x-0 top-0 z-40 h-1 overflow-hidden",children:o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-r-full bg-brand shadow-[0_0_6px] shadow-brand/60 animate-preview-ramp"})}),Ie.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"starting",progress:Ye,claimPhase:Se})}),ot.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"suspended",onResume:ne.resume})}),ot.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(zc,{kind:"errored",error:ot.error,onRetry:ne.retry,connectionsHref:`/${ue.slug}/settings/connections`})}),Ie.showWakingPill&&o.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 border border-border bg-muted px-4 py-3 shadow-lg pointer-events-none select-none",children:[o.jsx(et,{className:"size-4.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:e("sandbox.preview.startingPreview")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:e("sandbox.preview.startingPreviewHint")})]})]}),Es==="visual"&&!b&&o.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-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[o.jsx(ex,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Es==="visual"&&b&&o.jsx(gte,{element:b,onDismiss:()=>v(null)}),Sd,pt&&qs&&o.jsx("div",{className:re("shrink-0",!bi&&"border-x border-border bg-background shadow-sm"),style:jo,children:o.jsx("iframe",{ref:y,src:qs,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:mi.handleError,onLoad:()=>{if(mi.handleLoad(),he(),Ie.mode!=="sandbox"){Ie.mode==="production"&&!Ie.showWakingPill&&Es==="blocks"&&Ui();return}if(qe("vm_preview_loaded",{view_mode:Es,vm_id:q?.sandboxHandle??null}),!H)try{const ve=y.current?.contentWindow?.location?.pathname;if(!ve)return;const Ee=$e.current;if(Ee!==null&&($e.current=null,rt(ve)!==rt(Ee))||rt(ve)===rt(ut))return;X(ve),hi({path:ve,pageKey:ee,params:dt})}catch{}Es==="visual"&&ha(),Es==="blocks"&&Ui()}},Ie.iframeBase)})]})})]})})]})}),o.jsx(Lse,{open:M,onOpenChange:z,isPending:Fe.isPending,error:$,templates:Oe,onSubmit:wo})]})}function eae(t){const e=F.c(22),{virtualMcpId:s}=t,n=ae(),i=As(s),{activeTask:r,taskId:a,currentBranch:l}=on(),c=oL(a),[d,h]=T.useState(!1);if(aL({threadId:a,sandboxBranch:r?.branch??l,agentHasRepo:xn(i?.metadata),threadHasRepo:xn(c)||xn(r?.metadata)})==="none"){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(ur,{className:"size-7 text-foreground"})}),e[0]=p):p=e[0];let m;e[1]!==n?(m=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=m):m=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>h(!0),b=o.jsx(ur,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let v;e[7]!==n?(v=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=v):v=e[8];let L;e[9]!==v?(L=o.jsxs(me,{onClick:x,children:[b,v]}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==m||e[12]!==g||e[13]!==L?(_=o.jsx(Ti,{className:"h-full",image:p,title:m,description:g,actions:L}),e[11]=m,e[12]=g,e[13]=L,e[14]=_):_=e[14];let y;e[15]!==d?(y=o.jsx(d0,{open:d,onOpenChange:h,mode:"agent"}),e[15]=d,e[16]=y):y=e[16];let w;return e[17]!==_||e[18]!==y?(w=o.jsxs(o.Fragment,{children:[_,y]}),e[17]=_,e[18]=y,e[19]=w):w=e[19],w}let f;return e[20]!==s?(f=o.jsx(Zoe,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}function tae(t){const e=F.c(14),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,enabled:a}=t,l=a===void 0?!0:a;let c;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c=tt.sandboxRepoDir(s,n,i,r),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s||e[7]!==r||e[8]!==n?(d=async()=>{const f=no({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},"config"),p=await fetch(f);return p.ok?(await p.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=r,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==l||e[11]!==c||e[12]!==d?(h={queryKey:c,queryFn:d,enabled:l,staleTime:1/0},e[10]=l,e[11]=c,e[12]=d,e[13]=h):h=e[13],Yt(h).data??null}const sae=T.lazy(()=>Ws(()=>import("./file-explorer-HB3Kjc_j.js"),__vite__mapDeps([168,1,2,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,98,101,92,102,103,104,105,106,107,108,109,110,111,74,149,147,96,142,115,81,82,83,84,85,86,87,88,89,90,91,93,94,95,97,99,100,112,113,114,78,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,143,144,145,146,148,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.FileExplorer})));function nae(t){const e=F.c(26),{openPath:s}=t,n=ae(),i=ho(),{org:r}=Ue(),{currentBranch:a,taskId:l}=on(),c=i?.entity?.id??null,d=ld(),h=la(),u=ci();h.vmEntry,u.lifecycle.phase;const f=d,p=c??"",m=a??"",g=l??null,x=f;let b;e[0]!==r.slug||e[1]!==p||e[2]!==m||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:p,branch:m,threadId:g,enabled:x},e[0]=r.slug,e[1]=p,e[2]=m,e[3]=g,e[4]=x,e[5]=b):b=e[5],tae(b);const v=null;if(!c||!a){let k;e[6]!==n?(k=n("mainPanelTabs.codeTab.noSandboxToBrowse"),e[6]=n,e[7]=k):k=e[7];let j;e[8]!==n?(j=n("mainPanelTabs.codeTab.noSandboxToBrowseDescription"),e[8]=n,e[9]=j):j=e[9];let C;return e[10]!==k||e[11]!==j?(C=o.jsx(Ti,{className:"h-full",title:k,description:j}),e[10]=k,e[11]=j,e[12]=C):C=e[12],C}let L;e[13]!==v||e[14]!==n?(L=v,e[13]=v,e[14]=n,e[15]=L):L=e[15];let _;e[16]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})}),e[16]=_):_=e[16];const y=l??null;let w;e[17]!==a||e[18]!==s||e[19]!==r.slug||e[20]!==y||e[21]!==c?(w=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(T.Suspense,{fallback:_,children:o.jsx(sae,{orgSlug:r.slug,virtualMcpId:c,branch:a,threadId:y,openPath:s})})}),e[17]=a,e[18]=s,e[19]=r.slug,e[20]=y,e[21]=c,e[22]=w):w=e[22];let S;return e[23]!==L||e[24]!==w?(S=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[L,w]}),e[23]=L,e[24]=w,e[25]=S):S=e[25],S}function iae(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([n])=>!e.includes(n)));return Object.keys(s).length>0?{...t,properties:s}:t}function rae(t,e,s){return typeof t!="string"?null:iae(In(t,e),s)}function xj(t,e,s){if(!e||typeof t!="string")return!1;const n=rae(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function oae({orgSlug:t,virtualMcpId:e,branch:s}){const n=Vs(),i=Ts()?.taskId??null,r=N0(e),a=_n(e).runtime==="cms";return Ds({mutationKey:rf(t,e,s),mutationFn:async({blockKey:l})=>{if(a){const h=await N_({orgSlug:t,virtualMcpId:e,branch:s},{delete:[l]});return Hg(n,{orgSlug:t,virtualMcpId:e,branch:s},h),await n.invalidateQueries({queryKey:j0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=C0(r,G8(l)),d=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:c})});return d.ok?d.json():S9(d,"Delete")},onMutate:async({blockKey:l})=>{const c=`${t}/${e}/${s}`,d=tt.decofile(c);await n.cancelQueries({queryKey:d});const h=n.getQueryData(d),u=!!h&&l in h,f=h?.[l];return n.setQueryData(d,p=>{if(!p)return p;const{[l]:m,...g}=p;return g}),{queryKey:d,blockKey:l,hadKey:u,previousValue:f}},onError:(l,c,d)=>{d&&n.setQueryData(d.queryKey,h=>d.hadKey?{...h??{},[d.blockKey]:d.previousValue}:h)},onSuccess:()=>{n.invalidateQueries({queryKey:tt.liveMeta(t,e,s)})}})}function wc(t){const e=F.c(6),{hasItems:s,emptyLabel:n,emptyHint:i}=t;let r;e[0]!==i||e[1]!==n||e[2]!==s?(r=s?"No results match your search.":o.jsxs(o.Fragment,{children:[o.jsx("div",{children:n}),o.jsx("div",{className:"mt-1 text-muted-foreground/80",children:i})]}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3];let a;return e[4]!==r?(a=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=a):a=e[5],a}function X9(t,e){return`${t}-${e}`}function bj(t,e){return`site/apps/${t}/${e}.ts`}function vj(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function aae(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function lae(t){return t==="local"?"Custom":"Installed"}function yj(t,e,s){const n=new Set([X9(t,e),e].map(r=>r.toLowerCase())),i=bj(t,e);for(const[r,a]of Object.entries(s)){if(r.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(n.has(r.toLowerCase())||l.__resolveType===i)return r}return null}function cae(t,e){const s=t.vendor.alias,n=t.name,i=yj(s,n,e);return{id:X9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:bj(s,n),blockKey:i,installed:i!==null}}function dae(t,e,s){if(t===G3)return null;const n=vj(t);if(!n)return null;const{vendor:i,app:r}=n,a=yj(i,r,s),l=da(t,e);return{id:X9(i,r),app:r,vendor:i,title:l.title??r,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function uae(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Zc(t,e)||!VS(n))return null;const i=vj(n)??aae(t);if(!i)return null;const r=da(n,s),{vendor:a,app:l}=i;return{id:X9(a,l),app:l,vendor:a,title:r.title??Sf(t,e,s),description:r.description??"",category:lae(a),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function hae(t,e,s){const n=new Map;for(const r of t){const a=cae(r,s);n.set(a.id,a)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const a=dae(r,e,s);!a||n.has(a.id)||n.set(a.id,a)}for(const[r,a]of Object.entries(s)){if(r.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=uae(r,a,e);!l||n.has(l.id)||n.set(l.id,l)}return[...n.values()].sort(fae)}function fae(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function mae(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function pae(t,e,s){const n=F.c(12),i=s?.enabled??!0;let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=tt.decoApps(),n[0]=r):r=n[0];let a;n[1]!==i?(a={queryKey:r,queryFn:mae,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=a):a=n[2];const l=Yt(a);let c;n[3]!==e||n[4]!==t||n[5]!==l.data?(c=t&&e?hae(l.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=l.data,n[6]=c):c=n[6];const d=c,h=l.isLoading&&!l.isError;let u;return n[7]!==d||n[8]!==l.isError||n[9]!==l.refetch||n[10]!==h?(u={catalog:d,isLoading:h,isError:l.isError,refetch:l.refetch},n[7]=d,n[8]=l.isError,n[9]=l.refetch,n[10]=h,n[11]=u):u=n[11],u}const gae=["sections","apps","loaders","actions"];function xae(t){const e=F.c(59),{active:s,counts:n,showBlog:i,onSelect:r}=t,a=ae();let l;e[0]!==a?(l=a("sandbox.collectionsSidebar.content"),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:o.jsx("span",{className:"text-sm font-medium",children:l})}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==a?(d=a("sandbox.collectionsSidebar.pages"),e[4]=a,e[5]=d):d=e[5];const h=s==="pages";let u;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==h?(u=o.jsx(zn,{id:"pages",icon:zr,label:d,count:n.pages,active:h,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=h,e[10]=u):u=e[10];let f;e[11]!==a?(f=a("sandbox.collectionsSidebar.redirects"),e[11]=a,e[12]=f):f=e[12];const p=s==="redirects";let m;e[13]!==n.redirects||e[14]!==r||e[15]!==f||e[16]!==p?(m=o.jsx(zn,{id:"redirects",icon:l8,label:f,count:n.redirects,active:p,onSelect:r}),e[13]=n.redirects,e[14]=r,e[15]=f,e[16]=p,e[17]=m):m=e[17];let g;e[18]!==a?(g=a("sandbox.collectionsSidebar.site"),e[18]=a,e[19]=g):g=e[19];const x=s==="site";let b;e[20]!==r||e[21]!==x||e[22]!==g?(b=o.jsx(zn,{id:"site",icon:q6,label:g,active:x,onSelect:r}),e[20]=r,e[21]=x,e[22]=g,e[23]=b):b=e[23];let v;e[24]!==a?(v=a("sandbox.collectionsSidebar.seo"),e[24]=a,e[25]=v):v=e[25];const L=s==="seo";let _;e[26]!==r||e[27]!==v||e[28]!==L?(_=o.jsx(zn,{id:"seo",icon:c8,label:v,active:L,onSelect:r}),e[26]=r,e[27]=v,e[28]=L,e[29]=_):_=e[29];let y;e[30]!==a?(y=a("sandbox.collectionsSidebar.calendar"),e[30]=a,e[31]=y):y=e[31];const w=s==="calendar";let S;e[32]!==r||e[33]!==y||e[34]!==w?(S=o.jsx(zn,{id:"calendar",icon:od,label:y,active:w,onSelect:r}),e[32]=r,e[33]=y,e[34]=w,e[35]=S):S=e[35];let k;e[36]!==s||e[37]!==n||e[38]!==r?(k=o.jsx(bae,{active:s,counts:n,onSelect:r}),e[36]=s,e[37]=n,e[38]=r,e[39]=k):k=e[39];let j;e[40]!==s||e[41]!==n.authors||e[42]!==n.categories||e[43]!==n.posts||e[44]!==r||e[45]!==i||e[46]!==a?(j=i&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[o.jsx(Hc,{size:13,className:"shrink-0"}),a("sandbox.collectionsSidebar.blog")]}),o.jsx(zn,{id:"posts",icon:Ai,label:a("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(zn,{id:"authors",icon:v9,label:a("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(zn,{id:"categories",icon:eg,label:a("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(zn,{id:"post-schedule",icon:gA,label:a("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:r})]}),e[40]=s,e[41]=n.authors,e[42]=n.categories,e[43]=n.posts,e[44]=r,e[45]=i,e[46]=a,e[47]=j):j=e[47];let C;e[48]!==b||e[49]!==_||e[50]!==S||e[51]!==k||e[52]!==j||e[53]!==u||e[54]!==m?(C=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,m,b,_,S,k,j]}),e[48]=b,e[49]=_,e[50]=S,e[51]=k,e[52]=j,e[53]=u,e[54]=m,e[55]=C):C=e[55];let V;return e[56]!==c||e[57]!==C?(V=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,C]}),e[56]=c,e[57]=C,e[58]=V):V=e[58],V}function bae(t){const e=F.c(52),{active:s,counts:n,onSelect:i}=t,r=ae();let a;e[0]!==s?(a=gae.includes(s),e[0]=s,e[1]=a):a=e[1];const l=a,[c,d]=T.useState(!1),h=c||l;let u,f;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=re("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer","text-muted-foreground hover:bg-muted hover:text-foreground"),f=o.jsx(xA,{size:16,className:"shrink-0"}),e[2]=u,e[3]=f):(u=e[2],f=e[3]);let p;e[4]!==r?(p=r("sandbox.collectionsSidebar.advanced"),e[4]=r,e[5]=p):p=e[5];let m;e[6]!==p?(m=o.jsx("span",{className:"flex-1 truncate",children:p}),e[6]=p,e[7]=m):m=e[7];const g=h&&"rotate-180";let x;e[8]!==g?(x=re("shrink-0 text-muted-foreground/70 transition-transform",g),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==x?(b=o.jsx(hs,{size:16,className:x}),e[10]=x,e[11]=b):b=e[11];let v;e[12]!==m||e[13]!==b?(v=o.jsxs($2,{className:u,children:[f,m,b]}),e[12]=m,e[13]=b,e[14]=v):v=e[14];let L;e[15]!==r?(L=r("sandbox.collectionsSidebar.sections"),e[15]=r,e[16]=L):L=e[16];const _=s==="sections";let y;e[17]!==n.sections||e[18]!==i||e[19]!==L||e[20]!==_?(y=o.jsx(zn,{id:"sections",icon:Wr,label:L,count:n.sections,active:_,onSelect:i,indent:!0}),e[17]=n.sections,e[18]=i,e[19]=L,e[20]=_,e[21]=y):y=e[21];let w;e[22]!==r?(w=r("sandbox.collectionsSidebar.apps"),e[22]=r,e[23]=w):w=e[23];const S=s==="apps";let k;e[24]!==n.apps||e[25]!==i||e[26]!==w||e[27]!==S?(k=o.jsx(zn,{id:"apps",icon:_8,label:w,count:n.apps,active:S,onSelect:i,indent:!0}),e[24]=n.apps,e[25]=i,e[26]=w,e[27]=S,e[28]=k):k=e[28];let j;e[29]!==r?(j=r("sandbox.collectionsSidebar.loaders"),e[29]=r,e[30]=j):j=e[30];const C=s==="loaders";let V;e[31]!==n.loaders||e[32]!==i||e[33]!==j||e[34]!==C?(V=o.jsx(zn,{id:"loaders",icon:Ia,label:j,count:n.loaders,active:C,onSelect:i,indent:!0}),e[31]=n.loaders,e[32]=i,e[33]=j,e[34]=C,e[35]=V):V=e[35];let N;e[36]!==r?(N=r("sandbox.collectionsSidebar.actions"),e[36]=r,e[37]=N):N=e[37];const A=s==="actions";let P;e[38]!==n.actions||e[39]!==i||e[40]!==N||e[41]!==A?(P=o.jsx(zn,{id:"actions",icon:hr,label:N,count:n.actions,active:A,onSelect:i,indent:!0}),e[38]=n.actions,e[39]=i,e[40]=N,e[41]=A,e[42]=P):P=e[42];let R;e[43]!==y||e[44]!==k||e[45]!==V||e[46]!==P?(R=o.jsxs(B2,{className:"flex flex-col gap-0.5 pt-0.5",children:[y,k,V,P]}),e[43]=y,e[44]=k,e[45]=V,e[46]=P,e[47]=R):R=e[47];let E;return e[48]!==h||e[49]!==R||e[50]!==v?(E=o.jsxs(z2,{open:h,onOpenChange:d,children:[v,R]}),e[48]=h,e[49]=R,e[50]=v,e[51]=E):E=e[51],E}function zn(t){const e=F.c(19),{id:s,icon:n,label:i,count:r,active:a,onSelect:l,indent:c}=t;let d;e[0]!==s||e[1]!==l?(d=()=>l(s),e[0]=s,e[1]=l,e[2]=d):d=e[2];const h=c&&"pl-6",u=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let f;e[3]!==h||e[4]!==u?(f=re("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",h,u),e[3]=h,e[4]=u,e[5]=f):f=e[5];let p;e[6]!==n?(p=o.jsx(n,{size:16,className:"shrink-0"}),e[6]=n,e[7]=p):p=e[7];let m;e[8]!==i?(m=o.jsx("span",{className:"flex-1 truncate",children:i}),e[8]=i,e[9]=m):m=e[9];let g;e[10]!==a||e[11]!==r?(g=r!==void 0&&o.jsx("span",{className:re("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:r}),e[10]=a,e[11]=r,e[12]=g):g=e[12];let x;return e[13]!==d||e[14]!==f||e[15]!==p||e[16]!==m||e[17]!==g?(x=o.jsxs("button",{type:"button",onClick:d,className:f,children:[p,m,g]}),e[13]=d,e[14]=f,e[15]=p,e[16]=m,e[17]=g,e[18]=x):x=e[18],x}function vae(t){const e=F.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:r,connectionsHref:a}=t;switch(s.kind){case"starting":{let l;e[0]!==n||e[1]!==i?(l=rk({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=l):l=e[2];let c;return e[3]!==n||e[4]!==l?(c=o.jsx(zc,{kind:"starting",progress:l,claimPhase:n}),e[3]=n,e[4]=l,e[5]=c):c=e[5],c}case"suspended":{let l;return e[6]!==r?(l=o.jsx(zc,{kind:"suspended",onResume:r}),e[6]=r,e[7]=l):l=e[7],l}case"errored":{let l;return e[8]!==a||e[9]!==r||e[10]!==s.error?(l=o.jsx(zc,{kind:"errored",error:s.error,onRetry:r,connectionsHref:a}),e[8]=a,e[9]=r,e[10]=s.error,e[11]=l):l=e[11],l}}}const yae=new Set(["clone-failed","install-failed","start-failed","crashed"]);function _ae(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!yae.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Lv(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),n=`${s} (copy)`;if(!t.has(n))return n;for(let i=2;i<1e3;i++){const r=`${s} (copy ${i})`;if(!t.has(r))return r}return`${s} (copy ${Date.now()})`}function Lae(t,e){const s=Ko,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let r=2;r<1e3;r++){const a=`${n}-copy-${r}`;if(!t.has(s(a)))return a}return`${n}-copy-${Date.now()}`}function wae(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),n=`${s}_copy`;if(!Object.hasOwn(t,n))return n;for(let i=2;i<1e3;i++){const r=`${s}_copy_${i}`;if(!Object.hasOwn(t,r))return r}return`${s}_copy_${Date.now()}`}function Sae(t){const e=s4(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function kae(t,e){return uk(t,e)}const jae=1e3;function Cae(t,e){for(let s=0;s<jae;s++){const n=s4(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Nae={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Vae={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Tae={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Aae(t){const e=F.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:a,error:l,templates:c,validate:d,onSubmit:h,onOpenChange:u}=t,f=a===void 0?!1:a,p=ae(),[m,g]=T.useState(i),[x,b]=T.useState(r),[v,L]=T.useState(Wo),[_,y]=T.useState(null),[w,S]=T.useState(s);s!==w&&(S(s),s&&(g(i),b(r),L(Wo),y(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==u?(j=he=>{!he&&!f&&(y(null),u(!1))},e[0]=f,e[1]=u,e[2]=j):j=e[2];const C=j;let V;e[3]!==f||e[4]!==m||e[5]!==h||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(V=async he=>{he.preventDefault();const ue=m.trim(),ce=x.trim();if(!ue||!ce||f)return;const ne=U9(ce);if(ne){y(ne);return}const q=d?.({name:ue,path:ce});if(q){y(q);return}y(null),await h({name:ue,path:ce,templateKey:k&&v!==Wo?v:null})},e[3]=f,e[4]=m,e[5]=h,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=V):V=e[10];const N=V,A=_??l,P=Nae[n];let R;e[11]!==p||e[12]!==P?(R=p(P),e[11]=p,e[12]=P,e[13]=R):R=e[13];let E;e[14]!==R?(E=o.jsx(cs,{children:o.jsx(Kt,{children:R})}),e[14]=R,e[15]=E):E=e[15];let I;e[16]!==f||e[17]!==k||e[18]!==p||e[19]!==v||e[20]!==c?(I=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:p("sandbox.pageFormDialog.labelTemplate")}),o.jsx(hk,{id:"page-form-template",value:v,onChange:L,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=p,e[19]=v,e[20]=c,e[21]=I):I=e[21];let D;e[22]!==p?(D=p("sandbox.pageFormDialog.labelName"),e[22]=p,e[23]=D):D=e[23];let O;e[24]!==D?(O=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:D}),e[24]=D,e[25]=O):O=e[25];let B;e[26]===Symbol.for("react.memo_cache_sentinel")?(B=he=>g(he.target.value),e[26]=B):B=e[26];let M;e[27]!==p?(M=p("sandbox.pageFormDialog.placeholderName"),e[27]=p,e[28]=M):M=e[28];let z;e[29]!==f||e[30]!==m||e[31]!==M?(z=o.jsx(vt,{id:"page-form-name",value:m,onChange:B,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=m,e[31]=M,e[32]=z):z=e[32];let $;e[33]!==z||e[34]!==O?($=o.jsxs("div",{className:"space-y-1.5",children:[O,z]}),e[33]=z,e[34]=O,e[35]=$):$=e[35];let U;e[36]!==p?(U=p("sandbox.pageFormDialog.labelPath"),e[36]=p,e[37]=U):U=e[37];let H;e[38]!==U?(H=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=H):H=e[39];let W;e[40]===Symbol.for("react.memo_cache_sentinel")?(W=he=>b(he.target.value),e[40]=W):W=e[40];let K;e[41]!==p?(K=p("sandbox.pageFormDialog.placeholderPath"),e[41]=p,e[42]=K):K=e[42];let G;e[43]!==f||e[44]!==x||e[45]!==K?(G=o.jsx(vt,{id:"page-form-path",value:x,onChange:W,placeholder:K,disabled:f}),e[43]=f,e[44]=x,e[45]=K,e[46]=G):G=e[46];let Y;e[47]!==H||e[48]!==G?(Y=o.jsxs("div",{className:"space-y-1.5",children:[H,G]}),e[47]=H,e[48]=G,e[49]=Y):Y=e[49];let Z;e[50]!==A?(Z=A&&o.jsx("p",{className:"text-xs text-destructive",children:A}),e[50]=A,e[51]=Z):Z=e[51];let te;e[52]!==$||e[53]!==Y||e[54]!==Z||e[55]!==I?(te=o.jsxs("div",{className:"space-y-4 py-4",children:[I,$,Y,Z]}),e[52]=$,e[53]=Y,e[54]=Z,e[55]=I,e[56]=te):te=e[56];let X;e[57]!==u?(X=()=>u(!1),e[57]=u,e[58]=X):X=e[58];let ee;e[59]!==p?(ee=p("sandbox.pageFormDialog.buttonCancel"),e[59]=p,e[60]=ee):ee=e[60];let J;e[61]!==f||e[62]!==X||e[63]!==ee?(J=o.jsx(me,{type:"button",variant:"outline",onClick:X,disabled:f,children:ee}),e[61]=f,e[62]=X,e[63]=ee,e[64]=J):J=e[64];let Q;e[65]!==f||e[66]!==m||e[67]!==x?(Q=!m.trim()||!x.trim()||f,e[65]=f,e[66]=m,e[67]=x,e[68]=Q):Q=e[68];let oe;e[69]!==f||e[70]!==n||e[71]!==p?(oe=f?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),p(Tae[n])]}):p(Vae[n]),e[69]=f,e[70]=n,e[71]=p,e[72]=oe):oe=e[72];let le;e[73]!==Q||e[74]!==oe?(le=o.jsx(me,{type:"submit",disabled:Q,children:oe}),e[73]=Q,e[74]=oe,e[75]=le):le=e[75];let de;e[76]!==J||e[77]!==le?(de=o.jsxs(qn,{children:[J,le]}),e[76]=J,e[77]=le,e[78]=de):de=e[78];let se;e[79]!==N||e[80]!==te||e[81]!==de||e[82]!==E?(se=o.jsx(zt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[E,te,de]})}),e[79]=N,e[80]=te,e[81]=de,e[82]=E,e[83]=se):se=e[83];let ie;return e[84]!==C||e[85]!==s||e[86]!==se?(ie=o.jsx(Ft,{open:s,onOpenChange:C,children:se}),e[84]=C,e[85]=s,e[86]=se,e[87]=ie):ie=e[87],ie}const Pae=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],wv={from:"",to:"",type:"temporary",discardQueryParameters:!1};function Eae(t){const e=F.c(111),{open:s,isPending:n,error:i,onSubmit:r,onOpenChange:a}=t,l=n===void 0?!1:n,c=ae(),[d,h]=T.useState(wv),[u,f]=T.useState(null),[p,m]=T.useState(s);s!==p&&(m(s),s&&(h(wv),f(null)));let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=je=>h(Ce=>({...Ce,...je})),e[0]=g):g=e[0];const x=g;let b;e[1]!==l||e[2]!==a?(b=je=>{!je&&!l&&(f(null),a(!1))},e[1]=l,e[2]=a,e[3]=b):b=e[3];const v=b;let L;e[4]!==l||e[5]!==r||e[6]!==d||e[7]!==c?(L=async je=>{je.preventDefault();const Ce=d.from.trim(),Pe=d.to.trim();if(!Ce||!Pe||l){f(c("sandbox.redirectFormDialog.errorRequired"));return}f(null),await r({...d,from:Ce,to:Pe})},e[4]=l,e[5]=r,e[6]=d,e[7]=c,e[8]=L):L=e[8];const _=L,y=u??i;let w;e[9]!==l||e[10]!==d.from||e[11]!==d.to?(w=!!d.from.trim()&&!!d.to.trim()&&!l,e[9]=l,e[10]=d.from,e[11]=d.to,e[12]=w):w=e[12];const S=w;let k;e[13]!==c?(k=c("sandbox.redirectFormDialog.title"),e[13]=c,e[14]=k):k=e[14];let j;e[15]!==k?(j=o.jsx(cs,{children:o.jsx(Kt,{children:k})}),e[15]=k,e[16]=j):j=e[16];let C;e[17]!==c?(C=c("sandbox.redirectEditor.fromLabel"),e[17]=c,e[18]=C):C=e[18];let V;e[19]!==C?(V=o.jsx(Mt,{htmlFor:"redirect-form-from",children:C}),e[19]=C,e[20]=V):V=e[20];const N=d.from;let A;e[21]===Symbol.for("react.memo_cache_sentinel")?(A=je=>x({from:je.target.value}),e[21]=A):A=e[21];let P;e[22]!==c?(P=c("sandbox.redirectEditor.fromPlaceholder"),e[22]=c,e[23]=P):P=e[23];let R;e[24]!==l||e[25]!==d.from||e[26]!==P?(R=o.jsx(vt,{id:"redirect-form-from",value:N,onChange:A,placeholder:P,autoFocus:!0,disabled:l}),e[24]=l,e[25]=d.from,e[26]=P,e[27]=R):R=e[27];let E;e[28]!==R||e[29]!==V?(E=o.jsxs("div",{className:"space-y-1.5",children:[V,R]}),e[28]=R,e[29]=V,e[30]=E):E=e[30];let I;e[31]!==c?(I=c("sandbox.redirectEditor.toLabel"),e[31]=c,e[32]=I):I=e[32];let D;e[33]!==I?(D=o.jsx(Mt,{htmlFor:"redirect-form-to",children:I}),e[33]=I,e[34]=D):D=e[34];const O=d.to;let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=je=>x({to:je.target.value}),e[35]=B):B=e[35];let M;e[36]!==c?(M=c("sandbox.redirectEditor.toPlaceholder"),e[36]=c,e[37]=M):M=e[37];let z;e[38]!==l||e[39]!==d.to||e[40]!==M?(z=o.jsx(vt,{id:"redirect-form-to",value:O,onChange:B,placeholder:M,disabled:l}),e[38]=l,e[39]=d.to,e[40]=M,e[41]=z):z=e[41];let $;e[42]!==D||e[43]!==z?($=o.jsxs("div",{className:"space-y-1.5",children:[D,z]}),e[42]=D,e[43]=z,e[44]=$):$=e[44];let U;e[45]!==c?(U=c("sandbox.redirectEditor.typeLabel"),e[45]=c,e[46]=U):U=e[46];let H;e[47]!==U?(H=o.jsx(Mt,{htmlFor:"redirect-form-type",children:U}),e[47]=U,e[48]=H):H=e[48];const W=d.type;let K;e[49]===Symbol.for("react.memo_cache_sentinel")?(K=je=>x({type:je}),e[49]=K):K=e[49];let G;e[50]!==c?(G=c("sandbox.redirectEditor.typePlaceholder"),e[50]=c,e[51]=G):G=e[51];let Y;e[52]!==G?(Y=o.jsx(bs,{id:"redirect-form-type",className:"w-full",children:o.jsx(Ss,{placeholder:G})}),e[52]=G,e[53]=Y):Y=e[53];let Z;e[54]!==c?(Z=Pae.map(je=>o.jsx(Rt,{value:je.value,children:c(je.labelKey,{status:IS[je.value]})},je.value)),e[54]=c,e[55]=Z):Z=e[55];let te;e[56]!==Z?(te=o.jsx(vs,{children:Z}),e[56]=Z,e[57]=te):te=e[57];let X;e[58]!==l||e[59]!==d.type||e[60]!==Y||e[61]!==te?(X=o.jsxs(xs,{value:W,onValueChange:K,disabled:l,children:[Y,te]}),e[58]=l,e[59]=d.type,e[60]=Y,e[61]=te,e[62]=X):X=e[62];let ee;e[63]!==H||e[64]!==X?(ee=o.jsxs("div",{className:"space-y-1.5",children:[H,X]}),e[63]=H,e[64]=X,e[65]=ee):ee=e[65];let J;e[66]===Symbol.for("react.memo_cache_sentinel")?(J=je=>x({discardQueryParameters:je===!0}),e[66]=J):J=e[66];let Q;e[67]!==l||e[68]!==d.discardQueryParameters?(Q=o.jsx(rl,{checked:d.discardQueryParameters,disabled:l,onCheckedChange:J}),e[67]=l,e[68]=d.discardQueryParameters,e[69]=Q):Q=e[69];let oe;e[70]!==c?(oe=c("sandbox.redirectEditor.discardQueryParameters"),e[70]=c,e[71]=oe):oe=e[71];let le;e[72]!==oe?(le=o.jsx("span",{className:"text-sm",children:oe}),e[72]=oe,e[73]=le):le=e[73];let de;e[74]!==Q||e[75]!==le?(de=o.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[Q,le]}),e[74]=Q,e[75]=le,e[76]=de):de=e[76];let se;e[77]!==y?(se=y&&o.jsx("p",{className:"text-xs text-destructive",children:y}),e[77]=y,e[78]=se):se=e[78];let ie;e[79]!==E||e[80]!==$||e[81]!==ee||e[82]!==de||e[83]!==se?(ie=o.jsxs("div",{className:"space-y-4 py-4",children:[E,$,ee,de,se]}),e[79]=E,e[80]=$,e[81]=ee,e[82]=de,e[83]=se,e[84]=ie):ie=e[84];let he;e[85]!==a?(he=()=>a(!1),e[85]=a,e[86]=he):he=e[86];let ue;e[87]!==c?(ue=c("sandbox.redirectFormDialog.cancel"),e[87]=c,e[88]=ue):ue=e[88];let ce;e[89]!==l||e[90]!==he||e[91]!==ue?(ce=o.jsx(me,{type:"button",variant:"outline",onClick:he,disabled:l,children:ue}),e[89]=l,e[90]=he,e[91]=ue,e[92]=ce):ce=e[92];const ne=!S;let q;e[93]!==l||e[94]!==c?(q=l?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),c("sandbox.redirectFormDialog.pending")]}):c("sandbox.redirectFormDialog.submit"),e[93]=l,e[94]=c,e[95]=q):q=e[95];let fe;e[96]!==ne||e[97]!==q?(fe=o.jsx(me,{type:"submit",disabled:ne,children:q}),e[96]=ne,e[97]=q,e[98]=fe):fe=e[98];let ge;e[99]!==ce||e[100]!==fe?(ge=o.jsxs(qn,{children:[ce,fe]}),e[99]=ce,e[100]=fe,e[101]=ge):ge=e[101];let _e;e[102]!==_||e[103]!==ie||e[104]!==ge||e[105]!==j?(_e=o.jsx(zt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:_,children:[j,ie,ge]})}),e[102]=_,e[103]=ie,e[104]=ge,e[105]=j,e[106]=_e):_e=e[106];let Le;return e[107]!==v||e[108]!==s||e[109]!==_e?(Le=o.jsx(Ft,{open:s,onOpenChange:v,children:_e}),e[107]=v,e[108]=s,e[109]=_e,e[110]=Le):Le=e[110],Le}function Rae(t){const e=F.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:a,onOpenChange:l}=t,c=r===void 0?!1:r,d=ae(),[h,u]=T.useState(i),[f,p]=T.useState(s);s!==f&&(p(s),s&&u(i));let m;e[0]!==c||e[1]!==l?(m=W=>{!W&&!c&&l(!1)},e[0]=c,e[1]=l,e[2]=m):m=e[2];const g=m;let x;e[3]!==c||e[4]!==h||e[5]!==a?(x=async W=>{W.preventDefault();const K=h.trim();!K||c||await a(K)},e[3]=c,e[4]=h,e[5]=a,e[6]=x):x=e[6];const b=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let L;e[9]!==v?(L=o.jsx(Kt,{children:v}),e[9]=v,e[10]=L):L=e[10];let _;e[11]!==d?(_=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=_):_=e[12];let y;e[13]!==_?(y=o.jsx(Mn,{children:_}),e[13]=_,e[14]=y):y=e[14];let w;e[15]!==L||e[16]!==y?(w=o.jsxs(cs,{children:[L,y]}),e[15]=L,e[16]=y,e[17]=w):w=e[17];let S;e[18]!==d?(S=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=S):S=e[19];let k;e[20]!==S?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:S}),e[20]=S,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=W=>u(W.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==h?(C=o.jsx(vt,{id:"section-rename-name",value:h,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=h,e[25]=C):C=e[25];let V;e[26]!==k||e[27]!==C?(V=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=V):V=e[28];let N;e[29]!==d?(N=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=N):N=e[30];let A;e[31]!==N?(A=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:N}),e[31]=N,e[32]=A):A=e[32];let P;e[33]!==n?(P=o.jsx(vt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=P):P=e[34];let R;e[35]!==A||e[36]!==P?(R=o.jsxs("div",{className:"space-y-1.5",children:[A,P]}),e[35]=A,e[36]=P,e[37]=R):R=e[37];let E;e[38]!==V||e[39]!==R?(E=o.jsxs("div",{className:"space-y-4 py-4",children:[V,R]}),e[38]=V,e[39]=R,e[40]=E):E=e[40];let I;e[41]!==l?(I=()=>l(!1),e[41]=l,e[42]=I):I=e[42];let D;e[43]!==d?(D=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=D):D=e[44];let O;e[45]!==c||e[46]!==I||e[47]!==D?(O=o.jsx(me,{type:"button",variant:"outline",onClick:I,disabled:c,children:D}),e[45]=c,e[46]=I,e[47]=D,e[48]=O):O=e[48];let B;e[49]!==c||e[50]!==h?(B=!h.trim()||c,e[49]=c,e[50]=h,e[51]=B):B=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let z;e[55]!==B||e[56]!==M?(z=o.jsx(me,{type:"submit",disabled:B,children:M}),e[55]=B,e[56]=M,e[57]=z):z=e[57];let $;e[58]!==O||e[59]!==z?($=o.jsxs(qn,{children:[O,z]}),e[58]=O,e[59]=z,e[60]=$):$=e[60];let U;e[61]!==b||e[62]!==E||e[63]!==$||e[64]!==w?(U=o.jsx(zt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[w,E,$]})}),e[61]=b,e[62]=E,e[63]=$,e[64]=w,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=o.jsx(Ft,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function Dae(t){const e=F.c(7),{type:s}=t,n=IS[s];let i;e[0]!==n?(i=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:n})}),e[0]=n,e[1]=i):i=e[1];const r=s==="permanent"?"Permanent":"Temporary";let a;e[2]!==r?(a=o.jsx(Ke,{side:"left",children:r}),e[2]=r,e[3]=a):a=e[3];let l;return e[4]!==i||e[5]!==a?(l=o.jsxs(We,{children:[i,a]}),e[4]=i,e[5]=a,e[6]=l):l=e[6],l}const im={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},y4=["posts","authors","categories"],bu={posts:"post",authors:"author",categories:"category"};function ka(t){return y4.includes(t)}const _4={posts:"post",authors:"author",categories:"category"},_j={posts:im.post,authors:im.author,categories:im.category},Mae=Object.fromEntries(Object.entries(_j).map(([t,e])=>[e,t]));function Iae(t){return typeof t=="string"?Mae[t]??null:null}function sa(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ls(t){return typeof t=="string"?t:""}function Oae(t,e){switch(t){case"posts":return{label:ls(e.title)||"Untitled post",subtitle:ls(e.slug)};case"authors":return{label:ls(e.name)||"Unnamed author",subtitle:ls(e.email)};case"categories":return{label:ls(e.name)||"Unnamed category",subtitle:ls(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Lj(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=sa(n);if(!i)continue;const r=Iae(i.__resolveType);if(!r)continue;const a=sa(i[_4[r]])??{},{label:l,subtitle:c}=Oae(r,a);e[r].push({key:s,kind:r,label:l,subtitle:c})}for(const s of y4)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function $ae(t,e){return Lj(t)[e]}function zu(t,e){return $ae(t,e).map(s=>({key:s.key,payload:Xd(sa(t[s.key])??void 0,e)}))}const Sv=Object.freeze({});function Xd(t,e){return t?sa(t[_4[e]])??Sv:Sv}function Sc(t,e,s){return{name:t,__resolveType:_j[e],[_4[e]]:s}}function j3e({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=f=>typeof f=="string"?f:ls(sa(f)?.[s]),a=f=>typeof f=="string"?f:ls(sa(f)?.name),l=f=>{const p=r(f),m=p?t.find(({payload:x})=>ls(x[s])===p):void 0;if(m)return m;const g=a(f);return g?t.find(({payload:x})=>ls(x.name)===g):void 0},c=t.map(({key:f,payload:p})=>({value:f,label:ls(p.name)||ls(p[s])||f})),d=new Map,h=[];return i.forEach((f,p)=>{const m=l(f);if(m){h.includes(m.key)||h.push(m.key);return}const g=`unresolved:${p}`;d.set(g,f),h.push(g),c.push({value:g,label:a(f)||r(f)||"Unknown"})}),{options:c,selectedValues:h,refsForValues:f=>f.map(p=>{const m=t.find(g=>g.key===p);return m?n(m.payload):d.get(p)}).filter(p=>p!==void 0)}}function Qa(t){return Array.isArray(t)?t:[]}function Ur(t){if(typeof t=="string")return t;const e=sa(t);return e?ls(e.slug):""}function Bae(t){if(typeof t=="string")return t;const e=sa(t);return e?ls(e.email):""}function wj(t){const e=[];return ls(t.title).trim()||e.push("Title"),ls(t.slug).trim()||e.push("Slug"),Qa(t.categories).map(Ur).filter(Boolean).length===0&&e.push("Category"),ls(t.excerpt).trim()||e.push("Excerpt"),ls(t.image).trim()||e.push("Cover image"),e}const Sj=8;function kj(t){const e=ls(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function C3e(t,e){return e!=="published"||kj(t)==="published"?!1:wj(t).length>0}function zae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Sj).toISOString()}function N3e(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=ls(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?zae(s):n}}function jj(t){return zu(t,"posts").map(({key:e,payload:s})=>({key:e,title:ls(s.title)||"Untitled post",slug:ls(s.slug),date:ls(s.date),scheduledDatetime:ls(s.scheduledDatetime),categorySlugs:Qa(s.categories).map(Ur).filter(Boolean),authorEmails:Qa(s.authors).map(Bae).filter(Boolean),missing:wj(s),status:kj(s)}))}function Fae(t,e){const s=Qa(t.categories);return s.some(n=>Ur(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function Uae(t,e){const s=Qa(t.categories);return s.length===1&&Ur(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function V3e(t,e,s){const n=Qa(t.categories);if(!n.some(l=>Ur(l)===e))return t;const i=n.map(l=>{const c=Ur(l);return c===e||c===s.slug?{name:s.name,slug:s.slug}:l}),r=new Set,a=i.filter(l=>{const c=Ur(l);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:a}}function Hae(t,e){const s=Qa(t.categories);return s.some(n=>Ur(n)===e)?{...t,categories:s.filter(n=>Ur(n)!==e)}:t}function kv(t){return{...t,dateModified:new Date().toISOString()}}function Dp(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function rm(t,e){const s=`collections/blog/${e}/${Dp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Cj(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Dp(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Dp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Kae={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},jv="Box";function Wae(t){return t.startsWith("site/")?"site":"app"}function qae(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Rd(...t){for(const e of t)if(e!==void 0)return e}function T3e(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const r of Object.keys(i)){if(!Qae(r)||e.has(r))continue;e.add(r);const a=da(r,t),l=Gae(r),c=Kae[l],d=Wae(r),h=(d==="site"?Rd(a.title,c?.title):Rd(c?.title,a.title))??l,u=d==="site"?Rd(a.description,c?.description):Rd(c?.description,a.description),f=d==="site"?a.icon:void 0,p=f&&qae(f)?f:void 0,m=p!==void 0?c?.iconName??jv:Rd(f,c?.iconName)??jv;s.push({resolveType:r,title:h,description:u,iconName:m,iconUrl:p,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function Gae(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Yae=["blog/sections/blocks/","site/sections/Blog/Post/"];function Qae(t){return Yae.some(e=>t.startsWith(e))}const A3e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],P3e=["January","February","March","April","May","June","July","August","September","October","November","December"],Nj=1440*60*1e3;function Ra(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function E3e(t){return new Date(t.getFullYear(),t.getMonth(),1)}function R3e(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Ef(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function Mp(t,e){return Math.round((Ra(t).getTime()-Ra(e).getTime())/Nj)}function Xae(t){const e=(t.getTime()-Ra(t).getTime())/Nj;return Math.min(Math.max(e,0),1)}function Cv(t,e){return Mp(t,e)+Xae(t)}function D3e(t){const e=Ef(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(Ef(e,n*7+r));s.push(i)}for(;s.length>0&&s[s.length-1].every(n=>n.getMonth()!==t.getMonth());)s.pop();return s}function M3e(t,e){const s=Ra(t[0]),n=Ef(s,7),i=s.getTime(),r=n.getTime(),a=[];for(const d of e){const h=Ra(d.start),u=Ra(d.end);if(u.getTime()<s.getTime()||h.getTime()>=n.getTime())continue;const f=h.getTime()<s.getTime()?s:h,p=u.getTime()>=n.getTime()?Ef(n,-1):u,m=Mp(f,s),g=Mp(p,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),v=Cv(new Date(x),s),L=Math.max(Cv(new Date(b),s)-v,0);L<=0||a.push({variant:d,startCol:m,span:g,leftUnits:v,widthUnits:L})}a.sort((d,h)=>d.startCol-h.startCol||h.span-d.span||d.variant.blockKey.localeCompare(h.variant.blockKey));const l=[],c=[];for(const d of a){let h=l.findIndex(u=>u<=d.startCol);h===-1&&(h=l.length,l.push(0)),l[h]=d.startCol+d.span,c.push({...d,lane:h})}return c}function Rf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const Vj=/^(\d{4})-(\d{2})-(\d{2})$/;function Df(t){const e=t.trim();if(!e)return null;const s=Vj.exec(e);if(s){const i=Number(s[1]),r=Number(s[2])-1,a=Number(s[3]),l=new Date(i,r,a);return l.getMonth()===r&&l.getDate()===a?l:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:Ra(n)}function Jae(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Sj);return{...Cj("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Rf(t)}}function Zae(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(Vj.test(e))return Df(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function ele(t,e){const s=Zae(t.scheduledDatetime);if(!s)return null;const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),i={...t,scheduledDatetime:n.toISOString()};return(typeof t.date=="string"?t.date:"")===Rf(s)&&(i.date=Rf(n)),i}function tle(t){return Df(t.scheduledDatetime)??Df(t.date)}function I3e(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:Df(i.scheduledDatetime)!==null},a=tle(i);if(!a){s.push(r);continue}const l=Rf(a),c=e.get(l);c?c.push(r):e.set(l,[r])}const n=(i,r)=>Number(r.scheduled)-Number(i.scheduled)||i.post.title.localeCompare(r.post.title);for(const i of e.values())i.sort(n);return s.sort(n),{byDay:e,undated:s}}const sle="0.161.0",nle="0.162.0",O3e="deno task update";function Nv(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Vv(t,e){const s=Nv(t),n=Nv(e);if(!s||!n)return 0;for(let i=0;i<3;i++){const r=s[i]-n[i];if(r!==0)return r}return 0}const Tj=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function ile(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const n=Tj.exec(s)?.[1];if(n)return n}return null}function rle(t){const e=t?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const n=s?.title;if(typeof n!="string")continue;const i=Tj.exec(n)?.[1];if(i)return i}return null}function ole(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=ile(t.denoJson)??rle(t.meta);return!e||Vv(e,sle)<0?{kind:"outdated",version:e}:Vv(e,nle)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function $3e(t){return t.kind==="publish-only"||t.kind==="full"}function B3e(t){return t.kind==="full"}function ale(t){const e=F.c(16),s=As(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=N0(t.virtualMcpId),i=Ts()?.taskId??null;let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r=tt.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[0]=t.branch,e[1]=t.orgSlug,e[2]=t.virtualMcpId,e[3]=r):r=e[3];let a;e[4]!==n||e[5]!==t||e[6]!==i?(a=async()=>{const f=await O3({...t,threadId:i},C0(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=a):a=e[7];const l=s==="deno";let c;e[8]!==r||e[9]!==a||e[10]!==l?(c={queryKey:r,queryFn:a,enabled:l,staleTime:3e5},e[8]=r,e[9]=a,e[10]=l,e[11]=c):c=e[11];const{data:d}=Yt(c),h=d??null;let u;return e[12]!==s||e[13]!==t.meta||e[14]!==h?(u=ole({packageManager:s,denoJson:h,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=h,e[15]=u):u=e[15],u}function lle({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=ae(),a=n[s],l=a===void 0,c=l?"":JSON.stringify(a,null,2),[d,h]=T.useState(!1),[u,f]=T.useState(c),[p,m]=T.useState(!1),g=!i||l,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},v=async L=>{if(!i||p)return;let _;try{_=JSON.parse(L)}catch{ye.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}m(!0);try{await i(_),ye.success(r("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(y){ye.error(r("sectionsEditor.pageJsonDialog.saveError",{error:y instanceof Error?y.message:String(y)}))}finally{m(!1)}};return o.jsx(Ft,{open:t,onOpenChange:e,children:o.jsxs(zt,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(cs,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(Kt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(me,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(xr,{size:12}):o.jsx(bn,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(me,{size:"sm",onClick:()=>v(u),disabled:!x||p,className:"h-7 text-xs",children:r(p?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),l?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",r("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"h-[70vh]",children:o.jsx(hd,{code:c,language:"json",readOnly:g,height:"100%",onChange:L=>f(L??""),onSave:L=>{v(L)}})})]})})}function yi(t){const e=F.c(46),{icon:s,logoUrl:n,title:i,subtitle:r,active:a,accent:l,variantCount:c,trailing:d,selectable:h,selectionActive:u,selected:f,invalid:p,invalidReason:m,onToggleSelect:g,onClick:x,menu:b}=t,v=ae(),L=l==="global";let _;e[0]!==s||e[1]!==a||e[2]!==L||e[3]!==n||e[4]!==c?(_=c&&c>1?o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(Ke,{side:"right",children:[c," variants"]})]})}):n?o.jsx("img",{src:n,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):o.jsx("span",{className:re("flex size-8 shrink-0 items-center justify-center rounded-lg",L?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:re("shrink-0",!L&&(a?"text-accent-foreground":"text-muted-foreground")),style:L?{color:z3}:void 0})}),e[0]=s,e[1]=a,e[2]=L,e[3]=n,e[4]=c,e[5]=_):_=e[5];const y=_,w=a?L?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":L?"hover:bg-global-section/10":"hover:bg-muted";let S;e[6]!==w?(S=re("group relative flex min-w-0 items-center rounded-md transition-colors",w),e[6]=w,e[7]=S):S=e[7];let k;e[8]!==g||e[9]!==h||e[10]!==f||e[11]!==u||e[12]!==v||e[13]!==i?(k=h&&o.jsx("span",{className:re("flex shrink-0 items-center pl-2.5 transition-opacity",f||u?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:cle,children:o.jsx(rl,{checked:f,onCheckedChange:()=>g?.(),"aria-label":v("sandbox.itemRow.selectItem",{title:i})})}),e[8]=g,e[9]=h,e[10]=f,e[11]=u,e[12]=v,e[13]=i,e[14]=k):k=e[14];const j=p&&!a&&"text-destructive";let C;e[15]!==j?(C=re("block truncate text-sm font-medium",j),e[15]=j,e[16]=C):C=e[16];let V;e[17]!==C||e[18]!==i?(V=o.jsx("span",{className:C,children:i}),e[17]=C,e[18]=i,e[19]=V):V=e[19];const N=a?"text-accent-foreground/70":"text-muted-foreground";let A;e[20]!==N?(A=re("block truncate text-xs",N),e[20]=N,e[21]=A):A=e[21];let P;e[22]!==r||e[23]!==A?(P=o.jsx("span",{className:A,children:r}),e[22]=r,e[23]=A,e[24]=P):P=e[24];let R;e[25]!==P||e[26]!==V?(R=o.jsxs("span",{className:"min-w-0 flex-1",children:[V,P]}),e[25]=P,e[26]=V,e[27]=R):R=e[27];let E;e[28]!==a||e[29]!==p||e[30]!==m?(E=p&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx("span",{className:re("flex shrink-0 items-center",a?"text-accent-foreground":"text-destructive"),children:o.jsx(vn,{size:14})})}),m&&o.jsx(Ke,{side:"bottom",children:m})]}),e[28]=a,e[29]=p,e[30]=m,e[31]=E):E=e[31];let I;e[32]!==x||e[33]!==y||e[34]!==R||e[35]!==E||e[36]!==d?(I=o.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[y,R,E,d]}),e[32]=x,e[33]=y,e[34]=R,e[35]=E,e[36]=d,e[37]=I):I=e[37];let D;e[38]!==a||e[39]!==b?(D=b&&o.jsx("div",{className:re("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:b}),e[38]=a,e[39]=b,e[40]=D):D=e[40];let O;return e[41]!==I||e[42]!==D||e[43]!==S||e[44]!==k?(O=o.jsxs("div",{className:S,children:[k,I,D]}),e[41]=I,e[42]=D,e[43]=S,e[44]=k,e[45]=O):O=e[45],O}function cle(t){return t.stopPropagation()}function Bo(t){const e=F.c(10),{icon:s,title:n,description:i}=t;let r;e[0]!==s?(r=s&&o.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==n?(a=o.jsx("div",{children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==i?(l=i&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=l):l=e[5];let c;return e[6]!==r||e[7]!==a||e[8]!==l?(c=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[r,a,l]}),e[6]=r,e[7]=a,e[8]=l,e[9]=c):c=e[9],c}const dle={loaders:Ia,actions:hr},ule={loaders:"Loaders",actions:"Actions"},hle={analytics:GP,blog:Hc,commerce:qP,site:bA,website:jn};function fle(t,e){return e===0?hle[t.toLowerCase()]??Qo:Qo}function bh(t,e){return e===0?Nse(t):t}function mle(t){const e=F.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,kind:c}=t,d=ae();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=T.useState(h),[p,m]=T.useState(null),[g,x]=T.useState(""),[b,v]=T.useState(Lle),[L,_]=T.useState(c);L!==c&&(_(c),f([]),m(null),x(""),v(new Set));let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=U=>{v(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},e[1]=y):y=e[1];const w=y;let S;e[2]!==i||e[3]!==s||e[4]!==n?(S={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=S):S=e[5];const k=V0(S);let j;e[6]!==k?(j=r4((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const C=j;let V;e[8]!==c?(V=mk(c),e[8]=c,e[9]=V):V=e[9];const N=V,A=dle[c];let P,R,E,I,D,O,B;if(e[10]!==A||e[11]!==i||e[12]!==l||e[13]!==c||e[14]!==a||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==p||e[23]!==N||e[24]!==d||e[25]!==n){E=Symbol.for("react.early_return_sentinel");e:{const U=[...bk(a,l,c).map(_le),...gk(a,c).map(yle)],H=g.trim().toLowerCase(),W=H.length>0,K=W?U.filter(pe=>pe.title.toLowerCase().includes(H)||pe.resolveType.toLowerCase().includes(H)):[],G=new Map,Y=[],Z=new Map;if(!W){for(const pe of U){const ke=pe.folderPath;if(!(ke.length<u.length)&&u.every((Te,we)=>ke[we]===Te))if(ke.length===u.length)if(pe.savedKey!==void 0){const Te=Z.get(pe.resolveType);Te?Te.push(pe):Z.set(pe.resolveType,[pe])}else Y.push(pe);else{const Te=ke[u.length],we=G.get(Te)??{count:0,savedCount:0};pe.savedKey!==void 0?we.savedCount=we.savedCount+1:we.count=we.count+1,G.set(Te,we)}}Y.sort(vle);for(const pe of Z.values())pe.sort(ble)}const te=[...Z.entries()].filter(pe=>{const[ke]=pe;return!Y.some(Te=>Te.resolveType===ke)}).flatMap(xle).sort(gle);let X;e[33]!==u?(X=(pe,ke)=>bh(pe.name,u.length).localeCompare(bh(ke.name,u.length)),e[33]=u,e[34]=X):X=e[34];const ee=[...G.entries()].map(ple).sort(X);let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=pe=>{m(pe.savedKey!==void 0?{mode:"saved",key:pe.savedKey}:{mode:"available",resolveType:pe.resolveType,title:pe.title})},e[35]=J):J=e[35];const Q=J;let oe;e[36]!==k||e[37]!==N||e[38]!==d?(oe=async(pe,ke)=>{await k.mutateAsync({blockKey:pe,data:ke}),ye.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:N,blockId:pe})),m({mode:"saved",key:pe})},e[36]=k,e[37]=N,e[38]=d,e[39]=oe):oe=e[39];const le=oe;let de;e[40]!==l||e[41]!==p?(de=wle(p,l),e[40]=l,e[41]=p,e[42]=de):de=e[42];const se=de;if(se){const pe=`${se.mode}:${se.mode==="saved"?se.blockKey:se.resolveType}`;let ke;e[43]===Symbol.for("react.memo_cache_sentinel")?(ke=()=>m(null),e[43]=ke):ke=e[43];let Te;e[44]!==i||e[45]!==l||e[46]!==le||e[47]!==c||e[48]!==a||e[49]!==s||e[50]!==r||e[51]!==k.isPending||e[52]!==C||e[53]!==pe||e[54]!==se.editorTarget||e[55]!==se.initialValue||e[56]!==n?(Te=o.jsx(pj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,kind:c,target:se.editorTarget,initialValue:se.initialValue,isCreating:k.isPending,onCreate:le,onSaveReferencedBlock:C,onBack:ke},pe),e[44]=i,e[45]=l,e[46]=le,e[47]=c,e[48]=a,e[49]=s,e[50]=r,e[51]=k.isPending,e[52]=C,e[53]=pe,e[54]=se.editorTarget,e[55]=se.initialValue,e[56]=n,e[57]=Te):Te=e[57],E=Te;break e}B="flex h-full w-full min-w-0 flex-col";let ie;e[58]!==d?(ie=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ie):ie=e[59];let he;e[60]===Symbol.for("react.memo_cache_sentinel")?(he=()=>f([]),e[60]=he):he=e[60];const ue=u.length===0?"font-medium text-foreground":"text-muted-foreground";let ce;e[61]!==ue?(ce=re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ue),e[61]=ue,e[62]=ce):ce=e[62];const ne=ule[c];let q;e[63]!==ce||e[64]!==ne?(q=o.jsx("button",{type:"button",onClick:he,className:ce,children:ne}),e[63]=ce,e[64]=ne,e[65]=q):q=e[65];let fe;e[66]!==u?(fe=u.map((pe,ke)=>{const Te=ke===u.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,ke+1)),className:re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Te?"font-medium text-foreground":"text-muted-foreground"),children:bh(pe,ke)})]},`${pe}-${ke}`)}),e[66]=u,e[67]=fe):fe=e[67];let ge;e[68]!==ie||e[69]!==q||e[70]!==fe?(ge=o.jsxs("nav",{"aria-label":ie,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[q,fe]}),e[68]=ie,e[69]=q,e[70]=fe,e[71]=ge):ge=e[71];let _e;e[72]===Symbol.for("react.memo_cache_sentinel")?(_e=o.jsx(u0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=_e):_e=e[72];let Le;e[73]===Symbol.for("react.memo_cache_sentinel")?(Le=pe=>x(pe.target.value),e[73]=Le):Le=e[73];let je;e[74]!==c||e[75]!==d?(je=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=je):je=e[76];let Ce;e[77]!==c||e[78]!==d?(Ce=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=Ce):Ce=e[79];let Pe;e[80]!==g||e[81]!==je||e[82]!==Ce?(Pe=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[_e,o.jsx("input",{type:"text",value:g,onChange:Le,placeholder:je,"aria-label":Ce,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=je,e[82]=Ce,e[83]=Pe):Pe=e[83],e[84]!==ge||e[85]!==Pe?(R=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ge,Pe]}),e[84]=ge,e[85]=Pe,e[86]=R):R=e[86],P=il,O="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",D=W?K.length===0?o.jsx(Bo,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:c,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):o.jsx("div",{className:"flex flex-col gap-1",children:K.map(pe=>o.jsx(yi,{icon:A,accent:pe.savedKey!==void 0?"global":void 0,title:pe.title,subtitle:pe.resolveType,active:!1,onClick:()=>Q(pe)},pe.savedKey??pe.resolveType))}):ee.length===0&&Y.length===0&&te.length===0?o.jsx(Bo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[ee.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:ee.map(pe=>{const ke=fle(pe.name,u.length);return o.jsxs("button",{type:"button",onClick:()=>f([...u,pe.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[o.jsx(ke,{size:18,className:"shrink-0 text-muted-foreground"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:bh(pe.name,u.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[pe.count," ",pe.count===1?N:c,pe.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:pe.savedCount})]})]})]})]},pe.name)})}),(Y.length>0||te.length>0)&&o.jsxs("div",{className:re("flex flex-col gap-1",ee.length>0&&"mt-4"),children:[Y.map(pe=>{const ke=Z.get(pe.resolveType)??[],Te=b.has(pe.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(yi,{icon:A,title:pe.title,subtitle:pe.resolveType,active:!1,onClick:()=>Q(pe)}),ke.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>w(pe.resolveType),"aria-expanded":Te,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:z3},children:[Te?o.jsx(hs,{size:12,className:"shrink-0"}):o.jsx(Ns,{size:12,className:"shrink-0"}),d(Te?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ke.length,")"]}),Te&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ke.map(we=>o.jsx(yi,{icon:A,accent:"global",title:we.title,subtitle:we.resolveType,active:!1,onClick:()=>Q(we)},we.savedKey))})]})]},pe.resolveType)}),te.map(pe=>o.jsx(yi,{icon:A,accent:"global",title:pe.title,subtitle:pe.resolveType,active:!1,onClick:()=>Q(pe)},pe.savedKey))]})]})}e[10]=A,e[11]=i,e[12]=l,e[13]=c,e[14]=a,e[15]=b,e[16]=s,e[17]=u,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=p,e[23]=N,e[24]=d,e[25]=n,e[26]=P,e[27]=R,e[28]=E,e[29]=I,e[30]=D,e[31]=O,e[32]=B}else P=e[26],R=e[27],E=e[28],I=e[29],D=e[30],O=e[31],B=e[32];if(E!==Symbol.for("react.early_return_sentinel"))return E;let M;e[87]!==I||e[88]!==D?(M=o.jsx("div",{className:I,children:D}),e[87]=I,e[88]=D,e[89]=M):M=e[89];let z;e[90]!==P||e[91]!==M||e[92]!==O?(z=o.jsx(P,{className:O,children:M}),e[90]=P,e[91]=M,e[92]=O,e[93]=z):z=e[93];let $;return e[94]!==R||e[95]!==z||e[96]!==B?($=o.jsxs("div",{className:B,children:[R,z]}),e[94]=R,e[95]=z,e[96]=B,e[97]=$):$=e[97],$}function ple(t){const[e,s]=t;return{name:e,...s}}function gle(t,e){return t.title.localeCompare(e.title)}function xle(t){const[,e]=t;return e}function ble(t,e){return t.title.localeCompare(e.title)}function vle(t,e){return t.title.localeCompare(e.title)}function yle(t){return{resolveType:t.resolveType,title:t.title,folderPath:xk(t.resolveType)}}function _le(t){return{resolveType:t.resolveType,title:t.title,folderPath:xk(t.resolveType),savedKey:t.key}}function Lle(){return new Set}function wle(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:n,title:i}=vk(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function Sle(t){const e=F.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:a,decofile:l,resolveType:c,title:d,defaultBlockId:h,isCreating:u,onCreate:f,onSaveReferencedBlock:p}=t,m=ae(),g=ho(),x=g?.entity?.id===n?g.entity.metadata?.siteSlug??null:null;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[v,L]=T.useState(b);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=[],e[1]=_):_=e[1];const[y,w]=T.useState(_),[S,k]=T.useState(0),[j,C]=T.useState(!1);let V;e[2]!==a||e[3]!==c?(V=In(c,a),e[2]=a,e[3]=c,e[4]=V):V=e[4];const N=V,A=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,P=Ts()?.taskId??null,R=r??void 0;let E;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==R||e[9]!==P||e[10]!==n?(E={orgSlug:s,virtualMcpId:n,branch:i,threadId:P,previewUrl:R,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=R,e[9]=P,e[10]=n,e[11]=E):E=e[11];const I=E;let D,O,B,M,z,$,U,H;if(e[12]!==l||e[13]!==y||e[14]!==v||e[15]!==f||e[16]!==m||e[17]!==d){const ce=[d,...y],ne=fe=>{w(y.slice(0,fe)),k(kle)};let q;e[26]!==l||e[27]!==v||e[28]!==f?(q=async fe=>{const ge=h4(fe,l);if(ge){ye.error(ge);return}await f(fe,v),C(!1)},e[26]=l,e[27]=v,e[28]=f,e[29]=q):q=e[29],D=q,M="flex h-full w-full min-w-0",B="flex min-w-0 flex-1 flex-col",O="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==m?(z=m("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=m,e[31]=z):z=e[31],$="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ce.map((fe,ge)=>{const _e=ge===ce.length-1,Le=kn(fe);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ge>0&&o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ne(ge),title:Le,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",_e?"font-medium text-foreground":"text-muted-foreground"),children:Le})]},`${Le}-${ge}`)}),e[12]=l,e[13]=y,e[14]=v,e[15]=f,e[16]=m,e[17]=d,e[18]=D,e[19]=O,e[20]=B,e[21]=M,e[22]=z,e[23]=$,e[24]=U,e[25]=H}else D=e[18],O=e[19],B=e[20],M=e[21],z=e[22],$=e[23],U=e[24],H=e[25];let W;e[32]!==z||e[33]!==$||e[34]!==U?(W=o.jsx("nav",{"aria-label":z,className:$,children:U}),e[32]=z,e[33]=$,e[34]=U,e[35]=W):W=e[35];let K;e[36]===Symbol.for("react.memo_cache_sentinel")?(K=()=>C(!0),e[36]=K):K=e[36];let G;e[37]!==m?(G=m("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=m,e[38]=G):G=e[38];let Y;e[39]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(J2,{size:14}),e[39]=Y):Y=e[39];let Z;e[40]!==u||e[41]!==G?(Z=o.jsx(He,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:K,"aria-label":G,children:Y})}),e[40]=u,e[41]=G,e[42]=Z):Z=e[42];let te;e[43]!==m?(te=m("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=m,e[44]=te):te=e[44];let X;e[45]!==te?(X=o.jsx(Ke,{side:"bottom",children:te}),e[45]=te,e[46]=X):X=e[46];let ee;e[47]!==Z||e[48]!==X?(ee=o.jsxs(We,{children:[Z,X]}),e[47]=Z,e[48]=X,e[49]=ee):ee=e[49];let J;e[50]!==W||e[51]!==ee||e[52]!==H?(J=o.jsxs("div",{className:H,children:[W,ee]}),e[50]=W,e[51]=ee,e[52]=H,e[53]=J):J=e[53];const Q="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",oe=m("sandbox.availableSectionEditor.localEditsHint",{typeLabel:A});let le;e[54]!==oe?(le=o.jsx("p",{className:Q,children:oe}),e[54]=oe,e[55]=le):le=e[55];let de;e[56]!==O||e[57]!==J||e[58]!==le?(de=o.jsxs("div",{className:O,children:[J,le]}),e[56]=O,e[57]=J,e[58]=le,e[59]=de):de=e[59];let se;e[60]!==l||e[61]!==y||e[62]!==S||e[63]!==v||e[64]!==a||e[65]!==p||e[66]!==I||e[67]!==N||e[68]!==m?(se=o.jsx(il,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:N?o.jsx(Bi,{schema:N,value:v,onChange:ce=>L(ce),basePath:"",breadcrumbPath:y,onBreadcrumbChange:w,meta:a,decofile:l,onSaveReferencedBlock:p,sandbox:I},S):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=l,e[61]=y,e[62]=S,e[63]=v,e[64]=a,e[65]=p,e[66]=I,e[67]=N,e[68]=m,e[69]=se):se=e[69];let ie;e[70]!==B||e[71]!==de||e[72]!==se?(ie=o.jsxs("div",{className:B,children:[de,se]}),e[70]=B,e[71]=de,e[72]=se,e[73]=ie):ie=e[73];let he;e[74]!==h||e[75]!==D||e[76]!==u||e[77]!==j?(he=o.jsx(f4,{open:j,onOpenChange:C,defaultBlockId:h,isPending:u,onSubmit:D}),e[74]=h,e[75]=D,e[76]=u,e[77]=j,e[78]=he):he=e[78];let ue;return e[79]!==M||e[80]!==ie||e[81]!==he?(ue=o.jsxs("div",{className:M,children:[ie,he]}),e[79]=M,e[80]=ie,e[81]=he,e[82]=ue):ue=e[82],ue}function kle(t){return t+1}var jle=Object.prototype.toString,yd=Array.isArray||function(e){return jle.call(e)==="[object Array]"};function L4(t){return typeof t=="function"}function Cle(t){return yd(t)?"array":typeof t}function om(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Tv(t,e){return t!=null&&typeof t=="object"&&e in t}function Nle(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var Vle=RegExp.prototype.test;function Tle(t,e){return Vle.call(t,e)}var Ale=/\S/;function Ple(t){return!Tle(Ale,t)}var Ele={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Rle(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return Ele[s]})}var Dle=/\s*/,Mle=/\s+/,Av=/\s*=/,Ile=/\s*\}/,Ole=/#|\^|\/|>|\{|&|=|!/;function $le(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],a=!1,l=!1,c="",d=0;function h(){if(a&&!l)for(;r.length;)delete i[r.pop()];else r=[];a=!1,l=!1}var u,f,p;function m(k){if(typeof k=="string"&&(k=k.split(Mle,2)),!yd(k)||k.length!==2)throw new Error("Invalid tags: "+k);u=new RegExp(om(k[0])+"\\s*"),f=new RegExp("\\s*"+om(k[1])),p=new RegExp("\\s*"+om("}"+k[1]))}m(e||Ri.tags);for(var g=new T0(t),x,b,v,L,_,y;!g.eos();){if(x=g.pos,v=g.scanUntil(u),v)for(var w=0,S=v.length;w<S;++w)L=v.charAt(w),Ple(L)?(r.push(i.length),c+=L):(l=!0,s=!0,c+=" "),i.push(["text",L,x,x+1]),x+=1,L===`
632
632
  `&&(h(),c="",d=0,s=!1);if(!g.scan(u))break;if(a=!0,b=g.scan(Ole)||"name",g.scan(Dle),b==="="?(v=g.scanUntil(Av),g.scan(Av),g.scanUntil(f)):b==="{"?(v=g.scanUntil(p),g.scan(Ile),g.scanUntil(f),b="&"):v=g.scanUntil(f),!g.scan(f))throw new Error("Unclosed tag at "+g.pos);if(b==">"?_=[b,v,x,g.pos,c,d,s]:_=[b,v,x,g.pos],d++,i.push(_),b==="#"||b==="^")n.push(_);else if(b==="/"){if(y=n.pop(),!y)throw new Error('Unopened section "'+v+'" at '+x);if(y[1]!==v)throw new Error('Unclosed section "'+y[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?l=!0:b==="="&&m(v)}if(h(),y=n.pop(),y)throw new Error('Unclosed section "'+y[1]+'" at '+g.pos);return zle(Ble(i))}function Ble(t){for(var e=[],s,n,i=0,r=t.length;i<r;++i)s=t[i],s&&(s[0]==="text"&&n&&n[0]==="text"?(n[1]+=s[1],n[3]=s[3]):(e.push(s),n=s));return e}function zle(t){for(var e=[],s=e,n=[],i,r,a=0,l=t.length;a<l;++a)switch(i=t[a],i[0]){case"#":case"^":s.push(i),n.push(i),s=i[4]=[];break;case"/":r=n.pop(),r[5]=i[2],s=n.length>0?n[n.length-1][4]:e;break;default:s.push(i)}return e}function T0(t){this.string=t,this.tail=t,this.pos=0}T0.prototype.eos=function(){return this.tail===""};T0.prototype.scan=function(e){var s=this.tail.match(e);if(!s||s.index!==0)return"";var n=s[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};T0.prototype.scanUntil=function(e){var s=this.tail.search(e),n;switch(s){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,s),this.tail=this.tail.substring(s)}return this.pos+=n.length,n};function sd(t,e){this.view=t,this.cache={".":this.view},this.parent=e}sd.prototype.push=function(e){return new sd(e,this)};sd.prototype.lookup=function(e){var s=this.cache,n;if(s.hasOwnProperty(e))n=s[e];else{for(var i=this,r,a,l,c=!1;i;){if(e.indexOf(".")>0)for(r=i.view,a=e.split("."),l=0;r!=null&&l<a.length;)l===a.length-1&&(c=Tv(r,a[l])||Nle(r,a[l])),r=r[a[l++]];else r=i.view[e],c=Tv(i.view,e);if(c){n=r;break}i=i.parent}s[e]=n}return L4(n)&&(n=n.call(this.view)),n};function Vn(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Vn.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Vn.prototype.parse=function(e,s){var n=this.templateCache,i=e+":"+(s||Ri.tags).join(":"),r=typeof n<"u",a=r?n.get(i):void 0;return a==null&&(a=$le(e,s),r&&n.set(i,a)),a};Vn.prototype.render=function(e,s,n,i){var r=this.getConfigTags(i),a=this.parse(e,r),l=s instanceof sd?s:new sd(s,void 0);return this.renderTokens(a,l,n,e,i)};Vn.prototype.renderTokens=function(e,s,n,i,r){for(var a="",l,c,d,h=0,u=e.length;h<u;++h)d=void 0,l=e[h],c=l[0],c==="#"?d=this.renderSection(l,s,n,i,r):c==="^"?d=this.renderInverted(l,s,n,i,r):c===">"?d=this.renderPartial(l,s,n,r):c==="&"?d=this.unescapedValue(l,s):c==="name"?d=this.escapedValue(l,s,r):c==="text"&&(d=this.rawValue(l)),d!==void 0&&(a+=d);return a};Vn.prototype.renderSection=function(e,s,n,i,r){var a=this,l="",c=s.lookup(e[1]);function d(f){return a.render(f,s,n,r)}if(c){if(yd(c))for(var h=0,u=c.length;h<u;++h)l+=this.renderTokens(e[4],s.push(c[h]),n,i,r);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")l+=this.renderTokens(e[4],s.push(c),n,i,r);else if(L4(c)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(s.view,i.slice(e[3],e[5]),d),c!=null&&(l+=c)}else l+=this.renderTokens(e[4],s,n,i,r);return l}};Vn.prototype.renderInverted=function(e,s,n,i,r){var a=s.lookup(e[1]);if(!a||yd(a)&&a.length===0)return this.renderTokens(e[4],s,n,i,r)};Vn.prototype.indentPartial=function(e,s,n){for(var i=s.replace(/[^ \t]/g,""),r=e.split(`
633
633
  `),a=0;a<r.length;a++)r[a].length&&(a>0||!n)&&(r[a]=i+r[a]);return r.join(`
634
- `)};Vn.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),a=L4(n)?n(e[1]):n[e[1]];if(a!=null){var l=e[6],c=e[5],d=e[4],h=a;c==0&&d&&(h=this.indentPartial(a,d,l));var u=this.parse(h,r);return this.renderTokens(u,s,n,h,i)}}};Vn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Vn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ri.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Ri.escape?String(r):i(r)};Vn.prototype.rawValue=function(e){return e[1]};Vn.prototype.getConfigTags=function(e){return yd(e)?e:e&&typeof e=="object"?e.tags:void 0};Vn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!yd(e))return e.escape};var Ri={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Fu.templateCache=t},get templateCache(){return Fu.templateCache}},Fu=new Vn;Ri.clearCache=function(){return Fu.clearCache()};Ri.parse=function(e,s){return Fu.parse(e,s)};Ri.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Cle(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Fu.render(e,s,n,i)};Ri.escape=Rle;Ri.Scanner=T0;Ri.Context=sd;Ri.Writer=Vn;function Fle(t,e){const s={__resolveType:t},n=QS([s],e)[0];return n?Mne(s,n,e):null}function Ule({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:a,onSaveReferencedBlock:l}){const c=ae(),d=ho(),h=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=T.useState(()=>Fle(a,r)),[f,p]=T.useState(u?.data??{}),[m,g]=T.useState([]),[x,b]=T.useState(0),[v,L]=T.useState(!1),[_,y]=T.useState(null),w=_!==null,{save:S,flush:k}=n4({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?In(u.resolveType,i):null,C=r[a],V=C?Wa(a,C):a,N=Ts()?.taskId??null,A={orgSlug:t,virtualMcpId:e,branch:s,threadId:N,previewUrl:n??void 0,siteSlug:h},P=O=>{p(O),S(a,O)},R=()=>{w?(y(null),L(!1),b(O=>O+1)):y(JSON.stringify(f,null,2))},E=O=>{const B=O??"";try{const M=JSON.parse(B);if(M&&typeof M=="object"&&!Array.isArray(M)){L(!1),P(M);return}L(!0)}catch{L(!0)}},I=[V,...m],D=O=>{g(m.slice(0,O)),b(B=>B+1)};return o.jsx("div",{className:"flex h-full w-full min-w-0",children:o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:z3},"aria-hidden":!0}),o.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:I.map((O,B)=>{const M=B===I.length-1,z=kn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[B>0&&o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>D(B),title:z,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:z})]},`${z}-${B}`)})}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:R,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?o.jsx(nn,{size:14}):o.jsx(rd,{size:14})})}),o.jsx(Ke,{side:"bottom",children:c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),o.jsxs("div",{className:"relative min-h-0 flex-1",children:[o.jsx(il,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:j?o.jsx(Bi,{schema:j,value:f,onChange:O=>P(O),basePath:"",breadcrumbPath:m,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:l,sandbox:A},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),_!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(hd,{language:"json",height:"100%",code:_,onChange:E,onSave:O=>{E(O),k()}})})]})]})]})})}function Hle(t){const e=F.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:a,meta:l,decofile:c,isCreating:d,onCreateAvailable:h,onSaveReferencedBlock:u}=t,f=ae();if(!s){let g;e[0]!==f?(g=f("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=f,e[1]=g):g=e[1];let x;e[2]!==f?(x=f("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=f,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=o.jsx(Bo,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let v;e[7]!==s.title?(v=Fk(s.title),e[7]=s.title,e[8]=v):v=e[8];let L;e[9]!==h||e[10]!==s.resolveType?(L=(y,w)=>h(s.resolveType,y,w),e[9]=h,e[10]=s.resolveType,e[11]=L):L=e[11];let _;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==l||e[16]!==u||e[17]!==n||e[18]!==a||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==L||e[24]!==i?(_=o.jsx(Sle,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:a,meta:l,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:L,onSaveReferencedBlock:u},g),e[12]=r,e[13]=c,e[14]=d,e[15]=l,e[16]=u,e[17]=n,e[18]=a,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=L,e[24]=i,e[25]=_):_=e[25],_}const p=`saved:${s.key}`;let m;return e[26]!==r||e[27]!==c||e[28]!==l||e[29]!==u||e[30]!==n||e[31]!==a||e[32]!==s.key||e[33]!==p||e[34]!==i?(m=o.jsx(Ule,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:a,meta:l,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},p),e[26]=r,e[27]=c,e[28]=l,e[29]=u,e[30]=n,e[31]=a,e[32]=s.key,e[33]=p,e[34]=i,e[35]=m):m=e[35],m}const Pv="__all__",Ev={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Kle={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},Mh={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Rv="status:";function Dv(t){if(!t.startsWith(Rv))return null;const e=t.slice(Rv.length);return e in Mh?e:null}const Mv=T.forwardRef(function(e,s){const n=F.c(20);let i,r,a,l,c;n[0]!==e?({icon:i,active:r,value:c,className:a,...l}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=a,n[4]=l,n[5]=c):(i=n[1],r=n[2],a=n[3],l=n[4],c=n[5]);const d=r?"text-foreground":"text-muted-foreground";let h;n[6]!==a||n[7]!==d?(h=re("h-7 gap-1 px-1.5 text-xs",d,a),n[6]=a,n[7]=d,n[8]=h):h=n[8];let u;n[9]!==i?(u=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=u):u=n[10];let f;n[11]!==c?(f=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let p;n[13]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(hs,{size:12,className:"shrink-0 opacity-60"}),n[13]=p):p=n[13];let m;return n[14]!==l||n[15]!==s||n[16]!==h||n[17]!==u||n[18]!==f?(m=o.jsxs(me,{ref:s,type:"button",variant:"ghost",size:"sm",className:h,...l,children:[u,f,p]}),n[14]=l,n[15]=s,n[16]=h,n[17]=u,n[18]=f,n[19]=m):m=n[19],m});function w4(t){const e=F.c(2),{count:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Wle(t){const e=F.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:a,statusFilter:l,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:h,onStatusFilterChange:u,onSortChange:f}=t,p=ae();let m;if(e[0]!==s||e[1]!==r){let se;e[3]!==r?(se=ie=>ie.slug===r,e[3]=r,e[4]=se):se=e[4],m=s.find(se),e[0]=s,e[1]=r,e[2]=m}else m=e[2];const g=m;let x;if(e[5]!==a||e[6]!==n){let se;e[8]!==a?(se=ie=>ie.email===a,e[8]=a,e[9]=se):se=e[9],x=n.find(se),e[5]=a,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(r||a||l);let L;e[10]!==b?.name||e[11]!==g?.name||e[12]!==l||e[13]!==p?(L=g?.name??b?.name??p(l?Mh[l]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=l,e[13]=p,e[14]=L):L=e[14];const _=L,y=r?`cat:${r}`:a?`author:${a}`:l?`status:${l}`:Pv;let w;e[15]!==h||e[16]!==d||e[17]!==u?(w=()=>{d(null),h(null),u(null)},e[15]=h,e[16]=d,e[17]=u,e[18]=w):w=e[18];const S=w;let k;e[19]!==S||e[20]!==h||e[21]!==d||e[22]!==u?(k=se=>{se.startsWith("cat:")?(h(null),u(null),d(se.slice(4))):se.startsWith("author:")?(d(null),u(null),h(se.slice(7))):Dv(se)?(d(null),h(null),u(Dv(se))):S()},e[19]=S,e[20]=h,e[21]=d,e[22]=u,e[23]=k):k=e[23];const j=k;let C;e[24]!==_||e[25]!==v?(C=o.jsx($t,{asChild:!0,children:o.jsx(Mv,{icon:vA,active:v,value:_,className:"min-w-0 shrink"})}),e[24]=_,e[25]=v,e[26]=C):C=e[26];let V;e[27]!==p?(V=p("sandbox.postToolbar.filterBy"),e[27]=p,e[28]=V):V=e[28];let N;e[29]!==V?(N=o.jsx(kd,{children:V}),e[29]=V,e[30]=N):N=e[30];let A;e[31]!==p?(A=p("sandbox.postToolbar.allPosts"),e[31]=p,e[32]=A):A=e[32];let P;e[33]!==A?(P=o.jsx(Uo,{value:Pv,children:A}),e[33]=A,e[34]=P):P=e[34];let R;e[35]!==p?(R=p("sandbox.postToolbar.statusLabel"),e[35]=p,e[36]=R):R=e[36];let E;e[37]!==R?(E=o.jsx(kd,{className:"text-muted-foreground/70",children:R}),e[37]=R,e[38]=E):E=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(Mh),e[39]=I):I=e[39];let D;e[40]!==i||e[41]!==p?(D=I.map(se=>o.jsxs(Uo,{value:`status:${se}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:p(Mh[se])}),o.jsx(w4,{count:i[se]})]},`status:${se}`)),e[40]=i,e[41]=p,e[42]=D):D=e[42];let O;e[43]!==s.length||e[44]!==p?(O=s.length>0&&o.jsx(kd,{className:"text-muted-foreground/70",children:p("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=p,e[45]=O):O=e[45];let B;e[46]!==s?(B=s.map(Gle),e[46]=s,e[47]=B):B=e[47];let M;e[48]!==n.length||e[49]!==p?(M=n.length>0&&o.jsx(kd,{className:"text-muted-foreground/70",children:p("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=p,e[50]=M):M=e[50];let z;e[51]!==n?(z=n.map(qle),e[51]=n,e[52]=z):z=e[52];let $;e[53]!==y||e[54]!==j||e[55]!==P||e[56]!==E||e[57]!==D||e[58]!==O||e[59]!==B||e[60]!==M||e[61]!==z?($=o.jsxs(Xh,{value:y,onValueChange:j,children:[P,E,D,O,B,M,z]}),e[53]=y,e[54]=j,e[55]=P,e[56]=E,e[57]=D,e[58]=O,e[59]=B,e[60]=M,e[61]=z,e[62]=$):$=e[62];let U;e[63]!==$||e[64]!==N?(U=o.jsxs(Bt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[N,$]}),e[63]=$,e[64]=N,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=o.jsxs(Ot,{children:[C,U]}),e[66]=U,e[67]=C,e[68]=H):H=e[68];let W;e[69]!==S||e[70]!==v||e[71]!==p?(W=v&&o.jsx(Yle,{label:p("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=v,e[71]=p,e[72]=W):W=e[72];const K=Kle[c];let G;e[73]!==p||e[74]!==K?(G=p(K),e[73]=p,e[74]=K,e[75]=G):G=e[75];let Y;e[76]!==G?(Y=o.jsx($t,{asChild:!0,children:o.jsx(Mv,{icon:yA,active:!0,value:G})}),e[76]=G,e[77]=Y):Y=e[77];let Z;e[78]!==p?(Z=p("sandbox.postToolbar.sortBy"),e[78]=p,e[79]=Z):Z=e[79];let te;e[80]!==Z?(te=o.jsx(kd,{children:Z}),e[80]=Z,e[81]=te):te=e[81];let X;e[82]!==f?(X=se=>f(se),e[82]=f,e[83]=X):X=e[83];let ee;e[84]===Symbol.for("react.memo_cache_sentinel")?(ee=Object.keys(Ev),e[84]=ee):ee=e[84];let J;e[85]!==p?(J=ee.map(se=>o.jsx(Uo,{value:se,children:p(Ev[se])},se)),e[85]=p,e[86]=J):J=e[86];let Q;e[87]!==c||e[88]!==X||e[89]!==J?(Q=o.jsx(Xh,{value:c,onValueChange:X,children:J}),e[87]=c,e[88]=X,e[89]=J,e[90]=Q):Q=e[90];let oe;e[91]!==te||e[92]!==Q?(oe=o.jsxs(Bt,{align:"end",className:"w-44",children:[te,Q]}),e[91]=te,e[92]=Q,e[93]=oe):oe=e[93];let le;e[94]!==Y||e[95]!==oe?(le=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs(Ot,{children:[Y,oe]})}),e[94]=Y,e[95]=oe,e[96]=le):le=e[96];let de;return e[97]!==H||e[98]!==W||e[99]!==le?(de=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,W,le]}),e[97]=H,e[98]=W,e[99]=le,e[100]=de):de=e[100],de}function qle(t){return o.jsxs(Uo,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(w4,{count:t.count})]},`author:${t.email}`)}function Gle(t){return o.jsxs(Uo,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(w4,{count:t.count})]},`cat:${t.slug}`)}function Yle(t){const e=F.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(nn,{size:12}),e[0]=i):i=e[0];let r;return e[1]!==s||e[2]!==n?(r=o.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:i}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function Qle(t){const e=F.c(18),{checked:s,disabled:n,onToggle:i}=t,r=ae();let a;e[0]!==i?(a=()=>i(),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==r?(l=r(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=r,e[4]=l):l=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==a||e[8]!==l?(c=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Xle,children:o.jsx(rl,{checked:s,disabled:n,onCheckedChange:a,"aria-label":l})})}),e[5]=s,e[6]=n,e[7]=a,e[8]=l,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==r?(d=r(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=r,e[12]=d):d=e[12];let h;e[13]!==d?(h=o.jsx(Ke,{side:"bottom",children:d}),e[13]=d,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==h?(u=o.jsxs(We,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=u):u=e[17],u}function Xle(t){return t.stopPropagation()}function Jle(t){const e=F.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:a}=t,l=ae();let c;e[0]!==n||e[1]!==i?(c=o.jsx(Qle,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==l?(d=l("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=l,e[5]=d):d=e[5];let h;e[6]!==d?(h=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=h):h=e[7];const u=s===0;let f;e[8]!==l?(f=l("sandbox.postToolbar.deleteSelectedPosts"),e[8]=l,e[9]=f):f=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(rn,{size:14}),e[10]=p):p=e[10];let m;e[11]!==r||e[12]!==u||e[13]!==f?(m=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:r,"aria-label":f,children:p})}),e[11]=r,e[12]=u,e[13]=f,e[14]=m):m=e[14];let g;e[15]!==l?(g=l("sandbox.postToolbar.deleteSelected"),e[15]=l,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(Ke,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==m||e[20]!==x?(b=o.jsxs(We,{children:[m,x]}),e[19]=m,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==l?(v=l("sandbox.postToolbar.exitSelection"),e[22]=l,e[23]=v):v=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(nn,{size:14}),e[24]=L):L=e[24];let _;e[25]!==a||e[26]!==v?(_=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,"aria-label":v,children:L})}),e[25]=a,e[26]=v,e[27]=_):_=e[27];let y;e[28]!==l?(y=l("sandbox.postToolbar.exitSelection"),e[28]=l,e[29]=y):y=e[29];let w;e[30]!==y?(w=o.jsx(Ke,{side:"bottom",children:y}),e[30]=y,e[31]=w):w=e[31];let S;e[32]!==_||e[33]!==w?(S=o.jsxs(We,{children:[_,w]}),e[32]=_,e[33]=w,e[34]=S):S=e[34];let k;e[35]!==b||e[36]!==S?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==h?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,h,k]}),e[38]=c,e[39]=k,e[40]=h,e[41]=j):j=e[41],j}function Dd(t){const e=F.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:a,onDelete:l}=t,c=ae();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Vi,{size:14}),e[2]=h):h=e[2];let u;e[3]!==d?(u=o.jsx($t,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Zle,children:h})}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(Qe,{onClick:n,children:[o.jsx(_9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let p;e[8]!==s||e[9]!==c?(p=s&&o.jsxs(Qe,{onClick:s,children:[o.jsx(bn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=p):p=e[10];let m;e[11]!==i||e[12]!==c?(m=i&&o.jsxs(o.Fragment,{children:[o.jsx(Dc,{}),o.jsxs(Qe,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(kg,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=m):m=e[13];let g;e[14]!==r||e[15]!==a||e[16]!==c?(g=(r||a)&&o.jsxs(o.Fragment,{children:[o.jsx(Dc,{}),r&&o.jsxs(Qe,{onClick:r,children:[o.jsx(c8,{size:14}),c("sandbox.itemActions.editSeo")]}),a&&o.jsxs(Qe,{onClick:a,children:[o.jsx(rd,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=r,e[15]=a,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Dc,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(rn,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let L;e[22]!==l||e[23]!==v?(L=o.jsxs(Qe,{onClick:l,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=l,e[23]=v,e[24]=L):L=e[24];let _;e[25]!==L||e[26]!==f||e[27]!==p||e[28]!==m||e[29]!==g?(_=o.jsxs(Bt,{align:"end",className:"w-44",children:[f,p,m,g,x,L]}),e[25]=L,e[26]=f,e[27]=p,e[28]=m,e[29]=g,e[30]=_):_=e[30];let y;return e[31]!==_||e[32]!==u?(y=o.jsxs(Ot,{children:[u,_]}),e[31]=_,e[32]=u,e[33]=y):y=e[33],y}function Zle(t){return t.stopPropagation()}function ece(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function tce(t){const e=new Map;for(const s of t){const n=ece(s.resolveType),i=e.get(n);i?i.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function Iv(t){const e=F.c(8),{icon:s,label:n,className:i}=t;let r;e[0]!==i?(r=re("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==s?(a=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==n||e[5]!==r||e[6]!==a?(l=o.jsxs("div",{className:r,children:[a,n]}),e[4]=n,e[5]=r,e[6]=a,e[7]=l):l=e[7],l}const Ov=T.lazy(()=>Ws(()=>import("./app-editor-BNKwsB0C.js"),__vite__mapDeps([169,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,40,72,73,28,80,29,30,31,32,33,34,35,36,37,38,39,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,74,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,78,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.AppEditor}))),sce=T.lazy(()=>Ws(()=>import("./post-editor-CKi-qWNG.js"),__vite__mapDeps([170,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,30,55,29,31,32,33,34,35,36,37,38,39,28,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,74,78,171,133,140,105,106,136,118,79,128,172,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,107,108,109,110,111,112,113,114,115,173,174,116,117,73,119,120,121,122,123,124,125,126,127,129,130,131,132,134,135,75,137,138,139,141,142,143,144,145,146,147,148,149,150,72,151,152,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.PostEditor}))),nce=T.lazy(()=>Ws(()=>import("./record-editor-DLoE_u56.js"),__vite__mapDeps([175,1,2,74,78,73,24,28,128,173,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,25,44,26,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,174,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,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,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.RecordEditor}))),ice=T.lazy(()=>Ws(()=>import("./category-editor-DRxFVwt9.js"),__vite__mapDeps([176,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,35,37,55,29,30,31,32,33,34,36,38,39,28,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,149,74,78,172,105,106,136,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,107,108,109,110,111,112,113,114,115,173,174,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,137,138,139,140,141,142,143,144,145,146,147,148,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.CategoryEditor}))),rce=T.lazy(()=>Ws(()=>import("./bulk-category-panel-8YfIcV58.js"),__vite__mapDeps([177,1,2,37,78,178,42,73,24,28])).then(t=>({default:t.BulkCategoryPanel}))),oce=T.lazy(()=>Ws(()=>import("./sections-editor-of2aPbXF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor}))),ace=T.lazy(()=>Ws(()=>import("./seo-editor-BdFo1CDL.js"),__vite__mapDeps([179,1,2,40,29,30,31,32,33,34,35,36,37,38,39,24,28,41,42,43,25,44,26,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,77,78,79,76,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,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,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SeoEditor}))),lce=T.lazy(()=>Ws(()=>import("./variant-calendar-52K0113C.js"),__vite__mapDeps([180,1,2,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,78,72,73,79,181,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,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,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.VariantCalendar}))),cce=T.lazy(()=>Ws(()=>import("./post-calendar-BqjLapsw.js"),__vite__mapDeps([182,1,2,30,29,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,183,72,73,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,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,78,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.PostCalendar}))),dce=T.lazy(()=>Ws(()=>import("./redirect-editor-B9a7bR4b.js"),__vite__mapDeps([184,1,2,140,24,74,78,73,28,174,32,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,81,29,30,31,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,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,141,142,143,144,145,146,147,148,149,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.RedirectEditor})));function uce(t){const e=F.c(20),{deepLinkPage:s}=t,n=ho(),{currentBranch:i}=on(),{org:r}=Ue(),a=n?.entity?.id??null,l=ci(),c=la(),{runtime:d,previewServerUrl:h}=_n(a),u=d==="cms";let f;e[0]!==u||e[1]!==c.previewState||e[2]!==l.lifecycle.phase?(f=_ae({fastPreviewActive:u,previewState:c.previewState,lifecyclePhase:l.lifecycle.phase}),e[0]=u,e[1]=c.previewState,e[2]=l.lifecycle.phase,e[3]=f):f=e[3];const p=f;if(p.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==p.state||e[5]!==c.start||e[6]!==x||e[7]!==l.lifecycle||e[8]!==l.phase?(b=o.jsx(vae,{state:p.state,claimPhase:l.phase,lifecycle:l.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=p.state,e[5]=c.start,e[6]=x,e[7]=l.lifecycle,e[8]=l.phase,e[9]=b):b=e[9],b}if(!a||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Bo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const m=u?h:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==p.devServerReady||e[14]!==p.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==m||e[18]!==a?(g=o.jsx(fce,{orgSlug:r.slug,virtualMcpId:a,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:m,deepLinkPage:s,devServerReady:p.devServerReady,sandboxWarming:p.sandboxWarming}),e[11]=i,e[12]=s,e[13]=p.devServerReady,e[14]=p.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=m,e[18]=a,e[19]=g):g=e[19],g}const $v=2e3,hce=15;function Bv(t,e,s,n){return typeof e!="string"||s&&(xj(e,s,n)||t.state.dataUpdateCount>=hce)?!1:$v}function fce({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:a,sandboxWarming:l}){const c=ae(),d=Ts()?.taskId??null,h={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:u,isLoading:f}=z9(h,{fetchEnabled:a}),p=pr({strict:!1}),[m,g]=T.useState(()=>p.contentCollection&&ka(p.contentCollection)&&p.contentCollection||"pages"),[x,b]=T.useState(()=>p.contentItem&&ka(m)?{collection:m,key:p.contentItem}:null),[v,L]=T.useState(null),_=!!(r?.pageId||r?.path||r?.pathTemplate),[y,w]=T.useState(!1);if(_&&!y&&x===null&&u){w(!0);const xe=Cee(wf(u),r??{});xe&&(g("pages"),b({collection:"pages",key:xe.key,path:xe.path}))}const[S,k]=T.useState(""),[j,C]=T.useState(null),[V,N]=T.useState(null),[A,P]=T.useState(null),[R,E]=T.useState("date-desc"),[I,D]=T.useState(()=>new Set),[O,B]=T.useState(null),M=()=>{D(new Set),B(null)},z=xe=>{b(xe),L(null)},[$,U]=T.useState(m);$!==m&&(U(m),k(""),C(null),N(null),P(null),E("date-desc"),D(new Set),B(null));const{data:H,isLoading:W,isFetching:K}=Q3(h,{fetchEnabled:a,refetchInterval:xe=>{const De=xe.state.data;if(m==="apps"&&x&&x.collection==="apps"){const Je=u?.[x.key];return Bv(xe,typeof Je?.__resolveType=="string"?Je.__resolveType:void 0,De)}if(m==="site"&&u){const Je=De?Cp(u,De):null,Ie=u.site,pt=Je?.resolveType??(typeof Ie?.__resolveType=="string"?Ie.__resolveType:void 0);return Bv(xe,pt,De,["seo"])}return!1}}),G=(xe,De)=>!xj(xe,H,De)&&(W||K),{catalog:Y,isLoading:Z}=pae(H??void 0,u??void 0,{enabled:m==="apps"}),te=ale({orgSlug:t,virtualMcpId:e,branch:s,meta:H}),X=V0(h),ee=oae(h),[J,Q]=T.useState(null),[oe,le]=T.useState(),[de,se]=T.useState(!1),[ie,he]=T.useState(),[ue,ce]=T.useState(null),[ne,q]=T.useState(null),[fe,ge]=T.useState(null),_e=!u||!H;if(f||W||_e&&l)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})});if(_e)return o.jsx(Bo,{title:"Could not load site data."});const Le=wf(u).sort((xe,De)=>xe.name.localeCompare(De.name)),je=$S(u).sort((xe,De)=>xe.from.localeCompare(De.from)),Ce=Y3(u,H),Pe=m==="sections"?vee(H):[],pe=Cp(u,H),ke=Lj(u),Te=y4.some(xe=>ke[xe].length>0),we=ka(m)?ke[m]:[],Ne=(Te?zu(u,"categories"):[]).map(({key:xe,payload:De})=>{const Je=typeof De.slug=="string"?De.slug:"",Ie=typeof De.name=="string"?De.name:"";return{slug:Je||xe,name:Ie||Je||xe}}).filter(xe=>xe.slug).sort((xe,De)=>xe.name.localeCompare(De.name)),Oe=m==="posts"&&(I.size>0||O!==null),nt=Oe?jj(u).filter(xe=>I.has(xe.key)):[],Fe=Hb(H,"loaders"),yt=Hb(H,"actions");if(!FS(u,H)&&!Te&&Fe===0&&yt===0)return o.jsx(Bo,{icon:vn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const it={pages:Le.length,sections:Ce.length,apps:Y.length,loaders:Fe,actions:yt,redirects:je.length,posts:ke.posts.length,authors:ke.authors.length,categories:ke.categories.length},st=new Set(Le.map(xe=>Ko(xe.path))),ft=new Set(Le.map(xe=>xe.name)),_t=new Set(Ce.map(xe=>xe.name)),mt=async xe=>{const De=u[xe.key];if(!De)return;const Je=ek(u,xe.key),Ie=tk(u,xe.key,Math.max(0,Je-1)),pt=hte(De.sections,Ie);if(pt)try{await X.mutateAsync({blockKey:xe.key,data:{...De,sections:pt}}),ye.success(`Variant added to "${xe.name}"`),b({collection:"pages",key:xe.key,path:xe.path})}catch(Et){ye.error(Et instanceof Error?Et.message:"Could not add variant")}},Ze=()=>{le(void 0),Q({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},rt=xe=>{le(void 0),Q({mode:"duplicate",sourceKey:xe.key,initialName:Lv(ft,xe.name),initialPath:Lae(st,xe.path)})},xt=xe=>{le(void 0),Q({mode:"rename",sourceKey:xe.key,initialName:xe.name,initialPath:xe.path})},be=async xe=>{if(!J)return;const{mode:De,sourceKey:Je}=J;try{if(De==="create"){let Ie;if(xe.templateKey){const Et=u[xe.templateKey];if(!Et)throw new Error("Selected template no longer exists.");Ie={...Et,name:xe.name,path:xe.path}}else Ie=kae(xe.name,xe.path);const pt=Cae(u,xe.name);await X.mutateAsync({blockKey:pt,data:Ie}),ye.success(`Created "${xe.name}"`),b({collection:"pages",key:pt,path:xe.path})}else if(De==="duplicate"&&Je){const Ie=u[Je];if(!Ie)throw new Error("Source page not found");const{key:pt,data:Et}=Sae({source:Ie,pages:Le,newName:xe.name,newPath:xe.path});await X.mutateAsync({blockKey:pt,data:Et}),ye.success(`Duplicated as "${xe.name}"`),b({collection:"pages",key:pt,path:xe.path})}else if(De==="rename"&&Je){const Ie=u[Je];if(!Ie)throw new Error("Page not found");const pt={...Ie,name:xe.name,path:xe.path};await X.mutateAsync({blockKey:Je,data:pt}),ye.success("Page updated"),x?.collection==="pages"&&x.key===Je&&b({collection:"pages",key:Je,path:xe.path})}Q(null)}catch(Ie){le(Ie instanceof Error?Ie.message:"Save failed")}},Re=({path:xe})=>{if(!J)return null;const De=Ko(xe);return(J.mode==="rename"?Ko(J.initialPath):null)!==De&&st.has(De)?`A page with path "${xe}" already exists.`:null},Me=async(xe,De,Je)=>{await X.mutateAsync({blockKey:De,data:{...Je,name:De,__resolveType:xe}}),ye.success(c("sandbox.contentBrowser.createdSection",{name:De})),b({collection:"sections",key:De})},dt=r4((xe,De)=>X.mutate({blockKey:xe,data:De})),ut=async xe=>{const De=u[xe.key];if(!De){ye.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Je=wae(u,xe.key),Ie=Lv(_t,xe.name),pt={...De,name:Ie};try{await X.mutateAsync({blockKey:Je,data:pt}),ye.success(c("sandbox.contentBrowser.duplicatedSection",{name:xe.name})),b({collection:"sections",key:Je})}catch(Et){ye.error(Et instanceof Error?Et.message:c("sandbox.contentBrowser.duplicateFailed"))}},ht=async xe=>{if(!ue)return;const De=u[ue];if(!De){ye.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await X.mutateAsync({blockKey:ue,data:{...De,name:xe}}),ye.success(c("sandbox.contentBrowser.sectionRenamed")),ce(null)}catch(Je){ye.error(Je instanceof Error?Je.message:c("sandbox.contentBrowser.renameFailed"))}},ct=()=>{he(void 0),se(!0)},lt=async xe=>{const De=jee(u,xe.from),Je=wee(xe);try{await X.mutateAsync({blockKey:De,data:Je}),ye.success("Created redirect"),se(!1),b({collection:"redirects",key:De})}catch(Ie){he(Ie instanceof Error?Ie.message:"Could not create redirect")}},Ge=async xe=>{const De=rm(u,xe),Je=Sc(De,xe,Cj(xe));try{await X.mutateAsync({blockKey:De,data:Je}),ye.success(`Created ${bu[xe]}`),b({collection:xe,key:De})}catch(Ie){ye.error(Ie instanceof Error?Ie.message:"Could not create")}},wt=async xe=>{const De=rm(u,"posts"),Je=Sc(De,"posts",Jae(xe));try{await X.mutateAsync({blockKey:De,data:Je}),ye.success(c("sandbox.postCalendar.createdScheduledPost")),g("posts"),U("posts"),b({collection:"posts",key:De}),L(null)}catch(Ie){ye.error(Ie instanceof Error?Ie.message:c("sandbox.postCalendar.couldNotCreate"))}},Pt=async(xe,De)=>{const Je=u[xe],Ie=Je?ele(Xd(Je,"posts"),De):null;if(!Ie){ye.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await X.mutateAsync({blockKey:xe,data:Sc(xe,"posts",Ie)})}catch(pt){ye.error(pt instanceof Error?pt.message:c("sandbox.postCalendar.couldNotReschedule"))}},Zt=async xe=>{const De=u[xe.key];if(!De){ye.error("Record not found.");return}const Je=rm(u,xe.kind),Ie=xe.kind==="posts"?"title":"name",pt={...structuredClone(Xd(De,xe.kind)),[Ie]:`${xe.label} (copy)`};try{await X.mutateAsync({blockKey:Je,data:Sc(Je,xe.kind,pt)}),ye.success(`Duplicated "${xe.label}"`),b({collection:xe.kind,key:Je})}catch(Et){ye.error(Et instanceof Error?Et.message:"Duplicate failed")}},Dt=xe=>{D(De=>{const Je=new Set(De);return Je.has(xe)?Je.delete(xe):Je.add(xe),Je})},$e=xe=>{g("posts"),U("posts"),b(null),L(null),k(""),C(null),N(null),P(null),E("date-desc"),D(new Set),B(xe||null)},Lt=async(xe,De)=>{const Je=[...I];let Ie=0;for(const pt of Je){const Et=u[pt],at=Xd(Et,"posts"),rs=xe==="add"?Fae(at,De):Uae(at,De);rs!==at&&(await X.mutateAsync({blockKey:pt,data:Sc(pt,"posts",kv(rs))}),Ie+=1)}return Ie},Se=async(xe,De)=>{const Je=I.size;try{const Ie=await Lt(xe,De),pt=xe==="add"?"Added to":"Moved",Et=Je-Ie;ye.success(`${pt} ${Ie} ${Ie===1?"post":"posts"}`+(Et>0?` (${Et} already set)`:"")),M()}catch(Ie){ye.error(Ie instanceof Error?Ie.message:"Bulk update failed")}},Ye=async()=>{if(ne)try{if(ne.kind==="blog-bulk"){for(const Ie of ne.keys)await ee.mutateAsync({blockKey:Ie});ye.success(`Deleted ${ne.count} ${ne.count===1?"post":"posts"}`),x&&x.collection!=="available-section"&&ne.keys.includes(x.key)&&b(null),M(),q(null);return}const{kind:xe,key:De,label:Je}=ne;if(xe==="blog"){if(ne.blogKind==="categories"){const Ie=Xd(u[De],"categories").slug,pt=typeof Ie=="string"?Ie:"";if(pt)for(const{key:Et,payload:at}of zu(u,"posts")){const rs=Hae(at,pt);rs!==at&&await X.mutateAsync({blockKey:Et,data:Sc(Et,"posts",kv(rs))})}}await ee.mutateAsync({blockKey:De})}else await ee.mutateAsync({blockKey:De});ye.success(`Deleted "${Je}"`),x&&x.collection!=="available-section"&&x.key===De&&b(null),q(null)}catch(xe){ye.error(xe instanceof Error?xe.message:"Delete failed")}},ot=ee.isPending||X.isPending,es=ne?.kind==="blog"?bu[ne.blogKind]:ne?.kind==="blog-bulk"?`${ne.count} ${ne.count===1?"post":"posts"}`:ne?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(xae,{active:m,counts:it,showBlog:Te,onSelect:xe=>{g(xe),b(null),L(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&o.jsx(mce,{activeCollection:m,pages:Le,redirects:je,sections:Ce,availableSections:Pe,appCatalog:Y,appCatalogLoading:Z,blogEntries:we,decofile:u,searchQuery:S,onSearchChange:k,postCategoryFilter:j,postAuthorFilter:V,postStatusFilter:A,postSort:R,onPostCategoryFilterChange:xe=>{C(xe),D(new Set)},onPostAuthorFilterChange:xe=>{N(xe),D(new Set)},onPostStatusFilterChange:xe=>{P(xe),D(new Set)},onPostSortChange:E,selectedPostKeys:I,postBulkPanelOpen:Oe,onTogglePostSelect:Dt,onSelectAllPosts:xe=>D(new Set(xe)),onClearPostSelection:()=>D(new Set),onExitPostSelection:M,onBulkDeletePosts:()=>q({kind:"blog-bulk",keys:[...I],count:I.size}),selection:x,onSelect:z,onCreate:()=>{m==="pages"?Ze():m==="redirects"?ct():ka(m)&&Ge(m)},onDuplicatePage:rt,onRenamePage:xt,onAddPageVariant:mt,onDeletePage:xe=>q({kind:"page",key:xe.key,label:xe.name}),onEditPageSeo:xe=>{const De={collection:"pages",key:xe.key,path:xe.path};b(De),L(xe.key)},onViewPageJson:xe=>ge(xe.key),onDuplicateSection:ut,onRenameSection:xe=>ce(xe.key),onDeleteSection:xe=>q({kind:"section",key:xe.key,label:xe.name}),onDeleteRedirect:xe=>q({kind:"redirect",key:xe.key,label:xe.from||xe.key}),onDuplicateBlog:Zt,onDeleteBlog:xe=>q({kind:"blog",blogKind:xe.kind,key:xe.key,label:xe.label})}),o.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?o.jsx(mle,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:H,decofile:u,kind:m}):o.jsx(T.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})}),children:m==="calendar"?o.jsx(lce,{decofile:u}):m==="post-schedule"?o.jsx(cce,{decofile:u,support:te,isCreating:X.isPending,onCreate:xe=>{wt(xe)},onReschedule:(xe,De)=>{Pt(xe,De)},onSelect:xe=>{g("posts"),U("posts"),b({collection:"posts",key:xe}),L(null)}}):m==="site"?pe?o.jsx(Ov,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:pe.key,block:u[pe.key],decofile:u,meta:H,title:"Site",excludeFields:["seo"],schemaPending:G(pe.resolveType,["seo"]),previewBaseUrl:n},`site:${pe.key}`):o.jsx(Bo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?o.jsx(ace,{orgSlug:t,virtualMcpId:e,branch:s,decofile:u,meta:H,target:{kind:"site"},previewBaseUrl:i}):m==="sections"?o.jsx(Hle,{selection:x?.collection==="sections"||x?.collection==="available-section"?x:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:H,decofile:u,isCreating:X.isPending,onCreateAvailable:Me,onSaveReferencedBlock:dt}):Oe?o.jsx(rce,{posts:nt,categories:Ne,initialSlug:O,isPending:X.isPending,onApply:(xe,De)=>{Se(xe,De)},onClose:M},O??"selection"):x&&x.collection!=="available-section"?x.collection==="apps"?o.jsx(Ov,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:u[x.key],decofile:u,meta:H,previewBaseUrl:n,schemaPending:G(typeof u[x.key]?.__resolveType=="string"?String(u[x.key].__resolveType):void 0)},`app:${x.key}`):x.collection==="posts"?o.jsx(sce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:u[x.key],decofile:u,meta:H,previewBaseUrl:i},`post:${x.key}`):x.collection==="categories"?o.jsx(ice,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:u[x.key],decofile:u,meta:H,onManagePosts:$e,onOpenPost:xe=>{g("posts"),U("posts"),b({collection:"posts",key:xe}),L(null)},previewBaseUrl:i},`category:${x.key}`):x.collection==="authors"?o.jsx(nce,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:x.key,block:u[x.key]},`authors:${x.key}`):x.collection==="redirects"?o.jsx(dce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:u[x.key]},`redirect:${x.key}`):o.jsx(oce,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:x.collection==="pages"?x.path:"/",activePageBlockKey:x.collection==="pages"?x.key:null,activeGlobalBlockKey:x.collection==="sections"?x.key:null,initialEditSeo:x.collection==="pages"&&v===x.key,onExitSeo:()=>L(null)},x.collection==="pages"?`page:${x.key}`:`section:${x.key}`):o.jsx(Bo,{title:`Select ${ka(m)?`a ${bu[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),J&&o.jsx(Aae,{open:!!J,mode:J.mode,initialName:J.initialName,initialPath:J.initialPath,isPending:X.isPending,error:oe,templates:Le,validate:Re,onSubmit:be,onOpenChange:xe=>{xe||(Q(null),le(void 0))}}),o.jsx(Eae,{open:de,isPending:X.isPending,error:ie,onSubmit:lt,onOpenChange:xe=>{xe||(se(!1),he(void 0))}}),ue&&o.jsx(Rae,{open:!!ue,blockKey:ue,initialName:Ce.find(xe=>xe.key===ue)?.name??ue,isPending:X.isPending,onSubmit:ht,onOpenChange:xe=>{xe||ce(null)}}),fe&&o.jsx(lle,{open:!!fe,onOpenChange:xe=>{xe||ge(null)},pageKey:fe,decofile:u,onSave:xe=>X.mutateAsync({blockKey:fe,data:xe})}),o.jsx(Gr,{open:!!ne,onOpenChange:xe=>{!xe&&!ot&&q(null)},children:o.jsxs(Yr,{children:[o.jsxs(Qr,{children:[o.jsx(Xr,{children:`Delete ${es}?`}),o.jsx(Jr,{children:ne?.kind==="section"?`"${ne.label}" will be removed. Pages that still reference it will lose this section.`:ne?.kind==="blog-bulk"?`${ne.count} ${ne.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:ne?`"${ne.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(Zr,{children:[o.jsx(eo,{disabled:ot,children:"Cancel"}),o.jsx(to,{onClick:xe=>{xe.preventDefault(),Ye()},disabled:ot,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ot?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function mce(t){const e=F.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:a,appCatalog:l,appCatalogLoading:c,blogEntries:d,decofile:h,searchQuery:u,onSearchChange:f,postCategoryFilter:p,postAuthorFilter:m,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:L,onPostSortChange:_,selectedPostKeys:y,postBulkPanelOpen:w,onTogglePostSelect:S,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:V,selection:N,onSelect:A,onCreate:P,onDuplicatePage:R,onRenamePage:E,onAddPageVariant:I,onDeletePage:D,onEditPageSeo:O,onViewPageJson:B,onDuplicateSection:M,onRenameSection:z,onDeleteSection:$,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:W}=t;let K,G,Y,Z,te,X,ee;if(e[0]!==s||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==d||e[5]!==h||e[6]!==I||e[7]!==V||e[8]!==j||e[9]!==P||e[10]!==W||e[11]!==D||e[12]!==U||e[13]!==$||e[14]!==H||e[15]!==R||e[16]!==M||e[17]!==O||e[18]!==C||e[19]!==v||e[20]!==b||e[21]!==_||e[22]!==L||e[23]!==E||e[24]!==z||e[25]!==f||e[26]!==A||e[27]!==k||e[28]!==S||e[29]!==B||e[30]!==n||e[31]!==m||e[32]!==w||e[33]!==p||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==u||e[38]!==r||e[39]!==y||e[40]!==N){const le=u.toLowerCase(),de=n.filter(be=>!le||be.name.toLowerCase().includes(le)||be.path.toLowerCase().includes(le)),se=i.filter(be=>!le||be.from.toLowerCase().includes(le)||be.to.toLowerCase().includes(le)),ie=r.filter(be=>!le||be.name.toLowerCase().includes(le)||be.key.toLowerCase().includes(le)||be.resolveType.toLowerCase().includes(le)),he=a.filter(be=>!le||be.title.toLowerCase().includes(le)||be.resolveType.toLowerCase().includes(le)||(be.description?.toLowerCase().includes(le)??!1)),ue=tce(ie),ce=l.filter(be=>!le||be.title.toLowerCase().includes(le)||be.app.toLowerCase().includes(le)||be.vendor.toLowerCase().includes(le)||be.category.toLowerCase().includes(le)),ne=d.filter(be=>!le||be.label.toLowerCase().includes(le)||be.subtitle.toLowerCase().includes(le)),q=s==="posts",fe=bce,ge=q?jj(h):[],_e=new Map,Le=new Map,je={published:0,scheduled:0,draft:0};for(const be of ge)je[be.status]=je[be.status]+1;for(const be of ge){for(const Re of be.categorySlugs)_e.set(Re,(_e.get(Re)??0)+1);for(const Re of be.authorEmails)Le.set(Re,(Le.get(Re)??0)+1)}const Ce=(q?zu(h,"categories"):[]).map(be=>{const{key:Re,payload:Me}=be,dt=fe(Me.slug)||Re;return{slug:dt,name:fe(Me.name)||fe(Me.slug)||Re,count:_e.get(dt)??0}}).filter(xce),Pe=(q?zu(h,"authors"):[]).map(be=>{const{key:Re,payload:Me}=be,dt=fe(Me.email);return{email:dt,name:fe(Me.name)||fe(Me.email)||Re,count:Le.get(dt)??0}}).filter(gce);let pe;e[48]!==p?(pe=be=>!p||be.categorySlugs.includes(p),e[48]=p,e[49]=pe):pe=e[49];let ke;e[50]!==m?(ke=be=>!m||be.authorEmails.includes(m),e[50]=m,e[51]=ke):ke=e[51];let Te;e[52]!==g?(Te=be=>!g||be.status===g,e[52]=g,e[53]=Te):Te=e[53];let we;e[54]!==x?(we=(be,Re)=>{if(x==="az")return be.title.localeCompare(Re.title);if(x==="za")return Re.title.localeCompare(be.title);const Me=be.date.localeCompare(Re.date);return x==="date-asc"?Me:-Me},e[54]=x,e[55]=we):we=e[55];const Ne=ge.filter(be=>!le||be.title.toLowerCase().includes(le)||be.slug.toLowerCase().includes(le)).filter(pe).filter(ke).filter(Te).sort(we),Oe=y.size,nt=Ne.map(pce),Fe=nt.length>0&&nt.every(be=>y.has(be)),yt=Oe>0||w,it=()=>{Fe?j():k(nt)},st=`Search ${s}…`,ft=ka(s)?`Create new ${bu[s]}`:s==="redirects"?"Create new redirect":"Create new page",_t=s!=="apps"&&s!=="sections";te="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let mt;e[56]===Symbol.for("react.memo_cache_sentinel")?(mt=o.jsx(u0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=mt):mt=e[56];let Ze;e[57]!==f?(Ze=be=>f(be.target.value),e[57]=f,e[58]=Ze):Ze=e[58];let rt;e[59]!==st||e[60]!==u||e[61]!==Ze?(rt=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[mt,o.jsx("input",{type:"text",value:u,onChange:Ze,placeholder:st,"aria-label":st,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=st,e[60]=u,e[61]=Ze,e[62]=rt):rt=e[62];let xt;e[63]!==ft||e[64]!==P||e[65]!==_t?(xt=_t&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:P,"aria-label":ft,children:o.jsx(Qt,{size:14})})}),o.jsx(Ke,{side:"bottom",children:ft})]}),e[63]=ft,e[64]=P,e[65]=_t,e[66]=xt):xt=e[66],e[67]!==rt||e[68]!==xt?(X=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[rt,xt]}),e[67]=rt,e[68]=xt,e[69]=X):X=e[69],ee=q&&(yt?o.jsx(Jle,{count:Oe,allSelected:Fe,onToggleSelectAll:it,onDelete:V,onExit:C}):o.jsx(Wle,{categories:Ce,authors:Pe,categoryFilter:p,statusCounts:je,authorFilter:m,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:L,onSortChange:_})),K=il,Z="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",G="flex flex-col gap-1 p-1.5",Y=s==="pages"?de.length===0?o.jsx(wc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):de.map(be=>{const Re=N?.collection==="pages"&&N.key===be.key,Me=ek(h,be.key);return o.jsx(yi,{icon:zr,title:be.name,subtitle:be.path,active:Re,variantCount:Me,onClick:()=>A({collection:"pages",key:be.key,path:be.path}),menu:o.jsx(Dd,{onDuplicate:()=>R(be),onRename:()=>E(be),onAddVariant:()=>I(be),onEditSeo:()=>O(be),onViewJson:()=>B(be),onDelete:()=>D(be)})},be.key)}):s==="sections"?ie.length===0&&he.length===0?o.jsx(wc,{hasItems:r.length>0||a.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[ue.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Iv,{icon:Wr,label:"Saved sections"}),ue.map(be=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:be.label}),be.sections.map(Re=>{const Me=N?.collection==="sections"&&N.key===Re.key;return o.jsx(yi,{icon:Wr,accent:"global",title:Re.name,subtitle:be.label,active:Me,onClick:()=>A({collection:"sections",key:Re.key}),menu:o.jsx(Dd,{onDuplicate:()=>M(Re),onRename:()=>z(Re),onDelete:()=>$(Re)})},Re.key)})]},be.label))]}),he.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Iv,{icon:zr,label:"Available sections",className:re(ue.length>0&&"mt-3")}),he.map(be=>{const Re=N?.collection==="available-section"&&N.resolveType===be.resolveType,Me=be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(yi,{icon:zr,title:be.title,subtitle:Me??be.resolveType,active:Re,onClick:()=>A({collection:"available-section",resolveType:be.resolveType,title:be.title})},be.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(et,{className:"size-4.5 text-muted-foreground"})}):ce.length===0?o.jsx(wc,{hasItems:l.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ce.map(be=>{const Re=N?.collection==="apps"&&be.blockKey!==null&&N.key===be.blockKey;return o.jsx(yi,{icon:_8,logoUrl:be.logo,title:be.title,subtitle:be.category,active:Re,trailing:be.installed?o.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!be.installed||!be.blockKey){ye.message(`${be.title} is not installed on this site.`);return}A({collection:"apps",key:be.blockKey})}},be.id)}):s==="redirects"?se.length===0?o.jsx(wc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):se.map(be=>o.jsx(yi,{icon:l8,title:be.from||"(no source)",subtitle:`→ ${be.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===be.key,trailing:o.jsx(Dae,{type:be.type}),onClick:()=>A({collection:"redirects",key:be.key}),menu:o.jsx(Dd,{onDelete:()=>U(be)})},be.key)):q?Ne.length===0?o.jsx(wc,{hasItems:ge.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Ne.map(be=>{const Re={key:be.key,kind:"posts",label:be.title,subtitle:be.slug};return o.jsx(yi,{icon:Ai,title:be.title,subtitle:be.slug||"no slug",invalid:be.missing.length>0,invalidReason:`Missing: ${be.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===be.key,selectable:!0,selectionActive:yt,selected:y.has(be.key),onToggleSelect:()=>S(be.key),onClick:()=>yt?S(be.key):A({collection:"posts",key:be.key}),menu:o.jsx(Dd,{onDuplicate:()=>H(Re),onDelete:()=>W(Re)})},be.key)}):ne.length===0?o.jsx(wc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${ka(s)?bu[s]:"item"}.`}):ne.map(be=>{const Re=N?.collection===be.kind&&N.key===be.key;return o.jsx(yi,{icon:be.kind==="posts"?Ai:be.kind==="authors"?v9:eg,title:be.label,subtitle:be.subtitle,active:Re,onClick:()=>A({collection:be.kind,key:be.key}),menu:o.jsx(Dd,{onDuplicate:()=>H(be),onDelete:()=>W(be)})},be.key)}),e[0]=s,e[1]=l,e[2]=c,e[3]=a,e[4]=d,e[5]=h,e[6]=I,e[7]=V,e[8]=j,e[9]=P,e[10]=W,e[11]=D,e[12]=U,e[13]=$,e[14]=H,e[15]=R,e[16]=M,e[17]=O,e[18]=C,e[19]=v,e[20]=b,e[21]=_,e[22]=L,e[23]=E,e[24]=z,e[25]=f,e[26]=A,e[27]=k,e[28]=S,e[29]=B,e[30]=n,e[31]=m,e[32]=w,e[33]=p,e[34]=x,e[35]=g,e[36]=i,e[37]=u,e[38]=r,e[39]=y,e[40]=N,e[41]=K,e[42]=G,e[43]=Y,e[44]=Z,e[45]=te,e[46]=X,e[47]=ee}else K=e[41],G=e[42],Y=e[43],Z=e[44],te=e[45],X=e[46],ee=e[47];let J;e[70]!==G||e[71]!==Y?(J=o.jsx("div",{className:G,children:Y}),e[70]=G,e[71]=Y,e[72]=J):J=e[72];let Q;e[73]!==K||e[74]!==Z||e[75]!==J?(Q=o.jsx(K,{className:Z,children:J}),e[73]=K,e[74]=Z,e[75]=J,e[76]=Q):Q=e[76];let oe;return e[77]!==te||e[78]!==X||e[79]!==ee||e[80]!==Q?(oe=o.jsxs("div",{className:te,children:[X,ee,Q]}),e[77]=te,e[78]=X,e[79]=ee,e[80]=Q,e[81]=oe):oe=e[81],oe}function pce(t){return t.key}function gce(t){return t.email}function xce(t){return t.slug}function bce(t){return typeof t=="string"?t:""}function vce(t){const e=F.c(25),{virtualMcpId:s}=t,n=ae(),[i,r]=T.useState(!1),a=As(s),{activeTask:l}=on();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},e[0]=c):c=e[0];const d=pr(c);if(!(xn(a?.metadata)||xn(l?.metadata))){let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(ur,{className:"size-7 text-foreground"})}),e[1]=f):f=e[1];let p;e[2]!==n?(p=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=p):p=e[3];let m;e[4]!==n?(m=n("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=n,e[5]=m):m=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>r(!0),x=o.jsx(ur,{className:"size-4"}),e[6]=g,e[7]=x):(g=e[6],x=e[7]);let b;e[8]!==n?(b=n("mainPanelTabs.previewTab.connectGithub"),e[8]=n,e[9]=b):b=e[9];let v;e[10]!==b?(v=o.jsxs(me,{onClick:g,children:[x,b]}),e[10]=b,e[11]=v):v=e[11];let L;e[12]!==p||e[13]!==m||e[14]!==v?(L=o.jsx(Ti,{className:"h-full",image:f,title:p,description:m,actions:v}),e[12]=p,e[13]=m,e[14]=v,e[15]=L):L=e[15];let _;e[16]!==i?(_=o.jsx(d0,{open:i,onOpenChange:r,mode:"agent"}),e[16]=i,e[17]=_):_=e[17];let y;return e[18]!==_||e[19]!==L?(y=o.jsxs(o.Fragment,{children:[L,_]}),e[18]=_,e[19]=L,e[20]=y):y=e[20],y}let u;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(u=o.jsx(uce,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=u):u=e[24],u}function yce(){const t=F.c(3),[e,s]=T.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=a=>{if(!a)return;const l=()=>s(a.clientWidth);l();const c=new ResizeObserver(l);return c.observe(a),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let r;return t[1]!==e?(r=[e,i],t[1]=e,t[2]=r):r=t[2],r}function _ce(t){const e=F.c(6),{virtualMcpId:s}=t,n=As(s),i=L7();let r;e[0]!==i||e[1]!==n?(r=h9(i,S7(n)),e[0]=i,e[1]=n,e[2]=r):r=e[2];const a=r;if(!a){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Lce,{}),e[3]=c):c=e[3],c}let l;return e[4]!==a?(l=o.jsx(kce,{config:a}),e[4]=a,e[5]=l):l=e[5],l}function Lce(){const t=F.c(12),e=ae();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:o.jsx(jg,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let a;t[7]!==r?(a=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=a):a=t[8];let l;return t[9]!==i||t[10]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,o.jsxs("div",{children:[i,a]})]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}function wce(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function Sce(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function kce(t){const e=F.c(99),{config:s}=t,n=ae(),[i,r]=T.useState(""),a=L9(i,300);let l;e[0]!==s.id||e[1]!==a?(l={configId:s.id,search:a},e[0]=s.id,e[1]=a,e[2]=l):l=e[2];const c=Hk(l),d=Y9(),[h,u]=T.useState(!1),[f,p]=T.useState(null),m=T.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const z=Array.from(M);if(z.length===0)return;const $=[];for(const U of z)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const W=H;$.push(`${U.name} (${W instanceof Error?W.message:"upload failed"})`)}await c.refetch(),$.length>0&&ye.error($.length===z.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:$.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:$.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),u(!0)},e[8]=b):b=e[8];const v=b;let L;e[9]===Symbol.for("react.memo_cache_sentinel")?(L=function(){u(!1)},e[9]=L):L=e[9];const _=L;let y;e[10]!==x?(y=function(M){M.preventDefault(),M.stopPropagation(),u(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=y):y=e[11];const w=y,[S,k]=yce();let j,C,V,N,A,P;if(e[12]!==s.name||e[13]!==a||e[14]!==k||e[15]!==S||e[16]!==x||e[17]!==h||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==w||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(jce),z=Sce(M,wce(S)),$=a.trim(),U=i!==a||c.isFetching&&!c.isFetchingNextPage;A="flex h-full min-h-0 flex-col gap-3 p-4";let H;e[31]!==n?(H=n("assets.browser.title"),e[31]=n,e[32]=H):H=e[32];let W;e[33]!==H?(W=o.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=W):W=e[34];let K;e[35]!==s.name||e[36]!==n?(K=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=K):K=e[37];let G;e[38]!==K?(G=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:K}),e[38]=K,e[39]=G):G=e[39];let Y;e[40]!==W||e[41]!==G?(Y=o.jsxs("div",{className:"min-w-0",children:[W,G]}),e[40]=W,e[41]=G,e[42]=Y):Y=e[42];let Z;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>m.current?.click(),e[43]=Z):Z=e[43];let te;e[44]!==d.isPending?(te=d.isPending?o.jsx(et,{className:"size-3.5"}):o.jsx(Gn,{size:14}),e[44]=d.isPending,e[45]=te):te=e[45];let X;e[46]!==n||e[47]!==d.isPending?(X=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=X):X=e[48];let ee;e[49]!==te||e[50]!==X||e[51]!==d.isPending?(ee=o.jsxs(me,{type:"button",size:"sm",disabled:d.isPending,onClick:Z,children:[te,X]}),e[49]=te,e[50]=X,e[51]=d.isPending,e[52]=ee):ee=e[52];let J;e[53]!==x?(J=o.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:ne=>{const q=Array.from(ne.target.files??[]);ne.target.value="",x(q)}}),e[53]=x,e[54]=J):J=e[54],e[55]!==Y||e[56]!==ee||e[57]!==J?(P=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Y,ee,J]}),e[55]=Y,e[56]=ee,e[57]=J,e[58]=P):P=e[58];let Q;e[59]!==n?(Q=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=Q):Q=e[60],e[61]!==U||e[62]!==i||e[63]!==Q?(j=o.jsx(b9,{value:i,onChange:r,isSearching:U,placeholder:Q,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=Q,e[64]=j):j=e[64];let oe;e[65]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>m.current?.click(),e[65]=oe):oe=e[65];const le=h&&"border-primary bg-primary/5",de=d.isPending&&"pointer-events-none opacity-60";let se;e[66]!==le||e[67]!==de?(se=re("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",le,de),e[66]=le,e[67]=de,e[68]=se):se=e[68];let ie;e[69]===Symbol.for("react.memo_cache_sentinel")?(ie=o.jsx(Gn,{size:16,className:"text-muted-foreground"}),e[69]=ie):ie=e[69];let he;e[70]!==n?(he=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=he):he=e[71];let ue;e[72]!==n?(ue=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=ue):ue=e[73];let ce;e[74]!==he||e[75]!==ue?(ce=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[he," ",ue]}),e[74]=he,e[75]=ue,e[76]=ce):ce=e[76],e[77]!==w||e[78]!==se||e[79]!==ce?(C=o.jsxs("button",{type:"button",onClick:oe,onDragOver:v,onDragLeave:_,onDrop:w,className:se,children:[ie,ce]}),e[77]=w,e[78]=se,e[79]=ce,e[80]=C):C=e[80],V="min-h-0 flex-1 overflow-y-auto pr-1",N=M.length===0?$?o.jsx(zv,{title:n("filePicker.filePickerDialog.noMatches",{query:$}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(zv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:z.map((ne,q)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ne.map(fe=>o.jsx(Cce,{item:fe,onDelete:()=>p(fe)},fe.key))},q))}),e[12]=s.name,e[13]=a,e[14]=k,e[15]=S,e[16]=x,e[17]=h,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=w,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=C,e[27]=V,e[28]=N,e[29]=A,e[30]=P}else j=e[25],C=e[26],V=e[27],N=e[28],A=e[29],P=e[30];let R;e[81]!==c||e[82]!==n?(R=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(me,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=R):R=e[83];let E;e[84]!==R||e[85]!==V||e[86]!==N?(E=o.jsxs("div",{className:V,children:[N,R]}),e[84]=R,e[85]=V,e[86]=N,e[87]=E):E=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>p(null),e[88]=I):I=e[88];let D;e[89]!==s.id||e[90]!==f?(D=o.jsx(Tce,{configId:s.id,item:f,onClose:I}),e[89]=s.id,e[90]=f,e[91]=D):D=e[91];let O;return e[92]!==j||e[93]!==C||e[94]!==E||e[95]!==D||e[96]!==A||e[97]!==P?(O=o.jsxs("div",{className:A,children:[P,j,C,E,D]}),e[92]=j,e[93]=C,e[94]=E,e[95]=D,e[96]=A,e[97]=P,e[98]=O):O=e[98],O}function jce(t){return t.items}function zv(t){const e=F.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ni,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==n?(a=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=a):a=e[4];let l;return e[5]!==r||e[6]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,r,a]}),e[5]=r,e[6]=a,e[7]=l):l=e[7],l}function Cce(t){const e=F.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=Kk(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let a;e[2]!==s.key?(a=m4(s.key),e[2]=s.key,e[3]=a):a=e[3];const l=a;let c;e[4]!==l||e[5]!==s.key||e[6]!==s.publicUrl?(c=l?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:Nce}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Ai,{size:28,className:"text-muted-foreground"})}),e[4]=l,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=o.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const h=s.key;let u;e[12]!==s.key?(u=Af(s.key),e[12]=s.key,e[13]=u):u=e[13];let f;e[14]!==s.key||e[15]!==u?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:h,children:u}),e[14]=s.key,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==s.size?(p=Wk(s.size),e[17]=s.size,e[18]=p):p=e[18];let m;e[19]!==r||e[20]!==p?(m=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",p]}),e[19]=r,e[20]=p,e[21]=m):m=e[21];let g;e[22]!==f||e[23]!==m?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,m]}),e[22]=f,e[23]=m,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(Vce,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=o.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let v;return e[31]!==b||e[32]!==d?(v=o.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=v):v=e[33],v}function Nce(t){t.target.style.display="none"}function Vce(t){const e=F.c(36),{item:s,onDelete:n}=t,i=ae(),[r,a]=T.useState(!1);let l;e[0]!==s.publicUrl||e[1]!==i?(l=async function(){try{await navigator.clipboard.writeText(s.publicUrl),a(!0),window.setTimeout(()=>a(!1),1500)}catch{ye.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=l):l=e[2];const c=l;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(c0,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx($t,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==r?(f=r?o.jsx(Gt,{size:14}):o.jsx(bn,{size:14}),e[8]=r,e[9]=f):f=e[9];let p;e[10]!==r||e[11]!==i?(p=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=p):p=e[12];let m;e[13]!==c||e[14]!==f||e[15]!==p?(m=o.jsxs(Qe,{onClick:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(hn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let v;e[20]!==s.publicUrl||e[21]!==b?(v=o.jsx(Qe,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=v):v=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(rn,{size:14}),e[23]=L):L=e[23];let _;e[24]!==i?(_=i("assets.browser.deleteAction"),e[24]=i,e[25]=_):_=e[25];let y;e[26]!==n||e[27]!==_?(y=o.jsxs(Qe,{variant:"destructive",onClick:n,children:[L,_]}),e[26]=n,e[27]=_,e[28]=y):y=e[28];let w;e[29]!==v||e[30]!==y||e[31]!==m?(w=o.jsxs(Bt,{align:"end",children:[m,v,y]}),e[29]=v,e[30]=y,e[31]=m,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==u?(S=o.jsxs(Ot,{children:[u,w]}),e[33]=w,e[34]=u,e[35]=S):S=e[35],S}function Tce(t){const e=F.c(47),{configId:s,item:n,onClose:i}=t,r=ae(),a=Pie();let l;e[0]!==s||e[1]!==a||e[2]!==n||e[3]!==i||e[4]!==r?(l=async function(){if(n)try{await a.mutateAsync({configId:s,key:n.key}),ye.success(r("assets.browser.deleted")),i()}catch{ye.error(r("assets.browser.deleteFailed"))}},e[0]=s,e[1]=a,e[2]=n,e[3]=i,e[4]=r,e[5]=l):l=e[5];const c=l,d=!!n;let h;e[6]!==i?(h=N=>!N&&i(),e[6]=i,e[7]=h):h=e[7];let u;e[8]!==r?(u=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=u):u=e[9];let f;e[10]!==u?(f=o.jsx(Xr,{children:u}),e[10]=u,e[11]=f):f=e[11];let p;e[12]!==n||e[13]!==r?(p=r("assets.browser.deleteConfirmDescription",{name:n?Af(n.key):""}),e[12]=n,e[13]=r,e[14]=p):p=e[14];let m;e[15]!==p?(m=o.jsx(Jr,{children:p}),e[15]=p,e[16]=m):m=e[16];let g;e[17]!==f||e[18]!==m?(g=o.jsxs(Qr,{children:[f,m]}),e[17]=f,e[18]=m,e[19]=g):g=e[19];const x=a.isPending;let b;e[20]!==r?(b=r("assets.browser.deleteCancel"),e[20]=r,e[21]=b):b=e[21];let v;e[22]!==a.isPending||e[23]!==b?(v=o.jsx(eo,{disabled:x,children:b}),e[22]=a.isPending,e[23]=b,e[24]=v):v=e[24];let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=re(A6({variant:"destructive"})),e[25]=L):L=e[25];const _=a.isPending;let y;e[26]!==c?(y=N=>{N.preventDefault(),c()},e[26]=c,e[27]=y):y=e[27];let w;e[28]!==a.isPending?(w=a.isPending?o.jsx(et,{className:"size-3.5"}):null,e[28]=a.isPending,e[29]=w):w=e[29];let S;e[30]!==r?(S=r("assets.browser.deleteConfirm"),e[30]=r,e[31]=S):S=e[31];let k;e[32]!==a.isPending||e[33]!==y||e[34]!==w||e[35]!==S?(k=o.jsxs(to,{className:L,disabled:_,onClick:y,children:[w,S]}),e[32]=a.isPending,e[33]=y,e[34]=w,e[35]=S,e[36]=k):k=e[36];let j;e[37]!==v||e[38]!==k?(j=o.jsxs(Zr,{children:[v,k]}),e[37]=v,e[38]=k,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=o.jsxs(Yr,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let V;return e[43]!==C||e[44]!==d||e[45]!==h?(V=o.jsx(Gr,{open:d,onOpenChange:h,children:C}),e[43]=C,e[44]=d,e[45]=h,e[46]=V):V=e[46],V}const am={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:oo},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Fr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:W6}},Ace=["fast","smart","thinking"];function Pce(t){const e=F.c(19),{tier:s,onSelect:n}=t,i=ae(),[r,a]=T.useState(!1),l=am[s].icon;let c;e[0]!==l?(c=o.jsx(l,{size:14,className:"text-muted-foreground"}),e[0]=l,e[1]=c):c=e[1];const d=am[s];let h;e[2]!==i||e[3]!==d.labelKey?(h=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=h):h=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(hs,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==h?(f=o.jsx(ws,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,h,u]})}),e[6]=c,e[7]=h,e[8]=f):f=e[8];let p;e[9]!==n||e[10]!==i||e[11]!==s?(p=Ace.map(x=>{const b=am[x],v=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),a(!1)},className:re("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-sm",children:i(b.labelKey)}),o.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&o.jsx(Gt,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=p):p=e[12];let m;e[13]!==p?(m=o.jsx(ks,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:p})}),e[13]=p,e[14]=m):m=e[14];let g;return e[15]!==r||e[16]!==f||e[17]!==m?(g=o.jsxs(js,{open:r,onOpenChange:a,children:[f,m]}),e[15]=r,e[16]=f,e[17]=m,e[18]=g):g=e[18],g}function Ece(t){const e=F.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,a=ae(),[l,c]=T.useState(i!==null);let d;e[0]!==a?(d=a("automations.automationConfig.modelLabel"),e[0]=a,e[1]=d):d=e[1];let h;e[2]!==d?(h=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=h):h=e[3];let u;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==a||e[8]!==s||e[9]!==l?(u=l?o.jsx(T.Suspense,{fallback:o.jsx(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:a("automations.automationConfig.loadingModels")}),children:o.jsx(Rce,{override:i,onOverrideChange:r})}):o.jsx(Pce,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=a,e[8]=s,e[9]=l,e[10]=u):u=e[10];let f;e[11]!==r?(f=v=>{c(v),v||r(null)},e[11]=r,e[12]=f):f=e[12];let p;e[13]!==f||e[14]!==l?(p=o.jsx(lo,{checked:l,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=l,e[15]=p):p=e[15];let m;e[16]!==a?(m=a("automations.automationConfig.specificModel"),e[16]=a,e[17]=m):m=e[17];let g;e[18]!==p||e[19]!==m?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[p,m]}),e[18]=p,e[19]=m,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u,g]}),e[21]=u,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==h||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[h,x]}),e[24]=h,e[25]=x,e[26]=b):b=e[26],b}function Rce(t){const e=F.c(25),{override:s,onOverrideChange:n}=t,i=ae(),r=m9(),a=r[0]?.id??null;let l;e[0]!==a||e[1]!==r||e[2]!==s?.credentialId?(l=r.some(b=>b.id===s?.credentialId)?s?.credentialId??null:a,e[0]=a,e[1]=r,e[2]=s?.credentialId,e[3]=l):l=e[3];const[c,d]=T.useState(l);let h;e[4]!==c||e[5]!==a||e[6]!==r?(h=r.some(b=>b.id===c)?c:a,e[4]=c,e[5]=a,e[6]=r,e[7]=h):h=e[7];const u=h;let f;e[8]!==r||e[9]!==s?(f=s&&r.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=r,e[9]=s,e[10]=f):f=e[10];const p=f;if(r.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let v;return e[13]!==b?(v=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}let m;e[15]!==i?(m=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=m):m=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const v=b.keyId??u??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==p||e[22]!==m||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(bP,{variant:"bordered",placeholder:m,model:p,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=p,e[22]=m,e[23]=g,e[24]=x):x=e[24],x}const Aj=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Pg,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:jn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:ni},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:qr},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:e0}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Qo,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:l9},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:_9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:G2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Tu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Qo},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:_A}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Ia,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Ia},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Hc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Hc}]}],Dce=Aj.flatMap(t=>t.tools.map(e=>e.name));function Mce(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Ice(t){const e=F.c(12),{agentId:s,value:n,onChange:i}=t,r=ae();let a;e[0]!==r?(a=r("automations.automationConfig.toolsLabel"),e[0]=r,e[1]=a):a=e[1];let l;e[2]!==a?(l=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:a}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==r||e[7]!==n?(c=s?o.jsx(T.Suspense,{fallback:o.jsxs(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(Pg,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(Oce,{agentId:s,value:n,onChange:i})}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:r("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=r,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function Fv(t){const e=F.c(17),{value:s,checked:n,onToggle:i,title:r,description:a,leading:l}=t;let c;e[0]!==n?(c=o.jsx(rl,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==l?(d=l&&o.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r?(h=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=h):h=e[5];let u;e[6]!==a?(u=a&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==h||e[9]!==u?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h,u]}),e[8]=h,e[9]=u,e[10]=f):f=e[10];let p;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(p=o.jsxs($s,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=p):p=e[16],p}function Uv(t){const e=F.c(27),{conn:s,label:n,icon:i,on:r,total:a,onToggle:l}=t,c=ae(),d=r===a;let h;e[0]!==i||e[1]!==s?(h=s?o.jsx(ao,{icon:s.icon,name:s.title,size:"2xs"}):i?o.jsx(i,{size:14,className:"text-muted-foreground"}):o.jsx(t7,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=h):h=e[2];let u;e[3]!==s?.title||e[4]!==n||e[5]!==c?(u=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==a?(p=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[r,"/",a]}),e[9]=r,e[10]=a,e[11]=p):p=e[11];let m;e[12]!==l?(m=L=>{L.stopPropagation(),l()},e[12]=l,e[13]=m):m=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==m||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=m,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==p||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[p,x]}),e[20]=p,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==h||e[24]!==f||e[25]!==b?(v=o.jsxs("div",{className:"flex items-center gap-2",children:[h,f,b]}),e[23]=h,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function Oce(t){const e=F.c(83),{agentId:s,value:n,onChange:i}=t,r=ae(),{org:a}=Ue(),[l,c]=T.useState(!1);let d;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const h=Cn(d);let u;e[4]!==h?(u={client:h},e[4]=h,e[5]=u):u=e[5];const{data:f,isLoading:p}=F8(u),m=dr();let g,x,b,v,L,_,y,w,S,k,j,C,V;if(e[6]!==m||e[7]!==f?.tools||e[8]!==p||e[9]!==i||e[10]!==l||e[11]!==r||e[12]!==n){const E=new Map(m.map(Uce)),I=new Map;for(const ue of f?.tools??[]){const ce=Br(ue._meta)??"__other__",ne=Gu(ue.name,ce==="__other__"?void 0:ce),q=ue.title,fe=q&&q!==ue.name?q:Mce(ne);I.has(ce)||I.set(ce,{clientId:ce,conn:E.get(ce),tools:[]}),I.get(ce).tools.push({name:ue.name,display:fe,description:ue.description})}const D=[...I.values()].sort(Fce),O=(f?.tools??[]).map(zce),B=[...Dce,...O],M=n===null?new Set(B):new Set(n),z=B.every(ue=>M.has(ue)),$=ue=>i(B.every(ce=>ue.has(ce))?null:[...ue]),U=ue=>{const ce=new Set(M);ce.has(ue)?ce.delete(ue):ce.add(ue),$(ce)},H=(ue,ce)=>{const ne=new Set(M);for(const q of ue)ce?ne.add(q):ne.delete(q);$(ne)};v=js,V=l,L=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(Pg,{size:14,className:"text-muted-foreground"}),e[26]=W):W=e[26];let K;e[27]!==z||e[28]!==r?(K=r(z?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=z,e[28]=r,e[29]=K):K=e[29];const G=!z&&o.jsxs(FE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",B.length]});let Y;e[30]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(hs,{size:14,className:"text-muted-foreground"}),e[30]=Y):Y=e[30],e[31]!==K||e[32]!==G?(_=o.jsx(ws,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,K,G,Y]})}),e[31]=K,e[32]=G,e[33]=_):_=e[33],b=ks,j="p-0 w-80",C="start",x=vr;let Z;e[34]!==r?(Z=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=Z):Z=e[35],e[36]!==Z?(S=o.jsx(Mi,{placeholder:Z}),e[36]=Z,e[37]=S):S=e[37];const te=z?r("automations.automationConfig.allToolsEnabled",{count:B.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:B.length});let X;e[38]!==te?(X=o.jsx("span",{className:"text-xs text-muted-foreground",children:te}),e[38]=te,e[39]=X):X=e[39];let ee;e[40]!==i?(ee=()=>i(null),e[40]=i,e[41]=ee):ee=e[41];let J;e[42]!==r?(J=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=J):J=e[43];let Q;e[44]!==z||e[45]!==ee||e[46]!==J?(Q=o.jsx("button",{type:"button",onClick:ee,disabled:z,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:J}),e[44]=z,e[45]=ee,e[46]=J,e[47]=Q):Q=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=oe):oe=e[48];let le;e[49]!==i?(le=()=>i([]),e[49]=i,e[50]=le):le=e[50];const de=M.size===0;let se;e[51]!==r?(se=r("automations.automationConfig.clear"),e[51]=r,e[52]=se):se=e[52];let ie;e[53]!==le||e[54]!==de||e[55]!==se?(ie=o.jsx("button",{type:"button",onClick:le,disabled:de,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:se}),e[53]=le,e[54]=de,e[55]=se,e[56]=ie):ie=e[56];let he;e[57]!==Q||e[58]!==ie?(he=o.jsxs("div",{className:"flex items-center gap-2",children:[Q,oe,ie]}),e[57]=Q,e[58]=ie,e[59]=he):he=e[59],e[60]!==X||e[61]!==he?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[X,he]}),e[60]=X,e[61]=he,e[62]=k):k=e[62],g=Ii,y="max-h-80",w=p?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(ri,{children:r("automations.automationConfig.noToolsFound")}),Aj.map(ue=>{const ce=ue.tools.map(Bce),ne=ce.filter(q=>M.has(q)).length;return o.jsx(fn,{heading:o.jsx(Uv,{label:r(ue.headingKey),icon:ue.icon,on:ne,total:ce.length,onToggle:()=>H(ce,ne!==ce.length)}),children:ue.tools.map(q=>o.jsx(Fv,{value:`${r(q.titleKey)} ${q.name}`,checked:M.has(q.name),onToggle:()=>U(q.name),title:r(q.titleKey),description:r(q.descriptionKey),leading:o.jsx(q.icon,{size:16,className:"text-muted-foreground"})},q.name))},ue.key)}),D.map(ue=>{const ce=ue.tools.map($ce),ne=ce.filter(q=>M.has(q)).length;return o.jsx(fn,{heading:o.jsx(Uv,{conn:ue.conn,on:ne,total:ce.length,onToggle:()=>H(ce,ne!==ce.length)}),children:ue.tools.map(q=>o.jsx(Fv,{value:`${q.display} ${q.name} ${ue.conn?.title??""}`,checked:M.has(q.name),onToggle:()=>U(q.name),title:q.display,description:q.description},q.name))},ue.clientId)})]}),e[6]=m,e[7]=f?.tools,e[8]=p,e[9]=i,e[10]=l,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=L,e[18]=_,e[19]=y,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=C,e[25]=V}else g=e[13],x=e[14],b=e[15],v=e[16],L=e[17],_=e[18],y=e[19],w=e[20],S=e[21],k=e[22],j=e[23],C=e[24],V=e[25];let N;e[63]!==g||e[64]!==y||e[65]!==w?(N=o.jsx(g,{className:y,children:w}),e[63]=g,e[64]=y,e[65]=w,e[66]=N):N=e[66];let A;e[67]!==x||e[68]!==N||e[69]!==S||e[70]!==k?(A=o.jsxs(x,{children:[S,k,N]}),e[67]=x,e[68]=N,e[69]=S,e[70]=k,e[71]=A):A=e[71];let P;e[72]!==b||e[73]!==A||e[74]!==j||e[75]!==C?(P=o.jsx(b,{className:j,align:C,children:A}),e[72]=b,e[73]=A,e[74]=j,e[75]=C,e[76]=P):P=e[76];let R;return e[77]!==v||e[78]!==L||e[79]!==_||e[80]!==P||e[81]!==V?(R=o.jsxs(v,{open:V,onOpenChange:L,children:[_,P]}),e[77]=v,e[78]=L,e[79]=_,e[80]=P,e[81]=V,e[82]=R):R=e[82],R}function $ce(t){return t.name}function Bce(t){return t.name}function zce(t){return t.name}function Fce(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function Uce(t){return[t.id,t]}function vu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Hce(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(i){const l=parseInt(i[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const r=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(r){const l=(r[2]??"0").padStart(2,"0"),c=(r[1]??"0").padStart(2,"0");return`Every day at ${l}:${c} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",d=(a[2]??"0").padStart(2,"0"),h=(a[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${h} UTC`}return t}function Kce(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function Wce(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return i?{count:parseInt(i[1]),unit:"days"}:null}function qce(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Gce=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Yce({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const a=ae(),{triggerAdd:l}=f0(),[c,d]=T.useState(!1),h=e??c,u=m=>{s?s(m):d(m)},f=async m=>{try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),ye.success(a("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:a("automations.addStarterPopover.failedAddStarter");ye.error(x)}},p=async()=>{try{const m=await l.mutateAsync({automation_id:t,type:"webhook"});u(!1),m.webhook?r?.(m.webhook):ye.success(a("automations.addStarterPopover.webhookStarterAdded"))}catch(m){const g=m instanceof Error?m.message:a("automations.addStarterPopover.failedAddWebhookStarter");ye.error(g)}};return o.jsxs(Ot,{open:h,onOpenChange:u,children:[o.jsx($t,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(Qt,{size:14}),a("automations.addStarterPopover.addStarter")]})}),o.jsxs(Bt,{align:"end",className:"w-[200px]",children:[o.jsxs(_i,{children:[o.jsxs(Li,{className:"gap-2.5",children:[o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.every")]}),o.jsx(wi,{className:"w-[160px]",children:Gce.map(m=>o.jsxs(Qe,{className:"gap-2.5",onSelect:()=>f(m.cron),disabled:l.isPending,children:[o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.everyUnit",{unit:m.label})]},m.cron))})]}),o.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.customCron")]}),o.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{u(!1),i?.()},children:[o.jsx(hr,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.event")]}),o.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{p()},disabled:l.isPending,children:[o.jsx(jn,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.webhook")]})]})]})}function Pj(t){const e=F.c(39),{open:s,onOpenChange:n,url:i,token:r,title:a,description:l}=t,c=a===void 0?"Webhook ready":a,d=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,h=ae(),[u,f]=T.useState(null),[p,m]=T.useState("curl"),[g,x]=T.useState("header"),b=T.useId();let v;e[0]!==h?(v=async(D,O)=>{try{await navigator.clipboard.writeText(D),f(O),ye.success(h("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ye.error(h("automations.webhookSecretDialog.failedCopy"))}},e[0]=h,e[1]=v):v=e[1];const L=v;let _;e[2]!==g||e[3]!==r||e[4]!==i?(_=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=_):_=e[5];const y=_,w=i&&r?g==="header"?`curl -X POST "${y}" \\
634
+ `)};Vn.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),a=L4(n)?n(e[1]):n[e[1]];if(a!=null){var l=e[6],c=e[5],d=e[4],h=a;c==0&&d&&(h=this.indentPartial(a,d,l));var u=this.parse(h,r);return this.renderTokens(u,s,n,h,i)}}};Vn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Vn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ri.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Ri.escape?String(r):i(r)};Vn.prototype.rawValue=function(e){return e[1]};Vn.prototype.getConfigTags=function(e){return yd(e)?e:e&&typeof e=="object"?e.tags:void 0};Vn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!yd(e))return e.escape};var Ri={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Fu.templateCache=t},get templateCache(){return Fu.templateCache}},Fu=new Vn;Ri.clearCache=function(){return Fu.clearCache()};Ri.parse=function(e,s){return Fu.parse(e,s)};Ri.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Cle(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Fu.render(e,s,n,i)};Ri.escape=Rle;Ri.Scanner=T0;Ri.Context=sd;Ri.Writer=Vn;function Fle(t,e){const s={__resolveType:t},n=QS([s],e)[0];return n?Mne(s,n,e):null}function Ule({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:a,onSaveReferencedBlock:l}){const c=ae(),d=ho(),h=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=T.useState(()=>Fle(a,r)),[f,p]=T.useState(u?.data??{}),[m,g]=T.useState([]),[x,b]=T.useState(0),[v,L]=T.useState(!1),[_,y]=T.useState(null),w=_!==null,{save:S,flush:k}=n4({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?In(u.resolveType,i):null,C=r[a],V=C?Wa(a,C):a,N=Ts()?.taskId??null,A={orgSlug:t,virtualMcpId:e,branch:s,threadId:N,previewUrl:n??void 0,siteSlug:h},P=O=>{p(O),S(a,O)},R=()=>{w?(y(null),L(!1),b(O=>O+1)):y(JSON.stringify(f,null,2))},E=O=>{const B=O??"";try{const M=JSON.parse(B);if(M&&typeof M=="object"&&!Array.isArray(M)){L(!1),P(M);return}L(!0)}catch{L(!0)}},I=[V,...m],D=O=>{g(m.slice(0,O)),b(B=>B+1)};return o.jsx("div",{className:"flex h-full w-full min-w-0",children:o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:z3},"aria-hidden":!0}),o.jsx("nav",{"aria-label":c("sandbox.savedSectionEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:I.map((O,B)=>{const M=B===I.length-1,z=kn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[B>0&&o.jsx(Ns,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>D(B),title:z,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",M?"font-medium text-foreground":"text-muted-foreground"),children:z})]},`${z}-${B}`)})}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:R,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?o.jsx(nn,{size:14}):o.jsx(rd,{size:14})})}),o.jsx(Ke,{side:"bottom",children:c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),o.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:c("sandbox.savedSectionEditor.globalSectionDescription")})]}),o.jsxs("div",{className:"relative min-h-0 flex-1",children:[o.jsx(il,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:o.jsx("div",{className:"mx-auto max-w-2xl",children:j?o.jsx(Bi,{schema:j,value:f,onChange:O=>P(O),basePath:"",breadcrumbPath:m,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:l,sandbox:A},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),_!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[v&&o.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.savedSectionEditor.invalidJsonError")}),o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(hd,{language:"json",height:"100%",code:_,onChange:E,onSave:O=>{E(O),k()}})})]})]})]})})}function Hle(t){const e=F.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:a,meta:l,decofile:c,isCreating:d,onCreateAvailable:h,onSaveReferencedBlock:u}=t,f=ae();if(!s){let g;e[0]!==f?(g=f("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=f,e[1]=g):g=e[1];let x;e[2]!==f?(x=f("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=f,e[3]=x):x=e[3];let b;return e[4]!==g||e[5]!==x?(b=o.jsx(Bo,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=b):b=e[6],b}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,b=s.title;let v;e[7]!==s.title?(v=Fk(s.title),e[7]=s.title,e[8]=v):v=e[8];let L;e[9]!==h||e[10]!==s.resolveType?(L=(y,w)=>h(s.resolveType,y,w),e[9]=h,e[10]=s.resolveType,e[11]=L):L=e[11];let _;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==l||e[16]!==u||e[17]!==n||e[18]!==a||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==L||e[24]!==i?(_=o.jsx(Sle,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:a,meta:l,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:L,onSaveReferencedBlock:u},g),e[12]=r,e[13]=c,e[14]=d,e[15]=l,e[16]=u,e[17]=n,e[18]=a,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=L,e[24]=i,e[25]=_):_=e[25],_}const p=`saved:${s.key}`;let m;return e[26]!==r||e[27]!==c||e[28]!==l||e[29]!==u||e[30]!==n||e[31]!==a||e[32]!==s.key||e[33]!==p||e[34]!==i?(m=o.jsx(Ule,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:a,meta:l,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},p),e[26]=r,e[27]=c,e[28]=l,e[29]=u,e[30]=n,e[31]=a,e[32]=s.key,e[33]=p,e[34]=i,e[35]=m):m=e[35],m}const Pv="__all__",Ev={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Kle={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},Mh={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Rv="status:";function Dv(t){if(!t.startsWith(Rv))return null;const e=t.slice(Rv.length);return e in Mh?e:null}const Mv=T.forwardRef(function(e,s){const n=F.c(20);let i,r,a,l,c;n[0]!==e?({icon:i,active:r,value:c,className:a,...l}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=a,n[4]=l,n[5]=c):(i=n[1],r=n[2],a=n[3],l=n[4],c=n[5]);const d=r?"text-foreground":"text-muted-foreground";let h;n[6]!==a||n[7]!==d?(h=re("h-7 gap-1 px-1.5 text-xs",d,a),n[6]=a,n[7]=d,n[8]=h):h=n[8];let u;n[9]!==i?(u=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=u):u=n[10];let f;n[11]!==c?(f=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let p;n[13]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(hs,{size:12,className:"shrink-0 opacity-60"}),n[13]=p):p=n[13];let m;return n[14]!==l||n[15]!==s||n[16]!==h||n[17]!==u||n[18]!==f?(m=o.jsxs(me,{ref:s,type:"button",variant:"ghost",size:"sm",className:h,...l,children:[u,f,p]}),n[14]=l,n[15]=s,n[16]=h,n[17]=u,n[18]=f,n[19]=m):m=n[19],m});function w4(t){const e=F.c(2),{count:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Wle(t){const e=F.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:a,statusFilter:l,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:h,onStatusFilterChange:u,onSortChange:f}=t,p=ae();let m;if(e[0]!==s||e[1]!==r){let se;e[3]!==r?(se=ie=>ie.slug===r,e[3]=r,e[4]=se):se=e[4],m=s.find(se),e[0]=s,e[1]=r,e[2]=m}else m=e[2];const g=m;let x;if(e[5]!==a||e[6]!==n){let se;e[8]!==a?(se=ie=>ie.email===a,e[8]=a,e[9]=se):se=e[9],x=n.find(se),e[5]=a,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(r||a||l);let L;e[10]!==b?.name||e[11]!==g?.name||e[12]!==l||e[13]!==p?(L=g?.name??b?.name??p(l?Mh[l]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=l,e[13]=p,e[14]=L):L=e[14];const _=L,y=r?`cat:${r}`:a?`author:${a}`:l?`status:${l}`:Pv;let w;e[15]!==h||e[16]!==d||e[17]!==u?(w=()=>{d(null),h(null),u(null)},e[15]=h,e[16]=d,e[17]=u,e[18]=w):w=e[18];const S=w;let k;e[19]!==S||e[20]!==h||e[21]!==d||e[22]!==u?(k=se=>{se.startsWith("cat:")?(h(null),u(null),d(se.slice(4))):se.startsWith("author:")?(d(null),u(null),h(se.slice(7))):Dv(se)?(d(null),h(null),u(Dv(se))):S()},e[19]=S,e[20]=h,e[21]=d,e[22]=u,e[23]=k):k=e[23];const j=k;let C;e[24]!==_||e[25]!==v?(C=o.jsx($t,{asChild:!0,children:o.jsx(Mv,{icon:vA,active:v,value:_,className:"min-w-0 shrink"})}),e[24]=_,e[25]=v,e[26]=C):C=e[26];let V;e[27]!==p?(V=p("sandbox.postToolbar.filterBy"),e[27]=p,e[28]=V):V=e[28];let N;e[29]!==V?(N=o.jsx(kd,{children:V}),e[29]=V,e[30]=N):N=e[30];let A;e[31]!==p?(A=p("sandbox.postToolbar.allPosts"),e[31]=p,e[32]=A):A=e[32];let P;e[33]!==A?(P=o.jsx(Uo,{value:Pv,children:A}),e[33]=A,e[34]=P):P=e[34];let R;e[35]!==p?(R=p("sandbox.postToolbar.statusLabel"),e[35]=p,e[36]=R):R=e[36];let E;e[37]!==R?(E=o.jsx(kd,{className:"text-muted-foreground/70",children:R}),e[37]=R,e[38]=E):E=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(Mh),e[39]=I):I=e[39];let D;e[40]!==i||e[41]!==p?(D=I.map(se=>o.jsxs(Uo,{value:`status:${se}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:p(Mh[se])}),o.jsx(w4,{count:i[se]})]},`status:${se}`)),e[40]=i,e[41]=p,e[42]=D):D=e[42];let O;e[43]!==s.length||e[44]!==p?(O=s.length>0&&o.jsx(kd,{className:"text-muted-foreground/70",children:p("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=p,e[45]=O):O=e[45];let B;e[46]!==s?(B=s.map(Gle),e[46]=s,e[47]=B):B=e[47];let M;e[48]!==n.length||e[49]!==p?(M=n.length>0&&o.jsx(kd,{className:"text-muted-foreground/70",children:p("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=p,e[50]=M):M=e[50];let z;e[51]!==n?(z=n.map(qle),e[51]=n,e[52]=z):z=e[52];let $;e[53]!==y||e[54]!==j||e[55]!==P||e[56]!==E||e[57]!==D||e[58]!==O||e[59]!==B||e[60]!==M||e[61]!==z?($=o.jsxs(Xh,{value:y,onValueChange:j,children:[P,E,D,O,B,M,z]}),e[53]=y,e[54]=j,e[55]=P,e[56]=E,e[57]=D,e[58]=O,e[59]=B,e[60]=M,e[61]=z,e[62]=$):$=e[62];let U;e[63]!==$||e[64]!==N?(U=o.jsxs(Bt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[N,$]}),e[63]=$,e[64]=N,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=o.jsxs(Ot,{children:[C,U]}),e[66]=U,e[67]=C,e[68]=H):H=e[68];let W;e[69]!==S||e[70]!==v||e[71]!==p?(W=v&&o.jsx(Yle,{label:p("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=v,e[71]=p,e[72]=W):W=e[72];const K=Kle[c];let G;e[73]!==p||e[74]!==K?(G=p(K),e[73]=p,e[74]=K,e[75]=G):G=e[75];let Y;e[76]!==G?(Y=o.jsx($t,{asChild:!0,children:o.jsx(Mv,{icon:yA,active:!0,value:G})}),e[76]=G,e[77]=Y):Y=e[77];let Z;e[78]!==p?(Z=p("sandbox.postToolbar.sortBy"),e[78]=p,e[79]=Z):Z=e[79];let te;e[80]!==Z?(te=o.jsx(kd,{children:Z}),e[80]=Z,e[81]=te):te=e[81];let X;e[82]!==f?(X=se=>f(se),e[82]=f,e[83]=X):X=e[83];let ee;e[84]===Symbol.for("react.memo_cache_sentinel")?(ee=Object.keys(Ev),e[84]=ee):ee=e[84];let J;e[85]!==p?(J=ee.map(se=>o.jsx(Uo,{value:se,children:p(Ev[se])},se)),e[85]=p,e[86]=J):J=e[86];let Q;e[87]!==c||e[88]!==X||e[89]!==J?(Q=o.jsx(Xh,{value:c,onValueChange:X,children:J}),e[87]=c,e[88]=X,e[89]=J,e[90]=Q):Q=e[90];let oe;e[91]!==te||e[92]!==Q?(oe=o.jsxs(Bt,{align:"end",className:"w-44",children:[te,Q]}),e[91]=te,e[92]=Q,e[93]=oe):oe=e[93];let le;e[94]!==Y||e[95]!==oe?(le=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs(Ot,{children:[Y,oe]})}),e[94]=Y,e[95]=oe,e[96]=le):le=e[96];let de;return e[97]!==H||e[98]!==W||e[99]!==le?(de=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,W,le]}),e[97]=H,e[98]=W,e[99]=le,e[100]=de):de=e[100],de}function qle(t){return o.jsxs(Uo,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(w4,{count:t.count})]},`author:${t.email}`)}function Gle(t){return o.jsxs(Uo,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(w4,{count:t.count})]},`cat:${t.slug}`)}function Yle(t){const e=F.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(nn,{size:12}),e[0]=i):i=e[0];let r;return e[1]!==s||e[2]!==n?(r=o.jsx("button",{type:"button","aria-label":s,onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:i}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function Qle(t){const e=F.c(18),{checked:s,disabled:n,onToggle:i}=t,r=ae();let a;e[0]!==i?(a=()=>i(),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==r?(l=r(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=r,e[4]=l):l=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==a||e[8]!==l?(c=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Xle,children:o.jsx(rl,{checked:s,disabled:n,onCheckedChange:a,"aria-label":l})})}),e[5]=s,e[6]=n,e[7]=a,e[8]=l,e[9]=c):c=e[9];let d;e[10]!==s||e[11]!==r?(d=r(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=r,e[12]=d):d=e[12];let h;e[13]!==d?(h=o.jsx(Ke,{side:"bottom",children:d}),e[13]=d,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==h?(u=o.jsxs(We,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=u):u=e[17],u}function Xle(t){return t.stopPropagation()}function Jle(t){const e=F.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:a}=t,l=ae();let c;e[0]!==n||e[1]!==i?(c=o.jsx(Qle,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==l?(d=l("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=l,e[5]=d):d=e[5];let h;e[6]!==d?(h=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=h):h=e[7];const u=s===0;let f;e[8]!==l?(f=l("sandbox.postToolbar.deleteSelectedPosts"),e[8]=l,e[9]=f):f=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(rn,{size:14}),e[10]=p):p=e[10];let m;e[11]!==r||e[12]!==u||e[13]!==f?(m=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:r,"aria-label":f,children:p})}),e[11]=r,e[12]=u,e[13]=f,e[14]=m):m=e[14];let g;e[15]!==l?(g=l("sandbox.postToolbar.deleteSelected"),e[15]=l,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(Ke,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==m||e[20]!==x?(b=o.jsxs(We,{children:[m,x]}),e[19]=m,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==l?(v=l("sandbox.postToolbar.exitSelection"),e[22]=l,e[23]=v):v=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(nn,{size:14}),e[24]=L):L=e[24];let _;e[25]!==a||e[26]!==v?(_=o.jsx(He,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,"aria-label":v,children:L})}),e[25]=a,e[26]=v,e[27]=_):_=e[27];let y;e[28]!==l?(y=l("sandbox.postToolbar.exitSelection"),e[28]=l,e[29]=y):y=e[29];let w;e[30]!==y?(w=o.jsx(Ke,{side:"bottom",children:y}),e[30]=y,e[31]=w):w=e[31];let S;e[32]!==_||e[33]!==w?(S=o.jsxs(We,{children:[_,w]}),e[32]=_,e[33]=w,e[34]=S):S=e[34];let k;e[35]!==b||e[36]!==S?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,S]}),e[35]=b,e[36]=S,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==h?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,h,k]}),e[38]=c,e[39]=k,e[40]=h,e[41]=j):j=e[41],j}function Dd(t){const e=F.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:a,onDelete:l}=t,c=ae();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Vi,{size:14}),e[2]=h):h=e[2];let u;e[3]!==d?(u=o.jsx($t,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Zle,children:h})}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(Qe,{onClick:n,children:[o.jsx(_9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let p;e[8]!==s||e[9]!==c?(p=s&&o.jsxs(Qe,{onClick:s,children:[o.jsx(bn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=p):p=e[10];let m;e[11]!==i||e[12]!==c?(m=i&&o.jsxs(o.Fragment,{children:[o.jsx(Dc,{}),o.jsxs(Qe,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(kg,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=m):m=e[13];let g;e[14]!==r||e[15]!==a||e[16]!==c?(g=(r||a)&&o.jsxs(o.Fragment,{children:[o.jsx(Dc,{}),r&&o.jsxs(Qe,{onClick:r,children:[o.jsx(c8,{size:14}),c("sandbox.itemActions.editSeo")]}),a&&o.jsxs(Qe,{onClick:a,children:[o.jsx(rd,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=r,e[15]=a,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Dc,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(rn,{size:14}),e[19]=b):b=e[19];let v;e[20]!==c?(v=c("sandbox.itemActions.delete"),e[20]=c,e[21]=v):v=e[21];let L;e[22]!==l||e[23]!==v?(L=o.jsxs(Qe,{onClick:l,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=l,e[23]=v,e[24]=L):L=e[24];let _;e[25]!==L||e[26]!==f||e[27]!==p||e[28]!==m||e[29]!==g?(_=o.jsxs(Bt,{align:"end",className:"w-44",children:[f,p,m,g,x,L]}),e[25]=L,e[26]=f,e[27]=p,e[28]=m,e[29]=g,e[30]=_):_=e[30];let y;return e[31]!==_||e[32]!==u?(y=o.jsxs(Ot,{children:[u,_]}),e[31]=_,e[32]=u,e[33]=y):y=e[33],y}function Zle(t){return t.stopPropagation()}function ece(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function tce(t){const e=new Map;for(const s of t){const n=ece(s.resolveType),i=e.get(n);i?i.push(s):e.set(n,[s])}return[...e.entries()].map(([s,n])=>({label:s,sections:n})).sort((s,n)=>s.label.localeCompare(n.label))}function Iv(t){const e=F.c(8),{icon:s,label:n,className:i}=t;let r;e[0]!==i?(r=re("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",i),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==s?(a=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==n||e[5]!==r||e[6]!==a?(l=o.jsxs("div",{className:r,children:[a,n]}),e[4]=n,e[5]=r,e[6]=a,e[7]=l):l=e[7],l}const Ov=T.lazy(()=>Ws(()=>import("./app-editor-BZA5-H8D.js"),__vite__mapDeps([169,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,40,72,73,28,80,29,30,31,32,33,34,35,36,37,38,39,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,74,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,78,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.AppEditor}))),sce=T.lazy(()=>Ws(()=>import("./post-editor-DKXuicWV.js"),__vite__mapDeps([170,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,30,55,29,31,32,33,34,35,36,37,38,39,28,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,74,78,171,133,140,105,106,136,118,79,128,172,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,107,108,109,110,111,112,113,114,115,173,174,116,117,73,119,120,121,122,123,124,125,126,127,129,130,131,132,134,135,75,137,138,139,141,142,143,144,145,146,147,148,149,150,72,151,152,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.PostEditor}))),nce=T.lazy(()=>Ws(()=>import("./record-editor-BNIadC-Z.js"),__vite__mapDeps([175,1,2,74,78,73,24,28,128,173,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,25,44,26,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,174,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,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,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.RecordEditor}))),ice=T.lazy(()=>Ws(()=>import("./category-editor-CVQOrSGs.js"),__vite__mapDeps([176,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,35,37,55,29,30,31,32,33,34,36,38,39,28,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,149,74,78,172,105,106,136,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,107,108,109,110,111,112,113,114,115,173,174,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,137,138,139,140,141,142,143,144,145,146,147,148,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.CategoryEditor}))),rce=T.lazy(()=>Ws(()=>import("./bulk-category-panel-pNvZGXoC.js"),__vite__mapDeps([177,1,2,37,78,178,42,73,24,28])).then(t=>({default:t.BulkCategoryPanel}))),oce=T.lazy(()=>Ws(()=>import("./sections-editor-D_5Mw5mz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor}))),ace=T.lazy(()=>Ws(()=>import("./seo-editor-87YPoabW.js"),__vite__mapDeps([179,1,2,40,29,30,31,32,33,34,35,36,37,38,39,24,28,41,42,43,25,44,26,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,77,78,79,76,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,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,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SeoEditor}))),lce=T.lazy(()=>Ws(()=>import("./variant-calendar-C34nSSck.js"),__vite__mapDeps([180,1,2,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,78,72,73,79,181,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,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,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.VariantCalendar}))),cce=T.lazy(()=>Ws(()=>import("./post-calendar-ChmrbB0W.js"),__vite__mapDeps([182,1,2,30,29,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,183,72,73,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,27,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,78,74,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.PostCalendar}))),dce=T.lazy(()=>Ws(()=>import("./redirect-editor-DQa7nNe7.js"),__vite__mapDeps([184,1,2,140,24,74,78,73,28,174,32,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,81,29,30,31,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,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,75,136,137,138,139,141,142,143,144,145,146,147,148,149,150,72,151,152,79,153,154,155,156,157,158,159,160,161,162,163,164,76,165,166,167])).then(t=>({default:t.RedirectEditor})));function uce(t){const e=F.c(20),{deepLinkPage:s}=t,n=ho(),{currentBranch:i}=on(),{org:r}=Ue(),a=n?.entity?.id??null,l=ci(),c=la(),{runtime:d,previewServerUrl:h}=_n(a),u=d==="cms";let f;e[0]!==u||e[1]!==c.previewState||e[2]!==l.lifecycle.phase?(f=_ae({fastPreviewActive:u,previewState:c.previewState,lifecyclePhase:l.lifecycle.phase}),e[0]=u,e[1]=c.previewState,e[2]=l.lifecycle.phase,e[3]=f):f=e[3];const p=f;if(p.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==p.state||e[5]!==c.start||e[6]!==x||e[7]!==l.lifecycle||e[8]!==l.phase?(b=o.jsx(vae,{state:p.state,claimPhase:l.phase,lifecycle:l.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=p.state,e[5]=c.start,e[6]=x,e[7]=l.lifecycle,e[8]=l.phase,e[9]=b):b=e[9],b}if(!a||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Bo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const m=u?h:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==p.devServerReady||e[14]!==p.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==m||e[18]!==a?(g=o.jsx(fce,{orgSlug:r.slug,virtualMcpId:a,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:m,deepLinkPage:s,devServerReady:p.devServerReady,sandboxWarming:p.sandboxWarming}),e[11]=i,e[12]=s,e[13]=p.devServerReady,e[14]=p.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=m,e[18]=a,e[19]=g):g=e[19],g}const $v=2e3,hce=15;function Bv(t,e,s,n){return typeof e!="string"||s&&(xj(e,s,n)||t.state.dataUpdateCount>=hce)?!1:$v}function fce({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:a,sandboxWarming:l}){const c=ae(),d=Ts()?.taskId??null,h={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:u,isLoading:f}=z9(h,{fetchEnabled:a}),p=pr({strict:!1}),[m,g]=T.useState(()=>p.contentCollection&&ka(p.contentCollection)&&p.contentCollection||"pages"),[x,b]=T.useState(()=>p.contentItem&&ka(m)?{collection:m,key:p.contentItem}:null),[v,L]=T.useState(null),_=!!(r?.pageId||r?.path||r?.pathTemplate),[y,w]=T.useState(!1);if(_&&!y&&x===null&&u){w(!0);const xe=Cee(wf(u),r??{});xe&&(g("pages"),b({collection:"pages",key:xe.key,path:xe.path}))}const[S,k]=T.useState(""),[j,C]=T.useState(null),[V,N]=T.useState(null),[A,P]=T.useState(null),[R,E]=T.useState("date-desc"),[I,D]=T.useState(()=>new Set),[O,B]=T.useState(null),M=()=>{D(new Set),B(null)},z=xe=>{b(xe),L(null)},[$,U]=T.useState(m);$!==m&&(U(m),k(""),C(null),N(null),P(null),E("date-desc"),D(new Set),B(null));const{data:H,isLoading:W,isFetching:K}=Q3(h,{fetchEnabled:a,refetchInterval:xe=>{const De=xe.state.data;if(m==="apps"&&x&&x.collection==="apps"){const Je=u?.[x.key];return Bv(xe,typeof Je?.__resolveType=="string"?Je.__resolveType:void 0,De)}if(m==="site"&&u){const Je=De?Cp(u,De):null,Ie=u.site,pt=Je?.resolveType??(typeof Ie?.__resolveType=="string"?Ie.__resolveType:void 0);return Bv(xe,pt,De,["seo"])}return!1}}),G=(xe,De)=>!xj(xe,H,De)&&(W||K),{catalog:Y,isLoading:Z}=pae(H??void 0,u??void 0,{enabled:m==="apps"}),te=ale({orgSlug:t,virtualMcpId:e,branch:s,meta:H}),X=V0(h),ee=oae(h),[J,Q]=T.useState(null),[oe,le]=T.useState(),[de,se]=T.useState(!1),[ie,he]=T.useState(),[ue,ce]=T.useState(null),[ne,q]=T.useState(null),[fe,ge]=T.useState(null),_e=!u||!H;if(f||W||_e&&l)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})});if(_e)return o.jsx(Bo,{title:"Could not load site data."});const Le=wf(u).sort((xe,De)=>xe.name.localeCompare(De.name)),je=$S(u).sort((xe,De)=>xe.from.localeCompare(De.from)),Ce=Y3(u,H),Pe=m==="sections"?vee(H):[],pe=Cp(u,H),ke=Lj(u),Te=y4.some(xe=>ke[xe].length>0),we=ka(m)?ke[m]:[],Ne=(Te?zu(u,"categories"):[]).map(({key:xe,payload:De})=>{const Je=typeof De.slug=="string"?De.slug:"",Ie=typeof De.name=="string"?De.name:"";return{slug:Je||xe,name:Ie||Je||xe}}).filter(xe=>xe.slug).sort((xe,De)=>xe.name.localeCompare(De.name)),Oe=m==="posts"&&(I.size>0||O!==null),nt=Oe?jj(u).filter(xe=>I.has(xe.key)):[],Fe=Hb(H,"loaders"),yt=Hb(H,"actions");if(!FS(u,H)&&!Te&&Fe===0&&yt===0)return o.jsx(Bo,{icon:vn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const it={pages:Le.length,sections:Ce.length,apps:Y.length,loaders:Fe,actions:yt,redirects:je.length,posts:ke.posts.length,authors:ke.authors.length,categories:ke.categories.length},st=new Set(Le.map(xe=>Ko(xe.path))),ft=new Set(Le.map(xe=>xe.name)),_t=new Set(Ce.map(xe=>xe.name)),mt=async xe=>{const De=u[xe.key];if(!De)return;const Je=ek(u,xe.key),Ie=tk(u,xe.key,Math.max(0,Je-1)),pt=hte(De.sections,Ie);if(pt)try{await X.mutateAsync({blockKey:xe.key,data:{...De,sections:pt}}),ye.success(`Variant added to "${xe.name}"`),b({collection:"pages",key:xe.key,path:xe.path})}catch(Et){ye.error(Et instanceof Error?Et.message:"Could not add variant")}},Ze=()=>{le(void 0),Q({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},rt=xe=>{le(void 0),Q({mode:"duplicate",sourceKey:xe.key,initialName:Lv(ft,xe.name),initialPath:Lae(st,xe.path)})},xt=xe=>{le(void 0),Q({mode:"rename",sourceKey:xe.key,initialName:xe.name,initialPath:xe.path})},be=async xe=>{if(!J)return;const{mode:De,sourceKey:Je}=J;try{if(De==="create"){let Ie;if(xe.templateKey){const Et=u[xe.templateKey];if(!Et)throw new Error("Selected template no longer exists.");Ie={...Et,name:xe.name,path:xe.path}}else Ie=kae(xe.name,xe.path);const pt=Cae(u,xe.name);await X.mutateAsync({blockKey:pt,data:Ie}),ye.success(`Created "${xe.name}"`),b({collection:"pages",key:pt,path:xe.path})}else if(De==="duplicate"&&Je){const Ie=u[Je];if(!Ie)throw new Error("Source page not found");const{key:pt,data:Et}=Sae({source:Ie,pages:Le,newName:xe.name,newPath:xe.path});await X.mutateAsync({blockKey:pt,data:Et}),ye.success(`Duplicated as "${xe.name}"`),b({collection:"pages",key:pt,path:xe.path})}else if(De==="rename"&&Je){const Ie=u[Je];if(!Ie)throw new Error("Page not found");const pt={...Ie,name:xe.name,path:xe.path};await X.mutateAsync({blockKey:Je,data:pt}),ye.success("Page updated"),x?.collection==="pages"&&x.key===Je&&b({collection:"pages",key:Je,path:xe.path})}Q(null)}catch(Ie){le(Ie instanceof Error?Ie.message:"Save failed")}},Re=({path:xe})=>{if(!J)return null;const De=Ko(xe);return(J.mode==="rename"?Ko(J.initialPath):null)!==De&&st.has(De)?`A page with path "${xe}" already exists.`:null},Me=async(xe,De,Je)=>{await X.mutateAsync({blockKey:De,data:{...Je,name:De,__resolveType:xe}}),ye.success(c("sandbox.contentBrowser.createdSection",{name:De})),b({collection:"sections",key:De})},dt=r4((xe,De)=>X.mutate({blockKey:xe,data:De})),ut=async xe=>{const De=u[xe.key];if(!De){ye.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Je=wae(u,xe.key),Ie=Lv(_t,xe.name),pt={...De,name:Ie};try{await X.mutateAsync({blockKey:Je,data:pt}),ye.success(c("sandbox.contentBrowser.duplicatedSection",{name:xe.name})),b({collection:"sections",key:Je})}catch(Et){ye.error(Et instanceof Error?Et.message:c("sandbox.contentBrowser.duplicateFailed"))}},ht=async xe=>{if(!ue)return;const De=u[ue];if(!De){ye.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await X.mutateAsync({blockKey:ue,data:{...De,name:xe}}),ye.success(c("sandbox.contentBrowser.sectionRenamed")),ce(null)}catch(Je){ye.error(Je instanceof Error?Je.message:c("sandbox.contentBrowser.renameFailed"))}},ct=()=>{he(void 0),se(!0)},lt=async xe=>{const De=jee(u,xe.from),Je=wee(xe);try{await X.mutateAsync({blockKey:De,data:Je}),ye.success("Created redirect"),se(!1),b({collection:"redirects",key:De})}catch(Ie){he(Ie instanceof Error?Ie.message:"Could not create redirect")}},Ge=async xe=>{const De=rm(u,xe),Je=Sc(De,xe,Cj(xe));try{await X.mutateAsync({blockKey:De,data:Je}),ye.success(`Created ${bu[xe]}`),b({collection:xe,key:De})}catch(Ie){ye.error(Ie instanceof Error?Ie.message:"Could not create")}},wt=async xe=>{const De=rm(u,"posts"),Je=Sc(De,"posts",Jae(xe));try{await X.mutateAsync({blockKey:De,data:Je}),ye.success(c("sandbox.postCalendar.createdScheduledPost")),g("posts"),U("posts"),b({collection:"posts",key:De}),L(null)}catch(Ie){ye.error(Ie instanceof Error?Ie.message:c("sandbox.postCalendar.couldNotCreate"))}},Pt=async(xe,De)=>{const Je=u[xe],Ie=Je?ele(Xd(Je,"posts"),De):null;if(!Ie){ye.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await X.mutateAsync({blockKey:xe,data:Sc(xe,"posts",Ie)})}catch(pt){ye.error(pt instanceof Error?pt.message:c("sandbox.postCalendar.couldNotReschedule"))}},Zt=async xe=>{const De=u[xe.key];if(!De){ye.error("Record not found.");return}const Je=rm(u,xe.kind),Ie=xe.kind==="posts"?"title":"name",pt={...structuredClone(Xd(De,xe.kind)),[Ie]:`${xe.label} (copy)`};try{await X.mutateAsync({blockKey:Je,data:Sc(Je,xe.kind,pt)}),ye.success(`Duplicated "${xe.label}"`),b({collection:xe.kind,key:Je})}catch(Et){ye.error(Et instanceof Error?Et.message:"Duplicate failed")}},Dt=xe=>{D(De=>{const Je=new Set(De);return Je.has(xe)?Je.delete(xe):Je.add(xe),Je})},$e=xe=>{g("posts"),U("posts"),b(null),L(null),k(""),C(null),N(null),P(null),E("date-desc"),D(new Set),B(xe||null)},Lt=async(xe,De)=>{const Je=[...I];let Ie=0;for(const pt of Je){const Et=u[pt],at=Xd(Et,"posts"),rs=xe==="add"?Fae(at,De):Uae(at,De);rs!==at&&(await X.mutateAsync({blockKey:pt,data:Sc(pt,"posts",kv(rs))}),Ie+=1)}return Ie},Se=async(xe,De)=>{const Je=I.size;try{const Ie=await Lt(xe,De),pt=xe==="add"?"Added to":"Moved",Et=Je-Ie;ye.success(`${pt} ${Ie} ${Ie===1?"post":"posts"}`+(Et>0?` (${Et} already set)`:"")),M()}catch(Ie){ye.error(Ie instanceof Error?Ie.message:"Bulk update failed")}},Ye=async()=>{if(ne)try{if(ne.kind==="blog-bulk"){for(const Ie of ne.keys)await ee.mutateAsync({blockKey:Ie});ye.success(`Deleted ${ne.count} ${ne.count===1?"post":"posts"}`),x&&x.collection!=="available-section"&&ne.keys.includes(x.key)&&b(null),M(),q(null);return}const{kind:xe,key:De,label:Je}=ne;if(xe==="blog"){if(ne.blogKind==="categories"){const Ie=Xd(u[De],"categories").slug,pt=typeof Ie=="string"?Ie:"";if(pt)for(const{key:Et,payload:at}of zu(u,"posts")){const rs=Hae(at,pt);rs!==at&&await X.mutateAsync({blockKey:Et,data:Sc(Et,"posts",kv(rs))})}}await ee.mutateAsync({blockKey:De})}else await ee.mutateAsync({blockKey:De});ye.success(`Deleted "${Je}"`),x&&x.collection!=="available-section"&&x.key===De&&b(null),q(null)}catch(xe){ye.error(xe instanceof Error?xe.message:"Delete failed")}},ot=ee.isPending||X.isPending,es=ne?.kind==="blog"?bu[ne.blogKind]:ne?.kind==="blog-bulk"?`${ne.count} ${ne.count===1?"post":"posts"}`:ne?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(xae,{active:m,counts:it,showBlog:Te,onSelect:xe=>{g(xe),b(null),L(null)}}),m!=="seo"&&m!=="site"&&m!=="calendar"&&m!=="post-schedule"&&m!=="loaders"&&m!=="actions"&&o.jsx(mce,{activeCollection:m,pages:Le,redirects:je,sections:Ce,availableSections:Pe,appCatalog:Y,appCatalogLoading:Z,blogEntries:we,decofile:u,searchQuery:S,onSearchChange:k,postCategoryFilter:j,postAuthorFilter:V,postStatusFilter:A,postSort:R,onPostCategoryFilterChange:xe=>{C(xe),D(new Set)},onPostAuthorFilterChange:xe=>{N(xe),D(new Set)},onPostStatusFilterChange:xe=>{P(xe),D(new Set)},onPostSortChange:E,selectedPostKeys:I,postBulkPanelOpen:Oe,onTogglePostSelect:Dt,onSelectAllPosts:xe=>D(new Set(xe)),onClearPostSelection:()=>D(new Set),onExitPostSelection:M,onBulkDeletePosts:()=>q({kind:"blog-bulk",keys:[...I],count:I.size}),selection:x,onSelect:z,onCreate:()=>{m==="pages"?Ze():m==="redirects"?ct():ka(m)&&Ge(m)},onDuplicatePage:rt,onRenamePage:xt,onAddPageVariant:mt,onDeletePage:xe=>q({kind:"page",key:xe.key,label:xe.name}),onEditPageSeo:xe=>{const De={collection:"pages",key:xe.key,path:xe.path};b(De),L(xe.key)},onViewPageJson:xe=>ge(xe.key),onDuplicateSection:ut,onRenameSection:xe=>ce(xe.key),onDeleteSection:xe=>q({kind:"section",key:xe.key,label:xe.name}),onDeleteRedirect:xe=>q({kind:"redirect",key:xe.key,label:xe.from||xe.key}),onDuplicateBlog:Zt,onDeleteBlog:xe=>q({kind:"blog",blogKind:xe.kind,key:xe.key,label:xe.label})}),o.jsx("div",{className:"flex-1 min-w-0",children:m==="loaders"||m==="actions"?o.jsx(mle,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:H,decofile:u,kind:m}):o.jsx(T.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(et,{className:"size-5 text-muted-foreground"})}),children:m==="calendar"?o.jsx(lce,{decofile:u}):m==="post-schedule"?o.jsx(cce,{decofile:u,support:te,isCreating:X.isPending,onCreate:xe=>{wt(xe)},onReschedule:(xe,De)=>{Pt(xe,De)},onSelect:xe=>{g("posts"),U("posts"),b({collection:"posts",key:xe}),L(null)}}):m==="site"?pe?o.jsx(Ov,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:pe.key,block:u[pe.key],decofile:u,meta:H,title:"Site",excludeFields:["seo"],schemaPending:G(pe.resolveType,["seo"]),previewBaseUrl:n},`site:${pe.key}`):o.jsx(Bo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):m==="seo"?o.jsx(ace,{orgSlug:t,virtualMcpId:e,branch:s,decofile:u,meta:H,target:{kind:"site"},previewBaseUrl:i}):m==="sections"?o.jsx(Hle,{selection:x?.collection==="sections"||x?.collection==="available-section"?x:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:H,decofile:u,isCreating:X.isPending,onCreateAvailable:Me,onSaveReferencedBlock:dt}):Oe?o.jsx(rce,{posts:nt,categories:Ne,initialSlug:O,isPending:X.isPending,onApply:(xe,De)=>{Se(xe,De)},onClose:M},O??"selection"):x&&x.collection!=="available-section"?x.collection==="apps"?o.jsx(Ov,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:u[x.key],decofile:u,meta:H,previewBaseUrl:n,schemaPending:G(typeof u[x.key]?.__resolveType=="string"?String(u[x.key].__resolveType):void 0)},`app:${x.key}`):x.collection==="posts"?o.jsx(sce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:u[x.key],decofile:u,meta:H,previewBaseUrl:i},`post:${x.key}`):x.collection==="categories"?o.jsx(ice,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:u[x.key],decofile:u,meta:H,onManagePosts:$e,onOpenPost:xe=>{g("posts"),U("posts"),b({collection:"posts",key:xe}),L(null)},previewBaseUrl:i},`category:${x.key}`):x.collection==="authors"?o.jsx(nce,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:x.key,block:u[x.key]},`authors:${x.key}`):x.collection==="redirects"?o.jsx(dce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:u[x.key]},`redirect:${x.key}`):o.jsx(oce,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:x.collection==="pages"?x.path:"/",activePageBlockKey:x.collection==="pages"?x.key:null,activeGlobalBlockKey:x.collection==="sections"?x.key:null,initialEditSeo:x.collection==="pages"&&v===x.key,onExitSeo:()=>L(null)},x.collection==="pages"?`page:${x.key}`:`section:${x.key}`):o.jsx(Bo,{title:`Select ${ka(m)?`a ${bu[m]}`:m==="pages"?"a page":m==="apps"?"an app":m==="redirects"?"a redirect":"a section"} to edit`,description:m==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),J&&o.jsx(Aae,{open:!!J,mode:J.mode,initialName:J.initialName,initialPath:J.initialPath,isPending:X.isPending,error:oe,templates:Le,validate:Re,onSubmit:be,onOpenChange:xe=>{xe||(Q(null),le(void 0))}}),o.jsx(Eae,{open:de,isPending:X.isPending,error:ie,onSubmit:lt,onOpenChange:xe=>{xe||(se(!1),he(void 0))}}),ue&&o.jsx(Rae,{open:!!ue,blockKey:ue,initialName:Ce.find(xe=>xe.key===ue)?.name??ue,isPending:X.isPending,onSubmit:ht,onOpenChange:xe=>{xe||ce(null)}}),fe&&o.jsx(lle,{open:!!fe,onOpenChange:xe=>{xe||ge(null)},pageKey:fe,decofile:u,onSave:xe=>X.mutateAsync({blockKey:fe,data:xe})}),o.jsx(Gr,{open:!!ne,onOpenChange:xe=>{!xe&&!ot&&q(null)},children:o.jsxs(Yr,{children:[o.jsxs(Qr,{children:[o.jsx(Xr,{children:`Delete ${es}?`}),o.jsx(Jr,{children:ne?.kind==="section"?`"${ne.label}" will be removed. Pages that still reference it will lose this section.`:ne?.kind==="blog-bulk"?`${ne.count} ${ne.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:ne?`"${ne.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(Zr,{children:[o.jsx(eo,{disabled:ot,children:"Cancel"}),o.jsx(to,{onClick:xe=>{xe.preventDefault(),Ye()},disabled:ot,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ot?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function mce(t){const e=F.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:a,appCatalog:l,appCatalogLoading:c,blogEntries:d,decofile:h,searchQuery:u,onSearchChange:f,postCategoryFilter:p,postAuthorFilter:m,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:L,onPostSortChange:_,selectedPostKeys:y,postBulkPanelOpen:w,onTogglePostSelect:S,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:V,selection:N,onSelect:A,onCreate:P,onDuplicatePage:R,onRenamePage:E,onAddPageVariant:I,onDeletePage:D,onEditPageSeo:O,onViewPageJson:B,onDuplicateSection:M,onRenameSection:z,onDeleteSection:$,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:W}=t;let K,G,Y,Z,te,X,ee;if(e[0]!==s||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==d||e[5]!==h||e[6]!==I||e[7]!==V||e[8]!==j||e[9]!==P||e[10]!==W||e[11]!==D||e[12]!==U||e[13]!==$||e[14]!==H||e[15]!==R||e[16]!==M||e[17]!==O||e[18]!==C||e[19]!==v||e[20]!==b||e[21]!==_||e[22]!==L||e[23]!==E||e[24]!==z||e[25]!==f||e[26]!==A||e[27]!==k||e[28]!==S||e[29]!==B||e[30]!==n||e[31]!==m||e[32]!==w||e[33]!==p||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==u||e[38]!==r||e[39]!==y||e[40]!==N){const le=u.toLowerCase(),de=n.filter(be=>!le||be.name.toLowerCase().includes(le)||be.path.toLowerCase().includes(le)),se=i.filter(be=>!le||be.from.toLowerCase().includes(le)||be.to.toLowerCase().includes(le)),ie=r.filter(be=>!le||be.name.toLowerCase().includes(le)||be.key.toLowerCase().includes(le)||be.resolveType.toLowerCase().includes(le)),he=a.filter(be=>!le||be.title.toLowerCase().includes(le)||be.resolveType.toLowerCase().includes(le)||(be.description?.toLowerCase().includes(le)??!1)),ue=tce(ie),ce=l.filter(be=>!le||be.title.toLowerCase().includes(le)||be.app.toLowerCase().includes(le)||be.vendor.toLowerCase().includes(le)||be.category.toLowerCase().includes(le)),ne=d.filter(be=>!le||be.label.toLowerCase().includes(le)||be.subtitle.toLowerCase().includes(le)),q=s==="posts",fe=bce,ge=q?jj(h):[],_e=new Map,Le=new Map,je={published:0,scheduled:0,draft:0};for(const be of ge)je[be.status]=je[be.status]+1;for(const be of ge){for(const Re of be.categorySlugs)_e.set(Re,(_e.get(Re)??0)+1);for(const Re of be.authorEmails)Le.set(Re,(Le.get(Re)??0)+1)}const Ce=(q?zu(h,"categories"):[]).map(be=>{const{key:Re,payload:Me}=be,dt=fe(Me.slug)||Re;return{slug:dt,name:fe(Me.name)||fe(Me.slug)||Re,count:_e.get(dt)??0}}).filter(xce),Pe=(q?zu(h,"authors"):[]).map(be=>{const{key:Re,payload:Me}=be,dt=fe(Me.email);return{email:dt,name:fe(Me.name)||fe(Me.email)||Re,count:Le.get(dt)??0}}).filter(gce);let pe;e[48]!==p?(pe=be=>!p||be.categorySlugs.includes(p),e[48]=p,e[49]=pe):pe=e[49];let ke;e[50]!==m?(ke=be=>!m||be.authorEmails.includes(m),e[50]=m,e[51]=ke):ke=e[51];let Te;e[52]!==g?(Te=be=>!g||be.status===g,e[52]=g,e[53]=Te):Te=e[53];let we;e[54]!==x?(we=(be,Re)=>{if(x==="az")return be.title.localeCompare(Re.title);if(x==="za")return Re.title.localeCompare(be.title);const Me=be.date.localeCompare(Re.date);return x==="date-asc"?Me:-Me},e[54]=x,e[55]=we):we=e[55];const Ne=ge.filter(be=>!le||be.title.toLowerCase().includes(le)||be.slug.toLowerCase().includes(le)).filter(pe).filter(ke).filter(Te).sort(we),Oe=y.size,nt=Ne.map(pce),Fe=nt.length>0&&nt.every(be=>y.has(be)),yt=Oe>0||w,it=()=>{Fe?j():k(nt)},st=`Search ${s}…`,ft=ka(s)?`Create new ${bu[s]}`:s==="redirects"?"Create new redirect":"Create new page",_t=s!=="apps"&&s!=="sections";te="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let mt;e[56]===Symbol.for("react.memo_cache_sentinel")?(mt=o.jsx(u0,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=mt):mt=e[56];let Ze;e[57]!==f?(Ze=be=>f(be.target.value),e[57]=f,e[58]=Ze):Ze=e[58];let rt;e[59]!==st||e[60]!==u||e[61]!==Ze?(rt=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[mt,o.jsx("input",{type:"text",value:u,onChange:Ze,placeholder:st,"aria-label":st,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=st,e[60]=u,e[61]=Ze,e[62]=rt):rt=e[62];let xt;e[63]!==ft||e[64]!==P||e[65]!==_t?(xt=_t&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:P,"aria-label":ft,children:o.jsx(Qt,{size:14})})}),o.jsx(Ke,{side:"bottom",children:ft})]}),e[63]=ft,e[64]=P,e[65]=_t,e[66]=xt):xt=e[66],e[67]!==rt||e[68]!==xt?(X=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[rt,xt]}),e[67]=rt,e[68]=xt,e[69]=X):X=e[69],ee=q&&(yt?o.jsx(Jle,{count:Oe,allSelected:Fe,onToggleSelectAll:it,onDelete:V,onExit:C}):o.jsx(Wle,{categories:Ce,authors:Pe,categoryFilter:p,statusCounts:je,authorFilter:m,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:L,onSortChange:_})),K=il,Z="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",G="flex flex-col gap-1 p-1.5",Y=s==="pages"?de.length===0?o.jsx(wc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):de.map(be=>{const Re=N?.collection==="pages"&&N.key===be.key,Me=ek(h,be.key);return o.jsx(yi,{icon:zr,title:be.name,subtitle:be.path,active:Re,variantCount:Me,onClick:()=>A({collection:"pages",key:be.key,path:be.path}),menu:o.jsx(Dd,{onDuplicate:()=>R(be),onRename:()=>E(be),onAddVariant:()=>I(be),onEditSeo:()=>O(be),onViewJson:()=>B(be),onDelete:()=>D(be)})},be.key)}):s==="sections"?ie.length===0&&he.length===0?o.jsx(wc,{hasItems:r.length>0||a.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[ue.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Iv,{icon:Wr,label:"Saved sections"}),ue.map(be=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:be.label}),be.sections.map(Re=>{const Me=N?.collection==="sections"&&N.key===Re.key;return o.jsx(yi,{icon:Wr,accent:"global",title:Re.name,subtitle:be.label,active:Me,onClick:()=>A({collection:"sections",key:Re.key}),menu:o.jsx(Dd,{onDuplicate:()=>M(Re),onRename:()=>z(Re),onDelete:()=>$(Re)})},Re.key)})]},be.label))]}),he.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Iv,{icon:zr,label:"Available sections",className:re(ue.length>0&&"mt-3")}),he.map(be=>{const Re=N?.collection==="available-section"&&N.resolveType===be.resolveType,Me=be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(yi,{icon:zr,title:be.title,subtitle:Me??be.resolveType,active:Re,onClick:()=>A({collection:"available-section",resolveType:be.resolveType,title:be.title})},be.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(et,{className:"size-4.5 text-muted-foreground"})}):ce.length===0?o.jsx(wc,{hasItems:l.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ce.map(be=>{const Re=N?.collection==="apps"&&be.blockKey!==null&&N.key===be.blockKey;return o.jsx(yi,{icon:_8,logoUrl:be.logo,title:be.title,subtitle:be.category,active:Re,trailing:be.installed?o.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!be.installed||!be.blockKey){ye.message(`${be.title} is not installed on this site.`);return}A({collection:"apps",key:be.blockKey})}},be.id)}):s==="redirects"?se.length===0?o.jsx(wc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):se.map(be=>o.jsx(yi,{icon:l8,title:be.from||"(no source)",subtitle:`→ ${be.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===be.key,trailing:o.jsx(Dae,{type:be.type}),onClick:()=>A({collection:"redirects",key:be.key}),menu:o.jsx(Dd,{onDelete:()=>U(be)})},be.key)):q?Ne.length===0?o.jsx(wc,{hasItems:ge.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Ne.map(be=>{const Re={key:be.key,kind:"posts",label:be.title,subtitle:be.slug};return o.jsx(yi,{icon:Ai,title:be.title,subtitle:be.slug||"no slug",invalid:be.missing.length>0,invalidReason:`Missing: ${be.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===be.key,selectable:!0,selectionActive:yt,selected:y.has(be.key),onToggleSelect:()=>S(be.key),onClick:()=>yt?S(be.key):A({collection:"posts",key:be.key}),menu:o.jsx(Dd,{onDuplicate:()=>H(Re),onDelete:()=>W(Re)})},be.key)}):ne.length===0?o.jsx(wc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${ka(s)?bu[s]:"item"}.`}):ne.map(be=>{const Re=N?.collection===be.kind&&N.key===be.key;return o.jsx(yi,{icon:be.kind==="posts"?Ai:be.kind==="authors"?v9:eg,title:be.label,subtitle:be.subtitle,active:Re,onClick:()=>A({collection:be.kind,key:be.key}),menu:o.jsx(Dd,{onDuplicate:()=>H(be),onDelete:()=>W(be)})},be.key)}),e[0]=s,e[1]=l,e[2]=c,e[3]=a,e[4]=d,e[5]=h,e[6]=I,e[7]=V,e[8]=j,e[9]=P,e[10]=W,e[11]=D,e[12]=U,e[13]=$,e[14]=H,e[15]=R,e[16]=M,e[17]=O,e[18]=C,e[19]=v,e[20]=b,e[21]=_,e[22]=L,e[23]=E,e[24]=z,e[25]=f,e[26]=A,e[27]=k,e[28]=S,e[29]=B,e[30]=n,e[31]=m,e[32]=w,e[33]=p,e[34]=x,e[35]=g,e[36]=i,e[37]=u,e[38]=r,e[39]=y,e[40]=N,e[41]=K,e[42]=G,e[43]=Y,e[44]=Z,e[45]=te,e[46]=X,e[47]=ee}else K=e[41],G=e[42],Y=e[43],Z=e[44],te=e[45],X=e[46],ee=e[47];let J;e[70]!==G||e[71]!==Y?(J=o.jsx("div",{className:G,children:Y}),e[70]=G,e[71]=Y,e[72]=J):J=e[72];let Q;e[73]!==K||e[74]!==Z||e[75]!==J?(Q=o.jsx(K,{className:Z,children:J}),e[73]=K,e[74]=Z,e[75]=J,e[76]=Q):Q=e[76];let oe;return e[77]!==te||e[78]!==X||e[79]!==ee||e[80]!==Q?(oe=o.jsxs("div",{className:te,children:[X,ee,Q]}),e[77]=te,e[78]=X,e[79]=ee,e[80]=Q,e[81]=oe):oe=e[81],oe}function pce(t){return t.key}function gce(t){return t.email}function xce(t){return t.slug}function bce(t){return typeof t=="string"?t:""}function vce(t){const e=F.c(25),{virtualMcpId:s}=t,n=ae(),[i,r]=T.useState(!1),a=As(s),{activeTask:l}=on();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},e[0]=c):c=e[0];const d=pr(c);if(!(xn(a?.metadata)||xn(l?.metadata))){let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(ur,{className:"size-7 text-foreground"})}),e[1]=f):f=e[1];let p;e[2]!==n?(p=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=p):p=e[3];let m;e[4]!==n?(m=n("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=n,e[5]=m):m=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>r(!0),x=o.jsx(ur,{className:"size-4"}),e[6]=g,e[7]=x):(g=e[6],x=e[7]);let b;e[8]!==n?(b=n("mainPanelTabs.previewTab.connectGithub"),e[8]=n,e[9]=b):b=e[9];let v;e[10]!==b?(v=o.jsxs(me,{onClick:g,children:[x,b]}),e[10]=b,e[11]=v):v=e[11];let L;e[12]!==p||e[13]!==m||e[14]!==v?(L=o.jsx(Ti,{className:"h-full",image:f,title:p,description:m,actions:v}),e[12]=p,e[13]=m,e[14]=v,e[15]=L):L=e[15];let _;e[16]!==i?(_=o.jsx(d0,{open:i,onOpenChange:r,mode:"agent"}),e[16]=i,e[17]=_):_=e[17];let y;return e[18]!==_||e[19]!==L?(y=o.jsxs(o.Fragment,{children:[L,_]}),e[18]=_,e[19]=L,e[20]=y):y=e[20],y}let u;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(u=o.jsx(uce,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=u):u=e[24],u}function yce(){const t=F.c(3),[e,s]=T.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=a=>{if(!a)return;const l=()=>s(a.clientWidth);l();const c=new ResizeObserver(l);return c.observe(a),()=>c.disconnect()},t[0]=n):n=t[0];const i=n;let r;return t[1]!==e?(r=[e,i],t[1]=e,t[2]=r):r=t[2],r}function _ce(t){const e=F.c(6),{virtualMcpId:s}=t,n=As(s),i=L7();let r;e[0]!==i||e[1]!==n?(r=h9(i,S7(n)),e[0]=i,e[1]=n,e[2]=r):r=e[2];const a=r;if(!a){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Lce,{}),e[3]=c):c=e[3],c}let l;return e[4]!==a?(l=o.jsx(kce,{config:a}),e[4]=a,e[5]=l):l=e[5],l}function Lce(){const t=F.c(12),e=ae();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:o.jsx(jg,{size:20,className:"text-muted-foreground"})}),t[0]=s):s=t[0];let n;t[1]!==e?(n=e("assets.browser.noBucketTitle"),t[1]=e,t[2]=n):n=t[2];let i;t[3]!==n?(i=o.jsx("p",{className:"text-sm font-medium",children:n}),t[3]=n,t[4]=i):i=t[4];let r;t[5]!==e?(r=e("assets.browser.noBucketDescription"),t[5]=e,t[6]=r):r=t[6];let a;t[7]!==r?(a=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=a):a=t[8];let l;return t[9]!==i||t[10]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-0 flex-col items-center justify-center gap-3 p-10 text-center",children:[s,o.jsxs("div",{children:[i,a]})]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}function wce(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function Sce(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function kce(t){const e=F.c(99),{config:s}=t,n=ae(),[i,r]=T.useState(""),a=L9(i,300);let l;e[0]!==s.id||e[1]!==a?(l={configId:s.id,search:a},e[0]=s.id,e[1]=a,e[2]=l):l=e[2];const c=Hk(l),d=Y9(),[h,u]=T.useState(!1),[f,p]=T.useState(null),m=T.useRef(null);let g;e[3]!==s.id||e[4]!==c||e[5]!==n||e[6]!==d?(g=async function(M){if(!M)return;const z=Array.from(M);if(z.length===0)return;const $=[];for(const U of z)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const W=H;$.push(`${U.name} (${W instanceof Error?W.message:"upload failed"})`)}await c.refetch(),$.length>0&&ye.error($.length===z.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:$.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:$.join("; ")}))},e[3]=s.id,e[4]=c,e[5]=n,e[6]=d,e[7]=g):g=e[7];const x=g;let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=function(M){M.preventDefault(),u(!0)},e[8]=b):b=e[8];const v=b;let L;e[9]===Symbol.for("react.memo_cache_sentinel")?(L=function(){u(!1)},e[9]=L):L=e[9];const _=L;let y;e[10]!==x?(y=function(M){M.preventDefault(),M.stopPropagation(),u(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=y):y=e[11];const w=y,[S,k]=yce();let j,C,V,N,A,P;if(e[12]!==s.name||e[13]!==a||e[14]!==k||e[15]!==S||e[16]!==x||e[17]!==h||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==w||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(jce),z=Sce(M,wce(S)),$=a.trim(),U=i!==a||c.isFetching&&!c.isFetchingNextPage;A="flex h-full min-h-0 flex-col gap-3 p-4";let H;e[31]!==n?(H=n("assets.browser.title"),e[31]=n,e[32]=H):H=e[32];let W;e[33]!==H?(W=o.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=W):W=e[34];let K;e[35]!==s.name||e[36]!==n?(K=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=K):K=e[37];let G;e[38]!==K?(G=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:K}),e[38]=K,e[39]=G):G=e[39];let Y;e[40]!==W||e[41]!==G?(Y=o.jsxs("div",{className:"min-w-0",children:[W,G]}),e[40]=W,e[41]=G,e[42]=Y):Y=e[42];let Z;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>m.current?.click(),e[43]=Z):Z=e[43];let te;e[44]!==d.isPending?(te=d.isPending?o.jsx(et,{className:"size-3.5"}):o.jsx(Gn,{size:14}),e[44]=d.isPending,e[45]=te):te=e[45];let X;e[46]!==n||e[47]!==d.isPending?(X=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=X):X=e[48];let ee;e[49]!==te||e[50]!==X||e[51]!==d.isPending?(ee=o.jsxs(me,{type:"button",size:"sm",disabled:d.isPending,onClick:Z,children:[te,X]}),e[49]=te,e[50]=X,e[51]=d.isPending,e[52]=ee):ee=e[52];let J;e[53]!==x?(J=o.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:ne=>{const q=Array.from(ne.target.files??[]);ne.target.value="",x(q)}}),e[53]=x,e[54]=J):J=e[54],e[55]!==Y||e[56]!==ee||e[57]!==J?(P=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Y,ee,J]}),e[55]=Y,e[56]=ee,e[57]=J,e[58]=P):P=e[58];let Q;e[59]!==n?(Q=n("filePicker.filePickerDialog.searchFilesPlaceholder"),e[59]=n,e[60]=Q):Q=e[60],e[61]!==U||e[62]!==i||e[63]!==Q?(j=o.jsx(b9,{value:i,onChange:r,isSearching:U,placeholder:Q,className:"shrink-0"}),e[61]=U,e[62]=i,e[63]=Q,e[64]=j):j=e[64];let oe;e[65]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>m.current?.click(),e[65]=oe):oe=e[65];const le=h&&"border-primary bg-primary/5",de=d.isPending&&"pointer-events-none opacity-60";let se;e[66]!==le||e[67]!==de?(se=re("flex shrink-0 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-border/60 p-4 text-center transition-colors",le,de),e[66]=le,e[67]=de,e[68]=se):se=e[68];let ie;e[69]===Symbol.for("react.memo_cache_sentinel")?(ie=o.jsx(Gn,{size:16,className:"text-muted-foreground"}),e[69]=ie):ie=e[69];let he;e[70]!==n?(he=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=he):he=e[71];let ue;e[72]!==n?(ue=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=ue):ue=e[73];let ce;e[74]!==he||e[75]!==ue?(ce=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[he," ",ue]}),e[74]=he,e[75]=ue,e[76]=ce):ce=e[76],e[77]!==w||e[78]!==se||e[79]!==ce?(C=o.jsxs("button",{type:"button",onClick:oe,onDragOver:v,onDragLeave:_,onDrop:w,className:se,children:[ie,ce]}),e[77]=w,e[78]=se,e[79]=ce,e[80]=C):C=e[80],V="min-h-0 flex-1 overflow-y-auto pr-1",N=M.length===0?$?o.jsx(zv,{title:n("filePicker.filePickerDialog.noMatches",{query:$}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(zv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:z.map((ne,q)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ne.map(fe=>o.jsx(Cce,{item:fe,onDelete:()=>p(fe)},fe.key))},q))}),e[12]=s.name,e[13]=a,e[14]=k,e[15]=S,e[16]=x,e[17]=h,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=w,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=C,e[27]=V,e[28]=N,e[29]=A,e[30]=P}else j=e[25],C=e[26],V=e[27],N=e[28],A=e[29],P=e[30];let R;e[81]!==c||e[82]!==n?(R=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(me,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(et,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=R):R=e[83];let E;e[84]!==R||e[85]!==V||e[86]!==N?(E=o.jsxs("div",{className:V,children:[N,R]}),e[84]=R,e[85]=V,e[86]=N,e[87]=E):E=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>p(null),e[88]=I):I=e[88];let D;e[89]!==s.id||e[90]!==f?(D=o.jsx(Tce,{configId:s.id,item:f,onClose:I}),e[89]=s.id,e[90]=f,e[91]=D):D=e[91];let O;return e[92]!==j||e[93]!==C||e[94]!==E||e[95]!==D||e[96]!==A||e[97]!==P?(O=o.jsxs("div",{className:A,children:[P,j,C,E,D]}),e[92]=j,e[93]=C,e[94]=E,e[95]=D,e[96]=A,e[97]=P,e[98]=O):O=e[98],O}function jce(t){return t.items}function zv(t){const e=F.c(8),{title:s,description:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:o.jsx(ni,{size:18,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx("p",{className:"text-sm font-medium",children:s}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==n?(a=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=a):a=e[4];let l;return e[5]!==r||e[6]!==a?(l=o.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[i,r,a]}),e[5]=r,e[6]=a,e[7]=l):l=e[7],l}function Cce(t){const e=F.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=Kk(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let a;e[2]!==s.key?(a=m4(s.key),e[2]=s.key,e[3]=a):a=e[3];const l=a;let c;e[4]!==l||e[5]!==s.key||e[6]!==s.publicUrl?(c=l?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:Nce}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Ai,{size:28,className:"text-muted-foreground"})}),e[4]=l,e[5]=s.key,e[6]=s.publicUrl,e[7]=c):c=e[7];let d;e[8]!==s.key||e[9]!==s.publicUrl||e[10]!==c?(d=o.jsx("a",{href:s.publicUrl,target:"_blank",rel:"noreferrer",title:s.key,className:"block transition hover:ring-2 hover:ring-inset hover:ring-primary",children:c}),e[8]=s.key,e[9]=s.publicUrl,e[10]=c,e[11]=d):d=e[11];const h=s.key;let u;e[12]!==s.key?(u=Af(s.key),e[12]=s.key,e[13]=u):u=e[13];let f;e[14]!==s.key||e[15]!==u?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:h,children:u}),e[14]=s.key,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==s.size?(p=Wk(s.size),e[17]=s.size,e[18]=p):p=e[18];let m;e[19]!==r||e[20]!==p?(m=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",p]}),e[19]=r,e[20]=p,e[21]=m):m=e[21];let g;e[22]!==f||e[23]!==m?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,m]}),e[22]=f,e[23]=m,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(Vce,{item:s,onDelete:n}),e[25]=s,e[26]=n,e[27]=x):x=e[27];let b;e[28]!==g||e[29]!==x?(b=o.jsxs("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background px-2 py-1.5",children:[g,x]}),e[28]=g,e[29]=x,e[30]=b):b=e[30];let v;return e[31]!==b||e[32]!==d?(v=o.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-lg border border-border/60 bg-muted",children:[d,b]}),e[31]=b,e[32]=d,e[33]=v):v=e[33],v}function Nce(t){t.target.style.display="none"}function Vce(t){const e=F.c(36),{item:s,onDelete:n}=t,i=ae(),[r,a]=T.useState(!1);let l;e[0]!==s.publicUrl||e[1]!==i?(l=async function(){try{await navigator.clipboard.writeText(s.publicUrl),a(!0),window.setTimeout(()=>a(!1),1500)}catch{ye.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=l):l=e[2];const c=l;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(c0,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx($t,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==r?(f=r?o.jsx(Gt,{size:14}):o.jsx(bn,{size:14}),e[8]=r,e[9]=f):f=e[9];let p;e[10]!==r||e[11]!==i?(p=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=p):p=e[12];let m;e[13]!==c||e[14]!==f||e[15]!==p?(m=o.jsxs(Qe,{onClick:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(hn,{size:14}),e[17]=x):x=e[17];let b;e[18]!==i?(b=i("filePicker.filePickerDialog.openInNewTab"),e[18]=i,e[19]=b):b=e[19];let v;e[20]!==s.publicUrl||e[21]!==b?(v=o.jsx(Qe,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=v):v=e[22];let L;e[23]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(rn,{size:14}),e[23]=L):L=e[23];let _;e[24]!==i?(_=i("assets.browser.deleteAction"),e[24]=i,e[25]=_):_=e[25];let y;e[26]!==n||e[27]!==_?(y=o.jsxs(Qe,{variant:"destructive",onClick:n,children:[L,_]}),e[26]=n,e[27]=_,e[28]=y):y=e[28];let w;e[29]!==v||e[30]!==y||e[31]!==m?(w=o.jsxs(Bt,{align:"end",children:[m,v,y]}),e[29]=v,e[30]=y,e[31]=m,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==u?(S=o.jsxs(Ot,{children:[u,w]}),e[33]=w,e[34]=u,e[35]=S):S=e[35],S}function Tce(t){const e=F.c(47),{configId:s,item:n,onClose:i}=t,r=ae(),a=Pie();let l;e[0]!==s||e[1]!==a||e[2]!==n||e[3]!==i||e[4]!==r?(l=async function(){if(n)try{await a.mutateAsync({configId:s,key:n.key}),ye.success(r("assets.browser.deleted")),i()}catch{ye.error(r("assets.browser.deleteFailed"))}},e[0]=s,e[1]=a,e[2]=n,e[3]=i,e[4]=r,e[5]=l):l=e[5];const c=l,d=!!n;let h;e[6]!==i?(h=N=>!N&&i(),e[6]=i,e[7]=h):h=e[7];let u;e[8]!==r?(u=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=u):u=e[9];let f;e[10]!==u?(f=o.jsx(Xr,{children:u}),e[10]=u,e[11]=f):f=e[11];let p;e[12]!==n||e[13]!==r?(p=r("assets.browser.deleteConfirmDescription",{name:n?Af(n.key):""}),e[12]=n,e[13]=r,e[14]=p):p=e[14];let m;e[15]!==p?(m=o.jsx(Jr,{children:p}),e[15]=p,e[16]=m):m=e[16];let g;e[17]!==f||e[18]!==m?(g=o.jsxs(Qr,{children:[f,m]}),e[17]=f,e[18]=m,e[19]=g):g=e[19];const x=a.isPending;let b;e[20]!==r?(b=r("assets.browser.deleteCancel"),e[20]=r,e[21]=b):b=e[21];let v;e[22]!==a.isPending||e[23]!==b?(v=o.jsx(eo,{disabled:x,children:b}),e[22]=a.isPending,e[23]=b,e[24]=v):v=e[24];let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=re(A6({variant:"destructive"})),e[25]=L):L=e[25];const _=a.isPending;let y;e[26]!==c?(y=N=>{N.preventDefault(),c()},e[26]=c,e[27]=y):y=e[27];let w;e[28]!==a.isPending?(w=a.isPending?o.jsx(et,{className:"size-3.5"}):null,e[28]=a.isPending,e[29]=w):w=e[29];let S;e[30]!==r?(S=r("assets.browser.deleteConfirm"),e[30]=r,e[31]=S):S=e[31];let k;e[32]!==a.isPending||e[33]!==y||e[34]!==w||e[35]!==S?(k=o.jsxs(to,{className:L,disabled:_,onClick:y,children:[w,S]}),e[32]=a.isPending,e[33]=y,e[34]=w,e[35]=S,e[36]=k):k=e[36];let j;e[37]!==v||e[38]!==k?(j=o.jsxs(Zr,{children:[v,k]}),e[37]=v,e[38]=k,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=o.jsxs(Yr,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let V;return e[43]!==C||e[44]!==d||e[45]!==h?(V=o.jsx(Gr,{open:d,onOpenChange:h,children:C}),e[43]=C,e[44]=d,e[45]=h,e[46]=V):V=e[46],V}const am={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:oo},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Fr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:W6}},Ace=["fast","smart","thinking"];function Pce(t){const e=F.c(19),{tier:s,onSelect:n}=t,i=ae(),[r,a]=T.useState(!1),l=am[s].icon;let c;e[0]!==l?(c=o.jsx(l,{size:14,className:"text-muted-foreground"}),e[0]=l,e[1]=c):c=e[1];const d=am[s];let h;e[2]!==i||e[3]!==d.labelKey?(h=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=h):h=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(hs,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==h?(f=o.jsx(ws,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,h,u]})}),e[6]=c,e[7]=h,e[8]=f):f=e[8];let p;e[9]!==n||e[10]!==i||e[11]!==s?(p=Ace.map(x=>{const b=am[x],v=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),a(!1)},className:re("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"text-sm",children:i(b.labelKey)}),o.jsx("div",{className:"text-xs text-muted-foreground",children:i(b.subtitleKey)})]}),x===s&&o.jsx(Gt,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=p):p=e[12];let m;e[13]!==p?(m=o.jsx(ks,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:p})}),e[13]=p,e[14]=m):m=e[14];let g;return e[15]!==r||e[16]!==f||e[17]!==m?(g=o.jsxs(js,{open:r,onOpenChange:a,children:[f,m]}),e[15]=r,e[16]=f,e[17]=m,e[18]=g):g=e[18],g}function Ece(t){const e=F.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,a=ae(),[l,c]=T.useState(i!==null);let d;e[0]!==a?(d=a("automations.automationConfig.modelLabel"),e[0]=a,e[1]=d):d=e[1];let h;e[2]!==d?(h=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=h):h=e[3];let u;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==a||e[8]!==s||e[9]!==l?(u=l?o.jsx(T.Suspense,{fallback:o.jsx(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:a("automations.automationConfig.loadingModels")}),children:o.jsx(Rce,{override:i,onOverrideChange:r})}):o.jsx(Pce,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=a,e[8]=s,e[9]=l,e[10]=u):u=e[10];let f;e[11]!==r?(f=v=>{c(v),v||r(null)},e[11]=r,e[12]=f):f=e[12];let p;e[13]!==f||e[14]!==l?(p=o.jsx(lo,{checked:l,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=l,e[15]=p):p=e[15];let m;e[16]!==a?(m=a("automations.automationConfig.specificModel"),e[16]=a,e[17]=m):m=e[17];let g;e[18]!==p||e[19]!==m?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[p,m]}),e[18]=p,e[19]=m,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u,g]}),e[21]=u,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==h||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[h,x]}),e[24]=h,e[25]=x,e[26]=b):b=e[26],b}function Rce(t){const e=F.c(25),{override:s,onOverrideChange:n}=t,i=ae(),r=m9(),a=r[0]?.id??null;let l;e[0]!==a||e[1]!==r||e[2]!==s?.credentialId?(l=r.some(b=>b.id===s?.credentialId)?s?.credentialId??null:a,e[0]=a,e[1]=r,e[2]=s?.credentialId,e[3]=l):l=e[3];const[c,d]=T.useState(l);let h;e[4]!==c||e[5]!==a||e[6]!==r?(h=r.some(b=>b.id===c)?c:a,e[4]=c,e[5]=a,e[6]=r,e[7]=h):h=e[7];const u=h;let f;e[8]!==r||e[9]!==s?(f=s&&r.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=r,e[9]=s,e[10]=f):f=e[10];const p=f;if(r.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let v;return e[13]!==b?(v=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=v):v=e[14],v}let m;e[15]!==i?(m=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=m):m=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const v=b.keyId??u??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==p||e[22]!==m||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(bP,{variant:"bordered",placeholder:m,model:p,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=p,e[22]=m,e[23]=g,e[24]=x):x=e[24],x}const Aj=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Pg,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:jn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:ni},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:qr},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:e0}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Qo,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:l9},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:_9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:G2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Tu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Qo},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:_A}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Ia,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Ia},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Hc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Hc}]}],Dce=Aj.flatMap(t=>t.tools.map(e=>e.name));function Mce(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Ice(t){const e=F.c(12),{agentId:s,value:n,onChange:i}=t,r=ae();let a;e[0]!==r?(a=r("automations.automationConfig.toolsLabel"),e[0]=r,e[1]=a):a=e[1];let l;e[2]!==a?(l=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:a}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==r||e[7]!==n?(c=s?o.jsx(T.Suspense,{fallback:o.jsxs(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(Pg,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(Oce,{agentId:s,value:n,onChange:i})}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:r("automations.automationConfig.pickAgentFirst")}),e[4]=s,e[5]=i,e[6]=r,e[7]=n,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function Fv(t){const e=F.c(17),{value:s,checked:n,onToggle:i,title:r,description:a,leading:l}=t;let c;e[0]!==n?(c=o.jsx(rl,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==l?(d=l&&o.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r?(h=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=h):h=e[5];let u;e[6]!==a?(u=a&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==h||e[9]!==u?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h,u]}),e[8]=h,e[9]=u,e[10]=f):f=e[10];let p;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(p=o.jsxs($s,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=p):p=e[16],p}function Uv(t){const e=F.c(27),{conn:s,label:n,icon:i,on:r,total:a,onToggle:l}=t,c=ae(),d=r===a;let h;e[0]!==i||e[1]!==s?(h=s?o.jsx(ao,{icon:s.icon,name:s.title,size:"2xs"}):i?o.jsx(i,{size:14,className:"text-muted-foreground"}):o.jsx(t7,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=h):h=e[2];let u;e[3]!==s?.title||e[4]!==n||e[5]!==c?(u=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==a?(p=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[r,"/",a]}),e[9]=r,e[10]=a,e[11]=p):p=e[11];let m;e[12]!==l?(m=L=>{L.stopPropagation(),l()},e[12]=l,e[13]=m):m=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==m||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=m,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==p||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[p,x]}),e[20]=p,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==h||e[24]!==f||e[25]!==b?(v=o.jsxs("div",{className:"flex items-center gap-2",children:[h,f,b]}),e[23]=h,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function Oce(t){const e=F.c(83),{agentId:s,value:n,onChange:i}=t,r=ae(),{org:a}=Ue(),[l,c]=T.useState(!1);let d;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const h=Cn(d);let u;e[4]!==h?(u={client:h},e[4]=h,e[5]=u):u=e[5];const{data:f,isLoading:p}=F8(u),m=dr();let g,x,b,v,L,_,y,w,S,k,j,C,V;if(e[6]!==m||e[7]!==f?.tools||e[8]!==p||e[9]!==i||e[10]!==l||e[11]!==r||e[12]!==n){const E=new Map(m.map(Uce)),I=new Map;for(const ue of f?.tools??[]){const ce=Br(ue._meta)??"__other__",ne=Gu(ue.name,ce==="__other__"?void 0:ce),q=ue.title,fe=q&&q!==ue.name?q:Mce(ne);I.has(ce)||I.set(ce,{clientId:ce,conn:E.get(ce),tools:[]}),I.get(ce).tools.push({name:ue.name,display:fe,description:ue.description})}const D=[...I.values()].sort(Fce),O=(f?.tools??[]).map(zce),B=[...Dce,...O],M=n===null?new Set(B):new Set(n),z=B.every(ue=>M.has(ue)),$=ue=>i(B.every(ce=>ue.has(ce))?null:[...ue]),U=ue=>{const ce=new Set(M);ce.has(ue)?ce.delete(ue):ce.add(ue),$(ce)},H=(ue,ce)=>{const ne=new Set(M);for(const q of ue)ce?ne.add(q):ne.delete(q);$(ne)};v=js,V=l,L=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(Pg,{size:14,className:"text-muted-foreground"}),e[26]=W):W=e[26];let K;e[27]!==z||e[28]!==r?(K=r(z?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=z,e[28]=r,e[29]=K):K=e[29];const G=!z&&o.jsxs(FE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",B.length]});let Y;e[30]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(hs,{size:14,className:"text-muted-foreground"}),e[30]=Y):Y=e[30],e[31]!==K||e[32]!==G?(_=o.jsx(ws,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,K,G,Y]})}),e[31]=K,e[32]=G,e[33]=_):_=e[33],b=ks,j="p-0 w-80",C="start",x=vr;let Z;e[34]!==r?(Z=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=Z):Z=e[35],e[36]!==Z?(S=o.jsx(Mi,{placeholder:Z}),e[36]=Z,e[37]=S):S=e[37];const te=z?r("automations.automationConfig.allToolsEnabled",{count:B.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:B.length});let X;e[38]!==te?(X=o.jsx("span",{className:"text-xs text-muted-foreground",children:te}),e[38]=te,e[39]=X):X=e[39];let ee;e[40]!==i?(ee=()=>i(null),e[40]=i,e[41]=ee):ee=e[41];let J;e[42]!==r?(J=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=J):J=e[43];let Q;e[44]!==z||e[45]!==ee||e[46]!==J?(Q=o.jsx("button",{type:"button",onClick:ee,disabled:z,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:J}),e[44]=z,e[45]=ee,e[46]=J,e[47]=Q):Q=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=oe):oe=e[48];let le;e[49]!==i?(le=()=>i([]),e[49]=i,e[50]=le):le=e[50];const de=M.size===0;let se;e[51]!==r?(se=r("automations.automationConfig.clear"),e[51]=r,e[52]=se):se=e[52];let ie;e[53]!==le||e[54]!==de||e[55]!==se?(ie=o.jsx("button",{type:"button",onClick:le,disabled:de,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:se}),e[53]=le,e[54]=de,e[55]=se,e[56]=ie):ie=e[56];let he;e[57]!==Q||e[58]!==ie?(he=o.jsxs("div",{className:"flex items-center gap-2",children:[Q,oe,ie]}),e[57]=Q,e[58]=ie,e[59]=he):he=e[59],e[60]!==X||e[61]!==he?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[X,he]}),e[60]=X,e[61]=he,e[62]=k):k=e[62],g=Ii,y="max-h-80",w=p?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(ri,{children:r("automations.automationConfig.noToolsFound")}),Aj.map(ue=>{const ce=ue.tools.map(Bce),ne=ce.filter(q=>M.has(q)).length;return o.jsx(fn,{heading:o.jsx(Uv,{label:r(ue.headingKey),icon:ue.icon,on:ne,total:ce.length,onToggle:()=>H(ce,ne!==ce.length)}),children:ue.tools.map(q=>o.jsx(Fv,{value:`${r(q.titleKey)} ${q.name}`,checked:M.has(q.name),onToggle:()=>U(q.name),title:r(q.titleKey),description:r(q.descriptionKey),leading:o.jsx(q.icon,{size:16,className:"text-muted-foreground"})},q.name))},ue.key)}),D.map(ue=>{const ce=ue.tools.map($ce),ne=ce.filter(q=>M.has(q)).length;return o.jsx(fn,{heading:o.jsx(Uv,{conn:ue.conn,on:ne,total:ce.length,onToggle:()=>H(ce,ne!==ce.length)}),children:ue.tools.map(q=>o.jsx(Fv,{value:`${q.display} ${q.name} ${ue.conn?.title??""}`,checked:M.has(q.name),onToggle:()=>U(q.name),title:q.display,description:q.description},q.name))},ue.clientId)})]}),e[6]=m,e[7]=f?.tools,e[8]=p,e[9]=i,e[10]=l,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=L,e[18]=_,e[19]=y,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=C,e[25]=V}else g=e[13],x=e[14],b=e[15],v=e[16],L=e[17],_=e[18],y=e[19],w=e[20],S=e[21],k=e[22],j=e[23],C=e[24],V=e[25];let N;e[63]!==g||e[64]!==y||e[65]!==w?(N=o.jsx(g,{className:y,children:w}),e[63]=g,e[64]=y,e[65]=w,e[66]=N):N=e[66];let A;e[67]!==x||e[68]!==N||e[69]!==S||e[70]!==k?(A=o.jsxs(x,{children:[S,k,N]}),e[67]=x,e[68]=N,e[69]=S,e[70]=k,e[71]=A):A=e[71];let P;e[72]!==b||e[73]!==A||e[74]!==j||e[75]!==C?(P=o.jsx(b,{className:j,align:C,children:A}),e[72]=b,e[73]=A,e[74]=j,e[75]=C,e[76]=P):P=e[76];let R;return e[77]!==v||e[78]!==L||e[79]!==_||e[80]!==P||e[81]!==V?(R=o.jsxs(v,{open:V,onOpenChange:L,children:[_,P]}),e[77]=v,e[78]=L,e[79]=_,e[80]=P,e[81]=V,e[82]=R):R=e[82],R}function $ce(t){return t.name}function Bce(t){return t.name}function zce(t){return t.name}function Fce(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function Uce(t){return[t.id,t]}function vu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Hce(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return`Every ${n[1]} hours`;const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(i){const l=parseInt(i[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const r=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(r){const l=(r[2]??"0").padStart(2,"0"),c=(r[1]??"0").padStart(2,"0");return`Every day at ${l}:${c} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",d=(a[2]??"0").padStart(2,"0"),h=(a[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${h} UTC`}return t}function Kce(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function Wce(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const n=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(n)return{count:parseInt(n[1]),unit:"hours"};const i=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);return i?{count:parseInt(i[1]),unit:"days"}:null}function qce(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Gce=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Yce({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const a=ae(),{triggerAdd:l}=f0(),[c,d]=T.useState(!1),h=e??c,u=m=>{s?s(m):d(m)},f=async m=>{try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),ye.success(a("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:a("automations.addStarterPopover.failedAddStarter");ye.error(x)}},p=async()=>{try{const m=await l.mutateAsync({automation_id:t,type:"webhook"});u(!1),m.webhook?r?.(m.webhook):ye.success(a("automations.addStarterPopover.webhookStarterAdded"))}catch(m){const g=m instanceof Error?m.message:a("automations.addStarterPopover.failedAddWebhookStarter");ye.error(g)}};return o.jsxs(Ot,{open:h,onOpenChange:u,children:[o.jsx($t,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(Qt,{size:14}),a("automations.addStarterPopover.addStarter")]})}),o.jsxs(Bt,{align:"end",className:"w-[200px]",children:[o.jsxs(_i,{children:[o.jsxs(Li,{className:"gap-2.5",children:[o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.every")]}),o.jsx(wi,{className:"w-[160px]",children:Gce.map(m=>o.jsxs(Qe,{className:"gap-2.5",onSelect:()=>f(m.cron),disabled:l.isPending,children:[o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.everyUnit",{unit:m.label})]},m.cron))})]}),o.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.customCron")]}),o.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{u(!1),i?.()},children:[o.jsx(hr,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.event")]}),o.jsxs(Qe,{className:"gap-2.5",onSelect:()=>{p()},disabled:l.isPending,children:[o.jsx(jn,{size:14,className:"text-muted-foreground shrink-0"}),a("automations.addStarterPopover.webhook")]})]})]})}function Pj(t){const e=F.c(39),{open:s,onOpenChange:n,url:i,token:r,title:a,description:l}=t,c=a===void 0?"Webhook ready":a,d=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,h=ae(),[u,f]=T.useState(null),[p,m]=T.useState("curl"),[g,x]=T.useState("header"),b=T.useId();let v;e[0]!==h?(v=async(D,O)=>{try{await navigator.clipboard.writeText(D),f(O),ye.success(h("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ye.error(h("automations.webhookSecretDialog.failedCopy"))}},e[0]=h,e[1]=v):v=e[1];const L=v;let _;e[2]!==g||e[3]!==r||e[4]!==i?(_=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=_):_=e[5];const y=_,w=i&&r?g==="header"?`curl -X POST "${y}" \\
635
635
  -H "Authorization: Bearer ${r}" \\
636
636
  -H "Content-Type: application/json" \\
637
637
  -d '{"hello":"world"}'`:`curl -X POST "${y}" \\
@@ -650,7 +650,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
650
650
  },
651
651
  body: JSON.stringify({ hello: "world" }),
652
652
  });`:"",k=p==="curl"?w:S;let j;e[6]!==c?(j=o.jsx(Kt,{children:c}),e[6]=c,e[7]=j):j=e[7];let C;e[8]!==d?(C=o.jsx(Mn,{children:d}),e[8]=d,e[9]=C):C=e[9];let V;e[10]!==j||e[11]!==C?(V=o.jsxs(cs,{children:[j,C]}),e[10]=j,e[11]=C,e[12]=V):V=e[12];let N;e[13]!==g||e[14]!==u||e[15]!==L||e[16]!==y||e[17]!==p||e[18]!==k||e[19]!==h||e[20]!==r||e[21]!==b||e[22]!==i?(N=i&&r?o.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.url")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:y}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>L(y,"url"),children:[o.jsx(bn,{size:13}),h(u==="url"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.tokenLabel")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:r}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>L(r,"token"),children:[o.jsx(bn,{size:13}),h(u==="token"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.snippet")}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ad,{value:p,onValueChange:D=>m(D),children:o.jsxs(t0,{className:"h-8 p-[2px]",children:[o.jsx(or,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),o.jsx(or,{value:"fetch",className:"h-7 px-2.5 text-xs",children:"fetch"})]})}),o.jsxs("label",{htmlFor:b,className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none",children:[o.jsx(rl,{id:b,checked:g==="url",onCheckedChange:D=>x(D?"url":"header")}),h("automations.webhookSecretDialog.tokenInUrl")]})]}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>L(k,"example"),children:[o.jsx(bn,{size:13}),h(u==="example"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]}),o.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:o.jsx(hd,{code:k,language:p==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[13]=g,e[14]=u,e[15]=L,e[16]=y,e[17]=p,e[18]=k,e[19]=h,e[20]=r,e[21]=b,e[22]=i,e[23]=N):N=e[23];let A;e[24]!==n?(A=()=>n(!1),e[24]=n,e[25]=A):A=e[25];let P;e[26]!==h?(P=h("automations.webhookSecretDialog.done"),e[26]=h,e[27]=P):P=e[27];let R;e[28]!==P||e[29]!==A?(R=o.jsx(qn,{children:o.jsx(me,{onClick:A,children:P})}),e[28]=P,e[29]=A,e[30]=R):R=e[30];let E;e[31]!==R||e[32]!==V||e[33]!==N?(E=o.jsxs(zt,{className:"max-w-lg",children:[V,N,R]}),e[31]=R,e[32]=V,e[33]=N,e[34]=E):E=e[34];let I;return e[35]!==n||e[36]!==s||e[37]!==E?(I=o.jsx(Ft,{open:s,onOpenChange:n,children:E}),e[35]=n,e[36]=s,e[37]=E,e[38]=I):I=e[38],I}function Qce(t){const e=F.c(137),{trigger:s,automationId:n,connectionName:i}=t,r=ae(),{triggerAdd:a,triggerRemove:l,triggerRotateToken:c}=f0(),[d,h]=T.useState(!1),[u,f]=T.useState(!1),[p,m]=T.useState(null);let g;e[0]!==s.cron_expression?(g=s.cron_expression?Wce(s.cron_expression):null,e[0]=s.cron_expression,e[1]=g):g=e[1];const x=g,[b,v]=T.useState(x?.count??1),[L,_]=T.useState(!1),[y,w]=T.useState(s.cron_expression??""),S=l.isPending||a.isPending||c.isPending,k=s.type==="cron",j=s.type==="webhook";let C;e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==s.id?(C=async()=>{try{await l.mutateAsync({trigger_id:s.id,automation_id:n}),ye.success(r("automations.triggerCard.starterRemoved"))}catch{ye.error(r("automations.triggerCard.failedToRemoveStarter"))}h(!1)},e[2]=n,e[3]=l,e[4]=r,e[5]=s.id,e[6]=C):C=e[6];const V=C;let N;e[7]!==a||e[8]!==n||e[9]!==l||e[10]!==s.id?(N=async Fe=>{await a.mutateAsync({automation_id:n,type:"cron",cron_expression:Fe}),await l.mutateAsync({trigger_id:s.id,automation_id:n})},e[7]=a,e[8]=n,e[9]=l,e[10]=s.id,e[11]=N):N=e[11];const A=N;let P;e[12]!==y||e[13]!==A||e[14]!==r||e[15]!==s.cron_expression?(P=async()=>{const Fe=y.trim();if(!Fe||!vu(Fe)||Fe===s.cron_expression){_(!1),w(s.cron_expression??"");return}try{await A(Fe),_(!1)}catch{ye.error(r("automations.triggerCard.failedToUpdateStarter")),w(s.cron_expression??""),_(!1)}},e[12]=y,e[13]=A,e[14]=r,e[15]=s.cron_expression,e[16]=P):P=e[16];const R=P;let E;e[17]!==n||e[18]!==c||e[19]!==s.id?(E=async()=>{f(!1);try{const Fe=await c.mutateAsync({trigger_id:s.id,automation_id:n});m({url:Fe.url,token:Fe.token})}catch(Fe){const yt=Fe,it=yt instanceof Error?yt.message:"Failed to rotate token";ye.error(it)}},e[17]=n,e[18]=c,e[19]=s.id,e[20]=E):E=e[20];const I=E;let D;e[21]!==x||e[22]!==A||e[23]!==r||e[24]!==s.cron_expression?(D=async Fe=>{if(!x)return;const yt=x.unit==="minutes"?5:1,it=Math.max(yt,Fe);it!==Fe&&v(it);const st=Kce(it,x.unit);if(st!==s.cron_expression)try{await A(st)}catch{ye.error(r("automations.triggerCard.failedToUpdateStarter")),v(x.count)}},e[21]=x,e[22]=A,e[23]=r,e[24]=s.cron_expression,e[25]=D):D=e[25];const O=D;let B;e[26]!==k||e[27]!==j?(B=k?o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}):j?o.jsx(jn,{size:14,className:"text-muted-foreground shrink-0"}):o.jsx(hr,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=k,e[27]=j,e[28]=B):B=e[28];let M;e[29]!==i||e[30]!==b||e[31]!==y||e[32]!==O||e[33]!==R||e[34]!==x||e[35]!==k||e[36]!==L||e[37]!==S||e[38]!==j||e[39]!==r||e[40]!==s.cron_expression||e[41]!==s.event_type||e[42]!==s.params?(M=x&&k?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:r("automations.triggerCard.every")}),o.jsx("input",{type:"number",min:x.unit==="minutes"?5:1,value:b,onChange:Fe=>v(parseInt(Fe.target.value)||1),onBlur:()=>O(b),onKeyDown:Fe=>{Fe.key==="Enter"&&Fe.target.blur(),Fe.key==="Escape"&&v(x.count)},disabled:S,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),o.jsx("span",{className:"text-sm",children:qce(x.unit,b)})]}):k&&L?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"text",value:y,onChange:Fe=>w(Fe.target.value),onBlur:R,onKeyDown:Fe=>{Fe.key==="Enter"&&Fe.target.blur(),Fe.key==="Escape"&&(_(!1),w(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),y&&!vu(y)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:r("automations.triggerCard.invalid")})]}):o.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:k?Hce(s.cron_expression??""):j?r("automations.triggerCard.webhookPostToFire"):`${s.event_type}${i?` · ${i}`:""}`}),!k&&!j&&s.params&&Object.keys(s.params).length>0&&o.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(Xce).join(", ")})]}),e[29]=i,e[30]=b,e[31]=y,e[32]=O,e[33]=R,e[34]=x,e[35]=k,e[36]=L,e[37]=S,e[38]=j,e[39]=r,e[40]=s.cron_expression,e[41]=s.event_type,e[42]=s.params,e[43]=M):M=e[43];let z;e[44]!==S?(z=S&&o.jsx(et,{className:"size-[13px] text-muted-foreground"}),e[44]=S,e[45]=z):z=e[45];let $;e[46]!==x||e[47]!==k||e[48]!==L||e[49]!==s.cron_expression?($=k&&!x&&!L&&o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{w(s.cron_expression??""),_(!0)},children:o.jsx(_9,{size:13,className:"text-muted-foreground"})}),e[46]=x,e[47]=k,e[48]=L,e[49]=s.cron_expression,e[50]=$):$=e[50];let U;e[51]!==j||e[52]!==r?(U=j&&o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:r("automations.triggerCard.rotateToken"),onClick:()=>f(!0),children:o.jsx(Dn,{size:13,className:"text-muted-foreground"})}),e[51]=j,e[52]=r,e[53]=U):U=e[53];let H;e[54]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>h(!0),children:o.jsx(ii,{size:13,className:"text-muted-foreground"})}),e[54]=H):H=e[54];let W;e[55]!==$||e[56]!==U||e[57]!==z?(W=o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[z,$,U,H]}),e[55]=$,e[56]=U,e[57]=z,e[58]=W):W=e[58];let K;e[59]!==W||e[60]!==B||e[61]!==M?(K=o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[B,M,W]}),e[59]=W,e[60]=B,e[61]=M,e[62]=K):K=e[62];let G;e[63]!==r?(G=r("automations.triggerCard.removeStarter"),e[63]=r,e[64]=G):G=e[64];let Y;e[65]!==G?(Y=o.jsx(Xr,{children:G}),e[65]=G,e[66]=Y):Y=e[66];let Z;e[67]!==r?(Z=r("automations.triggerCard.confirmRemoveStarter"),e[67]=r,e[68]=Z):Z=e[68];let te;e[69]!==Z?(te=o.jsx(Jr,{children:Z}),e[69]=Z,e[70]=te):te=e[70];let X;e[71]!==Y||e[72]!==te?(X=o.jsxs(Qr,{children:[Y,te]}),e[71]=Y,e[72]=te,e[73]=X):X=e[73];let ee;e[74]!==r?(ee=r("automations.triggerCard.cancel"),e[74]=r,e[75]=ee):ee=e[75];let J;e[76]!==ee?(J=o.jsx(eo,{children:ee}),e[76]=ee,e[77]=J):J=e[77];let Q;e[78]!==r?(Q=r("automations.triggerCard.remove"),e[78]=r,e[79]=Q):Q=e[79];let oe;e[80]!==V||e[81]!==Q?(oe=o.jsx(to,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Q}),e[80]=V,e[81]=Q,e[82]=oe):oe=e[82];let le;e[83]!==J||e[84]!==oe?(le=o.jsxs(Zr,{children:[J,oe]}),e[83]=J,e[84]=oe,e[85]=le):le=e[85];let de;e[86]!==X||e[87]!==le?(de=o.jsxs(Yr,{children:[X,le]}),e[86]=X,e[87]=le,e[88]=de):de=e[88];let se;e[89]!==d||e[90]!==de?(se=o.jsx(Gr,{open:d,onOpenChange:h,children:de}),e[89]=d,e[90]=de,e[91]=se):se=e[91];let ie;e[92]!==r?(ie=r("automations.triggerCard.rotateWebhookToken"),e[92]=r,e[93]=ie):ie=e[93];let he;e[94]!==ie?(he=o.jsx(Xr,{children:ie}),e[94]=ie,e[95]=he):he=e[95];let ue;e[96]!==r?(ue=r("automations.triggerCard.rotateWebhookTokenDescription"),e[96]=r,e[97]=ue):ue=e[97];let ce;e[98]!==ue?(ce=o.jsx(Jr,{children:ue}),e[98]=ue,e[99]=ce):ce=e[99];let ne;e[100]!==he||e[101]!==ce?(ne=o.jsxs(Qr,{children:[he,ce]}),e[100]=he,e[101]=ce,e[102]=ne):ne=e[102];let q;e[103]!==r?(q=r("automations.triggerCard.cancel"),e[103]=r,e[104]=q):q=e[104];let fe;e[105]!==q?(fe=o.jsx(eo,{children:q}),e[105]=q,e[106]=fe):fe=e[106];let ge;e[107]!==r?(ge=r("automations.triggerCard.rotate"),e[107]=r,e[108]=ge):ge=e[108];let _e;e[109]!==I||e[110]!==ge?(_e=o.jsx(to,{onClick:I,children:ge}),e[109]=I,e[110]=ge,e[111]=_e):_e=e[111];let Le;e[112]!==fe||e[113]!==_e?(Le=o.jsxs(Zr,{children:[fe,_e]}),e[112]=fe,e[113]=_e,e[114]=Le):Le=e[114];let je;e[115]!==ne||e[116]!==Le?(je=o.jsxs(Yr,{children:[ne,Le]}),e[115]=ne,e[116]=Le,e[117]=je):je=e[117];let Ce;e[118]!==u||e[119]!==je?(Ce=o.jsx(Gr,{open:u,onOpenChange:f,children:je}),e[118]=u,e[119]=je,e[120]=Ce):Ce=e[120];const Pe=p!==null;let pe;e[121]===Symbol.for("react.memo_cache_sentinel")?(pe=Fe=>{Fe||m(null)},e[121]=pe):pe=e[121];const ke=p?.url??null,Te=p?.token??null;let we;e[122]!==r?(we=r("automations.triggerCard.newWebhookToken"),e[122]=r,e[123]=we):we=e[123];let Ne;e[124]!==r?(Ne=r("automations.triggerCard.newWebhookTokenDescription"),e[124]=r,e[125]=Ne):Ne=e[125];let Oe;e[126]!==Pe||e[127]!==ke||e[128]!==Te||e[129]!==we||e[130]!==Ne?(Oe=o.jsx(Pj,{open:Pe,onOpenChange:pe,url:ke,token:Te,title:we,description:Ne}),e[126]=Pe,e[127]=ke,e[128]=Te,e[129]=we,e[130]=Ne,e[131]=Oe):Oe=e[131];let nt;return e[132]!==K||e[133]!==se||e[134]!==Ce||e[135]!==Oe?(nt=o.jsxs(o.Fragment,{children:[K,se,Ce,Oe]}),e[132]=K,e[133]=se,e[134]=Ce,e[135]=Oe,e[136]=nt):nt=e[136],nt}function Xce(t){const[e,s]=t;return`${e}: ${s}`}function Jce(t){const e=F.c(70),{automationId:s,onDone:n}=t,i=ae();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const a=dr(r),[l,c]=T.useState(),[d,h]=T.useState();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const[f,p]=T.useState(u),{triggerAdd:m}=f0(),{data:g,isLoading:x}=UE(l);let b,v,L,_,y,w;if(e[2]!==m||e[3]!==s||e[4]!==l||e[5]!==d||e[6]!==x||e[7]!==n||e[8]!==f||e[9]!==i||e[10]!==a||e[11]!==g){const j=g?.find(z=>z.type===d);let C;e[18]!==m||e[19]!==s||e[20]!==l||e[21]!==d||e[22]!==n||e[23]!==f||e[24]!==i?(C=async()=>{if(!(!l||!d))try{await m.mutateAsync({automation_id:s,type:"event",event_type:d,connection_id:l,params:f}),qe("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:l,event_type:d}),ye.success(i("automations.eventTriggerForm.successAdded")),n()}catch{ye.error(i("automations.eventTriggerForm.errorFailed"))}},e[18]=m,e[19]=s,e[20]=l,e[21]=d,e[22]=n,e[23]=f,e[24]=i,e[25]=C):C=e[25],b=C,v="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(hr,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=V):V=e[26];let N;e[27]!==i?(N=i("automations.eventTriggerForm.title"),e[27]=i,e[28]=N):N=e[28];let A;e[29]!==N?(A=o.jsx("span",{className:"text-sm font-medium",children:N}),e[29]=N,e[30]=A):A=e[30];let P;e[31]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(ii,{size:13}),e[31]=P):P=e[31];let R;e[32]!==n?(R=o.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:n,children:P}),e[32]=n,e[33]=R):R=e[33],e[34]!==A||e[35]!==R?(L=o.jsxs("div",{className:"flex items-center gap-2",children:[V,A,R]}),e[34]=A,e[35]=R,e[36]=L):L=e[36];const E=l??"";let I;e[37]===Symbol.for("react.memo_cache_sentinel")?(I=z=>{c(z),h(void 0),p({})},e[37]=I):I=e[37];let D;e[38]!==i?(D=i("automations.eventTriggerForm.selectConnectionPlaceholder"),e[38]=i,e[39]=D):D=e[39];let O;e[40]!==D?(O=o.jsx(bs,{className:"w-full",children:o.jsx(Ss,{placeholder:D})}),e[40]=D,e[41]=O):O=e[41];let B;e[42]!==i||e[43]!==a?(B=a.length===0?o.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:i("automations.eventTriggerForm.noConnectionsWithTrigger")}):a.map(tde),e[42]=i,e[43]=a,e[44]=B):B=e[44];let M;e[45]!==B?(M=o.jsx(vs,{children:B}),e[45]=B,e[46]=M):M=e[46],e[47]!==E||e[48]!==O||e[49]!==M?(_=o.jsxs(xs,{value:E,onValueChange:I,children:[O,M]}),e[47]=E,e[48]=O,e[49]=M,e[50]=_):_=e[50],e[51]!==l||e[52]!==d||e[53]!==x||e[54]!==i||e[55]!==g?(y=l&&o.jsxs(xs,{value:d??"",onValueChange:z=>{h(z),p({})},children:[o.jsx(bs,{className:"w-full",children:x?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(et,{className:"size-[13px]"}),i("automations.eventTriggerForm.loadingEvents")]}):o.jsx(Ss,{placeholder:i("automations.eventTriggerForm.selectEventTypePlaceholder"),children:d??i("automations.eventTriggerForm.selectEventTypePlaceholder")})}),o.jsx(vs,{children:g?.map(ede)})]}),e[51]=l,e[52]=d,e[53]=x,e[54]=i,e[55]=g,e[56]=y):y=e[56],w=j?.paramsSchema&&Object.keys(j.paramsSchema).length>0&&o.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(j.paramsSchema).map(z=>{const[$,U]=z;return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("label",{className:"text-xs text-muted-foreground",children:[$,U.description&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",U.description]})]}),U.enum?o.jsxs(xs,{value:f[$]??"",onValueChange:H=>p(W=>({...W,[$]:H})),children:[o.jsx(bs,{className:"w-full",children:o.jsx(Ss,{placeholder:i("automations.eventTriggerForm.selectParamPlaceholder",{key:$})})}),o.jsx(vs,{children:U.enum.map(Zce)})]}):o.jsx("input",{type:"text",value:f[$]??"",onChange:H=>p(W=>({...W,[$]:H.target.value})),placeholder:U.description??$,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},$)})}),e[2]=m,e[3]=s,e[4]=l,e[5]=d,e[6]=x,e[7]=n,e[8]=f,e[9]=i,e[10]=a,e[11]=g,e[12]=b,e[13]=v,e[14]=L,e[15]=_,e[16]=y,e[17]=w}else b=e[12],v=e[13],L=e[14],_=e[15],y=e[16],w=e[17];let S;e[57]!==m||e[58]!==l||e[59]!==d||e[60]!==b||e[61]!==i?(S=l&&d&&o.jsx(me,{size:"sm",onClick:b,disabled:m.isPending,children:m.isPending?o.jsx(et,{className:"size-[13px]"}):i("automations.eventTriggerForm.addTriggerButton")}),e[57]=m,e[58]=l,e[59]=d,e[60]=b,e[61]=i,e[62]=S):S=e[62];let k;return e[63]!==v||e[64]!==L||e[65]!==_||e[66]!==y||e[67]!==w||e[68]!==S?(k=o.jsxs("div",{className:v,children:[L,_,y,w,S]}),e[63]=v,e[64]=L,e[65]=_,e[66]=y,e[67]=w,e[68]=S,e[69]=k):k=e[69],k}function Zce(t){return o.jsx(Rt,{value:t,children:t},t)}function ede(t){return o.jsx(Rt,{value:t.type,children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{children:t.type}),o.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function tde(t){return o.jsx(Rt,{value:t.id,children:t.title},t.id)}const sde=30;function nde(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},n=new Set(s.fields);for(const i of e.fields)n.add(i);return{...s,fields:n,saveCount:s.saveCount+1}}case"reset":return null}}function ide({automationId:t,automation:e,onBack:s,onDelete:n}){const i=ae(),r=e.virtual_mcp_id,{org:a}=Ue(),{update:l,triggerAdd:c,run:d}=f0(),h=dr(),u=new Map(h.map(Q=>[Q.id,Q.title])),{openTask:f}=on(),{openSidePanel:p}=oa(),{sendMessage:m}=ai(),g=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[x,b]=T.useState(g),[v,L]=T.useState(!1),[_,y]=T.useState(!1),[w,S]=T.useState(!1),[k,j]=T.useState(""),[C,V]=T.useState(!1),[N,A]=T.useState(null),[P,R]=T.useState(!1),[E,I]=T.useState(!1),[D,O]=T.useState(!1),B=async()=>{if(P)return;const oe=kV(x).filter(le=>le.type==="text").map(le=>le.text).join(`
653
- `);if(oe.trim()){R(!0);try{X(),qe("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:oe.length}),p(),await m({tiptapDoc:lL({managerAgentId:jT.AUTOMATION_MANAGER(a.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:oe})})}finally{R(!1)}}},M=e.models?.tier??"smart",z=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,$=T2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:z,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=$.watch("active"),[H,W]=T.useReducer(nde,null),K=()=>{H!==null&&(qe("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(H.fields),save_count:H.saveCount,edit_duration_ms:Date.now()-H.start}),W({type:"reset"}))},G=async()=>{const Q=$.control._formState.dirtyFields,oe=Object.keys(Q);if(oe.length===0&&!D)return!0;const le=$.getValues(),de=$.control._defaultValues;$.reset(le,{keepValues:!0});const se=D;O(!1);const ie={tier:le.tier,...le.modelOverride?{modelId:le.modelOverride.modelId,credentialId:le.modelOverride.credentialId,modelTitle:le.modelOverride.title}:{}},he={id:t,name:le.name,active:le.active,models:ie,tools:le.tools,maxAgentSteps:le.maxAgentSteps,messages:SV(x),temperature:0};try{await l.mutateAsync(he)}catch{return $.reset(de,{keepValues:!0}),se&&O(!0),!1}const ue=[...oe];return se&&ue.push("messages"),W({type:"accumulate",now:Date.now(),fields:ue}),te(),!0},{schedule:Y,flush:Z}=Jh({save:G}),{schedule:te,flush:X}=Jh({delayMs:3e4,save:async()=>K()});T.useEffect(()=>{const Q=$.watch(()=>Y());return()=>Q.unsubscribe()},[]);const ee=Q=>{if(b(Q),!E){I(!0);return}O(!0),Y()},J=async()=>{qe("automation_test_clicked",{automation_id:t,agent_id:r});const Q=await Z();if(X(),!!Q){if(!x){ye.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const oe=await d.mutateAsync(t);oe.threadId&&(p(),f(oe.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(me,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(c9,{size:14}),i("automations.automationDetail.backToList")]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(Ls,{control:$.control,name:"name",render:({field:Q})=>o.jsx(vt,{...Q,placeholder:i("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(me,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(rn,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ls,{control:$.control,name:"active",render:({field:Q})=>o.jsx(lo,{checked:Q.value,onCheckedChange:oe=>{Q.onChange(oe),Z()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i(U?"automations.automationDetail.active":"automations.automationDetail.inactive")}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(cL,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.starter")}),o.jsx(Yce,{automationId:t,open:v,onOpenChange:L,onCustomSelect:()=>{S(!0),V(!1),j("")},onEventSelect:()=>{V(!0),S(!1)},onWebhookCreated:Q=>{qe("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),A(Q)}})]}),e.triggers.length===0&&!w?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[i("automations.automationDetail.whenShouldRun")," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>L(!0),children:i("automations.automationDetail.addStarter")})," ",i("automations.automationDetail.toGetGoing")]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Q=>o.jsx(Qce,{trigger:Q,automationId:t,connectionName:Q.connection_id?u.get(Q.connection_id):void 0},Q.id))}),w&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:k,onChange:Q=>j(Q.target.value),onBlur:async()=>{const Q=k.trim();if(!(!Q||!vu(Q)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:Q}),qe("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ye.success(i("automations.automationDetail.starterAdded")),S(!1),j("")}catch{ye.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async Q=>{const oe=k.trim();Q.key==="Enter"&&oe&&vu(oe)&&Q.target.blur(),Q.key==="Escape"&&(S(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!vu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(et,{className:"size-[13px] text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{S(!1),j("")},children:o.jsx(ii,{size:13})})]}),C&&o.jsx(T.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(et,{className:"size-[13px] text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(Jce,{automationId:t,onDone:()=>V(!1)})}),o.jsx(Pj,{open:N!==null,onOpenChange:Q=>{Q||A(null)},url:N?.url??null,token:N?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.instructions")}),o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:P||!x,onClick:B,children:[o.jsx(Fr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(w_,{tiptapDoc:x,setTiptapDoc:ee,placeholder:i("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(S_,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:J,disabled:!r,children:[o.jsx(Gf,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(Ke,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(z2,{open:_,onOpenChange:y,className:"flex flex-col gap-2.5",children:[o.jsxs($2,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.advanced")}),o.jsx(hs,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(B2,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(Ece,{tier:$.watch("tier"),onTierChange:Q=>$.setValue("tier",Q,{shouldDirty:!0}),override:$.watch("modelOverride"),onOverrideChange:Q=>$.setValue("modelOverride",Q,{shouldDirty:!0})}),o.jsx(Ice,{agentId:r||null,value:$.watch("tools"),onChange:Q=>$.setValue("tools",Q,{shouldDirty:!0})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.maxSteps")}),o.jsx(vt,{type:"number",min:1,max:100,className:"w-40",placeholder:i("automations.automationDetail.maxStepsPlaceholder",{default:sde}),value:$.watch("maxAgentSteps")??"",onChange:Q=>{const oe=Q.target.value.trim(),le=oe===""?null:Number(oe);$.setValue("maxAgentSteps",le===null||Number.isNaN(le)?null:le,{shouldDirty:!0})}})]})]})]})]})]})}const Ej=[{key:"24h",labelKey:"mainPanelTabs.automationTab.last24hours",ms:1440*60*1e3},{key:"7d",labelKey:"mainPanelTabs.automationTab.last7days",ms:10080*60*1e3},{key:"30d",labelKey:"mainPanelTabs.automationTab.last30days",ms:720*60*60*1e3}];function Rj(t){const e=Ej.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function rde(t){const e=F.c(16),{automationId:s,triggerIds:n}=t,i=ae(),[r,a]=T.useState("30d"),[l,c]=T.useState(ode);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;a(b),c(Rj(b))},e[0]=d):d=e[0];let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(bs,{className:"w-44",children:o.jsx(Ss,{})}),e[1]=h):h=e[1];let u;e[2]!==i?(u=Ej.map(x=>o.jsx(Rt,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=u):u=e[3];let f;e[4]!==u?(f=o.jsx(vs,{children:u}),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==f||e[7]!==r?(p=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(xs,{value:r,onValueChange:d,children:[h,f]})}),e[6]=f,e[7]=r,e[8]=p):p=e[8];let m;e[9]!==s||e[10]!==l||e[11]!==n?(m=o.jsx(mT,{automationId:s,triggerIds:n,range:l}),e[9]=s,e[10]=l,e[11]=n,e[12]=m):m=e[12];let g;return e[13]!==p||e[14]!==m?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[p,m]}),e[13]=p,e[14]=m,e[15]=g):g=e[15],g}function ode(){return Rj("30d")}function ade(t){const e=F.c(5),{tabId:s}=t;let n;e[0]!==s?(n=m6(s),e[0]=s,e[1]=n):n=e[1];const i=n;if(!i)return null;let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Aa,{}),e[2]=r):r=e[2];let a;return e[3]!==i.id?(a=o.jsx(T.Suspense,{fallback:r,children:o.jsx(lde,{id:i.id})}),e[3]=i.id,e[4]=a):a=e[4],a}function lde(t){const e=F.c(41),{id:s}=t,n=ae(),{openPanel:i}=Di(),{data:r,isLoading:a}=HE(s),[l,c]=T.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const h=d;if(a){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Aa,{}),e[2]=C):C=e[2],C}if(!r){let C;e[3]!==n?(C=n("mainPanelTabs.automationTab.automationNotFound"),e[3]=n,e[4]=C):C=e[4];let V;return e[5]!==C?(V=o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:C}),e[5]=C,e[6]=V):V=e[6],V}let u;e[7]!==r.triggers?(u=r.triggers.map(cde),e[7]=r.triggers,e[8]=u):u=e[8];const f=u;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(c9,{size:14}),e[9]=p):p=e[9];let m;e[10]!==n?(m=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=m):m=e[11];let g;e[12]!==h||e[13]!==m?(g=o.jsxs(me,{variant:"ghost",size:"sm",onClick:h,children:[p,m]}),e[12]=h,e[13]=m,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let v;e[19]!==n?(v=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=v):v=e[20];let L;e[21]!==v?(L={id:"runs",label:v},e[21]=v,e[22]=L):L=e[22];let _;e[23]!==b||e[24]!==L?(_=[b,L],e[23]=b,e[24]=L,e[25]=_):_=e[25];let y;e[26]===Symbol.for("react.memo_cache_sentinel")?(y=C=>c(C),e[26]=y):y=e[26];let w;e[27]!==_||e[28]!==l?(w=o.jsx(s7,{tabs:_,activeTab:l,onTabChange:y}),e[27]=_,e[28]=l,e[29]=w):w=e[29];let S;e[30]!==w||e[31]!==g?(S=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,w]}),e[30]=w,e[31]=g,e[32]=S):S=e[32];let k;e[33]!==r||e[34]!==s||e[35]!==l||e[36]!==f?(k=l==="settings"?o.jsx(ide,{automationId:s,automation:r}):o.jsx(rde,{automationId:s,triggerIds:f}),e[33]=r,e[34]=s,e[35]=l,e[36]=f,e[37]=k):k=e[37];let j;return e[38]!==S||e[39]!==k?(j=o.jsx(En,{children:o.jsx(En.Content,{children:o.jsxs(En.Body,{children:[S,k]})})}),e[38]=S,e[39]=k,e[40]=j):j=e[40],j}function cde(t){return t.id}function dde(t){const e=F.c(29),{virtualMcpId:s}=t,n=ae(),{openPanel:i}=Di(),{data:r}=KE(s),a=r===void 0?[]:r,{create:l}=f0(),[c,d]=T.useState(""),h=c.toLowerCase(),u=a.filter(E=>E.name.toLowerCase().includes(h));let f;e[0]!==i?(f=E=>i(`automation:${E}`),e[0]=i,e[1]=f):f=e[1];const p=f,m=async()=>{if(l.isPending)return;qe("automation_new_clicked",{virtual_mcp_id:s,existing_count:a.length});const E=await l.mutateAsync(WE(s));p(E.id)},g=l.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Qt,{size:14}),e[2]=x):x=e[2];let b;e[3]!==n?(b=n("automations.automationsList.newAutomation"),e[3]=n,e[4]=b):b=e[4];let v;e[5]!==l.isPending||e[6]!==m||e[7]!==b?(v=o.jsxs(me,{size:"sm",onClick:m,disabled:g,children:[x,b]}),e[5]=l.isPending,e[6]=m,e[7]=b,e[8]=v):v=e[8];const L=v,_=En,y=En,w=En;let S;e[9]!==n?(S=n("automations.automationsList.title"),e[9]=n,e[10]=S):S=e[10];let k;e[11]!==S?(k=o.jsx(En.Title,{children:S}),e[11]=S,e[12]=k):k=e[12];const j=a.length>0&&o.jsx(b9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let C;e[13]!==L||e[14]!==j?(C=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,L]}),e[13]=L,e[14]=j,e[15]=C):C=e[15];let V;e[16]!==k||e[17]!==C?(V=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=V):V=e[18];const N=a.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ti,{image:o.jsx(hr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:L})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ti,{image:o.jsx(hr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(E=>o.jsx(qE,{automation:E,onClick:()=>p(E.id)},E.id))});let A;e[19]!==V||e[20]!==N||e[21]!==w.Body?(A=o.jsxs(w.Body,{children:[V,N]}),e[19]=V,e[20]=N,e[21]=w.Body,e[22]=A):A=e[22];let P;e[23]!==A||e[24]!==y.Content?(P=o.jsx(y.Content,{children:A}),e[23]=A,e[24]=y.Content,e[25]=P):P=e[25];let R;return e[26]!==_||e[27]!==P?(R=o.jsx(_,{children:P}),e[26]=_,e[27]=P,e[28]=R):R=e[28],R}function ude(t){const e=F.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Aa,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(T.Suspense,{fallback:n,children:o.jsx(dde,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function hde(t){const e=F.c(60),{file:s,onClose:n}=t,i=ae();let r,a;e[0]!==s.filename?(r=o.jsx(Xo,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),a=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let l;e[3]!==s.size?(l=X8(s.size),e[3]=s.size,e[4]=l):l=e[4];let c;e[5]!==l?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:l}),e[5]=l,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==a||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,a,c]}),e[7]=r,e[8]=a,e[9]=c,e[10]=d):d=e[10];let h;e[11]!==i?(h=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=h):h=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Cu,{size:14}),e[13]=u):u=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:u}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let p;e[17]!==h||e[18]!==f?(p=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":h,asChild:!0,children:f})}),e[17]=h,e[18]=f,e[19]=p):p=e[19];let m;e[20]!==i?(m=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=m):m=e[21];let g;e[22]!==m?(g=o.jsx(Ke,{side:"bottom",children:m}),e[22]=m,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==p?(x=o.jsxs(We,{children:[p,g]}),e[24]=g,e[25]=p,e[26]=x):x=e[26];let b;e[27]!==i?(b=i("mainPanelTabs.fileTab.openInNewTab"),e[27]=i,e[28]=b):b=e[28];let v;e[29]!==s.downloadUrl?(v=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=v):v=e[30];let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(hn,{size:14}),e[31]=L):L=e[31];let _;e[32]!==b||e[33]!==v?(_=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:L})}),e[32]=b,e[33]=v,e[34]=_):_=e[34];let y;e[35]!==i?(y=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=y):y=e[36];let w;e[37]!==y?(w=o.jsx(Ke,{side:"bottom",children:y}),e[37]=y,e[38]=w):w=e[38];let S;e[39]!==_||e[40]!==w?(S=o.jsxs(We,{children:[_,w]}),e[39]=_,e[40]=w,e[41]=S):S=e[41];let k;e[42]!==i?(k=i("mainPanelTabs.fileTab.close"),e[42]=i,e[43]=k):k=e[43];let j;e[44]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(ii,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let V;e[48]!==i?(V=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=V):V=e[49];let N;e[50]!==V?(N=o.jsx(Ke,{side:"bottom",children:V}),e[50]=V,e[51]=N):N=e[51];let A;e[52]!==C||e[53]!==N?(A=o.jsxs(We,{children:[C,N]}),e[52]=C,e[53]=N,e[54]=A):A=e[54];let P;return e[55]!==x||e[56]!==S||e[57]!==A||e[58]!==d?(P=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,S,A]}),e[55]=x,e[56]=S,e[57]=A,e[58]=d,e[59]=P):P=e[59],P}function fde(t){const e=F.c(31),{fileKey:s,taskId:n}=t,i=ae(),{closePanel:r}=Di(),{data:a,isPending:l}=D6(n);let c;e[0]!==s||e[1]!==a?(c=a?.find(g=>g.key===s)??null,e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=c;let h;e[3]!==r?(h=()=>r(),e[3]=r,e[4]=h):h=e[4];const u=h;if(!d){if(l){let w;return e[5]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(Y8,{})}),e[5]=w):w=e[5],w}let g;e[6]!==s?(g=s.split("/").pop()??s,e[6]=s,e[7]=g):g=e[7];let x;e[8]!==g?(x=o.jsx(Xo,{filename:g,className:"h-7.5 w-6"}),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==i?(b=i("mainPanelTabs.fileTab.fileNotAvailable"),e[10]=i,e[11]=b):b=e[11];let v;e[12]!==b?(v=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=v):v=e[13];let L;e[14]!==i?(L=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=L):L=e[15];let _;e[16]!==u||e[17]!==L?(_=o.jsx(me,{variant:"ghost",size:"sm",onClick:u,children:L}),e[16]=u,e[17]=L,e[18]=_):_=e[18];let y;return e[19]!==x||e[20]!==v||e[21]!==_?(y=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,v,_]}),e[19]=x,e[20]=v,e[21]=_,e[22]=y):y=e[22],y}let f;e[23]!==d||e[24]!==u?(f=o.jsx(hde,{file:d,onClose:u}),e[23]=d,e[24]=u,e[25]=f):f=e[25];let p;e[26]!==d?(p=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(Q8,{file:d})}),e[26]=d,e[27]=p):p=e[27];let m;return e[28]!==f||e[29]!==p?(m=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,p]}),e[28]=f,e[29]=p,e[30]=m):m=e[30],m}function mde(t){const e=F.c(7),{onClose:s}=t,n=ae();let i;e[0]!==n?(i=n("routes.commerceOnboarding.connectModal.loadError"),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==i?(r=o.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e[2]=i,e[3]=r):r=e[3];let a;return e[4]!==s||e[5]!==r?(a=o.jsx(Tg,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=a):a=e[6],a}function pde(){const t=F.c(10),{closePanel:e}=Di();let s;t[0]!==e?(s=()=>e(),t[0]=e,t[1]=s):s=t[1];const n=s;let i;t[2]!==n?(i=()=>o.jsx(mde,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ME,{}),t[4]=r):r=t[4];let a;t[5]!==n?(a=o.jsx(T.Suspense,{fallback:o.jsx(Tg,{onClose:n,footer:null,children:r}),children:o.jsx(gde,{onDone:n,onClose:n})}),t[5]=n,t[6]=a):a=t[6];let l;return t[7]!==i||t[8]!==a?(l=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(tn,{fallback:i,children:a})}),t[7]=i,t[8]=a,t[9]=l):l=t[9],l}function gde(t){const e=F.c(46),{onDone:s,onClose:n}=t,i=ae(),{org:r}=Ue();let a;e[0]!==r.id?(a=Kd.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=a):a=e[1];const l=a;let c;e[2]!==r.id||e[3]!==r.slug?(c={connectionId:Xu,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=Cn(c);let h;e[5]!==l||e[6]!==r||e[7]!==d?(h={selfClient:d,org:r,cdConnectionId:l},e[5]=l,e[6]=r,e[7]=d,e[8]=h):h=e[8];const u=IE(h),[f,p]=T.useState(!1),[m,g]=T.useState(null);let x;e[9]!==d?(x={mutationFn:async P=>_7(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:P}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Ds(x);let v;e[11]!==s||e[12]!==b||e[13]!==u||e[14]!==i?(v=async()=>{if(g(null),u)try{await b.mutateAsync(u)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=u,e[14]=i,e[15]=v):v=e[15];const L=v;let _;e[16]!==m?(_=m?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:m}):null,e[16]=m,e[17]=_):_=e[17];let y;e[18]!==b.isPending||e[19]!==i?(y=b.isPending?i("routes.commerceOnboarding.connectSourcesTab.refreshing"):i("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=i,e[20]=y):y=e[20];let w;e[21]!==L?(w=()=>{L()},e[21]=L,e[22]=w):w=e[22];let S;e[23]!==f||e[24]!==b.isPending||e[25]!==y||e[26]!==w?(S=o.jsx(kE,{ready:f,pending:b.isPending,label:y,onClick:w}),e[23]=f,e[24]=b.isPending,e[25]=y,e[26]=w,e[27]=S):S=e[27];let k;e[28]!==_||e[29]!==S?(k=o.jsxs(o.Fragment,{children:[_,S]}),e[28]=_,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==i?(j=i("routes.commerceOnboarding.connectSourcesTab.title"),e[31]=i,e[32]=j):j=e[32];let C;e[33]!==j?(C=o.jsx("h2",{className:"text-xl font-medium leading-tight text-foreground",children:j}),e[33]=j,e[34]=C):C=e[34];let V;e[35]!==l||e[36]!==r||e[37]!==u?(V=o.jsx(OE,{org:r,cdConnectionId:l,siteUrl:u,onReadinessChange:p}),e[35]=l,e[36]=r,e[37]=u,e[38]=V):V=e[38];let N;e[39]!==C||e[40]!==V?(N=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,V]}),e[39]=C,e[40]=V,e[41]=N):N=e[41];let A;return e[42]!==n||e[43]!==k||e[44]!==N?(A=o.jsx(Tg,{onClose:n,footer:k,children:N}),e[42]=n,e[43]=k,e[44]=N,e[45]=A):A=e[45],A}const xde=T.lazy(()=>Ws(()=>import("./project-app-view-BxEzaMDJ.js"),__vite__mapDeps([185,1,2,81,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,82,83,84,10,11,18,85,86,87,88,89,90,91,92,93,94,95,96,23,4,5,9,12,13,14,15,16,3,6,7,8,17,19,20,21,22,27,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,146,160,121,122,123,161,156,130,131,162,116,117,73,118,119,120,124,125,126,127,128,129,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,147,148,149,150,72,151,152,79,153,154,155,157,158,159,163,164,76,165,166,167])).then(t=>({default:t.AppViewContent})));function bde(){const t=F.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:i}=b7();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Aa,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Aa,{}),t[1]=d):d=t[1];let h;return t[2]!==i?(h=o.jsx(T.Suspense,{fallback:d,children:o.jsx(xde,{connectionId:i,toolName:CT})}),t[2]=i,t[3]=h):h=t[3],h}let r;t[4]!==n?(r=()=>o.jsx(Dj,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Aa,{}),t[6]=a):a=t[6];let l;t[7]!==n?(l=o.jsx(T.Suspense,{fallback:a,children:o.jsx(yde,{claimedSiteUrl:n})}),t[7]=n,t[8]=l):l=t[8];let c;return t[9]!==r||t[10]!==l?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(tn,{fallback:r,children:l})}),t[9]=r,t[10]=l,t[11]=c):c=t[11],c}const vde=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Dj(t){const e=F.c(27),{claimedSiteUrl:s,children:n}=t,i=ae(),r=s??void 0;let a;e[0]!==r?(a=Gm(r),e[0]=r,e[1]=a):a=e[1];const l=a;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsxs("div",{className:"relative flex items-end justify-center pt-4",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute -bottom-6 size-56 rounded-full bg-success/10 blur-3xl"}),o.jsx(op,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(op,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==i?(d=i("reports.emptyState.title"),e[3]=i,e[4]=d):d=e[4];let h;e[5]!==d?(h=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=h):h=e[6];let u;e[7]!==i?(u=i("reports.emptyState.description"),e[7]=i,e[8]=u):u=e[8];let f;e[9]!==u?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:u}),e[9]=u,e[10]=f):f=e[10];let p;e[11]!==h||e[12]!==f?(p=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[h,f]}),e[11]=h,e[12]=f,e[13]=p):p=e[13];let m;e[14]!==n||e[15]!==l?(m=n??(l?o.jsx("p",{className:"text-sm text-muted-foreground",children:l}):null),e[14]=n,e[15]=l,e[16]=m):m=e[16];let g;e[17]!==i?(g=vde.map(L=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:i(L)},L)),e[17]=i,e[18]=g):g=e[18];let x;e[19]!==g?(x=o.jsx("ul",{className:"flex flex-wrap items-center justify-center gap-2",children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==x||e[22]!==m?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[m,x]}),e[21]=x,e[22]=m,e[23]=b):b=e[23];let v;return e[24]!==b||e[25]!==p?(v=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,p,b]}),e[24]=b,e[25]=p,e[26]=v):v=e[26],v}function yde(t){const e=F.c(46),{claimedSiteUrl:s}=t,n=ae(),i=Ks(),{org:r}=Ue();let a;e[0]!==r.id||e[1]!==r.slug?(a={connectionId:Xu,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=a):a=e[2];const l=Cn(a);let c;e[3]!==s?(c=Gm(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,h]=T.useState(c),[u,f]=T.useState(null);let p;e[5]!==l?(p={mutationFn:async R=>_7(await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:R}})),retry:!1},e[5]=l,e[6]=p):p=e[6];const m=Ds(p);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==m?(g=async R=>{const E=$E(R);if(!E.ok){f(E.error);return}f(null);const I=Gm(E.value)??void 0;qe("reports_start_diagnostic_submitted",{organization_id:r.id,domain:I});try{await m.mutateAsync(E.value)}catch(D){const O=D;qe("reports_start_diagnostic_failed",{organization_id:r.id,domain:I,error:O instanceof Error?O.message:String(O)}),f(O instanceof Error?O.message:"__configurationFailed");return}i({to:Ca.agents,params:{org:r.slug,panel:void 0},search:{virtualmcpid:ra(r.id).id,connect:"1",siteUrl:E.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=m,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=R=>{R.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const v=b;let L;e[15]!==n?(L=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=L):L=e[16];let _;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=R=>h(R.target.value),e[17]=_):_=e[17];let y;e[18]!==n?(y=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=y):y=e[19];const w=!!u;let S;e[20]!==m.isPending||e[21]!==d||e[22]!==L||e[23]!==y||e[24]!==w?(S=o.jsx(vt,{"aria-label":L,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:_,placeholder:y,"aria-invalid":w,disabled:m.isPending}),e[20]=m.isPending,e[21]=d,e[22]=L,e[23]=y,e[24]=w,e[25]=S):S=e[25];let k;e[26]!==m.isPending||e[27]!==n?(k=m.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=m.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(gr,{size:16}),e[29]=j):j=e[29];let C;e[30]!==m.isPending||e[31]!==k?(C=o.jsxs(me,{type:"submit",className:"shrink-0",disabled:m.isPending,children:[k,j]}),e[30]=m.isPending,e[31]=k,e[32]=C):C=e[32];let V;e[33]!==S||e[34]!==C?(V=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[S,C]}),e[33]=S,e[34]=C,e[35]=V):V=e[35];let N;e[36]!==u||e[37]!==n?(N=u?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:GE(n,u)}):null,e[36]=u,e[37]=n,e[38]=N):N=e[38];let A;e[39]!==v||e[40]!==V||e[41]!==N?(A=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:v,children:[V,N]}),e[39]=v,e[40]=V,e[41]=N,e[42]=A):A=e[42];let P;return e[43]!==s||e[44]!==A?(P=o.jsx(Dj,{claimedSiteUrl:s,children:A}),e[43]=s,e[44]=A,e[45]=P):P=e[45],P}function _de(t){return[Kd.SELF(t),Kd.REGISTRY(t),Kd.COMMUNITY_REGISTRY(t),Kd.DEV_ASSETS(t)]}function Lde(t,e){const s=new Set(_de(e));return t.some(n=>!s.has(n.id))}function wde(){const t=F.c(78),e=ae(),{org:s}=Ue(),n=dr();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"mcp-github"},t[0]=i):i=t[0];const r=dr(i),{projects:a}=r0(),l=bg();let c;t[1]!==s.slug?(c={org:s.slug},t[1]=s.slug,t[2]=c):c=t[2];const d=c;let h;t[3]!==e?(h=e("discover.setup.connectTitle"),t[3]=e,t[4]=h):h=t[4];let u;t[5]!==e?(u=e("discover.setup.connectBody"),t[5]=e,t[6]=u):u=t[6];let f;t[7]!==n||t[8]!==s.id?(f=Lde(n,s.id),t[7]=n,t[8]=s.id,t[9]=f):f=t[9];let p;t[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Ia,{size:18}),t[10]=p):p=t[10];let m;t[11]===Symbol.for("react.memo_cache_sentinel")?(m={tab:"all"},t[11]=m):m=t[11];let g;t[12]!==e?(g=e("discover.setup.connectAction"),t[12]=e,t[13]=g):g=t[13];let x;t[14]!==d||t[15]!==g?(x=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Io,{to:"/$org/settings/connections",params:d,search:m,children:g})}),t[14]=d,t[15]=g,t[16]=x):x=t[16];let b;t[17]!==h||t[18]!==u||t[19]!==f||t[20]!==x?(b={key:"connect",title:h,body:u,done:f,icon:p,action:x},t[17]=h,t[18]=u,t[19]=f,t[20]=x,t[21]=b):b=t[21];let v;t[22]!==e?(v=e("discover.setup.githubTitle"),t[22]=e,t[23]=v):v=t[23];let L;t[24]!==e?(L=e("discover.setup.githubBody"),t[24]=e,t[25]=L):L=t[25];const _=r.length>0;let y;t[26]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ur,{className:"size-[18px]"}),t[26]=y):y=t[26];let w;t[27]===Symbol.for("react.memo_cache_sentinel")?(w={tab:"all"},t[27]=w):w=t[27];let S;t[28]!==e?(S=e("discover.setup.githubAction"),t[28]=e,t[29]=S):S=t[29];let k;t[30]!==d||t[31]!==S?(k=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Io,{to:"/$org/settings/connections",params:d,search:w,children:S})}),t[30]=d,t[31]=S,t[32]=k):k=t[32];let j;t[33]!==v||t[34]!==L||t[35]!==_||t[36]!==k?(j={key:"github",title:v,body:L,done:_,icon:y,action:k},t[33]=v,t[34]=L,t[35]=_,t[36]=k,t[37]=j):j=t[37];let C;t[38]!==e?(C=e("discover.setup.projectTitle"),t[38]=e,t[39]=C):C=t[39];let V;t[40]!==e?(V=e("discover.setup.projectBody"),t[40]=e,t[41]=V):V=t[41];const N=a.length>0;let A;t[42]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(Qt,{size:18}),t[42]=A):A=t[42];let P;t[43]!==s.slug?(P={org:s.slug,panel:void 0},t[43]=s.slug,t[44]=P):P=t[44];let R;t[45]===Symbol.for("react.memo_cache_sentinel")?(R={virtualmcpid:void 0},t[45]=R):R=t[45];let E;t[46]!==e?(E=e("discover.setup.projectAction"),t[46]=e,t[47]=E):E=t[47];let I;t[48]!==P||t[49]!==E?(I=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Io,{to:Ca.agents,params:P,search:R,children:E})}),t[48]=P,t[49]=E,t[50]=I):I=t[50];let D;t[51]!==C||t[52]!==V||t[53]!==N||t[54]!==I?(D={key:"project",title:C,body:V,done:N,icon:A,action:I},t[51]=C,t[52]=V,t[53]=N,t[54]=I,t[55]=D):D=t[55];let O;t[56]!==e?(O=e("discover.setup.inviteTitle"),t[56]=e,t[57]=O):O=t[57];let B;t[58]!==e?(B=e("discover.setup.inviteBody"),t[58]=e,t[59]=B):B=t[59];let M;t[60]!==l.data?.data?.members?(M=l.data?.data?.members??[],t[60]=l.data?.data?.members,t[61]=M):M=t[61];const z=M.length>1;let $;t[62]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(v9,{size:18}),t[62]=$):$=t[62];let U;t[63]!==e?(U=e("discover.setup.inviteAction"),t[63]=e,t[64]=U):U=t[64];let H;t[65]!==d||t[66]!==U?(H=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Io,{to:"/$org/settings/members",params:d,children:U})}),t[65]=d,t[66]=U,t[67]=H):H=t[67];let W;t[68]!==O||t[69]!==B||t[70]!==z||t[71]!==H?(W={key:"invite",title:O,body:B,done:z,icon:$,action:H},t[68]=O,t[69]=B,t[70]=z,t[71]=H,t[72]=W):W=t[72];let K;return t[73]!==j||t[74]!==D||t[75]!==W||t[76]!==b?(K=[b,j,D,W],t[73]=j,t[74]=D,t[75]=W,t[76]=b,t[77]=K):K=t[77],K}function Sde(){const t=F.c(51),e=ae(),{projects:s}=r0();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={slug:"mcp-github"},t[0]=n):n=t[0];const i=dr(n),r=Eg();let a;t[1]!==s?(a=s.some(jde),t[1]=s,t[2]=a):a=t[2];const l=a;let c;t[3]!==s?(c=s.some(kde),t[3]=s,t[4]=c):c=t[4];const d=c;let h;if(t[5]!==r||t[6]!==s){let P;t[8]!==r?(P=R=>h9(r.data?.configs??[],S7(R)),t[8]=r,t[9]=P):P=t[9],h=s.some(P),t[5]=r,t[6]=s,t[7]=h}else h=t[7];const u=h;let f;t[10]!==e?(f=e("discover.capabilities.previewTitle"),t[10]=e,t[11]=f):f=t[11];let p;t[12]!==e?(p=e("discover.capabilities.previewRequirement"),t[12]=e,t[13]=p):p=t[13];let m;t[14]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Ai,{size:18}),t[14]=m):m=t[14];let g;t[15]!==l||t[16]!==f||t[17]!==p?(g={key:"preview",title:f,requirement:p,satisfied:l,icon:m},t[15]=l,t[16]=f,t[17]=p,t[18]=g):g=t[18];let x;t[19]!==e?(x=e("discover.capabilities.gitTitle"),t[19]=e,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("discover.capabilities.gitRequirement"),t[21]=e,t[22]=b):b=t[22];const v=i.length>0&&l;let L;t[23]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(ur,{className:"size-[18px]"}),t[23]=L):L=t[23];let _;t[24]!==v||t[25]!==x||t[26]!==b?(_={key:"git",title:x,requirement:b,satisfied:v,icon:L},t[24]=v,t[25]=x,t[26]=b,t[27]=_):_=t[27];let y;t[28]!==e?(y=e("discover.capabilities.contentTitle"),t[28]=e,t[29]=y):y=t[29];let w;t[30]!==e?(w=e("discover.capabilities.contentRequirement"),t[30]=e,t[31]=w):w=t[31];let S;t[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ai,{size:18}),t[32]=S):S=t[32];let k;t[33]!==d||t[34]!==y||t[35]!==w?(k={key:"content",title:y,requirement:w,satisfied:d,icon:S},t[33]=d,t[34]=y,t[35]=w,t[36]=k):k=t[36];let j;t[37]!==e?(j=e("discover.capabilities.assetsTitle"),t[37]=e,t[38]=j):j=t[38];let C;t[39]!==e?(C=e("discover.capabilities.assetsRequirement"),t[39]=e,t[40]=C):C=t[40];let V;t[41]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(ni,{size:18}),t[41]=V):V=t[41];let N;t[42]!==u||t[43]!==j||t[44]!==C?(N={key:"assets",title:j,requirement:C,satisfied:u,icon:V},t[42]=u,t[43]=j,t[44]=C,t[45]=N):N=t[45];let A;return t[46]!==_||t[47]!==k||t[48]!==N||t[49]!==g?(A=[g,_,k,N],t[46]=_,t[47]=k,t[48]=N,t[49]=g,t[50]=A):A=t[50],A}function kde(t){return!!aa(t)&&p0(t.metadata?.ui?.layout)!=="off"}function jde(t){return aa(t)}function lm(t){const e=F.c(10),{title:s,description:n,children:i}=t;let r;e[0]!==s?(r=o.jsx("h2",{className:"text-base font-semibold text-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==n?(a=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==r||e[5]!==a?(l=o.jsxs("div",{className:"flex flex-col gap-1",children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6];let c;return e[7]!==i||e[8]!==l?(c=o.jsxs("section",{className:"flex flex-col gap-3",children:[l,i]}),e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function Cde(){const t=F.c(63),e=ae(),{org:s}=Ue(),n=wde(),i=Sde();let r;t[0]!==n?(r=n.filter(Tde),t[0]=n,t[1]=r):r=t[1];const a=r;let l;t[2]!==e?(l=e("discover.title"),t[2]=e,t[3]=l):l=t[3];let c;t[4]!==l?(c=o.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:l}),t[4]=l,t[5]=c):c=t[5];let d;t[6]!==e?(d=e("discover.subtitle"),t[6]=e,t[7]=d):d=t[7];let h;t[8]!==d?(h=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:d}),t[8]=d,t[9]=h):h=t[9];let u;t[10]!==c||t[11]!==h?(u=o.jsxs("header",{className:"flex flex-col gap-2",children:[c,h]}),t[10]=c,t[11]=h,t[12]=u):u=t[12];let f;t[13]!==e?(f=e("discover.setup.title"),t[13]=e,t[14]=f):f=t[14];let p;t[15]!==a.length||t[16]!==e?(p=a.length===0?e("discover.setup.allDone"):e("discover.setup.description"),t[15]=a.length,t[16]=e,t[17]=p):p=t[17];let m;t[18]!==n?(m=n.map(Vde),t[18]=n,t[19]=m):m=t[19];let g;t[20]!==m?(g=o.jsx("ul",{className:"flex flex-col gap-2",children:m}),t[20]=m,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==p||t[24]!==g?(x=o.jsx(lm,{title:f,description:p,children:g}),t[22]=f,t[23]=p,t[24]=g,t[25]=x):x=t[25];let b;t[26]!==e?(b=e("discover.capabilities.title"),t[26]=e,t[27]=b):b=t[27];let v;t[28]!==e?(v=e("discover.capabilities.description"),t[28]=e,t[29]=v):v=t[29];let L;if(t[30]!==i||t[31]!==e){let R;t[33]!==e?(R=E=>o.jsxs("li",{className:"flex items-start gap-3 rounded-xl border border-border bg-card p-4",children:[o.jsx("span",{className:re("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",E.satisfied?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:E.satisfied?o.jsx(Gt,{size:18}):E.icon}),o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:E.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:E.satisfied?e("discover.capabilities.ready"):E.requirement})]})]},E.key),t[33]=e,t[34]=R):R=t[34],L=i.map(R),t[30]=i,t[31]=e,t[32]=L}else L=t[32];let _;t[35]!==L?(_=o.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:L}),t[35]=L,t[36]=_):_=t[36];let y;t[37]!==b||t[38]!==v||t[39]!==_?(y=o.jsx(lm,{title:b,description:v,children:_}),t[37]=b,t[38]=v,t[39]=_,t[40]=y):y=t[40];let w;t[41]!==e?(w=e("discover.catalog.title"),t[41]=e,t[42]=w):w=t[42];let S;t[43]!==e?(S=e("discover.catalog.description"),t[43]=e,t[44]=S):S=t[44];let k;t[45]!==s.slug?(k={org:s.slug},t[45]=s.slug,t[46]=k):k=t[46];let j;t[47]===Symbol.for("react.memo_cache_sentinel")?(j={tab:"all"},t[47]=j):j=t[47];let C;t[48]!==e?(C=e("discover.catalog.action"),t[48]=e,t[49]=C):C=t[49];let V;t[50]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(gr,{size:18}),t[50]=V):V=t[50];let N;t[51]!==k||t[52]!==C?(N=o.jsx("div",{children:o.jsx(me,{asChild:!0,size:"lg",children:o.jsxs(Io,{to:"/$org/settings/connections",params:k,search:j,onClick:Nde,children:[C,V]})})}),t[51]=k,t[52]=C,t[53]=N):N=t[53];let A;t[54]!==w||t[55]!==S||t[56]!==N?(A=o.jsx(lm,{title:w,description:S,children:N}),t[54]=w,t[55]=S,t[56]=N,t[57]=A):A=t[57];let P;return t[58]!==x||t[59]!==y||t[60]!==A||t[61]!==u?(P=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-10 p-6 md:p-10",children:[u,x,y,A]})}),t[58]=x,t[59]=y,t[60]=A,t[61]=u,t[62]=P):P=t[62],P}function Nde(){return qe("discover_catalog_opened",{})}function Vde(t){return o.jsxs("li",{className:re("flex items-start gap-3 rounded-xl border border-border bg-card p-4",t.done&&"opacity-60"),children:[o.jsx("span",{className:re("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",t.done?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.done?o.jsx(Gt,{size:18}):t.icon}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:t.body})]}),!t.done&&o.jsx("div",{className:"shrink-0",children:t.action})]},t.key)}function Tde(t){return!t.done}function Ade(t){const e=F.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,a=ae();let l;e[0]!==s?(l=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]!==n||e[3]!==a?(d=n.deckDetected&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?a("deck.deckToolbar.hideSlideList"):a("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(b6,{size:14})})}),o.jsx(Ke,{side:"bottom",children:n.railOpen?a("deck.deckToolbar.hideSlideList"):a("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=a,e[4]=d):d=e[4];let h;e[5]!==c?(h=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=h):h=e[6];let u;e[7]!==c?(u=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=u):u=e[8];let f;e[9]!==c||e[10]!==h||e[11]!==u?(f=o.jsx("button",{type:"button",onClick:h,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:u}),e[9]=c,e[10]=h,e[11]=u,e[12]=f):f=e[12];let p;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==a?(p=n.agentUpdated&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(Dn,{size:12}),a("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(Ke,{side:"bottom",children:a("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=a,e[16]=p):p=e[16];let m;e[17]!==n.saving||e[18]!==a?(m=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:a("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=a,e[19]=m):m=e[19];let g;e[20]!==n||e[21]!==a?(g=n.deckDetected&&n.writable&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?a("deck.deckToolbar.doneEditing"):a("deck.deckToolbar.editInline"),className:re(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(a8,{size:14})})}),o.jsx(Ke,{side:"bottom",children:n.editMode?a("deck.deckToolbar.doneEditing"):a("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=a,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==i||e[25]!==n.deckDetected||e[26]!==a?(x=n.deckDetected?o.jsxs(Ot,{children:[o.jsx($t,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":a("deck.deckToolbar.download"),children:o.jsx(Cu,{size:14})})}),o.jsxs(Bt,{align:"end",children:[o.jsxs(Qe,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(LA,{size:14}),a("deck.deckToolbar.exportAsPdf")]}),o.jsx(Qe,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(l9,{size:14}),a("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":a("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx(Cu,{size:14})})})}),o.jsx(Ke,{side:"bottom",children:a("deck.deckToolbar.download")})]}),e[23]=c,e[24]=i,e[25]=n.deckDetected,e[26]=a,e[27]=x):x=e[27];let b;e[28]!==a?(b=a("deck.deckToolbar.openInNewTab"),e[28]=a,e[29]=b):b=e[29];let v;e[30]!==c?(v=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=v):v=e[31];let L;e[32]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(hn,{size:14}),e[32]=L):L=e[32];let _;e[33]!==b||e[34]!==v?(_=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:L})}),e[33]=b,e[34]=v,e[35]=_):_=e[35];let y;e[36]!==a?(y=a("deck.deckToolbar.openInNewTab"),e[36]=a,e[37]=y):y=e[37];let w;e[38]!==y?(w=o.jsx(Ke,{side:"bottom",children:y}),e[38]=y,e[39]=w):w=e[39];let S;e[40]!==_||e[41]!==w?(S=o.jsxs(We,{children:[_,w]}),e[40]=_,e[41]=w,e[42]=S):S=e[42];let k;return e[43]!==S||e[44]!==d||e[45]!==f||e[46]!==p||e[47]!==m||e[48]!==g||e[49]!==x||e[50]!==r?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,f,p,m,g,x,S,r]}),e[43]=S,e[44]=d,e[45]=f,e[46]=p,e[47]=m,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const Nc=1;function Pde(t){if(typeof t!="object"||t===null||t.v!==Nc||t.source!=="deck-viewer")return null;const e=t;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class Po extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function Mj(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Ede(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?Mj(s).length:null}function Rde(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new Po("no <deck-viewer> element in source","no-viewer");const i=Mj(n),r=e.kind==="move"?e.from:e.at,a=i[r];if(!a)throw new Po(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new Po("cannot remove the last slide","bad-op");a.remove();break}case"duplicate":{const c=a.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");a.after(c);break}case"move":{if(e.to<0||e.to>=i.length)throw new Po(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?i[e.to]:i[e.to].nextSibling;n.insertBefore(a,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new Po(`invalid attribute name: ${e.name}`,"bad-op");a.setAttribute(e.name,e.value);break}case"remove-attr":{a.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new Po("replace html has no root element","bad-op");a.replaceWith(s.importNode(d,!0));break}default:throw new Po(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
653
+ `);if(oe.trim()){R(!0);try{X(),qe("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:oe.length}),p(),await m({tiptapDoc:lL({managerAgentId:jT.AUTOMATION_MANAGER(a.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:oe})})}finally{R(!1)}}},M=e.models?.tier??"smart",z=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,$=T2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:z,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=$.watch("active"),[H,W]=T.useReducer(nde,null),K=()=>{H!==null&&(qe("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(H.fields),save_count:H.saveCount,edit_duration_ms:Date.now()-H.start}),W({type:"reset"}))},G=async()=>{const Q=$.control._formState.dirtyFields,oe=Object.keys(Q);if(oe.length===0&&!D)return!0;const le=$.getValues(),de=$.control._defaultValues;$.reset(le,{keepValues:!0});const se=D;O(!1);const ie={tier:le.tier,...le.modelOverride?{modelId:le.modelOverride.modelId,credentialId:le.modelOverride.credentialId,modelTitle:le.modelOverride.title}:{}},he={id:t,name:le.name,active:le.active,models:ie,tools:le.tools,maxAgentSteps:le.maxAgentSteps,messages:SV(x),temperature:0};try{await l.mutateAsync(he)}catch{return $.reset(de,{keepValues:!0}),se&&O(!0),!1}const ue=[...oe];return se&&ue.push("messages"),W({type:"accumulate",now:Date.now(),fields:ue}),te(),!0},{schedule:Y,flush:Z}=Jh({save:G}),{schedule:te,flush:X}=Jh({delayMs:3e4,save:async()=>K()});T.useEffect(()=>{const Q=$.watch(()=>Y());return()=>Q.unsubscribe()},[]);const ee=Q=>{if(b(Q),!E){I(!0);return}O(!0),Y()},J=async()=>{qe("automation_test_clicked",{automation_id:t,agent_id:r});const Q=await Z();if(X(),!!Q){if(!x){ye.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const oe=await d.mutateAsync(t);oe.threadId&&(p(),f(oe.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(me,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(c9,{size:14}),i("automations.automationDetail.backToList")]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(Ls,{control:$.control,name:"name",render:({field:Q})=>o.jsx(vt,{...Q,placeholder:i("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(me,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(rn,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ls,{control:$.control,name:"active",render:({field:Q})=>o.jsx(lo,{checked:Q.value,onCheckedChange:oe=>{Q.onChange(oe),Z()},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i(U?"automations.automationDetail.active":"automations.automationDetail.inactive")}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(cL,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.starter")}),o.jsx(Yce,{automationId:t,open:v,onOpenChange:L,onCustomSelect:()=>{S(!0),V(!1),j("")},onEventSelect:()=>{V(!0),S(!1)},onWebhookCreated:Q=>{qe("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),A(Q)}})]}),e.triggers.length===0&&!w?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[i("automations.automationDetail.whenShouldRun")," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>L(!0),children:i("automations.automationDetail.addStarter")})," ",i("automations.automationDetail.toGetGoing")]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Q=>o.jsx(Qce,{trigger:Q,automationId:t,connectionName:Q.connection_id?u.get(Q.connection_id):void 0},Q.id))}),w&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(au,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:k,onChange:Q=>j(Q.target.value),onBlur:async()=>{const Q=k.trim();if(!(!Q||!vu(Q)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:Q}),qe("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ye.success(i("automations.automationDetail.starterAdded")),S(!1),j("")}catch{ye.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async Q=>{const oe=k.trim();Q.key==="Enter"&&oe&&vu(oe)&&Q.target.blur(),Q.key==="Escape"&&(S(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!vu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(et,{className:"size-[13px] text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{S(!1),j("")},children:o.jsx(ii,{size:13})})]}),C&&o.jsx(T.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(et,{className:"size-[13px] text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(Jce,{automationId:t,onDone:()=>V(!1)})}),o.jsx(Pj,{open:N!==null,onOpenChange:Q=>{Q||A(null)},url:N?.url??null,token:N?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.instructions")}),o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:P||!x,onClick:B,children:[o.jsx(Fr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(w_,{tiptapDoc:x,setTiptapDoc:ee,placeholder:i("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(S_,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:J,disabled:!r,children:[o.jsx(Gf,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(Ke,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(z2,{open:_,onOpenChange:y,className:"flex flex-col gap-2.5",children:[o.jsxs($2,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.advanced")}),o.jsx(hs,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(B2,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(Ece,{tier:$.watch("tier"),onTierChange:Q=>$.setValue("tier",Q,{shouldDirty:!0}),override:$.watch("modelOverride"),onOverrideChange:Q=>$.setValue("modelOverride",Q,{shouldDirty:!0})}),o.jsx(Ice,{agentId:r||null,value:$.watch("tools"),onChange:Q=>$.setValue("tools",Q,{shouldDirty:!0})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.maxSteps")}),o.jsx(vt,{type:"number",min:1,max:100,className:"w-40",placeholder:i("automations.automationDetail.maxStepsPlaceholder",{default:sde}),value:$.watch("maxAgentSteps")??"",onChange:Q=>{const oe=Q.target.value.trim(),le=oe===""?null:Number(oe);$.setValue("maxAgentSteps",le===null||Number.isNaN(le)?null:le,{shouldDirty:!0})}})]})]})]})]})]})}const Ej=[{key:"24h",labelKey:"mainPanelTabs.automationTab.last24hours",ms:1440*60*1e3},{key:"7d",labelKey:"mainPanelTabs.automationTab.last7days",ms:10080*60*1e3},{key:"30d",labelKey:"mainPanelTabs.automationTab.last30days",ms:720*60*60*1e3}];function Rj(t){const e=Ej.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function rde(t){const e=F.c(16),{automationId:s,triggerIds:n}=t,i=ae(),[r,a]=T.useState("30d"),[l,c]=T.useState(ode);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;a(b),c(Rj(b))},e[0]=d):d=e[0];let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(bs,{className:"w-44",children:o.jsx(Ss,{})}),e[1]=h):h=e[1];let u;e[2]!==i?(u=Ej.map(x=>o.jsx(Rt,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=u):u=e[3];let f;e[4]!==u?(f=o.jsx(vs,{children:u}),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==f||e[7]!==r?(p=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(xs,{value:r,onValueChange:d,children:[h,f]})}),e[6]=f,e[7]=r,e[8]=p):p=e[8];let m;e[9]!==s||e[10]!==l||e[11]!==n?(m=o.jsx(mT,{automationId:s,triggerIds:n,range:l}),e[9]=s,e[10]=l,e[11]=n,e[12]=m):m=e[12];let g;return e[13]!==p||e[14]!==m?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[p,m]}),e[13]=p,e[14]=m,e[15]=g):g=e[15],g}function ode(){return Rj("30d")}function ade(t){const e=F.c(5),{tabId:s}=t;let n;e[0]!==s?(n=m6(s),e[0]=s,e[1]=n):n=e[1];const i=n;if(!i)return null;let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Aa,{}),e[2]=r):r=e[2];let a;return e[3]!==i.id?(a=o.jsx(T.Suspense,{fallback:r,children:o.jsx(lde,{id:i.id})}),e[3]=i.id,e[4]=a):a=e[4],a}function lde(t){const e=F.c(41),{id:s}=t,n=ae(),{openPanel:i}=Di(),{data:r,isLoading:a}=HE(s),[l,c]=T.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const h=d;if(a){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Aa,{}),e[2]=C):C=e[2],C}if(!r){let C;e[3]!==n?(C=n("mainPanelTabs.automationTab.automationNotFound"),e[3]=n,e[4]=C):C=e[4];let V;return e[5]!==C?(V=o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:C}),e[5]=C,e[6]=V):V=e[6],V}let u;e[7]!==r.triggers?(u=r.triggers.map(cde),e[7]=r.triggers,e[8]=u):u=e[8];const f=u;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(c9,{size:14}),e[9]=p):p=e[9];let m;e[10]!==n?(m=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=m):m=e[11];let g;e[12]!==h||e[13]!==m?(g=o.jsxs(me,{variant:"ghost",size:"sm",onClick:h,children:[p,m]}),e[12]=h,e[13]=m,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let v;e[19]!==n?(v=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=v):v=e[20];let L;e[21]!==v?(L={id:"runs",label:v},e[21]=v,e[22]=L):L=e[22];let _;e[23]!==b||e[24]!==L?(_=[b,L],e[23]=b,e[24]=L,e[25]=_):_=e[25];let y;e[26]===Symbol.for("react.memo_cache_sentinel")?(y=C=>c(C),e[26]=y):y=e[26];let w;e[27]!==_||e[28]!==l?(w=o.jsx(s7,{tabs:_,activeTab:l,onTabChange:y}),e[27]=_,e[28]=l,e[29]=w):w=e[29];let S;e[30]!==w||e[31]!==g?(S=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,w]}),e[30]=w,e[31]=g,e[32]=S):S=e[32];let k;e[33]!==r||e[34]!==s||e[35]!==l||e[36]!==f?(k=l==="settings"?o.jsx(ide,{automationId:s,automation:r}):o.jsx(rde,{automationId:s,triggerIds:f}),e[33]=r,e[34]=s,e[35]=l,e[36]=f,e[37]=k):k=e[37];let j;return e[38]!==S||e[39]!==k?(j=o.jsx(En,{children:o.jsx(En.Content,{children:o.jsxs(En.Body,{children:[S,k]})})}),e[38]=S,e[39]=k,e[40]=j):j=e[40],j}function cde(t){return t.id}function dde(t){const e=F.c(29),{virtualMcpId:s}=t,n=ae(),{openPanel:i}=Di(),{data:r}=KE(s),a=r===void 0?[]:r,{create:l}=f0(),[c,d]=T.useState(""),h=c.toLowerCase(),u=a.filter(E=>E.name.toLowerCase().includes(h));let f;e[0]!==i?(f=E=>i(`automation:${E}`),e[0]=i,e[1]=f):f=e[1];const p=f,m=async()=>{if(l.isPending)return;qe("automation_new_clicked",{virtual_mcp_id:s,existing_count:a.length});const E=await l.mutateAsync(WE(s));p(E.id)},g=l.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Qt,{size:14}),e[2]=x):x=e[2];let b;e[3]!==n?(b=n("automations.automationsList.newAutomation"),e[3]=n,e[4]=b):b=e[4];let v;e[5]!==l.isPending||e[6]!==m||e[7]!==b?(v=o.jsxs(me,{size:"sm",onClick:m,disabled:g,children:[x,b]}),e[5]=l.isPending,e[6]=m,e[7]=b,e[8]=v):v=e[8];const L=v,_=En,y=En,w=En;let S;e[9]!==n?(S=n("automations.automationsList.title"),e[9]=n,e[10]=S):S=e[10];let k;e[11]!==S?(k=o.jsx(En.Title,{children:S}),e[11]=S,e[12]=k):k=e[12];const j=a.length>0&&o.jsx(b9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let C;e[13]!==L||e[14]!==j?(C=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,L]}),e[13]=L,e[14]=j,e[15]=C):C=e[15];let V;e[16]!==k||e[17]!==C?(V=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=V):V=e[18];const N=a.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ti,{image:o.jsx(hr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:L})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ti,{image:o.jsx(hr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(E=>o.jsx(qE,{automation:E,onClick:()=>p(E.id)},E.id))});let A;e[19]!==V||e[20]!==N||e[21]!==w.Body?(A=o.jsxs(w.Body,{children:[V,N]}),e[19]=V,e[20]=N,e[21]=w.Body,e[22]=A):A=e[22];let P;e[23]!==A||e[24]!==y.Content?(P=o.jsx(y.Content,{children:A}),e[23]=A,e[24]=y.Content,e[25]=P):P=e[25];let R;return e[26]!==_||e[27]!==P?(R=o.jsx(_,{children:P}),e[26]=_,e[27]=P,e[28]=R):R=e[28],R}function ude(t){const e=F.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Aa,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(T.Suspense,{fallback:n,children:o.jsx(dde,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function hde(t){const e=F.c(60),{file:s,onClose:n}=t,i=ae();let r,a;e[0]!==s.filename?(r=o.jsx(Xo,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),a=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let l;e[3]!==s.size?(l=X8(s.size),e[3]=s.size,e[4]=l):l=e[4];let c;e[5]!==l?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:l}),e[5]=l,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==a||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,a,c]}),e[7]=r,e[8]=a,e[9]=c,e[10]=d):d=e[10];let h;e[11]!==i?(h=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=h):h=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Cu,{size:14}),e[13]=u):u=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:u}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let p;e[17]!==h||e[18]!==f?(p=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":h,asChild:!0,children:f})}),e[17]=h,e[18]=f,e[19]=p):p=e[19];let m;e[20]!==i?(m=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=m):m=e[21];let g;e[22]!==m?(g=o.jsx(Ke,{side:"bottom",children:m}),e[22]=m,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==p?(x=o.jsxs(We,{children:[p,g]}),e[24]=g,e[25]=p,e[26]=x):x=e[26];let b;e[27]!==i?(b=i("mainPanelTabs.fileTab.openInNewTab"),e[27]=i,e[28]=b):b=e[28];let v;e[29]!==s.downloadUrl?(v=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=v):v=e[30];let L;e[31]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(hn,{size:14}),e[31]=L):L=e[31];let _;e[32]!==b||e[33]!==v?(_=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:L})}),e[32]=b,e[33]=v,e[34]=_):_=e[34];let y;e[35]!==i?(y=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=y):y=e[36];let w;e[37]!==y?(w=o.jsx(Ke,{side:"bottom",children:y}),e[37]=y,e[38]=w):w=e[38];let S;e[39]!==_||e[40]!==w?(S=o.jsxs(We,{children:[_,w]}),e[39]=_,e[40]=w,e[41]=S):S=e[41];let k;e[42]!==i?(k=i("mainPanelTabs.fileTab.close"),e[42]=i,e[43]=k):k=e[43];let j;e[44]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(ii,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let V;e[48]!==i?(V=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=V):V=e[49];let N;e[50]!==V?(N=o.jsx(Ke,{side:"bottom",children:V}),e[50]=V,e[51]=N):N=e[51];let A;e[52]!==C||e[53]!==N?(A=o.jsxs(We,{children:[C,N]}),e[52]=C,e[53]=N,e[54]=A):A=e[54];let P;return e[55]!==x||e[56]!==S||e[57]!==A||e[58]!==d?(P=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,S,A]}),e[55]=x,e[56]=S,e[57]=A,e[58]=d,e[59]=P):P=e[59],P}function fde(t){const e=F.c(31),{fileKey:s,taskId:n}=t,i=ae(),{closePanel:r}=Di(),{data:a,isPending:l}=D6(n);let c;e[0]!==s||e[1]!==a?(c=a?.find(g=>g.key===s)??null,e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=c;let h;e[3]!==r?(h=()=>r(),e[3]=r,e[4]=h):h=e[4];const u=h;if(!d){if(l){let w;return e[5]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(Y8,{})}),e[5]=w):w=e[5],w}let g;e[6]!==s?(g=s.split("/").pop()??s,e[6]=s,e[7]=g):g=e[7];let x;e[8]!==g?(x=o.jsx(Xo,{filename:g,className:"h-7.5 w-6"}),e[8]=g,e[9]=x):x=e[9];let b;e[10]!==i?(b=i("mainPanelTabs.fileTab.fileNotAvailable"),e[10]=i,e[11]=b):b=e[11];let v;e[12]!==b?(v=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=v):v=e[13];let L;e[14]!==i?(L=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=L):L=e[15];let _;e[16]!==u||e[17]!==L?(_=o.jsx(me,{variant:"ghost",size:"sm",onClick:u,children:L}),e[16]=u,e[17]=L,e[18]=_):_=e[18];let y;return e[19]!==x||e[20]!==v||e[21]!==_?(y=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,v,_]}),e[19]=x,e[20]=v,e[21]=_,e[22]=y):y=e[22],y}let f;e[23]!==d||e[24]!==u?(f=o.jsx(hde,{file:d,onClose:u}),e[23]=d,e[24]=u,e[25]=f):f=e[25];let p;e[26]!==d?(p=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(Q8,{file:d})}),e[26]=d,e[27]=p):p=e[27];let m;return e[28]!==f||e[29]!==p?(m=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,p]}),e[28]=f,e[29]=p,e[30]=m):m=e[30],m}function mde(t){const e=F.c(7),{onClose:s}=t,n=ae();let i;e[0]!==n?(i=n("routes.commerceOnboarding.connectModal.loadError"),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==i?(r=o.jsx("p",{className:"text-sm text-muted-foreground",children:i}),e[2]=i,e[3]=r):r=e[3];let a;return e[4]!==s||e[5]!==r?(a=o.jsx(Tg,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=a):a=e[6],a}function pde(){const t=F.c(10),{closePanel:e}=Di();let s;t[0]!==e?(s=()=>e(),t[0]=e,t[1]=s):s=t[1];const n=s;let i;t[2]!==n?(i=()=>o.jsx(mde,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ME,{}),t[4]=r):r=t[4];let a;t[5]!==n?(a=o.jsx(T.Suspense,{fallback:o.jsx(Tg,{onClose:n,footer:null,children:r}),children:o.jsx(gde,{onDone:n,onClose:n})}),t[5]=n,t[6]=a):a=t[6];let l;return t[7]!==i||t[8]!==a?(l=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(tn,{fallback:i,children:a})}),t[7]=i,t[8]=a,t[9]=l):l=t[9],l}function gde(t){const e=F.c(46),{onDone:s,onClose:n}=t,i=ae(),{org:r}=Ue();let a;e[0]!==r.id?(a=Kd.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=a):a=e[1];const l=a;let c;e[2]!==r.id||e[3]!==r.slug?(c={connectionId:Xu,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=Cn(c);let h;e[5]!==l||e[6]!==r||e[7]!==d?(h={selfClient:d,org:r,cdConnectionId:l},e[5]=l,e[6]=r,e[7]=d,e[8]=h):h=e[8];const u=IE(h),[f,p]=T.useState(!1),[m,g]=T.useState(null);let x;e[9]!==d?(x={mutationFn:async P=>_7(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:P}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Ds(x);let v;e[11]!==s||e[12]!==b||e[13]!==u||e[14]!==i?(v=async()=>{if(g(null),u)try{await b.mutateAsync(u)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=u,e[14]=i,e[15]=v):v=e[15];const L=v;let _;e[16]!==m?(_=m?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:m}):null,e[16]=m,e[17]=_):_=e[17];let y;e[18]!==b.isPending||e[19]!==i?(y=b.isPending?i("routes.commerceOnboarding.connectSourcesTab.refreshing"):i("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=i,e[20]=y):y=e[20];let w;e[21]!==L?(w=()=>{L()},e[21]=L,e[22]=w):w=e[22];let S;e[23]!==f||e[24]!==b.isPending||e[25]!==y||e[26]!==w?(S=o.jsx(kE,{ready:f,pending:b.isPending,label:y,onClick:w}),e[23]=f,e[24]=b.isPending,e[25]=y,e[26]=w,e[27]=S):S=e[27];let k;e[28]!==_||e[29]!==S?(k=o.jsxs(o.Fragment,{children:[_,S]}),e[28]=_,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==i?(j=i("routes.commerceOnboarding.connectSourcesTab.title"),e[31]=i,e[32]=j):j=e[32];let C;e[33]!==j?(C=o.jsx("h2",{className:"text-xl font-medium leading-tight text-foreground",children:j}),e[33]=j,e[34]=C):C=e[34];let V;e[35]!==l||e[36]!==r||e[37]!==u?(V=o.jsx(OE,{org:r,cdConnectionId:l,siteUrl:u,onReadinessChange:p}),e[35]=l,e[36]=r,e[37]=u,e[38]=V):V=e[38];let N;e[39]!==C||e[40]!==V?(N=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,V]}),e[39]=C,e[40]=V,e[41]=N):N=e[41];let A;return e[42]!==n||e[43]!==k||e[44]!==N?(A=o.jsx(Tg,{onClose:n,footer:k,children:N}),e[42]=n,e[43]=k,e[44]=N,e[45]=A):A=e[45],A}const xde=T.lazy(()=>Ws(()=>import("./project-app-view-DKi7PUJM.js"),__vite__mapDeps([185,1,2,81,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,82,83,84,10,11,18,85,86,87,88,89,90,91,92,93,94,95,96,23,4,5,9,12,13,14,15,16,3,6,7,8,17,19,20,21,22,27,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,146,160,121,122,123,161,156,130,131,162,116,117,73,118,119,120,124,125,126,127,128,129,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,147,148,149,150,72,151,152,79,153,154,155,157,158,159,163,164,76,165,166,167])).then(t=>({default:t.AppViewContent})));function bde(){const t=F.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:i}=b7();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Aa,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Aa,{}),t[1]=d):d=t[1];let h;return t[2]!==i?(h=o.jsx(T.Suspense,{fallback:d,children:o.jsx(xde,{connectionId:i,toolName:CT})}),t[2]=i,t[3]=h):h=t[3],h}let r;t[4]!==n?(r=()=>o.jsx(Dj,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Aa,{}),t[6]=a):a=t[6];let l;t[7]!==n?(l=o.jsx(T.Suspense,{fallback:a,children:o.jsx(yde,{claimedSiteUrl:n})}),t[7]=n,t[8]=l):l=t[8];let c;return t[9]!==r||t[10]!==l?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(tn,{fallback:r,children:l})}),t[9]=r,t[10]=l,t[11]=c):c=t[11],c}const vde=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Dj(t){const e=F.c(27),{claimedSiteUrl:s,children:n}=t,i=ae(),r=s??void 0;let a;e[0]!==r?(a=Gm(r),e[0]=r,e[1]=a):a=e[1];const l=a;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsxs("div",{className:"relative flex items-end justify-center pt-4",children:[o.jsx("div",{"aria-hidden":!0,className:"absolute -bottom-6 size-56 rounded-full bg-success/10 blur-3xl"}),o.jsx(op,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(op,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==i?(d=i("reports.emptyState.title"),e[3]=i,e[4]=d):d=e[4];let h;e[5]!==d?(h=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=h):h=e[6];let u;e[7]!==i?(u=i("reports.emptyState.description"),e[7]=i,e[8]=u):u=e[8];let f;e[9]!==u?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:u}),e[9]=u,e[10]=f):f=e[10];let p;e[11]!==h||e[12]!==f?(p=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[h,f]}),e[11]=h,e[12]=f,e[13]=p):p=e[13];let m;e[14]!==n||e[15]!==l?(m=n??(l?o.jsx("p",{className:"text-sm text-muted-foreground",children:l}):null),e[14]=n,e[15]=l,e[16]=m):m=e[16];let g;e[17]!==i?(g=vde.map(L=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:i(L)},L)),e[17]=i,e[18]=g):g=e[18];let x;e[19]!==g?(x=o.jsx("ul",{className:"flex flex-wrap items-center justify-center gap-2",children:g}),e[19]=g,e[20]=x):x=e[20];let b;e[21]!==x||e[22]!==m?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[m,x]}),e[21]=x,e[22]=m,e[23]=b):b=e[23];let v;return e[24]!==b||e[25]!==p?(v=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,p,b]}),e[24]=b,e[25]=p,e[26]=v):v=e[26],v}function yde(t){const e=F.c(46),{claimedSiteUrl:s}=t,n=ae(),i=Ks(),{org:r}=Ue();let a;e[0]!==r.id||e[1]!==r.slug?(a={connectionId:Xu,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=a):a=e[2];const l=Cn(a);let c;e[3]!==s?(c=Gm(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,h]=T.useState(c),[u,f]=T.useState(null);let p;e[5]!==l?(p={mutationFn:async R=>_7(await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:R}})),retry:!1},e[5]=l,e[6]=p):p=e[6];const m=Ds(p);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==m?(g=async R=>{const E=$E(R);if(!E.ok){f(E.error);return}f(null);const I=Gm(E.value)??void 0;qe("reports_start_diagnostic_submitted",{organization_id:r.id,domain:I});try{await m.mutateAsync(E.value)}catch(D){const O=D;qe("reports_start_diagnostic_failed",{organization_id:r.id,domain:I,error:O instanceof Error?O.message:String(O)}),f(O instanceof Error?O.message:"__configurationFailed");return}i({to:Ca.agents,params:{org:r.slug,panel:void 0},search:{virtualmcpid:ra(r.id).id,connect:"1",siteUrl:E.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=m,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=R=>{R.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const v=b;let L;e[15]!==n?(L=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=L):L=e[16];let _;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=R=>h(R.target.value),e[17]=_):_=e[17];let y;e[18]!==n?(y=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=y):y=e[19];const w=!!u;let S;e[20]!==m.isPending||e[21]!==d||e[22]!==L||e[23]!==y||e[24]!==w?(S=o.jsx(vt,{"aria-label":L,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:_,placeholder:y,"aria-invalid":w,disabled:m.isPending}),e[20]=m.isPending,e[21]=d,e[22]=L,e[23]=y,e[24]=w,e[25]=S):S=e[25];let k;e[26]!==m.isPending||e[27]!==n?(k=m.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=m.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(gr,{size:16}),e[29]=j):j=e[29];let C;e[30]!==m.isPending||e[31]!==k?(C=o.jsxs(me,{type:"submit",className:"shrink-0",disabled:m.isPending,children:[k,j]}),e[30]=m.isPending,e[31]=k,e[32]=C):C=e[32];let V;e[33]!==S||e[34]!==C?(V=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[S,C]}),e[33]=S,e[34]=C,e[35]=V):V=e[35];let N;e[36]!==u||e[37]!==n?(N=u?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:GE(n,u)}):null,e[36]=u,e[37]=n,e[38]=N):N=e[38];let A;e[39]!==v||e[40]!==V||e[41]!==N?(A=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:v,children:[V,N]}),e[39]=v,e[40]=V,e[41]=N,e[42]=A):A=e[42];let P;return e[43]!==s||e[44]!==A?(P=o.jsx(Dj,{claimedSiteUrl:s,children:A}),e[43]=s,e[44]=A,e[45]=P):P=e[45],P}function _de(t){return[Kd.SELF(t),Kd.REGISTRY(t),Kd.COMMUNITY_REGISTRY(t),Kd.DEV_ASSETS(t)]}function Lde(t,e){const s=new Set(_de(e));return t.some(n=>!s.has(n.id))}function wde(){const t=F.c(78),e=ae(),{org:s}=Ue(),n=dr();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"mcp-github"},t[0]=i):i=t[0];const r=dr(i),{projects:a}=r0(),l=bg();let c;t[1]!==s.slug?(c={org:s.slug},t[1]=s.slug,t[2]=c):c=t[2];const d=c;let h;t[3]!==e?(h=e("discover.setup.connectTitle"),t[3]=e,t[4]=h):h=t[4];let u;t[5]!==e?(u=e("discover.setup.connectBody"),t[5]=e,t[6]=u):u=t[6];let f;t[7]!==n||t[8]!==s.id?(f=Lde(n,s.id),t[7]=n,t[8]=s.id,t[9]=f):f=t[9];let p;t[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Ia,{size:18}),t[10]=p):p=t[10];let m;t[11]===Symbol.for("react.memo_cache_sentinel")?(m={tab:"all"},t[11]=m):m=t[11];let g;t[12]!==e?(g=e("discover.setup.connectAction"),t[12]=e,t[13]=g):g=t[13];let x;t[14]!==d||t[15]!==g?(x=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Io,{to:"/$org/settings/connections",params:d,search:m,children:g})}),t[14]=d,t[15]=g,t[16]=x):x=t[16];let b;t[17]!==h||t[18]!==u||t[19]!==f||t[20]!==x?(b={key:"connect",title:h,body:u,done:f,icon:p,action:x},t[17]=h,t[18]=u,t[19]=f,t[20]=x,t[21]=b):b=t[21];let v;t[22]!==e?(v=e("discover.setup.githubTitle"),t[22]=e,t[23]=v):v=t[23];let L;t[24]!==e?(L=e("discover.setup.githubBody"),t[24]=e,t[25]=L):L=t[25];const _=r.length>0;let y;t[26]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(ur,{className:"size-[18px]"}),t[26]=y):y=t[26];let w;t[27]===Symbol.for("react.memo_cache_sentinel")?(w={tab:"all"},t[27]=w):w=t[27];let S;t[28]!==e?(S=e("discover.setup.githubAction"),t[28]=e,t[29]=S):S=t[29];let k;t[30]!==d||t[31]!==S?(k=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Io,{to:"/$org/settings/connections",params:d,search:w,children:S})}),t[30]=d,t[31]=S,t[32]=k):k=t[32];let j;t[33]!==v||t[34]!==L||t[35]!==_||t[36]!==k?(j={key:"github",title:v,body:L,done:_,icon:y,action:k},t[33]=v,t[34]=L,t[35]=_,t[36]=k,t[37]=j):j=t[37];let C;t[38]!==e?(C=e("discover.setup.projectTitle"),t[38]=e,t[39]=C):C=t[39];let V;t[40]!==e?(V=e("discover.setup.projectBody"),t[40]=e,t[41]=V):V=t[41];const N=a.length>0;let A;t[42]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(Qt,{size:18}),t[42]=A):A=t[42];let P;t[43]!==s.slug?(P={org:s.slug,panel:void 0},t[43]=s.slug,t[44]=P):P=t[44];let R;t[45]===Symbol.for("react.memo_cache_sentinel")?(R={virtualmcpid:void 0},t[45]=R):R=t[45];let E;t[46]!==e?(E=e("discover.setup.projectAction"),t[46]=e,t[47]=E):E=t[47];let I;t[48]!==P||t[49]!==E?(I=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Io,{to:Ca.agents,params:P,search:R,children:E})}),t[48]=P,t[49]=E,t[50]=I):I=t[50];let D;t[51]!==C||t[52]!==V||t[53]!==N||t[54]!==I?(D={key:"project",title:C,body:V,done:N,icon:A,action:I},t[51]=C,t[52]=V,t[53]=N,t[54]=I,t[55]=D):D=t[55];let O;t[56]!==e?(O=e("discover.setup.inviteTitle"),t[56]=e,t[57]=O):O=t[57];let B;t[58]!==e?(B=e("discover.setup.inviteBody"),t[58]=e,t[59]=B):B=t[59];let M;t[60]!==l.data?.data?.members?(M=l.data?.data?.members??[],t[60]=l.data?.data?.members,t[61]=M):M=t[61];const z=M.length>1;let $;t[62]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(v9,{size:18}),t[62]=$):$=t[62];let U;t[63]!==e?(U=e("discover.setup.inviteAction"),t[63]=e,t[64]=U):U=t[64];let H;t[65]!==d||t[66]!==U?(H=o.jsx(me,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(Io,{to:"/$org/settings/members",params:d,children:U})}),t[65]=d,t[66]=U,t[67]=H):H=t[67];let W;t[68]!==O||t[69]!==B||t[70]!==z||t[71]!==H?(W={key:"invite",title:O,body:B,done:z,icon:$,action:H},t[68]=O,t[69]=B,t[70]=z,t[71]=H,t[72]=W):W=t[72];let K;return t[73]!==j||t[74]!==D||t[75]!==W||t[76]!==b?(K=[b,j,D,W],t[73]=j,t[74]=D,t[75]=W,t[76]=b,t[77]=K):K=t[77],K}function Sde(){const t=F.c(51),e=ae(),{projects:s}=r0();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={slug:"mcp-github"},t[0]=n):n=t[0];const i=dr(n),r=Eg();let a;t[1]!==s?(a=s.some(jde),t[1]=s,t[2]=a):a=t[2];const l=a;let c;t[3]!==s?(c=s.some(kde),t[3]=s,t[4]=c):c=t[4];const d=c;let h;if(t[5]!==r||t[6]!==s){let P;t[8]!==r?(P=R=>h9(r.data?.configs??[],S7(R)),t[8]=r,t[9]=P):P=t[9],h=s.some(P),t[5]=r,t[6]=s,t[7]=h}else h=t[7];const u=h;let f;t[10]!==e?(f=e("discover.capabilities.previewTitle"),t[10]=e,t[11]=f):f=t[11];let p;t[12]!==e?(p=e("discover.capabilities.previewRequirement"),t[12]=e,t[13]=p):p=t[13];let m;t[14]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Ai,{size:18}),t[14]=m):m=t[14];let g;t[15]!==l||t[16]!==f||t[17]!==p?(g={key:"preview",title:f,requirement:p,satisfied:l,icon:m},t[15]=l,t[16]=f,t[17]=p,t[18]=g):g=t[18];let x;t[19]!==e?(x=e("discover.capabilities.gitTitle"),t[19]=e,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("discover.capabilities.gitRequirement"),t[21]=e,t[22]=b):b=t[22];const v=i.length>0&&l;let L;t[23]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(ur,{className:"size-[18px]"}),t[23]=L):L=t[23];let _;t[24]!==v||t[25]!==x||t[26]!==b?(_={key:"git",title:x,requirement:b,satisfied:v,icon:L},t[24]=v,t[25]=x,t[26]=b,t[27]=_):_=t[27];let y;t[28]!==e?(y=e("discover.capabilities.contentTitle"),t[28]=e,t[29]=y):y=t[29];let w;t[30]!==e?(w=e("discover.capabilities.contentRequirement"),t[30]=e,t[31]=w):w=t[31];let S;t[32]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ai,{size:18}),t[32]=S):S=t[32];let k;t[33]!==d||t[34]!==y||t[35]!==w?(k={key:"content",title:y,requirement:w,satisfied:d,icon:S},t[33]=d,t[34]=y,t[35]=w,t[36]=k):k=t[36];let j;t[37]!==e?(j=e("discover.capabilities.assetsTitle"),t[37]=e,t[38]=j):j=t[38];let C;t[39]!==e?(C=e("discover.capabilities.assetsRequirement"),t[39]=e,t[40]=C):C=t[40];let V;t[41]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(ni,{size:18}),t[41]=V):V=t[41];let N;t[42]!==u||t[43]!==j||t[44]!==C?(N={key:"assets",title:j,requirement:C,satisfied:u,icon:V},t[42]=u,t[43]=j,t[44]=C,t[45]=N):N=t[45];let A;return t[46]!==_||t[47]!==k||t[48]!==N||t[49]!==g?(A=[g,_,k,N],t[46]=_,t[47]=k,t[48]=N,t[49]=g,t[50]=A):A=t[50],A}function kde(t){return!!aa(t)&&p0(t.metadata?.ui?.layout)!=="off"}function jde(t){return aa(t)}function lm(t){const e=F.c(10),{title:s,description:n,children:i}=t;let r;e[0]!==s?(r=o.jsx("h2",{className:"text-base font-semibold text-foreground",children:s}),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==n?(a=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:n}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==r||e[5]!==a?(l=o.jsxs("div",{className:"flex flex-col gap-1",children:[r,a]}),e[4]=r,e[5]=a,e[6]=l):l=e[6];let c;return e[7]!==i||e[8]!==l?(c=o.jsxs("section",{className:"flex flex-col gap-3",children:[l,i]}),e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function Cde(){const t=F.c(63),e=ae(),{org:s}=Ue(),n=wde(),i=Sde();let r;t[0]!==n?(r=n.filter(Tde),t[0]=n,t[1]=r):r=t[1];const a=r;let l;t[2]!==e?(l=e("discover.title"),t[2]=e,t[3]=l):l=t[3];let c;t[4]!==l?(c=o.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:l}),t[4]=l,t[5]=c):c=t[5];let d;t[6]!==e?(d=e("discover.subtitle"),t[6]=e,t[7]=d):d=t[7];let h;t[8]!==d?(h=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:d}),t[8]=d,t[9]=h):h=t[9];let u;t[10]!==c||t[11]!==h?(u=o.jsxs("header",{className:"flex flex-col gap-2",children:[c,h]}),t[10]=c,t[11]=h,t[12]=u):u=t[12];let f;t[13]!==e?(f=e("discover.setup.title"),t[13]=e,t[14]=f):f=t[14];let p;t[15]!==a.length||t[16]!==e?(p=a.length===0?e("discover.setup.allDone"):e("discover.setup.description"),t[15]=a.length,t[16]=e,t[17]=p):p=t[17];let m;t[18]!==n?(m=n.map(Vde),t[18]=n,t[19]=m):m=t[19];let g;t[20]!==m?(g=o.jsx("ul",{className:"flex flex-col gap-2",children:m}),t[20]=m,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==p||t[24]!==g?(x=o.jsx(lm,{title:f,description:p,children:g}),t[22]=f,t[23]=p,t[24]=g,t[25]=x):x=t[25];let b;t[26]!==e?(b=e("discover.capabilities.title"),t[26]=e,t[27]=b):b=t[27];let v;t[28]!==e?(v=e("discover.capabilities.description"),t[28]=e,t[29]=v):v=t[29];let L;if(t[30]!==i||t[31]!==e){let R;t[33]!==e?(R=E=>o.jsxs("li",{className:"flex items-start gap-3 rounded-xl border border-border bg-card p-4",children:[o.jsx("span",{className:re("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",E.satisfied?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:E.satisfied?o.jsx(Gt,{size:18}):E.icon}),o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:E.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:E.satisfied?e("discover.capabilities.ready"):E.requirement})]})]},E.key),t[33]=e,t[34]=R):R=t[34],L=i.map(R),t[30]=i,t[31]=e,t[32]=L}else L=t[32];let _;t[35]!==L?(_=o.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:L}),t[35]=L,t[36]=_):_=t[36];let y;t[37]!==b||t[38]!==v||t[39]!==_?(y=o.jsx(lm,{title:b,description:v,children:_}),t[37]=b,t[38]=v,t[39]=_,t[40]=y):y=t[40];let w;t[41]!==e?(w=e("discover.catalog.title"),t[41]=e,t[42]=w):w=t[42];let S;t[43]!==e?(S=e("discover.catalog.description"),t[43]=e,t[44]=S):S=t[44];let k;t[45]!==s.slug?(k={org:s.slug},t[45]=s.slug,t[46]=k):k=t[46];let j;t[47]===Symbol.for("react.memo_cache_sentinel")?(j={tab:"all"},t[47]=j):j=t[47];let C;t[48]!==e?(C=e("discover.catalog.action"),t[48]=e,t[49]=C):C=t[49];let V;t[50]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(gr,{size:18}),t[50]=V):V=t[50];let N;t[51]!==k||t[52]!==C?(N=o.jsx("div",{children:o.jsx(me,{asChild:!0,size:"lg",children:o.jsxs(Io,{to:"/$org/settings/connections",params:k,search:j,onClick:Nde,children:[C,V]})})}),t[51]=k,t[52]=C,t[53]=N):N=t[53];let A;t[54]!==w||t[55]!==S||t[56]!==N?(A=o.jsx(lm,{title:w,description:S,children:N}),t[54]=w,t[55]=S,t[56]=N,t[57]=A):A=t[57];let P;return t[58]!==x||t[59]!==y||t[60]!==A||t[61]!==u?(P=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-10 p-6 md:p-10",children:[u,x,y,A]})}),t[58]=x,t[59]=y,t[60]=A,t[61]=u,t[62]=P):P=t[62],P}function Nde(){return qe("discover_catalog_opened",{})}function Vde(t){return o.jsxs("li",{className:re("flex items-start gap-3 rounded-xl border border-border bg-card p-4",t.done&&"opacity-60"),children:[o.jsx("span",{className:re("mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg",t.done?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.done?o.jsx(Gt,{size:18}):t.icon}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:t.body})]}),!t.done&&o.jsx("div",{className:"shrink-0",children:t.action})]},t.key)}function Tde(t){return!t.done}function Ade(t){const e=F.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,a=ae();let l;e[0]!==s?(l=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=l):l=e[1];const c=l;let d;e[2]!==n||e[3]!==a?(d=n.deckDetected&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?a("deck.deckToolbar.hideSlideList"):a("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(b6,{size:14})})}),o.jsx(Ke,{side:"bottom",children:n.railOpen?a("deck.deckToolbar.hideSlideList"):a("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=a,e[4]=d):d=e[4];let h;e[5]!==c?(h=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=h):h=e[6];let u;e[7]!==c?(u=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=u):u=e[8];let f;e[9]!==c||e[10]!==h||e[11]!==u?(f=o.jsx("button",{type:"button",onClick:h,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:u}),e[9]=c,e[10]=h,e[11]=u,e[12]=f):f=e[12];let p;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==a?(p=n.agentUpdated&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(Dn,{size:12}),a("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(Ke,{side:"bottom",children:a("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=a,e[16]=p):p=e[16];let m;e[17]!==n.saving||e[18]!==a?(m=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:a("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=a,e[19]=m):m=e[19];let g;e[20]!==n||e[21]!==a?(g=n.deckDetected&&n.writable&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?a("deck.deckToolbar.doneEditing"):a("deck.deckToolbar.editInline"),className:re(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(a8,{size:14})})}),o.jsx(Ke,{side:"bottom",children:n.editMode?a("deck.deckToolbar.doneEditing"):a("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=a,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==i||e[25]!==n.deckDetected||e[26]!==a?(x=n.deckDetected?o.jsxs(Ot,{children:[o.jsx($t,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":a("deck.deckToolbar.download"),children:o.jsx(Cu,{size:14})})}),o.jsxs(Bt,{align:"end",children:[o.jsxs(Qe,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(LA,{size:14}),a("deck.deckToolbar.exportAsPdf")]}),o.jsx(Qe,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(l9,{size:14}),a("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":a("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx(Cu,{size:14})})})}),o.jsx(Ke,{side:"bottom",children:a("deck.deckToolbar.download")})]}),e[23]=c,e[24]=i,e[25]=n.deckDetected,e[26]=a,e[27]=x):x=e[27];let b;e[28]!==a?(b=a("deck.deckToolbar.openInNewTab"),e[28]=a,e[29]=b):b=e[29];let v;e[30]!==c?(v=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=v):v=e[31];let L;e[32]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(hn,{size:14}),e[32]=L):L=e[32];let _;e[33]!==b||e[34]!==v?(_=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:L})}),e[33]=b,e[34]=v,e[35]=_):_=e[35];let y;e[36]!==a?(y=a("deck.deckToolbar.openInNewTab"),e[36]=a,e[37]=y):y=e[37];let w;e[38]!==y?(w=o.jsx(Ke,{side:"bottom",children:y}),e[38]=y,e[39]=w):w=e[39];let S;e[40]!==_||e[41]!==w?(S=o.jsxs(We,{children:[_,w]}),e[40]=_,e[41]=w,e[42]=S):S=e[42];let k;return e[43]!==S||e[44]!==d||e[45]!==f||e[46]!==p||e[47]!==m||e[48]!==g||e[49]!==x||e[50]!==r?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,f,p,m,g,x,S,r]}),e[43]=S,e[44]=d,e[45]=f,e[46]=p,e[47]=m,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const Nc=1;function Pde(t){if(typeof t!="object"||t===null||t.v!==Nc||t.source!=="deck-viewer")return null;const e=t;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class Po extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function Mj(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Ede(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?Mj(s).length:null}function Rde(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new Po("no <deck-viewer> element in source","no-viewer");const i=Mj(n),r=e.kind==="move"?e.from:e.at,a=i[r];if(!a)throw new Po(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new Po("cannot remove the last slide","bad-op");a.remove();break}case"duplicate":{const c=a.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");a.after(c);break}case"move":{if(e.to<0||e.to>=i.length)throw new Po(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?i[e.to]:i[e.to].nextSibling;n.insertBefore(a,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new Po(`invalid attribute name: ${e.name}`,"bad-op");a.setAttribute(e.name,e.value);break}case"remove-attr":{a.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new Po("replace html has no root element","bad-op");a.replaceWith(s.importNode(d,!0));break}default:throw new Po(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
654
654
  `:""}${s.documentElement.outerHTML}
655
655
  `}const Hv="home",Dde=400,Mde=800;function Ide(t){const e=t.savePath!==void 0,{org:s}=Ue(),n=Vs(),i=T8(Hv),[r,a]=T.useState(!1),[l,c]=T.useState(!1),[d,h]=T.useState(!1),[u,f]=T.useState(!1),[p,m]=T.useState(!1),[g,x]=T.useState(!1),[b,v]=T.useState(null),[L,_]=T.useState(null),[y,w]=T.useState(0),[S]=T.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),k=r||g||p,j=()=>{t.savePath!==void 0&&(n.invalidateQueries({queryKey:tt.orgFsStat(s.id,Hv,t.savePath)}),n.invalidateQueries({queryKey:tt.orgFsRecent(s.id)}))},C=M=>{S.iframe?.contentWindow?.postMessage(M,"*")},V=()=>{S.source=null,f(!1),L&&v(L),w(M=>M+1),j()};t.statMarker!==L&&(_(t.statMarker),t.statMarker!==null&&(b===null?v(t.statMarker):S.selfMarkers.has(t.statMarker)||t.statMarker!==b&&(k?f(!0):(S.source=null,v(t.statMarker)))));const N=async()=>{S.saveTimer=null;const M=S.source;if(M===null){x(!1);return}m(!0);try{const z=await i.mutateAsync({path:t.savePath,body:M});S.selfMarkers.add(pg(z)),j()}catch(z){console.error("[deck-editor] save failed",z),ye.error("Couldn't save deck edits — reloading the preview."),I.current.reload()}finally{m(!1),x(!1)}},A=M=>{x(!0),S.saveTimer&&clearTimeout(S.saveTimer),S.saveTimer=setTimeout(()=>{I.current.flushSave()},M)},P=(M,z,$)=>{C({v:Nc,type:"ack",opId:M,ok:z,error:$})},R=async M=>{if(!e){P(M.opId,!1,"read-only preview");return}try{if(S.source===null){const $=await fetch(t.readUrl,{credentials:"include"});if(!$.ok)throw new Error(`HTTP ${$.status}`);S.source=await $.text()}const z=Ede(S.source);if(z===null||z!==M.witness.childCount)throw new Po(`slide count drifted (source ${z}, iframe ${M.witness.childCount})`,"stale-index");S.source=Rde(S.source,M.op),P(M.opId,!0),A(M.op.kind==="replace"?Mde:Dde)}catch(z){console.error("[deck-editor] op failed",M.op,z),P(M.opId,!1,z instanceof Error?z.message:String(z)),ye.error("That edit couldn't be saved — reloading the preview."),I.current.reload()}},E=M=>{if(!S.iframe||M.source!==S.iframe.contentWindow)return;const z=Pde(M.data);if(z){if(z.type==="ready"){c(!0),I.current.editMode?C({v:Nc,type:"set-edit-mode",enabled:!0}):I.current.railOpen&&C({v:Nc,type:"set-rail",open:!0});return}z.type==="op"&&(S.queue=S.queue.then(()=>I.current.handleOp(z)).catch(()=>{}))}},I=T.useRef({onMessage:E,handleOp:R,flushSave:N,reload:V,editMode:r,railOpen:d});I.current={onMessage:E,handleOp:R,flushSave:N,reload:V,editMode:r,railOpen:d};const[D]=T.useState(()=>{let M=null;return z=>{if(z){S.iframe=z;const $=U=>I.current.onMessage(U);window.addEventListener("message",$),M=()=>window.removeEventListener("message",$)}else M?.(),M=null,S.iframe=null}}),O=M=>{h(M),C({v:Nc,type:"set-rail",open:M})},B=M=>{a(M),C({v:Nc,type:"set-edit-mode",enabled:M}),M&&h(!0),!M&&u&&!g&&!p&&V()};return{iframeRef:D,deckDetected:l,writable:e,displayedMarker:b===null?null:`${b}.${y}`,editMode:r,setEditMode:B,railOpen:d,setRailOpen:O,saving:p,agentUpdated:u,reload:V,postToIframe:C}}const Ode=300;function Ij({readUrl:t,marker:e,title:s,savePath:n,trailing:i}){const r=Ide({readUrl:t,statMarker:e,savePath:n}),[a,l]=T.useState(null);if(r.displayedMarker===null)return null;const c=t.includes("?")?"&":"?",d=`${t}${c}v=${encodeURIComponent(r.displayedMarker)}`,h=a===d;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(Ade,{readUrl:t,editor:r,downloadName:s.split("/").pop()??s,trailing:i}),o.jsx("div",{className:"relative flex-1",children:o.jsx("iframe",{ref:r.iframeRef,src:d,onLoad:()=>l(d),sandbox:"allow-scripts allow-downloads",className:re("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",h?"opacity-100":"opacity-0"),style:{transitionDuration:`${Ode}ms`},title:s},d)})]})}const $de=[{mode:"private",labelKey:"library.fileShareButton.modeOrgOnly",Icon:qu},{mode:"public",labelKey:"library.fileShareButton.modePublic",Icon:jn},{mode:"password",labelKey:"library.fileShareButton.modePassword",Icon:g9}];function Oj(t){const e=F.c(56),{volume:s,path:n,kind:i,shareMode:r,effectivePublic:a,url:l}=t,c=ae(),d=VP(s),{data:h}=gg(s,n),u=h?.shareMode??r,p=(h?.effectivePublic??a)&&u==="private",m=i==="dir",g=m?"folder":"file",[x,b]=T.useState(!1),[v,L]=T.useState(""),[_,y]=T.useState(!1);let w;e[0]!==n||e[1]!==d||e[2]!==g||e[3]!==c?(w=(M,z)=>{d.mutate({path:n,mode:M,password:z},{onSuccess:()=>{b(!1),L(""),ye.success(M==="private"?c("library.fileShareButton.toastOrgOnly",{subject:g}):M==="public"?c("library.fileShareButton.toastPublic",{subject:g}):c("library.fileShareButton.toastPassword",{subject:g}))},onError:$=>ye.error($ instanceof Error?$.message:c("library.fileShareButton.failedUpdateSharing"))})},e[0]=n,e[1]=d,e[2]=g,e[3]=c,e[4]=w):w=e[4];const S=w;let k;e[5]!==S?(k=M=>{if(M==="password"){b(!0);return}b(!1),S(M)},e[5]=S,e[6]=k):k=e[6];const j=k,C=x?"password":u;let V;e[7]!==c||e[8]!==l?(V=async()=>{l&&(await navigator.clipboard.writeText(l),y(!0),ye.success(c("library.fileShareButton.linkCopied")),setTimeout(()=>y(!1),2e3))},e[7]=c,e[8]=l,e[9]=V):V=e[9];const N=V;let A;e[10]!==_||e[11]!==N||e[12]!==c||e[13]!==l?(A=l?o.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-input bg-muted/50 px-2 py-1.5",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l}),o.jsx(me,{variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:N,"aria-label":c("library.fileShareButton.copyLink"),children:_?o.jsx(Gt,{size:12,className:"text-success"}):o.jsx(bn,{size:12})})]}):null,e[10]=_,e[11]=N,e[12]=c,e[13]=l,e[14]=A):A=e[14];const P=A;if(p){let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:o.jsx(jn,{size:16})}),e[15]=M):M=e[15];let z;e[16]!==c?(z=c("library.fileShareButton.sharedViaParent"),e[16]=c,e[17]=z):z=e[17];let $;e[18]!==z?($=o.jsx("span",{className:"text-sm font-medium text-foreground",children:z}),e[18]=z,e[19]=$):$=e[19];const U=m?"files in this folder":"this file";let H;e[20]!==c||e[21]!==U?(H=c("library.fileShareButton.inheritedDescription",{target:U}),e[20]=c,e[21]=U,e[22]=H):H=e[22];let W;e[23]!==H?(W=o.jsx("span",{className:"text-xs text-muted-foreground",children:H}),e[23]=H,e[24]=W):W=e[24];let K;e[25]!==W||e[26]!==$?(K=o.jsxs("div",{className:"flex items-start gap-3",children:[M,o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[$,W]})]}),e[25]=W,e[26]=$,e[27]=K):K=e[27];let G;return e[28]!==P||e[29]!==K?(G=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[K,P]}),e[28]=P,e[29]=K,e[30]=G):G=e[30],G}let R;e[31]!==C||e[32]!==j||e[33]!==d.isPending||e[34]!==c?(R=$de.map(M=>{const{mode:z,labelKey:$,Icon:U}=M;return o.jsxs("button",{type:"button",disabled:d.isPending,onClick:()=>j(z),className:re("flex flex-col items-center gap-1 rounded-md px-2 py-2 text-xs font-medium transition-colors disabled:opacity-60",C===z?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(U,{size:15}),c($)]},z)}),e[31]=C,e[32]=j,e[33]=d.isPending,e[34]=c,e[35]=R):R=e[35];let E;e[36]!==R?(E=o.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-muted p-1",children:R}),e[36]=R,e[37]=E):E=e[37];let I;e[38]!==C||e[39]!==m||e[40]!==c?(I=C==="private"?c("library.fileShareButton.privateDescription",{target:m?"these files":"this link"}):C==="public"?c(m?"library.fileShareButton.publicFolderDescription":"library.fileShareButton.publicFileDescription"):c("library.fileShareButton.passwordDescription",{target:m?"files in this folder":"this file"}),e[38]=C,e[39]=m,e[40]=c,e[41]=I):I=e[41];let D;e[42]!==I?(D=o.jsx("p",{className:"text-xs text-muted-foreground",children:I}),e[42]=I,e[43]=D):D=e[43];let O;e[44]!==C||e[45]!==S||e[46]!==u||e[47]!==v||e[48]!==d.isPending||e[49]!==c?(O=C==="password"&&o.jsxs("form",{className:"flex items-center gap-2",onSubmit:M=>{M.preventDefault(),v&&S("password",v)},children:[o.jsx(vt,{type:"password",value:v,onChange:M=>L(M.target.value),placeholder:c(u==="password"?"library.fileShareButton.newPasswordPlaceholder":"library.fileShareButton.passwordPlaceholder"),autoComplete:"new-password",className:"h-8 text-xs"}),o.jsx(me,{type:"submit",size:"sm",className:"shrink-0",disabled:!v||d.isPending,children:c(u==="password"?"library.fileShareButton.buttonUpdate":"library.fileShareButton.buttonSet")})]}),e[44]=C,e[45]=S,e[46]=u,e[47]=v,e[48]=d.isPending,e[49]=c,e[50]=O):O=e[50];let B;return e[51]!==P||e[52]!==E||e[53]!==D||e[54]!==O?(B=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[E,D,O,P]}),e[51]=P,e[52]=E,e[53]=D,e[54]=O,e[55]=B):B=e[55],B}function Ip(t){const e=F.c(21),{volume:s,path:n,shareMode:i,effectivePublic:r,url:a}=t,l=ae();let c;e[0]!==l?(c=l("library.fileShareButton.share"),e[0]=l,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(WP,{size:14}),e[2]=d):d=e[2];let h;e[3]!==c?(h=o.jsx(He,{asChild:!0,children:o.jsx(ws,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":c,children:d})})}),e[3]=c,e[4]=h):h=e[4];let u;e[5]!==l?(u=l("library.fileShareButton.share"),e[5]=l,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx(Ke,{side:"bottom",children:u}),e[7]=u,e[8]=f):f=e[8];let p;e[9]!==h||e[10]!==f?(p=o.jsxs(We,{children:[h,f]}),e[9]=h,e[10]=f,e[11]=p):p=e[11];let m;e[12]!==r||e[13]!==n||e[14]!==i||e[15]!==a||e[16]!==s?(m=o.jsx(ks,{align:"end",className:"w-80 p-3",children:o.jsx(Oj,{volume:s,path:n,kind:"file",shareMode:i,effectivePublic:r,url:a})}),e[12]=r,e[13]=n,e[14]=i,e[15]=a,e[16]=s,e[17]=m):m=e[17];let g;return e[18]!==p||e[19]!==m?(g=o.jsxs(js,{children:[p,m]}),e[18]=p,e[19]=m,e[20]=g):g=e[20],g}function Bde(t){const e=F.c(14),{target:s,onOpenChange:n}=t,i=ae(),r=!!s,a=s?.kind==="dir"?"folder":"file";let l;e[0]!==i||e[1]!==a?(l=i("library.fileShareButton.shareDialogTitle",{type:a}),e[0]=i,e[1]=a,e[2]=l):l=e[2];let c;e[3]!==l?(c=o.jsx(cs,{children:o.jsx(Kt,{children:l})}),e[3]=l,e[4]=c):c=e[4];let d;e[5]!==s?(d=s&&o.jsx(Oj,{...s}),e[5]=s,e[6]=d):d=e[6];let h;e[7]!==c||e[8]!==d?(h=o.jsxs(zt,{className:"sm:max-w-md",children:[c,d]}),e[7]=c,e[8]=d,e[9]=h):h=e[9];let u;return e[10]!==n||e[11]!==r||e[12]!==h?(u=o.jsx(Ft,{open:r,onOpenChange:n,children:h}),e[10]=n,e[11]=r,e[12]=h,e[13]=u):u=e[13],u}const cm="home";function zde(t){const e=F.c(5),{label:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(en,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=n):n=e[0];let i;e[1]!==s?(i=s&&o.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=i):i=e[2];let r;return e[3]!==i?(r=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[n,i]}),e[3]=i,e[4]=r):r=e[4],r}function Fde(t){const e=F.c(15),{path:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={refetchIntervalWhenAbsent:2e3},e[0]=n):n=e[0];const i=gg(cm,s,n),r=mg(cm)(s);if(i.isPending||!i.data){const f=!i.isPending&&!i.data?"Waiting for the deck to sync…":void 0;let p;return e[1]!==f?(p=o.jsx(zde,{label:f}),e[1]=f,e[2]=p):p=e[2],p}let a;e[3]!==i.data?(a=pg(i.data),e[3]=i.data,e[4]=a):a=e[4];const l=i.data.shareMode??"private",c=i.data.effectivePublic??!1,d=window.location.origin+r;let h;e[5]!==s||e[6]!==l||e[7]!==c||e[8]!==d?(h=o.jsx(Ip,{volume:cm,path:s,shareMode:l,effectivePublic:c,url:d}),e[5]=s,e[6]=l,e[7]=c,e[8]=d,e[9]=h):h=e[9];let u;return e[10]!==s||e[11]!==r||e[12]!==a||e[13]!==h?(u=o.jsx(Ij,{readUrl:r,marker:a,title:s,savePath:s,trailing:h}),e[10]=s,e[11]=r,e[12]=a,e[13]=h,e[14]=u):u=e[14],u}function Ude(t){const e=F.c(13),{previewPath:s}=t,n=ae(),i=Ks(),r=ia({strict:!1}).org??"";let a;e[0]!==s?(a=s.split("/").slice(0,-1).join("/"),e[0]=s,e[1]=a):a=e[1];const l=a;let c;e[2]!==i||e[3]!==r||e[4]!==l||e[5]!==s?(c=()=>{i({to:Ca.library,params:{org:r},search:{path:l||void 0,preview:s}})},e[2]=i,e[3]=r,e[4]=l,e[5]=s,e[6]=c):c=e[6];const d=c;let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Qo,{size:14}),e[7]=h):h=e[7];let u;e[8]!==n?(u=n("library.seeInLibrary.label"),e[8]=n,e[9]=u):u=e[9];let f;return e[10]!==d||e[11]!==u?(f=o.jsxs(me,{variant:"ghost",size:"sm",onClick:d,className:"shrink-0 gap-1.5 text-xs text-muted-foreground",children:[h,u]}),e[10]=d,e[11]=u,e[12]=f):f=e[12],f}const Hde=t=>/\.html?$/i.test(t);function Kv(t){const e=F.c(10),{onClose:s}=t,n=ae();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ii,{size:14}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:s,children:i})}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==n?(a=n("library.previewContent.close"),e[3]=n,e[4]=a):a=e[4];let l;e[5]!==a?(l=o.jsx(Ke,{side:"bottom",children:a}),e[5]=a,e[6]=l):l=e[6];let c;return e[7]!==r||e[8]!==l?(c=o.jsxs(We,{children:[r,l]}),e[7]=r,e[8]=l,e[9]=c):c=e[9],c}function $j(t){const e=F.c(67),{previewPath:s,onClose:n,showSeeInLibrary:i,variant:r}=t,a=i===void 0?!1:i,l=ae();let c;e[0]!==s?(c=Ng(s),e[0]=s,e[1]=c):c=e[1];const d=c,{volume:h,dirPath:u}=d,{data:f,isPending:p}=gg(h,u),m=mg(h??"");let g,x,b,v,L,_,y,w,S;if(e[2]!==m||e[3]!==f||e[4]!==u||e[5]!==n||e[6]!==s||e[7]!==a||e[8]!==r||e[9]!==h){S=Symbol.for("react.early_return_sentinel");e:{x=cn(u),b=r==="dialog";let P;e[19]!==s||e[20]!==a?(P=a?o.jsx(Ude,{previewPath:s}):null,e[19]=s,e[20]=a,e[21]=P):P=e[21];const R=P;if(g=f&&f.kind==="file"?{key:s,filename:x,size:f.size,downloadUrl:m(f.path)}:null,g&&f&&Hde(x)){const I=g.downloadUrl;let D;e[22]!==f?(D=pg(f),e[22]=f,e[23]=D):D=e[23];const O=h??"",B=f.shareMode??"private",M=f.effectivePublic??!1,z=window.location.origin+g.downloadUrl;let $;e[24]!==u||e[25]!==O||e[26]!==B||e[27]!==M||e[28]!==z?($=o.jsx(Ip,{volume:O,path:u,shareMode:B,effectivePublic:M,url:z}),e[24]=u,e[25]=O,e[26]=B,e[27]=M,e[28]=z,e[29]=$):$=e[29];let U;e[30]!==b||e[31]!==n?(U=b?o.jsx("div",{className:"w-8 shrink-0"}):o.jsx(Kv,{onClose:n}),e[30]=b,e[31]=n,e[32]=U):U=e[32];let H;e[33]!==R||e[34]!==$||e[35]!==U?(H=o.jsxs(o.Fragment,{children:[$,R,U]}),e[33]=R,e[34]=$,e[35]=U,e[36]=H):H=e[36],S=o.jsxs(o.Fragment,{children:[b&&o.jsx(Kt,{className:"sr-only",children:x}),o.jsx(Ij,{readUrl:I,marker:D,title:x,savePath:h==="home"?u:void 0,trailing:H},s)]});break e}const E=b?"h-11 py-1 pr-12 pl-2":"h-9 px-2";e[37]!==E?(w=re("flex shrink-0 items-center gap-1 border-b border-border/60",E),e[37]=E,e[38]=w):w=e[38],v="flex min-w-0 flex-1 items-center gap-2 px-2",L=o.jsx(Xo,{filename:x,className:"h-4.5 w-3.5 shrink-0"}),_=b?o.jsx(Kt,{className:"truncate text-xs font-medium text-foreground",children:x}):o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:x}),y=g&&o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:X8(g.size)})}e[2]=m,e[3]=f,e[4]=u,e[5]=n,e[6]=s,e[7]=a,e[8]=r,e[9]=h,e[10]=g,e[11]=x,e[12]=b,e[13]=v,e[14]=L,e[15]=_,e[16]=y,e[17]=w,e[18]=S}else g=e[10],x=e[11],b=e[12],v=e[13],L=e[14],_=e[15],y=e[16],w=e[17],S=e[18];if(S!==Symbol.for("react.early_return_sentinel"))return S;let k;e[39]!==v||e[40]!==L||e[41]!==_||e[42]!==y?(k=o.jsxs("div",{className:v,children:[L,_,y]}),e[39]=v,e[40]=L,e[41]=_,e[42]=y,e[43]=k):k=e[43];let j;e[44]!==f?.effectivePublic||e[45]!==f?.shareMode||e[46]!==g||e[47]!==u||e[48]!==l||e[49]!==h?(j=g&&o.jsxs(o.Fragment,{children:[o.jsx(Ip,{volume:h??"",path:u,shareMode:f?.shareMode??"private",effectivePublic:f?.effectivePublic??!1,url:window.location.origin+g.downloadUrl}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",asChild:!0,children:o.jsx("a",{href:g.downloadUrl,download:g.filename,children:o.jsx(Cu,{size:14})})})}),o.jsx(Ke,{side:"bottom",children:l("library.previewContent.download")})]}),o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>window.open(g.downloadUrl,"_blank","noopener"),children:o.jsx(hn,{size:14})})}),o.jsx(Ke,{side:"bottom",children:l("library.previewContent.openInNewTab")})]})]}),e[44]=f?.effectivePublic,e[45]=f?.shareMode,e[46]=g,e[47]=u,e[48]=l,e[49]=h,e[50]=j):j=e[50];let C;e[51]!==b||e[52]!==n?(C=!b&&o.jsx(Kv,{onClose:n}),e[51]=b,e[52]=n,e[53]=C):C=e[53];let V;e[54]!==j||e[55]!==C||e[56]!==w||e[57]!==k?(V=o.jsxs("div",{className:w,children:[k,j,C]}),e[54]=j,e[55]=C,e[56]=w,e[57]=k,e[58]=V):V=e[58];let N;e[59]!==g||e[60]!==x||e[61]!==p||e[62]!==l?(N=o.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:g?o.jsx(Q8,{file:g}):p?o.jsx(Y8,{}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[o.jsx(Xo,{filename:x,className:"h-7.5 w-6"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:l("library.previewContent.fileNotAvailable")})]})}),e[59]=g,e[60]=x,e[61]=p,e[62]=l,e[63]=N):N=e[63];let A;return e[64]!==V||e[65]!==N?(A=o.jsxs(o.Fragment,{children:[V,N]}),e[64]=V,e[65]=N,e[66]=A):A=e[66],A}function Kde(t){const e=F.c(4),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let a;return e[0]!==n||e[1]!==s||e[2]!==r?(a=o.jsx("div",{className:"flex h-full w-full flex-col bg-background",children:o.jsx($j,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"panel"})}),e[0]=n,e[1]=s,e[2]=r,e[3]=a):a=e[3],a}function Wde(t){const e=F.c(5),{path:s}=t,{closePanel:n}=Di();let i;e[0]!==n?(i=()=>n(),e[0]=n,e[1]=i):i=e[1];const r=i;let a;return e[2]!==r||e[3]!==s?(a=o.jsx(Kde,{previewPath:s,onClose:r,showSeeInLibrary:!0}),e[2]=r,e[3]=s,e[4]=a):a=e[4],a}function qde(t){const e=t("library.brandComponentsPreview.title"),s=t("library.brandComponentsPreview.subtitle"),n=t("library.brandComponentsPreview.monthlySavingsLabel"),i=t("library.brandComponentsPreview.primaryButton"),r=t("library.brandComponentsPreview.secondaryButton"),a=t("library.brandComponentsPreview.ghostButton"),l=t("library.brandComponentsPreview.successBadge"),c=t("library.brandComponentsPreview.warningBadge"),d=t("library.brandComponentsPreview.errorBadge"),h=t("library.brandComponentsPreview.infoBadge"),u=t("library.brandComponentsPreview.allChip"),f=t("library.brandComponentsPreview.incomeChip"),p=t("library.brandComponentsPreview.spendingChip"),m=t("library.brandComponentsPreview.emailPlaceholder");return`
656
656
  <div class="stack">
@@ -812,7 +812,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
812
812
  <p class="cta">slides-create --theme &hellip;</p>
813
813
  </section>`].join(`
814
814
 
815
- `);function Zde(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Jde).replaceAll("{{title}}",Xde).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function eue(t){const e=F.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=ju(s),a=ju(i??"");if(r.isPending||i&&a.isPending){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(en,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=h):h=e[0],h}if(r.isError||!r.data){let h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=h):h=e[1],h}const l=a.data??null;let c;e[2]!==l||e[3]!==r.data?(c=Zde(r.data,l),e[2]=l,e[3]=r.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=o.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function Jd(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function tue(t){const e=F.c(16),{family:s,tokens:n,editing:i,valueOf:r,onEdit:a}=t;let l;e[0]!==s?(l=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=l):l=e[1];let c;if(e[2]!==i||e[3]!==a||e[4]!==n||e[5]!==r){let u;e[7]!==i||e[8]!==a||e[9]!==r?(u=f=>{const p=r(f),m=`${f.name.replace(/^--brand-/,"")}: ${p}`;return i&&/^#/.test(p)?o.jsx("input",{type:"color","aria-label":f.name,title:m,value:ZE(p),onChange:g=>a(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):o.jsx("span",{title:m,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:p}},f.name)},e[7]=i,e[8]=a,e[9]=r,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=a,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,d]}),e[13]=l,e[14]=d,e[15]=h):h=e[15],h}function sue(t){const e=F.c(9),{token:s,value:n}=t;if(s.kind==="space"){let r;return e[0]!==n?(r=o.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:o.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=r):r=e[1],r}if(s.kind==="radius"){let r;return e[2]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=r):r=e[3],r}if(s.kind==="shadow"){let r;return e[4]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=r):r=e[5],r}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const r=`min(${n}, 22px)`;let a;return e[6]!==r?(a=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:r},children:"Ag"}),e[6]=r,e[7]=a):a=e[7],a}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function Bj(t){const e=F.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let a;e[0]!==s||e[1]!==n?(a=o.jsx(sue,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=a):a=e[2];let l;if(e[3]!==s.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],l=s.name.replace(u,""),e[3]=s.name,e[4]=l}else l=e[4];let c;e[6]!==l?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:l}),e[6]=l,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==r||e[10]!==s.name||e[11]!==n?(d=i?o.jsx(vt,{value:n,onChange:u=>r(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=r,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==a||e[14]!==c||e[15]!==d?(h=o.jsxs("div",{className:"flex items-center gap-3",children:[a,c,d]}),e[13]=a,e[14]=c,e[15]=d,e[16]=h):h=e[16],h}function Md(t){const e=F.c(16),{label:s,tokens:n,editing:i,valueOf:r,onEdit:a}=t;if(n.length===0)return null;let l;e[0]!==s?(l=o.jsx(Jd,{children:s}),e[0]=s,e[1]=l):l=e[1];let c;if(e[2]!==i||e[3]!==a||e[4]!==n||e[5]!==r){let u;e[7]!==i||e[8]!==a||e[9]!==r?(u=f=>o.jsx(Bj,{token:f,value:r(f),editing:i,onEdit:a},f.name),e[7]=i,e[8]=a,e[9]=r,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=a,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-3",children:[l,d]}),e[13]=l,e[14]=d,e[15]=h):h=e[15],h}function nue({brandPath:t,onClose:e,variant:s}){const n=ae(),{org:i}=Ue(),r=Ng(t),a=r.volume??"",l=r.dirPath,c=cn(l),d=r.readOnly,h=Vs(),u=o0(),f=T8(a),{upload:p,remove:m}=ku(a),g=T.useRef(null),x=A8(a,l),b=x.data??[],v=q=>b.some(fe=>fe.kind==="file"&&cn(fe.path)===q),L=v("tokens.css"),_=v("brand.md"),y=v("slides-theme.html"),w=YE(b),S=u(a,`${l}/tokens.css`),k=u(a,`${l}/brand.md`),j=u(a,`${l}/slides-theme.html`),C=ju(S,{enabled:L}),V=ju(k,{enabled:_}),[N,A]=T.useState(!1),[P,R]=T.useState({}),[E,I]=T.useState(null),[D,O]=T.useState(!1),[B,M]=T.useState(!1),[z,$]=T.useState("deck"),U=C.data?QE(C.data):[],H=q=>U.find(fe=>fe.name===q)?.value,W=q=>P[q.name]??q.value,K=XE(U),G=U.filter(q=>q.kind==="font"),Y=U.filter(q=>q.kind==="type"),Z=U.filter(q=>q.kind==="space"),te=U.filter(q=>q.kind==="radius"),X=U.filter(q=>q.kind==="shadow"),ee=U.filter(q=>q.kind==="motion"),J=U.filter(q=>q.kind==="other"),Q=(q,fe)=>R(ge=>({...ge,[q]:fe})),oe=y&&z==="deck",le=E??V.data??"",de=Object.entries(P).filter(([q,fe])=>H(q)!==fe),se=E!==null&&E!==(V.data??""),ie=de.length>0||se;function he(){R({}),I(null),A(!1)}async function ue(){O(!0);try{if(de.length>0){let q=C.data??"";for(const[fe,ge]of de)q=JE(q,fe,ge);await f.mutateAsync({path:`${l}/tokens.css`,body:q,contentType:"text/css; charset=utf-8"}),h.invalidateQueries({queryKey:tt.fileText(S)})}se&&E!==null&&(await f.mutateAsync({path:`${l}/brand.md`,body:E,contentType:"text/markdown; charset=utf-8"}),h.invalidateQueries({queryKey:tt.fileText(k)})),h.invalidateQueries({queryKey:tt.orgFsVolume(i.id,a)}),h.invalidateQueries({queryKey:tt.orgFsRecent(i.id)}),R({}),I(null),A(!1),ye.success(n("library.brandPreview.brandSaved"))}catch(q){ye.error(q instanceof Error?q.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function ce(q){const fe=q?.[0];if(!fe)return;const _e=`logo.${(fe.name.split(".").pop()??"png").toLowerCase()}`;try{await p.mutateAsync({dir:l,files:[new File([fe],_e,{type:fe.type})]}),w&&cn(w)!==_e&&await m.mutateAsync(w),ye.success(n("library.brandPreview.logoUpdated"))}catch(Le){ye.error(Le instanceof Error?Le.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ne=!x.isPending&&!L&&!_&&!w;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:o.jsx(Ym,{size:18})}),s==="dialog"?o.jsx(Kt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):o.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(N?o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"ghost",size:"sm",onClick:he,disabled:D,children:n("library.brandPreview.cancel")}),o.jsx(me,{size:"sm",disabled:!ie||D,onClick:()=>{ue()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[o.jsx(wA,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(bT,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(nn,{size:16})})}):o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(nn,{size:16})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?o.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[o.jsx(en,{className:"h-40 w-full rounded-xl"}),o.jsx(en,{className:"h-4 w-1/3"}),o.jsx(en,{className:"h-4 w-2/3"})]}):ne?o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):o.jsxs(o.Fragment,{children:[(y||L)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(B?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(q=>!q),onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),M(fe=>!fe))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:q=>q.stopPropagation(),children:[y&&o.jsx("button",{type:"button",onClick:()=>{$("deck"),M(!1)},className:re("rounded-md px-2.5 py-1",oe?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),o.jsx("button",{type:"button",onClick:()=>{$("components"),M(!1)},className:re("rounded-md px-2.5 py-1",oe?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),B?o.jsx(hs,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(F6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!B&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:re("w-full overflow-hidden rounded-xl border border-border bg-muted/30",oe?"aspect-[16/9]":"h-96"),children:oe?o.jsx(eue,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):o.jsx(Qde,{tokensUrl:S})})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jd,{children:n("library.brandPreview.logo")}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:w?o.jsx("img",{src:u(a,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(Ym,{size:28,className:"text-muted-foreground/50"})}),N&&o.jsxs("div",{children:[o.jsxs(me,{variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Gn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:q=>{ce(q.target.files)}})]})]})]}),K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jd,{children:n("library.brandPreview.colors")}),K.map(q=>o.jsx(tue,{family:q.family,tokens:q.tokens,editing:N,valueOf:W,onEdit:Q},q.family))]}),(G.length>0||Y.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jd,{children:n("library.brandPreview.typography")}),G.map(q=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:q.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),N?o.jsx(vt,{value:W(q),onChange:fe=>Q(q.name,fe.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(q)},children:W(q)})]},q.name)),Y.map(q=>o.jsx(Bj,{token:q,value:W(q),editing:N,onEdit:Q},q.name))]}),o.jsx(Md,{label:n("library.brandPreview.spacing"),tokens:Z,editing:N,valueOf:W,onEdit:Q}),o.jsx(Md,{label:n("library.brandPreview.radius"),tokens:te,editing:N,valueOf:W,onEdit:Q}),o.jsx(Md,{label:n("library.brandPreview.shadows"),tokens:X,editing:N,valueOf:W,onEdit:Q}),o.jsx(Md,{label:n("library.brandPreview.motion"),tokens:ee,editing:N,valueOf:W,onEdit:Q}),o.jsx(Md,{label:n("library.brandPreview.tokens"),tokens:J,editing:N,valueOf:W,onEdit:Q}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jd,{children:n("library.brandPreview.voiceGuidelines")}),N?o.jsx(Jo,{value:le,onChange:q=>I(q.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):V.isPending&&_?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(en,{className:"h-3 w-full"}),o.jsx(en,{className:"h-3 w-5/6"})]}):le.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(cd,{id:`brand-preview-${t}`,text:le})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function zj(t){const e=F.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=l=>{l||n()},e[0]=n,e[1]=i):i=e[1];let r;e[2]!==s||e[3]!==n?(r=o.jsx(zt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:o.jsx(nue,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let a;return e[5]!==i||e[6]!==r?(a=o.jsx(Ft,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=a):a=e[7],a}function Fj(t){const e=F.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let a;e[0]!==n?(a=d=>{d||n()},e[0]=n,e[1]=a):a=e[1];let l;e[2]!==n||e[3]!==s||e[4]!==r?(l=o.jsx(zt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx($j,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==a||e[7]!==l?(c=o.jsx(Ft,{open:!0,onOpenChange:a,children:l}),e[6]=a,e[7]=l,e[8]=c):c=e[8],c}function iue(t){const e=F.c(11),{onOpenDir:s}=t,n=ae(),i=eR();let r;e[0]!==i.data?(r=i.data??[],e[0]=i.data,e[1]=r):r=e[1];let a;if(e[2]!==s||e[3]!==n||e[4]!==r){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(m0,{name:d.volume,glyph:qr,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:k7(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],a=r.map(c),e[2]=s,e[3]=n,e[4]=r,e[5]=a}else a=e[5];let l;return e[9]!==a?(l=o.jsx(o.Fragment,{children:a}),e[9]=a,e[10]=l):l=e[10],l}function S4(t){return`${window.location.origin}${t}`}function yu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const rue=[Nu,"uploads","outputs"],Uj=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Gn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Fr}],Op=new Set([...Uj.map(t=>t.volume),Wc("public")]),oue=6;function Hj(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=Z8(t),r=i?`public/${i}`:t==="home"?Vu(s):t;return n?`${r}/${n}`:r}function vh(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const i=n.dataTransfer.getData("application/x-studio-library-path");i&&i!==t&&!t.startsWith(i+"/")&&s.onDrop(i,t)}:void 0}}function Mo(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Mr(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"@container",children:o.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function J9(t){const e=F.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx(Mr,{children:Array.from({length:n*3},aue)}),e[0]=n,e[1]=i):i=e[1],i}function aue(t,e){return o.jsx(en,{className:"h-16 rounded-2xl"},e)}function k4(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function lue(t){const e=F.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,a=ae(),l=AP(s);let c;e[0]!==a||e[1]!==l.data?(c=l.data?a("library.libraryViews.filesCount",{count:l.data.files}):void 0,e[0]=a,e[1]=l.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==a?(d=a(n),e[3]=n,e[4]=a,e[5]=d):d=e[5];let h;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(h=o.jsx(m0,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:r}),e[6]=i,e[7]=r,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11],h}function cue(t){const e=F.c(12),{onOpenDir:s}=t,n=ae(),r=P8().data?.length??0;let a;e[0]!==s?(a=Uj.map(h=>o.jsx(lue,{volume:h.volume,descriptionKey:h.descriptionKey,glyph:h.glyph,onOpen:()=>s(h.volume)},h.volume)),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==r||e[4]!==n?(l=r>0&&o.jsx(m0,{name:Wc("public"),meta:n("library.libraryViews.skillSetsCount",{count:r}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:hr,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=r,e[4]=n,e[5]=l):l=e[5];let c;e[6]!==s?(c=o.jsx(iue,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==l||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[a,l,c]}),e[8]=a,e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function due(t){const e=F.c(19),{segments:s,onNavigate:n}=t,{org:i}=Ue();let r;e[0]!==s?(r=s[0]===Nu?s.slice(1):s,e[0]=s,e[1]=r):r=e[1];const a=r,l=s.length-a.length,c=a.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?o.jsx("span",{className:"truncate font-medium text-foreground",children:Vu(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Nu),children:Vu(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let h;if(e[6]!==l||e[7]!==n||e[8]!==a||e[9]!==s){let f;e[11]!==l||e[12]!==n||e[13]!==a.length||e[14]!==s?(f=(p,m)=>{const g=s.slice(0,l+m+1).join("/"),x=m===a.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(Ns,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Wc(p)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Wc(p)})]},g)},e[11]=l,e[12]=n,e[13]=a.length,e[14]=s,e[15]=f):f=e[15],h=a.map(f),e[6]=l,e[7]=n,e[8]=a,e[9]=s,e[10]=h}else h=e[10];let u;return e[16]!==d||e[17]!==h?(u=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,h]}),e[16]=d,e[17]=h,e[18]=u):u=e[18],u}function uue(t){const e=F.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:a,onDelete:l}=t,c=ae(),{org:d}=Ue(),h=o0(),u=TP(s,n);let f;e[0]!==h||e[1]!==a?(f=S=>a({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:S4(h(S.volume,S.path))}),e[0]=h,e[1]=a,e[2]=f):f=e[2];const p=f;if(u.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(J9,{rows:2}),e[3]=S):S=e[3],S}let m,g,x,b,v;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(k4,{children:k}),e[17]=k,e[18]=j):j=e[18],v=j;break e}const S=(i||u.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=re("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],m=Mo,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=u.data,e[6]=u.isPlaceholderData,e[7]=i,e[8]=c,e[9]=m,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else m=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let L;e[21]!==m||e[22]!==x?(L=o.jsx(m,{children:x}),e[21]=m,e[22]=x,e[23]=L):L=e[23];let _;if(e[24]!==h||e[25]!==l||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==p){let S;e[31]!==h||e[32]!==l||e[33]!==r||e[34]!==d||e[35]!==p?(S=k=>{const j=Z8(k.volume)!==null;return o.jsx(j7,{filename:cn(k.path),updatedAt:k.updatedAt,downloadUrl:h(k.volume,k.path),subtitle:Hj(k.volume,k.path,d.slug),publicState:yu(k),onOpen:()=>r(e7(k.volume,k.path)),onShare:j?void 0:()=>p(k),onDelete:j?void 0:()=>l({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=h,e[32]=l,e[33]=r,e[34]=d,e[35]=p,e[36]=S):S=e[36],_=g.map(S),e[24]=h,e[25]=l,e[26]=r,e[27]=d,e[28]=g,e[29]=p,e[30]=_}else _=e[30];let y;e[37]!==_?(y=o.jsx(Mr,{children:_}),e[37]=_,e[38]=y):y=e[38];let w;return e[39]!==b||e[40]!==L||e[41]!==y?(w=o.jsxs("div",{className:b,children:[L,y]}),e[39]=b,e[40]=L,e[41]=y,e[42]=w):w=e[42],w}function hue(t){const e=F.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=ae(),{org:a}=Ue(),l=V8(),c=o0();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:S4(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const h=d;if(l.isPending){let v;e[3]!==r?(v=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=v):v=e[4];let L;e[5]!==v?(L=o.jsx(Mo,{children:v}),e[5]=v,e[6]=L):L=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(J9,{}),e[7]=_):_=e[7];let y;return e[8]!==L?(y=o.jsxs("div",{className:"flex flex-col gap-3",children:[L,_]}),e[8]=L,e[9]=y):y=e[9],y}let u,f,p,m,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==a||e[14]!==l.data||e[15]!==h||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const v=(l.data??[]).slice(0,oue);if(v.length===0){g=null;break e}p="flex flex-col gap-3";let L;e[22]!==r?(L=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=L):L=e[23],e[24]!==L?(m=o.jsx(Mo,{children:L}),e[24]=L,e[25]=m):m=e[25],u=Mr;let _;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==a||e[30]!==h?(_=y=>o.jsx(nR,{filename:cn(y.path),updatedAt:y.updatedAt,size:y.size,downloadUrl:c(y.volume,y.path),subtitle:Hj(y.volume,y.path,a.slug),publicState:yu(y),onOpen:()=>s(e7(y.volume,y.path)),onShare:()=>h(y),onDelete:()=>i({volume:y.volume,path:y.path,kind:"file"})},`${y.volume}/${y.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=a,e[30]=h,e[31]=_):_=e[31],f=v.map(_)}e[10]=c,e[11]=i,e[12]=s,e[13]=a,e[14]=l.data,e[15]=h,e[16]=r,e[17]=u,e[18]=f,e[19]=p,e[20]=m,e[21]=g}else u=e[17],f=e[18],p=e[19],m=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==f?(x=o.jsx(u,{children:f}),e[32]=u,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==p||e[36]!==m||e[37]!==x?(b=o.jsxs("div",{className:p,children:[m,x]}),e[35]=p,e[36]=m,e[37]=x,e[38]=b):b=e[38],b}function fue(t){const e=F.c(16),{onOpenDir:s}=t,n=ae(),i=P8();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(J9,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.data?(r=i.data??[],e[1]=i.data,e[2]=r):r=e[2];const a=r;if(a.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let h;return e[5]!==d?(h=o.jsx(k4,{children:d}),e[5]=d,e[6]=h):h=e[6],h}let l;if(e[7]!==s||e[8]!==a||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=h=>o.jsx(m0,{name:h,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${h}`)},h),e[11]=s,e[12]=n,e[13]=d):d=e[13],l=a.map(d),e[7]=s,e[8]=a,e[9]=n,e[10]=l}else l=e[10];let c;return e[14]!==l?(c=o.jsx(Mr,{children:l}),e[14]=l,e[15]=c):c=e[15],c}function mue(t){const e=F.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:a,onShare:l,onDelete:c,onDragStart:d,onContextMenu:h,onMove:u}=t,f=ae(),{org:p}=Ue(),m=s.volume??"",g=A8(m,s.dirPath),x=o0();let b;e[0]!==s.isHomeRoot||e[1]!==p?(b=N=>s.isHomeRoot&&Op.has(N.toLowerCase())?`${Vu(p.slug)}/${N}`:void 0,e[0]=s.isHomeRoot,e[1]=p,e[2]=b):b=e[2];const v=b;let L;e[3]!==s.isHomeRoot||e[4]!==n?(L=s.isHomeRoot?o.jsx(cue,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=L):L=e[5];const _=L;if(g.isPending){let N;e[6]!==_||e[7]!==f?(N=_&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.folders")}),o.jsx(Mr,{children:_})]}),e[6]=_,e[7]=f,e[8]=N):N=e[8];let A;e[9]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(J9,{rows:2}),e[9]=A):A=e[9];let P;return e[10]!==N?(P=o.jsxs(o.Fragment,{children:[N,A]}),e[10]=N,e[11]=P):P=e[11],P}if(g.isError){let N;e[12]!==g.error||e[13]!==f?(N=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=N):N=e[14];let A;return e[15]!==N?(A=o.jsx("p",{className:"text-sm text-destructive",children:N}),e[15]=N,e[16]=A):A=e[16],A}let y,w,S,k,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==h||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==a||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==l||e[30]!==_||e[31]!==f||e[32]!==m){j=Symbol.for("react.early_return_sentinel");e:{const N=g.data??[],A=N.filter(bue),P=N.filter(xue),R=N.filter(gue),E=N.filter(pue);if(N.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==f?(M=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=M):M=e[40];let z;e[41]!==M?(z=o.jsx(k4,{children:M}),e[41]=M,e[42]=z):z=e[42],j=z;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==m?(I=M=>s.readOnly?void 0:()=>c({volume:m,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=m,e[46]=I):I=e[46];const D=I;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==l||e[50]!==m?(O=M=>s.readOnly?void 0:()=>l({volume:m,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?S4(x(m,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=l,e[50]=m,e[51]=O):O=e[51];const B=O;y=A.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.skills")}),o.jsx(Mr,{children:A.map(M=>o.jsx(tR,{dirName:cn(M.path),updatedAt:M.updatedAt,skillMdUrl:x(m,`${M.path}/SKILL.md`),publicState:yu(M),onOpen:()=>r(gc(s,M.path)),onBrowse:()=>n(gc(s,M.path)),onShare:B(M),onDelete:D(M),draggable:!s.readOnly,...vh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),w=P.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.brands")}),o.jsx(Mr,{children:P.map(M=>o.jsx(sR,{dirName:cn(M.path),updatedAt:M.updatedAt,tokensUrl:x(m,`${M.path}/tokens.css`),onOpen:()=>a(gc(s,M.path)),onBrowse:()=>n(gc(s,M.path)),onDelete:D(M),draggable:!s.readOnly,...vh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),S=(R.length>0||_)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.folders")}),o.jsxs(Mr,{children:[_,R.map(M=>o.jsx(m0,{name:cn(M.path),meta:k7(M.updatedAt),subtitle:v(cn(M.path)),readOnly:s.readOnly,publicState:yu(M),onOpen:()=>n(gc(s,M.path)),onShare:B(M),onDelete:D(M),draggable:!s.readOnly,...vh(M.path,"dir",{onDragStart:d,onContextMenu:h,onDrop:u})},M.path))]})]}),k=E.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.files")}),o.jsx(Mr,{children:E.map(M=>o.jsx(j7,{filename:cn(M.path),updatedAt:M.updatedAt,downloadUrl:x(m,M.path),publicState:yu(M),onOpen:()=>i(gc(s,M.path)),onShare:B(M),onDelete:D(M),draggable:!s.readOnly,...vh(M.path,"file",{onDragStart:d,onContextMenu:h})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=h,e[22]=c,e[23]=d,e[24]=u,e[25]=a,e[26]=n,e[27]=i,e[28]=r,e[29]=l,e[30]=_,e[31]=f,e[32]=m,e[33]=y,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else y=e[33],w=e[34],S=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let C;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==l?(C=s.isHomeRoot&&o.jsx(hue,{onOpenFile:i,onShare:l,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=l,e[56]=C):C=e[56];let V;return e[57]!==y||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==C?(V=o.jsxs(o.Fragment,{children:[y,w,S,k,C]}),e[57]=y,e[58]=w,e[59]=S,e[60]=k,e[61]=C,e[62]=V):V=e[62],V}function pue(t){return t.kind==="file"}function gue(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function xue(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function bue(t){return t.kind==="dir"&&t.hasSkill}function vue({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=ae(),{org:i}=Ue(),r=Vs(),a=Ks(),l=Za(),c=pr({strict:!1}),d=c.path||Nu,h=Ng(d),u=iR(),f=h.volume!==null&&u.has(h.volume)?{...h,readOnly:!0}:h,p=(q,fe)=>a({to:".",search:ge=>({...ge,[q]:fe||void 0})}),m=q=>p("path",q),g=(q,fe)=>a({to:".",search:ge=>({...ge,preview:void 0,skill:void 0,brand:void 0,[q]:fe})}),x=t??(q=>g("preview",q)),b=e??(q=>g("skill",q)),v=s??(q=>g("brand",q)),[L,_]=T.useState(""),y=L9(L.trim(),300),w=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,S=w?n("library.library.searchInPlaceholder",{folder:Wc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?Vu(i.slug):Wc(f.segments.at(-1)??""),[j,C]=T.useState(null),[V,N]=T.useState(null),[A,P]=T.useState(!1),[R,E]=T.useState(""),[I,D]=T.useState(!1),[O,B]=T.useState(null),[M,z]=T.useState(""),$=T.useRef(null),[U,H]=T.useState(!1),W=T.useRef(0),K=f.readOnly?null:f.volume,{upload:G,mkdir:Y,move:Z}=ku(K??Nu),{remove:te}=ku(j?.volume??"uploads");async function X(q){if(!(!K||!q||q.length===0))try{await G.mutateAsync({dir:f.dirPath,files:[...q]}),ye.success(q.length===1?n("library.library.uploadedSingle",{filename:q[0]?.name??""}):n("library.library.uploadedMultiple",{count:q.length}))}catch(fe){ye.error(fe instanceof Error?fe.message:n("library.library.uploadFailed"))}finally{$.current&&($.current.value="")}}const ee=K!==null;function J(q){return q.dataTransfer.types.includes("Files")}function Q(q){!ee||!J(q)||(q.preventDefault(),W.current+=1,H(!0))}function oe(q){!ee||!J(q)||q.preventDefault()}function le(){ee&&(W.current=Math.max(0,W.current-1),W.current===0&&H(!1))}function de(q){ee&&(q.preventDefault(),q.stopPropagation(),W.current=0,H(!1),q.dataTransfer.files.length>0&&X(q.dataTransfer.files))}async function se(){const q=R.trim();if(!(!K||!q)){if(f.isHomeRoot&&Op.has(q.toLowerCase())){ye.error(n("library.library.folderNameReserved",{name:q}));return}try{const fe=f.dirPath;await Y.mutateAsync(fe?`${fe}/${q}`:q),ye.success(n("library.library.folderCreated",{name:q})),P(!1),E("")}catch(fe){ye.error(fe instanceof Error?fe.message:n("library.library.folderCreateFailed"))}}}async function ie(){if(!j)return;const q=j;try{await te.mutateAsync(q.path),ye.success(n("library.library.deleted",{name:cn(q.path)}))}catch(fe){ye.error(fe instanceof Error?fe.message:n("library.library.deleteFailed"))}finally{C(null)}}async function he(){if(!O)return;const q=M.trim();if(!q||q.includes("/")||q.includes("..")||q===cn(O.path)){D(!1),B(null),z("");return}if(O.kind==="dir"&&f.isHomeRoot&&Op.has(q.toLowerCase())){ye.error(n("library.library.folderNameReserved",{name:q}));return}try{const fe=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",ge=fe?`${fe}/${q}`:q;await Z.mutateAsync({from:O.path,to:ge});const _e=q.replace(/[<>]/g,"");ye.success(n("library.library.renamed",{name:_e}))}catch(fe){ye.error(fe instanceof Error?fe.message:n("library.library.renameFailed"))}finally{D(!1),B(null),z("")}}async function ue(q,fe){try{const ge=cn(q),_e=fe?`${fe}/${ge}`:ge;await Z.mutateAsync({from:q,to:_e}),ye.success(n("library.library.moved",{name:ge,destination:fe||n("library.library.theLibrary")}))}catch(ge){ye.error(ge instanceof Error?ge.message:n("library.library.moveFailed"))}}function ce(){for(const q of rue)r.invalidateQueries({queryKey:tt.orgFsVolume(i.id,q)});f.volume&&r.invalidateQueries({queryKey:tt.orgFsVolume(i.id,f.volume)}),r.invalidateQueries({queryKey:tt.orgFsRecent(i.id)}),r.invalidateQueries({queryKey:tt.orgFsSearchRoot(i.id)}),r.invalidateQueries({queryKey:tt.orgFsPublicSets(i.id)})}function ne(q){q.defaultPrevented||!K||q.target.closest("input, textarea, button, a, [role='button']")||(q.preventDefault(),P(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:Q,onDragOver:oe,onDragLeave:le,onDrop:de,onContextMenu:ne,children:[U&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[o.jsx(Gn,{size:28,className:"text-primary"}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:k})})]})}),o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:o.jsx(due,{segments:f.segments,onNavigate:m})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(u0,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(vt,{value:L,onChange:q=>_(q.target.value),onKeyDown:q=>{q.key==="Escape"&&_("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),L&&o.jsx(me,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>_(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(ii,{size:14})})]}),o.jsx(me,{variant:"ghost",size:"icon",onClick:ce,"aria-label":n("library.library.refresh"),children:o.jsx(Dn,{size:14})}),K&&o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>P(!0),children:[o.jsx(Qt,{size:14}),n("library.library.newFolder")]}),f.readOnly?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(h0,{size:12}),n("library.library.readOnly")]}):o.jsxs(me,{size:"sm",disabled:G.isPending,onClick:()=>$.current?.click(),children:[o.jsx(Gn,{size:14}),G.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:$,type:"file",multiple:!0,className:"hidden",onChange:q=>{X(q.target.files)}})]}),y?o.jsx(uue,{query:y,scope:w,stale:L.trim()!==y,onOpenFile:x,onShare:N,onDelete:C}):f.volume===null?o.jsx(fue,{onOpenDir:m}):o.jsx(mue,{location:f,onOpenDir:m,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:N,onDelete:C,onContextMenu:(q,fe)=>{B({path:q,kind:fe}),z(cn(q)),D(!0)},onMove:ue},f.volume)]})}),l&&(c.preview?o.jsx(Fj,{previewPath:c.preview,onClose:()=>p("preview",null)}):c.skill?o.jsx(J8,{skillPath:c.skill,onClose:()=>p("skill",null)},c.skill):c.brand?o.jsx(zj,{brandPath:c.brand,onClose:()=>p("brand",null)},c.brand):null),o.jsx(Ft,{open:A,onOpenChange:P,children:o.jsxs(zt,{children:[o.jsxs(cs,{children:[o.jsx(Kt,{children:n("library.library.newFolderTitle")}),o.jsx(Mn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(vt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:R,onChange:q=>E(q.target.value),onKeyDown:q=>{q.key==="Enter"&&se()}}),o.jsxs(qn,{children:[o.jsx(me,{variant:"outline",onClick:()=>P(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!R.trim()||Y.isPending,onClick:()=>{se()},children:n("library.library.create")})]})]})}),o.jsx(Ft,{open:I,onOpenChange:q=>{D(q),q||(B(null),z(""))},children:o.jsxs(zt,{children:[o.jsxs(cs,{children:[o.jsx(Kt,{children:O&&n("library.library.renameTitle",{name:cn(O.path)})}),o.jsx(Mn,{children:n("library.library.renameDescription")})]}),o.jsx(vt,{autoFocus:!0,value:M,onChange:q=>z(q.target.value),onKeyDown:q=>{q.key==="Enter"&&he()}}),o.jsxs(qn,{children:[o.jsx(me,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!M.trim()||Z.isPending,onClick:()=>{he()},children:n("library.library.rename")})]})]})}),o.jsx(Bde,{target:V,onOpenChange:q=>{q||N(null)}}),o.jsx(Gr,{open:j!==null,onOpenChange:q=>{q||C(null)},children:o.jsxs(Yr,{children:[o.jsxs(Qr,{children:[o.jsx(Xr,{children:n("library.library.deleteTitle",{name:j?cn(j.path):""})}),o.jsx(Jr,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(Zr,{children:[o.jsx(eo,{children:n("library.library.cancel")}),o.jsx(to,{onClick:()=>{ie()},children:n("library.library.delete")})]})]})})]})}function yue(){const t=F.c(10),{openPanel:e}=Di(),[s,n]=T.useState(null),[i,r]=T.useState(null);let a;t[0]!==e?(a=o.jsx(vue,{onOpenFile:h=>e(tV(h)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=a):a=t[1];let l;t[2]!==s?(l=s&&o.jsx(J8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=l):l=t[3];let c;t[4]!==i?(c=i&&o.jsx(zj,{brandPath:i,onClose:()=>r(null)},i),t[4]=i,t[5]=c):c=t[5];let d;return t[6]!==a||t[7]!==l||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[a,l,c]}),t[6]=a,t[7]=l,t[8]=c,t[9]=d):d=t[9],d}const Wv=T.lazy(()=>Ws(()=>import("./project-app-view-BxEzaMDJ.js"),__vite__mapDeps([185,1,2,81,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,82,83,84,10,11,18,85,86,87,88,89,90,91,92,93,94,95,96,23,4,5,9,12,13,14,15,16,3,6,7,8,17,19,20,21,22,27,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,146,160,121,122,123,161,156,130,131,162,116,117,73,118,119,120,124,125,126,127,128,129,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,147,148,149,150,72,151,152,79,153,154,155,157,158,159,163,164,76,165,166,167])).then(t=>({default:t.AppViewContent}))),_ue=T.lazy(()=>Ws(()=>import("./index-Bf3UYpNv.js"),__vite__mapDeps([186,1,2,55,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,133,187,18,10,11,135,149,85,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,23,4,5,9,12,13,14,15,16,3,6,7,8,17,19,20,21,22,27,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,73])).then(t=>({default:t.HostingTab}))),Lue=T.lazy(()=>Ws(()=>import("./e2e-tab-H0hc-BZ9.js"),__vite__mapDeps([188,1,2,36,28,40,29,30,31,32,33,34,35,37,38,39,24,41,42,43,25,44,26,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,133,74,78,149,23,73,85,187,18,10,11,135,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,4,5,9,12,13,14,15,16,3,6,7,8,17,19,20,21,22,27,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,118])).then(t=>({default:t.E2eTab}))),wue=T.lazy(()=>Ws(()=>import("./analytics-tab-CsPoqNEM.js"),__vite__mapDeps([189,1,2,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,133,140,74,78,85,190,191,192,149,23,187,18,10,11,135])).then(t=>({default:t.AnalyticsTab}))),Sue=T.lazy(()=>Ws(()=>import("./cdn-tab-xbZtzilg.js"),__vite__mapDeps([193,1,2,49,190,191,192,187,136,18,10,11,135,194,195])).then(t=>({default:t.CdnTab})));function kue(){const t=F.c(2),e=wP();let s;return t[0]!==e?(s=e?o.jsx(LH,{}):o.jsx(gH,{}),t[0]=e,t[1]=s):s=t[1],s}function jue({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:i,automationTabParsed:r}){const a=_P(),l=Em().monitorEnabled===!0||Em().auth.localMode===!0;if(t==="overview")return o.jsx(kue,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(WX,{})});if(sV(t))return o.jsx(y5,{virtualMcpId:e});if(t==="git")return o.jsx(IZ,{virtualMcpId:e});if(t==="automations")return o.jsx(ude,{virtualMcpId:e});if(t==="site-editor")return o.jsx(eae,{virtualMcpId:e});const c=Am(t);if(c)return o.jsx(nae,{openPath:c.path});if(t==="content")return o.jsx(vce,{virtualMcpId:e});if(t==="assets")return o.jsx(_ce,{virtualMcpId:e});if(t==="hosting"&&a.hosting)return o.jsx(_ue,{virtualMcpId:e});if(t==="e2e"&&a.e2e)return o.jsx(Lue,{virtualMcpId:e});if(t==="analytics"&&a.analytics)return o.jsx(wue,{virtualMcpId:e});if(t==="cdn"&&l&&a.monitor)return o.jsx(Sue,{virtualMcpId:e});if(t==="files")return o.jsx(yue,{});if(t==="reports")return o.jsx(bde,{});if(t==="discover")return o.jsx(Cde,{});if(t==="connect-sources")return o.jsx(pde,{});if(r)return o.jsx(ade,{tabId:t});const d=g6(t);if(d)return o.jsx(Fde,{path:d.path},d.path);const h=p6(t);if(h)return o.jsx(fde,{fileKey:h.key,taskId:s});const u=x6(t);if(u)return o.jsx(Wde,{path:u.path},u.path);const f=nV(t);if(f){const m=i.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(Ci,{children:o.jsx(Wv,{connectionId:f.connectionId,toolName:f.toolName,args:m?.args},t)})}const p=n.find(m=>m.id===t);return p?o.jsx(Ci,{children:o.jsx(Wv,{connectionId:p.view.appId,toolName:p.id,args:p.view.args},t)}):o.jsx(y5,{virtualMcpId:e})}function Cue(t){const e=F.c(13),{taskId:s,virtualMcpId:n}=t;let i;e[0]!==s||e[1]!==n?(i={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=i):i=e[2];const{activeTab:r,layoutTabs:a,expandedTools:l,automationTabParsed:c}=e3(i);let d;e[3]!==r||e[4]!==c||e[5]!==l||e[6]!==a||e[7]!==s||e[8]!==n?(d=o.jsx(Ci,{children:o.jsx(jue,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:c})}),e[3]=r,e[4]=c,e[5]=l,e[6]=a,e[7]=s,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==r||e[11]!==d?(h=o.jsx(tn,{children:d},r),e[10]=r,e[11]=d,e[12]=h):h=e[12],h}const Nue=new Set(["site-editor","content"]);function Vue(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&Nue.has(t.mainTab)}const Da="setup";function Tue(t){const e=F.c(57),s=ae();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let _;e[3]!==t.scriptTabs?(_=y=>!t.scriptTabs.includes(y),e[3]=t.scriptTabs,e[4]=_):_=e[4],n=t.scripts.filter(_),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let r;e[5]!==t?(r=()=>{t.active===Da?t.onToggle():t.onSelectTab(Da)},e[5]=t,e[6]=r):r=e[6];const a=r;let l;e[7]!==t.open||e[8]!==s?(l=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=l):l=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(hs,{className:"size-4"}):o.jsx(F6,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==l||e[15]!==c?(d=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":l,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=l,e[15]=c,e[16]=d):d=e[16];let h;e[17]!==t.open||e[18]!==s?(h=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=h):h=e[19];let u;e[20]!==h?(u=o.jsx(Ke,{children:h}),e[20]=h,e[21]=u):u=e[21];let f;e[22]!==d||e[23]!==u?(f=o.jsxs(We,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=f):f=e[24];const p=t.active===Da;let m;e[25]!==a||e[26]!==t.open||e[27]!==s||e[28]!==p?(m=o.jsx(Aue,{active:p,open:t.open,onClick:a,t:s}),e[25]=a,e[26]=t.open,e[27]=s,e[28]=p,e[29]=m):m=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(_=>o.jsx(Eue,{active:t.active===_,onClick:()=>{t.active===_?t.onToggle():t.onSelectTab(_)},onClose:()=>t.onCloseScript(_),t:s,children:_},_)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(Rue,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==m?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[m,g,x]}),e[36]=g,e[37]=x,e[38]=m,e[39]=b):b=e[39];let v;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(v=t.showScriptControls?o.jsx(Due,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(Pue,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let L;return e[53]!==b||e[54]!==v||e[55]!==f?(L=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=L):L=e[56],L}function Aue(t){const e=F.c(11),{active:s,open:n,onClick:i,t:r}=t,a=s&&n,l=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=re("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(uE,{className:"size-4"}),e[2]=h):h=e[2];let u;e[3]!==r?(u=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=u):u=e[4];let f;return e[5]!==i||e[6]!==a||e[7]!==l||e[8]!==d||e[9]!==u?(f=o.jsxs("button",{type:"button","aria-pressed":a,"aria-expanded":l,onClick:i,className:d,children:[h,u]}),e[5]=i,e[6]=a,e[7]=l,e[8]=d,e[9]=u,e[10]=f):f=e[10],f}function Pue(t){const e=F.c(40),{status:s,onStart:n,onStop:i,onRestart:r,onResume:a,onRetry:l,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-3.5"}),e[0]=d):d=e[0];let h;e[1]!==c?(h=c("sandbox.toolbar.start"),e[1]=c,e[2]=h):h=e[2];let u;return e[3]!==n||e[4]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:n,children:[d," ",h]}),e[3]=n,e[4]=h,e[5]=u):u=e[5],u}if(s==="suspended"&&a){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-3.5"}),e[6]=d):d=e[6];let h;e[7]!==c?(h=c("sandbox.toolbar.resume"),e[7]=c,e[8]=h):h=e[8];let u;return e[9]!==a||e[10]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:a,children:[d," ",h]}),e[9]=a,e[10]=h,e[11]=u):u=e[11],u}if(s==="errored"&&l){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Dn,{className:"size-3.5"}),e[12]=d):d=e[12];let h;e[13]!==c?(h=c("sandbox.toolbar.retry"),e[13]=c,e[14]=h):h=e[14];let u;return e[15]!==l||e[16]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:l,children:[d," ",h]}),e[15]=l,e[16]=h,e[17]=u):u=e[17],u}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,h=d?"rounded-r-none border-r-0":void 0;let u;e[18]!==h?(u=re(h),e[18]=h,e[19]=u):u=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let p;e[22]!==i||e[23]!==u||e[24]!==f?(p=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:i,className:u,children:f})}),e[22]=i,e[23]=u,e[24]=f,e[25]=p):p=e[25];let m;e[26]!==c?(m=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=m):m=e[27];let g;e[28]!==m?(g=o.jsx(Ke,{children:m}),e[28]=m,e[29]=g):g=e[29];let x;e[30]!==p||e[31]!==g?(x=o.jsxs(We,{children:[p,g]}),e[30]=p,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs(Ot,{children:[o.jsx($t,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(hs,{className:"size-3"})})}),o.jsx(Bt,{align:"end",children:o.jsxs(Qe,{onClick:r,children:[o.jsx(Dn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=r,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function Eue(t){const e=F.c(17),{active:s,onClick:n,onClose:i,children:r,t:a}=t,l=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==l?(c=re("flex h-6 items-center rounded-md border text-xs",l),e[0]=l,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",h=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let u;e[2]!==d||e[3]!==h?(u=re("flex h-full items-center",d,h),e[2]=d,e[3]=h,e[4]=u):u=e[4];let f;e[5]!==r||e[6]!==n||e[7]!==u?(f=o.jsx("button",{type:"button",onClick:n,className:u,children:r}),e[5]=r,e[6]=n,e[7]=u,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==i||e[11]!==a?(p=i&&o.jsx("button",{type:"button","aria-label":a("sandbox.toolbar.closeTab",{tab:String(r)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(nn,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=a,e[12]=p):p=e[12];let m;return e[13]!==c||e[14]!==f||e[15]!==p?(m=o.jsxs("div",{className:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16],m}function Rue(t){const e=F.c(27),{scripts:s,onRun:n}=t,i=ae(),[r,a]=T.useState(!1);let l;e[0]!==i?(l=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Qt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==l?(d=o.jsx(He,{asChild:!0,children:o.jsx(ws,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"xs","aria-label":l,children:c})})}),e[3]=l,e[4]=d):d=e[4];let h;e[5]!==i?(h=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=h):h=e[6];let u;e[7]!==h?(u=o.jsx(Ke,{children:h}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=o.jsxs(We,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let p;e[12]!==i?(p=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=p):p=e[13];let m;e[14]!==p?(m=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:p}),e[14]=p,e[15]=m):m=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(v=>o.jsxs("button",{type:"button",onClick:()=>{a(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==m||e[21]!==g?(x=o.jsxs(ks,{align:"start",className:"p-1 w-56",children:[m,g]}),e[20]=m,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==f?(b=o.jsxs(js,{open:r,onOpenChange:a,children:[f,x]}),e[23]=r,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function Due(t){const e=F.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:r,t:a}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(et,{className:"size-3.5"}),e[0]=f):f=e[0];let p;e[1]!==a?(p=a("sandbox.toolbar.stopping"),e[1]=a,e[2]=p):p=e[2];let m;return e[3]!==p?(m=o.jsxs(me,{variant:"outline",size:"xs",disabled:!0,children:[f," ",p]}),e[3]=p,e[4]=m):m=e[4],m}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Oa,{className:"size-3.5"}),e[5]=f):f=e[5];let p;e[6]!==a?(p=a("sandbox.toolbar.run"),e[6]=a,e[7]=p):p=e[7];let m;e[8]!==i||e[9]!==p?(m=o.jsx(He,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"xs",onClick:i,children:[f," ",p]})}),e[8]=i,e[9]=p,e[10]=m):m=e[10];let g;e[11]!==a?(g=a("sandbox.toolbar.startProcess"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(Ke,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==m||e[16]!==x?(b=o.jsxs(We,{children:[m,x]}),e[15]=m,e[16]=x,e[17]=b):b=e[17],b}let l;e[18]!==a?(l=a("sandbox.toolbar.stop"),e[18]=a,e[19]=l):l=e[19];let c;e[20]!==r||e[21]!==l?(c=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:r,children:l})}),e[20]=r,e[21]=l,e[22]=c):c=e[22];let d;e[23]!==a?(d=a("sandbox.toolbar.stopProcess"),e[23]=a,e[24]=d):d=e[24];let h;e[25]!==d?(h=o.jsx(Ke,{children:d}),e[25]=d,e[26]=h):h=e[26];let u;return e[27]!==c||e[28]!==h?(u=o.jsxs(We,{children:[c,h]}),e[27]=c,e[28]=h,e[29]=u):u=e[29],u}var Kj=Object.defineProperty,Mue=Object.getOwnPropertyDescriptor,Iue=(t,e)=>{for(var s in e)Kj(t,s,{get:e[s],enumerable:!0})},Ps=(t,e,s,n)=>{for(var i=n>1?void 0:n?Mue(e,s):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(i=(n?a(e,s,i):a(i))||i);return n&&i&&Kj(e,s,i),i},Xe=(t,e)=>(s,n)=>e(s,n,t),qv="Terminal input",$p={get:()=>qv,set:t=>qv=t},Gv="Too much output to announce, navigate to rows manually to read",Bp={get:()=>Gv,set:t=>Gv=t};function Oue(t){return t.replace(/\r?\n/g,"\r")}function $ue(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function Bue(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function zue(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");Wj(i,e,s,n)}}function Wj(t,e,s,n){t=Oue(t),t=$ue(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function qj(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,r=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${r}px`,e.style.zIndex="1000",e.focus()}function Yv(t,e,s,n,i){qj(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Ro(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Z9(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let r=t[i];r>65535?(r-=65536,n+=String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):n+=String.fromCharCode(r)}return n}var Fue=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i=0;if(this._interim){let r=t.charCodeAt(i++);56320<=r&&r<=57343?e[n++]=(this._interim-55296)*1024+r-56320+65536:(e[n++]=this._interim,e[n++]=r),this._interim=0}for(let r=i;r<s;++r){let a=t.charCodeAt(r);if(55296<=a&&a<=56319){if(++r>=s)return this._interim=a,n;let l=t.charCodeAt(r);56320<=l&&l<=57343?e[n++]=(a-55296)*1024+l-56320+65536:(e[n++]=a,e[n++]=l);continue}a!==65279&&(e[n++]=a)}return n}},Uue=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i,r,a,l,c=0,d=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)p<<=6,p|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-m;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[m++]=g,p<<=6,p|=g&63}f||(x===2?p<128?d--:e[n++]=p:x===3?p<2048||p>=55296&&p<=57343||p===65279||(e[n++]=p):p<65536||p>1114111||(e[n++]=p)),this.interim.fill(0)}let h=s-4,u=d;for(;u<s;){for(;u<h&&!((i=t[u])&128)&&!((r=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[n++]=i,e[n++]=r,e[n++]=a,e[n++]=l,u+=4;if(i=t[u++],i<128)e[n++]=i;else if((i&224)===192){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(c=(i&31)<<6|r&63,c<128){u--;continue}e[n++]=c}else if((i&240)===224){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(i&15)<<12|(r&63)<<6|a&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=a,n;if(l=t[u++],(l&192)!==128){u--;continue}if(c=(i&7)<<18|(r&63)<<12|(a&63)<<6|l&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Gj="",zo=" ",A0=class Yj{constructor(){this.fg=0,this.bg=0,this.extended=new Mf}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Yj;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Mf=class Qj{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Qj(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},si=class Xj extends A0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Mf,this.combinedData=""}static fromCharData(e){let s=new Xj;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ro(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Qv="di$target",zp="di$dependencies",dm=new Map;function Hue(t){return t[zp]||[]}function an(t){if(dm.has(t))return dm.get(t);let e=function(s,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Kue(e,s,i)};return e._id=t,dm.set(t,e),e}function Kue(t,e,s){e[Qv]===e?e[zp].push({id:t,index:s}):(e[zp]=[{id:t,index:s}],e[Qv]=e)}var Tn=an("BufferService"),Jj=an("CoreMouseService"),fl=an("CoreService"),Wue=an("CharsetService"),j4=an("InstantiationService"),Zj=an("LogService"),An=an("OptionsService"),eC=an("OscLinkService"),que=an("UnicodeService"),P0=an("DecorationService"),Fp=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,r=new si,a=s.getTrimmedLength(),l=-1,c=-1,d=!1;for(let h=0;h<a;h++)if(!(c===-1&&!s.hasContent(h))){if(s.loadCell(h,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=h,l=r.extended.urlId;continue}else d=r.extended.urlId!==l;else c!==-1&&(d=!0);if(d||c!==-1&&h===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:c+1,y:t},end:{x:h+(!d&&h===a-1?1:0),y:t}},p=!1;if(!i?.allowNonHttpProtocols)try{let m=new URL(u);["http:","https:"].includes(m.protocol)||(p=!0)}catch{p=!0}p||n.push({text:u,range:f,activate:(m,g)=>i?i.activate(m,g,f):Gue(m,g),hover:(m,g)=>i?.hover?.(m,g,f),leave:(m,g)=>i?.leave?.(m,g,f)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=h,l=r.extended.urlId):(c=-1,l=-1)}}e(n)}};Fp=Ps([Xe(0,Tn),Xe(1,An),Xe(2,eC)],Fp);function Gue(t,e){if(confirm(`Do you want to navigate to ${e}?
815
+ `);function Zde(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Jde).replaceAll("{{title}}",Xde).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function eue(t){const e=F.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=ju(s),a=ju(i??"");if(r.isPending||i&&a.isPending){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(en,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=h):h=e[0],h}if(r.isError||!r.data){let h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=h):h=e[1],h}const l=a.data??null;let c;e[2]!==l||e[3]!==r.data?(c=Zde(r.data,l),e[2]=l,e[3]=r.data,e[4]=c):c=e[4];let d;return e[5]!==c||e[6]!==n?(d=o.jsx("iframe",{title:n,srcDoc:c,sandbox:"allow-scripts",className:"block h-full w-full border-0 bg-white"}),e[5]=c,e[6]=n,e[7]=d):d=e[7],d}function Jd(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function tue(t){const e=F.c(16),{family:s,tokens:n,editing:i,valueOf:r,onEdit:a}=t;let l;e[0]!==s?(l=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=l):l=e[1];let c;if(e[2]!==i||e[3]!==a||e[4]!==n||e[5]!==r){let u;e[7]!==i||e[8]!==a||e[9]!==r?(u=f=>{const p=r(f),m=`${f.name.replace(/^--brand-/,"")}: ${p}`;return i&&/^#/.test(p)?o.jsx("input",{type:"color","aria-label":f.name,title:m,value:ZE(p),onChange:g=>a(f.name,g.target.value),className:"size-7 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5"},f.name):o.jsx("span",{title:m,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:p}},f.name)},e[7]=i,e[8]=a,e[9]=r,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=a,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-wrap gap-1",children:c}),e[11]=c,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,d]}),e[13]=l,e[14]=d,e[15]=h):h=e[15],h}function sue(t){const e=F.c(9),{token:s,value:n}=t;if(s.kind==="space"){let r;return e[0]!==n?(r=o.jsx("span",{className:"flex h-7 w-16 shrink-0 items-center",children:o.jsx("span",{className:"h-1.5 rounded-full bg-primary",style:{width:n,maxWidth:"100%"}})}),e[0]=n,e[1]=r):r=e[1],r}if(s.kind==="radius"){let r;return e[2]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 border border-border bg-muted/50",style:{borderRadius:n}}),e[2]=n,e[3]=r):r=e[3],r}if(s.kind==="shadow"){let r;return e[4]!==n?(r=o.jsx("span",{className:"size-7 shrink-0 rounded-md bg-background",style:{boxShadow:n}}),e[4]=n,e[5]=r):r=e[5],r}if(s.kind==="type"&&/^--brand-text-/.test(s.name)){const r=`min(${n}, 22px)`;let a;return e[6]!==r?(a=o.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center overflow-hidden leading-none text-foreground",style:{fontSize:r},children:"Ag"}),e[6]=r,e[7]=a):a=e[7],a}let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("span",{className:"size-7 shrink-0"}),e[8]=i):i=e[8],i}function Bj(t){const e=F.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let a;e[0]!==s||e[1]!==n?(a=o.jsx(sue,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=a):a=e[2];let l;if(e[3]!==s.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],l=s.name.replace(u,""),e[3]=s.name,e[4]=l}else l=e[4];let c;e[6]!==l?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:l}),e[6]=l,e[7]=c):c=e[7];let d;e[8]!==i||e[9]!==r||e[10]!==s.name||e[11]!==n?(d=i?o.jsx(vt,{value:n,onChange:u=>r(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=r,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==a||e[14]!==c||e[15]!==d?(h=o.jsxs("div",{className:"flex items-center gap-3",children:[a,c,d]}),e[13]=a,e[14]=c,e[15]=d,e[16]=h):h=e[16],h}function Md(t){const e=F.c(16),{label:s,tokens:n,editing:i,valueOf:r,onEdit:a}=t;if(n.length===0)return null;let l;e[0]!==s?(l=o.jsx(Jd,{children:s}),e[0]=s,e[1]=l):l=e[1];let c;if(e[2]!==i||e[3]!==a||e[4]!==n||e[5]!==r){let u;e[7]!==i||e[8]!==a||e[9]!==r?(u=f=>o.jsx(Bj,{token:f,value:r(f),editing:i,onEdit:a},f.name),e[7]=i,e[8]=a,e[9]=r,e[10]=u):u=e[10],c=n.map(u),e[2]=i,e[3]=a,e[4]=n,e[5]=r,e[6]=c}else c=e[6];let d;e[11]!==c?(d=o.jsx("div",{className:"flex flex-col gap-2.5",children:c}),e[11]=c,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-3",children:[l,d]}),e[13]=l,e[14]=d,e[15]=h):h=e[15],h}function nue({brandPath:t,onClose:e,variant:s}){const n=ae(),{org:i}=Ue(),r=Ng(t),a=r.volume??"",l=r.dirPath,c=cn(l),d=r.readOnly,h=Vs(),u=o0(),f=T8(a),{upload:p,remove:m}=ku(a),g=T.useRef(null),x=A8(a,l),b=x.data??[],v=q=>b.some(fe=>fe.kind==="file"&&cn(fe.path)===q),L=v("tokens.css"),_=v("brand.md"),y=v("slides-theme.html"),w=YE(b),S=u(a,`${l}/tokens.css`),k=u(a,`${l}/brand.md`),j=u(a,`${l}/slides-theme.html`),C=ju(S,{enabled:L}),V=ju(k,{enabled:_}),[N,A]=T.useState(!1),[P,R]=T.useState({}),[E,I]=T.useState(null),[D,O]=T.useState(!1),[B,M]=T.useState(!1),[z,$]=T.useState("deck"),U=C.data?QE(C.data):[],H=q=>U.find(fe=>fe.name===q)?.value,W=q=>P[q.name]??q.value,K=XE(U),G=U.filter(q=>q.kind==="font"),Y=U.filter(q=>q.kind==="type"),Z=U.filter(q=>q.kind==="space"),te=U.filter(q=>q.kind==="radius"),X=U.filter(q=>q.kind==="shadow"),ee=U.filter(q=>q.kind==="motion"),J=U.filter(q=>q.kind==="other"),Q=(q,fe)=>R(ge=>({...ge,[q]:fe})),oe=y&&z==="deck",le=E??V.data??"",de=Object.entries(P).filter(([q,fe])=>H(q)!==fe),se=E!==null&&E!==(V.data??""),ie=de.length>0||se;function he(){R({}),I(null),A(!1)}async function ue(){O(!0);try{if(de.length>0){let q=C.data??"";for(const[fe,ge]of de)q=JE(q,fe,ge);await f.mutateAsync({path:`${l}/tokens.css`,body:q,contentType:"text/css; charset=utf-8"}),h.invalidateQueries({queryKey:tt.fileText(S)})}se&&E!==null&&(await f.mutateAsync({path:`${l}/brand.md`,body:E,contentType:"text/markdown; charset=utf-8"}),h.invalidateQueries({queryKey:tt.fileText(k)})),h.invalidateQueries({queryKey:tt.orgFsVolume(i.id,a)}),h.invalidateQueries({queryKey:tt.orgFsRecent(i.id)}),R({}),I(null),A(!1),ye.success(n("library.brandPreview.brandSaved"))}catch(q){ye.error(q instanceof Error?q.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function ce(q){const fe=q?.[0];if(!fe)return;const _e=`logo.${(fe.name.split(".").pop()??"png").toLowerCase()}`;try{await p.mutateAsync({dir:l,files:[new File([fe],_e,{type:fe.type})]}),w&&cn(w)!==_e&&await m.mutateAsync(w),ye.success(n("library.brandPreview.logoUpdated"))}catch(Le){ye.error(Le instanceof Error?Le.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ne=!x.isPending&&!L&&!_&&!w;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:o.jsx(Ym,{size:18})}),s==="dialog"?o.jsx(Kt,{className:"flex-1 truncate text-base font-medium text-foreground",children:c}):o.jsx("span",{className:"flex-1 truncate text-base font-medium text-foreground",children:c}),!d&&(N?o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"ghost",size:"sm",onClick:he,disabled:D,children:n("library.brandPreview.cancel")}),o.jsx(me,{size:"sm",disabled:!ie||D,onClick:()=>{ue()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[o.jsx(wA,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(bT,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(nn,{size:16})})}):o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(nn,{size:16})})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x.isPending?o.jsxs("div",{className:"flex flex-col gap-3 p-6",children:[o.jsx(en,{className:"h-40 w-full rounded-xl"}),o.jsx(en,{className:"h-4 w-1/3"}),o.jsx(en,{className:"h-4 w-2/3"})]}):ne?o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:n("library.brandPreview.brandNotAvailable")}):o.jsxs(o.Fragment,{children:[(y||L)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n(B?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(q=>!q),onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),M(fe=>!fe))},className:"flex cursor-pointer items-center justify-between gap-2 px-4 py-2.5 hover:bg-muted/40",children:[o.jsxs("div",{className:"flex gap-0.5 rounded-lg bg-muted p-0.5 text-xs font-medium",onClick:q=>q.stopPropagation(),children:[y&&o.jsx("button",{type:"button",onClick:()=>{$("deck"),M(!1)},className:re("rounded-md px-2.5 py-1",oe?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:n("library.brandPreview.deck")}),o.jsx("button",{type:"button",onClick:()=>{$("components"),M(!1)},className:re("rounded-md px-2.5 py-1",oe?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),B?o.jsx(hs,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(F6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!B&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:re("w-full overflow-hidden rounded-xl border border-border bg-muted/30",oe?"aspect-[16/9]":"h-96"),children:oe?o.jsx(eue,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):o.jsx(Qde,{tokensUrl:S})})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto p-6",children:[o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jd,{children:n("library.brandPreview.logo")}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"flex size-24 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted/30",children:w?o.jsx("img",{src:u(a,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(Ym,{size:28,className:"text-muted-foreground/50"})}),N&&o.jsxs("div",{children:[o.jsxs(me,{variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Gn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:q=>{ce(q.target.files)}})]})]})]}),K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jd,{children:n("library.brandPreview.colors")}),K.map(q=>o.jsx(tue,{family:q.family,tokens:q.tokens,editing:N,valueOf:W,onEdit:Q},q.family))]}),(G.length>0||Y.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jd,{children:n("library.brandPreview.typography")}),G.map(q=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:q.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),N?o.jsx(vt,{value:W(q),onChange:fe=>Q(q.name,fe.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(q)},children:W(q)})]},q.name)),Y.map(q=>o.jsx(Bj,{token:q,value:W(q),editing:N,onEdit:Q},q.name))]}),o.jsx(Md,{label:n("library.brandPreview.spacing"),tokens:Z,editing:N,valueOf:W,onEdit:Q}),o.jsx(Md,{label:n("library.brandPreview.radius"),tokens:te,editing:N,valueOf:W,onEdit:Q}),o.jsx(Md,{label:n("library.brandPreview.shadows"),tokens:X,editing:N,valueOf:W,onEdit:Q}),o.jsx(Md,{label:n("library.brandPreview.motion"),tokens:ee,editing:N,valueOf:W,onEdit:Q}),o.jsx(Md,{label:n("library.brandPreview.tokens"),tokens:J,editing:N,valueOf:W,onEdit:Q}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jd,{children:n("library.brandPreview.voiceGuidelines")}),N?o.jsx(Jo,{value:le,onChange:q=>I(q.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):V.isPending&&_?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(en,{className:"h-3 w-full"}),o.jsx(en,{className:"h-3 w-5/6"})]}):le.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(cd,{id:`brand-preview-${t}`,text:le})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function zj(t){const e=F.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=l=>{l||n()},e[0]=n,e[1]=i):i=e[1];let r;e[2]!==s||e[3]!==n?(r=o.jsx(zt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl!",closeButtonClassName:"hidden",children:o.jsx(nue,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let a;return e[5]!==i||e[6]!==r?(a=o.jsx(Ft,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=a):a=e[7],a}function Fj(t){const e=F.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let a;e[0]!==n?(a=d=>{d||n()},e[0]=n,e[1]=a):a=e[1];let l;e[2]!==n||e[3]!==s||e[4]!==r?(l=o.jsx(zt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx($j,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==a||e[7]!==l?(c=o.jsx(Ft,{open:!0,onOpenChange:a,children:l}),e[6]=a,e[7]=l,e[8]=c):c=e[8],c}function iue(t){const e=F.c(11),{onOpenDir:s}=t,n=ae(),i=eR();let r;e[0]!==i.data?(r=i.data??[],e[0]=i.data,e[1]=r):r=e[1];let a;if(e[2]!==s||e[3]!==n||e[4]!==r){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(m0,{name:d.volume,glyph:qr,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:k7(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],a=r.map(c),e[2]=s,e[3]=n,e[4]=r,e[5]=a}else a=e[5];let l;return e[9]!==a?(l=o.jsx(o.Fragment,{children:a}),e[9]=a,e[10]=l):l=e[10],l}function S4(t){return`${window.location.origin}${t}`}function yu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const rue=[Nu,"uploads","outputs"],Uj=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Gn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Fr}],Op=new Set([...Uj.map(t=>t.volume),Wc("public")]),oue=6;function Hj(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=Z8(t),r=i?`public/${i}`:t==="home"?Vu(s):t;return n?`${r}/${n}`:r}function vh(t,e,s){return{onDragStart:n=>{s.onDragStart?.(t),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-studio-library-path",t)},onContextMenu:n=>{n.preventDefault(),s.onContextMenu?.(t,e)},onDrop:s.onDrop?n=>{n.preventDefault();const i=n.dataTransfer.getData("application/x-studio-library-path");i&&i!==t&&!t.startsWith(i+"/")&&s.onDrop(i,t)}:void 0}}function Mo(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function Mr(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("div",{className:"@container",children:o.jsx("div",{className:"grid grid-cols-1 gap-3 @[440px]:grid-cols-2 @[660px]:grid-cols-3",children:s})}),e[0]=s,e[1]=n):n=e[1],n}function J9(t){const e=F.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx(Mr,{children:Array.from({length:n*3},aue)}),e[0]=n,e[1]=i):i=e[1],i}function aue(t,e){return o.jsx(en,{className:"h-16 rounded-2xl"},e)}function k4(t){const e=F.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1],n}function lue(t){const e=F.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,a=ae(),l=AP(s);let c;e[0]!==a||e[1]!==l.data?(c=l.data?a("library.libraryViews.filesCount",{count:l.data.files}):void 0,e[0]=a,e[1]=l.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==a?(d=a(n),e[3]=n,e[4]=a,e[5]=d):d=e[5];let h;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(h=o.jsx(m0,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:r}),e[6]=i,e[7]=r,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11],h}function cue(t){const e=F.c(12),{onOpenDir:s}=t,n=ae(),r=P8().data?.length??0;let a;e[0]!==s?(a=Uj.map(h=>o.jsx(lue,{volume:h.volume,descriptionKey:h.descriptionKey,glyph:h.glyph,onOpen:()=>s(h.volume)},h.volume)),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==r||e[4]!==n?(l=r>0&&o.jsx(m0,{name:Wc("public"),meta:n("library.libraryViews.skillSetsCount",{count:r}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:hr,tone:"system",readOnly:!0,onOpen:()=>s("public")}),e[2]=s,e[3]=r,e[4]=n,e[5]=l):l=e[5];let c;e[6]!==s?(c=o.jsx(iue,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==l||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[a,l,c]}),e[8]=a,e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function due(t){const e=F.c(19),{segments:s,onNavigate:n}=t,{org:i}=Ue();let r;e[0]!==s?(r=s[0]===Nu?s.slice(1):s,e[0]=s,e[1]=r):r=e[1];const a=r,l=s.length-a.length,c=a.length===0;let d;e[2]!==c||e[3]!==n||e[4]!==i.slug?(d=c?o.jsx("span",{className:"truncate font-medium text-foreground",children:Vu(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Nu),children:Vu(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let h;if(e[6]!==l||e[7]!==n||e[8]!==a||e[9]!==s){let f;e[11]!==l||e[12]!==n||e[13]!==a.length||e[14]!==s?(f=(p,m)=>{const g=s.slice(0,l+m+1).join("/"),x=m===a.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(Ns,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Wc(p)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Wc(p)})]},g)},e[11]=l,e[12]=n,e[13]=a.length,e[14]=s,e[15]=f):f=e[15],h=a.map(f),e[6]=l,e[7]=n,e[8]=a,e[9]=s,e[10]=h}else h=e[10];let u;return e[16]!==d||e[17]!==h?(u=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,h]}),e[16]=d,e[17]=h,e[18]=u):u=e[18],u}function uue(t){const e=F.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:a,onDelete:l}=t,c=ae(),{org:d}=Ue(),h=o0(),u=TP(s,n);let f;e[0]!==h||e[1]!==a?(f=S=>a({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:S4(h(S.volume,S.path))}),e[0]=h,e[1]=a,e[2]=f):f=e[2];const p=f;if(u.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(J9,{rows:2}),e[3]=S):S=e[3],S}let m,g,x,b,v;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(k4,{children:k}),e[17]=k,e[18]=j):j=e[18],v=j;break e}const S=(i||u.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=re("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],m=Mo,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=u.data,e[6]=u.isPlaceholderData,e[7]=i,e[8]=c,e[9]=m,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else m=e[9],g=e[10],x=e[11],b=e[12],v=e[13];if(v!==Symbol.for("react.early_return_sentinel"))return v;let L;e[21]!==m||e[22]!==x?(L=o.jsx(m,{children:x}),e[21]=m,e[22]=x,e[23]=L):L=e[23];let _;if(e[24]!==h||e[25]!==l||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==p){let S;e[31]!==h||e[32]!==l||e[33]!==r||e[34]!==d||e[35]!==p?(S=k=>{const j=Z8(k.volume)!==null;return o.jsx(j7,{filename:cn(k.path),updatedAt:k.updatedAt,downloadUrl:h(k.volume,k.path),subtitle:Hj(k.volume,k.path,d.slug),publicState:yu(k),onOpen:()=>r(e7(k.volume,k.path)),onShare:j?void 0:()=>p(k),onDelete:j?void 0:()=>l({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=h,e[32]=l,e[33]=r,e[34]=d,e[35]=p,e[36]=S):S=e[36],_=g.map(S),e[24]=h,e[25]=l,e[26]=r,e[27]=d,e[28]=g,e[29]=p,e[30]=_}else _=e[30];let y;e[37]!==_?(y=o.jsx(Mr,{children:_}),e[37]=_,e[38]=y):y=e[38];let w;return e[39]!==b||e[40]!==L||e[41]!==y?(w=o.jsxs("div",{className:b,children:[L,y]}),e[39]=b,e[40]=L,e[41]=y,e[42]=w):w=e[42],w}function hue(t){const e=F.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=ae(),{org:a}=Ue(),l=V8(),c=o0();let d;e[0]!==c||e[1]!==n?(d=v=>n({volume:v.volume,path:v.path,kind:"file",shareMode:v.shareMode??"private",effectivePublic:v.effectivePublic??!1,url:S4(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const h=d;if(l.isPending){let v;e[3]!==r?(v=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=v):v=e[4];let L;e[5]!==v?(L=o.jsx(Mo,{children:v}),e[5]=v,e[6]=L):L=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(J9,{}),e[7]=_):_=e[7];let y;return e[8]!==L?(y=o.jsxs("div",{className:"flex flex-col gap-3",children:[L,_]}),e[8]=L,e[9]=y):y=e[9],y}let u,f,p,m,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==a||e[14]!==l.data||e[15]!==h||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const v=(l.data??[]).slice(0,oue);if(v.length===0){g=null;break e}p="flex flex-col gap-3";let L;e[22]!==r?(L=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=L):L=e[23],e[24]!==L?(m=o.jsx(Mo,{children:L}),e[24]=L,e[25]=m):m=e[25],u=Mr;let _;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==a||e[30]!==h?(_=y=>o.jsx(nR,{filename:cn(y.path),updatedAt:y.updatedAt,size:y.size,downloadUrl:c(y.volume,y.path),subtitle:Hj(y.volume,y.path,a.slug),publicState:yu(y),onOpen:()=>s(e7(y.volume,y.path)),onShare:()=>h(y),onDelete:()=>i({volume:y.volume,path:y.path,kind:"file"})},`${y.volume}/${y.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=a,e[30]=h,e[31]=_):_=e[31],f=v.map(_)}e[10]=c,e[11]=i,e[12]=s,e[13]=a,e[14]=l.data,e[15]=h,e[16]=r,e[17]=u,e[18]=f,e[19]=p,e[20]=m,e[21]=g}else u=e[17],f=e[18],p=e[19],m=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==f?(x=o.jsx(u,{children:f}),e[32]=u,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==p||e[36]!==m||e[37]!==x?(b=o.jsxs("div",{className:p,children:[m,x]}),e[35]=p,e[36]=m,e[37]=x,e[38]=b):b=e[38],b}function fue(t){const e=F.c(16),{onOpenDir:s}=t,n=ae(),i=P8();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(J9,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.data?(r=i.data??[],e[1]=i.data,e[2]=r):r=e[2];const a=r;if(a.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let h;return e[5]!==d?(h=o.jsx(k4,{children:d}),e[5]=d,e[6]=h):h=e[6],h}let l;if(e[7]!==s||e[8]!==a||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=h=>o.jsx(m0,{name:h,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${h}`)},h),e[11]=s,e[12]=n,e[13]=d):d=e[13],l=a.map(d),e[7]=s,e[8]=a,e[9]=n,e[10]=l}else l=e[10];let c;return e[14]!==l?(c=o.jsx(Mr,{children:l}),e[14]=l,e[15]=c):c=e[15],c}function mue(t){const e=F.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:a,onShare:l,onDelete:c,onDragStart:d,onContextMenu:h,onMove:u}=t,f=ae(),{org:p}=Ue(),m=s.volume??"",g=A8(m,s.dirPath),x=o0();let b;e[0]!==s.isHomeRoot||e[1]!==p?(b=N=>s.isHomeRoot&&Op.has(N.toLowerCase())?`${Vu(p.slug)}/${N}`:void 0,e[0]=s.isHomeRoot,e[1]=p,e[2]=b):b=e[2];const v=b;let L;e[3]!==s.isHomeRoot||e[4]!==n?(L=s.isHomeRoot?o.jsx(cue,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=L):L=e[5];const _=L;if(g.isPending){let N;e[6]!==_||e[7]!==f?(N=_&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.folders")}),o.jsx(Mr,{children:_})]}),e[6]=_,e[7]=f,e[8]=N):N=e[8];let A;e[9]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(J9,{rows:2}),e[9]=A):A=e[9];let P;return e[10]!==N?(P=o.jsxs(o.Fragment,{children:[N,A]}),e[10]=N,e[11]=P):P=e[11],P}if(g.isError){let N;e[12]!==g.error||e[13]!==f?(N=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=N):N=e[14];let A;return e[15]!==N?(A=o.jsx("p",{className:"text-sm text-destructive",children:N}),e[15]=N,e[16]=A):A=e[16],A}let y,w,S,k,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==h||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==a||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==l||e[30]!==_||e[31]!==f||e[32]!==m){j=Symbol.for("react.early_return_sentinel");e:{const N=g.data??[],A=N.filter(bue),P=N.filter(xue),R=N.filter(gue),E=N.filter(pue);if(N.length===0&&!s.isHomeRoot){let M;e[38]!==s.readOnly||e[39]!==f?(M=s.readOnly?f("library.libraryViews.emptyReadOnlySet"):f("library.libraryViews.emptyFolder"),e[38]=s.readOnly,e[39]=f,e[40]=M):M=e[40];let z;e[41]!==M?(z=o.jsx(k4,{children:M}),e[41]=M,e[42]=z):z=e[42],j=z;break e}let I;e[43]!==s.readOnly||e[44]!==c||e[45]!==m?(I=M=>s.readOnly?void 0:()=>c({volume:m,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=m,e[46]=I):I=e[46];const D=I;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==l||e[50]!==m?(O=M=>s.readOnly?void 0:()=>l({volume:m,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?S4(x(m,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=l,e[50]=m,e[51]=O):O=e[51];const B=O;y=A.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.skills")}),o.jsx(Mr,{children:A.map(M=>o.jsx(tR,{dirName:cn(M.path),updatedAt:M.updatedAt,skillMdUrl:x(m,`${M.path}/SKILL.md`),publicState:yu(M),onOpen:()=>r(gc(s,M.path)),onBrowse:()=>n(gc(s,M.path)),onShare:B(M),onDelete:D(M),draggable:!s.readOnly,...vh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),w=P.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.brands")}),o.jsx(Mr,{children:P.map(M=>o.jsx(sR,{dirName:cn(M.path),updatedAt:M.updatedAt,tokensUrl:x(m,`${M.path}/tokens.css`),onOpen:()=>a(gc(s,M.path)),onBrowse:()=>n(gc(s,M.path)),onDelete:D(M),draggable:!s.readOnly,...vh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),S=(R.length>0||_)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.folders")}),o.jsxs(Mr,{children:[_,R.map(M=>o.jsx(m0,{name:cn(M.path),meta:k7(M.updatedAt),subtitle:v(cn(M.path)),readOnly:s.readOnly,publicState:yu(M),onOpen:()=>n(gc(s,M.path)),onShare:B(M),onDelete:D(M),draggable:!s.readOnly,...vh(M.path,"dir",{onDragStart:d,onContextMenu:h,onDrop:u})},M.path))]})]}),k=E.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Mo,{children:f("library.libraryViews.files")}),o.jsx(Mr,{children:E.map(M=>o.jsx(j7,{filename:cn(M.path),updatedAt:M.updatedAt,downloadUrl:x(m,M.path),publicState:yu(M),onOpen:()=>i(gc(s,M.path)),onShare:B(M),onDelete:D(M),draggable:!s.readOnly,...vh(M.path,"file",{onDragStart:d,onContextMenu:h})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=h,e[22]=c,e[23]=d,e[24]=u,e[25]=a,e[26]=n,e[27]=i,e[28]=r,e[29]=l,e[30]=_,e[31]=f,e[32]=m,e[33]=y,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else y=e[33],w=e[34],S=e[35],k=e[36],j=e[37];if(j!==Symbol.for("react.early_return_sentinel"))return j;let C;e[52]!==s.isHomeRoot||e[53]!==c||e[54]!==i||e[55]!==l?(C=s.isHomeRoot&&o.jsx(hue,{onOpenFile:i,onShare:l,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=l,e[56]=C):C=e[56];let V;return e[57]!==y||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==C?(V=o.jsxs(o.Fragment,{children:[y,w,S,k,C]}),e[57]=y,e[58]=w,e[59]=S,e[60]=k,e[61]=C,e[62]=V):V=e[62],V}function pue(t){return t.kind==="file"}function gue(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function xue(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function bue(t){return t.kind==="dir"&&t.hasSkill}function vue({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=ae(),{org:i}=Ue(),r=Vs(),a=Ks(),l=Za(),c=pr({strict:!1}),d=c.path||Nu,h=Ng(d),u=iR(),f=h.volume!==null&&u.has(h.volume)?{...h,readOnly:!0}:h,p=(q,fe)=>a({to:".",search:ge=>({...ge,[q]:fe||void 0})}),m=q=>p("path",q),g=(q,fe)=>a({to:".",search:ge=>({...ge,preview:void 0,skill:void 0,brand:void 0,[q]:fe})}),x=t??(q=>g("preview",q)),b=e??(q=>g("skill",q)),v=s??(q=>g("brand",q)),[L,_]=T.useState(""),y=L9(L.trim(),300),w=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,S=w?n("library.library.searchInPlaceholder",{folder:Wc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?Vu(i.slug):Wc(f.segments.at(-1)??""),[j,C]=T.useState(null),[V,N]=T.useState(null),[A,P]=T.useState(!1),[R,E]=T.useState(""),[I,D]=T.useState(!1),[O,B]=T.useState(null),[M,z]=T.useState(""),$=T.useRef(null),[U,H]=T.useState(!1),W=T.useRef(0),K=f.readOnly?null:f.volume,{upload:G,mkdir:Y,move:Z}=ku(K??Nu),{remove:te}=ku(j?.volume??"uploads");async function X(q){if(!(!K||!q||q.length===0))try{await G.mutateAsync({dir:f.dirPath,files:[...q]}),ye.success(q.length===1?n("library.library.uploadedSingle",{filename:q[0]?.name??""}):n("library.library.uploadedMultiple",{count:q.length}))}catch(fe){ye.error(fe instanceof Error?fe.message:n("library.library.uploadFailed"))}finally{$.current&&($.current.value="")}}const ee=K!==null;function J(q){return q.dataTransfer.types.includes("Files")}function Q(q){!ee||!J(q)||(q.preventDefault(),W.current+=1,H(!0))}function oe(q){!ee||!J(q)||q.preventDefault()}function le(){ee&&(W.current=Math.max(0,W.current-1),W.current===0&&H(!1))}function de(q){ee&&(q.preventDefault(),q.stopPropagation(),W.current=0,H(!1),q.dataTransfer.files.length>0&&X(q.dataTransfer.files))}async function se(){const q=R.trim();if(!(!K||!q)){if(f.isHomeRoot&&Op.has(q.toLowerCase())){ye.error(n("library.library.folderNameReserved",{name:q}));return}try{const fe=f.dirPath;await Y.mutateAsync(fe?`${fe}/${q}`:q),ye.success(n("library.library.folderCreated",{name:q})),P(!1),E("")}catch(fe){ye.error(fe instanceof Error?fe.message:n("library.library.folderCreateFailed"))}}}async function ie(){if(!j)return;const q=j;try{await te.mutateAsync(q.path),ye.success(n("library.library.deleted",{name:cn(q.path)}))}catch(fe){ye.error(fe instanceof Error?fe.message:n("library.library.deleteFailed"))}finally{C(null)}}async function he(){if(!O)return;const q=M.trim();if(!q||q.includes("/")||q.includes("..")||q===cn(O.path)){D(!1),B(null),z("");return}if(O.kind==="dir"&&f.isHomeRoot&&Op.has(q.toLowerCase())){ye.error(n("library.library.folderNameReserved",{name:q}));return}try{const fe=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",ge=fe?`${fe}/${q}`:q;await Z.mutateAsync({from:O.path,to:ge});const _e=q.replace(/[<>]/g,"");ye.success(n("library.library.renamed",{name:_e}))}catch(fe){ye.error(fe instanceof Error?fe.message:n("library.library.renameFailed"))}finally{D(!1),B(null),z("")}}async function ue(q,fe){try{const ge=cn(q),_e=fe?`${fe}/${ge}`:ge;await Z.mutateAsync({from:q,to:_e}),ye.success(n("library.library.moved",{name:ge,destination:fe||n("library.library.theLibrary")}))}catch(ge){ye.error(ge instanceof Error?ge.message:n("library.library.moveFailed"))}}function ce(){for(const q of rue)r.invalidateQueries({queryKey:tt.orgFsVolume(i.id,q)});f.volume&&r.invalidateQueries({queryKey:tt.orgFsVolume(i.id,f.volume)}),r.invalidateQueries({queryKey:tt.orgFsRecent(i.id)}),r.invalidateQueries({queryKey:tt.orgFsSearchRoot(i.id)}),r.invalidateQueries({queryKey:tt.orgFsPublicSets(i.id)})}function ne(q){q.defaultPrevented||!K||q.target.closest("input, textarea, button, a, [role='button']")||(q.preventDefault(),P(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:Q,onDragOver:oe,onDragLeave:le,onDrop:de,onContextMenu:ne,children:[U&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-background/80 p-6 backdrop-blur-sm",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-primary px-10 py-8 text-center",children:[o.jsx(Gn,{size:28,className:"text-primary"}),o.jsx("p",{className:"text-sm font-medium text-foreground",children:n("library.library.dropToUpload",{location:k})})]})}),o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"min-w-0 flex-1 basis-full sm:basis-auto",children:o.jsx(due,{segments:f.segments,onNavigate:m})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(u0,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(vt,{value:L,onChange:q=>_(q.target.value),onKeyDown:q=>{q.key==="Escape"&&_("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),L&&o.jsx(me,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>_(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(ii,{size:14})})]}),o.jsx(me,{variant:"ghost",size:"icon",onClick:ce,"aria-label":n("library.library.refresh"),children:o.jsx(Dn,{size:14})}),K&&o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>P(!0),children:[o.jsx(Qt,{size:14}),n("library.library.newFolder")]}),f.readOnly?o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(h0,{size:12}),n("library.library.readOnly")]}):o.jsxs(me,{size:"sm",disabled:G.isPending,onClick:()=>$.current?.click(),children:[o.jsx(Gn,{size:14}),G.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:$,type:"file",multiple:!0,className:"hidden",onChange:q=>{X(q.target.files)}})]}),y?o.jsx(uue,{query:y,scope:w,stale:L.trim()!==y,onOpenFile:x,onShare:N,onDelete:C}):f.volume===null?o.jsx(fue,{onOpenDir:m}):o.jsx(mue,{location:f,onOpenDir:m,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:N,onDelete:C,onContextMenu:(q,fe)=>{B({path:q,kind:fe}),z(cn(q)),D(!0)},onMove:ue},f.volume)]})}),l&&(c.preview?o.jsx(Fj,{previewPath:c.preview,onClose:()=>p("preview",null)}):c.skill?o.jsx(J8,{skillPath:c.skill,onClose:()=>p("skill",null)},c.skill):c.brand?o.jsx(zj,{brandPath:c.brand,onClose:()=>p("brand",null)},c.brand):null),o.jsx(Ft,{open:A,onOpenChange:P,children:o.jsxs(zt,{children:[o.jsxs(cs,{children:[o.jsx(Kt,{children:n("library.library.newFolderTitle")}),o.jsx(Mn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(vt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:R,onChange:q=>E(q.target.value),onKeyDown:q=>{q.key==="Enter"&&se()}}),o.jsxs(qn,{children:[o.jsx(me,{variant:"outline",onClick:()=>P(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!R.trim()||Y.isPending,onClick:()=>{se()},children:n("library.library.create")})]})]})}),o.jsx(Ft,{open:I,onOpenChange:q=>{D(q),q||(B(null),z(""))},children:o.jsxs(zt,{children:[o.jsxs(cs,{children:[o.jsx(Kt,{children:O&&n("library.library.renameTitle",{name:cn(O.path)})}),o.jsx(Mn,{children:n("library.library.renameDescription")})]}),o.jsx(vt,{autoFocus:!0,value:M,onChange:q=>z(q.target.value),onKeyDown:q=>{q.key==="Enter"&&he()}}),o.jsxs(qn,{children:[o.jsx(me,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!M.trim()||Z.isPending,onClick:()=>{he()},children:n("library.library.rename")})]})]})}),o.jsx(Bde,{target:V,onOpenChange:q=>{q||N(null)}}),o.jsx(Gr,{open:j!==null,onOpenChange:q=>{q||C(null)},children:o.jsxs(Yr,{children:[o.jsxs(Qr,{children:[o.jsx(Xr,{children:n("library.library.deleteTitle",{name:j?cn(j.path):""})}),o.jsx(Jr,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(Zr,{children:[o.jsx(eo,{children:n("library.library.cancel")}),o.jsx(to,{onClick:()=>{ie()},children:n("library.library.delete")})]})]})})]})}function yue(){const t=F.c(10),{openPanel:e}=Di(),[s,n]=T.useState(null),[i,r]=T.useState(null);let a;t[0]!==e?(a=o.jsx(vue,{onOpenFile:h=>e(tV(h)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=a):a=t[1];let l;t[2]!==s?(l=s&&o.jsx(J8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=l):l=t[3];let c;t[4]!==i?(c=i&&o.jsx(zj,{brandPath:i,onClose:()=>r(null)},i),t[4]=i,t[5]=c):c=t[5];let d;return t[6]!==a||t[7]!==l||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[a,l,c]}),t[6]=a,t[7]=l,t[8]=c,t[9]=d):d=t[9],d}const Wv=T.lazy(()=>Ws(()=>import("./project-app-view-DKi7PUJM.js"),__vite__mapDeps([185,1,2,81,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,82,83,84,10,11,18,85,86,87,88,89,90,91,92,93,94,95,96,23,4,5,9,12,13,14,15,16,3,6,7,8,17,19,20,21,22,27,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,146,160,121,122,123,161,156,130,131,162,116,117,73,118,119,120,124,125,126,127,128,129,132,133,134,135,75,136,137,138,139,140,141,142,143,144,145,147,148,149,150,72,151,152,79,153,154,155,157,158,159,163,164,76,165,166,167])).then(t=>({default:t.AppViewContent}))),_ue=T.lazy(()=>Ws(()=>import("./index-DeRHV1NZ.js"),__vite__mapDeps([186,1,2,55,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,133,187,18,10,11,135,149,85,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,23,4,5,9,12,13,14,15,16,3,6,7,8,17,19,20,21,22,27,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,78,74,115,73])).then(t=>({default:t.HostingTab}))),Lue=T.lazy(()=>Ws(()=>import("./e2e-tab-DG1u-6iR.js"),__vite__mapDeps([188,1,2,36,28,40,29,30,31,32,33,34,35,37,38,39,24,41,42,43,25,44,26,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,133,74,78,149,23,73,85,187,18,10,11,135,81,82,83,84,86,87,88,89,90,91,92,93,94,95,96,4,5,9,12,13,14,15,16,3,6,7,8,17,19,20,21,22,27,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,118])).then(t=>({default:t.E2eTab}))),wue=T.lazy(()=>Ws(()=>import("./analytics-tab-DV5GngUD.js"),__vite__mapDeps([189,1,2,29,30,31,32,33,34,35,36,37,38,39,24,28,40,41,42,43,25,44,26,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,133,140,74,78,85,190,191,192,149,23,187,18,10,11,135])).then(t=>({default:t.AnalyticsTab}))),Sue=T.lazy(()=>Ws(()=>import("./cdn-tab-DnFT0Npy.js"),__vite__mapDeps([193,1,2,49,190,191,192,187,136,18,10,11,135,194,195])).then(t=>({default:t.CdnTab})));function kue(){const t=F.c(2),e=wP();let s;return t[0]!==e?(s=e?o.jsx(LH,{}):o.jsx(gH,{}),t[0]=e,t[1]=s):s=t[1],s}function jue({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:i,automationTabParsed:r}){const a=_P(),l=Em().monitorEnabled===!0||Em().auth.localMode===!0;if(t==="overview")return o.jsx(kue,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(WX,{})});if(sV(t))return o.jsx(y5,{virtualMcpId:e});if(t==="git")return o.jsx(IZ,{virtualMcpId:e});if(t==="automations")return o.jsx(ude,{virtualMcpId:e});if(t==="site-editor")return o.jsx(eae,{virtualMcpId:e});const c=Am(t);if(c)return o.jsx(nae,{openPath:c.path});if(t==="content")return o.jsx(vce,{virtualMcpId:e});if(t==="assets")return o.jsx(_ce,{virtualMcpId:e});if(t==="hosting"&&a.hosting)return o.jsx(_ue,{virtualMcpId:e});if(t==="e2e"&&a.e2e)return o.jsx(Lue,{virtualMcpId:e});if(t==="analytics"&&a.analytics)return o.jsx(wue,{virtualMcpId:e});if(t==="cdn"&&l&&a.monitor)return o.jsx(Sue,{virtualMcpId:e});if(t==="files")return o.jsx(yue,{});if(t==="reports")return o.jsx(bde,{});if(t==="discover")return o.jsx(Cde,{});if(t==="connect-sources")return o.jsx(pde,{});if(r)return o.jsx(ade,{tabId:t});const d=g6(t);if(d)return o.jsx(Fde,{path:d.path},d.path);const h=p6(t);if(h)return o.jsx(fde,{fileKey:h.key,taskId:s});const u=x6(t);if(u)return o.jsx(Wde,{path:u.path},u.path);const f=nV(t);if(f){const m=i.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(Ci,{children:o.jsx(Wv,{connectionId:f.connectionId,toolName:f.toolName,args:m?.args},t)})}const p=n.find(m=>m.id===t);return p?o.jsx(Ci,{children:o.jsx(Wv,{connectionId:p.view.appId,toolName:p.id,args:p.view.args},t)}):o.jsx(y5,{virtualMcpId:e})}function Cue(t){const e=F.c(13),{taskId:s,virtualMcpId:n}=t;let i;e[0]!==s||e[1]!==n?(i={virtualMcpId:n,taskId:s},e[0]=s,e[1]=n,e[2]=i):i=e[2];const{activeTab:r,layoutTabs:a,expandedTools:l,automationTabParsed:c}=e3(i);let d;e[3]!==r||e[4]!==c||e[5]!==l||e[6]!==a||e[7]!==s||e[8]!==n?(d=o.jsx(Ci,{children:o.jsx(jue,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:c})}),e[3]=r,e[4]=c,e[5]=l,e[6]=a,e[7]=s,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==r||e[11]!==d?(h=o.jsx(tn,{children:d},r),e[10]=r,e[11]=d,e[12]=h):h=e[12],h}const Nue=new Set(["site-editor","content"]);function Vue(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&Nue.has(t.mainTab)}const Da="setup";function Tue(t){const e=F.c(57),s=ae();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let _;e[3]!==t.scriptTabs?(_=y=>!t.scriptTabs.includes(y),e[3]=t.scriptTabs,e[4]=_):_=e[4],n=t.scripts.filter(_),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=n}else n=e[2];const i=n;let r;e[5]!==t?(r=()=>{t.active===Da?t.onToggle():t.onSelectTab(Da)},e[5]=t,e[6]=r):r=e[6];const a=r;let l;e[7]!==t.open||e[8]!==s?(l=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=l):l=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(hs,{className:"size-4"}):o.jsx(F6,{className:"size-4"}),e[10]=t.open,e[11]=c):c=e[11];let d;e[12]!==t.onToggle||e[13]!==t.open||e[14]!==l||e[15]!==c?(d=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":l,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=l,e[15]=c,e[16]=d):d=e[16];let h;e[17]!==t.open||e[18]!==s?(h=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=h):h=e[19];let u;e[20]!==h?(u=o.jsx(Ke,{children:h}),e[20]=h,e[21]=u):u=e[21];let f;e[22]!==d||e[23]!==u?(f=o.jsxs(We,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=f):f=e[24];const p=t.active===Da;let m;e[25]!==a||e[26]!==t.open||e[27]!==s||e[28]!==p?(m=o.jsx(Aue,{active:p,open:t.open,onClick:a,t:s}),e[25]=a,e[26]=t.open,e[27]=s,e[28]=p,e[29]=m):m=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(_=>o.jsx(Eue,{active:t.active===_,onClick:()=>{t.active===_?t.onToggle():t.onSelectTab(_)},onClose:()=>t.onCloseScript(_),t:s,children:_},_)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(Rue,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==m?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[m,g,x]}),e[36]=g,e[37]=x,e[38]=m,e[39]=b):b=e[39];let v;e[40]!==t.onRestart||e[41]!==t.onResume||e[42]!==t.onRetry||e[43]!==t.onRunActiveScript||e[44]!==t.onStart||e[45]!==t.onStop||e[46]!==t.onStopActiveScript||e[47]!==t.scriptIsKilling||e[48]!==t.scriptIsRunning||e[49]!==t.showScriptControls||e[50]!==t.status||e[51]!==s?(v=t.showScriptControls?o.jsx(Due,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(Pue,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry,t:s}),e[40]=t.onRestart,e[41]=t.onResume,e[42]=t.onRetry,e[43]=t.onRunActiveScript,e[44]=t.onStart,e[45]=t.onStop,e[46]=t.onStopActiveScript,e[47]=t.scriptIsKilling,e[48]=t.scriptIsRunning,e[49]=t.showScriptControls,e[50]=t.status,e[51]=s,e[52]=v):v=e[52];let L;return e[53]!==b||e[54]!==v||e[55]!==f?(L=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-2",children:[f,b,v]}),e[53]=b,e[54]=v,e[55]=f,e[56]=L):L=e[56],L}function Aue(t){const e=F.c(11),{active:s,open:n,onClick:i,t:r}=t,a=s&&n,l=s&&n,c=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let d;e[0]!==c?(d=re("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(uE,{className:"size-4"}),e[2]=h):h=e[2];let u;e[3]!==r?(u=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=u):u=e[4];let f;return e[5]!==i||e[6]!==a||e[7]!==l||e[8]!==d||e[9]!==u?(f=o.jsxs("button",{type:"button","aria-pressed":a,"aria-expanded":l,onClick:i,className:d,children:[h,u]}),e[5]=i,e[6]=a,e[7]=l,e[8]=d,e[9]=u,e[10]=f):f=e[10],f}function Pue(t){const e=F.c(40),{status:s,onStart:n,onStop:i,onRestart:r,onResume:a,onRetry:l,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-3.5"}),e[0]=d):d=e[0];let h;e[1]!==c?(h=c("sandbox.toolbar.start"),e[1]=c,e[2]=h):h=e[2];let u;return e[3]!==n||e[4]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:n,children:[d," ",h]}),e[3]=n,e[4]=h,e[5]=u):u=e[5],u}if(s==="suspended"&&a){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Oa,{className:"size-3.5"}),e[6]=d):d=e[6];let h;e[7]!==c?(h=c("sandbox.toolbar.resume"),e[7]=c,e[8]=h):h=e[8];let u;return e[9]!==a||e[10]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:a,children:[d," ",h]}),e[9]=a,e[10]=h,e[11]=u):u=e[11],u}if(s==="errored"&&l){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Dn,{className:"size-3.5"}),e[12]=d):d=e[12];let h;e[13]!==c?(h=c("sandbox.toolbar.retry"),e[13]=c,e[14]=h):h=e[14];let u;return e[15]!==l||e[16]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:l,children:[d," ",h]}),e[15]=l,e[16]=h,e[17]=u):u=e[17],u}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,h=d?"rounded-r-none border-r-0":void 0;let u;e[18]!==h?(u=re(h),e[18]=h,e[19]=u):u=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let p;e[22]!==i||e[23]!==u||e[24]!==f?(p=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:i,className:u,children:f})}),e[22]=i,e[23]=u,e[24]=f,e[25]=p):p=e[25];let m;e[26]!==c?(m=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=m):m=e[27];let g;e[28]!==m?(g=o.jsx(Ke,{children:m}),e[28]=m,e[29]=g):g=e[29];let x;e[30]!==p||e[31]!==g?(x=o.jsxs(We,{children:[p,g]}),e[30]=p,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs(Ot,{children:[o.jsx($t,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(hs,{className:"size-3"})})}),o.jsx(Bt,{align:"end",children:o.jsxs(Qe,{onClick:r,children:[o.jsx(Dn,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=r,e[34]=d,e[35]=c,e[36]=b):b=e[36];let v;return e[37]!==x||e[38]!==b?(v=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=v):v=e[39],v}return null}function Eue(t){const e=F.c(17),{active:s,onClick:n,onClose:i,children:r,t:a}=t,l=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==l?(c=re("flex h-6 items-center rounded-md border text-xs",l),e[0]=l,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",h=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let u;e[2]!==d||e[3]!==h?(u=re("flex h-full items-center",d,h),e[2]=d,e[3]=h,e[4]=u):u=e[4];let f;e[5]!==r||e[6]!==n||e[7]!==u?(f=o.jsx("button",{type:"button",onClick:n,className:u,children:r}),e[5]=r,e[6]=n,e[7]=u,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==i||e[11]!==a?(p=i&&o.jsx("button",{type:"button","aria-label":a("sandbox.toolbar.closeTab",{tab:String(r)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(nn,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=a,e[12]=p):p=e[12];let m;return e[13]!==c||e[14]!==f||e[15]!==p?(m=o.jsxs("div",{className:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16],m}function Rue(t){const e=F.c(27),{scripts:s,onRun:n}=t,i=ae(),[r,a]=T.useState(!1);let l;e[0]!==i?(l=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=l):l=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Qt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==l?(d=o.jsx(He,{asChild:!0,children:o.jsx(ws,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"xs","aria-label":l,children:c})})}),e[3]=l,e[4]=d):d=e[4];let h;e[5]!==i?(h=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=h):h=e[6];let u;e[7]!==h?(u=o.jsx(Ke,{children:h}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=o.jsxs(We,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let p;e[12]!==i?(p=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=p):p=e[13];let m;e[14]!==p?(m=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:p}),e[14]=p,e[15]=m):m=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(v=>o.jsxs("button",{type:"button",onClick:()=>{a(!1),n(v)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",v]},v)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==m||e[21]!==g?(x=o.jsxs(ks,{align:"start",className:"p-1 w-56",children:[m,g]}),e[20]=m,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==f?(b=o.jsxs(js,{open:r,onOpenChange:a,children:[f,x]}),e[23]=r,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function Due(t){const e=F.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:r,t:a}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(et,{className:"size-3.5"}),e[0]=f):f=e[0];let p;e[1]!==a?(p=a("sandbox.toolbar.stopping"),e[1]=a,e[2]=p):p=e[2];let m;return e[3]!==p?(m=o.jsxs(me,{variant:"outline",size:"xs",disabled:!0,children:[f," ",p]}),e[3]=p,e[4]=m):m=e[4],m}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Oa,{className:"size-3.5"}),e[5]=f):f=e[5];let p;e[6]!==a?(p=a("sandbox.toolbar.run"),e[6]=a,e[7]=p):p=e[7];let m;e[8]!==i||e[9]!==p?(m=o.jsx(He,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"xs",onClick:i,children:[f," ",p]})}),e[8]=i,e[9]=p,e[10]=m):m=e[10];let g;e[11]!==a?(g=a("sandbox.toolbar.startProcess"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(Ke,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==m||e[16]!==x?(b=o.jsxs(We,{children:[m,x]}),e[15]=m,e[16]=x,e[17]=b):b=e[17],b}let l;e[18]!==a?(l=a("sandbox.toolbar.stop"),e[18]=a,e[19]=l):l=e[19];let c;e[20]!==r||e[21]!==l?(c=o.jsx(He,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:r,children:l})}),e[20]=r,e[21]=l,e[22]=c):c=e[22];let d;e[23]!==a?(d=a("sandbox.toolbar.stopProcess"),e[23]=a,e[24]=d):d=e[24];let h;e[25]!==d?(h=o.jsx(Ke,{children:d}),e[25]=d,e[26]=h):h=e[26];let u;return e[27]!==c||e[28]!==h?(u=o.jsxs(We,{children:[c,h]}),e[27]=c,e[28]=h,e[29]=u):u=e[29],u}var Kj=Object.defineProperty,Mue=Object.getOwnPropertyDescriptor,Iue=(t,e)=>{for(var s in e)Kj(t,s,{get:e[s],enumerable:!0})},Ps=(t,e,s,n)=>{for(var i=n>1?void 0:n?Mue(e,s):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(i=(n?a(e,s,i):a(i))||i);return n&&i&&Kj(e,s,i),i},Xe=(t,e)=>(s,n)=>e(s,n,t),qv="Terminal input",$p={get:()=>qv,set:t=>qv=t},Gv="Too much output to announce, navigate to rows manually to read",Bp={get:()=>Gv,set:t=>Gv=t};function Oue(t){return t.replace(/\r?\n/g,"\r")}function $ue(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function Bue(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function zue(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");Wj(i,e,s,n)}}function Wj(t,e,s,n){t=Oue(t),t=$ue(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function qj(t,e,s){let n=s.getBoundingClientRect(),i=t.clientX-n.left-10,r=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${i}px`,e.style.top=`${r}px`,e.style.zIndex="1000",e.focus()}function Yv(t,e,s,n,i){qj(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Ro(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Z9(t,e=0,s=t.length){let n="";for(let i=e;i<s;++i){let r=t[i];r>65535?(r-=65536,n+=String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):n+=String.fromCharCode(r)}return n}var Fue=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i=0;if(this._interim){let r=t.charCodeAt(i++);56320<=r&&r<=57343?e[n++]=(this._interim-55296)*1024+r-56320+65536:(e[n++]=this._interim,e[n++]=r),this._interim=0}for(let r=i;r<s;++r){let a=t.charCodeAt(r);if(55296<=a&&a<=56319){if(++r>=s)return this._interim=a,n;let l=t.charCodeAt(r);56320<=l&&l<=57343?e[n++]=(a-55296)*1024+l-56320+65536:(e[n++]=a,e[n++]=l);continue}a!==65279&&(e[n++]=a)}return n}},Uue=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let n=0,i,r,a,l,c=0,d=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)p<<=6,p|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-m;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[m++]=g,p<<=6,p|=g&63}f||(x===2?p<128?d--:e[n++]=p:x===3?p<2048||p>=55296&&p<=57343||p===65279||(e[n++]=p):p<65536||p>1114111||(e[n++]=p)),this.interim.fill(0)}let h=s-4,u=d;for(;u<s;){for(;u<h&&!((i=t[u])&128)&&!((r=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[n++]=i,e[n++]=r,e[n++]=a,e[n++]=l,u+=4;if(i=t[u++],i<128)e[n++]=i;else if((i&224)===192){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(c=(i&31)<<6|r&63,c<128){u--;continue}e[n++]=c}else if((i&240)===224){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(i&15)<<12|(r&63)<<6|a&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=a,n;if(l=t[u++],(l&192)!==128){u--;continue}if(c=(i&7)<<18|(r&63)<<12|(a&63)<<6|l&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Gj="",zo=" ",A0=class Yj{constructor(){this.fg=0,this.bg=0,this.extended=new Mf}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Yj;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Mf=class Qj{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Qj(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},si=class Xj extends A0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Mf,this.combinedData=""}static fromCharData(e){let s=new Xj;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ro(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let i=e[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(n-55296)*1024+i-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Qv="di$target",zp="di$dependencies",dm=new Map;function Hue(t){return t[zp]||[]}function an(t){if(dm.has(t))return dm.get(t);let e=function(s,n,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Kue(e,s,i)};return e._id=t,dm.set(t,e),e}function Kue(t,e,s){e[Qv]===e?e[zp].push({id:t,index:s}):(e[zp]=[{id:t,index:s}],e[Qv]=e)}var Tn=an("BufferService"),Jj=an("CoreMouseService"),fl=an("CoreService"),Wue=an("CharsetService"),j4=an("InstantiationService"),Zj=an("LogService"),An=an("OptionsService"),eC=an("OscLinkService"),que=an("UnicodeService"),P0=an("DecorationService"),Fp=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let n=[],i=this._optionsService.rawOptions.linkHandler,r=new si,a=s.getTrimmedLength(),l=-1,c=-1,d=!1;for(let h=0;h<a;h++)if(!(c===-1&&!s.hasContent(h))){if(s.loadCell(h,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=h,l=r.extended.urlId;continue}else d=r.extended.urlId!==l;else c!==-1&&(d=!0);if(d||c!==-1&&h===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:c+1,y:t},end:{x:h+(!d&&h===a-1?1:0),y:t}},p=!1;if(!i?.allowNonHttpProtocols)try{let m=new URL(u);["http:","https:"].includes(m.protocol)||(p=!0)}catch{p=!0}p||n.push({text:u,range:f,activate:(m,g)=>i?i.activate(m,g,f):Gue(m,g),hover:(m,g)=>i?.hover?.(m,g,f),leave:(m,g)=>i?.leave?.(m,g,f)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=h,l=r.extended.urlId):(c=-1,l=-1)}}e(n)}};Fp=Ps([Xe(0,Tn),Xe(1,An),Xe(2,eC)],Fp);function Gue(t,e){if(confirm(`Do you want to navigate to ${e}?
816
816
 
817
817
  WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var e1=an("CharSizeService"),co=an("CoreBrowserService"),C4=an("MouseService"),uo=an("RenderService"),Yue=an("SelectionService"),tC=an("CharacterJoinerService"),_d=an("ThemeService"),sC=an("LinkProviderService"),Que=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Xv.isErrorNoTelemetry(t)?new Xv(t.message+`
818
818
 
@@ -831,4 +831,4 @@ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){t
831
831
 
832
832
  `)||n}}function D9e(t,e){const s=t.trim().split(`
833
833
  `);return QC({title:s[0]??"",body:s.slice(1).join(`
834
- `),fallbackTitle:e})}function $4(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function B4(t){return t.fastPreview?{fastPreview:!0}:void 0}async function km(t,e,s){try{return await s()}catch(n){throw new O4(n instanceof Error?n.message:e,t)}}async function XC(t){const e=t.expectedHeadSha;if(!e)return;const n=(await $c($4(t),B4(t)).catch(()=>null))?.headSha;if(n&&n!==e)throw new YC(e,n)}function JC(t,e){return EJ($4(t),e,B4(t))}function ZC(t,e){return E9e(t.orgSlug,t.target,{branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor})}async function eN(t,e,s){await XC(t),await km("push",s("thread.publishDialog.failedPushChanges"),()=>JC(t,e.message)),await km("sync",s("thread.publishDialog.failedRebase"),()=>sS($4(t),t.baseBranch,B4(t)));const n=await km("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>ZC(t,e));try{await GC(t.orgSlug,t.target,{number:n.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(i){throw new O4(i instanceof Error?i.message:s("thread.publishDialog.failedMergePullRequest"),"merge",n)}return n}async function tN(t,e){return await XC(t),await JC(t,e.message),ZC(t,e)}function M9e(t,e){return t instanceof YC?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof O4&&t.step==="merge"&&t.pr?{message:e("thread.publishDialog.mergeFailed",{prNumber:t.pr.number,message:t.message}),pullRequest:t.pr,headMoved:!1}:{message:t instanceof Error?t.message:e("thread.publishDialog.failedPublish"),pullRequest:null,headMoved:!1}}function j2(t,e){const s=M9e(t,e),n=s.pullRequest;return n&&ye.error(s.message,{action:{label:e("thread.publishDialog.viewPr"),onClick:()=>window.open(n.htmlUrl,"_blank","noopener,noreferrer")}}),{message:s.message,pullRequestOpened:n!==null,headMoved:s.headMoved}}function sN(t,e){ye.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnGithub"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function I9e(t){const{mode:e,target:s,note:n,allPaths:i,destinationHost:r,publishLockRef:a,onOpenChange:l,refresh:c,onPullRequestChanged:d,onPublished:h}=t,u=ae(),[f,p]=T.useState(!1),[m,g]=T.useState(!1),[x,b]=T.useState(),v=()=>D9e(n,u("thread.publishDialog.changesFrom",{branch:s.headBranch})),L=async()=>{a.current=!0,p(!0),b(void 0);try{await eN(s,v(),u),ye.success(r?u("thread.publishPopover.publishedTo",{host:r}):u("thread.publishDialog.publishedTo",{baseBranch:s.baseBranch})),l(!1),await Promise.all([d?.(),h?.()])}catch(w){const S=j2(w,u);b(S.message),S.pullRequestOpened&&await d?.(),S.headMoved&&await c()}finally{a.current=!1,p(!1)}},_=async()=>{a.current=!0,p(!0),b(void 0);try{const w=await tN(s,v());sN(w,u),l(!1),await d?.()}catch(w){const S=j2(w,u);b(S.message||u("thread.publishDialog.failedSubmitForReview")),S.headMoved&&await c()}finally{a.current=!1,p(!1)}},y=async(w,S)=>{g(!0);try{await Lp({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},w,{fastPreview:!0}),ye.success(S),await c()}catch(k){ye.error(k instanceof Error?k.message:u("thread.publishPopover.failedDiscard"))}finally{g(!1)}};return{isPublishing:f,isDiscarding:m,publishError:x,submit:e==="review"?_:L,discardChange:w=>y(w.filepaths,u("thread.publishPopover.discarded",{name:w.name})),discardAll:async()=>{i.length!==0&&await y(i,u("thread.publishDialog.allChangesDiscarded"))}}}function O9e(t,e,s,n,i){return["cms-publish-bodies",t,e,s,n,i]}const $9e=6e4;function B9e(t,e,s){const n=F.c(6);let i;n[0]!==s||n[1]!==t||n[2]!==e?(i=tt.decofile(`${t}/${e}/${s}`),n[0]=s,n[1]=t,n[2]=e,n[3]=i):i=n[3];let r;n[4]!==i?(r={queryKey:i,queryFn:aV},n[4]=i,n[5]=r):r=n[5];const{data:a}=Yt(r);return a}function z9e(t){const e=F.c(43),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,baseBranch:a}=t;let l,c,d,h;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c={orgSlug:s,virtualMcpId:n,branch:i,threadId:r},l={fastPreview:!0},d=Wf,h=aS(c,l),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=l,e[5]=c,e[6]=d,e[7]=h):(l=e[4],c=e[5],d=e[6],h=e[7]);const u=d(h),f=u.data,p=f.changedFiles??null,m=f.headSha??null,g=p?p.length>0:(f.aheadOfBase??0)>0;let x;e[8]!==a||e[9]!==i||e[10]!==m||e[11]!==s||e[12]!==n?(x=O9e(s,n,i,a,m),e[8]=a,e[9]=i,e[10]=m,e[11]=s,e[12]=n,e[13]=x):x=e[13];let b;e[14]!==a||e[15]!==l||e[16]!==c?(b=()=>hu(c,{base:a},l),e[14]=a,e[15]=l,e[16]=c,e[17]=b):b=e[17];let v;e[18]!==x||e[19]!==b||e[20]!==g?(v={queryKey:x,queryFn:b,enabled:g,staleTime:$9e},e[18]=x,e[19]=b,e[20]=g,e[21]=v):v=e[21];const L=Yt(v),_=B9e(s,n,i),y=L.data??null;let w;e[22]!==_||e[23]!==y||e[24]!==p?(w=p?KC({files:p,lookup:_,diff:y}):m9e(y),e[22]=_,e[23]=y,e[24]=p,e[25]=w):w=e[25];const S=w;let k;e[26]!==y?.diffs||e[27]!==p?(k=p?p.map(F9e):Object.keys(y?.diffs??{}),e[26]=y?.diffs,e[27]=p,e[28]=k):k=e[28];const j=f.changedFilesTotal??S.count,C=f.changedFilesTruncated??!1,V=g&&L.isPending,N=!p&&g&&L.isPending;let A;e[29]!==u?(A=()=>u.refetch(),e[29]=u,e[30]=A):A=e[30];let P;return e[31]!==L.isError||e[32]!==y||e[33]!==m||e[34]!==f||e[35]!==S||e[36]!==N||e[37]!==A||e[38]!==k||e[39]!==j||e[40]!==C||e[41]!==V?(P={status:f,summary:S,allPaths:k,changedFilesTotal:j,changedFilesTruncated:C,headSha:m,diff:y,bodiesPending:V,bodiesFailed:L.isError,cardsPending:N,refresh:A},e[31]=L.isError,e[32]=y,e[33]=m,e[34]=f,e[35]=S,e[36]=N,e[37]=A,e[38]=k,e[39]=j,e[40]=C,e[41]=V,e[42]=P):P=e[42],P}function F9e(t){return t.path}function U9e(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function H9e(t){const e=F.c(28),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:a,status:l,diff:c,enabled:d}=t,[h]=ro(),{language:u}=h;let f,p,m;if(e[0]!==i||e[1]!==c||e[2]!==d||e[3]!==a||e[4]!==u||e[5]!==s||e[6]!==l||e[7]!==r||e[8]!==n){const y=c?MJ(c):"";f=d&&!!i&&!!l&&!!c&&y!=="",m=Yt,p=U9e({orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:a,signature:y,language:u}),e[0]=i,e[1]=c,e[2]=d,e[3]=a,e[4]=u,e[5]=s,e[6]=l,e[7]=r,e[8]=n,e[9]=f,e[10]=p,e[11]=m}else f=e[9],p=e[10],m=e[11];let g;e[12]!==i||e[13]!==c||e[14]!==a||e[15]!==u||e[16]!==s||e[17]!==l||e[18]!==r||e[19]!==n?(g=()=>IJ({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},{status:l,diff:c,language:u},a?{fastPreview:!0}:void 0),e[12]=i,e[13]=c,e[14]=a,e[15]=u,e[16]=s,e[17]=l,e[18]=r,e[19]=n,e[20]=g):g=e[20];let x;e[21]!==f||e[22]!==p||e[23]!==g?(x={queryKey:p,queryFn:g,enabled:f,staleTime:1/0,gcTime:6e5,retry:K9e},e[21]=f,e[22]=p,e[23]=g,e[24]=x):x=e[24];const b=m(x),v=b.data??null,L=f&&b.isFetching&&!b.data;let _;return e[25]!==v||e[26]!==L?(_={verdict:v,loading:L},e[25]=v,e[26]=L,e[27]=_):_=e[27],_}function K9e(t,e){return!eS(e)&&t<1}function nN(t){const e=F.c(30),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:a,status:l,diff:c,policy:d,judgeEnabled:h,paths:u}=t,f=h===void 0?!0:h,p=u===void 0?null:u;let m;e[0]!==c||e[1]!==f||e[2]!==d?(m=f&&KJ(c,d),e[0]=c,e[1]=f,e[2]=d,e[3]=m):m=e[3];const g=m;let x;e[4]!==i||e[5]!==c||e[6]!==a||e[7]!==g||e[8]!==s||e[9]!==l||e[10]!==r||e[11]!==n?(x={orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:a,status:l,diff:c,enabled:g},e[4]=i,e[5]=c,e[6]=a,e[7]=g,e[8]=s,e[9]=l,e[10]=r,e[11]=n,e[12]=x):x=e[12];const{verdict:b,loading:v}=H9e(x);if(!c&&p){let w;e[13]!==p||e[14]!==d?(w=HJ(p,d),e[13]=p,e[14]=d,e[15]=w):w=e[15];let S;return e[16]!==w?(S={gate:w,ready:!1},e[16]=w,e[17]=S):S=e[17],S}if(!c){let w;return e[18]===Symbol.for("react.memo_cache_sentinel")?(w={gate:{allowed:!0,reason:null},ready:!1},e[18]=w):w=e[18],w}if(!g){let w;e[19]!==c||e[20]!==d?(w=UJ(c,d),e[19]=c,e[20]=d,e[21]=w):w=e[21];let S;return e[22]!==w?(S={gate:w,ready:!0},e[22]=w,e[23]=S):S=e[23],S}let L;e[24]!==v||e[25]!==b?(L=WJ(b,v),e[24]=v,e[25]=b,e[26]=L):L=e[26];const _=!v;let y;return e[27]!==L||e[28]!==_?(y={gate:L,ready:_},e[27]=L,e[28]=_,e[29]=y):y=e[29],y}const iN="(max-width: 479px)";function W9e(t){const e=globalThis.matchMedia(iN);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function q9e(){return T.useSyncExternalStore(W9e,Y9e,G9e)}function G9e(){return!1}function Y9e(){return globalThis.matchMedia(iN).matches}function Q9e(t){const e=F.c(22),s=q9e(),n=T.useRef(!1);let i;e[0]!==t?(i=d=>{!d&&n.current||t.onOpenChange(d)},e[0]=t,e[1]=i):i=e[1];const r=i;if(s){let d;e[2]!==t?(d=t.open?o.jsx(Uy,{...t,publishLockRef:n}):null,e[2]=t,e[3]=d):d=e[3];let h;e[4]!==d?(h=o.jsx(zt,{className:"flex max-h-[85vh] w-[92vw] max-w-[420px] flex-col gap-0 overflow-hidden p-0",children:d}),e[4]=d,e[5]=h):h=e[5];let u;e[6]!==r||e[7]!==t.open||e[8]!==h?(u=o.jsx(Ft,{open:t.open,onOpenChange:r,children:h}),e[6]=r,e[7]=t.open,e[8]=h,e[9]=u):u=e[9];let f;return e[10]!==t.children||e[11]!==u?(f=o.jsxs(o.Fragment,{children:[t.children,u]}),e[10]=t.children,e[11]=u,e[12]=f):f=e[12],f}let a;e[13]!==t.children?(a=o.jsx(vP,{asChild:!0,children:o.jsx("span",{className:"inline-flex",children:t.children})}),e[13]=t.children,e[14]=a):a=e[14];let l;e[15]!==t?(l=o.jsx(ks,{align:"end",sideOffset:8,collisionPadding:12,onFocusOutside:X9e,className:"flex max-h-[min(720px,85vh)] w-[420px] flex-col gap-0 overflow-hidden p-0",children:o.jsx(Uy,{...t,publishLockRef:n})}),e[15]=t,e[16]=l):l=e[16];let c;return e[17]!==r||e[18]!==t.open||e[19]!==a||e[20]!==l?(c=o.jsxs(js,{open:t.open,onOpenChange:r,children:[a,l]}),e[17]=r,e[18]=t.open,e[19]=a,e[20]=l,e[21]=c):c=e[21],c}function X9e(t){return t.preventDefault()}function z4(t){const e=F.c(11),{mode:s,title:n,subLine:i,trailing:r}=t,a=s==="review"?Fo:jn;let l;e[0]!==a?(l=o.jsx(a,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==l||e[3]!==n||e[4]!==r?(c=o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[l,n,r]}),e[2]=l,e[3]=n,e[4]=r,e[5]=c):c=e[5];let d;e[6]!==i?(d=i?o.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:i}):null,e[6]=i,e[7]=d):d=e[7];let h;return e[8]!==c||e[9]!==d?(h=o.jsxs(o.Fragment,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=h):h=e[10],h}function F4(t){const e=F.c(9),{draftPreviewUrl:s,t:n}=t;let i;e[0]!==s?(i=()=>{s&&window.open(s,"_blank","noopener,noreferrer")},e[0]=s,e[1]=i):i=e[1];const r=!s;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(h0,{className:"size-4"}),e[2]=a):a=e[2];let l;e[3]!==n?(l=n("thread.publishPopover.preview"),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==i||e[6]!==r||e[7]!==l?(c=o.jsxs(me,{type:"button",variant:"outline",onClick:i,disabled:r,children:[a,l]}),e[5]=i,e[6]=r,e[7]=l,e[8]=c):c=e[8],c}function J9e(t){const e=F.c(20),{mode:s,draftPreviewUrl:n}=t,i=ae();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx($r,{className:"h-3.5 w-48"}),e[0]=r):r=e[0];let a;e[1]!==s?(a=o.jsx(z4,{mode:s,title:r}),e[1]=s,e[2]=a):a=e[2];let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(w2,{children:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Lu,{}),o.jsx(Lu,{}),o.jsx(Lu,{})]})}),c=o.jsxs(o.Fragment,{children:[o.jsx($r,{className:"h-3 w-20"}),o.jsx($r,{className:"h-14 w-full rounded-lg"})]}),e[3]=l,e[4]=c):(l=e[3],c=e[4]);let d;e[5]!==n||e[6]!==i?(d=o.jsx(F4,{draftPreviewUrl:n,t:i}),e[5]=n,e[6]=i,e[7]=d):d=e[7];const h=s==="review"?"default":"brand";let u;e[8]!==s||e[9]!==i?(u=i(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[8]=s,e[9]=i,e[10]=u):u=e[10];let f;e[11]!==h||e[12]!==u?(f=o.jsx(me,{type:"button",variant:h,className:"flex-1",disabled:!0,children:u}),e[11]=h,e[12]=u,e[13]=f):f=e[13];let p;e[14]!==d||e[15]!==f?(p=o.jsxs("div",{className:"flex gap-2",children:[d,f]}),e[14]=d,e[15]=f,e[16]=p):p=e[16];let m;return e[17]!==a||e[18]!==p?(m=o.jsx(I4,{state:"loading",header:a,body:l,note:c,footer:p}),e[17]=a,e[18]=p,e[19]=m):m=e[19],m}function Z9e(t){const e=F.c(25),{mode:s,draftPreviewUrl:n,message:i,onRetry:r}=t,a=ae();let l;e[0]!==a?(l=a("thread.publishPopover.loadFailed"),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("span",{className:"truncate",children:l}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==s||e[5]!==c?(d=o.jsx(z4,{mode:s,title:c}),e[4]=s,e[5]=c,e[6]=d):d=e[6];let h;e[7]!==i?(h=o.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:i}),e[7]=i,e[8]=h):h=e[8];let u;e[9]!==n||e[10]!==a?(u=o.jsx(F4,{draftPreviewUrl:n,t:a}),e[9]=n,e[10]=a,e[11]=u):u=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Dn,{className:"size-4"}),e[12]=f):f=e[12];let p;e[13]!==a?(p=a("thread.publishPopover.retry"),e[13]=a,e[14]=p):p=e[14];let m;e[15]!==r||e[16]!==p?(m=o.jsxs(me,{type:"button",variant:"outline",className:"flex-1",onClick:r,children:[f,p]}),e[15]=r,e[16]=p,e[17]=m):m=e[17];let g;e[18]!==u||e[19]!==m?(g=o.jsxs("div",{className:"flex gap-2",children:[u,m]}),e[18]=u,e[19]=m,e[20]=g):g=e[20];let x;return e[21]!==d||e[22]!==h||e[23]!==g?(x=o.jsx(I4,{state:"ready",header:d,body:h,footer:g}),e[21]=d,e[22]=h,e[23]=g,e[24]=x):x=e[24],x}function Uy(t){const e=F.c(14),s=t.mode??"publish";let n;e[0]!==s||e[1]!==t.draftPreviewUrl?(n=c=>{const{error:d,resetError:h}=c;return o.jsx(Z9e,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:d?.message??"",onRetry:h})},e[0]=s,e[1]=t.draftPreviewUrl,e[2]=n):n=e[2];let i;e[3]!==s||e[4]!==t.draftPreviewUrl?(i=o.jsx(J9e,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),e[3]=s,e[4]=t.draftPreviewUrl,e[5]=i):i=e[5];let r;e[6]!==t?(r=o.jsx(e1e,{...t}),e[6]=t,e[7]=r):r=e[7];let a;e[8]!==i||e[9]!==r?(a=o.jsx(T.Suspense,{fallback:i,children:r}),e[8]=i,e[9]=r,e[10]=a):a=e[10];let l;return e[11]!==n||e[12]!==a?(l=o.jsx(tn,{fallback:n,children:a}),e[11]=n,e[12]=a,e[13]=l):l=e[13],l}function e1e(t){const e=F.c(160),{publishLockRef:s,onOpenChange:n,mode:i,orgSlug:r,virtualMcpId:a,branch:l,baseBranch:c,repoTarget:d,owner:h,repo:u,publishPolicy:f,draftPreviewUrl:p,destinationHost:m,lastPublishedPr:g,onRequestApproval:x,openPullRequest:b,onPullRequestChanged:v,onPublished:L}=t,_=i===void 0?"publish":i,y=g===void 0?null:g,w=b===void 0?null:b,S=ae(),k=Ts()?.taskId??null,{data:j}=On.useSession();let C;e[0]!==c||e[1]!==l||e[2]!==r||e[3]!==k||e[4]!==a?(C={orgSlug:r,virtualMcpId:a,branch:l,threadId:k,baseBranch:c},e[0]=c,e[1]=l,e[2]=r,e[3]=k,e[4]=a,e[5]=C):C=e[5];const{status:V,summary:N,allPaths:A,changedFilesTotal:P,changedFilesTruncated:R,headSha:E,diff:I,bodiesPending:D,bodiesFailed:O,cardsPending:B,refresh:M}=z9e(C),[z,$]=T.useState(null),[U,H]=T.useState(!1),[W,K]=T.useState(null),[G,Y]=T.useState(null);let Z;e[6]!==z||e[7]!==N?(Z=b9e(z,y9e(N)),e[6]=z,e[7]=N,e[8]=Z):Z=e[8];const te=Z,X=_==="review",ee=B?"loading":D?"manifest":"ready",J=!X;let Q;e[9]!==A||e[10]!==l||e[11]!==I||e[12]!==V||e[13]!==r||e[14]!==f||e[15]!==J||e[16]!==k||e[17]!==a?(Q={orgSlug:r,virtualMcpId:a,branch:l,threadId:k,fastPreview:!0,status:V,diff:I,paths:A,policy:f,judgeEnabled:J},e[9]=A,e[10]=l,e[11]=I,e[12]=V,e[13]=r,e[14]=f,e[15]=J,e[16]=k,e[17]=a,e[18]=Q):Q=e[18];const{gate:oe}=nN(Q),le=w?.state==="open";let de;e[19]!==l||e[20]!==V?(de=P3(V)??l,e[19]=l,e[20]=V,e[21]=de):de=e[21];const se=j?.user;let ie;e[22]!==se?(ie=M4(se),e[22]=se,e[23]=ie):ie=e[23];const he=E??void 0;let ue;e[24]!==c||e[25]!==l||e[26]!==r||e[27]!==h||e[28]!==u||e[29]!==d||e[30]!==ie||e[31]!==he||e[32]!==de||e[33]!==k||e[34]!==a?(ue={orgSlug:r,virtualMcpId:a,branch:l,threadId:k,fastPreview:!0,baseBranch:c,target:d,owner:h,repo:u,headBranch:de,coAuthor:ie,expectedHeadSha:he},e[24]=c,e[25]=l,e[26]=r,e[27]=h,e[28]=u,e[29]=d,e[30]=ie,e[31]=he,e[32]=de,e[33]=k,e[34]=a,e[35]=ue):ue=e[35];const ce=ue;let ne;e[36]!==A||e[37]!==m||e[38]!==_||e[39]!==te||e[40]!==n||e[41]!==L||e[42]!==v||e[43]!==s||e[44]!==M||e[45]!==ce?(ne={mode:_,target:ce,note:te,allPaths:A,destinationHost:m,publishLockRef:s,onOpenChange:n,refresh:M,onPullRequestChanged:v,onPublished:L},e[36]=A,e[37]=m,e[38]=_,e[39]=te,e[40]=n,e[41]=L,e[42]=v,e[43]=s,e[44]=M,e[45]=ce,e[46]=ne):ne=e[46];const{isPublishing:q,isDiscarding:fe,publishError:ge,submit:_e,discardChange:Le,discardAll:je}=I9e(ne),Ce=!q&&N.count>0&&(X||oe.allowed);let Pe;e[47]!==X||e[48]!==N.count||e[49]!==S?(Pe=X?N.count===0?S("thread.publishPopover.submitForReview"):N.count===1?S("thread.publishPopover.submitOneForReview"):S("thread.publishPopover.submitCountForReview",{count:N.count}):N.count===0?S("thread.publishPopover.publish"):N.count===1?S("thread.publishPopover.publishOneInProduction"):S("thread.publishPopover.publishCountInProduction",{count:N.count}),e[47]=X,e[48]=N.count,e[49]=S,e[50]=Pe):Pe=e[50];const pe=Pe;let ke;e:{if(X&&le){let lt;e[51]!==w.number||e[52]!==S?(lt=S("thread.publishPopover.updatesPullRequest",{number:w.number}),e[51]=w.number,e[52]=S,e[53]=lt):lt=e[53],ke=lt;break e}const ht=y;if(!ht?.mergedAt){ke=null;break e}let ct;if(e[54]!==ht||e[55]!==S){const lt=ud(new Date(ht.mergedAt)),Ge=P9e(ht);ct=Ge?S("thread.publishPopover.lastPublishedBy",{when:lt,name:Ge}):S("thread.publishPopover.lastPublished",{when:lt}),e[54]=ht,e[55]=S,e[56]=ct}else ct=e[56];ke=ct}const Te=ke;let we;e[57]!==X||e[58]!==N.count||e[59]!==S?(we=X?S("thread.publishPopover.submitForReview"):N.count===1?S("thread.publishPopover.publishOne"):N.count>1?S("thread.publishPopover.publishCount",{count:N.count}):S("thread.publishPopover.publish"),e[57]=X,e[58]=N.count,e[59]=S,e[60]=we):we=e[60];const Ne=we;let Oe;e[61]!==D||e[62]!==G||e[63]!==Le||e[64]!==W||e[65]!==I||e[66]!==fe||e[67]!==q?(Oe=(ht,ct)=>ct.length===0?null:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("div",{className:"px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:ht}),ct.map(lt=>{const Ge=WC(lt);return o.jsx(C9e,{change:lt,diff:I,bodyPending:D,expanded:W===Ge,onToggleExpanded:()=>K(W===Ge?null:Ge),confirming:G===Ge,onConfirmingChange:wt=>Y(wt?Ge:null),onDiscard:()=>{Le(lt)},isPublishing:q,isDiscarding:fe},Ge)})]}),e[61]=D,e[62]=G,e[63]=Le,e[64]=W,e[65]=I,e[66]=fe,e[67]=q,e[68]=Oe):Oe=e[68];const nt=Oe;let Fe;e:{if(X||N.count===0){Fe=null;break e}if(oe.pending){let Ge;e[69]===Symbol.for("react.memo_cache_sentinel")?(Ge=o.jsx(et,{className:"size-3.5 motion-reduce:animate-none"}),e[69]=Ge):Ge=e[69];let wt;e[70]!==S?(wt=S("thread.publishPopover.reviewing"),e[70]=S,e[71]=wt):wt=e[71];let Pt;e[72]!==wt?(Pt=o.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[Ge,wt]}),e[72]=wt,e[73]=Pt):Pt=e[73],Fe=Pt;break e}if(oe.allowed){Fe=null;break e}let ht;e[74]===Symbol.for("react.memo_cache_sentinel")?(ht=o.jsx(na,{className:"mt-0.5 size-3.5 shrink-0"}),e[74]=ht):ht=e[74];let ct;e[75]!==oe.reason||e[76]!==S?(ct=oe.reason??S("thread.publishPopover.needsReviewGeneric"),e[75]=oe.reason,e[76]=S,e[77]=ct):ct=e[77];let lt;e[78]!==ct?(lt=o.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[ht,o.jsx("span",{children:ct})]}),e[78]=ct,e[79]=lt):lt=e[79],Fe=lt}const yt=Fe;let it;e:{if(N.count<=1||R){it=null;break e}if(U){let wt;e[80]!==S?(wt=S("thread.publishPopover.discardAllConfirm"),e[80]=S,e[81]=wt):wt=e[81];let Pt;e[82]!==wt?(Pt=o.jsx("span",{className:"text-destructive",children:wt}),e[82]=wt,e[83]=Pt):Pt=e[83];let Zt;e[84]===Symbol.for("react.memo_cache_sentinel")?(Zt=()=>H(!1),e[84]=Zt):Zt=e[84];let Dt;e[85]!==S?(Dt=S("thread.publishDialog.cancel"),e[85]=S,e[86]=Dt):Dt=e[86];let $e;e[87]!==Dt?($e=o.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:Zt,children:Dt}),e[87]=Dt,e[88]=$e):$e=e[88];let Lt;e[89]!==je?(Lt=()=>{H(!1),je()},e[89]=je,e[90]=Lt):Lt=e[90];let Se;e[91]!==S?(Se=S("thread.publishPopover.discard"),e[91]=S,e[92]=Se):Se=e[92];let Ye;e[93]!==fe||e[94]!==Lt||e[95]!==Se?(Ye=o.jsx("button",{type:"button",className:"font-medium text-destructive disabled:opacity-50",onClick:Lt,disabled:fe,children:Se}),e[93]=fe,e[94]=Lt,e[95]=Se,e[96]=Ye):Ye=e[96];let ot;e[97]!==Pt||e[98]!==$e||e[99]!==Ye?(ot=o.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11px]",children:[Pt,$e,Ye]}),e[97]=Pt,e[98]=$e,e[99]=Ye,e[100]=ot):ot=e[100],it=ot;break e}let ht;e[101]===Symbol.for("react.memo_cache_sentinel")?(ht=()=>H(!0),e[101]=ht):ht=e[101];const ct=q||fe;let lt;e[102]!==S?(lt=S("thread.publishPopover.discardAll"),e[102]=S,e[103]=lt):lt=e[103];let Ge;e[104]!==ct||e[105]!==lt?(Ge=o.jsx("button",{type:"button",className:"ml-auto shrink-0 text-[11px] text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:ht,disabled:ct,children:lt}),e[104]=ct,e[105]=lt,e[106]=Ge):Ge=e[106],it=Ge}const st=it;let ft;e[107]!==O||e[108]!==B||e[109]!==P||e[110]!==R||e[111]!==X||e[112]!==nt||e[113]!==N.blocks||e[114]!==N.count||e[115]!==N.other||e[116]!==N.pages||e[117]!==S?(ft=B?o.jsx(w2,{children:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Lu,{}),o.jsx(Lu,{})]})}):N.count===0?o.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[o.jsx(xr,{className:"mb-1 size-5 text-success"}),o.jsx("p",{className:"text-sm font-medium",children:S(X?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:S(X?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):o.jsxs(w2,{children:[R?o.jsx("p",{className:"text-[11px] text-muted-foreground",children:S("thread.publishPopover.showingFirst",{shown:N.count,total:P})}):null,nt(S("thread.publishPopover.pagesGroup"),N.pages),nt(S("thread.publishPopover.blocksGroup"),N.blocks),nt(S("thread.publishPopover.otherGroup"),N.other),O?o.jsx("p",{className:"text-[11px] text-muted-foreground",children:S("thread.publishPopover.detailsUnavailable")}):null]}),e[107]=O,e[108]=B,e[109]=P,e[110]=R,e[111]=X,e[112]=nt,e[113]=N.blocks,e[114]=N.count,e[115]=N.other,e[116]=N.pages,e[117]=S,e[118]=ft):ft=e[118];const _t=ft;let mt;e[119]!==pe?(mt=o.jsx("span",{className:"truncate",children:pe}),e[119]=pe,e[120]=mt):mt=e[120];let Ze;e[121]!==st||e[122]!==_||e[123]!==Te||e[124]!==mt?(Ze=o.jsx(z4,{mode:_,title:mt,subLine:Te,trailing:st}),e[121]=st,e[122]=_,e[123]=Te,e[124]=mt,e[125]=Ze):Ze=e[125];let rt;e[126]!==q||e[127]!==X||e[128]!==te||e[129]!==N.count||e[130]!==S?(rt=N.count===0?null:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-[13px] font-medium",children:S(X?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),o.jsx(Jo,{value:te,onChange:ht=>$(ht.target.value),placeholder:S(X?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,className:"resize-none text-[13px]",disabled:q})]}),e[126]=q,e[127]=X,e[128]=te,e[129]=N.count,e[130]=S,e[131]=rt):rt=e[131];let xt;e[132]!==p||e[133]!==S?(xt=o.jsx(F4,{draftPreviewUrl:p,t:S}),e[132]=p,e[133]=S,e[134]=xt):xt=e[134];let be;e[135]!==Ce||e[136]!==oe||e[137]!==q||e[138]!==X||e[139]!==x||e[140]!==Ne||e[141]!==_e||e[142]!==N.count||e[143]!==S?(be=!X&&N.count>0&&!oe.allowed&&!oe.pending?o.jsx(me,{type:"button",className:"flex-1",onClick:x,disabled:q,children:S("thread.publishPopover.requestApproval")}):o.jsxs(me,{type:"button",variant:X?"default":"brand",className:"flex-1",onClick:()=>{_e()},disabled:!Ce,children:[q?o.jsx(et,{className:"size-4 motion-reduce:animate-none"}):null,q?S(X?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):Ne]}),e[135]=Ce,e[136]=oe,e[137]=q,e[138]=X,e[139]=x,e[140]=Ne,e[141]=_e,e[142]=N.count,e[143]=S,e[144]=be):be=e[144];let Re;e[145]!==xt||e[146]!==be?(Re=o.jsxs("div",{className:"flex gap-2",children:[xt,be]}),e[145]=xt,e[146]=be,e[147]=Re):Re=e[147];let Me;e[148]!==ge?(Me=ge?o.jsx("p",{className:"text-xs text-destructive",children:ge}):null,e[148]=ge,e[149]=Me):Me=e[149];let dt;e[150]!==Re||e[151]!==Me?(dt=o.jsxs(o.Fragment,{children:[Re,Me]}),e[150]=Re,e[151]=Me,e[152]=dt):dt=e[152];let ut;return e[153]!==_t||e[154]!==yt||e[155]!==ee||e[156]!==Ze||e[157]!==rt||e[158]!==dt?(ut=o.jsx(I4,{state:ee,header:Ze,body:_t,note:rt,gate:yt,footer:dt}),e[153]=_t,e[154]=yt,e[155]=ee,e[156]=Ze,e[157]=rt,e[158]=dt,e[159]=ut):ut=e[159],ut}function t1e(){return!1}function rN(t,e){t1e()&&console.log(`[github-header] ${t}`,e??"")}function s1e(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return sk[t].short}const n1e=new Set(["failure","timed_out","cancelled","action_required"]);function oN(t){return t.status==="completed"&&n1e.has(t.conclusion)}function U4(t){return t.status==="queued"||t.status==="in_progress"}function Uh(t){return t.isPending&&t.fetchStatus!=="idle"}function i1e(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr-page"}}function Ar(t,e,s){return e?[...t,i1e(s)]:t}function vi(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"sync",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function Hy(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function jh(t,e,s){if(e.filter(U4).length===0)return t;const i=e.filter(r=>r.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:i,total:e.length})}}function r1e(t){const{lifecycle:e,branch:s,pr:n,checks:i,reviews:r,loading:a,t:l}=t;if(a)return{label:l("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&s1e(t.claimPhase.kind)||l("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:l("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:l("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||l("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:l("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:l("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:l("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:l("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForBranchTooltip"),menu:[]};const c=s,d=c.unpushed>0&&!(n&&c.headSha&&n.headSha&&c.headSha===n.headSha);if(t.noReviewableDiff&&!n)return{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:vi([],c,l)};if(c.workingTreeDirty||d)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:vi(Ar([Hy(l)],n,l),c,l)};if(rN("no local work — checking PR/sync state",{workingTreeDirty:c.workingTreeDirty,unpushed:c.unpushed,aheadOfBase:c.aheadOfBase,behindBase:c.behindBase,branch:c.branch,base:c.base,prMerged:n?.merged??null,prState:n?.state??null}),n?.merged)return!!c.headSha&&!!n.headSha&&c.headSha!==n.headSha?{label:l("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:l("thread.headerActions.openNewPrTooltip"),menu:vi(Ar([],n,l),c,l)}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.prMergedTooltip",{prNumber:String(n.number),base:n.base}),menu:vi(Ar([],n,l),c,l)};if(c.aheadOfBase>0){if(n&&n.state==="closed"&&!n.merged)return{label:l("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:l("thread.headerActions.reopenPrTooltip",{prNumber:String(n.number)}),menu:vi(Ar([],n,l),c,l)};if(!n)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:vi([Hy(l)],c,l)};if((r?.mergeableState??"unknown")==="dirty")return{label:l("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:l("thread.cmsActions.resolveOnGithub"),action:"open-pr-page"}]};const u=i.filter(U4).length,f=i.filter(oN).map(m=>m.name);if(u===0&&f.length>0)return{label:l("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:l("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:vi(Ar([{key:"publish-anyway",label:l("thread.headerActions.publishAnyway"),action:"merge",tooltip:l("thread.headerActions.squashMergeTooltip",{prNumber:String(n.number),base:n.base})}],n,l),c,l)};if(r?.draft)return jh({label:l("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:l("thread.headerActions.markDraftReadyTooltip"),menu:vi(Ar([],n,l),c,l)},i,l);const p=r?.unresolvedConversations??0;return p>0?jh({label:l("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:l("thread.headerActions.unresolvedConversationsTooltip",{count:String(p)}),menu:vi(Ar([],n,l),c,l)},i,l):r?.missingRequiredApprovals?jh({label:l("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:l("thread.headerActions.waitingForApprovalsTooltip"),menu:vi(Ar([],n,l),c,l)},i,l):jh({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:vi(Ar([{key:"review",label:l("thread.headerActions.review"),action:"review"}],n,l),c,l)},i,l)}return c.behindBase>0?{label:l("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:[]}}function Ky(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr"}}function Ch(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"get-latest",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function Wy(t,e,s,n){const i=e.length;if(i===0)return t;if(e.filter(U4).length>0){const l=e.filter(d=>d.status==="completed").length,c=n("thread.cmsActions.checksRunning",{done:l,total:i});return s==="loading"?{...t,loading:!0,tooltip:c}:{...t,tooltip:c}}const a=e.filter(oN).length;return a>0?{...t,variant:"warning",tooltip:n("thread.cmsActions.checksFailing",{failed:a,total:i})}:t}function o1e(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function a1e(t){return Uh(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:Uh(t.checksQuery)||Uh(t.reviewsQuery)}function l1e(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function c1e(t){const{branch:e,pr:s,checks:n,reviews:i,publishing:r,saving:a,loading:l,publishableChangeCount:c,t:d}=t;if(e.kind!=="ready"&&t.statusError)return{label:d("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(l||e.kind!=="ready")return{label:d("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(r)return{label:d("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:d("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(a)return{label:d("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(s&&s.state==="open"&&!s.merged?s:null){const u=i?.mergeableState??"unknown";return u==="dirty"?{label:d("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:d("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:d("thread.cmsActions.resolveOnGithub"),action:"open-pr"}]}:u==="blocked"||i?.draft?Wy({label:d("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:Ch([Ky(d)],e,d)},n,"loading",d):Wy({label:d("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Ch([Ky(d)],e,d)},n,"none",d)}return o1e(s,e)?{label:d("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:Ch([],e,d)}:l1e(e,c)?{label:d("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Ch([{key:"request-approval",label:d("thread.headerActions.submitForReview"),action:"request-approval"}],e,d)}:e.behindBase>0?{label:d("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:d("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:d("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:[]}}function d1e(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function aN(t){const e=F.c(4);let s;e[0]!==t?(s=IP(t),e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n={...s,select:u1e},e[2]=s,e[3]=n):n=e[3],Yt(n)}function u1e(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:d1e(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function qy(t,e){return t==="open-pr"||e==="resolve-on-github"?o.jsx(ur,{size:16}):t==="publish"?o.jsx(d8,{className:"size-4"}):t==="get-latest"||t==="retry-status"?o.jsx(Dn,{className:"size-4"}):o.jsx(Fo,{className:"size-4"})}function h1e(t){const e=F.c(62),{virtualMcpId:s}=t,n=ae(),{org:i}=Ue(),r=Vs(),a=As(s),{data:l}=On.useSession(),{deleteRelease:c}=k9(s),{currentBranch:d,setCurrentTaskBranch:h,taskId:u,createTask:f}=on();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={open:!1,mode:"publish"},e[0]=p):p=e[0];const[m,g]=T.useState(p);let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=q=>g({open:!0,mode:q}),e[1]=x):x=e[1];const b=x,v=O8(a),L=v.status==="attached"||v.status==="public-clone"?v.repo:null,{previewServerUrl:_}=_n(s);let y;if(e[2]!==d||e[3]!==i.slug||e[4]!==s){const q=d?e4(Z3(i.slug,s,d)):null;y=q?Dr(q.path,q.params):"/",e[2]=d,e[3]=i.slug,e[4]=s,e[5]=y}else y=e[5];const w=y;let S;e[6]!==d||e[7]!==w||e[8]!==i.slug||e[9]!==_||e[10]!==s?(S=d?{orgSlug:i.slug,virtualMcpId:s,branch:d,previewServerUrl:_,path:w}:null,e[6]=d,e[7]=w,e[8]=i.slug,e[9]=_,e[10]=s,e[11]=S):S=e[11];const k=YS(S);let j;e[12]!==d||e[13]!==i.slug||e[14]!==u||e[15]!==s?(j=aS({orgSlug:i.slug,virtualMcpId:s,branch:d??"",threadId:u??null},{fastPreview:!0}),e[12]=d,e[13]=i.slug,e[14]=u,e[15]=s,e[16]=j):j=e[16];const C=!!d;let V;e[17]!==j||e[18]!==C?(V={...j,enabled:C},e[17]=j,e[18]=C,e[19]=V):V=e[19];const N=Yt(V),A=N.data??null,P=A?{kind:"ready",branch:P3(A)??d??"",base:A.base??"main",workingTreeDirty:nS(A),unpushed:A.unpushed??0,aheadOfBase:A.aheadOfBase??0,behindBase:A.behindBase??0,headSha:A.headSha??""}:{kind:"unknown"},R=A?.changedFiles?KC({files:A.changedFiles}).count:null,E=(P.kind==="ready"?P.branch:null)??d??null,I=P.kind==="ready"?P.base:"main",D=p9({orgId:i.id,orgSlug:i.slug,target:Un(L),owner:L?.owner??"",repo:L?.name??"",branch:E}),O=D.data??null,B=OP({orgId:i.id,orgSlug:i.slug,target:Un(L),owner:L?.owner??"",repo:L?.name??"",base:I}),M=_g({orgId:i.id,orgSlug:i.slug,target:Un(L),owner:L?.owner??"",repo:L?.name??"",branch:E}),z=aN({orgId:i.id,orgSlug:i.slug,target:Un(L),owner:L?.owner??"",repo:L?.name??"",branch:E});let $;e[20]!==M||e[21]!==O||e[22]!==D||e[23]!==z?($=a1e({pr:O,prQuery:D,checksQuery:M,reviewsQuery:z}),e[20]=M,e[21]=O,e[22]=D,e[23]=z,e[24]=$):$=e[24];const U=$;let H;e[25]!==D?(H=async()=>{await D.refetch()},e[25]=D,e[26]=H):H=e[26];const W=H,K=Ds({mutationFn:async()=>{const q=d;await h(Gc(Kg(l?.user))),q&&q!==I&&await c(q)},onError:p1e});let G;e[27]!==i.slug||e[28]!==u||e[29]!==s?(G=async q=>(await sS({orgSlug:i.slug,virtualMcpId:s,branch:q.branch,threadId:u??null},q.base,{fastPreview:!0}),q),e[27]=i.slug,e[28]=u,e[29]=s,e[30]=G):G=e[30];let Y;e[31]!==d||e[32]!==i.slug||e[33]!==r||e[34]!==n||e[35]!==u||e[36]!==s?(Y=async q=>{ye.success(n("thread.headerActions.syncedWithBase",{base:q.base})),await Promise.all([r.invalidateQueries({queryKey:j0({orgSlug:i.slug,virtualMcpId:s,branch:d??q.branch,threadId:u??null})}),r.invalidateQueries({queryKey:tt.decofile(`${i.slug}/${s}/${q.branch}`)})])},e[31]=d,e[32]=i.slug,e[33]=r,e[34]=n,e[35]=u,e[36]=s,e[37]=Y):Y=e[37];let Z;e[38]!==G||e[39]!==Y?(Z={mutationFn:G,onSuccess:Y,onError:m1e},e[38]=G,e[39]=Y,e[40]=Z):Z=e[40];const te=Ds(Z),X=X3(i.slug,s,d??"");if(v.status==="detached"){let q;e[41]!==n?(q=n("thread.headerActions.reconnectGithub"),e[41]=n,e[42]=q):q=e[42];let fe;e[43]!==q?(fe=o.jsx(He,{asChild:!0,children:o.jsx("span",{children:o.jsx(me,{size:"sm",variant:"outline",disabled:!0,children:q})})}),e[43]=q,e[44]=fe):fe=e[44];let ge;e[45]!==n?(ge=n("thread.headerActions.githubConnectionRemoved"),e[45]=n,e[46]=ge):ge=e[46];let _e;e[47]!==ge?(_e=o.jsx(Ke,{children:ge}),e[47]=ge,e[48]=_e):_e=e[48];let Le;return e[49]!==fe||e[50]!==_e?(Le=o.jsx(Go,{children:o.jsxs(We,{children:[fe,_e]})}),e[49]=fe,e[50]=_e,e[51]=Le):Le=e[51],Le}if(!a)return null;if(!L||!_){const q=L?"noPreviewServer":"noRepo";let fe;e[52]!==d||e[53]!==f?(fe=d?()=>{const _e=f?.({runtime:"sandbox",branch:d});_e&&qe("coding_session_started",{thread_id:_e})}:void 0,e[52]=d,e[53]=f,e[54]=fe):fe=e[54];let ge;return e[55]!==q||e[56]!==fe?(ge=o.jsx(g1e,{reason:q,onStartCodingSession:fe}),e[55]=q,e[56]=fe,e[57]=ge):ge=e[57],ge}if(!d)return null;const ee=K.isPending,J=c1e({branch:P,pr:O,checks:M.data??[],reviews:z.data??null,publishing:ee,saving:X,syncing:te.isPending,statusRetrying:N.isFetching&&!!N.error,statusError:N.error instanceof Error?N.error.message:N.error?String(N.error):null,loading:!!U,publishableChangeCount:R,t:n}),Q=q=>{switch(q){case"publish":{b("publish");return}case"request-approval":{b("review");return}case"get-latest":{if(!E||te.isPending)return;te.mutate({branch:E,base:I});return}case"retry-status":{N.refetch();return}case"open-pr":{O?.htmlUrl&&window.open(O.htmlUrl,"_blank","noopener,noreferrer");return}}},oe=J.menu.map(q=>({key:q.key,label:q.label,icon:qy(q.action,q.key),...q.tooltip?{tooltip:q.tooltip}:{},onSelect:()=>Q(q.action)})),le=J.action,de=J.label,se=J.variant,ie=!!J.loading;let he;e[58]!==n?(he=n("thread.cmsActions.moreActionsAriaLabel"),e[58]=n,e[59]=he):he=e[59];const ue=o.jsx(OC,{size:"sm",label:de,variant:se,disabled:!!J.disabled||!le,loading:ie,...le&&!J.loading?{icon:qy(le)}:{},...J.tooltip?{tooltip:J.tooltip}:{},items:oe,menuAriaLabel:he,onClick:le?()=>Q(le):void 0}),ce=d?o.jsx(Q9e,{open:m.open,mode:m.mode,onOpenChange:q=>{q||g(f1e)},orgSlug:i.slug,orgId:i.id,virtualMcpId:s,branch:d,baseBranch:I,repoTarget:Un(L),owner:L.owner,repo:L.name,publishPolicy:oS(a?.metadata?.publishPolicy),draftPreviewUrl:k.url,destinationHost:k.host,lastPublishedPr:B.data??null,onRequestApproval:()=>b("review"),openPullRequest:O?.state==="open"?O:null,onPullRequestChanged:W,onPublished:()=>K.mutateAsync(),children:ue}):ue;let ne;return e[60]!==ce?(ne=o.jsx(o.Fragment,{children:ce}),e[60]=ce,e[61]=ne):ne=e[61],ne}function f1e(t){return{...t,open:!1}}function m1e(t){ye.error(t instanceof Error?t.message:String(t))}function p1e(t){ye.error(t instanceof Error?t.message:String(t))}function g1e(t){const e=F.c(14),{reason:s,onStartCodingSession:n}=t,i=ae(),r=!n;let a;e[0]!==i?(a=i("sandbox.cmsUnavailable.startCodingSession"),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==n||e[3]!==r||e[4]!==a?(l=o.jsx(He,{asChild:!0,children:o.jsx("span",{children:o.jsx(me,{size:"sm",variant:"outline",disabled:r,onClick:n,children:a})})}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5];let c;e[6]!==s||e[7]!==i?(c=i(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=i,e[8]=c):c=e[8];let d;e[9]!==c?(d=o.jsx(Ke,{children:c}),e[9]=c,e[10]=d):d=e[10];let h;return e[11]!==l||e[12]!==d?(h=o.jsx(Go,{children:o.jsxs(We,{children:[l,d]})}),e[11]=l,e[12]=d,e[13]=h):h=e[13],h}const x1e=new Set(["main","master"]);function b1e(t,e){return x1e.has(t.trim().toLowerCase())?e("thread.headerActions.publishToProduction"):e("thread.headerActions.publish")}function v1e(t){const e=F.c(10),[s,n]=T.useState(0);let i;e[0]!==t?(i=c=>{c&&n(y1e),t.onOpenChange(c)},e[0]=t,e[1]=i):i=e[1];const r=i;let a;e[2]!==r||e[3]!==t||e[4]!==s?(a=t.open?o.jsx(_1e,{...t,onOpenChange:r},s):null,e[2]=r,e[3]=t,e[4]=s,e[5]=a):a=e[5];let l;return e[6]!==r||e[7]!==t.open||e[8]!==a?(l=o.jsx(Ft,{open:t.open,onOpenChange:r,children:a}),e[6]=r,e[7]=t.open,e[8]=a,e[9]=l):l=e[9],l}function y1e(t){return t+1}function _1e({onOpenChange:t,orgSlug:e,orgId:s,virtualMcpId:n,branch:i,baseBranch:r,repoTarget:a,owner:l,repo:c,previewUrl:d,publishPolicy:h,dialogIntent:u="open-pr",headSha:f=null,openPullRequest:p=null,onPullRequestChanged:m,onPublished:g}){const x=ae(),b=Cn({connectionId:Xu,orgId:s,orgSlug:e}),{data:v}=On.useSession(),L=A_(b),_={orgSlug:e,virtualMcpId:n,branch:i,threadId:Ts()?.taskId??null},y=M4(v?.user),w=p?.state==="open",S=u==="open-pr"&&!w,k=u==="publish-only",[j,C]=T.useState(null),[V,N]=T.useState(null),[A,P]=T.useState(!0),[R,E]=T.useState(!1),[I,D]=T.useState(""),[O,B]=T.useState(""),[M,z]=T.useState(),[$,U]=T.useState(!1),[H,W]=T.useState(),[K,G]=T.useState(!1),[Y,Z]=T.useState(!1),[te,X]=T.useState(!1),ee=T.useRef(!1),J=T.useRef(!1),Q={base:r,...f?{headSha:f}:{}},oe=async Ne=>{const Oe=(Ne.aheadOfBase??0)>0?await hu(_,Q):null,nt=E3(Ne)?await hu(_):null;return FJ(Oe,nt)},le=async()=>{const Ne=await $c(_),Oe=k?await oe(Ne):await hu(_,zJ(Ne,{openPrFromCommits:S,commitToOpenPr:w})?Q:void 0);C(Ne),N(Oe),D(x("thread.publishDialog.changesFrom",{branch:Ne.current??i})),X(!0),Nb(_,{status:Ne,diff:Oe}).then(nt=>{D(nt.title),B(nt.body)}).catch(()=>{}).finally(()=>X(!1))};ee.current||(ee.current=!0,(async()=>{P(!0),z(void 0),N(null),D(""),B(""),W(void 0);try{await le()}catch(Ne){if(eS(Ne)&&!J.current){J.current=!0;try{await L.mutateAsync({virtualMcpId:n,branch:i}),await le();return}catch(Oe){z(Oe instanceof Error?Oe.message:x("thread.publishDialog.failedLoadAfterReprovision"));return}}z(Ne instanceof Error?Ne.message:x("thread.publishDialog.failedLoad"))}finally{P(!1)}})());const de=P3(j)??i,se=b1e(r,x),ie=()=>{!j||!V||(X(!0),Nb(_,{status:j,diff:V}).then(Ne=>{D(Ne.title),B(Ne.body)}).catch(()=>{}).finally(()=>X(!1)))},he=lS(j),ue=V?Object.keys(V.diffs).length:he,{gate:ce}=nN({orgSlug:e,virtualMcpId:n,branch:i,threadId:_.threadId,status:j,diff:V,policy:h,judgeEnabled:k}),ne=S?cS(j):BJ(j,V),q=!A&&(ne||S),fe=q&&ce.allowed,ge=!q||ce.allowed?null:ce.pending?x("thread.publishDialog.reviewingChanges"):ce.reason??x("thread.publishDialog.publishNeedsReview"),_e=S||!w&&(j?.aheadOfBase??0)>0,Le=!A&&(_e||ne)&&(ue>0||ne),je={orgSlug:e,virtualMcpId:n,branch:i,threadId:_.threadId,baseBranch:r,target:a,owner:l,repo:c,headBranch:de,coAuthor:y,expectedHeadSha:f??void 0},Ce=()=>QC({title:I,body:O,fallbackTitle:x("thread.publishDialog.changesFrom",{branch:de})}),Pe=Ne=>{R||$||t(Ne)},pe=async()=>{E(!0),z(void 0);try{await eN(je,Ce(),x),ye.success(x("thread.publishDialog.publishedTo",{baseBranch:r})),Pe(!1),N(null),D(""),B(""),await m?.(),await g?.()}catch(Ne){const Oe=j2(Ne,x);z(Oe.message),Oe.pullRequestOpened&&await m?.()}finally{E(!1)}},ke=async Ne=>{try{await Lp(_,[Ne]),ye.success(x("thread.publishDialog.discardedChanges",{filepath:Ne})),N(nt=>{if(!nt)return nt;const Fe={...nt,diffs:{...nt.diffs}};return delete Fe.diffs[Ne],Fe});const Oe=await $c(_);C(Oe)}catch(Oe){ye.error(Oe instanceof Error?Oe.message:x("thread.publishDialog.failedDiscardChanges"))}},Te=async()=>{if(V){G(!1),Z(!0);try{const Ne=Object.keys(V.diffs);if(Ne.length===0)return;await Lp(_,Ne),ye.success(x("thread.publishDialog.allChangesDiscarded")),N(null);const Oe=await $c(_);C(Oe),Pe(!1)}catch(Ne){ye.error(Ne instanceof Error?Ne.message:x("thread.publishDialog.failedDiscardChanges"))}finally{Z(!1)}}},we=async()=>{U(!0),W(void 0);try{const Ne=await tN(je,Ce());sN(Ne,x),Pe(!1),await m?.()}catch(Ne){W(Ne instanceof Error?Ne.message:x("thread.publishDialog.failedSubmitForReview"))}finally{U(!1)}};return o.jsx(zt,{className:"top-14 left-auto right-4 flex h-[90%] max-h-[85vh] w-[90vw] max-w-[600px] translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0",children:o.jsxs(ad,{defaultValue:"description",className:"flex h-full flex-col gap-0",children:[o.jsxs("div",{className:"shrink-0 space-y-3 px-6 pt-5 pb-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:S?x("thread.publishDialog.submitForReview"):se}),o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full bg-success"}),ue," ",x(ue===1?"thread.publishDialog.change":"thread.publishDialog.changes")," ",x(S?"thread.publishDialog.inThisPr":"thread.publishDialog.toPublish")]})]}),K?o.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md bg-destructive/5 px-3 py-2",children:[o.jsx("span",{className:"text-xs text-destructive",children:x("thread.publishDialog.discardConfirmMessage")}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[o.jsx(me,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>G(!1),children:x("thread.publishDialog.cancel")}),o.jsxs(me,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:Te,disabled:Y,children:[Y?o.jsx(et,{className:"h-3 w-3"}):null,x("thread.publishDialog.discardAll")]})]})]}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(t0,{className:"h-8 w-auto",variant:"pill",children:[o.jsx(or,{value:"description",className:"px-3 text-xs",children:x("thread.publishDialog.description")}),o.jsx(or,{value:"changes",className:"px-3 text-xs",children:x("thread.publishDialog.changesTab")})]}),ue>0&&!S&&o.jsx("button",{type:"button",className:"text-xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>G(!0),disabled:R||Y,children:x("thread.publishDialog.discardAll")})]})]}),o.jsx("div",{className:"border-t"}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:A?o.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[o.jsx(et,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm",children:x("thread.publishDialog.loadingChanges")})]}):o.jsxs(o.Fragment,{children:[o.jsx(Pa,{value:"description",className:"mt-0 px-6 py-5",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("p",{className:"text-sm font-medium",children:x(S?"thread.publishDialog.pullRequest":"thread.publishDialog.commitMessage")}),o.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",disabled:te||R||$,onClick:ie,children:[te?o.jsx(et,{className:"h-3 w-3"}):o.jsx(Fr,{className:"h-3 w-3"}),x(te?"thread.publishDialog.generating":"thread.publishDialog.regenerate")]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"publish-title",className:"text-xs font-medium text-muted-foreground",children:x("thread.publishDialog.title")}),o.jsx(vt,{id:"publish-title",value:I,onChange:Ne=>D(Ne.target.value),placeholder:x(te?"thread.publishDialog.generating":"thread.publishDialog.commitTitlePlaceholder"),disabled:R||$||te,className:"text-sm"})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"publish-body",className:"text-xs font-medium text-muted-foreground",children:x("thread.publishDialog.descriptionLabel")}),o.jsx(Jo,{id:"publish-body",value:O,onChange:Ne=>B(Ne.target.value),placeholder:x(te?"thread.publishDialog.generating":"thread.publishDialog.descriptionPlaceholder"),disabled:R||$||te,rows:5,className:"resize-none text-sm"})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[x("thread.publishDialog.branchLabel")," ",o.jsx("span",{className:"font-mono",children:i})," → ",o.jsx("span",{className:"font-mono",children:r})," · ",o.jsx("span",{className:"text-foreground/80",children:k?x("thread.publishDialog.squashMergesInto",{publishLabel:se,baseBranch:r}):x("thread.publishDialog.opensPullRequestInto",{baseBranch:r})})]})]})}),o.jsx(Pa,{value:"changes",className:"mt-0",children:o.jsx(R3,{diff:V,onDiscardFile:ke})})]})}),o.jsx("div",{className:"shrink-0 border-t",children:o.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-6 py-3.5 text-sm transition-colors hover:bg-muted/50 disabled:opacity-50",onClick:()=>{d&&window.open(d,"_blank","noopener,noreferrer")},disabled:!d,children:[o.jsxs("span",{className:"flex items-center gap-3",children:[o.jsx(h0,{className:"h-4 w-4 text-muted-foreground"}),x("thread.publishDialog.visitPreview")]}),o.jsx(gr,{className:"h-4 w-4 text-muted-foreground"})]})}),o.jsx("div",{className:"shrink-0 border-t px-6 py-3",children:k?o.jsxs(o.Fragment,{children:[o.jsx(L1e,{label:se,canPublish:fe,disabledReason:ge,isPublishing:R,onPublish:pe}),M&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:M}),!fe&&!ce.pending&&Le&&o.jsxs(o.Fragment,{children:[o.jsxs(me,{type:"button",variant:"outline",className:"mt-2 w-full",onClick:we,disabled:$,children:[$?o.jsx(et,{className:"h-4 w-4"}):o.jsx(qr,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),H&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:H})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs(me,{type:"button",className:"w-full",onClick:we,disabled:!Le||$,children:[$?o.jsx(et,{className:"h-4 w-4"}):o.jsx(qr,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),H&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:H})]})})]})})}function L1e(t){const e=F.c(14),{label:s,canPublish:n,disabledReason:i,isPublishing:r,onPublish:a}=t,l=!n||r;let c;e[0]!==r?(c=r?o.jsx(et,{className:"h-4 w-4"}):null,e[0]=r,e[1]=c):c=e[1];let d;e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c?(d=o.jsxs(me,{type:"button",variant:"brand",className:"w-full",onClick:a,disabled:l,children:[c,s]}),e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d):d=e[6];const h=d;if(!i)return h;let u;e[7]!==h?(u=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"flex w-full",children:h})}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==i?(f=o.jsx(Ke,{children:i}),e[9]=i,e[10]=f):f=e[10];let p;return e[11]!==u||e[12]!==f?(p=o.jsx(Go,{children:o.jsxs(We,{children:[u,f]})}),e[11]=u,e[12]=f,e[13]=p):p=e[13],p}function Gy(t){switch(t){case"publish":return o.jsx(d8,{className:"size-4"});case"create-pr":case"reopen":return o.jsx(Fo,{className:"size-4"});case"rebase":case"sync":return o.jsx(Dn,{className:"size-4"});case"fix-checks":return o.jsx(na,{className:"size-4"});case"mark-ready":return o.jsx(xr,{className:"size-4"});case"resolve-comments":return o.jsx(ng,{className:"size-4"});case"merge":return o.jsx(Vg,{className:"size-4"});case"review":return o.jsx(h0,{className:"size-4"});case"open-pr-page":return o.jsx(ur,{size:16})}}const Yy=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),Qy=new Set(["publish","create-pr"]);function w1e(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function S1e({virtualMcpId:t}){const e=ae(),{org:s}=Ue(),{data:n}=On.useSession(),i=As(t),{deleteRelease:r}=k9(t),{currentBranch:a,setCurrentTaskBranch:l,taskId:c}=on(),d=ai(),{openSidePanel:h}=oa(),[u,f]=T.useState(!1),[p,m]=T.useState("open-pr"),[g,x]=T.useState(null),[b,v]=T.useState(!1),L=T.useRef(""),_=O8(i),y=_.status==="attached"||_.status==="public-clone"?_.repo:null,{lifecycle:w,branch:S,phase:k}=ci(),j={orgSlug:s.slug,virtualMcpId:t,branch:a??"",threadId:c??null},V=Yt({queryKey:j0(j),queryFn:()=>$c(j),enabled:!!a,staleTime:15e3,refetchInterval:oe=>q1(oe.state.data)?5e3:!1}).data??null,N=S,A=w,P=N.kind==="ready"?N.branch:null,R=a??P??void 0,E=(N.kind==="ready"?N.branch:null)??R??null,I=p9({orgId:s.id,orgSlug:s.slug,target:Un(y),owner:y?.owner??"",repo:y?.name??"",branch:E}),D=I.data??null,O=_g({orgId:s.id,orgSlug:s.slug,target:Un(y),owner:y?.owner??"",repo:y?.name??"",branch:E}),B=aN({orgId:s.id,orgSlug:s.slug,target:Un(y),owner:y?.owner??"",repo:y?.name??"",branch:E}),M=N,z=oS(i?.metadata?.publishPolicy),$=X3(s.slug,t,a??R??""),{previewUrl:U}=la();if(_.status==="detached")return o.jsx(j1e,{label:e("thread.headerActions.githubConnectionRemoved"),children:o.jsx(me,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!y)return null;const H=E?r1e({lifecycle:A,branch:M,claimPhase:k,pr:D,checks:O.data??[],reviews:B.data??null,noReviewableDiff:q1(V),loading:Uh(I),t:e}):w1e(e),W=JSON.stringify({label:H.label,branchKind:M.kind,workingTreeDirty:M.kind==="ready"?M.workingTreeDirty:null,unpushed:M.kind==="ready"?M.unpushed:null,aheadOfBase:M.kind==="ready"?M.aheadOfBase:null,lifecycle:A.phase,githubHeadBranch:E,noReviewableDiff:q1(V)});L.current!==W&&(L.current=W,rN("header button",{label:H.label,tooltip:H.tooltip,action:H.action,chatBranch:a,sandboxBranch:P,sandboxRouteBranch:R,githubHeadBranch:E,branchMeta:N,effectiveBranchMeta:M,lifecyclePhase:A.phase,prNumber:D?.number??null,prState:D?.state??null}));const K=oe=>(h(),d.sendMessage({parts:[{type:"text",text:oe}]})),G=d.isStreaming,Y=M.kind==="ready"?M.base:"main",Z=async()=>{await I.refetch()},te=async()=>{const oe=a,le=Gc(Kg(n?.user));await l(le),oe&&oe!==Y&&await r(oe)},X=async oe=>{if(!(!y||b)){v(!0);try{const le=M4(n?.user);await GC(s.slug,Un(y),{number:oe,coAuthor:le}),ye.success(e("thread.headerActions.publishedPr",{prNumber:String(oe)})),await Z(),await te()}catch(le){ye.error(le instanceof qC?le.detail??R9e(le.reason,e):le instanceof Error?le.message:e("thread.headerActions.failedToMergePullRequest"))}finally{v(!1)}}},ee=(oe,le)=>{m(oe),x(le),f(!0)},J=oe=>{if(E)switch(oe){case"publish":ee("publish-only",H.meta?.publishPolicyOverride??null);return;case"create-pr":ee("open-pr",null);return;case"merge":D&&X(D.number);return;case"sync":if(G)return;K(nZ({branch:E,base:Y}));return;case"open-pr-page":D?.htmlUrl&&window.open(D.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(G)return;D&&K(lZ({prNumber:D.number}));return;case"reopen":if(G)return;D&&K(tZ({prNumber:D.number}));return;case"rebase":if(G)return;K(sZ({branch:E}));return;case"fix-checks":if(G)return;D&&K(rZ({prNumber:D.number,failingChecks:H.meta?.failingChecks??[]}));return;case"mark-ready":if(G)return;D&&K(oZ({prNumber:D.number}));return;case"resolve-comments":if(G)return;D&&K(aZ({prNumber:D.number}));return}},Q=b||G;return o.jsxs(o.Fragment,{children:[o.jsx(k1e,{t:e,button:H,actionBusy:Q,githubActionPending:b,savePending:$,onAction:J}),R&&o.jsx(v1e,{open:u,onOpenChange:f,orgSlug:s.slug,orgId:s.id,virtualMcpId:t,branch:R,baseBranch:Y,repoTarget:Un(y),owner:y.owner,repo:y.name,previewUrl:U,publishPolicy:g??z,dialogIntent:p,headSha:M.kind==="ready"?M.headSha:null,openPullRequest:D?.state==="open"?D:null,onPullRequestChanged:Z,onPublished:te})]})}function k1e(t){const e=F.c(44),{t:s,button:n,actionBusy:i,githubActionPending:r,savePending:a,onAction:l}=t,c=n.action;let d;e[0]!==c||e[1]!==i?(d=i&&c!==void 0&&Yy.has(c),e[0]=c,e[1]=i,e[2]=d):d=e[2];const h=d,u=r&&c==="merge";let f;e[3]!==c||e[4]!==a?(f=a&&c!==void 0&&Qy.has(c),e[3]=c,e[4]=a,e[5]=f):f=e[5];const p=f,m=!!n.disabled||h||u||p||!c,g=!!n.loading||u;let x;e[6]!==n.tooltip||e[7]!==h||e[8]!==p||e[9]!==s?(x=h?s("thread.headerActions.chatIsRunning"):p?s("thread.headerActions.saving"):n.tooltip,e[6]=n.tooltip,e[7]=h,e[8]=p,e[9]=s,e[10]=x):x=e[10];const b=x;let v;if(e[11]!==i||e[12]!==n.menu||e[13]!==r||e[14]!==l||e[15]!==a||e[16]!==s){let V;e[18]!==i||e[19]!==r||e[20]!==l||e[21]!==a||e[22]!==s?(V=N=>{const A=i&&Yy.has(N.action),P=a&&Qy.has(N.action),R=N.action==="merge"&&r,E=P?s("thread.headerActions.saving"):A?s("thread.headerActions.chatIsRunning"):N.tooltip;return{key:N.key,label:N.label,icon:Gy(N.action),disabled:!!(A||P||R),...E?{tooltip:E}:{},onSelect:()=>l(N.action)}},e[18]=i,e[19]=r,e[20]=l,e[21]=a,e[22]=s,e[23]=V):V=e[23],v=n.menu.map(V),e[11]=i,e[12]=n.menu,e[13]=r,e[14]=l,e[15]=a,e[16]=s,e[17]=v}else v=e[17];const L=v,_=n.label,y=n.variant;let w;e[24]!==c||e[25]!==g?(w=c&&!g?{icon:Gy(c)}:{},e[24]=c,e[25]=g,e[26]=w):w=e[26];let S;e[27]!==b?(S=b?{tooltip:b}:{},e[27]=b,e[28]=S):S=e[28];let k;e[29]!==s?(k=s("thread.headerActions.moreActionsAriaLabel"),e[29]=s,e[30]=k):k=e[30];let j;e[31]!==c||e[32]!==l?(j=c?()=>l(c):void 0,e[31]=c,e[32]=l,e[33]=j):j=e[33];let C;return e[34]!==n.label||e[35]!==n.variant||e[36]!==m||e[37]!==L||e[38]!==g||e[39]!==w||e[40]!==S||e[41]!==k||e[42]!==j?(C=o.jsx(OC,{size:"sm",label:_,variant:y,disabled:m,loading:g,...w,...S,items:L,menuAriaLabel:k,onClick:j}),e[34]=n.label,e[35]=n.variant,e[36]=m,e[37]=L,e[38]=g,e[39]=w,e[40]=S,e[41]=k,e[42]=j,e[43]=C):C=e[43],C}function j1e(t){const e=F.c(9),{label:s,children:n}=t;if(!s){let l;return e[0]!==n?(l=o.jsx(o.Fragment,{children:n}),e[0]=n,e[1]=l):l=e[1],l}let i;e[2]!==n?(i=o.jsx(He,{asChild:!0,children:o.jsx("span",{children:n})}),e[2]=n,e[3]=i):i=e[3];let r;e[4]!==s?(r=o.jsx(Ke,{children:s}),e[4]=s,e[5]=r):r=e[5];let a;return e[6]!==i||e[7]!==r?(a=o.jsx(Go,{children:o.jsxs(We,{children:[i,r]})}),e[6]=i,e[7]=r,e[8]=a):a=e[8],a}function C1e(t){const e=F.c(14),{virtualMcp:s}=t,n=ae(),i=sl(),{navigateToTask:r}=jV(),{create:a}=Ju();let l,c;if(e[0]!==i||e[1]!==a||e[2]!==r||e[3]!==n||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{const d=SP(s,i);if(!d){c=null;break e}const h=d.mode==="dev";let u;e[7]!==a||e[8]!==r?(u=async b=>{const v=crypto.randomUUID();try{await a({id:v,virtual_mcp_id:b})}catch{}r(v,{virtualMcpId:b})},e[7]=a,e[8]=r,e[9]=u):u=e[9];const f=u,p=(b,v,L)=>o.jsxs("button",{type:"button","aria-pressed":v,"aria-label":b,title:b,onClick:()=>{v||f(d.targetId)},className:re("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md transition-colors",v?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(L,{className:"size-3.5 shrink-0"}),o.jsx("span",{className:"@max-3xl/panel-header:hidden",children:b})]});let m;e[10]!==n?(m=n("devAgent.devAgentControl.develop"),e[10]=n,e[11]=m):m=e[11];const g=p(m,h,rd);let x;e[12]!==n?(x=n("devAgent.devAgentControl.live"),e[12]=n,e[13]=x):x=e[13],l=o.jsxs("div",{className:"inline-flex items-center rounded-lg border border-border bg-muted p-0.5 text-xs font-medium",children:[g,p(x,!h,jn)]})}e[0]=i,e[1]=a,e[2]=r,e[3]=n,e[4]=s,e[5]=l,e[6]=c}else l=e[5],c=e[6];return c!==Symbol.for("react.early_return_sentinel")?c:l}function N1e(t){const e=F.c(11),{virtualMcp:s}=t,n=_n(s.id).runtime==="cms",i=R8(s.metadata?.ui?.layout??null);let r;e[0]!==i?(r=Cg(i),e[0]=i,e[1]=r):r=e[1];const a=r;let l;e[2]!==s?(l=o.jsx(C1e,{virtualMcp:s}),e[2]=s,e[3]=l):l=e[3];let c;e[4]!==n||e[5]!==a||e[6]!==s?(c=a&&kP(s)?n?o.jsx(h1e,{virtualMcpId:s.id}):o.jsx(S1e,{virtualMcpId:s.id}):null,e[4]=n,e[5]=a,e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==c?(d=o.jsxs("div",{className:"flex items-center gap-2",children:[l,c]}),e[8]=l,e[9]=c,e[10]=d):d=e[10],d}const V1e=10080*60*1e3;function T1e({sandboxMap:t,userId:e,rawBranches:s,now:n}){const i=new Map;for(const[u,f]of Object.entries(t??{}))for(const[p,m]of Object.entries(f??{})){let g=i.get(p);g||(g={userIds:new Set,lastActiveAt:0},i.set(p,g)),g.userIds.add(u);for(const x of Object.values(m??{})){const b=x?.createdAt??0;b>g.lastActiveAt&&(g.lastActiveAt=b)}}const r=n-V1e,a=[...i.entries()].filter(([,u])=>u.lastActiveAt>=r).sort((u,f)=>f[1].lastActiveAt-u[1].lastActiveAt).map(([u,f])=>({name:u,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),l=new Set(a.map(u=>u.name)),c=new Set(Object.keys(t?.[e]??{})),d=[...c].filter(u=>!l.has(u)).sort().map(u=>({name:u,source:"yours"})),h=s.filter(u=>!c.has(u.name)&&!l.has(u.name)).map(u=>({name:u.name,source:"other",author:u.author??null}));return{recent:a,yours:d,others:h}}const A1e=100,P1e=50,E1e=300;function C2(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function R1e(t){const e=F.c(46),{orgId:s,orgSlug:n,userId:i,target:r,sandboxMap:a,owner:l,repo:c,search:d,enabled:h}=t,u=d===void 0?"":d,f=h===void 0?!0:h;let p;e[0]!==u?(p=u.trim(),e[0]=u,e[1]=p):p=e[1];const m=p,g=L9(m,E1e);let x;e[2]!==r?(x=wg(r),e[2]=r,e[3]=x):x=e[3];const b=x,v=m.length>0;let L;e[4]!==g||e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==c||e[9]!==r?(L=tt.githubBranchSearch(s,n,$8(r),l,c,g),e[4]=g,e[5]=s,e[6]=n,e[7]=l,e[8]=c,e[9]=r,e[10]=L):L=e[10];const _=f&&b;let y;e[11]!==g||e[12]!==n||e[13]!==r?(y=W=>{const{pageParam:K}=W;return R2(n,"REPOSITORY_SEARCH_BRANCHES",{...r,query:g,limit:g?P1e:A1e,cursor:K})},e[11]=g,e[12]=n,e[13]=r,e[14]=y):y=e[14];let w;e[15]!==g?(w=W=>g?void 0:W.nextCursor??void 0,e[15]=g,e[16]=w):w=e[16];let S;e[17]!==L||e[18]!==_||e[19]!==y||e[20]!==w?(S={queryKey:L,enabled:_,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:y,getNextPageParam:w},e[17]=L,e[18]=_,e[19]=y,e[20]=w,e[21]=S):S=e[21];const{data:k,isLoading:j,isError:C,isFetching:V,hasNextPage:N,isFetchingNextPage:A,fetchNextPage:P}=w7(S),R=v&&(g!==m||V);let E,I,D;if(e[22]!==k?.pages||e[23]!==a||e[24]!==m||e[25]!==i){const W=(k?.pages??[]).flatMap(D1e);E=T1e({sandboxMap:a,userId:i,rawBranches:W,now:Date.now()});let K;e[29]!==m?(K=Y=>C2(Y.name,m),e[29]=m,e[30]=K):K=e[30],I=E.recent.filter(K);let G;e[31]!==m?(G=Y=>C2(Y.name,m),e[31]=m,e[32]=G):G=e[32],D=E.yours.filter(G),e[22]=k?.pages,e[23]=a,e[24]=m,e[25]=i,e[26]=E,e[27]=I,e[28]=D}else E=e[26],I=e[27],D=e[28];const O=D,B=E.others,M=k?.pages[0],z=v&&M&&!R?Math.max(0,M.totalCount-M.branches.length):0,$=!v&&N;let U;e[33]!==P?(U=()=>{P()},e[33]=P,e[34]=U):U=e[34];let H;return e[35]!==z||e[36]!==C||e[37]!==A||e[38]!==j||e[39]!==R||e[40]!==B||e[41]!==I||e[42]!==$||e[43]!==U||e[44]!==O?(H={recent:I,yours:O,others:B,isLoading:j,isError:C,isSearching:R,hiddenMatchCount:z,hasMore:$,isFetchingMore:A,fetchMore:U},e[35]=z,e[36]=C,e[37]=A,e[38]=j,e[39]=R,e[40]=B,e[41]=I,e[42]=$,e[43]=U,e[44]=O,e[45]=H):H=e[45],H}function D1e(t){return t.branches}function M1e(t){const e=F.c(189),{virtualMcpId:s,userLabel:n,value:i,baseBranch:r,orgId:a,orgSlug:l,userId:c,target:d,owner:h,repo:u,sandboxMap:f,onChange:p,onCreateBranch:m,disabled:g,spawnsNewChat:x,placement:b}=t,v=g===void 0?!1:g,L=x===void 0?!1:x,_=b===void 0?"chat":b,y=ae(),w=_==="header",[S,k]=T.useState(!1),[j,C]=T.useState(!1),[V,N]=T.useState(null),[A,P]=T.useState(""),[R,E]=T.useState(null),{releases:I,createRelease:D,renameRelease:O,deleteRelease:B}=k9(s),M=!!i&&i===r;let z,$,U,H,W,K,G,Y,Z,te,X,ee,J,Q,oe,le,de,se,ie,he,ue,ce,ne,q,fe,ge,_e;if(e[0]!==r||e[1]!==D||e[2]!==B||e[3]!==v||e[4]!==A||e[5]!==M||e[6]!==w||e[7]!==p||e[8]!==m||e[9]!==S||e[10]!==R||e[11]!==I||e[12]!==O||e[13]!==y||e[14]!==n||e[15]!==i){let Ge;e[43]!==i?(Ge=at=>at.branch===i,e[43]=i,e[44]=Ge):Ge=e[44];const wt=I.find(Ge);_e=!M&&!wt&&!!i;const Pt=M?y("thread.branchPicker.live"):wt?.name??y("thread.branchPicker.defaultVersionName");te=i?Pt:y("thread.branchPicker.selectVersion");const Zt=M?"bg-success":N1(wt?.color??"orange");let Dt;e[45]!==p?(Dt=at=>{p(at),k(!1)},e[45]=p,e[46]=Dt):Dt=e[46],X=Dt;let $e;e[47]!==y?($e=at=>{ye.error(at instanceof Error?at.message:y("thread.branchPicker.saveError"))},e[47]=y,e[48]=$e):$e=e[48];const Lt=$e;let Se;e[49]!==D||e[50]!==p||e[51]!==I||e[52]!==Lt?(Se=(at,rs)=>{I.some(_r=>_r.branch===at)||D({branch:at,name:rs.trim()||at,color:Th(I.length),createdAt:new Date().toISOString()}).catch(Lt),p(at),C(!1),k(!1)},e[49]=D,e[50]=p,e[51]=I,e[52]=Lt,e[53]=Se):Se=e[53],K=Se;let Ye;e[54]!==D||e[55]!==p||e[56]!==m||e[57]!==I||e[58]!==Lt||e[59]!==y||e[60]!==n?(Ye=()=>{const at=Gc(n);D({branch:at,name:ep(I,y("thread.branchPicker.defaultVersionName")),color:Th(I.length),createdAt:new Date().toISOString()}).catch(Lt),(m??p)(at),k(!1)},e[54]=D,e[55]=p,e[56]=m,e[57]=I,e[58]=Lt,e[59]=y,e[60]=n,e[61]=Ye):Ye=e[61],Z=Ye;let ot;e[62]===Symbol.for("react.memo_cache_sentinel")?(ot=()=>{N(null),P(""),C(!1)},e[62]=ot):ot=e[62];const es=ot;let xe;e[63]===Symbol.for("react.memo_cache_sentinel")?(xe=at=>{N(at.branch),P(at.name)},e[63]=xe):xe=e[63],Q=xe;let De;e[64]!==A||e[65]!==O||e[66]!==Lt?(De=at=>{const rs=A.trim();rs&&O(at,rs).catch(Lt),N(null),P("")},e[64]=A,e[65]=O,e[66]=Lt,e[67]=De):De=e[67],ee=De;let Je;e[68]!==D||e[69]!==A||e[70]!==I.length||e[71]!==i?(Je=()=>{const at=A.trim();at&&i&&D({branch:i,name:at,color:Th(I.length),createdAt:new Date().toISOString()}),N(null),P("")},e[68]=D,e[69]=A,e[70]=I.length,e[71]=i,e[72]=Je):Je=e[72],J=Je;let Ie;e[73]===Symbol.for("react.memo_cache_sentinel")?(Ie=()=>{N(null),P("")},e[73]=Ie):Ie=e[73],G=Ie;let pt;e[74]!==r||e[75]!==B||e[76]!==R||e[77]!==X||e[78]!==I||e[79]!==Lt||e[80]!==i?(pt=()=>{const at=R;if(E(null),!!at){if(at.branch===i){const rs=I.find(_r=>_r.branch!==at.branch);rs?X(rs.branch):r?X(r):k(!1)}else k(!1);B(at.branch).catch(Lt)}},e[74]=r,e[75]=B,e[76]=R,e[77]=X,e[78]=I,e[79]=Lt,e[80]=i,e[81]=pt):pt=e[81],Y=pt,W=js,ie=S,e[82]!==v?(he=v?void 0:at=>{at||es(),k(at)},e[82]=v,e[83]=he):he=e[83],H=We,U=He,se=!0,de="inline-flex min-w-0 shrink",$=ws,le=!0,z=me,ce=fg.branchPicker,ne=w?"outline":"ghost",q=w?"sm":"default",fe=te,ge=v;const Et=w?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[84]!==Et?(oe=re("shrink min-w-0 max-w-[220px] gap-2",Et,y7),e[84]=Et,e[85]=oe):oe=e[85],ue=re("h-2 w-2 shrink-0 rounded-full",i?Zt:"bg-muted-foreground"),e[0]=r,e[1]=D,e[2]=B,e[3]=v,e[4]=A,e[5]=M,e[6]=w,e[7]=p,e[8]=m,e[9]=S,e[10]=R,e[11]=I,e[12]=O,e[13]=y,e[14]=n,e[15]=i,e[16]=z,e[17]=$,e[18]=U,e[19]=H,e[20]=W,e[21]=K,e[22]=G,e[23]=Y,e[24]=Z,e[25]=te,e[26]=X,e[27]=ee,e[28]=J,e[29]=Q,e[30]=oe,e[31]=le,e[32]=de,e[33]=se,e[34]=ie,e[35]=he,e[36]=ue,e[37]=ce,e[38]=ne,e[39]=q,e[40]=fe,e[41]=ge,e[42]=_e}else z=e[16],$=e[17],U=e[18],H=e[19],W=e[20],K=e[21],G=e[22],Y=e[23],Z=e[24],te=e[25],X=e[26],ee=e[27],J=e[28],Q=e[29],oe=e[30],le=e[31],de=e[32],se=e[33],ie=e[34],he=e[35],ue=e[36],ce=e[37],ne=e[38],q=e[39],fe=e[40],ge=e[41],_e=e[42];let Le;e[86]!==ue?(Le=o.jsx("span",{className:ue}),e[86]=ue,e[87]=Le):Le=e[87];let je;e[88]!==te?(je=o.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:te}),e[88]=te,e[89]=je):je=e[89];let Ce;e[90]!==v?(Ce=!v&&o.jsx(hs,{size:12,className:"opacity-60 shrink-0"}),e[90]=v,e[91]=Ce):Ce=e[91];let Pe;e[92]!==z||e[93]!==oe||e[94]!==Le||e[95]!==je||e[96]!==Ce||e[97]!==ce||e[98]!==ne||e[99]!==q||e[100]!==fe||e[101]!==ge?(Pe=o.jsxs(z,{"data-tour":ce,variant:ne,size:q,"aria-label":fe,disabled:ge,className:oe,children:[Le,je,Ce]}),e[92]=z,e[93]=oe,e[94]=Le,e[95]=je,e[96]=Ce,e[97]=ce,e[98]=ne,e[99]=q,e[100]=fe,e[101]=ge,e[102]=Pe):Pe=e[102];let pe;e[103]!==$||e[104]!==le||e[105]!==Pe?(pe=o.jsx($,{asChild:le,children:Pe}),e[103]=$,e[104]=le,e[105]=Pe,e[106]=pe):pe=e[106];let ke;e[107]!==de||e[108]!==pe?(ke=o.jsx("span",{className:de,children:pe}),e[107]=de,e[108]=pe,e[109]=ke):ke=e[109];let Te;e[110]!==U||e[111]!==se||e[112]!==ke?(Te=o.jsx(U,{asChild:se,children:ke}),e[110]=U,e[111]=se,e[112]=ke,e[113]=Te):Te=e[113];let we;e[114]!==te?(we=o.jsx(Ke,{children:te}),e[114]=te,e[115]=we):we=e[115];let Ne;e[116]!==H||e[117]!==Te||e[118]!==we?(Ne=o.jsxs(H,{children:[Te,we]}),e[116]=H,e[117]=Te,e[118]=we,e[119]=Ne):Ne=e[119];let Oe;e[120]!==L||e[121]!==y?(Oe=L&&o.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:y("thread.branchPicker.newChatHint")}),e[120]=L,e[121]=y,e[122]=Oe):Oe=e[122];let nt;e[123]!==K||e[124]!==j||e[125]!==G||e[126]!==Z||e[127]!==A||e[128]!==V||e[129]!==S||e[130]!==a||e[131]!==l||e[132]!==h||e[133]!==X||e[134]!==I||e[135]!==u||e[136]!==f||e[137]!==ee||e[138]!==J||e[139]!==Q||e[140]!==y||e[141]!==d||e[142]!==_e||e[143]!==c||e[144]!==i?(nt=j?o.jsx(O1e,{orgId:a,orgSlug:l,userId:c,target:d,owner:h,repo:u,sandboxMap:f,enabled:S,onBack:()=>C(!1),onAdopt:K}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col",children:[_e&&i&&(V===i?o.jsx(Xy,{value:A,onChange:P,onSave:J,onCancel:G}):o.jsx(Jy,{dot:N1("orange"),label:y("thread.branchPicker.defaultVersionName"),branch:i,selected:!0,onSelect:()=>X(i),onRename:()=>{N(i),P(ep(I,y("thread.branchPicker.defaultVersionName")))}})),I.map(Ge=>V===Ge.branch?o.jsx(Xy,{value:A,onChange:P,onSave:()=>ee(Ge.branch),onCancel:G},Ge.branch):o.jsx(Jy,{dot:N1(Ge.color),label:Ge.name,branch:Ge.branch,selected:Ge.branch===i,onSelect:()=>X(Ge.branch),onRename:()=>Q(Ge),onDelete:()=>E(Ge)},Ge.branch))]}),(_e||I.length>0)&&o.jsx("div",{className:"my-1 border-t"}),o.jsxs("button",{type:"button",onClick:()=>{Z()},className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm text-muted-foreground hover:bg-accent hover:text-foreground",children:[o.jsx(Qt,{className:"h-4 w-4 shrink-0"}),y("thread.branchPicker.newVersion")]}),o.jsxs("button",{type:"button",onClick:()=>C(!0),className:"flex w-full items-center justify-between gap-2 rounded-md px-2 py-2 text-left text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[y("thread.branchPicker.advanced"),o.jsx(Ns,{className:"h-4 w-4 shrink-0"})]})]}),e[123]=K,e[124]=j,e[125]=G,e[126]=Z,e[127]=A,e[128]=V,e[129]=S,e[130]=a,e[131]=l,e[132]=h,e[133]=X,e[134]=I,e[135]=u,e[136]=f,e[137]=ee,e[138]=J,e[139]=Q,e[140]=y,e[141]=d,e[142]=_e,e[143]=c,e[144]=i,e[145]=nt):nt=e[145];let Fe;e[146]!==Oe||e[147]!==nt?(Fe=o.jsxs(ks,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:I1e,children:[Oe,nt]}),e[146]=Oe,e[147]=nt,e[148]=Fe):Fe=e[148];let yt;e[149]!==W||e[150]!==ie||e[151]!==he||e[152]!==Ne||e[153]!==Fe?(yt=o.jsxs(W,{open:ie,onOpenChange:he,children:[Ne,Fe]}),e[149]=W,e[150]=ie,e[151]=he,e[152]=Ne,e[153]=Fe,e[154]=yt):yt=e[154];const it=yt,st=R!==null;let ft;e[155]===Symbol.for("react.memo_cache_sentinel")?(ft=Ge=>{Ge||E(null)},e[155]=ft):ft=e[155];let _t;e[156]!==y?(_t=y("thread.branchPicker.deleteTitle"),e[156]=y,e[157]=_t):_t=e[157];let mt;e[158]!==_t?(mt=o.jsx(Xr,{children:_t}),e[158]=_t,e[159]=mt):mt=e[159];let Ze;e[160]!==R||e[161]!==y?(Ze=R&&y("thread.branchPicker.deleteConfirm",{name:R.name}),e[160]=R,e[161]=y,e[162]=Ze):Ze=e[162];let rt;e[163]!==Ze?(rt=o.jsx(Jr,{children:Ze}),e[163]=Ze,e[164]=rt):rt=e[164];let xt;e[165]!==mt||e[166]!==rt?(xt=o.jsxs(Qr,{children:[mt,rt]}),e[165]=mt,e[166]=rt,e[167]=xt):xt=e[167];let be;e[168]!==y?(be=y("thread.branchPicker.cancel"),e[168]=y,e[169]=be):be=e[169];let Re;e[170]!==be?(Re=o.jsx(eo,{children:be}),e[170]=be,e[171]=Re):Re=e[171];let Me;e[172]!==y?(Me=y("thread.branchPicker.delete"),e[172]=y,e[173]=Me):Me=e[173];let dt;e[174]!==Y||e[175]!==Me?(dt=o.jsx(to,{onClick:Y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Me}),e[174]=Y,e[175]=Me,e[176]=dt):dt=e[176];let ut;e[177]!==Re||e[178]!==dt?(ut=o.jsxs(Zr,{children:[Re,dt]}),e[177]=Re,e[178]=dt,e[179]=ut):ut=e[179];let ht;e[180]!==xt||e[181]!==ut?(ht=o.jsxs(Yr,{children:[xt,ut]}),e[180]=xt,e[181]=ut,e[182]=ht):ht=e[182];let ct;e[183]!==st||e[184]!==ht?(ct=o.jsx(Gr,{open:st,onOpenChange:ft,children:ht}),e[183]=st,e[184]=ht,e[185]=ct):ct=e[185];let lt;return e[186]!==it||e[187]!==ct?(lt=o.jsxs(o.Fragment,{children:[it,ct]}),e[186]=it,e[187]=ct,e[188]=lt):lt=e[188],lt}function I1e(t){return t.preventDefault()}function Xy(t){const e=F.c(20),{value:s,onChange:n,onSave:i,onCancel:r}=t,a=ae();let l;e[0]!==a?(l=a("thread.branchPicker.rename"),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==n?(c=m=>n(m.target.value),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==r||e[5]!==i?(d=m=>{m.key==="Enter"&&i(),m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r())},e[4]=r,e[5]=i,e[6]=d):d=e[6];let h;e[7]!==l||e[8]!==c||e[9]!==d||e[10]!==s?(h=o.jsx("input",{autoFocus:!0,"aria-label":l,value:s,onChange:c,onKeyDown:d,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),e[7]=l,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11];let u;e[12]!==a?(u=a("thread.branchPicker.save"),e[12]=a,e[13]=u):u=e[13];let f;e[14]!==i||e[15]!==u?(f=o.jsx(me,{size:"sm",onClick:i,children:u}),e[14]=i,e[15]=u,e[16]=f):f=e[16];let p;return e[17]!==h||e[18]!==f?(p=o.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[h,f]}),e[17]=h,e[18]=f,e[19]=p):p=e[19],p}function Jy(t){const e=F.c(45),{dot:s,label:n,branch:i,selected:r,onSelect:a,onRename:l,onDelete:c}=t,d=ae(),h=r?"bg-accent":"hover:bg-accent/60";let u;e[0]!==h?(u=re("group flex items-center rounded-md",h),e[0]=h,e[1]=u):u=e[1];let f;e[2]!==s?(f=re("h-2 w-2 shrink-0 rounded-full",s),e[2]=s,e[3]=f):f=e[3];let p;e[4]!==f?(p=o.jsx("span",{className:f}),e[4]=f,e[5]=p):p=e[5];let m;e[6]!==n?(m=o.jsx("span",{className:"flex-1 truncate",children:n}),e[6]=n,e[7]=m):m=e[7];let g;e[8]!==a||e[9]!==r||e[10]!==p||e[11]!==m?(g=o.jsx(He,{asChild:!0,children:o.jsxs("button",{type:"button","aria-pressed":r,onClick:a,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[p,m]})}),e[8]=a,e[9]=r,e[10]=p,e[11]=m,e[12]=g):g=e[12];let x;e[13]!==i||e[14]!==d?(x=d("thread.branchPicker.branchTooltip",{branch:i}),e[13]=i,e[14]=d,e[15]=x):x=e[15];let b;e[16]!==x?(b=o.jsx(Ke,{side:"bottom",className:"font-mono text-xs",children:x}),e[16]=x,e[17]=b):b=e[17];let v;e[18]!==g||e[19]!==b?(v=o.jsxs(We,{children:[g,b]}),e[18]=g,e[19]=b,e[20]=v):v=e[20];let L;e[21]!==d?(L=d("thread.branchPicker.moreActions"),e[21]=d,e[22]=L):L=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(c0,{className:"h-4 w-4"}),e[23]=_):_=e[23];let y;e[24]!==L?(y=o.jsx($t,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":L,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:_})}),e[24]=L,e[25]=y):y=e[25];let w;e[26]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(_9,{className:"h-4 w-4"}),e[26]=w):w=e[26];let S;e[27]!==d?(S=d("thread.branchPicker.rename"),e[27]=d,e[28]=S):S=e[28];let k;e[29]!==l||e[30]!==S?(k=o.jsxs(Qe,{onSelect:l,children:[w,S]}),e[29]=l,e[30]=S,e[31]=k):k=e[31];let j;e[32]!==c||e[33]!==d?(j=c&&o.jsxs(Qe,{onSelect:c,className:"text-destructive focus:text-destructive",children:[o.jsx(rn,{className:"h-4 w-4"}),d("thread.branchPicker.delete")]}),e[32]=c,e[33]=d,e[34]=j):j=e[34];let C;e[35]!==k||e[36]!==j?(C=o.jsxs(Bt,{align:"end",children:[k,j]}),e[35]=k,e[36]=j,e[37]=C):C=e[37];let V;e[38]!==y||e[39]!==C?(V=o.jsxs(Ot,{children:[y,C]}),e[38]=y,e[39]=C,e[40]=V):V=e[40];let N;return e[41]!==V||e[42]!==u||e[43]!==v?(N=o.jsxs("div",{className:u,children:[v,V]}),e[41]=V,e[42]=u,e[43]=v,e[44]=N):N=e[44],N}function O1e(t){const e=F.c(94),{orgId:s,orgSlug:n,userId:i,target:r,owner:a,repo:l,sandboxMap:c,enabled:d,onBack:h,onAdopt:u}=t,f=ae(),[p,m]=T.useState("branches"),[g,x]=T.useState(""),b=p==="branches"?g:"",v=d&&p==="branches";let L;e[0]!==s||e[1]!==n||e[2]!==a||e[3]!==l||e[4]!==c||e[5]!==b||e[6]!==v||e[7]!==r||e[8]!==i?(L={orgId:s,orgSlug:n,userId:i,target:r,sandboxMap:c,owner:a,repo:l,search:b,enabled:v},e[0]=s,e[1]=n,e[2]=a,e[3]=l,e[4]=c,e[5]=b,e[6]=v,e[7]=r,e[8]=i,e[9]=L):L=e[9];const{recent:_,yours:y,others:w,isLoading:S,hasMore:k,isFetchingMore:j,fetchMore:C}=R1e(L),V=d&&p==="prs";let N;e[10]!==s||e[11]!==n||e[12]!==a||e[13]!==l||e[14]!==V||e[15]!==r?(N={orgId:s,orgSlug:n,target:r,owner:a,repo:l,enabled:V},e[10]=s,e[11]=n,e[12]=a,e[13]=l,e[14]=V,e[15]=r,e[16]=N):N=e[16];const{data:A,isLoading:P}=$P(N);let R,E,I,D,O,B,M,z,$;if(e[17]!==C||e[18]!==k||e[19]!==j||e[20]!==S||e[21]!==u||e[22]!==h||e[23]!==w||e[24]!==a||e[25]!==P||e[26]!==_||e[27]!==l||e[28]!==g||e[29]!==f||e[30]!==A||e[31]!==p||e[32]!==y){const K=A===void 0?[]:A,G=`${a}/${l}`;let Y;e[42]!==G?(Y=G.toLowerCase(),e[42]=G,e[43]=Y):Y=e[43];const Z=Y;let te;e[44]!==Z?(te=ne=>ne.headRepoFullName?.toLowerCase()===Z,e[44]=Z,e[45]=te):te=e[45];const X=K.filter(te);let ee;if(e[46]!==w||e[47]!==_||e[48]!==y){const ne=new Set;ee=[..._,...y,...w].filter(q=>ne.has(q.name)?!1:(ne.add(q.name),!0)),e[46]=w,e[47]=_,e[48]=y,e[49]=ee}else ee=e[49];const J=ee;O="flex flex-col";let Q;e[50]===Symbol.for("react.memo_cache_sentinel")?(Q=o.jsx(Qh,{className:"h-4 w-4 shrink-0"}),e[50]=Q):Q=e[50];let oe;e[51]!==f?(oe=f("thread.branchPicker.advancedBack"),e[51]=f,e[52]=oe):oe=e[52],e[53]!==h||e[54]!==oe?(B=o.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[Q,oe]}),e[53]=h,e[54]=oe,e[55]=B):B=e[55],E=vr,$=p==="branches"?$1e:void 0;let le;e[56]!==f||e[57]!==p?(le=f(p==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[56]=f,e[57]=p,e[58]=le):le=e[58],e[59]!==g||e[60]!==le?(I=o.jsx(Mi,{placeholder:le,value:g,onValueChange:x}),e[59]=g,e[60]=le,e[61]=I):I=e[61];let de;e[62]===Symbol.for("react.memo_cache_sentinel")?(de=ne=>{m(ne),x("")},e[62]=de):de=e[62];let se;e[63]!==f?(se=f("thread.branchPicker.branchesTab"),e[63]=f,e[64]=se):se=e[64];let ie;e[65]!==se?(ie=o.jsx(or,{value:"branches",className:"h-6 px-2.5 text-xs",children:se}),e[65]=se,e[66]=ie):ie=e[66];let he;e[67]!==f?(he=f("thread.branchPicker.prsTab"),e[67]=f,e[68]=he):he=e[68];let ue;e[69]!==he?(ue=o.jsx(or,{value:"prs",className:"h-6 px-2.5 text-xs",children:he}),e[69]=he,e[70]=ue):ue=e[70];let ce;e[71]!==ie||e[72]!==ue?(ce=o.jsxs(t0,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[ie,ue]}),e[71]=ie,e[72]=ue,e[73]=ce):ce=e[73],e[74]!==ce||e[75]!==p?(D=o.jsx(ad,{className:"px-2 pt-2 pb-1",value:p,onValueChange:de,children:ce}),e[74]=ce,e[75]=p,e[76]=D):D=e[76],R=Ii,e[77]!==C||e[78]!==p?(M=ne=>{const q=ne.currentTarget;p==="branches"&&q.scrollHeight-q.scrollTop-q.clientHeight<48&&C()},e[77]=C,e[78]=p,e[79]=M):M=e[79],z=p==="branches"?o.jsxs(o.Fragment,{children:[S&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingMore")}),!S&&J.length===0&&o.jsx(ri,{children:f("thread.branchPicker.noBranchesFound")}),J.length>0&&o.jsx(fn,{children:J.map(ne=>o.jsxs($s,{value:ne.name,className:"cursor-pointer",onSelect:()=>u(ne.name,ne.name),children:[o.jsx(qr,{className:"mr-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:ne.name})]},ne.name))}),k&&o.jsx("div",{className:"p-2",children:o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:j,onClick:C,children:f(j?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):o.jsxs(o.Fragment,{children:[P&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingPullRequests")}),!P&&X.length===0&&o.jsx(ri,{children:f("thread.branchPicker.noOpenPullRequests")}),X.length>0&&o.jsx(fn,{children:X.map(ne=>o.jsxs($s,{value:`#${ne.number} ${ne.title} ${ne.head}`,className:"cursor-pointer",onSelect:()=>u(ne.head,Ka(ne.title)),children:[o.jsx(Fo,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate",children:Ka(ne.title)}),o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",ne.number," · ",ne.head]})]})]},ne.number))})]}),e[17]=C,e[18]=k,e[19]=j,e[20]=S,e[21]=u,e[22]=h,e[23]=w,e[24]=a,e[25]=P,e[26]=_,e[27]=l,e[28]=g,e[29]=f,e[30]=A,e[31]=p,e[32]=y,e[33]=R,e[34]=E,e[35]=I,e[36]=D,e[37]=O,e[38]=B,e[39]=M,e[40]=z,e[41]=$}else R=e[33],E=e[34],I=e[35],D=e[36],O=e[37],B=e[38],M=e[39],z=e[40],$=e[41];let U;e[80]!==R||e[81]!==M||e[82]!==z?(U=o.jsx(R,{onScroll:M,children:z}),e[80]=R,e[81]=M,e[82]=z,e[83]=U):U=e[83];let H;e[84]!==E||e[85]!==I||e[86]!==D||e[87]!==U||e[88]!==$?(H=o.jsxs(E,{filter:$,children:[I,D,U]}),e[84]=E,e[85]=I,e[86]=D,e[87]=U,e[88]=$,e[89]=H):H=e[89];let W;return e[90]!==O||e[91]!==B||e[92]!==H?(W=o.jsxs("div",{className:O,children:[B,H]}),e[90]=O,e[91]=B,e[92]=H,e[93]=W):W=e[93],W}function $1e(t,e){return C2(t,e)?1:0}function B1e(t){const e=F.c(16),{locked:s,placement:n,value:i,virtualMcpId:r,userLabel:a,baseBranch:l,onChange:c,onCreateBranch:d,orgId:h,orgSlug:u,userId:f,target:p,owner:m,repo:g,sandboxMap:x}=t;let b;return e[0]!==l||e[1]!==s||e[2]!==c||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==m||e[7]!==n||e[8]!==g||e[9]!==x||e[10]!==p||e[11]!==f||e[12]!==a||e[13]!==i||e[14]!==r?(b=o.jsx(M1e,{virtualMcpId:r,userLabel:a,value:i,baseBranch:l,orgId:h,orgSlug:u,userId:f,target:p,owner:m,repo:g,sandboxMap:x,onChange:c,onCreateBranch:d,spawnsNewChat:s,placement:n}),e[0]=l,e[1]=s,e[2]=c,e[3]=d,e[4]=h,e[5]=u,e[6]=m,e[7]=n,e[8]=g,e[9]=x,e[10]=p,e[11]=f,e[12]=a,e[13]=i,e[14]=r,e[15]=b):b=e[15],b}function z1e(t){const e=F.c(2),{branchPill:s}=t;if(!s)return null;let n;return e[0]!==s?(n=o.jsx(o.Fragment,{children:s}),e[0]=s,e[1]=n):n=e[1],n}function F1e(t){const e=F.c(19),{virtualMcp:s,currentBranch:n}=t,i=D2(),r=Ts();let a;e[0]!==i?.messages||e[1]!==r?.isThreadLocked?(a=(i?.messages??[]).length>0||(r?.isThreadLocked??!1),e[0]=i?.messages,e[1]=r?.isThreadLocked,e[2]=a):a=e[2];const l=a,c=r?.setCurrentTaskBranch,d=r?.createTask;let h;e[3]!==r?.activeTask?.metadata||e[4]!==s?.metadata?(h=i9(s?.metadata)==="cms"&&H6(r?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=r?.activeTask?.metadata,e[4]=s?.metadata,e[5]=h):h=e[5];const u=h,f=aa(s),p=Un(f),{data:m}=On.useSession(),g=m?.user;let x;e[6]!==g?(x=Kg(g),e[6]=g,e[7]=x):x=e[7];const b=x,v=m?.user?.id??"",{org:L}=Ue(),_=Lg(s,n);let y;e[8]!==d||e[9]!==l||e[10]!==c?(y=V=>{l&&d?d({branch:V}):c&&c(V)},e[8]=d,e[9]=l,e[10]=c,e[11]=y):y=e[11];const w=y;let S;e[12]!==u||e[13]!==d||e[14]!==l||e[15]!==c?(S=V=>{(l||u)&&d?d({branch:V}):c&&c(V)},e[12]=u,e[13]=d,e[14]=l,e[15]=c,e[16]=S):S=e[16];const k=S,j=f&&wg(p)?o.jsx(B1e,{userLabel:b,virtualMcpId:s?.id??"",value:n,baseBranch:_,orgId:L.id,orgSlug:L.slug,userId:v,target:p,owner:f.owner,repo:f.name,sandboxMap:s?.metadata?.sandboxMap,onChange:w,onCreateBranch:k,locked:l,placement:"chat"},`${$8(p)}:${f.owner}/${f.name}`):null;let C;return e[17]!==j?(C=o.jsx(z1e,{branchPill:j}),e[17]=j,e[18]=C):C=e[18],C}function U1e(){const t=F.c(20),e=ae(),{threads:s}=s9(),{createNewTask:n}=oa(),i=M8(),r=l0();let a;t[0]!==r||t[1]!==s?(a=s.find(x=>x.id===r)?.branch??null,t[0]=r,t[1]=s,t[2]=a):a=t[2];const l=a;let c;t[3]!==i||t[4]!==n||t[5]!==l?(c=()=>{n(i,l)},t[3]=i,t[4]=n,t[5]=l,t[6]=c):c=t[6];const d=c;let h;t[7]!==e?(h=e("sidebar.taskGroupsList.newChat"),t[7]=e,t[8]=h):h=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Zu,{size:16}),t[9]=u):u=t[9];let f;t[10]!==d||t[11]!==h?(f=o.jsx(He,{asChild:!0,children:o.jsx("button",{type:"button",onClick:d,"aria-label":h,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:u})}),t[10]=d,t[11]=h,t[12]=f):f=t[12];let p;t[13]!==e?(p=e("sidebar.taskGroupsList.newChat"),t[13]=e,t[14]=p):p=t[14];let m;t[15]!==p?(m=o.jsx(Ke,{side:"bottom",children:p}),t[15]=p,t[16]=m):m=t[16];let g;return t[17]!==f||t[18]!==m?(g=o.jsxs(We,{children:[f,m]}),t[17]=f,t[18]=m,t[19]=g):g=t[19],g}function jm(t){const e=F.c(13),{label:s,value:n,onChange:i,options:r}=t;let a;e[0]!==s?(a=o.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==i?(l=u=>u&&i(u),e[2]=i,e[3]=l):l=e[3];let c;e[4]!==r?(c=r.map(H1e),e[4]=r,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==c||e[8]!==n?(d=o.jsx(d9,{type:"single",size:"sm",value:n,onValueChange:l,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=l,e[7]=c,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==a||e[11]!==d?(h=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a,d]}),e[10]=a,e[11]=d,e[12]=h):h=e[12],h}function H1e(t){return o.jsxs(Kc,{value:t.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[t.icon,t.label]},t.value)}function K1e(t){const e=F.c(91),{panel:s,className:n}=t,i=n===void 0?"md:size-[34px] rounded-lg":n,r=ae();let a;e[0]!==r?(a=r("sidebar.taskGroupsList.filterChats"),e[0]=r,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(ag,{size:16}),e[2]=l):l=e[2];let c;e[3]!==s.filtersActive?(c=s.filtersActive&&o.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"}),e[3]=s.filtersActive,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s.filtersActive||e[7]!==a||e[8]!==c?(d=o.jsx(He,{asChild:!0,children:o.jsx(ws,{asChild:!0,children:o.jsxs($o,{"aria-label":a,active:s.filtersActive,className:i,children:[l,c]})})}),e[5]=i,e[6]=s.filtersActive,e[7]=a,e[8]=c,e[9]=d):d=e[9];let h;e[10]!==r?(h=r("sidebar.taskGroupsList.filterChats"),e[10]=r,e[11]=h):h=e[11];let u;e[12]!==h?(u=o.jsx(Ke,{side:"bottom",children:h}),e[12]=h,e[13]=u):u=e[13];let f;e[14]!==d||e[15]!==u?(f=o.jsxs(We,{children:[d,u]}),e[14]=d,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==r?(p=r("sidebar.taskGroupsList.filterView"),e[17]=r,e[18]=p):p=e[18];const m=s.groupBy;let g;e[19]!==s?(g=Z=>{qe("tasks_panel_group_by_changed",{to_value:Z}),s.setGroupBy(Z)},e[19]=s,e[20]=g):g=e[20];let x;e[21]!==r?(x=r("sidebar.taskGroupsList.viewList"),e[21]=r,e[22]=x):x=e[22];let b;e[23]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(SA,{size:13}),e[23]=b):b=e[23];let v;e[24]!==x?(v={value:"flat",label:x,icon:b},e[24]=x,e[25]=v):v=e[25];let L;e[26]!==r?(L=r("sidebar.taskGroupsList.viewStatus"),e[26]=r,e[27]=L):L=e[27];let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(kA,{size:13}),e[28]=_):_=e[28];let y;e[29]!==L?(y={value:"status",label:L,icon:_},e[29]=L,e[30]=y):y=e[30];let w;e[31]!==v||e[32]!==y?(w=[v,y],e[31]=v,e[32]=y,e[33]=w):w=e[33];let S;e[34]!==s.groupBy||e[35]!==g||e[36]!==w||e[37]!==p?(S=o.jsx(jm,{label:p,value:m,onChange:g,options:w}),e[34]=s.groupBy,e[35]=g,e[36]=w,e[37]=p,e[38]=S):S=e[38];let k;e[39]!==r?(k=r("sidebar.taskGroupsList.filterType"),e[39]=r,e[40]=k):k=e[40];const j=s.typeFilter;let C;e[41]!==s?(C=Z=>{qe("tasks_panel_filter_changed",{to_value:Z}),s.setTypeFilter(Z)},e[41]=s,e[42]=C):C=e[42];let V;e[43]!==r?(V=r("sidebar.taskGroupsList.typeAll"),e[43]=r,e[44]=V):V=e[44];let N;e[45]!==V?(N={value:"all",label:V},e[45]=V,e[46]=N):N=e[46];let A;e[47]!==r?(A=r("sidebar.taskGroupsList.typeChats"),e[47]=r,e[48]=A):A=e[48];let P;e[49]!==A?(P={value:"manual",label:A},e[49]=A,e[50]=P):P=e[50];let R;e[51]!==r?(R=r("sidebar.taskGroupsList.typeAuto"),e[51]=r,e[52]=R):R=e[52];let E;e[53]!==R?(E={value:"automation",label:R},e[53]=R,e[54]=E):E=e[54];let I;e[55]!==N||e[56]!==P||e[57]!==E?(I=[N,P,E],e[55]=N,e[56]=P,e[57]=E,e[58]=I):I=e[58];let D;e[59]!==s.typeFilter||e[60]!==k||e[61]!==C||e[62]!==I?(D=o.jsx(jm,{label:k,value:j,onChange:C,options:I}),e[59]=s.typeFilter,e[60]=k,e[61]=C,e[62]=I,e[63]=D):D=e[63];let O;e[64]!==r?(O=r("sidebar.taskGroupsList.filterScope"),e[64]=r,e[65]=O):O=e[65];const B=s.showAll?"team":"mine";let M;e[66]!==s?(M=Z=>s.setShowAll(Z==="team"),e[66]=s,e[67]=M):M=e[67];let z;e[68]!==r?(z=r("sidebar.taskGroupsList.scopeMine"),e[68]=r,e[69]=z):z=e[69];let $;e[70]!==z?($={value:"mine",label:z},e[70]=z,e[71]=$):$=e[71];let U;e[72]!==r?(U=r("sidebar.taskGroupsList.scopeTeam"),e[72]=r,e[73]=U):U=e[73];let H;e[74]!==U?(H={value:"team",label:U},e[74]=U,e[75]=H):H=e[75];let W;e[76]!==$||e[77]!==H?(W=[$,H],e[76]=$,e[77]=H,e[78]=W):W=e[78];let K;e[79]!==O||e[80]!==B||e[81]!==M||e[82]!==W?(K=o.jsx(jm,{label:O,value:B,onChange:M,options:W}),e[79]=O,e[80]=B,e[81]=M,e[82]=W,e[83]=K):K=e[83];let G;e[84]!==S||e[85]!==D||e[86]!==K?(G=o.jsxs(ks,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[S,D,K]}),e[84]=S,e[85]=D,e[86]=K,e[87]=G):G=e[87];let Y;return e[88]!==G||e[89]!==f?(Y=o.jsxs(js,{children:[f,G]}),e[88]=G,e[89]=f,e[90]=Y):Y=e[90],Y}function W1e(t,e){return t.filter(s=>s.id===e||!!s.trigger_id||P_(s))}function q1e(){const t=F.c(2),e=sl()??[];let s;return t[0]!==e?(s=n=>{if(!n)return;const i=e.find(r=>r.id===n);return i?i9(i.metadata):void 0},t[0]=e,t[1]=s):s=t[1],s}function G1e(t){const e=F.c(9),{virtualMcpId:s,size:n,showAutomationBadge:i}=t,r=n===void 0?"sm":n,a=ae();let l;e[0]!==r||e[1]!==s?(l=s?o.jsx(Y1e,{virtualMcpId:s,size:r}):o.jsx(Kr,{icon:null,name:"?",size:r}),e[0]=r,e[1]=s,e[2]=l):l=e[2];let c;e[3]!==i||e[4]!==a?(c=i&&o.jsx("span",{"aria-label":a("tasksPanel.mcpAvatar.automationTriggered"),className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:o.jsx(hr,{size:10,className:"text-white"})}),e[3]=i,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=o.jsxs("div",{className:"relative shrink-0",children:[l,c]}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function Y1e(t){const e=F.c(6),{virtualMcpId:s,size:n}=t,i=As(s);if(!i){let l;return e[0]!==n?(l=o.jsx(Kr,{icon:null,name:"?",size:n}),e[0]=n,e[1]=l):l=e[1],l}const r=i.icon??null;let a;return e[2]!==i.title||e[3]!==n||e[4]!==r?(a=o.jsx(Kr,{icon:r,name:i.title,size:n}),e[2]=i.title,e[3]=n,e[4]=r,e[5]=a):a=e[5],a}const Zy=["thread"];function Q1e(t){const e=F.c(53),{open:s,onOpenChange:n}=t,[i,r]=T.useState(""),{org:a}=Ue(),{setTaskId:l}=oa(),c=us(),d=ae();let h,u,f,p;e[0]!==a.id||e[1]!==i?(p=i.trim(),h=p?20:10,f=Yt,u=tt.globalSearch(a.id,p,h,Zy),e[0]=a.id,e[1]=i,e[2]=h,e[3]=u,e[4]=f,e[5]=p):(h=e[2],u=e[3],f=e[4],p=e[5]);let m;e[6]!==h||e[7]!==c||e[8]!==p?(m=async()=>{const O=await c.call("GLOBAL_SEARCH",{query:p,limit:h,types:[...Zy]});return{...O,items:O.items.filter(X1e)}},e[6]=h,e[7]=c,e[8]=p,e[9]=m):m=e[9];let g;e[10]!==s||e[11]!==u||e[12]!==m?(g={queryKey:u,enabled:s,queryFn:m,staleTime:1e4},e[10]=s,e[11]=u,e[12]=m,e[13]=g):g=e[13];const{data:x,isFetching:b}=f(g);let v;e[14]!==x?.items?(v=x?.items??[],e[14]=x?.items,e[15]=v):v=e[15];const L=v;let _;e[16]!==n?(_=O=>{O||r(""),n(O)},e[16]=n,e[17]=_):_=e[17];const y=_;let w;e[18]!==y||e[19]!==l?(w=O=>{y(!1),l(O.id,O.virtual_mcp_id??void 0)},e[18]=y,e[19]=l,e[20]=w):w=e[20];const S=w;let k;e[21]!==d?(k=d("tasksPanel.globalSearchDialog.title"),e[21]=d,e[22]=k):k=e[22];let j;e[23]!==k?(j=o.jsx(Kt,{children:k}),e[23]=k,e[24]=j):j=e[24];let C;e[25]!==d?(C=d("tasksPanel.globalSearchDialog.description"),e[25]=d,e[26]=C):C=e[26];let V;e[27]!==C?(V=o.jsx(Mn,{children:C}),e[27]=C,e[28]=V):V=e[28];let N;e[29]!==V||e[30]!==j?(N=o.jsxs(cs,{className:"sr-only",children:[j,V]}),e[29]=V,e[30]=j,e[31]=N):N=e[31];let A;e[32]!==d?(A=d("tasksPanel.globalSearchDialog.placeholder"),e[32]=d,e[33]=A):A=e[33];let P;e[34]!==i||e[35]!==A?(P=o.jsx(Mi,{value:i,onValueChange:r,placeholder:A}),e[34]=i,e[35]=A,e[36]=P):P=e[36];let R;e[37]!==S||e[38]!==b||e[39]!==L||e[40]!==d||e[41]!==p?(R=o.jsx(Ii,{children:b&&L.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:d("tasksPanel.globalSearchDialog.searching")}):L.length===0?o.jsx(ri,{children:d("tasksPanel.globalSearchDialog.noResults")}):o.jsx(fn,{heading:p?void 0:d("tasksPanel.globalSearchDialog.recent"),children:L.map(O=>O.type==="thread"?o.jsxs($s,{value:`thread:${O.id}:${O.title}`,onSelect:()=>S(O),className:"gap-2.5",children:[o.jsx(G1e,{virtualMcpId:O.virtual_mcp_id,size:"xs"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-foreground truncate",children:O.title||d("tasksPanel.globalSearchDialog.untitledChat")})}),o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(O.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${O.id}`):null)})}),e[37]=S,e[38]=b,e[39]=L,e[40]=d,e[41]=p,e[42]=R):R=e[42];let E;e[43]!==P||e[44]!==R?(E=o.jsxs(vr,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[P,R]}),e[43]=P,e[44]=R,e[45]=E):E=e[45];let I;e[46]!==N||e[47]!==E?(I=o.jsxs(zt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[N,E]}),e[46]=N,e[47]=E,e[48]=I):I=e[48];let D;return e[49]!==y||e[50]!==s||e[51]!==I?(D=o.jsx(Ft,{open:s,onOpenChange:y,children:I}),e[49]=y,e[50]=s,e[51]=I,e[52]=D):D=e[52],D}function X1e(t){return t.type==="thread"}function J1e(t){const e=F.c(43),{branch:s,onOutcome:n}=t,i=ae();let r;e[0]!==n?(r=S=>{S||n("cancel")},e[0]=n,e[1]=r):r=e[1];let a;e[2]!==i?(a=i("sidebar.archiveWorktreeDialog.title"),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==a?(l=o.jsx(Xr,{children:a}),e[4]=a,e[5]=l):l=e[5];let c;e[6]!==i?(c=i("sidebar.archiveWorktreeDialog.stopsAndDeletesBefore"),e[6]=i,e[7]=c):c=e[7];let d;e[8]!==s?(d=o.jsx("span",{className:"font-mono",children:s}),e[8]=s,e[9]=d):d=e[9];let h;e[10]!==i?(h=i("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=i,e[11]=h):h=e[11];let u;e[12]!==c||e[13]!==d||e[14]!==h?(u=o.jsxs(Jr,{children:[c," ",d," ",h]}),e[12]=c,e[13]=d,e[14]=h,e[15]=u):u=e[15];let f;e[16]!==l||e[17]!==u?(f=o.jsxs(Qr,{children:[l,u]}),e[16]=l,e[17]=u,e[18]=f):f=e[18];let p;e[19]!==n?(p=()=>n("cancel"),e[19]=n,e[20]=p):p=e[20];let m;e[21]!==i?(m=i("sidebar.archiveWorktreeDialog.cancel"),e[21]=i,e[22]=m):m=e[22];let g;e[23]!==m||e[24]!==p?(g=o.jsx(eo,{onClick:p,children:m}),e[23]=m,e[24]=p,e[25]=g):g=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=re(A6({variant:"destructive"})),e[26]=x):x=e[26];let b;e[27]!==n?(b=()=>n("confirm"),e[27]=n,e[28]=b):b=e[28];let v;e[29]!==i?(v=i("sidebar.archiveWorktreeDialog.confirm"),e[29]=i,e[30]=v):v=e[30];let L;e[31]!==b||e[32]!==v?(L=o.jsx(to,{className:x,onClick:b,children:v}),e[31]=b,e[32]=v,e[33]=L):L=e[33];let _;e[34]!==g||e[35]!==L?(_=o.jsxs(Zr,{children:[g,L]}),e[34]=g,e[35]=L,e[36]=_):_=e[36];let y;e[37]!==_||e[38]!==f?(y=o.jsxs(Yr,{children:[f,_]}),e[37]=_,e[38]=f,e[39]=y):y=e[39];let w;return e[40]!==r||e[41]!==y?(w=o.jsx(Gr,{open:!0,onOpenChange:r,children:y}),e[40]=r,e[41]=y,e[42]=w):w=e[42],w}function Z1e(t,e,s){if(!s)return;const n=t.findIndex(i=>i.id===e);if(n!==-1){for(let i=n+1;i<t.length;i++){const r=t[i];if(r?.created_by===s)return r}for(let i=n-1;i>=0;i--){const r=t[i];if(r?.created_by===s)return r}}}function eme(t){return t==="ephemeral"||t.startsWith("thread:")}function lN(t){const e=F.c(45),{task:s,isActive:n,onClick:i,onArchive:r,showAutomationBadge:a,showAgentIcon:l,hideStatusIdle:c,indented:d}=t,h=ae(),u=pT(s.status),f=u.icon,p=s.metadata?.kind==="tool_call_run",m=As(p?void 0:s.virtual_mcp_id);let g;e[0]!==m?(g=aa(m),e[0]=m,e[1]=g):g=e[1];const x=g;gT(6e4);const b=a||!!s.trigger_id,v=s.id,L="button",_=0;let y;e[2]!==i?(y=M=>{M.target===M.currentTarget&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),i())},e[2]=i,e[3]=y):y=e[3];const w=d?"-ml-4 pl-6":"pl-[9px]",S=n?"bg-accent text-accent-foreground":"hover:bg-accent/60";let k;e[4]!==w||e[5]!==S?(k=re("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",w,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",S),e[4]=w,e[5]=S,e[6]=k):k=e[6];let j;e[7]!==p||e[8]!==l||e[9]!==m?.icon||e[10]!==m?.title?(j=l&&!p&&o.jsx(Kr,{icon:m?.icon??null,name:m?.title??"?",size:"2xs"}),e[7]=p,e[8]=l,e[9]=m?.icon,e[10]=m?.title,e[11]=j):j=e[11];let C;e[12]!==b||e[13]!==h?(C=b&&o.jsx(hr,{size:12,"aria-label":h("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=b,e[13]=h,e[14]=C):C=e[14];let V;e[15]!==h||e[16]!==s.title?(V=s.title||h("tasksPanel.taskRow.untitledTask"),e[15]=h,e[16]=s.title,e[17]=V):V=e[17];let N;e[18]!==V?(N=o.jsx("div",{className:"text-sm text-foreground truncate",children:V}),e[18]=V,e[19]=N):N=e[19];let A;e[20]!==C||e[21]!==N?(A=o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[C,N]}),e[20]=C,e[21]=N,e[22]=A):A=e[22];let P;e[23]!==x||e[24]!==n||e[25]!==s.branch||e[26]!==s.updated_at?(P=s.updated_at&&o.jsxs("div",{className:re("flex items-center gap-1 text-[11px] min-w-0",n?"text-accent-foreground/70":"text-muted-foreground/60"),children:[s.branch&&!eme(s.branch)?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"truncate font-mono",children:s.branch}),o.jsx("span",{className:"shrink-0",children:"·"})]}):x?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"truncate",children:[x.owner,"/",x.name]}),o.jsx("span",{className:"shrink-0",children:"·"})]}):null,o.jsx("span",{className:"shrink-0",children:ud(new Date(s.updated_at))})]}),e[23]=x,e[24]=n,e[25]=s.branch,e[26]=s.updated_at,e[27]=P):P=e[27];let R;e[28]!==A||e[29]!==P?(R=o.jsxs("div",{className:"flex-1 min-w-0",children:[A,P]}),e[28]=A,e[29]=P,e[30]=R):R=e[30];const E="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",I=!c&&o.jsx("span",{className:re("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",r&&"group-hover/row:opacity-0"),"aria-label":h("tasksPanel.taskRow.statusLabel",{status:h(u.labelKey)}),children:s.status==="in_progress"?o.jsx(et,{className:re("size-3.5",u.iconClassName)}):o.jsx(f,{size:14,className:u.iconClassName})});let D;e[31]!==r||e[32]!==h?(D=r&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":h("tasksPanel.taskRow.archiveTask"),onClick:M=>{M.stopPropagation(),r()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:o.jsx(N6,{size:14})})}),o.jsx(Ke,{side:"right",children:h("tasksPanel.taskRow.archive")})]}),e[31]=r,e[32]=h,e[33]=D):D=e[33];let O;e[34]!==I||e[35]!==D?(O=o.jsxs("div",{className:E,children:[I,D]}),e[34]=I,e[35]=D,e[36]=O):O=e[36];let B;return e[37]!==i||e[38]!==R||e[39]!==O||e[40]!==y||e[41]!==k||e[42]!==j||e[43]!==s.id?(B=o.jsxs("div",{"data-task-id":v,role:L,tabIndex:_,onClick:i,onKeyDown:y,className:k,children:[j,R,O]}),e[37]=i,e[38]=R,e[39]=O,e[40]=y,e[41]=k,e[42]=j,e[43]=s.id,e[44]=B):B=e[44],B}const e6=["requires_action","in_progress","failed","expired","completed"];function tme(t){const e=new Map(e6.map(s=>[s,[]]));for(const s of t){const n=s.status??"completed";(e.get(n)??e.get("completed")).push(s)}return e6.map(s=>({status:s,threads:e.get(s)}))}const sme="sidebar.group.expanded.";function nme(t,e){const s=F.c(3),[n,i]=qf(`${sme}${t}`,e);let r;return s[0]!==n||s[1]!==i?(r=[n,i],s[0]=n,s[1]=i,s[2]=r):r=s[2],r}function cN(t){const e=F.c(18),{onClick:s,isFetching:n,indented:i}=t,r=ae();let a;e[0]!==r?(a=r("sidebar.showMoreButton.ariaLabel"),e[0]=r,e[1]=a):a=e[1];const l=i?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==l?(c=re("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",l,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==n?(d=n&&o.jsx(et,{className:"size-3.5"}),e[4]=n,e[5]=d):d=e[5];let h;e[6]!==n||e[7]!==r?(h=r(n?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=n,e[7]=r,e[8]=h):h=e[8];let u;e[9]!==h?(u=o.jsx("span",{children:h}),e[9]=h,e[10]=u):u=e[10];let f;return e[11]!==n||e[12]!==s||e[13]!==a||e[14]!==c||e[15]!==d||e[16]!==u?(f=o.jsxs("button",{type:"button","aria-label":a,onClick:s,disabled:n,className:c,children:[d,u]}),e[11]=n,e[12]=s,e[13]=a,e[14]=c,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function ime(t,e,s,n){return[t,e,s,n.type,n.member,n.currentUserId??""].join("|")}function rme(t){return t.member==="mine"&&!t.currentUserId}const dN=4;let Hh=0;const N2=[];function ome(){for(;Hh<dN&&N2.length>0;){const t=N2.shift();t&&t()}}function uN(t){return new Promise((e,s)=>{const n=()=>{Hh++,t().then(e,s).finally(()=>{Hh--,ome()})};Hh<dN?n():N2.push(n)})}const n1=10;function t6(t,e,s,n,i){const r={hidden:!1};n.member==="mine"&&n.currentUserId&&(r.created_by=n.currentUserId),n.type==="automation"&&(r.has_trigger=!0),n.type==="manual"&&(r.has_trigger=!1);const a={where:r,limit:i,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return a.status=e,a}function ame(t,e,s,n){let i=0;for(const r of t)hN(r,e,s,n)&&i++;return i}function Cm(t,e,s,n){return ame(t,e,s,n)}function lme(t,e){return!!(t>=n1||t===0&&e)}function s6(t,e){return t<e}function cme(t,e){return e===!1?!1:e===!0?!0:t}function hN(t,e,s,n){return!(t.hidden||(t.status??"completed")!==s||n.member==="mine"&&n.currentUserId&&t.created_by!==n.currentUserId||n.type==="automation"&&!t.trigger_id||n.type==="manual"&&t.trigger_id)}const Kf=new Map,Nh=new Map;function dme(t,e){return e?t>=n1?!0:null:!1}function n6(t){return Kf.get(t)}function ume(t,e){Kf.set(t,e)}function hme(t,e,s){const n=Kf.get(t);if(n!==void 0){s(n);return}let i=Nh.get(t);i||(i=uN(e).then(r=>(Kf.set(t,r),Nh.delete(t),r)).catch(()=>(Nh.delete(t),Promise.reject(new Error("group probe failed")))),Nh.set(t,i)),i.then(s,()=>s(!1))}function i6(t){const e=t,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===n1,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function fme(t,e,s,n,i){let r=0;for(const a of t)e.has(a.id)||hN(a,s,n,i)&&r++;return r}function mme(t,e,s,n){const i=F.c(8),{org:r}=Ue(),a=ime(r.id,t,e,s);let l;i[0]!==s?(l=rme(s),i[0]=s,i[1]=l):l=i[1];const c=l,[d,h]=T.useState({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==a&&h({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});const u=n9(),{threads:f,hasMore:p}=s9(),m=Cm(f,t,e,s),g=lme(m,p),x=dme(m,p),b=us();if(d.identity===a&&d.serverHasMore===null){const S=x??n6(a);S!==void 0&&h({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:S})}!c&&d.identity===a&&d.serverHasMore===null&&x===null&&n6(a)===void 0&&d.probeSubscribedIdentity!==a&&(h(S=>S.identity===a?{...S,isProbing:!0,probeSubscribedIdentity:a}:S),hme(a,async()=>{const S=t6(t,e,0,s,1),k=await b.call("COLLECTION_THREADS_LIST",S),{totalCount:j}=i6(k),C=Cm(u.threads.get(),t,e,s);return j===void 0?!1:s6(C,j)},S=>{h(k=>k.identity!==a?k:{...k,isProbing:!1,serverHasMore:S})}));const L=async function(){if(d.isFetching||d.isProbing||c)return;const k=a;h(j=>j.identity===k?{...j,isFetching:!0}:j);try{const j=Cm(f,t,e,s),C=t6(t,e,j,s,n1),V=await uN(()=>b.call("COLLECTION_THREADS_LIST",C)),{items:N,hasMore:A,totalCount:P}=i6(V),R=new Set(f.map(pme)),E=fme(N,R,t,e,s),I=j;u.mergeThreads(N),h(D=>{if(D.identity!==k)return D;let O;return P!==void 0?O=s6(I+E,P):O=N.length===0||E===0?!1:A,ume(k,O),{...D,isFetching:!1,serverHasMore:O}})}catch(j){const C=j,V=C instanceof Error?C.message:String(C);ye.error(`Could not load more tasks: ${V}`),h(N=>N.identity===k?{...N,isFetching:!1}:N)}},_=d.isFetching||d.isProbing,y=!c&&!_&&cme(g,d.serverHasMore);let w;return i[2]!==_||i[3]!==L||i[4]!==y||i[5]!==d.isProbing||i[6]!==d.serverHasMore?(w={hasMore:y,isFetching:_,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:L},i[2]=_,i[3]=L,i[4]=y,i[5]=d.isProbing,i[6]=d.serverHasMore,i[7]=w):w=i[7],w}function pme(t){return t.id}function gme(t){const e=F.c(20),{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:l,filters:c}=t,{isFetching:d,isProbing:h,loadMore:u,hasMore:f,serverHasMore:p}=mme("status",s,c),[m,g]=T.useState(!1);!m&&n.length===0&&p===!0&&!d&&!h&&(g(!0),queueMicrotask(()=>{u()}));let x;if(e[0]!==i||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==r||e[5]!==n){let L;e[7]!==i||e[8]!==l||e[9]!==c||e[10]!==a||e[11]!==r?(L=_=>o.jsx(lN,{task:_,isActive:i===_.id,onClick:()=>r(_),onArchive:l&&_.created_by===c.currentUserId?()=>a(_):void 0,showAutomationBadge:!!_.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},_.id),e[7]=i,e[8]=l,e[9]=c,e[10]=a,e[11]=r,e[12]=L):L=e[12],x=n.map(L),e[0]=i,e[1]=l,e[2]=c,e[3]=a,e[4]=r,e[5]=n,e[6]=x}else x=e[6];let b;e[13]!==f||e[14]!==d||e[15]!==u?(b=(f||d)&&o.jsx(cN,{onClick:()=>{u()},isFetching:d,indented:!0}),e[13]=f,e[14]=d,e[15]=u,e[16]=b):b=e[16];let v;return e[17]!==x||e[18]!==b?(v=o.jsxs(o.Fragment,{children:[x,b]}),e[17]=x,e[18]=b,e[19]=v):v=e[19],v}function xme(t){const e=F.c(39),{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:l,filters:c}=t,d=ae(),h=xT[s],u=h.icon,[f,p]=nme(`status-${s}`,!1);let m;e[0]!==f||e[1]!==p?(m=function(){p(!f)},e[0]=f,e[1]=p,e[2]=m):m=e[2];const g=m;let x;e[3]!==g?(x=C=>{C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),g())},e[3]=g,e[4]=x):x=e[4];let b;e[5]!==u||e[6]!==h.iconClassName?(b=o.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:o.jsx(u,{size:12,className:h.iconClassName})}),e[5]=u,e[6]=h.iconClassName,e[7]=b):b=e[7];let v;e[8]!==f?(v=o.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:f?o.jsx(hs,{size:14}):o.jsx(Ns,{size:14})}),e[8]=f,e[9]=v):v=e[9];let L;e[10]!==b||e[11]!==v?(L=o.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[b,v]}),e[10]=b,e[11]=v,e[12]=L):L=e[12];let _;e[13]!==h.labelKey||e[14]!==d?(_=d(h.labelKey),e[13]=h.labelKey,e[14]=d,e[15]=_):_=e[15];let y;e[16]!==_?(y=o.jsx("span",{className:"flex-1 truncate",children:_}),e[16]=_,e[17]=y):y=e[17];let w;e[18]!==n.length?(w=o.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:o.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:n.length})}),e[18]=n.length,e[19]=w):w=e[19];let S;e[20]!==f||e[21]!==g||e[22]!==x||e[23]!==L||e[24]!==y||e[25]!==w?(S=o.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":f,onClick:g,onKeyDown:x,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[L,y,w]}),e[20]=f,e[21]=g,e[22]=x,e[23]=L,e[24]=y,e[25]=w,e[26]=S):S=e[26];let k;e[27]!==i||e[28]!==l||e[29]!==f||e[30]!==c||e[31]!==a||e[32]!==r||e[33]!==s||e[34]!==n?(k=f&&o.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:o.jsx(gme,{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:l,filters:c})}),e[27]=i,e[28]=l,e[29]=f,e[30]=c,e[31]=a,e[32]=r,e[33]=s,e[34]=n,e[35]=k):k=e[35];let j;return e[36]!==k||e[37]!==S?(j=o.jsxs("div",{className:"flex flex-col gap-0.5",children:[S,k]}),e[36]=k,e[37]=S,e[38]=j):j=e[38],j}function bme(t){const e=F.c(38),{threads:s,groupBy:n,activeTaskId:i,onSelectTask:r,onArchiveTask:a,filters:l,hasMore:c,isFetchingMore:d,onLoadMore:h,filtersActive:u}=t;if(s.length===0&&!c&&!d){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(jA,{className:"size-6 opacity-60"}),e[0]=x):x=e[0];const b=u?"No chats match your filters":"No chats yet";let v;return e[1]!==b?(v=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[x,o.jsx("p",{className:"text-sm",children:b})]}),e[1]=b,e[2]=v):v=e[2],v}const f=s.length>1||c;if(n==="status"){let x;if(e[3]!==i||e[4]!==f||e[5]!==l||e[6]!==a||e[7]!==r||e[8]!==s){let v;e[10]!==i||e[11]!==f||e[12]!==l||e[13]!==a||e[14]!==r?(v=L=>o.jsx(xme,{status:L.status,threads:L.threads,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:f,filters:l},L.status),e[10]=i,e[11]=f,e[12]=l,e[13]=a,e[14]=r,e[15]=v):v=e[15],x=tme(s).map(v),e[3]=i,e[4]=f,e[5]=l,e[6]=a,e[7]=r,e[8]=s,e[9]=x}else x=e[9];let b;return e[16]!==x?(b=o.jsx(o.Fragment,{children:x}),e[16]=x,e[17]=b):b=e[17],b}let p;if(e[18]!==i||e[19]!==f||e[20]!==l||e[21]!==a||e[22]!==r||e[23]!==s){let x;e[25]!==i||e[26]!==f||e[27]!==l||e[28]!==a||e[29]!==r?(x=b=>o.jsx(lN,{task:b,isActive:i===b.id,onClick:()=>r(b),onArchive:f&&b.created_by===l.currentUserId?()=>a(b):void 0,showAutomationBadge:!!b.trigger_id,showAgentIcon:!0},b.id),e[25]=i,e[26]=f,e[27]=l,e[28]=a,e[29]=r,e[30]=x):x=e[30],p=s.map(x),e[18]=i,e[19]=f,e[20]=l,e[21]=a,e[22]=r,e[23]=s,e[24]=p}else p=e[24];let m;e[31]!==c||e[32]!==d||e[33]!==h?(m=(c||d)&&o.jsx(cN,{onClick:h,isFetching:d}),e[31]=c,e[32]=d,e[33]=h,e[34]=m):m=e[34];let g;return e[35]!==p||e[36]!==m?(g=o.jsxs(o.Fragment,{children:[p,m]}),e[35]=p,e[36]=m,e[37]=g):g=e[37],g}function vme(t,e){return null}function yme(t,e){return t.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const _me=["archive","reclaim-worktree"],Lme=[];function wme(t){return t==="confirm"?_me:Lme}function Sme(t){const e=F.c(11),{panel:s}=t;let n;return e[0]!==s.activeTaskId||e[1]!==s.archiveTask||e[2]!==s.filters||e[3]!==s.filtersActive||e[4]!==s.groupBy||e[5]!==s.hasMore||e[6]!==s.isFetchingMore||e[7]!==s.loadMore||e[8]!==s.selectTask||e[9]!==s.threads?(n=o.jsx(bme,{threads:s.threads,groupBy:s.groupBy,activeTaskId:s.activeTaskId,onSelectTask:s.selectTask,onArchiveTask:s.archiveTask,filters:s.filters,hasMore:s.hasMore,isFetchingMore:s.isFetchingMore,onLoadMore:s.loadMore,filtersActive:s.filtersActive}),e[0]=s.activeTaskId,e[1]=s.archiveTask,e[2]=s.filters,e[3]=s.filtersActive,e[4]=s.groupBy,e[5]=s.hasMore,e[6]=s.isFetchingMore,e[7]=s.loadMore,e[8]=s.selectTask,e[9]=s.threads,e[10]=n):n=e[10],n}function kme(t){const e=F.c(83);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{onNavigate:n}=s,i=ae(),{data:r}=On.useSession(),a=r?.user?.id,{org:l}=Ue();let c;e[2]!==l.id?(c=ra(l.id),e[2]=l.id,e[3]=c):c=e[3];const d=c.id,h=q1e(),{threads:u,hasMore:f,isFetchingMore:p,fetchNextPage:m}=s9(),g=u.filter(Vme),{hide:x,setScope:b}=Ju(),v=Ks(),L=us(),{setTaskId:_,createNewTask:y}=oa(),w=I8(),S=l0();let k;e[4]!==S||e[5]!==u||e[6]!==w?(k=HP({routeAgentId:w,threadVirtualMcpId:u.find(pe=>pe.id===S)?.virtual_mcp_id}),e[4]=S,e[5]=u,e[6]=w,e[7]=k):k=e[7];const j=k;let C;e[8]!==n?(C=()=>{n?.()},e[8]=n,e[9]=C):C=e[9];const V=C,N=[...g].sort(Nme),[A,P]=T.useState("all"),[R,E]=T.useState("flat"),[I,D]=qf("sidebar-threads-scope-all",!1),[O,B]=T.useState(!1),[M,z]=T.useState(!1);let $;e[10]!==B?($=()=>{qe("tasks_panel_search_opened"),z(!0),B(!0)},e[10]=B,e[11]=$):$=e[11];const U=$,[H,W]=T.useState(null),K=a??null;let G;e[12]!==K||e[13]!==A?(G={type:A,member:"mine",currentUserId:K},e[12]=K,e[13]=A,e[14]=G):G=e[14];const Y=G,Z={};I||(Z.created_by="me"),b(Z);let te;e[15]!==a?(te=pe=>a?pe.filter(ke=>ke.created_by===a):[],e[15]=a,e[16]=te):te=e[16];const X=te;let ee;e[17]!==A?(ee=pe=>A==="automation"?pe.filter(Cme):A==="manual"?pe.filter(jme):pe,e[17]=A,e[18]=ee):ee=e[18];const J=ee,Q=W1e(J(I?N:X(N)),S);let oe;e[19]!==S||e[20]!==V||e[21]!==a||e[22]!==x||e[23]!==v||e[24]!==l.slug||e[25]!==_||e[26]!==Q?(oe=pe=>{const ke=pe.id===S,Te=x(pe.id);if(PT(pe.id),!ke)return Te;const we=Z1e(Q,pe.id,a);return V(),we?_(we.id,we.virtual_mcp_id):v({to:"/$org",params:{org:l.slug}}),Te},e[19]=S,e[20]=V,e[21]=a,e[22]=x,e[23]=v,e[24]=l.slug,e[25]=_,e[26]=Q,e[27]=oe):oe=e[27];const le=oe;let de;e[28]!==L||e[29]!==i?(de=async pe=>{try{await L.call("SANDBOX_DELETE",{virtualMcpId:pe.virtualMcpId,branch:pe.branch,removeWorktree:!0})}catch{ye.error(i("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:pe.branch}))}},e[28]=L,e[29]=i,e[30]=de):de=e[30];const se=de;let ie;e[31]!==u||e[32]!==le||e[33]!==a||e[34]!==W?(ie=pe=>{if(a&&pe.created_by&&pe.created_by!==a)return;const ke=vme();if(!ke||yme(u,ke)){le(pe);return}W({task:pe,target:ke})},e[31]=u,e[32]=le,e[33]=a,e[34]=W,e[35]=ie):ie=e[35];const he=ie;let ue;e[36]!==le||e[37]!==H||e[38]!==se||e[39]!==W?(ue=pe=>{const ke=H;ke&&(W(null),(async()=>{for(const Te of wme(pe))if(Te==="archive")try{await le(ke.task)}catch{return}else await se(ke.target)})())},e[36]=le,e[37]=H,e[38]=se,e[39]=W,e[40]=ue):ue=e[40];const ce=ue;let ne;e[41]!==V||e[42]!==_?(ne=pe=>{V(),_(pe.id,pe.virtual_mcp_id)},e[41]=V,e[42]=_,e[43]=ne):ne=e[43];const q=ne;let fe;e[44]!==j||e[45]!==S||e[46]!==u||e[47]!==V||e[48]!==y||e[49]!==a||e[50]!==d||e[51]!==h||e[52]!==_?(fe=()=>{const pe=j??d;qe("sidebar_new_thread_clicked",{virtual_mcp_id:pe}),V();const ke=BP(u,pe,a,h(pe));if(ke){_(ke.id,ke.virtual_mcp_id);return}const Te=u.find(we=>we.id===S)?.branch??null;y(pe,Te)},e[44]=j,e[45]=S,e[46]=u,e[47]=V,e[48]=y,e[49]=a,e[50]=d,e[51]=h,e[52]=_,e[53]=fe):fe=e[53];const ge=fe;let _e;e[54]!==m?(_e=()=>{m()},e[54]=m,e[55]=_e):_e=e[55];const Le=R!=="flat"||A!=="all"||I;let je;e[56]!==ce||e[57]!==H?(je=H?o.jsx(J1e,{branch:H.target.branch,onOutcome:ce}):null,e[56]=ce,e[57]=H,e[58]=je):je=e[58];let Ce;e[59]!==M||e[60]!==O||e[61]!==B?(Ce=M?o.jsx(Q1e,{open:O,onOpenChange:B}):null,e[59]=M,e[60]=O,e[61]=B,e[62]=Ce):Ce=e[62];let Pe;return e[63]!==S||e[64]!==he||e[65]!==Y||e[66]!==R||e[67]!==f||e[68]!==p||e[69]!==ge||e[70]!==U||e[71]!==q||e[72]!==E||e[73]!==D||e[74]!==P||e[75]!==I||e[76]!==_e||e[77]!==Le||e[78]!==je||e[79]!==Ce||e[80]!==A||e[81]!==Q?(Pe={threads:Q,activeTaskId:S,filters:Y,hasMore:f,isFetchingMore:p,loadMore:_e,groupBy:R,setGroupBy:E,typeFilter:A,setTypeFilter:P,showAll:I,setShowAll:D,filtersActive:Le,selectTask:q,archiveTask:he,newThread:ge,openSearch:U,reclaimDialog:je,searchDialog:Ce},e[63]=S,e[64]=he,e[65]=Y,e[66]=R,e[67]=f,e[68]=p,e[69]=ge,e[70]=U,e[71]=q,e[72]=E,e[73]=D,e[74]=P,e[75]=I,e[76]=_e,e[77]=Le,e[78]=je,e[79]=Ce,e[80]=A,e[81]=Q,e[82]=Pe):Pe=e[82],Pe}function jme(t){return!t.trigger_id}function Cme(t){return!!t.trigger_id}function Nme(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function Vme(t){return!t.hidden}function Tme(){const t=F.c(60),e=ae(),[s,n]=T.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={onNavigate:()=>n(!1)},t[0]=i):i=t[0];const r=kme(i),a=Ts()?.activeTask;let l;t[1]!==a?.title||t[2]!==r.activeTaskId||t[3]!==r.threads||t[4]!==e?(l=a?.title||r.threads.find(D=>D.id===r.activeTaskId)?.title||e("tasksPanel.taskRow.untitledTask"),t[1]=a?.title,t[2]=r.activeTaskId,t[3]=r.threads,t[4]=e,t[5]=l):l=t[5];const c=l;let d;t[6]!==r?(d=()=>{n(!1),r.openSearch()},t[6]=r,t[7]=d):d=t[7];const h=d;let u;t[8]!==e?(u=e("chat.threadsMenu.chats"),t[8]=e,t[9]=u):u=t[9];const f=s&&"bg-sidebar-accent";let p;t[10]!==f?(p=re("flex h-[34px] min-w-0 shrink items-center gap-1.5 rounded-lg px-2 text-sm text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",f),t[10]=f,t[11]=p):p=t[11];let m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(t8,{size:16,className:"shrink-0"}),t[12]=m):m=t[12];let g;t[13]!==c?(g=o.jsx("span",{className:"truncate max-w-[10rem] font-medium",children:c}),t[13]=c,t[14]=g):g=t[14];let x;t[15]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(hs,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[15]=x):x=t[15];let b;t[16]!==u||t[17]!==p||t[18]!==g?(b=o.jsx(He,{asChild:!0,children:o.jsx(ws,{asChild:!0,children:o.jsxs("button",{type:"button","aria-label":u,className:p,children:[m,g,x]})})}),t[16]=u,t[17]=p,t[18]=g,t[19]=b):b=t[19];let v;t[20]!==e?(v=e("chat.threadsMenu.chats"),t[20]=e,t[21]=v):v=t[21];let L;t[22]!==v?(L=o.jsx(Ke,{side:"bottom",children:v}),t[22]=v,t[23]=L):L=t[23];let _;t[24]!==L||t[25]!==b?(_=o.jsxs(We,{children:[b,L]}),t[24]=L,t[25]=b,t[26]=_):_=t[26];let y;t[27]!==r?(y=o.jsx(K1e,{panel:r,className:"size-8 rounded-lg"}),t[27]=r,t[28]=y):y=t[28];let w;t[29]!==e?(w=e("sidebar.taskGroupsList.searchChats"),t[29]=e,t[30]=w):w=t[30];let S;t[31]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(sg,{size:16}),t[31]=S):S=t[31];let k;t[32]!==h||t[33]!==w?(k=o.jsx($o,{"aria-label":w,onClick:h,className:"size-8 rounded-lg",children:S}),t[32]=h,t[33]=w,t[34]=k):k=t[34];let j;t[35]!==e?(j=e("sidebar.taskGroupsList.newChat"),t[35]=e,t[36]=j):j=t[36];let C;t[37]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Zu,{size:16}),t[37]=C):C=t[37];let V;t[38]!==r.newThread||t[39]!==j?(V=o.jsx($o,{"aria-label":j,onClick:r.newThread,className:"size-8 rounded-lg",children:C}),t[38]=r.newThread,t[39]=j,t[40]=V):V=t[40];let N;t[41]!==k||t[42]!==V?(N=o.jsxs("div",{className:"flex items-center gap-0.5",children:[k,V]}),t[41]=k,t[42]=V,t[43]=N):N=t[43];let A;t[44]!==y||t[45]!==N?(A=o.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[y,N]}),t[44]=y,t[45]=N,t[46]=A):A=t[46];let P;t[47]!==r?(P=o.jsx("div",{className:"flex max-h-[60vh] min-h-0 flex-col gap-0.5 overflow-y-auto overscroll-contain",children:o.jsx(Sme,{panel:r})}),t[47]=r,t[48]=P):P=t[48];let R;t[49]!==A||t[50]!==P?(R=o.jsxs(ks,{align:"start",side:"bottom",onOpenAutoFocus:Ame,className:"flex w-80 flex-col gap-2 p-2",children:[A,P]}),t[49]=A,t[50]=P,t[51]=R):R=t[51];let E;t[52]!==s||t[53]!==_||t[54]!==R?(E=o.jsxs(js,{open:s,onOpenChange:n,children:[_,R]}),t[52]=s,t[53]=_,t[54]=R,t[55]=E):E=t[55];let I;return t[56]!==r.reclaimDialog||t[57]!==r.searchDialog||t[58]!==E?(I=o.jsxs(o.Fragment,{children:[E,r.searchDialog,r.reclaimDialog]}),t[56]=r.reclaimDialog,t[57]=r.searchDialog,t[58]=E,t[59]=I):I=t[59],I}function Ame(t){return t.preventDefault()}function fN(t){const e=F.c(4),{chatContent:s}=t;let n;e[0]!==s?(n=s??o.jsx(V_,{}),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=o.jsx("div",{"data-testid":"chat-panel",className:"h-full min-h-0",children:n}),e[2]=n,e[3]=i):i=e[3],i}function Nm(t){const e=F.c(25),{side:s,open:n,disabled:i,onToggle:r}=t,a=ae();let l;e[0]!==n||e[1]!==s||e[2]!==a?(l=a(n?s==="left"?"agentShellLayout.toggleButtons.hideChat":"agentShellLayout.toggleButtons.hidePanel":s==="left"?"agentShellLayout.toggleButtons.showChat":"agentShellLayout.toggleButtons.showPanel"),e[0]=n,e[1]=s,e[2]=a,e[3]=l):l=e[3];const c=l;let d;e[4]!==r||e[5]!==n||e[6]!==s?(d=()=>{qe("agent_toolbar_toggled",{button:s==="left"?"chat":"main",next_state:n?"closed":"open"}),r()},e[4]=r,e[5]=n,e[6]=s,e[7]=d):d=e[7];const h=d;if(s==="left"){let g,x;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=re("flex h-10 md:h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-sm disabled:opacity-40",v7()),x=o.jsx(ng,{size:16}),e[8]=g,e[9]=x):(g=e[8],x=e[9]);let b;return e[10]!==i||e[11]!==c||e[12]!==h||e[13]!==g?(b=o.jsxs("button",{type:"button",disabled:i,onClick:h,className:g,children:[x,c]}),e[10]=i,e[11]=c,e[12]=h,e[13]=g,e[14]=b):b=e[14],b}let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(CA,{size:16}),e[15]=u):u=e[15];let f;e[16]!==i||e[17]!==c||e[18]!==h?(f=o.jsx(He,{asChild:!0,children:o.jsx($o,{"aria-label":c,disabled:i,onClick:h,className:"size-7 rounded-md disabled:opacity-40",children:u})}),e[16]=i,e[17]=c,e[18]=h,e[19]=f):f=e[19];let p;e[20]!==c?(p=o.jsx(Ke,{side:"bottom",children:c}),e[20]=c,e[21]=p):p=e[21];let m;return e[22]!==f||e[23]!==p?(m=o.jsxs(We,{children:[f,p]}),e[22]=f,e[23]=p,e[24]=m):m=e[24],m}const Vm="workspace-side-panel",r6="workspace-main-panel";function o6(t){const e=F.c(7),{children:s,header:n,testId:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=re("min-h-0 flex-1 overflow-hidden rounded-[0.75rem] bg-background card-shadow [transform:translateZ(0)]","flex flex-col"),e[0]=r):r=e[0];let a;e[1]!==s?(a=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s}),e[1]=s,e[2]=a):a=e[2];let l;return e[3]!==n||e[4]!==a||e[5]!==i?(l=o.jsx("div",{className:"flex h-full min-h-0 flex-col p-0.5",children:o.jsxs("div",{"data-testid":i,className:r,children:[n,a]})}),e[3]=n,e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Pme(t){const e=F.c(4),{virtualMcpId:s,taskId:n,disableActiveMainToggle:i}=t;let r;return e[0]!==i||e[1]!==n||e[2]!==s?(r=o.jsx(r9e,{virtualMcpId:s,taskId:n,disableActiveMainToggle:i}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3],r}function Eme(t){const e=F.c(80),{virtualMcpId:s,taskId:n,entity:i,sidePanelOpen:r,mainOpen:a,toggleSidePanel:l,toggleMain:c,chatContent:d}=t,[h,u]=QB(),f=T.useRef(null);let p;e[0]!==a||e[1]!==r?(p=iB({sidePanelOpen:r,mainOpen:a}),e[0]=a,e[1]=r,e[2]=p):p=e[2];const m=p,g=r&&a?h:m.side,x=100-g;let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(U1e,{}),e[3]=b):b=e[3];const v=b;let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Tme,{}),e[4]=L):L=e[4];const _=L;let y;e[5]!==i?(y=o.jsx(N1e,{virtualMcp:i}),e[5]=i,e[6]=y):y=e[6];const w=y,S=Ts()?.currentBranch??null,k=R8(i.metadata?.ui?.layout??null);let j;e[7]!==k||e[8]!==S||e[9]!==i?(j=Cg(k)?o.jsx(F1e,{virtualMcp:i,currentBranch:S}):null,e[7]=k,e[8]=S,e[9]=i,e[10]=j):j=e[10];const C=j;let V,N;e[11]!==x||e[12]!==g?(V=()=>{f.current?.setLayout({[Vm]:g,[r6]:x})},N=[g,x],e[11]=x,e[12]=g,e[13]=V,e[14]=N):(V=e[13],N=e[14]),T.useEffect(V,N);let A;e[15]!==a||e[16]!==r||e[17]!==c?(A=!a&&o.jsx(Nm,{side:"right",open:a,disabled:!r,onToggle:c}),e[15]=a,e[16]=r,e[17]=c,e[18]=A):A=e[18];let P;e[19]!==A?(P=o.jsxs(Tb,{children:[_,o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[v,A]})]}),e[19]=A,e[20]=P):P=e[20];const R=P,E=!a;let I;e[21]!==r||e[22]!==E||e[23]!==l?(I=o.jsx(Nm,{side:"left",open:r,disabled:E,onToggle:l}),e[21]=r,e[22]=E,e[23]=l,e[24]=I):I=e[24];const D=!r;let O;e[25]!==D||e[26]!==n||e[27]!==s?(O=o.jsx(Pme,{virtualMcpId:s,taskId:n,disableActiveMainToggle:D}),e[25]=D,e[26]=n,e[27]=s,e[28]=O):O=e[28];let B;e[29]!==I||e[30]!==O?(B=o.jsxs("div",{className:"flex min-w-0 shrink items-center gap-0.5 overflow-hidden",children:[I,O]}),e[29]=I,e[30]=O,e[31]=B):B=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-center",children:o.jsx(qZ,{className:"@max-sm/panel-header:hidden"})}),e[32]=M):M=e[32];let z;e[33]!==C?(z=o.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:C}),e[33]=C,e[34]=z):z=e[34];const $=!r;let U;e[35]!==a||e[36]!==$||e[37]!==c?(U=o.jsx(Nm,{side:"right",open:a,disabled:$,onToggle:c}),e[35]=a,e[36]=$,e[37]=c,e[38]=U):U=e[38];let H;e[39]!==w||e[40]!==U?(H=o.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-1",children:[w,U]}),e[39]=w,e[40]=U,e[41]=H):H=e[41];let W;e[42]!==z||e[43]!==H?(W=o.jsxs("div",{className:"flex min-w-0 shrink items-center justify-end gap-1",children:[z,H]}),e[42]=z,e[43]=H,e[44]=W):W=e[44];let K;e[45]!==B||e[46]!==W?(K=o.jsxs(Tb,{className:"justify-between gap-2",children:[B,M,W]}),e[45]=B,e[46]=W,e[47]=K):K=e[47];const G=K,Y=`${s}-${n}`;let Z,te;e[48]===Symbol.for("react.memo_cache_sentinel")?(Z=re("flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-workspace-panel-open]]:!min-w-[320px]"),te={overflow:"visible"},e[48]=Z,e[49]=te):(Z=e[48],te=e[49]);let X;e[50]!==a||e[51]!==u||e[52]!==r?(X=(ge,_e)=>{const{isUserInteraction:Le}=_e,je=ge[Vm];Le&&r&&a&&typeof je=="number"&&je>0&&je<100&&u(je)},e[50]=a,e[51]=u,e[52]=r,e[53]=X):X=e[53];const ee=`${m.side}%`,J=r?"":void 0,Q=r?R:null;let oe;e[54]!==d||e[55]!==r?(oe=r&&o.jsx(fN,{chatContent:d}),e[54]=d,e[55]=r,e[56]=oe):oe=e[56];let le;e[57]!==Q||e[58]!==oe?(le=o.jsx(o6,{testId:"side-panel",header:Q,children:oe}),e[57]=Q,e[58]=oe,e[59]=le):le=e[59];let de;e[60]!==ee||e[61]!==J||e[62]!==le?(de=o.jsx(Ac,{id:Vm,defaultSize:ee,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":J,className:"min-w-0 overflow-hidden bg-sidebar",children:le}),e[60]=ee,e[61]=J,e[62]=le,e[63]=de):de=e[63];let se;e[64]===Symbol.for("react.memo_cache_sentinel")?(se=o.jsx(ip,{className:"bg-sidebar"}),e[64]=se):se=e[64];const ie=`${m.main}%`,he=a?"":void 0,ue=a?G:null;let ce;e[65]!==n||e[66]!==s?(ce=o.jsx(IC,{taskId:n,virtualMcpId:s}),e[65]=n,e[66]=s,e[67]=ce):ce=e[67];let ne;e[68]!==ue||e[69]!==ce?(ne=o.jsx(o6,{testId:"main-panel",header:ue,children:ce}),e[68]=ue,e[69]=ce,e[70]=ne):ne=e[70];let q;e[71]!==ie||e[72]!==he||e[73]!==ne?(q=o.jsx(Ac,{id:r6,defaultSize:ie,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":he,className:"min-w-0 overflow-hidden bg-sidebar",children:ne}),e[71]=ie,e[72]=he,e[73]=ne,e[74]=q):q=e[74];let fe;return e[75]!==Y||e[76]!==X||e[77]!==de||e[78]!==q?(fe=o.jsx(WZ,{children:o.jsxs(np,{ref:f,orientation:"horizontal",className:Z,style:te,onLayoutChanged:X,children:[de,se,q]},Y)}),e[75]=Y,e[76]=X,e[77]=de,e[78]=q,e[79]=fe):fe=e[79],fe}const Tm="__mobile-main-panel-tab-select__",V2="main";function Rme({tabs:t,activeTab:e,mainOpen:s,t:n}){const i=t.find(a=>a.id===e),r=n("mainPanelTabs.mobileMainPanelTabSelect.mainView");return s?i?.title??r:i?.title??t[0]?.title??r}const Dme={kind:"component",Component:ng},Mme={kind:"component",Component:X2},Ime={kind:"component",Component:Qo},Ome={kind:"component",Component:zr};function $me({tabs:t,overlayEnabled:e,t:s}){return[{value:"chat",title:s("mainPanelTabs.mobileMainPanelTabSelect.chat"),icon:Dme},...t.length>0?t.map(n=>({value:n.id,title:n.title,icon:n.icon})):[{value:V2,title:s("mainPanelTabs.mobileMainPanelTabSelect.mainView"),icon:Ome}],...e?[{value:"board",title:s("mainPanelTabs.mobileMainPanelTabSelect.tasks"),icon:Mme},{value:"files",title:s("mainPanelTabs.mobileMainPanelTabSelect.library"),icon:Ime}]:[]]}function Bme(t){const e=F.c(53),{virtualMcpId:s,taskId:n}=t,i=ae(),r=Ks(),{openPanel:a}=Di();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const c=ia(l);let d;e[1]!==n||e[2]!==s?(d={virtualMcpId:s,taskId:n},e[1]=n,e[2]=s,e[3]=d):d=e[3];const{tabs:h,activeTab:u,mainOpen:f}=e3(d),{org:p}=Ue(),m=w8();let g;e[4]!==p.id?(g=Yh(p.id),e[4]=p.id,e[5]=g):g=e[5];const x=s===g;let b,v,L,_,y,w,S,k,j,C;if(e[6]!==u||e[7]!==f||e[8]!==r||e[9]!==x||e[10]!==a||e[11]!==p.id||e[12]!==c.org||e[13]!==c.taskId||e[14]!==m||e[15]!==i||e[16]!==h||e[17]!==s){_=Symbol.for("react.early_return_sentinel");e:{const A=$me({tabs:h,overlayEnabled:!!(c.org&&c.taskId),t:i}),P=f?A.find($=>$.value===u)?.value??V2:"chat",R=A.find($=>$.value===P),E=R?.title??Rme({tabs:h,activeTab:u,mainOpen:f,t:i});let I;e[28]!==r?(I=$=>{r({to:".",search:U=>({...U,...oB($)}),replace:!0})},e[28]=r,e[29]=I):I=e[29];const D=I;let O;e[30]!==x||e[31]!==a||e[32]!==p.id||e[33]!==m||e[34]!==D||e[35]!==s?(O=$=>{if($!==Tm){if(qe("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:$,source:"mobile_select"}),W8({reportsOnly:m,onReportAgent:x,tabId:$})){a($,{virtualmcpid:Yh(p.id),search:Ume});return}if($==="chat"||$===V2){D($==="chat"?"chat":"main");return}a($,{search:Fme})}},e[30]=x,e[31]=a,e[32]=p.id,e[33]=m,e[34]=D,e[35]=s,e[36]=O):O=e[36];const B=O,M=A.find($=>$.value!==P);if(A.length===2&&M){_=o.jsxs("button",{type:"button",onClick:()=>B(M.value),"aria-label":i("mainPanelTabs.mobileMainPanelTabSelect.switchTo",{name:M.title}),className:"flex h-10 min-w-0 max-w-[7.5rem] items-center gap-1.5 rounded-md px-1.5 text-xs text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:o.jsx(Ff,{icon:M.icon,className:"size-5"})}),o.jsx("span",{className:"min-w-0 truncate",children:M.title})]});break e}v=xs,j=Tm,C=B;let z;e[37]!==i?(z=i("mainPanelTabs.mobileMainPanelTabSelect.view"),e[37]=i,e[38]=z):z=e[38],L=o.jsx(bs,{"aria-label":z,className:"h-10! w-full min-w-0 max-w-[7.5rem] rounded-md border-0 bg-transparent px-1.5 text-xs shadow-none [--card-shadow:none]",children:o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[R&&o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:o.jsx(Ff,{icon:R.icon,className:"size-5"})}),o.jsx("span",{className:"min-w-0 truncate",children:E})]})}),b=vs,y="end",w="w-56",e[39]!==E?(S=o.jsx(Rt,{value:Tm,disabled:!0,hideCheck:!0,className:"hidden",children:E}),e[39]=E,e[40]=S):S=e[40],k=A.map(zme)}e[6]=u,e[7]=f,e[8]=r,e[9]=x,e[10]=a,e[11]=p.id,e[12]=c.org,e[13]=c.taskId,e[14]=m,e[15]=i,e[16]=h,e[17]=s,e[18]=b,e[19]=v,e[20]=L,e[21]=_,e[22]=y,e[23]=w,e[24]=S,e[25]=k,e[26]=j,e[27]=C}else b=e[18],v=e[19],L=e[20],_=e[21],y=e[22],w=e[23],S=e[24],k=e[25],j=e[26],C=e[27];if(_!==Symbol.for("react.early_return_sentinel"))return _;let V;e[41]!==b||e[42]!==y||e[43]!==w||e[44]!==S||e[45]!==k?(V=o.jsxs(b,{align:y,className:w,children:[S,k]}),e[41]=b,e[42]=y,e[43]=w,e[44]=S,e[45]=k,e[46]=V):V=e[46];let N;return e[47]!==v||e[48]!==L||e[49]!==V||e[50]!==j||e[51]!==C?(N=o.jsxs(v,{value:j,onValueChange:C,children:[L,V]}),e[47]=v,e[48]=L,e[49]=V,e[50]=j,e[51]=C,e[52]=N):N=e[52],N}function zme(t){return o.jsx(Rt,{value:t.value,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:o.jsx(Ff,{icon:t.icon})}),o.jsx("span",{className:"min-w-0 truncate",children:t.title})]})},t.value)}function Fme(t){return{...t,sidepanel:!1}}function Ume(t){return{...t,thread:void 0,sidepanel:!1}}function Hme(t,e,s){const n=F.c(36),i=n9(),{locator:r}=Ue(),a=T.useSyncExternalStore(i.threads.subscribe,i.threads.get),l=T.useSyncExternalStore(i.threadsStatus.subscribe,i.threadsStatus.get);let c;n[0]!==t||n[1]!==a?(c=t===null?null:a.find(y=>y.id===t&&!y.partial)??null,n[0]=t,n[1]=a,n[2]=c):c=n[2];const d=c,[h,u]=T.useState(void 0);let f;n[3]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{u(void 0)},n[3]=f):f=n[3];let p;n[4]!==t?(p=[t],n[4]=t,n[5]=p):p=n[5],T.useEffect(f,p);let m,g;n[6]!==h||n[7]!==t||n[8]!==d||n[9]!==i||n[10]!==l.kind?(m=()=>{t!==null&&(d||l.kind!=="loading"&&h===void 0&&(u("pending"),i.fetchThreadIntoSlot(t).then(y=>{u(y)})))},g=[t,d,l.kind,h,i],n[6]=h,n[7]=t,n[8]=d,n[9]=i,n[10]=l.kind,n[11]=m,n[12]=g):(m=n[11],g=n[12]),T.useEffect(m,g);let x;n[13]!==s||n[14]!==r||n[15]!==i||n[16]!==e?(x={mutationFn:async y=>i.create({id:y,virtual_mcp_id:e,...s?{branch:s}:{},...BT(sessionStorage,r,y)})},n[13]=s,n[14]=r,n[15]=i,n[16]=e,n[17]=x):x=n[17];const b=Ds(x);let v,L;if(n[18]!==b||n[19]!==h||n[20]!==t||n[21]!==d||n[22]!==l.kind?(v=()=>{t!==null&&(d||h===null&&l.kind!=="loading"&&(b.isPending||b.variables!==t&&b.mutate(t)))},L=[t,d,h,l.kind,b],n[18]=b,n[19]=h,n[20]=t,n[21]=d,n[22]=l.kind,n[23]=v,n[24]=L):(v=n[23],L=n[24]),T.useEffect(v,L),t===null){let y;return n[25]===Symbol.for("react.memo_cache_sentinel")?(y={status:"ready",task:null},n[25]=y):y=n[25],y}if(d){let y;return n[26]!==d?(y={status:"ready",task:d},n[26]=d,n[27]=y):y=n[27],y}if(h&&typeof h=="object"){let y;return n[28]!==h?(y={status:"ready",task:h},n[28]=h,n[29]=y):y=n[29],y}if(b.data){let y;return n[30]!==b.data?(y={status:"ready",task:b.data},n[30]=b.data,n[31]=y):y=n[31],y}if(b.isError){let y;return n[32]!==b.error?(y={status:"error",error:b.error},n[32]=b.error,n[33]=y):y=n[33],y}if(b.isPending||l.kind!=="loading"){let y;return n[34]===Symbol.for("react.memo_cache_sentinel")?(y={status:"creating"},n[34]=y):y=n[34],y}let _;return n[35]===Symbol.for("react.memo_cache_sentinel")?(_={status:"loading"},n[35]=_):_=n[35],_}function Kme(){const t=F.c(31);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=ia(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[1]=n):n=t[1];const i=pr(n),r=s.org;if(!r||s.taskId!==void 0)return null;let a;t[2]!==s.panel||t[3]!==i.main?(a=lV(i.main,s.panel),t[2]=s.panel,t[3]=i.main,t[4]=a):a=t[4];const l=a;if(!l)return null;if(l.to===null){let u;return t[5]!==l.search?(u=o.jsx(ei,{to:".",search:f=>({...f,...l.search}),replace:!0}),t[5]=l.search,t[6]=u):u=t[6],u}if(l.to==="/$org/agents/{-$panel}"){let u;t[7]!==r||t[8]!==l.panel?(u={org:r,panel:l.panel},t[7]=r,t[8]=l.panel,t[9]=u):u=t[9];let f;t[10]!==l.search?(f=m=>({...m,...l.search}),t[10]=l.search,t[11]=f):f=t[11];let p;return t[12]!==u||t[13]!==f?(p=o.jsx(ei,{to:"/$org/agents/{-$panel}",params:u,search:f,replace:!0}),t[12]=u,t[13]=f,t[14]=p):p=t[14],p}if(l.to==="/$org/tasks/{-$taskKey}"){let u;t[15]!==r||t[16]!==s.taskKey?(u={org:r,taskKey:s.taskKey},t[15]=r,t[16]=s.taskKey,t[17]=u):u=t[17];let f;t[18]!==l.search?(f=m=>({...m,...l.search}),t[18]=l.search,t[19]=f):f=t[19];let p;return t[20]!==u||t[21]!==f?(p=o.jsx(ei,{to:"/$org/tasks/{-$taskKey}",params:u,search:f,replace:!0}),t[20]=u,t[21]=f,t[22]=p):p=t[22],p}let c;t[23]!==r?(c={org:r},t[23]=r,t[24]=c):c=t[24];let d;t[25]!==l.search?(d=u=>({...u,...l.search}),t[25]=l.search,t[26]=d):d=t[26];let h;return t[27]!==c||t[28]!==d||t[29]!==l.to?(h=o.jsx(ei,{to:l.to,params:c,search:d,replace:!0}),t[27]=c,t[28]=d,t[29]=l.to,t[30]=h):h=t[30],h}function Wme(){const t=F.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=ia(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[1]=n):n=t[1];const i=pr(n),{org:r,taskId:a}=s;if(!r||a===void 0)return null;let l;return t[2]!==r||t[3]!==i||t[4]!==a?(l=cV({org:r,taskId:a,search:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=l):l=t[5],l}function qme(){const t=F.c(29),e=Wme();if(!e)return null;if(e.to==="/$org/agents/{-$panel}"){let i;t[0]!==e.params.org||t[1]!==e.params.panel?(i={org:e.params.org,panel:e.params.panel},t[0]=e.params.org,t[1]=e.params.panel,t[2]=i):i=t[2];let r;t[3]!==e.params.project||t[4]!==e.search?(r=()=>({...e.search,virtualmcpid:e.params.project}),t[3]=e.params.project,t[4]=e.search,t[5]=r):r=t[5];let a;return t[6]!==i||t[7]!==r?(a=o.jsx(ei,{to:"/$org/agents/{-$panel}",params:i,search:r,replace:!0}),t[6]=i,t[7]=r,t[8]=a):a=t[8],a}if(e.to==="/$org/tasks/{-$taskKey}"){let i;t[9]!==e.params.org?(i={org:e.params.org},t[9]=e.params.org,t[10]=i):i=t[10];let r;return t[11]!==i||t[12]!==e.search?(r=o.jsx(ei,{to:"/$org/tasks/{-$taskKey}",params:i,search:e.search,replace:!0}),t[11]=i,t[12]=e.search,t[13]=r):r=t[13],r}if(e.to==="/$org/reports"){let i;t[14]!==e.params.org?(i={org:e.params.org},t[14]=e.params.org,t[15]=i):i=t[15];let r;return t[16]!==i||t[17]!==e.search?(r=o.jsx(ei,{to:"/$org/reports",params:i,search:e.search,replace:!0}),t[16]=i,t[17]=e.search,t[18]=r):r=t[18],r}if(e.to==="/$org/library"){let i;t[19]!==e.params.org?(i={org:e.params.org},t[19]=e.params.org,t[20]=i):i=t[20];let r;return t[21]!==i||t[22]!==e.search?(r=o.jsx(ei,{to:"/$org/library",params:i,search:e.search,replace:!0}),t[21]=i,t[22]=e.search,t[23]=r):r=t[23],r}let s;t[24]!==e.params.org?(s={org:e.params.org},t[24]=e.params.org,t[25]=s):s=t[25];let n;return t[26]!==s||t[27]!==e.search?(n=o.jsx(ei,{to:"/$org/home",params:s,search:e.search,replace:!0}),t[26]=s,t[27]=e.search,t[28]=n):n=t[28],n}function Gme(){const t=F.c(6),e=Za(),s=Ks();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const{preview:i}=pr(n);if(!e||!i)return null;let r;t[1]!==s?(r=()=>s({to:".",search:Yme}),t[1]=s,t[2]=r):r=t[2];let a;return t[3]!==i||t[4]!==r?(a=o.jsx(Fj,{previewPath:i,onClose:r,showSeeInLibrary:!0}),t[3]=i,t[4]=r,t[5]=a):a=t[5],a}function Yme(t){const{preview:e,...s}=t;return s}const Qme=T.createContext(null);function mN(){return T.useContext(Qme)}const Vc=T.createContext(null);function ho(){return T.use(Vc)}function pN(t){const e=F.c(13),{children:s}=t,n=ae(),i=ld(),r=mN(),a=l0()!==null;let l;e[0]!==a||e[1]!==i||e[2]!==r?(l=o.jsx(V_,{}),e[0]=a,e[1]=i,e[2]=r,e[3]=l):l=e[3];const c=l;let d;e[4]!==n?(d=n("agentShellLayout.agentShellLayout.chatLoadingError"),e[4]=n,e[5]=d):d=e[5];let h;e[6]!==d?(h=o.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:d}),e[6]=d,e[7]=h):h=e[7];const u=s??c;let f;e[8]!==u?(f=o.jsx(Ci,{children:u}),e[8]=u,e[9]=f):f=e[9];let p;return e[10]!==h||e[11]!==f?(p=o.jsx(tn,{fallback:h,children:f}),e[10]=h,e[11]=f,e[12]=p):p=e[12],p}function a6(t){const e=F.c(13),{threadId:s,children:n}=t;if(ae(),mN(),s===null){let r;return e[0]!==n?(r=o.jsx(ln.ThreadlessProvider,{children:n}),e[0]=n,e[1]=r):r=e[1],r}let i;return e[10]!==n||e[11]!==s?(i=o.jsx(ln.ActiveTaskProvider,{taskId:s,children:n}),e[10]=n,e[11]=s,e[12]=i):i=e[12],i}function gN(t){const e=F.c(3),{onNewTaskRef:s,createNewTask:n}=t;let i;return e[0]!==n||e[1]!==s?(i=()=>(s.current=n,()=>{s.current=null}),e[0]=n,e[1]=s,e[2]=i):i=e[2],T.useLayoutEffect(i),null}function l6({virtualMcpId:t,hasActiveGithubRepo:e,sandboxMap:s,children:n}){const i=ae(),{currentBranch:r,activeTask:a,setCurrentTaskBranch:l}=on(),c=ld(),d="agent-sandbox",{data:h}=On.useSession(),u=h?.user?.id,f=!E6({isDesktopApp:c,harnessId:a?.harness_id}),p=xz({agentSandboxMap:s,threadSandboxMap:a?.metadata?.sandboxMap,userId:u,ownerId:a?.created_by,branch:r}),m=e||xn(a?.metadata),g=T.useRef(null),x=f&&pz({threadLoaded:!!a,isOwner:!!u&&a?.created_by===u,hasActiveGithubRepo:m,branch:r??null,attempted:g.current===(a?.id??null)});T.useEffect(()=>{!x||!a||(g.current=a.id,l(Gc(h?.user?.name||h?.user?.email?.split("@")[0])))},[x,a,h,l]);const{org:b}=Ue(),v=i0("cms_auto_fresh_branch"),L=_n(t),_=T.useRef(null),y=v&&L.resolved&&L.runtime==="cms"&&!!b?.slug&&!!r&&_.current!==(a?.id??null),S=Yt({...L$({orgSlug:b?.slug??"",virtualMcpId:t,branch:r??""}),enabled:y}).data?.lastCommitAt??null;T.useEffect(()=>{!y||!a||y$(S,Date.now())&&(_.current=a.id,l(Gc(h?.user?.name||h?.user?.email?.split("@")[0])))},[y,S,a,h,l]);const k=As(t),j=Lg(k,r),{releases:C,createRelease:V}=k9(t),A=!!u&&a?.created_by===u&&!!r&&r!==j&&!C.some(M=>M.branch===r),P=T.useRef(null);T.useEffect(()=>{!A||!r||P.current!==r&&(P.current=r,V({branch:r,name:ep(C,i("thread.branchPicker.defaultVersionName")),color:Th(C.length),createdAt:new Date().toISOString()}).catch(()=>{}))},[A,r,C,V,i]);const R=L.resolved?L.runtime:null,E=eB(t,r??void 0),D=(u&&r?AR(p?.[u]?.[r]):{})[d]??null,O=D?.previewUrl??null,B=f&&R!=="cms"&&(!!D||E);return f?R==="cms"?o.jsx(Kb,{children:n},`${t}:${r??"no-branch"}:${a?.id??""}`):o.jsx(dz,{virtualMcpId:t,branch:r??null,previewUrl:O,enabled:B,children:o.jsx(jz,{executionEnabled:f,virtualMcpId:t,branch:r??null,userId:u??null,hasActiveGithubRepo:m,vmEntry:D,threadId:a?.id??null,children:o.jsx(Kb,{children:n},`${t}:${r??"no-branch"}:${a?.id??""}`)})},a?.id??"no-thread"):o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex h-full rounded-[0.75rem] bg-background card-shadow",children:o.jsx(Ti,{image:o.jsx(vn,{size:48,className:"text-muted-foreground"}),title:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWeb"),description:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWebDescription")})})})}function Xme(t){const e=F.c(15),{entity:s,virtualMcpId:n,layout:i,onNewTaskRef:r}=t;let a;e[0]!==i.createNewTask||e[1]!==r?(a=o.jsx(gN,{onNewTaskRef:r,createNewTask:i.createNewTask}),e[0]=i.createNewTask,e[1]=r,e[2]=a):a=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(pN,{}),e[3]=l):l=e[3];let c;e[4]!==s||e[5]!==i.mainOpen||e[6]!==i.sidePanelOpen||e[7]!==i.threadId||e[8]!==i.toggleMain||e[9]!==i.toggleSidePanel||e[10]!==n?(c=o.jsx(Ci,{children:o.jsx(Eme,{virtualMcpId:n,taskId:i.threadId,entity:s,sidePanelOpen:i.sidePanelOpen,mainOpen:i.mainOpen,toggleSidePanel:i.toggleSidePanel,toggleMain:i.toggleMain,chatContent:l})}),e[4]=s,e[5]=i.mainOpen,e[6]=i.sidePanelOpen,e[7]=i.threadId,e[8]=i.toggleMain,e[9]=i.toggleSidePanel,e[10]=n,e[11]=c):c=e[11];let d;return e[12]!==a||e[13]!==c?(d=o.jsxs(o.Fragment,{children:[a,c]}),e[12]=a,e[13]=c,e[14]=d):d=e[14],d}function Jme(t){const e=F.c(19),{virtualMcpId:s,layout:n,onNewTaskRef:i}=t,r=ae();let a;e[0]!==n.mainOpen||e[1]!==n.sidePanelOpen||e[2]!==n.sidePanelParamPresent?(a=rB({visibility:{sidePanelOpen:n.sidePanelOpen,mainOpen:n.mainOpen},sidePanelParamPresent:n.sidePanelParamPresent}),e[0]=n.mainOpen,e[1]=n.sidePanelOpen,e[2]=n.sidePanelParamPresent,e[3]=a):a=e[3];const l=a;let c;e[4]!==n.threadId||e[5]!==s?(c=o.jsx(KP.Tabs,{children:o.jsx(Bme,{virtualMcpId:s,taskId:n.threadId})}),e[4]=n.threadId,e[5]=s,e[6]=c):c=e[6];let d;e[7]!==n.createNewTask||e[8]!==i?(d=o.jsx(gN,{onNewTaskRef:i,createNewTask:n.createNewTask}),e[7]=n.createNewTask,e[8]=i,e[9]=d):d=e[9];let h;e[10]!==n.threadId||e[11]!==l||e[12]!==r||e[13]!==s?(h=o.jsx(Ci,{children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:l==="main"?o.jsx(tn,{fallback:o.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:r("agentShellLayout.agentShellLayout.somethingWentWrong")}),children:o.jsx(Ci,{children:o.jsx("div",{"data-testid":"main-panel",className:"h-full",children:o.jsx(IC,{taskId:n.threadId,virtualMcpId:s})})})}):o.jsx(fN,{chatContent:o.jsx(pN,{})})})}),e[10]=n.threadId,e[11]=l,e[12]=r,e[13]=s,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==d||e[17]!==h?(u=o.jsxs(o.Fragment,{children:[c,d,h]}),e[15]=c,e[16]=d,e[17]=h,e[18]=u):u=e[18],u}function Zme(){const t=F.c(109),e=ae(),s=Za(),n=Ks(),{org:i}=Ue();FP(i.slug);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const l=ia(r).org??"",c=l0(),d=M8(),h=I8(),[u]=T.useState(epe),{data:f}=On.useSession();let p;t[1]!==f?.user?.email||t[2]!==f?.user?.name?(p=()=>Gc(f?.user?.name||f?.user?.email?.split("@")[0]),t[1]=f?.user?.email,t[2]=f?.user?.name,t[3]=p):p=t[3];const[m]=T.useState(p),g=n9(),x=T.useSyncExternalStore(g.threads.subscribe,g.threads.get),b=T.useSyncExternalStore(g.threadsStatus.subscribe,g.threadsStatus.get),v=As(d);let L;t[4]!==v?(L=v&&aa(v),t[4]=v,t[5]=L):L=t[5];const _=!!L,y=Lg(v,null),w=Hme(c,d,m);lB(w.status==="ready"?w.task:null);const S=v?.metadata?.ui?.layout??null;let k;t[6]!==S?(k=S?{defaultMainView:S.defaultMainView??null,chatDefaultOpen:S.chatDefaultOpen??null}:null,t[6]=S,t[7]=k):k=t[7];const j=k;let C;t[8]!==d?(C={virtualMcpId:d,isAgentRoute:!0},t[8]=d,t[9]=C):C=t[9];const V=aB(j,C),N=T.useRef(null);let A,P;if(t[10]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{const H=W=>{U6(W)&&W.shiftKey&&W.code==="KeyS"&&!W.repeat&&(W.preventDefault(),N.current?.())};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},P=[],t[10]=A,t[11]=P):(A=t[10],P=t[11]),T.useEffect(A,P),c===null&&h&&v){if(b.kind==="loading"){let G;t[12]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(et,{className:"size-4 mr-2"}),t[12]=G):G=t[12];let Y;t[13]!==e?(Y=e("agentShellLayout.agentShellLayout.creatingTask"),t[13]=e,t[14]=Y):Y=t[14];let Z;return t[15]!==Y?(Z=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{role:"status","aria-live":"polite",className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[G,Y]})}),t[15]=Y,t[16]=Z):Z=t[16],Z}let H;t[17]!==y||t[18]!==v.metadata||t[19]!==_||t[20]!==f?.user?.id||t[21]!==x||t[22]!==d?(H=zP(x,d,f?.user?.id,i9(v.metadata),_,{baseBranch:y}),t[17]=y,t[18]=v.metadata,t[19]=_,t[20]=f?.user?.id,t[21]=x,t[22]=d,t[23]=H):H=t[23];const K=H?.id??(_?u:null);if(K){let G;return t[24]!==K?(G=o.jsx(ei,{to:".",replace:!0,search:Y=>({...Y,thread:K})}),t[24]=K,t[25]=G):G=t[25],G}}const R=d;let E;t[26]!==v||t[27]!==d?(E={virtualMcpId:d,entity:v},t[26]=v,t[27]=d,t[28]=E):E=t[28];const I=E;if(w.status==="creating"||w.status==="loading"){let H;t[29]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(et,{className:"size-4 mr-2"}),t[29]=H):H=t[29];let W;t[30]!==e?(W=e("agentShellLayout.agentShellLayout.creatingTask"),t[30]=e,t[31]=W):W=t[31];let K;t[32]!==W?(K=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{role:"status","aria-live":"polite",className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[H,W]})}),t[32]=W,t[33]=K):K=t[33];let G;return t[34]!==I||t[35]!==K?(G=o.jsx(Vc,{value:I,children:K}),t[34]=I,t[35]=K,t[36]=G):G=t[36],G}if(w.status==="error"){let H;t[37]!==e?(H=e("agentShellLayout.agentShellLayout.taskUnavailable"),t[37]=e,t[38]=H):H=t[38];let W;t[39]!==H?(W=o.jsx("div",{className:"font-medium",children:H}),t[39]=H,t[40]=W):W=t[40];let K;t[41]!==w.error.message?(K=o.jsx("div",{className:"text-muted-foreground",children:w.error.message}),t[41]=w.error.message,t[42]=K):K=t[42];let G;t[43]!==K||t[44]!==W?(G=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{role:"alert",className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[W,K]})}),t[43]=K,t[44]=W,t[45]=G):G=t[45];let Y;return t[46]!==I||t[47]!==G?(Y=o.jsx(Vc,{value:I,children:G}),t[46]=I,t[47]=G,t[48]=Y):Y=t[48],Y}if(!v){let H;t[49]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(vn,{size:48,className:"text-muted-foreground"}),t[49]=H):H=t[49];let W;t[50]!==e?(W=e("agentShellLayout.agentShellLayout.agentNotFound"),t[50]=e,t[51]=W):W=t[51];let K;t[52]!==e||t[53]!==d?(K=e("agentShellLayout.agentShellLayout.agentNotFoundDescription",{virtualMcpId:d}),t[52]=e,t[53]=d,t[54]=K):K=t[54];let G;t[55]!==n||t[56]!==l?(G=()=>n({to:"/$org",params:{org:l}}),t[55]=n,t[56]=l,t[57]=G):G=t[57];let Y;t[58]!==e?(Y=e("agentShellLayout.agentShellLayout.goToOrgHome"),t[58]=e,t[59]=Y):Y=t[59];let Z;t[60]!==G||t[61]!==Y?(Z=o.jsx(me,{variant:"outline",onClick:G,children:Y}),t[60]=G,t[61]=Y,t[62]=Z):Z=t[62];let te;t[63]!==K||t[64]!==Z||t[65]!==W?(te=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx(Ti,{image:H,title:W,description:K,actions:Z})})}),t[63]=K,t[64]=Z,t[65]=W,t[66]=te):te=t[66];let X;return t[67]!==I||t[68]!==te?(X=o.jsx(Vc,{value:I,children:te}),t[67]=I,t[68]=te,t[69]=X):X=t[69],X}if(s){const H=w.status==="ready"?w.task:null,W=v?.metadata?.sandboxMap;let K;t[70]!==R||t[71]!==V?(K=o.jsx(Ci,{children:o.jsx(Jme,{virtualMcpId:R,layout:V,onNewTaskRef:N})}),t[70]=R,t[71]=V,t[72]=K):K=t[72];let G;t[73]!==V.providerKey||t[74]!==V.threadId||t[75]!==K?(G=o.jsx(a6,{threadId:V.threadId,children:K},V.providerKey),t[73]=V.providerKey,t[74]=V.threadId,t[75]=K,t[76]=G):G=t[76];let Y;t[77]!==_||t[78]!==G||t[79]!==W||t[80]!==d?(Y=o.jsx(l6,{virtualMcpId:d,hasActiveGithubRepo:_,sandboxMap:W,children:G}),t[77]=_,t[78]=G,t[79]=W,t[80]=d,t[81]=Y):Y=t[81];let Z;t[82]!==R||t[83]!==Y||t[84]!==H?(Z=o.jsx("div",{className:"flex flex-col flex-1 min-w-0 bg-background min-h-0",children:o.jsx(ln.Provider,{virtualMcpId:R,task:H,children:Y},R)}),t[82]=R,t[83]=Y,t[84]=H,t[85]=Z):Z=t[85];let te;return t[86]!==I||t[87]!==Z?(te=o.jsx(Vc,{value:I,children:Z}),t[86]=I,t[87]=Z,t[88]=te):te=t[88],te}const D=w.status==="ready"?w.task:null,O=v?.metadata?.sandboxMap;let B;t[89]!==v||t[90]!==V||t[91]!==d?(B=o.jsx(Ci,{children:o.jsx(Xme,{entity:v,virtualMcpId:d,layout:V,onNewTaskRef:N})}),t[89]=v,t[90]=V,t[91]=d,t[92]=B):B=t[92];let M;t[93]!==V.providerKey||t[94]!==V.threadId||t[95]!==B?(M=o.jsx(a6,{threadId:V.threadId,children:B},V.providerKey),t[93]=V.providerKey,t[94]=V.threadId,t[95]=B,t[96]=M):M=t[96];let z;t[97]!==_||t[98]!==M||t[99]!==O||t[100]!==d?(z=o.jsx(l6,{virtualMcpId:d,hasActiveGithubRepo:_,sandboxMap:O,children:M}),t[97]=_,t[98]=M,t[99]=O,t[100]=d,t[101]=z):z=t[101];let $;t[102]!==R||t[103]!==z||t[104]!==D?($=o.jsx(ln.Provider,{virtualMcpId:R,task:D,children:z},R),t[102]=R,t[103]=z,t[104]=D,t[105]=$):$=t[105];let U;return t[106]!==I||t[107]!==$?(U=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsx(Vc,{value:I,children:$})}),t[106]=I,t[107]=$,t[108]=U):U=t[108],U}function epe(){return crypto.randomUUID()}function tpe(){const t=F.c(3);let e,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(qme,{}),s=o.jsx(Kme,{}),t[0]=e,t[1]=s):(e=t[0],s=t[1]);let n;return t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsxs(Ci,{children:[e,s,o.jsxs(nE,{children:[o.jsx(Zme,{}),o.jsx(Gme,{})]})]}),t[2]=n):n=t[2],n}const spe=Object.freeze(Object.defineProperty({__proto__:null,default:tpe,useInsetContext:ho},Symbol.toStringTag,{value:"Module"}));export{f3 as $,$3e as A,B3e as B,kj as C,C3e as D,fh as E,j3e as F,z3 as G,zu as H,N3e as I,nre as J,GS as K,Mge as L,$g as M,wS as N,r3 as O,Qc as P,y0 as Q,Aq as R,Bi as S,Xt as T,_0 as U,m3 as V,Xc as W,h3 as X,KL as Y,c3 as Z,jL as _,j0 as a,nte as a$,fr as a0,Gae as a1,Qae as a2,In as a3,T3e as a4,u3 as a5,jj as a6,V3e as a7,Gge as a8,Cf as a9,w3e as aA,QS as aB,jf as aC,Mne as aD,Fge as aE,Mre as aF,x3e as aG,JS as aH,Xge as aI,L3e as aJ,k3e as aK,S3e as aL,Tre as aM,Pee as aN,Eee as aO,_3e as aP,f4 as aQ,Fk as aR,lle as aS,ed as aT,bd as aU,Uge as aV,Jge as aW,r3e as aX,hte as aY,o3e as aZ,s3e as a_,Ri as aa,Rk as ab,d3 as ac,Ck as ad,Cs as ae,i3e as af,p3e as ag,g3e as ah,wre as ai,g4 as aj,Bge as ak,ij as al,Ore as am,loe as an,z9 as ao,Q3 as ap,ho as aq,oae as ar,wf as as,jp as at,Wa as au,y3e as av,Rp as aw,cj as ax,Bre as ay,Qre as az,no as b,Qge as b0,n3e as b1,t3e as b2,e3e as b3,f3e as b4,Dee as b5,F3 as b6,qge as b7,Yge as b8,Wge as b9,I3e as bA,Rf as bB,nle as bC,O3e as bD,$ge as bE,IS as bF,wee as bG,spe as bH,m3e as ba,h4 as bb,KS as bc,HS as bd,zge as be,Ree as bf,Hge as bg,vse as bh,c3e as bi,d3e as bj,Zge as bk,l3e as bl,a3e as bm,u3e as bn,zre as bo,x4 as bp,v3e as bq,ooe as br,b3e as bs,P3e as bt,E3e as bu,D3e as bv,Ra as bw,M3e as bx,R3e as by,A3e as bz,Sf as c,n4 as d,V0 as e,$c as f,kn as g,h3e as h,r4 as i,Toe as j,Ige as k,yf as l,Oge as m,wae as n,Kge as o,_n as p,Kee as q,rae as r,rN as s,ale as t,la as u,Wee as v,Xd as w,wj as x,Sc as y,kv as z};
834
+ `),fallbackTitle:e})}function $4(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function B4(t){return t.fastPreview?{fastPreview:!0}:void 0}async function km(t,e,s){try{return await s()}catch(n){throw new O4(n instanceof Error?n.message:e,t)}}async function XC(t){const e=t.expectedHeadSha;if(!e)return;const n=(await $c($4(t),B4(t)).catch(()=>null))?.headSha;if(n&&n!==e)throw new YC(e,n)}function JC(t,e){return EJ($4(t),e,B4(t))}function ZC(t,e){return E9e(t.orgSlug,t.target,{branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor})}async function eN(t,e,s){await XC(t),await km("push",s("thread.publishDialog.failedPushChanges"),()=>JC(t,e.message)),await km("sync",s("thread.publishDialog.failedRebase"),()=>sS($4(t),t.baseBranch,B4(t)));const n=await km("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>ZC(t,e));try{await GC(t.orgSlug,t.target,{number:n.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(i){throw new O4(i instanceof Error?i.message:s("thread.publishDialog.failedMergePullRequest"),"merge",n)}return n}async function tN(t,e){return await XC(t),await JC(t,e.message),ZC(t,e)}function M9e(t,e){return t instanceof YC?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof O4&&t.step==="merge"&&t.pr?{message:e("thread.publishDialog.mergeFailed",{prNumber:t.pr.number,message:t.message}),pullRequest:t.pr,headMoved:!1}:{message:t instanceof Error?t.message:e("thread.publishDialog.failedPublish"),pullRequest:null,headMoved:!1}}function j2(t,e){const s=M9e(t,e),n=s.pullRequest;return n&&ye.error(s.message,{action:{label:e("thread.publishDialog.viewPr"),onClick:()=>window.open(n.htmlUrl,"_blank","noopener,noreferrer")}}),{message:s.message,pullRequestOpened:n!==null,headMoved:s.headMoved}}function sN(t,e){ye.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnGithub"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function I9e(t){const{mode:e,target:s,note:n,allPaths:i,destinationHost:r,publishLockRef:a,onOpenChange:l,refresh:c,onPullRequestChanged:d,onPublished:h}=t,u=ae(),[f,p]=T.useState(!1),[m,g]=T.useState(!1),[x,b]=T.useState(),v=()=>D9e(n,u("thread.publishDialog.changesFrom",{branch:s.headBranch})),L=async()=>{a.current=!0,p(!0),b(void 0);try{await eN(s,v(),u),ye.success(r?u("thread.publishPopover.publishedTo",{host:r}):u("thread.publishDialog.publishedTo",{baseBranch:s.baseBranch})),l(!1),await Promise.all([d?.(),h?.()])}catch(w){const S=j2(w,u);b(S.message),S.pullRequestOpened&&await d?.(),S.headMoved&&await c()}finally{a.current=!1,p(!1)}},_=async()=>{a.current=!0,p(!0),b(void 0);try{const w=await tN(s,v());sN(w,u),l(!1),await d?.()}catch(w){const S=j2(w,u);b(S.message||u("thread.publishDialog.failedSubmitForReview")),S.headMoved&&await c()}finally{a.current=!1,p(!1)}},y=async(w,S)=>{g(!0);try{await Lp({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},w,{fastPreview:!0}),ye.success(S),await c()}catch(k){ye.error(k instanceof Error?k.message:u("thread.publishPopover.failedDiscard"))}finally{g(!1)}};return{isPublishing:f,isDiscarding:m,publishError:x,submit:e==="review"?_:L,discardChange:w=>y(w.filepaths,u("thread.publishPopover.discarded",{name:w.name})),discardAll:async()=>{i.length!==0&&await y(i,u("thread.publishDialog.allChangesDiscarded"))}}}function O9e(t,e,s,n,i){return["cms-publish-bodies",t,e,s,n,i]}const $9e=6e4;function B9e(t,e,s){const n=F.c(6);let i;n[0]!==s||n[1]!==t||n[2]!==e?(i=tt.decofile(`${t}/${e}/${s}`),n[0]=s,n[1]=t,n[2]=e,n[3]=i):i=n[3];let r;n[4]!==i?(r={queryKey:i,queryFn:aV},n[4]=i,n[5]=r):r=n[5];const{data:a}=Yt(r);return a}function z9e(t){const e=F.c(43),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,baseBranch:a}=t;let l,c,d,h;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c={orgSlug:s,virtualMcpId:n,branch:i,threadId:r},l={fastPreview:!0},d=Wf,h=aS(c,l),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=l,e[5]=c,e[6]=d,e[7]=h):(l=e[4],c=e[5],d=e[6],h=e[7]);const u=d(h),f=u.data,p=f.changedFiles??null,m=f.headSha??null,g=p?p.length>0:(f.aheadOfBase??0)>0;let x;e[8]!==a||e[9]!==i||e[10]!==m||e[11]!==s||e[12]!==n?(x=O9e(s,n,i,a,m),e[8]=a,e[9]=i,e[10]=m,e[11]=s,e[12]=n,e[13]=x):x=e[13];let b;e[14]!==a||e[15]!==l||e[16]!==c?(b=()=>hu(c,{base:a},l),e[14]=a,e[15]=l,e[16]=c,e[17]=b):b=e[17];let v;e[18]!==x||e[19]!==b||e[20]!==g?(v={queryKey:x,queryFn:b,enabled:g,staleTime:$9e},e[18]=x,e[19]=b,e[20]=g,e[21]=v):v=e[21];const L=Yt(v),_=B9e(s,n,i),y=L.data??null;let w;e[22]!==_||e[23]!==y||e[24]!==p?(w=p?KC({files:p,lookup:_,diff:y}):m9e(y),e[22]=_,e[23]=y,e[24]=p,e[25]=w):w=e[25];const S=w;let k;e[26]!==y?.diffs||e[27]!==p?(k=p?p.map(F9e):Object.keys(y?.diffs??{}),e[26]=y?.diffs,e[27]=p,e[28]=k):k=e[28];const j=f.changedFilesTotal??S.count,C=f.changedFilesTruncated??!1,V=g&&L.isPending,N=!p&&g&&L.isPending;let A;e[29]!==u?(A=()=>u.refetch(),e[29]=u,e[30]=A):A=e[30];let P;return e[31]!==L.isError||e[32]!==y||e[33]!==m||e[34]!==f||e[35]!==S||e[36]!==N||e[37]!==A||e[38]!==k||e[39]!==j||e[40]!==C||e[41]!==V?(P={status:f,summary:S,allPaths:k,changedFilesTotal:j,changedFilesTruncated:C,headSha:m,diff:y,bodiesPending:V,bodiesFailed:L.isError,cardsPending:N,refresh:A},e[31]=L.isError,e[32]=y,e[33]=m,e[34]=f,e[35]=S,e[36]=N,e[37]=A,e[38]=k,e[39]=j,e[40]=C,e[41]=V,e[42]=P):P=e[42],P}function F9e(t){return t.path}function U9e(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function H9e(t){const e=F.c(28),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:a,status:l,diff:c,enabled:d}=t,[h]=ro(),{language:u}=h;let f,p,m;if(e[0]!==i||e[1]!==c||e[2]!==d||e[3]!==a||e[4]!==u||e[5]!==s||e[6]!==l||e[7]!==r||e[8]!==n){const y=c?MJ(c):"";f=d&&!!i&&!!l&&!!c&&y!=="",m=Yt,p=U9e({orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:a,signature:y,language:u}),e[0]=i,e[1]=c,e[2]=d,e[3]=a,e[4]=u,e[5]=s,e[6]=l,e[7]=r,e[8]=n,e[9]=f,e[10]=p,e[11]=m}else f=e[9],p=e[10],m=e[11];let g;e[12]!==i||e[13]!==c||e[14]!==a||e[15]!==u||e[16]!==s||e[17]!==l||e[18]!==r||e[19]!==n?(g=()=>IJ({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},{status:l,diff:c,language:u},a?{fastPreview:!0}:void 0),e[12]=i,e[13]=c,e[14]=a,e[15]=u,e[16]=s,e[17]=l,e[18]=r,e[19]=n,e[20]=g):g=e[20];let x;e[21]!==f||e[22]!==p||e[23]!==g?(x={queryKey:p,queryFn:g,enabled:f,staleTime:1/0,gcTime:6e5,retry:K9e},e[21]=f,e[22]=p,e[23]=g,e[24]=x):x=e[24];const b=m(x),v=b.data??null,L=f&&b.isFetching&&!b.data;let _;return e[25]!==v||e[26]!==L?(_={verdict:v,loading:L},e[25]=v,e[26]=L,e[27]=_):_=e[27],_}function K9e(t,e){return!eS(e)&&t<1}function nN(t){const e=F.c(30),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:a,status:l,diff:c,policy:d,judgeEnabled:h,paths:u}=t,f=h===void 0?!0:h,p=u===void 0?null:u;let m;e[0]!==c||e[1]!==f||e[2]!==d?(m=f&&KJ(c,d),e[0]=c,e[1]=f,e[2]=d,e[3]=m):m=e[3];const g=m;let x;e[4]!==i||e[5]!==c||e[6]!==a||e[7]!==g||e[8]!==s||e[9]!==l||e[10]!==r||e[11]!==n?(x={orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:a,status:l,diff:c,enabled:g},e[4]=i,e[5]=c,e[6]=a,e[7]=g,e[8]=s,e[9]=l,e[10]=r,e[11]=n,e[12]=x):x=e[12];const{verdict:b,loading:v}=H9e(x);if(!c&&p){let w;e[13]!==p||e[14]!==d?(w=HJ(p,d),e[13]=p,e[14]=d,e[15]=w):w=e[15];let S;return e[16]!==w?(S={gate:w,ready:!1},e[16]=w,e[17]=S):S=e[17],S}if(!c){let w;return e[18]===Symbol.for("react.memo_cache_sentinel")?(w={gate:{allowed:!0,reason:null},ready:!1},e[18]=w):w=e[18],w}if(!g){let w;e[19]!==c||e[20]!==d?(w=UJ(c,d),e[19]=c,e[20]=d,e[21]=w):w=e[21];let S;return e[22]!==w?(S={gate:w,ready:!0},e[22]=w,e[23]=S):S=e[23],S}let L;e[24]!==v||e[25]!==b?(L=WJ(b,v),e[24]=v,e[25]=b,e[26]=L):L=e[26];const _=!v;let y;return e[27]!==L||e[28]!==_?(y={gate:L,ready:_},e[27]=L,e[28]=_,e[29]=y):y=e[29],y}const iN="(max-width: 479px)";function W9e(t){const e=globalThis.matchMedia(iN);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function q9e(){return T.useSyncExternalStore(W9e,Y9e,G9e)}function G9e(){return!1}function Y9e(){return globalThis.matchMedia(iN).matches}function Q9e(t){const e=F.c(22),s=q9e(),n=T.useRef(!1);let i;e[0]!==t?(i=d=>{!d&&n.current||t.onOpenChange(d)},e[0]=t,e[1]=i):i=e[1];const r=i;if(s){let d;e[2]!==t?(d=t.open?o.jsx(Uy,{...t,publishLockRef:n}):null,e[2]=t,e[3]=d):d=e[3];let h;e[4]!==d?(h=o.jsx(zt,{className:"flex max-h-[85vh] w-[92vw] max-w-[420px] flex-col gap-0 overflow-hidden p-0",children:d}),e[4]=d,e[5]=h):h=e[5];let u;e[6]!==r||e[7]!==t.open||e[8]!==h?(u=o.jsx(Ft,{open:t.open,onOpenChange:r,children:h}),e[6]=r,e[7]=t.open,e[8]=h,e[9]=u):u=e[9];let f;return e[10]!==t.children||e[11]!==u?(f=o.jsxs(o.Fragment,{children:[t.children,u]}),e[10]=t.children,e[11]=u,e[12]=f):f=e[12],f}let a;e[13]!==t.children?(a=o.jsx(vP,{asChild:!0,children:o.jsx("span",{className:"inline-flex",children:t.children})}),e[13]=t.children,e[14]=a):a=e[14];let l;e[15]!==t?(l=o.jsx(ks,{align:"end",sideOffset:8,collisionPadding:12,onFocusOutside:X9e,className:"flex max-h-[min(720px,85vh)] w-[420px] flex-col gap-0 overflow-hidden p-0",children:o.jsx(Uy,{...t,publishLockRef:n})}),e[15]=t,e[16]=l):l=e[16];let c;return e[17]!==r||e[18]!==t.open||e[19]!==a||e[20]!==l?(c=o.jsxs(js,{open:t.open,onOpenChange:r,children:[a,l]}),e[17]=r,e[18]=t.open,e[19]=a,e[20]=l,e[21]=c):c=e[21],c}function X9e(t){return t.preventDefault()}function z4(t){const e=F.c(11),{mode:s,title:n,subLine:i,trailing:r}=t,a=s==="review"?Fo:jn;let l;e[0]!==a?(l=o.jsx(a,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==l||e[3]!==n||e[4]!==r?(c=o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[l,n,r]}),e[2]=l,e[3]=n,e[4]=r,e[5]=c):c=e[5];let d;e[6]!==i?(d=i?o.jsx("div",{className:"pl-6 text-xs text-muted-foreground",children:i}):null,e[6]=i,e[7]=d):d=e[7];let h;return e[8]!==c||e[9]!==d?(h=o.jsxs(o.Fragment,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=h):h=e[10],h}function F4(t){const e=F.c(9),{draftPreviewUrl:s,t:n}=t;let i;e[0]!==s?(i=()=>{s&&window.open(s,"_blank","noopener,noreferrer")},e[0]=s,e[1]=i):i=e[1];const r=!s;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(h0,{className:"size-4"}),e[2]=a):a=e[2];let l;e[3]!==n?(l=n("thread.publishPopover.preview"),e[3]=n,e[4]=l):l=e[4];let c;return e[5]!==i||e[6]!==r||e[7]!==l?(c=o.jsxs(me,{type:"button",variant:"outline",onClick:i,disabled:r,children:[a,l]}),e[5]=i,e[6]=r,e[7]=l,e[8]=c):c=e[8],c}function J9e(t){const e=F.c(20),{mode:s,draftPreviewUrl:n}=t,i=ae();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx($r,{className:"h-3.5 w-48"}),e[0]=r):r=e[0];let a;e[1]!==s?(a=o.jsx(z4,{mode:s,title:r}),e[1]=s,e[2]=a):a=e[2];let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(w2,{children:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Lu,{}),o.jsx(Lu,{}),o.jsx(Lu,{})]})}),c=o.jsxs(o.Fragment,{children:[o.jsx($r,{className:"h-3 w-20"}),o.jsx($r,{className:"h-14 w-full rounded-lg"})]}),e[3]=l,e[4]=c):(l=e[3],c=e[4]);let d;e[5]!==n||e[6]!==i?(d=o.jsx(F4,{draftPreviewUrl:n,t:i}),e[5]=n,e[6]=i,e[7]=d):d=e[7];const h=s==="review"?"default":"brand";let u;e[8]!==s||e[9]!==i?(u=i(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[8]=s,e[9]=i,e[10]=u):u=e[10];let f;e[11]!==h||e[12]!==u?(f=o.jsx(me,{type:"button",variant:h,className:"flex-1",disabled:!0,children:u}),e[11]=h,e[12]=u,e[13]=f):f=e[13];let p;e[14]!==d||e[15]!==f?(p=o.jsxs("div",{className:"flex gap-2",children:[d,f]}),e[14]=d,e[15]=f,e[16]=p):p=e[16];let m;return e[17]!==a||e[18]!==p?(m=o.jsx(I4,{state:"loading",header:a,body:l,note:c,footer:p}),e[17]=a,e[18]=p,e[19]=m):m=e[19],m}function Z9e(t){const e=F.c(25),{mode:s,draftPreviewUrl:n,message:i,onRetry:r}=t,a=ae();let l;e[0]!==a?(l=a("thread.publishPopover.loadFailed"),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("span",{className:"truncate",children:l}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==s||e[5]!==c?(d=o.jsx(z4,{mode:s,title:c}),e[4]=s,e[5]=c,e[6]=d):d=e[6];let h;e[7]!==i?(h=o.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:i}),e[7]=i,e[8]=h):h=e[8];let u;e[9]!==n||e[10]!==a?(u=o.jsx(F4,{draftPreviewUrl:n,t:a}),e[9]=n,e[10]=a,e[11]=u):u=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Dn,{className:"size-4"}),e[12]=f):f=e[12];let p;e[13]!==a?(p=a("thread.publishPopover.retry"),e[13]=a,e[14]=p):p=e[14];let m;e[15]!==r||e[16]!==p?(m=o.jsxs(me,{type:"button",variant:"outline",className:"flex-1",onClick:r,children:[f,p]}),e[15]=r,e[16]=p,e[17]=m):m=e[17];let g;e[18]!==u||e[19]!==m?(g=o.jsxs("div",{className:"flex gap-2",children:[u,m]}),e[18]=u,e[19]=m,e[20]=g):g=e[20];let x;return e[21]!==d||e[22]!==h||e[23]!==g?(x=o.jsx(I4,{state:"ready",header:d,body:h,footer:g}),e[21]=d,e[22]=h,e[23]=g,e[24]=x):x=e[24],x}function Uy(t){const e=F.c(14),s=t.mode??"publish";let n;e[0]!==s||e[1]!==t.draftPreviewUrl?(n=c=>{const{error:d,resetError:h}=c;return o.jsx(Z9e,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:d?.message??"",onRetry:h})},e[0]=s,e[1]=t.draftPreviewUrl,e[2]=n):n=e[2];let i;e[3]!==s||e[4]!==t.draftPreviewUrl?(i=o.jsx(J9e,{mode:s,draftPreviewUrl:t.draftPreviewUrl}),e[3]=s,e[4]=t.draftPreviewUrl,e[5]=i):i=e[5];let r;e[6]!==t?(r=o.jsx(e1e,{...t}),e[6]=t,e[7]=r):r=e[7];let a;e[8]!==i||e[9]!==r?(a=o.jsx(T.Suspense,{fallback:i,children:r}),e[8]=i,e[9]=r,e[10]=a):a=e[10];let l;return e[11]!==n||e[12]!==a?(l=o.jsx(tn,{fallback:n,children:a}),e[11]=n,e[12]=a,e[13]=l):l=e[13],l}function e1e(t){const e=F.c(160),{publishLockRef:s,onOpenChange:n,mode:i,orgSlug:r,virtualMcpId:a,branch:l,baseBranch:c,repoTarget:d,owner:h,repo:u,publishPolicy:f,draftPreviewUrl:p,destinationHost:m,lastPublishedPr:g,onRequestApproval:x,openPullRequest:b,onPullRequestChanged:v,onPublished:L}=t,_=i===void 0?"publish":i,y=g===void 0?null:g,w=b===void 0?null:b,S=ae(),k=Ts()?.taskId??null,{data:j}=On.useSession();let C;e[0]!==c||e[1]!==l||e[2]!==r||e[3]!==k||e[4]!==a?(C={orgSlug:r,virtualMcpId:a,branch:l,threadId:k,baseBranch:c},e[0]=c,e[1]=l,e[2]=r,e[3]=k,e[4]=a,e[5]=C):C=e[5];const{status:V,summary:N,allPaths:A,changedFilesTotal:P,changedFilesTruncated:R,headSha:E,diff:I,bodiesPending:D,bodiesFailed:O,cardsPending:B,refresh:M}=z9e(C),[z,$]=T.useState(null),[U,H]=T.useState(!1),[W,K]=T.useState(null),[G,Y]=T.useState(null);let Z;e[6]!==z||e[7]!==N?(Z=b9e(z,y9e(N)),e[6]=z,e[7]=N,e[8]=Z):Z=e[8];const te=Z,X=_==="review",ee=B?"loading":D?"manifest":"ready",J=!X;let Q;e[9]!==A||e[10]!==l||e[11]!==I||e[12]!==V||e[13]!==r||e[14]!==f||e[15]!==J||e[16]!==k||e[17]!==a?(Q={orgSlug:r,virtualMcpId:a,branch:l,threadId:k,fastPreview:!0,status:V,diff:I,paths:A,policy:f,judgeEnabled:J},e[9]=A,e[10]=l,e[11]=I,e[12]=V,e[13]=r,e[14]=f,e[15]=J,e[16]=k,e[17]=a,e[18]=Q):Q=e[18];const{gate:oe}=nN(Q),le=w?.state==="open";let de;e[19]!==l||e[20]!==V?(de=P3(V)??l,e[19]=l,e[20]=V,e[21]=de):de=e[21];const se=j?.user;let ie;e[22]!==se?(ie=M4(se),e[22]=se,e[23]=ie):ie=e[23];const he=E??void 0;let ue;e[24]!==c||e[25]!==l||e[26]!==r||e[27]!==h||e[28]!==u||e[29]!==d||e[30]!==ie||e[31]!==he||e[32]!==de||e[33]!==k||e[34]!==a?(ue={orgSlug:r,virtualMcpId:a,branch:l,threadId:k,fastPreview:!0,baseBranch:c,target:d,owner:h,repo:u,headBranch:de,coAuthor:ie,expectedHeadSha:he},e[24]=c,e[25]=l,e[26]=r,e[27]=h,e[28]=u,e[29]=d,e[30]=ie,e[31]=he,e[32]=de,e[33]=k,e[34]=a,e[35]=ue):ue=e[35];const ce=ue;let ne;e[36]!==A||e[37]!==m||e[38]!==_||e[39]!==te||e[40]!==n||e[41]!==L||e[42]!==v||e[43]!==s||e[44]!==M||e[45]!==ce?(ne={mode:_,target:ce,note:te,allPaths:A,destinationHost:m,publishLockRef:s,onOpenChange:n,refresh:M,onPullRequestChanged:v,onPublished:L},e[36]=A,e[37]=m,e[38]=_,e[39]=te,e[40]=n,e[41]=L,e[42]=v,e[43]=s,e[44]=M,e[45]=ce,e[46]=ne):ne=e[46];const{isPublishing:q,isDiscarding:fe,publishError:ge,submit:_e,discardChange:Le,discardAll:je}=I9e(ne),Ce=!q&&N.count>0&&(X||oe.allowed);let Pe;e[47]!==X||e[48]!==N.count||e[49]!==S?(Pe=X?N.count===0?S("thread.publishPopover.submitForReview"):N.count===1?S("thread.publishPopover.submitOneForReview"):S("thread.publishPopover.submitCountForReview",{count:N.count}):N.count===0?S("thread.publishPopover.publish"):N.count===1?S("thread.publishPopover.publishOneInProduction"):S("thread.publishPopover.publishCountInProduction",{count:N.count}),e[47]=X,e[48]=N.count,e[49]=S,e[50]=Pe):Pe=e[50];const pe=Pe;let ke;e:{if(X&&le){let lt;e[51]!==w.number||e[52]!==S?(lt=S("thread.publishPopover.updatesPullRequest",{number:w.number}),e[51]=w.number,e[52]=S,e[53]=lt):lt=e[53],ke=lt;break e}const ht=y;if(!ht?.mergedAt){ke=null;break e}let ct;if(e[54]!==ht||e[55]!==S){const lt=ud(new Date(ht.mergedAt)),Ge=P9e(ht);ct=Ge?S("thread.publishPopover.lastPublishedBy",{when:lt,name:Ge}):S("thread.publishPopover.lastPublished",{when:lt}),e[54]=ht,e[55]=S,e[56]=ct}else ct=e[56];ke=ct}const Te=ke;let we;e[57]!==X||e[58]!==N.count||e[59]!==S?(we=X?S("thread.publishPopover.submitForReview"):N.count===1?S("thread.publishPopover.publishOne"):N.count>1?S("thread.publishPopover.publishCount",{count:N.count}):S("thread.publishPopover.publish"),e[57]=X,e[58]=N.count,e[59]=S,e[60]=we):we=e[60];const Ne=we;let Oe;e[61]!==D||e[62]!==G||e[63]!==Le||e[64]!==W||e[65]!==I||e[66]!==fe||e[67]!==q?(Oe=(ht,ct)=>ct.length===0?null:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("div",{className:"px-0.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:ht}),ct.map(lt=>{const Ge=WC(lt);return o.jsx(C9e,{change:lt,diff:I,bodyPending:D,expanded:W===Ge,onToggleExpanded:()=>K(W===Ge?null:Ge),confirming:G===Ge,onConfirmingChange:wt=>Y(wt?Ge:null),onDiscard:()=>{Le(lt)},isPublishing:q,isDiscarding:fe},Ge)})]}),e[61]=D,e[62]=G,e[63]=Le,e[64]=W,e[65]=I,e[66]=fe,e[67]=q,e[68]=Oe):Oe=e[68];const nt=Oe;let Fe;e:{if(X||N.count===0){Fe=null;break e}if(oe.pending){let Ge;e[69]===Symbol.for("react.memo_cache_sentinel")?(Ge=o.jsx(et,{className:"size-3.5 motion-reduce:animate-none"}),e[69]=Ge):Ge=e[69];let wt;e[70]!==S?(wt=S("thread.publishPopover.reviewing"),e[70]=S,e[71]=wt):wt=e[71];let Pt;e[72]!==wt?(Pt=o.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[Ge,wt]}),e[72]=wt,e[73]=Pt):Pt=e[73],Fe=Pt;break e}if(oe.allowed){Fe=null;break e}let ht;e[74]===Symbol.for("react.memo_cache_sentinel")?(ht=o.jsx(na,{className:"mt-0.5 size-3.5 shrink-0"}),e[74]=ht):ht=e[74];let ct;e[75]!==oe.reason||e[76]!==S?(ct=oe.reason??S("thread.publishPopover.needsReviewGeneric"),e[75]=oe.reason,e[76]=S,e[77]=ct):ct=e[77];let lt;e[78]!==ct?(lt=o.jsxs("div",{className:"flex items-start gap-2 border-t px-4 py-2.5 text-xs text-warning",children:[ht,o.jsx("span",{children:ct})]}),e[78]=ct,e[79]=lt):lt=e[79],Fe=lt}const yt=Fe;let it;e:{if(N.count<=1||R){it=null;break e}if(U){let wt;e[80]!==S?(wt=S("thread.publishPopover.discardAllConfirm"),e[80]=S,e[81]=wt):wt=e[81];let Pt;e[82]!==wt?(Pt=o.jsx("span",{className:"text-destructive",children:wt}),e[82]=wt,e[83]=Pt):Pt=e[83];let Zt;e[84]===Symbol.for("react.memo_cache_sentinel")?(Zt=()=>H(!1),e[84]=Zt):Zt=e[84];let Dt;e[85]!==S?(Dt=S("thread.publishDialog.cancel"),e[85]=S,e[86]=Dt):Dt=e[86];let $e;e[87]!==Dt?($e=o.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:Zt,children:Dt}),e[87]=Dt,e[88]=$e):$e=e[88];let Lt;e[89]!==je?(Lt=()=>{H(!1),je()},e[89]=je,e[90]=Lt):Lt=e[90];let Se;e[91]!==S?(Se=S("thread.publishPopover.discard"),e[91]=S,e[92]=Se):Se=e[92];let Ye;e[93]!==fe||e[94]!==Lt||e[95]!==Se?(Ye=o.jsx("button",{type:"button",className:"font-medium text-destructive disabled:opacity-50",onClick:Lt,disabled:fe,children:Se}),e[93]=fe,e[94]=Lt,e[95]=Se,e[96]=Ye):Ye=e[96];let ot;e[97]!==Pt||e[98]!==$e||e[99]!==Ye?(ot=o.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11px]",children:[Pt,$e,Ye]}),e[97]=Pt,e[98]=$e,e[99]=Ye,e[100]=ot):ot=e[100],it=ot;break e}let ht;e[101]===Symbol.for("react.memo_cache_sentinel")?(ht=()=>H(!0),e[101]=ht):ht=e[101];const ct=q||fe;let lt;e[102]!==S?(lt=S("thread.publishPopover.discardAll"),e[102]=S,e[103]=lt):lt=e[103];let Ge;e[104]!==ct||e[105]!==lt?(Ge=o.jsx("button",{type:"button",className:"ml-auto shrink-0 text-[11px] text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:ht,disabled:ct,children:lt}),e[104]=ct,e[105]=lt,e[106]=Ge):Ge=e[106],it=Ge}const st=it;let ft;e[107]!==O||e[108]!==B||e[109]!==P||e[110]!==R||e[111]!==X||e[112]!==nt||e[113]!==N.blocks||e[114]!==N.count||e[115]!==N.other||e[116]!==N.pages||e[117]!==S?(ft=B?o.jsx(w2,{children:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Lu,{}),o.jsx(Lu,{})]})}):N.count===0?o.jsxs("div",{className:"flex flex-col items-center gap-1 py-10 text-center",children:[o.jsx(xr,{className:"mb-1 size-5 text-success"}),o.jsx("p",{className:"text-sm font-medium",children:S(X?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:S(X?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):o.jsxs(w2,{children:[R?o.jsx("p",{className:"text-[11px] text-muted-foreground",children:S("thread.publishPopover.showingFirst",{shown:N.count,total:P})}):null,nt(S("thread.publishPopover.pagesGroup"),N.pages),nt(S("thread.publishPopover.blocksGroup"),N.blocks),nt(S("thread.publishPopover.otherGroup"),N.other),O?o.jsx("p",{className:"text-[11px] text-muted-foreground",children:S("thread.publishPopover.detailsUnavailable")}):null]}),e[107]=O,e[108]=B,e[109]=P,e[110]=R,e[111]=X,e[112]=nt,e[113]=N.blocks,e[114]=N.count,e[115]=N.other,e[116]=N.pages,e[117]=S,e[118]=ft):ft=e[118];const _t=ft;let mt;e[119]!==pe?(mt=o.jsx("span",{className:"truncate",children:pe}),e[119]=pe,e[120]=mt):mt=e[120];let Ze;e[121]!==st||e[122]!==_||e[123]!==Te||e[124]!==mt?(Ze=o.jsx(z4,{mode:_,title:mt,subLine:Te,trailing:st}),e[121]=st,e[122]=_,e[123]=Te,e[124]=mt,e[125]=Ze):Ze=e[125];let rt;e[126]!==q||e[127]!==X||e[128]!==te||e[129]!==N.count||e[130]!==S?(rt=N.count===0?null:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-[13px] font-medium",children:S(X?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),o.jsx(Jo,{value:te,onChange:ht=>$(ht.target.value),placeholder:S(X?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,className:"resize-none text-[13px]",disabled:q})]}),e[126]=q,e[127]=X,e[128]=te,e[129]=N.count,e[130]=S,e[131]=rt):rt=e[131];let xt;e[132]!==p||e[133]!==S?(xt=o.jsx(F4,{draftPreviewUrl:p,t:S}),e[132]=p,e[133]=S,e[134]=xt):xt=e[134];let be;e[135]!==Ce||e[136]!==oe||e[137]!==q||e[138]!==X||e[139]!==x||e[140]!==Ne||e[141]!==_e||e[142]!==N.count||e[143]!==S?(be=!X&&N.count>0&&!oe.allowed&&!oe.pending?o.jsx(me,{type:"button",className:"flex-1",onClick:x,disabled:q,children:S("thread.publishPopover.requestApproval")}):o.jsxs(me,{type:"button",variant:X?"default":"brand",className:"flex-1",onClick:()=>{_e()},disabled:!Ce,children:[q?o.jsx(et,{className:"size-4 motion-reduce:animate-none"}):null,q?S(X?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):Ne]}),e[135]=Ce,e[136]=oe,e[137]=q,e[138]=X,e[139]=x,e[140]=Ne,e[141]=_e,e[142]=N.count,e[143]=S,e[144]=be):be=e[144];let Re;e[145]!==xt||e[146]!==be?(Re=o.jsxs("div",{className:"flex gap-2",children:[xt,be]}),e[145]=xt,e[146]=be,e[147]=Re):Re=e[147];let Me;e[148]!==ge?(Me=ge?o.jsx("p",{className:"text-xs text-destructive",children:ge}):null,e[148]=ge,e[149]=Me):Me=e[149];let dt;e[150]!==Re||e[151]!==Me?(dt=o.jsxs(o.Fragment,{children:[Re,Me]}),e[150]=Re,e[151]=Me,e[152]=dt):dt=e[152];let ut;return e[153]!==_t||e[154]!==yt||e[155]!==ee||e[156]!==Ze||e[157]!==rt||e[158]!==dt?(ut=o.jsx(I4,{state:ee,header:Ze,body:_t,note:rt,gate:yt,footer:dt}),e[153]=_t,e[154]=yt,e[155]=ee,e[156]=Ze,e[157]=rt,e[158]=dt,e[159]=ut):ut=e[159],ut}function t1e(){return!1}function rN(t,e){t1e()&&console.log(`[github-header] ${t}`,e??"")}function s1e(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return sk[t].short}const n1e=new Set(["failure","timed_out","cancelled","action_required"]);function oN(t){return t.status==="completed"&&n1e.has(t.conclusion)}function U4(t){return t.status==="queued"||t.status==="in_progress"}function Uh(t){return t.isPending&&t.fetchStatus!=="idle"}function i1e(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr-page"}}function Ar(t,e,s){return e?[...t,i1e(s)]:t}function vi(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"sync",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function Hy(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function jh(t,e,s){if(e.filter(U4).length===0)return t;const i=e.filter(r=>r.status==="completed").length;return{...t,tooltip:s("thread.cmsActions.checksRunning",{done:i,total:e.length})}}function r1e(t){const{lifecycle:e,branch:s,pr:n,checks:i,reviews:r,loading:a,t:l}=t;if(a)return{label:l("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&s1e(t.claimPhase.kind)||l("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:l("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:l("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||l("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:l("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:l("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:l("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:l("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:l("thread.headerActions.waitingForBranchTooltip"),menu:[]};const c=s,d=c.unpushed>0&&!(n&&c.headSha&&n.headSha&&c.headSha===n.headSha);if(t.noReviewableDiff&&!n)return{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:vi([],c,l)};if(c.workingTreeDirty||d)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:vi(Ar([Hy(l)],n,l),c,l)};if(rN("no local work — checking PR/sync state",{workingTreeDirty:c.workingTreeDirty,unpushed:c.unpushed,aheadOfBase:c.aheadOfBase,behindBase:c.behindBase,branch:c.branch,base:c.base,prMerged:n?.merged??null,prState:n?.state??null}),n?.merged)return!!c.headSha&&!!n.headSha&&c.headSha!==n.headSha?{label:l("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:l("thread.headerActions.openNewPrTooltip"),menu:vi(Ar([],n,l),c,l)}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.prMergedTooltip",{prNumber:String(n.number),base:n.base}),menu:vi(Ar([],n,l),c,l)};if(c.aheadOfBase>0){if(n&&n.state==="closed"&&!n.merged)return{label:l("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:l("thread.headerActions.reopenPrTooltip",{prNumber:String(n.number)}),menu:vi(Ar([],n,l),c,l)};if(!n)return{label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:vi([Hy(l)],c,l)};if((r?.mergeableState??"unknown")==="dirty")return{label:l("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:l("thread.cmsActions.resolveOnGithub"),action:"open-pr-page"}]};const u=i.filter(U4).length,f=i.filter(oN).map(m=>m.name);if(u===0&&f.length>0)return{label:l("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:l("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:vi(Ar([{key:"publish-anyway",label:l("thread.headerActions.publishAnyway"),action:"merge",tooltip:l("thread.headerActions.squashMergeTooltip",{prNumber:String(n.number),base:n.base})}],n,l),c,l)};if(r?.draft)return jh({label:l("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:l("thread.headerActions.markDraftReadyTooltip"),menu:vi(Ar([],n,l),c,l)},i,l);const p=r?.unresolvedConversations??0;return p>0?jh({label:l("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:l("thread.headerActions.unresolvedConversationsTooltip",{count:String(p)}),menu:vi(Ar([],n,l),c,l)},i,l):r?.missingRequiredApprovals?jh({label:l("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:l("thread.headerActions.waitingForApprovalsTooltip"),menu:vi(Ar([],n,l),c,l)},i,l):jh({label:l("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:vi(Ar([{key:"review",label:l("thread.headerActions.review"),action:"review"}],n,l),c,l)},i,l)}return c.behindBase>0?{label:l("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:l("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:l("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:l("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:[]}}function Ky(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr"}}function Ch(t,e,s){return e.kind!=="ready"||e.behindBase<=0?t:[...t,{key:"get-latest",label:s("thread.cmsActions.getLatest"),action:"get-latest",tooltip:s("thread.cmsActions.getLatestTooltip")}]}function Wy(t,e,s,n){const i=e.length;if(i===0)return t;if(e.filter(U4).length>0){const l=e.filter(d=>d.status==="completed").length,c=n("thread.cmsActions.checksRunning",{done:l,total:i});return s==="loading"?{...t,loading:!0,tooltip:c}:{...t,tooltip:c}}const a=e.filter(oN).length;return a>0?{...t,variant:"warning",tooltip:n("thread.cmsActions.checksFailing",{failed:a,total:i})}:t}function o1e(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function a1e(t){return Uh(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:Uh(t.checksQuery)||Uh(t.reviewsQuery)}function l1e(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function c1e(t){const{branch:e,pr:s,checks:n,reviews:i,publishing:r,saving:a,loading:l,publishableChangeCount:c,t:d}=t;if(e.kind!=="ready"&&t.statusError)return{label:d("thread.cmsActions.retry"),action:"retry-status",variant:"outline",disabled:t.statusRetrying,loading:t.statusRetrying,tooltip:t.statusError,menu:[]};if(l||e.kind!=="ready")return{label:d("thread.headerActions.loading"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(r)return{label:d("thread.cmsActions.publishing"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(t.syncing)return{label:d("thread.cmsActions.gettingLatest"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(a)return{label:d("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(s&&s.state==="open"&&!s.merged?s:null){const u=i?.mergeableState??"unknown";return u==="dirty"?{label:d("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:d("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:d("thread.cmsActions.resolveOnGithub"),action:"open-pr"}]}:u==="blocked"||i?.draft?Wy({label:d("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:Ch([Ky(d)],e,d)},n,"loading",d):Wy({label:d("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Ch([Ky(d)],e,d)},n,"none",d)}return o1e(s,e)?{label:d("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:Ch([],e,d)}:l1e(e,c)?{label:d("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:Ch([{key:"request-approval",label:d("thread.headerActions.submitForReview"),action:"request-approval"}],e,d)}:e.behindBase>0?{label:d("thread.cmsActions.getLatest"),action:"get-latest",variant:"default",tooltip:d("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:d("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:[]}}function d1e(t){return t.conflicting===!0?"dirty":t.conflicting===null?"unknown":t.reviewBlocked||t.unresolvedConversations>0?"blocked":"clean"}function aN(t){const e=F.c(4);let s;e[0]!==t?(s=IP(t),e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n={...s,select:u1e},e[2]=s,e[3]=n):n=e[3],Yt(n)}function u1e(t){const e=t.changeRequest;return e?{draft:e.draft,mergeableState:d1e(e),unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.reviewBlocked}:null}function qy(t,e){return t==="open-pr"||e==="resolve-on-github"?o.jsx(ur,{size:16}):t==="publish"?o.jsx(d8,{className:"size-4"}):t==="get-latest"||t==="retry-status"?o.jsx(Dn,{className:"size-4"}):o.jsx(Fo,{className:"size-4"})}function h1e(t){const e=F.c(62),{virtualMcpId:s}=t,n=ae(),{org:i}=Ue(),r=Vs(),a=As(s),{data:l}=On.useSession(),{deleteRelease:c}=k9(s),{currentBranch:d,setCurrentTaskBranch:h,taskId:u,createTask:f}=on();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={open:!1,mode:"publish"},e[0]=p):p=e[0];const[m,g]=T.useState(p);let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=q=>g({open:!0,mode:q}),e[1]=x):x=e[1];const b=x,v=O8(a),L=v.status==="attached"||v.status==="public-clone"?v.repo:null,{previewServerUrl:_}=_n(s);let y;if(e[2]!==d||e[3]!==i.slug||e[4]!==s){const q=d?e4(Z3(i.slug,s,d)):null;y=q?Dr(q.path,q.params):"/",e[2]=d,e[3]=i.slug,e[4]=s,e[5]=y}else y=e[5];const w=y;let S;e[6]!==d||e[7]!==w||e[8]!==i.slug||e[9]!==_||e[10]!==s?(S=d?{orgSlug:i.slug,virtualMcpId:s,branch:d,previewServerUrl:_,path:w}:null,e[6]=d,e[7]=w,e[8]=i.slug,e[9]=_,e[10]=s,e[11]=S):S=e[11];const k=YS(S);let j;e[12]!==d||e[13]!==i.slug||e[14]!==u||e[15]!==s?(j=aS({orgSlug:i.slug,virtualMcpId:s,branch:d??"",threadId:u??null},{fastPreview:!0}),e[12]=d,e[13]=i.slug,e[14]=u,e[15]=s,e[16]=j):j=e[16];const C=!!d;let V;e[17]!==j||e[18]!==C?(V={...j,enabled:C},e[17]=j,e[18]=C,e[19]=V):V=e[19];const N=Yt(V),A=N.data??null,P=A?{kind:"ready",branch:P3(A)??d??"",base:A.base??"main",workingTreeDirty:nS(A),unpushed:A.unpushed??0,aheadOfBase:A.aheadOfBase??0,behindBase:A.behindBase??0,headSha:A.headSha??""}:{kind:"unknown"},R=A?.changedFiles?KC({files:A.changedFiles}).count:null,E=(P.kind==="ready"?P.branch:null)??d??null,I=P.kind==="ready"?P.base:"main",D=p9({orgId:i.id,orgSlug:i.slug,target:Un(L),owner:L?.owner??"",repo:L?.name??"",branch:E}),O=D.data??null,B=OP({orgId:i.id,orgSlug:i.slug,target:Un(L),owner:L?.owner??"",repo:L?.name??"",base:I}),M=_g({orgId:i.id,orgSlug:i.slug,target:Un(L),owner:L?.owner??"",repo:L?.name??"",branch:E}),z=aN({orgId:i.id,orgSlug:i.slug,target:Un(L),owner:L?.owner??"",repo:L?.name??"",branch:E});let $;e[20]!==M||e[21]!==O||e[22]!==D||e[23]!==z?($=a1e({pr:O,prQuery:D,checksQuery:M,reviewsQuery:z}),e[20]=M,e[21]=O,e[22]=D,e[23]=z,e[24]=$):$=e[24];const U=$;let H;e[25]!==D?(H=async()=>{await D.refetch()},e[25]=D,e[26]=H):H=e[26];const W=H,K=Ds({mutationFn:async()=>{const q=d;await h(Gc(Kg(l?.user))),q&&q!==I&&await c(q)},onError:p1e});let G;e[27]!==i.slug||e[28]!==u||e[29]!==s?(G=async q=>(await sS({orgSlug:i.slug,virtualMcpId:s,branch:q.branch,threadId:u??null},q.base,{fastPreview:!0}),q),e[27]=i.slug,e[28]=u,e[29]=s,e[30]=G):G=e[30];let Y;e[31]!==d||e[32]!==i.slug||e[33]!==r||e[34]!==n||e[35]!==u||e[36]!==s?(Y=async q=>{ye.success(n("thread.headerActions.syncedWithBase",{base:q.base})),await Promise.all([r.invalidateQueries({queryKey:j0({orgSlug:i.slug,virtualMcpId:s,branch:d??q.branch,threadId:u??null})}),r.invalidateQueries({queryKey:tt.decofile(`${i.slug}/${s}/${q.branch}`)})])},e[31]=d,e[32]=i.slug,e[33]=r,e[34]=n,e[35]=u,e[36]=s,e[37]=Y):Y=e[37];let Z;e[38]!==G||e[39]!==Y?(Z={mutationFn:G,onSuccess:Y,onError:m1e},e[38]=G,e[39]=Y,e[40]=Z):Z=e[40];const te=Ds(Z),X=X3(i.slug,s,d??"");if(v.status==="detached"){let q;e[41]!==n?(q=n("thread.headerActions.reconnectGithub"),e[41]=n,e[42]=q):q=e[42];let fe;e[43]!==q?(fe=o.jsx(He,{asChild:!0,children:o.jsx("span",{children:o.jsx(me,{size:"sm",variant:"outline",disabled:!0,children:q})})}),e[43]=q,e[44]=fe):fe=e[44];let ge;e[45]!==n?(ge=n("thread.headerActions.githubConnectionRemoved"),e[45]=n,e[46]=ge):ge=e[46];let _e;e[47]!==ge?(_e=o.jsx(Ke,{children:ge}),e[47]=ge,e[48]=_e):_e=e[48];let Le;return e[49]!==fe||e[50]!==_e?(Le=o.jsx(Go,{children:o.jsxs(We,{children:[fe,_e]})}),e[49]=fe,e[50]=_e,e[51]=Le):Le=e[51],Le}if(!a)return null;if(!L||!_){const q=L?"noPreviewServer":"noRepo";let fe;e[52]!==d||e[53]!==f?(fe=d?()=>{const _e=f?.({runtime:"sandbox",branch:d});_e&&qe("coding_session_started",{thread_id:_e})}:void 0,e[52]=d,e[53]=f,e[54]=fe):fe=e[54];let ge;return e[55]!==q||e[56]!==fe?(ge=o.jsx(g1e,{reason:q,onStartCodingSession:fe}),e[55]=q,e[56]=fe,e[57]=ge):ge=e[57],ge}if(!d)return null;const ee=K.isPending,J=c1e({branch:P,pr:O,checks:M.data??[],reviews:z.data??null,publishing:ee,saving:X,syncing:te.isPending,statusRetrying:N.isFetching&&!!N.error,statusError:N.error instanceof Error?N.error.message:N.error?String(N.error):null,loading:!!U,publishableChangeCount:R,t:n}),Q=q=>{switch(q){case"publish":{b("publish");return}case"request-approval":{b("review");return}case"get-latest":{if(!E||te.isPending)return;te.mutate({branch:E,base:I});return}case"retry-status":{N.refetch();return}case"open-pr":{O?.htmlUrl&&window.open(O.htmlUrl,"_blank","noopener,noreferrer");return}}},oe=J.menu.map(q=>({key:q.key,label:q.label,icon:qy(q.action,q.key),...q.tooltip?{tooltip:q.tooltip}:{},onSelect:()=>Q(q.action)})),le=J.action,de=J.label,se=J.variant,ie=!!J.loading;let he;e[58]!==n?(he=n("thread.cmsActions.moreActionsAriaLabel"),e[58]=n,e[59]=he):he=e[59];const ue=o.jsx(OC,{size:"sm",label:de,variant:se,disabled:!!J.disabled||!le,loading:ie,...le&&!J.loading?{icon:qy(le)}:{},...J.tooltip?{tooltip:J.tooltip}:{},items:oe,menuAriaLabel:he,onClick:le?()=>Q(le):void 0}),ce=d?o.jsx(Q9e,{open:m.open,mode:m.mode,onOpenChange:q=>{q||g(f1e)},orgSlug:i.slug,orgId:i.id,virtualMcpId:s,branch:d,baseBranch:I,repoTarget:Un(L),owner:L.owner,repo:L.name,publishPolicy:oS(a?.metadata?.publishPolicy),draftPreviewUrl:k.url,destinationHost:k.host,lastPublishedPr:B.data??null,onRequestApproval:()=>b("review"),openPullRequest:O?.state==="open"?O:null,onPullRequestChanged:W,onPublished:()=>K.mutateAsync(),children:ue}):ue;let ne;return e[60]!==ce?(ne=o.jsx(o.Fragment,{children:ce}),e[60]=ce,e[61]=ne):ne=e[61],ne}function f1e(t){return{...t,open:!1}}function m1e(t){ye.error(t instanceof Error?t.message:String(t))}function p1e(t){ye.error(t instanceof Error?t.message:String(t))}function g1e(t){const e=F.c(14),{reason:s,onStartCodingSession:n}=t,i=ae(),r=!n;let a;e[0]!==i?(a=i("sandbox.cmsUnavailable.startCodingSession"),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==n||e[3]!==r||e[4]!==a?(l=o.jsx(He,{asChild:!0,children:o.jsx("span",{children:o.jsx(me,{size:"sm",variant:"outline",disabled:r,onClick:n,children:a})})}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5];let c;e[6]!==s||e[7]!==i?(c=i(s==="noPreviewServer"?"sandbox.cmsUnavailable.noPreviewServer":"sandbox.cmsUnavailable.noRepo"),e[6]=s,e[7]=i,e[8]=c):c=e[8];let d;e[9]!==c?(d=o.jsx(Ke,{children:c}),e[9]=c,e[10]=d):d=e[10];let h;return e[11]!==l||e[12]!==d?(h=o.jsx(Go,{children:o.jsxs(We,{children:[l,d]})}),e[11]=l,e[12]=d,e[13]=h):h=e[13],h}const x1e=new Set(["main","master"]);function b1e(t,e){return x1e.has(t.trim().toLowerCase())?e("thread.headerActions.publishToProduction"):e("thread.headerActions.publish")}function v1e(t){const e=F.c(10),[s,n]=T.useState(0);let i;e[0]!==t?(i=c=>{c&&n(y1e),t.onOpenChange(c)},e[0]=t,e[1]=i):i=e[1];const r=i;let a;e[2]!==r||e[3]!==t||e[4]!==s?(a=t.open?o.jsx(_1e,{...t,onOpenChange:r},s):null,e[2]=r,e[3]=t,e[4]=s,e[5]=a):a=e[5];let l;return e[6]!==r||e[7]!==t.open||e[8]!==a?(l=o.jsx(Ft,{open:t.open,onOpenChange:r,children:a}),e[6]=r,e[7]=t.open,e[8]=a,e[9]=l):l=e[9],l}function y1e(t){return t+1}function _1e({onOpenChange:t,orgSlug:e,orgId:s,virtualMcpId:n,branch:i,baseBranch:r,repoTarget:a,owner:l,repo:c,previewUrl:d,publishPolicy:h,dialogIntent:u="open-pr",headSha:f=null,openPullRequest:p=null,onPullRequestChanged:m,onPublished:g}){const x=ae(),b=Cn({connectionId:Xu,orgId:s,orgSlug:e}),{data:v}=On.useSession(),L=A_(b),_={orgSlug:e,virtualMcpId:n,branch:i,threadId:Ts()?.taskId??null},y=M4(v?.user),w=p?.state==="open",S=u==="open-pr"&&!w,k=u==="publish-only",[j,C]=T.useState(null),[V,N]=T.useState(null),[A,P]=T.useState(!0),[R,E]=T.useState(!1),[I,D]=T.useState(""),[O,B]=T.useState(""),[M,z]=T.useState(),[$,U]=T.useState(!1),[H,W]=T.useState(),[K,G]=T.useState(!1),[Y,Z]=T.useState(!1),[te,X]=T.useState(!1),ee=T.useRef(!1),J=T.useRef(!1),Q={base:r,...f?{headSha:f}:{}},oe=async Ne=>{const Oe=(Ne.aheadOfBase??0)>0?await hu(_,Q):null,nt=E3(Ne)?await hu(_):null;return FJ(Oe,nt)},le=async()=>{const Ne=await $c(_),Oe=k?await oe(Ne):await hu(_,zJ(Ne,{openPrFromCommits:S,commitToOpenPr:w})?Q:void 0);C(Ne),N(Oe),D(x("thread.publishDialog.changesFrom",{branch:Ne.current??i})),X(!0),Nb(_,{status:Ne,diff:Oe}).then(nt=>{D(nt.title),B(nt.body)}).catch(()=>{}).finally(()=>X(!1))};ee.current||(ee.current=!0,(async()=>{P(!0),z(void 0),N(null),D(""),B(""),W(void 0);try{await le()}catch(Ne){if(eS(Ne)&&!J.current){J.current=!0;try{await L.mutateAsync({virtualMcpId:n,branch:i}),await le();return}catch(Oe){z(Oe instanceof Error?Oe.message:x("thread.publishDialog.failedLoadAfterReprovision"));return}}z(Ne instanceof Error?Ne.message:x("thread.publishDialog.failedLoad"))}finally{P(!1)}})());const de=P3(j)??i,se=b1e(r,x),ie=()=>{!j||!V||(X(!0),Nb(_,{status:j,diff:V}).then(Ne=>{D(Ne.title),B(Ne.body)}).catch(()=>{}).finally(()=>X(!1)))},he=lS(j),ue=V?Object.keys(V.diffs).length:he,{gate:ce}=nN({orgSlug:e,virtualMcpId:n,branch:i,threadId:_.threadId,status:j,diff:V,policy:h,judgeEnabled:k}),ne=S?cS(j):BJ(j,V),q=!A&&(ne||S),fe=q&&ce.allowed,ge=!q||ce.allowed?null:ce.pending?x("thread.publishDialog.reviewingChanges"):ce.reason??x("thread.publishDialog.publishNeedsReview"),_e=S||!w&&(j?.aheadOfBase??0)>0,Le=!A&&(_e||ne)&&(ue>0||ne),je={orgSlug:e,virtualMcpId:n,branch:i,threadId:_.threadId,baseBranch:r,target:a,owner:l,repo:c,headBranch:de,coAuthor:y,expectedHeadSha:f??void 0},Ce=()=>QC({title:I,body:O,fallbackTitle:x("thread.publishDialog.changesFrom",{branch:de})}),Pe=Ne=>{R||$||t(Ne)},pe=async()=>{E(!0),z(void 0);try{await eN(je,Ce(),x),ye.success(x("thread.publishDialog.publishedTo",{baseBranch:r})),Pe(!1),N(null),D(""),B(""),await m?.(),await g?.()}catch(Ne){const Oe=j2(Ne,x);z(Oe.message),Oe.pullRequestOpened&&await m?.()}finally{E(!1)}},ke=async Ne=>{try{await Lp(_,[Ne]),ye.success(x("thread.publishDialog.discardedChanges",{filepath:Ne})),N(nt=>{if(!nt)return nt;const Fe={...nt,diffs:{...nt.diffs}};return delete Fe.diffs[Ne],Fe});const Oe=await $c(_);C(Oe)}catch(Oe){ye.error(Oe instanceof Error?Oe.message:x("thread.publishDialog.failedDiscardChanges"))}},Te=async()=>{if(V){G(!1),Z(!0);try{const Ne=Object.keys(V.diffs);if(Ne.length===0)return;await Lp(_,Ne),ye.success(x("thread.publishDialog.allChangesDiscarded")),N(null);const Oe=await $c(_);C(Oe),Pe(!1)}catch(Ne){ye.error(Ne instanceof Error?Ne.message:x("thread.publishDialog.failedDiscardChanges"))}finally{Z(!1)}}},we=async()=>{U(!0),W(void 0);try{const Ne=await tN(je,Ce());sN(Ne,x),Pe(!1),await m?.()}catch(Ne){W(Ne instanceof Error?Ne.message:x("thread.publishDialog.failedSubmitForReview"))}finally{U(!1)}};return o.jsx(zt,{className:"top-14 left-auto right-4 flex h-[90%] max-h-[85vh] w-[90vw] max-w-[600px] translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0",children:o.jsxs(ad,{defaultValue:"description",className:"flex h-full flex-col gap-0",children:[o.jsxs("div",{className:"shrink-0 space-y-3 px-6 pt-5 pb-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:S?x("thread.publishDialog.submitForReview"):se}),o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full bg-success"}),ue," ",x(ue===1?"thread.publishDialog.change":"thread.publishDialog.changes")," ",x(S?"thread.publishDialog.inThisPr":"thread.publishDialog.toPublish")]})]}),K?o.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md bg-destructive/5 px-3 py-2",children:[o.jsx("span",{className:"text-xs text-destructive",children:x("thread.publishDialog.discardConfirmMessage")}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[o.jsx(me,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>G(!1),children:x("thread.publishDialog.cancel")}),o.jsxs(me,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:Te,disabled:Y,children:[Y?o.jsx(et,{className:"h-3 w-3"}):null,x("thread.publishDialog.discardAll")]})]})]}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(t0,{className:"h-8 w-auto",variant:"pill",children:[o.jsx(or,{value:"description",className:"px-3 text-xs",children:x("thread.publishDialog.description")}),o.jsx(or,{value:"changes",className:"px-3 text-xs",children:x("thread.publishDialog.changesTab")})]}),ue>0&&!S&&o.jsx("button",{type:"button",className:"text-xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>G(!0),disabled:R||Y,children:x("thread.publishDialog.discardAll")})]})]}),o.jsx("div",{className:"border-t"}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:A?o.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[o.jsx(et,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm",children:x("thread.publishDialog.loadingChanges")})]}):o.jsxs(o.Fragment,{children:[o.jsx(Pa,{value:"description",className:"mt-0 px-6 py-5",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("p",{className:"text-sm font-medium",children:x(S?"thread.publishDialog.pullRequest":"thread.publishDialog.commitMessage")}),o.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50",disabled:te||R||$,onClick:ie,children:[te?o.jsx(et,{className:"h-3 w-3"}):o.jsx(Fr,{className:"h-3 w-3"}),x(te?"thread.publishDialog.generating":"thread.publishDialog.regenerate")]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"publish-title",className:"text-xs font-medium text-muted-foreground",children:x("thread.publishDialog.title")}),o.jsx(vt,{id:"publish-title",value:I,onChange:Ne=>D(Ne.target.value),placeholder:x(te?"thread.publishDialog.generating":"thread.publishDialog.commitTitlePlaceholder"),disabled:R||$||te,className:"text-sm"})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"publish-body",className:"text-xs font-medium text-muted-foreground",children:x("thread.publishDialog.descriptionLabel")}),o.jsx(Jo,{id:"publish-body",value:O,onChange:Ne=>B(Ne.target.value),placeholder:x(te?"thread.publishDialog.generating":"thread.publishDialog.descriptionPlaceholder"),disabled:R||$||te,rows:5,className:"resize-none text-sm"})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[x("thread.publishDialog.branchLabel")," ",o.jsx("span",{className:"font-mono",children:i})," → ",o.jsx("span",{className:"font-mono",children:r})," · ",o.jsx("span",{className:"text-foreground/80",children:k?x("thread.publishDialog.squashMergesInto",{publishLabel:se,baseBranch:r}):x("thread.publishDialog.opensPullRequestInto",{baseBranch:r})})]})]})}),o.jsx(Pa,{value:"changes",className:"mt-0",children:o.jsx(R3,{diff:V,onDiscardFile:ke})})]})}),o.jsx("div",{className:"shrink-0 border-t",children:o.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-6 py-3.5 text-sm transition-colors hover:bg-muted/50 disabled:opacity-50",onClick:()=>{d&&window.open(d,"_blank","noopener,noreferrer")},disabled:!d,children:[o.jsxs("span",{className:"flex items-center gap-3",children:[o.jsx(h0,{className:"h-4 w-4 text-muted-foreground"}),x("thread.publishDialog.visitPreview")]}),o.jsx(gr,{className:"h-4 w-4 text-muted-foreground"})]})}),o.jsx("div",{className:"shrink-0 border-t px-6 py-3",children:k?o.jsxs(o.Fragment,{children:[o.jsx(L1e,{label:se,canPublish:fe,disabledReason:ge,isPublishing:R,onPublish:pe}),M&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:M}),!fe&&!ce.pending&&Le&&o.jsxs(o.Fragment,{children:[o.jsxs(me,{type:"button",variant:"outline",className:"mt-2 w-full",onClick:we,disabled:$,children:[$?o.jsx(et,{className:"h-4 w-4"}):o.jsx(qr,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),H&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:H})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs(me,{type:"button",className:"w-full",onClick:we,disabled:!Le||$,children:[$?o.jsx(et,{className:"h-4 w-4"}):o.jsx(qr,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),H&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:H})]})})]})})}function L1e(t){const e=F.c(14),{label:s,canPublish:n,disabledReason:i,isPublishing:r,onPublish:a}=t,l=!n||r;let c;e[0]!==r?(c=r?o.jsx(et,{className:"h-4 w-4"}):null,e[0]=r,e[1]=c):c=e[1];let d;e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==c?(d=o.jsxs(me,{type:"button",variant:"brand",className:"w-full",onClick:a,disabled:l,children:[c,s]}),e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=d):d=e[6];const h=d;if(!i)return h;let u;e[7]!==h?(u=o.jsx(He,{asChild:!0,children:o.jsx("span",{className:"flex w-full",children:h})}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==i?(f=o.jsx(Ke,{children:i}),e[9]=i,e[10]=f):f=e[10];let p;return e[11]!==u||e[12]!==f?(p=o.jsx(Go,{children:o.jsxs(We,{children:[u,f]})}),e[11]=u,e[12]=f,e[13]=p):p=e[13],p}function Gy(t){switch(t){case"publish":return o.jsx(d8,{className:"size-4"});case"create-pr":case"reopen":return o.jsx(Fo,{className:"size-4"});case"rebase":case"sync":return o.jsx(Dn,{className:"size-4"});case"fix-checks":return o.jsx(na,{className:"size-4"});case"mark-ready":return o.jsx(xr,{className:"size-4"});case"resolve-comments":return o.jsx(ng,{className:"size-4"});case"merge":return o.jsx(Vg,{className:"size-4"});case"review":return o.jsx(h0,{className:"size-4"});case"open-pr-page":return o.jsx(ur,{size:16})}}const Yy=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),Qy=new Set(["publish","create-pr"]);function w1e(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function S1e({virtualMcpId:t}){const e=ae(),{org:s}=Ue(),{data:n}=On.useSession(),i=As(t),{deleteRelease:r}=k9(t),{currentBranch:a,setCurrentTaskBranch:l,taskId:c}=on(),d=ai(),{openSidePanel:h}=oa(),[u,f]=T.useState(!1),[p,m]=T.useState("open-pr"),[g,x]=T.useState(null),[b,v]=T.useState(!1),L=T.useRef(""),_=O8(i),y=_.status==="attached"||_.status==="public-clone"?_.repo:null,{lifecycle:w,branch:S,phase:k}=ci(),j={orgSlug:s.slug,virtualMcpId:t,branch:a??"",threadId:c??null},V=Yt({queryKey:j0(j),queryFn:()=>$c(j),enabled:!!a,staleTime:15e3,refetchInterval:oe=>q1(oe.state.data)?5e3:!1}).data??null,N=S,A=w,P=N.kind==="ready"?N.branch:null,R=a??P??void 0,E=(N.kind==="ready"?N.branch:null)??R??null,I=p9({orgId:s.id,orgSlug:s.slug,target:Un(y),owner:y?.owner??"",repo:y?.name??"",branch:E}),D=I.data??null,O=_g({orgId:s.id,orgSlug:s.slug,target:Un(y),owner:y?.owner??"",repo:y?.name??"",branch:E}),B=aN({orgId:s.id,orgSlug:s.slug,target:Un(y),owner:y?.owner??"",repo:y?.name??"",branch:E}),M=N,z=oS(i?.metadata?.publishPolicy),$=X3(s.slug,t,a??R??""),{previewUrl:U}=la();if(_.status==="detached")return o.jsx(j1e,{label:e("thread.headerActions.githubConnectionRemoved"),children:o.jsx(me,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!y)return null;const H=E?r1e({lifecycle:A,branch:M,claimPhase:k,pr:D,checks:O.data??[],reviews:B.data??null,noReviewableDiff:q1(V),loading:Uh(I),t:e}):w1e(e),W=JSON.stringify({label:H.label,branchKind:M.kind,workingTreeDirty:M.kind==="ready"?M.workingTreeDirty:null,unpushed:M.kind==="ready"?M.unpushed:null,aheadOfBase:M.kind==="ready"?M.aheadOfBase:null,lifecycle:A.phase,githubHeadBranch:E,noReviewableDiff:q1(V)});L.current!==W&&(L.current=W,rN("header button",{label:H.label,tooltip:H.tooltip,action:H.action,chatBranch:a,sandboxBranch:P,sandboxRouteBranch:R,githubHeadBranch:E,branchMeta:N,effectiveBranchMeta:M,lifecyclePhase:A.phase,prNumber:D?.number??null,prState:D?.state??null}));const K=oe=>(h(),d.sendMessage({parts:[{type:"text",text:oe}]})),G=d.isStreaming,Y=M.kind==="ready"?M.base:"main",Z=async()=>{await I.refetch()},te=async()=>{const oe=a,le=Gc(Kg(n?.user));await l(le),oe&&oe!==Y&&await r(oe)},X=async oe=>{if(!(!y||b)){v(!0);try{const le=M4(n?.user);await GC(s.slug,Un(y),{number:oe,coAuthor:le}),ye.success(e("thread.headerActions.publishedPr",{prNumber:String(oe)})),await Z(),await te()}catch(le){ye.error(le instanceof qC?le.detail??R9e(le.reason,e):le instanceof Error?le.message:e("thread.headerActions.failedToMergePullRequest"))}finally{v(!1)}}},ee=(oe,le)=>{m(oe),x(le),f(!0)},J=oe=>{if(E)switch(oe){case"publish":ee("publish-only",H.meta?.publishPolicyOverride??null);return;case"create-pr":ee("open-pr",null);return;case"merge":D&&X(D.number);return;case"sync":if(G)return;K(nZ({branch:E,base:Y}));return;case"open-pr-page":D?.htmlUrl&&window.open(D.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(G)return;D&&K(lZ({prNumber:D.number}));return;case"reopen":if(G)return;D&&K(tZ({prNumber:D.number}));return;case"rebase":if(G)return;K(sZ({branch:E}));return;case"fix-checks":if(G)return;D&&K(rZ({prNumber:D.number,failingChecks:H.meta?.failingChecks??[]}));return;case"mark-ready":if(G)return;D&&K(oZ({prNumber:D.number}));return;case"resolve-comments":if(G)return;D&&K(aZ({prNumber:D.number}));return}},Q=b||G;return o.jsxs(o.Fragment,{children:[o.jsx(k1e,{t:e,button:H,actionBusy:Q,githubActionPending:b,savePending:$,onAction:J}),R&&o.jsx(v1e,{open:u,onOpenChange:f,orgSlug:s.slug,orgId:s.id,virtualMcpId:t,branch:R,baseBranch:Y,repoTarget:Un(y),owner:y.owner,repo:y.name,previewUrl:U,publishPolicy:g??z,dialogIntent:p,headSha:M.kind==="ready"?M.headSha:null,openPullRequest:D?.state==="open"?D:null,onPullRequestChanged:Z,onPublished:te})]})}function k1e(t){const e=F.c(44),{t:s,button:n,actionBusy:i,githubActionPending:r,savePending:a,onAction:l}=t,c=n.action;let d;e[0]!==c||e[1]!==i?(d=i&&c!==void 0&&Yy.has(c),e[0]=c,e[1]=i,e[2]=d):d=e[2];const h=d,u=r&&c==="merge";let f;e[3]!==c||e[4]!==a?(f=a&&c!==void 0&&Qy.has(c),e[3]=c,e[4]=a,e[5]=f):f=e[5];const p=f,m=!!n.disabled||h||u||p||!c,g=!!n.loading||u;let x;e[6]!==n.tooltip||e[7]!==h||e[8]!==p||e[9]!==s?(x=h?s("thread.headerActions.chatIsRunning"):p?s("thread.headerActions.saving"):n.tooltip,e[6]=n.tooltip,e[7]=h,e[8]=p,e[9]=s,e[10]=x):x=e[10];const b=x;let v;if(e[11]!==i||e[12]!==n.menu||e[13]!==r||e[14]!==l||e[15]!==a||e[16]!==s){let V;e[18]!==i||e[19]!==r||e[20]!==l||e[21]!==a||e[22]!==s?(V=N=>{const A=i&&Yy.has(N.action),P=a&&Qy.has(N.action),R=N.action==="merge"&&r,E=P?s("thread.headerActions.saving"):A?s("thread.headerActions.chatIsRunning"):N.tooltip;return{key:N.key,label:N.label,icon:Gy(N.action),disabled:!!(A||P||R),...E?{tooltip:E}:{},onSelect:()=>l(N.action)}},e[18]=i,e[19]=r,e[20]=l,e[21]=a,e[22]=s,e[23]=V):V=e[23],v=n.menu.map(V),e[11]=i,e[12]=n.menu,e[13]=r,e[14]=l,e[15]=a,e[16]=s,e[17]=v}else v=e[17];const L=v,_=n.label,y=n.variant;let w;e[24]!==c||e[25]!==g?(w=c&&!g?{icon:Gy(c)}:{},e[24]=c,e[25]=g,e[26]=w):w=e[26];let S;e[27]!==b?(S=b?{tooltip:b}:{},e[27]=b,e[28]=S):S=e[28];let k;e[29]!==s?(k=s("thread.headerActions.moreActionsAriaLabel"),e[29]=s,e[30]=k):k=e[30];let j;e[31]!==c||e[32]!==l?(j=c?()=>l(c):void 0,e[31]=c,e[32]=l,e[33]=j):j=e[33];let C;return e[34]!==n.label||e[35]!==n.variant||e[36]!==m||e[37]!==L||e[38]!==g||e[39]!==w||e[40]!==S||e[41]!==k||e[42]!==j?(C=o.jsx(OC,{size:"sm",label:_,variant:y,disabled:m,loading:g,...w,...S,items:L,menuAriaLabel:k,onClick:j}),e[34]=n.label,e[35]=n.variant,e[36]=m,e[37]=L,e[38]=g,e[39]=w,e[40]=S,e[41]=k,e[42]=j,e[43]=C):C=e[43],C}function j1e(t){const e=F.c(9),{label:s,children:n}=t;if(!s){let l;return e[0]!==n?(l=o.jsx(o.Fragment,{children:n}),e[0]=n,e[1]=l):l=e[1],l}let i;e[2]!==n?(i=o.jsx(He,{asChild:!0,children:o.jsx("span",{children:n})}),e[2]=n,e[3]=i):i=e[3];let r;e[4]!==s?(r=o.jsx(Ke,{children:s}),e[4]=s,e[5]=r):r=e[5];let a;return e[6]!==i||e[7]!==r?(a=o.jsx(Go,{children:o.jsxs(We,{children:[i,r]})}),e[6]=i,e[7]=r,e[8]=a):a=e[8],a}function C1e(t){const e=F.c(14),{virtualMcp:s}=t,n=ae(),i=sl(),{navigateToTask:r}=jV(),{create:a}=Ju();let l,c;if(e[0]!==i||e[1]!==a||e[2]!==r||e[3]!==n||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{const d=SP(s,i);if(!d){c=null;break e}const h=d.mode==="dev";let u;e[7]!==a||e[8]!==r?(u=async b=>{const v=crypto.randomUUID();try{await a({id:v,virtual_mcp_id:b})}catch{}r(v,{virtualMcpId:b})},e[7]=a,e[8]=r,e[9]=u):u=e[9];const f=u,p=(b,v,L)=>o.jsxs("button",{type:"button","aria-pressed":v,"aria-label":b,title:b,onClick:()=>{v||f(d.targetId)},className:re("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md transition-colors",v?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(L,{className:"size-3.5 shrink-0"}),o.jsx("span",{className:"@max-3xl/panel-header:hidden",children:b})]});let m;e[10]!==n?(m=n("devAgent.devAgentControl.develop"),e[10]=n,e[11]=m):m=e[11];const g=p(m,h,rd);let x;e[12]!==n?(x=n("devAgent.devAgentControl.live"),e[12]=n,e[13]=x):x=e[13],l=o.jsxs("div",{className:"inline-flex items-center rounded-lg border border-border bg-muted p-0.5 text-xs font-medium",children:[g,p(x,!h,jn)]})}e[0]=i,e[1]=a,e[2]=r,e[3]=n,e[4]=s,e[5]=l,e[6]=c}else l=e[5],c=e[6];return c!==Symbol.for("react.early_return_sentinel")?c:l}function N1e(t){const e=F.c(11),{virtualMcp:s}=t,n=_n(s.id).runtime==="cms",i=R8(s.metadata?.ui?.layout??null);let r;e[0]!==i?(r=Cg(i),e[0]=i,e[1]=r):r=e[1];const a=r;let l;e[2]!==s?(l=o.jsx(C1e,{virtualMcp:s}),e[2]=s,e[3]=l):l=e[3];let c;e[4]!==n||e[5]!==a||e[6]!==s?(c=a&&kP(s)?n?o.jsx(h1e,{virtualMcpId:s.id}):o.jsx(S1e,{virtualMcpId:s.id}):null,e[4]=n,e[5]=a,e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==c?(d=o.jsxs("div",{className:"flex items-center gap-2",children:[l,c]}),e[8]=l,e[9]=c,e[10]=d):d=e[10],d}const V1e=10080*60*1e3;function T1e({sandboxMap:t,userId:e,rawBranches:s,now:n}){const i=new Map;for(const[u,f]of Object.entries(t??{}))for(const[p,m]of Object.entries(f??{})){let g=i.get(p);g||(g={userIds:new Set,lastActiveAt:0},i.set(p,g)),g.userIds.add(u);for(const x of Object.values(m??{})){const b=x?.createdAt??0;b>g.lastActiveAt&&(g.lastActiveAt=b)}}const r=n-V1e,a=[...i.entries()].filter(([,u])=>u.lastActiveAt>=r).sort((u,f)=>f[1].lastActiveAt-u[1].lastActiveAt).map(([u,f])=>({name:u,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),l=new Set(a.map(u=>u.name)),c=new Set(Object.keys(t?.[e]??{})),d=[...c].filter(u=>!l.has(u)).sort().map(u=>({name:u,source:"yours"})),h=s.filter(u=>!c.has(u.name)&&!l.has(u.name)).map(u=>({name:u.name,source:"other",author:u.author??null}));return{recent:a,yours:d,others:h}}const A1e=100,P1e=50,E1e=300;function C2(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function R1e(t){const e=F.c(46),{orgId:s,orgSlug:n,userId:i,target:r,sandboxMap:a,owner:l,repo:c,search:d,enabled:h}=t,u=d===void 0?"":d,f=h===void 0?!0:h;let p;e[0]!==u?(p=u.trim(),e[0]=u,e[1]=p):p=e[1];const m=p,g=L9(m,E1e);let x;e[2]!==r?(x=wg(r),e[2]=r,e[3]=x):x=e[3];const b=x,v=m.length>0;let L;e[4]!==g||e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==c||e[9]!==r?(L=tt.githubBranchSearch(s,n,$8(r),l,c,g),e[4]=g,e[5]=s,e[6]=n,e[7]=l,e[8]=c,e[9]=r,e[10]=L):L=e[10];const _=f&&b;let y;e[11]!==g||e[12]!==n||e[13]!==r?(y=W=>{const{pageParam:K}=W;return R2(n,"REPOSITORY_SEARCH_BRANCHES",{...r,query:g,limit:g?P1e:A1e,cursor:K})},e[11]=g,e[12]=n,e[13]=r,e[14]=y):y=e[14];let w;e[15]!==g?(w=W=>g?void 0:W.nextCursor??void 0,e[15]=g,e[16]=w):w=e[16];let S;e[17]!==L||e[18]!==_||e[19]!==y||e[20]!==w?(S={queryKey:L,enabled:_,staleTime:3e4,retry:!1,initialPageParam:null,queryFn:y,getNextPageParam:w},e[17]=L,e[18]=_,e[19]=y,e[20]=w,e[21]=S):S=e[21];const{data:k,isLoading:j,isError:C,isFetching:V,hasNextPage:N,isFetchingNextPage:A,fetchNextPage:P}=w7(S),R=v&&(g!==m||V);let E,I,D;if(e[22]!==k?.pages||e[23]!==a||e[24]!==m||e[25]!==i){const W=(k?.pages??[]).flatMap(D1e);E=T1e({sandboxMap:a,userId:i,rawBranches:W,now:Date.now()});let K;e[29]!==m?(K=Y=>C2(Y.name,m),e[29]=m,e[30]=K):K=e[30],I=E.recent.filter(K);let G;e[31]!==m?(G=Y=>C2(Y.name,m),e[31]=m,e[32]=G):G=e[32],D=E.yours.filter(G),e[22]=k?.pages,e[23]=a,e[24]=m,e[25]=i,e[26]=E,e[27]=I,e[28]=D}else E=e[26],I=e[27],D=e[28];const O=D,B=E.others,M=k?.pages[0],z=v&&M&&!R?Math.max(0,M.totalCount-M.branches.length):0,$=!v&&N;let U;e[33]!==P?(U=()=>{P()},e[33]=P,e[34]=U):U=e[34];let H;return e[35]!==z||e[36]!==C||e[37]!==A||e[38]!==j||e[39]!==R||e[40]!==B||e[41]!==I||e[42]!==$||e[43]!==U||e[44]!==O?(H={recent:I,yours:O,others:B,isLoading:j,isError:C,isSearching:R,hiddenMatchCount:z,hasMore:$,isFetchingMore:A,fetchMore:U},e[35]=z,e[36]=C,e[37]=A,e[38]=j,e[39]=R,e[40]=B,e[41]=I,e[42]=$,e[43]=U,e[44]=O,e[45]=H):H=e[45],H}function D1e(t){return t.branches}function M1e(t){const e=F.c(189),{virtualMcpId:s,userLabel:n,value:i,baseBranch:r,orgId:a,orgSlug:l,userId:c,target:d,owner:h,repo:u,sandboxMap:f,onChange:p,onCreateBranch:m,disabled:g,spawnsNewChat:x,placement:b}=t,v=g===void 0?!1:g,L=x===void 0?!1:x,_=b===void 0?"chat":b,y=ae(),w=_==="header",[S,k]=T.useState(!1),[j,C]=T.useState(!1),[V,N]=T.useState(null),[A,P]=T.useState(""),[R,E]=T.useState(null),{releases:I,createRelease:D,renameRelease:O,deleteRelease:B}=k9(s),M=!!i&&i===r;let z,$,U,H,W,K,G,Y,Z,te,X,ee,J,Q,oe,le,de,se,ie,he,ue,ce,ne,q,fe,ge,_e;if(e[0]!==r||e[1]!==D||e[2]!==B||e[3]!==v||e[4]!==A||e[5]!==M||e[6]!==w||e[7]!==p||e[8]!==m||e[9]!==S||e[10]!==R||e[11]!==I||e[12]!==O||e[13]!==y||e[14]!==n||e[15]!==i){let Ge;e[43]!==i?(Ge=at=>at.branch===i,e[43]=i,e[44]=Ge):Ge=e[44];const wt=I.find(Ge);_e=!M&&!wt&&!!i;const Pt=M?y("thread.branchPicker.live"):wt?.name??y("thread.branchPicker.defaultVersionName");te=i?Pt:y("thread.branchPicker.selectVersion");const Zt=M?"bg-success":N1(wt?.color??"orange");let Dt;e[45]!==p?(Dt=at=>{p(at),k(!1)},e[45]=p,e[46]=Dt):Dt=e[46],X=Dt;let $e;e[47]!==y?($e=at=>{ye.error(at instanceof Error?at.message:y("thread.branchPicker.saveError"))},e[47]=y,e[48]=$e):$e=e[48];const Lt=$e;let Se;e[49]!==D||e[50]!==p||e[51]!==I||e[52]!==Lt?(Se=(at,rs)=>{I.some(_r=>_r.branch===at)||D({branch:at,name:rs.trim()||at,color:Th(I.length),createdAt:new Date().toISOString()}).catch(Lt),p(at),C(!1),k(!1)},e[49]=D,e[50]=p,e[51]=I,e[52]=Lt,e[53]=Se):Se=e[53],K=Se;let Ye;e[54]!==D||e[55]!==p||e[56]!==m||e[57]!==I||e[58]!==Lt||e[59]!==y||e[60]!==n?(Ye=()=>{const at=Gc(n);D({branch:at,name:ep(I,y("thread.branchPicker.defaultVersionName")),color:Th(I.length),createdAt:new Date().toISOString()}).catch(Lt),(m??p)(at),k(!1)},e[54]=D,e[55]=p,e[56]=m,e[57]=I,e[58]=Lt,e[59]=y,e[60]=n,e[61]=Ye):Ye=e[61],Z=Ye;let ot;e[62]===Symbol.for("react.memo_cache_sentinel")?(ot=()=>{N(null),P(""),C(!1)},e[62]=ot):ot=e[62];const es=ot;let xe;e[63]===Symbol.for("react.memo_cache_sentinel")?(xe=at=>{N(at.branch),P(at.name)},e[63]=xe):xe=e[63],Q=xe;let De;e[64]!==A||e[65]!==O||e[66]!==Lt?(De=at=>{const rs=A.trim();rs&&O(at,rs).catch(Lt),N(null),P("")},e[64]=A,e[65]=O,e[66]=Lt,e[67]=De):De=e[67],ee=De;let Je;e[68]!==D||e[69]!==A||e[70]!==I.length||e[71]!==i?(Je=()=>{const at=A.trim();at&&i&&D({branch:i,name:at,color:Th(I.length),createdAt:new Date().toISOString()}),N(null),P("")},e[68]=D,e[69]=A,e[70]=I.length,e[71]=i,e[72]=Je):Je=e[72],J=Je;let Ie;e[73]===Symbol.for("react.memo_cache_sentinel")?(Ie=()=>{N(null),P("")},e[73]=Ie):Ie=e[73],G=Ie;let pt;e[74]!==r||e[75]!==B||e[76]!==R||e[77]!==X||e[78]!==I||e[79]!==Lt||e[80]!==i?(pt=()=>{const at=R;if(E(null),!!at){if(at.branch===i){const rs=I.find(_r=>_r.branch!==at.branch);rs?X(rs.branch):r?X(r):k(!1)}else k(!1);B(at.branch).catch(Lt)}},e[74]=r,e[75]=B,e[76]=R,e[77]=X,e[78]=I,e[79]=Lt,e[80]=i,e[81]=pt):pt=e[81],Y=pt,W=js,ie=S,e[82]!==v?(he=v?void 0:at=>{at||es(),k(at)},e[82]=v,e[83]=he):he=e[83],H=We,U=He,se=!0,de="inline-flex min-w-0 shrink",$=ws,le=!0,z=me,ce=fg.branchPicker,ne=w?"outline":"ghost",q=w?"sm":"default",fe=te,ge=v;const Et=w?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[84]!==Et?(oe=re("shrink min-w-0 max-w-[220px] gap-2",Et,y7),e[84]=Et,e[85]=oe):oe=e[85],ue=re("h-2 w-2 shrink-0 rounded-full",i?Zt:"bg-muted-foreground"),e[0]=r,e[1]=D,e[2]=B,e[3]=v,e[4]=A,e[5]=M,e[6]=w,e[7]=p,e[8]=m,e[9]=S,e[10]=R,e[11]=I,e[12]=O,e[13]=y,e[14]=n,e[15]=i,e[16]=z,e[17]=$,e[18]=U,e[19]=H,e[20]=W,e[21]=K,e[22]=G,e[23]=Y,e[24]=Z,e[25]=te,e[26]=X,e[27]=ee,e[28]=J,e[29]=Q,e[30]=oe,e[31]=le,e[32]=de,e[33]=se,e[34]=ie,e[35]=he,e[36]=ue,e[37]=ce,e[38]=ne,e[39]=q,e[40]=fe,e[41]=ge,e[42]=_e}else z=e[16],$=e[17],U=e[18],H=e[19],W=e[20],K=e[21],G=e[22],Y=e[23],Z=e[24],te=e[25],X=e[26],ee=e[27],J=e[28],Q=e[29],oe=e[30],le=e[31],de=e[32],se=e[33],ie=e[34],he=e[35],ue=e[36],ce=e[37],ne=e[38],q=e[39],fe=e[40],ge=e[41],_e=e[42];let Le;e[86]!==ue?(Le=o.jsx("span",{className:ue}),e[86]=ue,e[87]=Le):Le=e[87];let je;e[88]!==te?(je=o.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:te}),e[88]=te,e[89]=je):je=e[89];let Ce;e[90]!==v?(Ce=!v&&o.jsx(hs,{size:12,className:"opacity-60 shrink-0"}),e[90]=v,e[91]=Ce):Ce=e[91];let Pe;e[92]!==z||e[93]!==oe||e[94]!==Le||e[95]!==je||e[96]!==Ce||e[97]!==ce||e[98]!==ne||e[99]!==q||e[100]!==fe||e[101]!==ge?(Pe=o.jsxs(z,{"data-tour":ce,variant:ne,size:q,"aria-label":fe,disabled:ge,className:oe,children:[Le,je,Ce]}),e[92]=z,e[93]=oe,e[94]=Le,e[95]=je,e[96]=Ce,e[97]=ce,e[98]=ne,e[99]=q,e[100]=fe,e[101]=ge,e[102]=Pe):Pe=e[102];let pe;e[103]!==$||e[104]!==le||e[105]!==Pe?(pe=o.jsx($,{asChild:le,children:Pe}),e[103]=$,e[104]=le,e[105]=Pe,e[106]=pe):pe=e[106];let ke;e[107]!==de||e[108]!==pe?(ke=o.jsx("span",{className:de,children:pe}),e[107]=de,e[108]=pe,e[109]=ke):ke=e[109];let Te;e[110]!==U||e[111]!==se||e[112]!==ke?(Te=o.jsx(U,{asChild:se,children:ke}),e[110]=U,e[111]=se,e[112]=ke,e[113]=Te):Te=e[113];let we;e[114]!==te?(we=o.jsx(Ke,{children:te}),e[114]=te,e[115]=we):we=e[115];let Ne;e[116]!==H||e[117]!==Te||e[118]!==we?(Ne=o.jsxs(H,{children:[Te,we]}),e[116]=H,e[117]=Te,e[118]=we,e[119]=Ne):Ne=e[119];let Oe;e[120]!==L||e[121]!==y?(Oe=L&&o.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:y("thread.branchPicker.newChatHint")}),e[120]=L,e[121]=y,e[122]=Oe):Oe=e[122];let nt;e[123]!==K||e[124]!==j||e[125]!==G||e[126]!==Z||e[127]!==A||e[128]!==V||e[129]!==S||e[130]!==a||e[131]!==l||e[132]!==h||e[133]!==X||e[134]!==I||e[135]!==u||e[136]!==f||e[137]!==ee||e[138]!==J||e[139]!==Q||e[140]!==y||e[141]!==d||e[142]!==_e||e[143]!==c||e[144]!==i?(nt=j?o.jsx(O1e,{orgId:a,orgSlug:l,userId:c,target:d,owner:h,repo:u,sandboxMap:f,enabled:S,onBack:()=>C(!1),onAdopt:K}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col",children:[_e&&i&&(V===i?o.jsx(Xy,{value:A,onChange:P,onSave:J,onCancel:G}):o.jsx(Jy,{dot:N1("orange"),label:y("thread.branchPicker.defaultVersionName"),branch:i,selected:!0,onSelect:()=>X(i),onRename:()=>{N(i),P(ep(I,y("thread.branchPicker.defaultVersionName")))}})),I.map(Ge=>V===Ge.branch?o.jsx(Xy,{value:A,onChange:P,onSave:()=>ee(Ge.branch),onCancel:G},Ge.branch):o.jsx(Jy,{dot:N1(Ge.color),label:Ge.name,branch:Ge.branch,selected:Ge.branch===i,onSelect:()=>X(Ge.branch),onRename:()=>Q(Ge),onDelete:()=>E(Ge)},Ge.branch))]}),(_e||I.length>0)&&o.jsx("div",{className:"my-1 border-t"}),o.jsxs("button",{type:"button",onClick:()=>{Z()},className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm text-muted-foreground hover:bg-accent hover:text-foreground",children:[o.jsx(Qt,{className:"h-4 w-4 shrink-0"}),y("thread.branchPicker.newVersion")]}),o.jsxs("button",{type:"button",onClick:()=>C(!0),className:"flex w-full items-center justify-between gap-2 rounded-md px-2 py-2 text-left text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[y("thread.branchPicker.advanced"),o.jsx(Ns,{className:"h-4 w-4 shrink-0"})]})]}),e[123]=K,e[124]=j,e[125]=G,e[126]=Z,e[127]=A,e[128]=V,e[129]=S,e[130]=a,e[131]=l,e[132]=h,e[133]=X,e[134]=I,e[135]=u,e[136]=f,e[137]=ee,e[138]=J,e[139]=Q,e[140]=y,e[141]=d,e[142]=_e,e[143]=c,e[144]=i,e[145]=nt):nt=e[145];let Fe;e[146]!==Oe||e[147]!==nt?(Fe=o.jsxs(ks,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:I1e,children:[Oe,nt]}),e[146]=Oe,e[147]=nt,e[148]=Fe):Fe=e[148];let yt;e[149]!==W||e[150]!==ie||e[151]!==he||e[152]!==Ne||e[153]!==Fe?(yt=o.jsxs(W,{open:ie,onOpenChange:he,children:[Ne,Fe]}),e[149]=W,e[150]=ie,e[151]=he,e[152]=Ne,e[153]=Fe,e[154]=yt):yt=e[154];const it=yt,st=R!==null;let ft;e[155]===Symbol.for("react.memo_cache_sentinel")?(ft=Ge=>{Ge||E(null)},e[155]=ft):ft=e[155];let _t;e[156]!==y?(_t=y("thread.branchPicker.deleteTitle"),e[156]=y,e[157]=_t):_t=e[157];let mt;e[158]!==_t?(mt=o.jsx(Xr,{children:_t}),e[158]=_t,e[159]=mt):mt=e[159];let Ze;e[160]!==R||e[161]!==y?(Ze=R&&y("thread.branchPicker.deleteConfirm",{name:R.name}),e[160]=R,e[161]=y,e[162]=Ze):Ze=e[162];let rt;e[163]!==Ze?(rt=o.jsx(Jr,{children:Ze}),e[163]=Ze,e[164]=rt):rt=e[164];let xt;e[165]!==mt||e[166]!==rt?(xt=o.jsxs(Qr,{children:[mt,rt]}),e[165]=mt,e[166]=rt,e[167]=xt):xt=e[167];let be;e[168]!==y?(be=y("thread.branchPicker.cancel"),e[168]=y,e[169]=be):be=e[169];let Re;e[170]!==be?(Re=o.jsx(eo,{children:be}),e[170]=be,e[171]=Re):Re=e[171];let Me;e[172]!==y?(Me=y("thread.branchPicker.delete"),e[172]=y,e[173]=Me):Me=e[173];let dt;e[174]!==Y||e[175]!==Me?(dt=o.jsx(to,{onClick:Y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Me}),e[174]=Y,e[175]=Me,e[176]=dt):dt=e[176];let ut;e[177]!==Re||e[178]!==dt?(ut=o.jsxs(Zr,{children:[Re,dt]}),e[177]=Re,e[178]=dt,e[179]=ut):ut=e[179];let ht;e[180]!==xt||e[181]!==ut?(ht=o.jsxs(Yr,{children:[xt,ut]}),e[180]=xt,e[181]=ut,e[182]=ht):ht=e[182];let ct;e[183]!==st||e[184]!==ht?(ct=o.jsx(Gr,{open:st,onOpenChange:ft,children:ht}),e[183]=st,e[184]=ht,e[185]=ct):ct=e[185];let lt;return e[186]!==it||e[187]!==ct?(lt=o.jsxs(o.Fragment,{children:[it,ct]}),e[186]=it,e[187]=ct,e[188]=lt):lt=e[188],lt}function I1e(t){return t.preventDefault()}function Xy(t){const e=F.c(20),{value:s,onChange:n,onSave:i,onCancel:r}=t,a=ae();let l;e[0]!==a?(l=a("thread.branchPicker.rename"),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==n?(c=m=>n(m.target.value),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==r||e[5]!==i?(d=m=>{m.key==="Enter"&&i(),m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r())},e[4]=r,e[5]=i,e[6]=d):d=e[6];let h;e[7]!==l||e[8]!==c||e[9]!==d||e[10]!==s?(h=o.jsx("input",{autoFocus:!0,"aria-label":l,value:s,onChange:c,onKeyDown:d,className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),e[7]=l,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11];let u;e[12]!==a?(u=a("thread.branchPicker.save"),e[12]=a,e[13]=u):u=e[13];let f;e[14]!==i||e[15]!==u?(f=o.jsx(me,{size:"sm",onClick:i,children:u}),e[14]=i,e[15]=u,e[16]=f):f=e[16];let p;return e[17]!==h||e[18]!==f?(p=o.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[h,f]}),e[17]=h,e[18]=f,e[19]=p):p=e[19],p}function Jy(t){const e=F.c(45),{dot:s,label:n,branch:i,selected:r,onSelect:a,onRename:l,onDelete:c}=t,d=ae(),h=r?"bg-accent":"hover:bg-accent/60";let u;e[0]!==h?(u=re("group flex items-center rounded-md",h),e[0]=h,e[1]=u):u=e[1];let f;e[2]!==s?(f=re("h-2 w-2 shrink-0 rounded-full",s),e[2]=s,e[3]=f):f=e[3];let p;e[4]!==f?(p=o.jsx("span",{className:f}),e[4]=f,e[5]=p):p=e[5];let m;e[6]!==n?(m=o.jsx("span",{className:"flex-1 truncate",children:n}),e[6]=n,e[7]=m):m=e[7];let g;e[8]!==a||e[9]!==r||e[10]!==p||e[11]!==m?(g=o.jsx(He,{asChild:!0,children:o.jsxs("button",{type:"button","aria-pressed":r,onClick:a,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[p,m]})}),e[8]=a,e[9]=r,e[10]=p,e[11]=m,e[12]=g):g=e[12];let x;e[13]!==i||e[14]!==d?(x=d("thread.branchPicker.branchTooltip",{branch:i}),e[13]=i,e[14]=d,e[15]=x):x=e[15];let b;e[16]!==x?(b=o.jsx(Ke,{side:"bottom",className:"font-mono text-xs",children:x}),e[16]=x,e[17]=b):b=e[17];let v;e[18]!==g||e[19]!==b?(v=o.jsxs(We,{children:[g,b]}),e[18]=g,e[19]=b,e[20]=v):v=e[20];let L;e[21]!==d?(L=d("thread.branchPicker.moreActions"),e[21]=d,e[22]=L):L=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(c0,{className:"h-4 w-4"}),e[23]=_):_=e[23];let y;e[24]!==L?(y=o.jsx($t,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":L,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:_})}),e[24]=L,e[25]=y):y=e[25];let w;e[26]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(_9,{className:"h-4 w-4"}),e[26]=w):w=e[26];let S;e[27]!==d?(S=d("thread.branchPicker.rename"),e[27]=d,e[28]=S):S=e[28];let k;e[29]!==l||e[30]!==S?(k=o.jsxs(Qe,{onSelect:l,children:[w,S]}),e[29]=l,e[30]=S,e[31]=k):k=e[31];let j;e[32]!==c||e[33]!==d?(j=c&&o.jsxs(Qe,{onSelect:c,className:"text-destructive focus:text-destructive",children:[o.jsx(rn,{className:"h-4 w-4"}),d("thread.branchPicker.delete")]}),e[32]=c,e[33]=d,e[34]=j):j=e[34];let C;e[35]!==k||e[36]!==j?(C=o.jsxs(Bt,{align:"end",children:[k,j]}),e[35]=k,e[36]=j,e[37]=C):C=e[37];let V;e[38]!==y||e[39]!==C?(V=o.jsxs(Ot,{children:[y,C]}),e[38]=y,e[39]=C,e[40]=V):V=e[40];let N;return e[41]!==V||e[42]!==u||e[43]!==v?(N=o.jsxs("div",{className:u,children:[v,V]}),e[41]=V,e[42]=u,e[43]=v,e[44]=N):N=e[44],N}function O1e(t){const e=F.c(94),{orgId:s,orgSlug:n,userId:i,target:r,owner:a,repo:l,sandboxMap:c,enabled:d,onBack:h,onAdopt:u}=t,f=ae(),[p,m]=T.useState("branches"),[g,x]=T.useState(""),b=p==="branches"?g:"",v=d&&p==="branches";let L;e[0]!==s||e[1]!==n||e[2]!==a||e[3]!==l||e[4]!==c||e[5]!==b||e[6]!==v||e[7]!==r||e[8]!==i?(L={orgId:s,orgSlug:n,userId:i,target:r,sandboxMap:c,owner:a,repo:l,search:b,enabled:v},e[0]=s,e[1]=n,e[2]=a,e[3]=l,e[4]=c,e[5]=b,e[6]=v,e[7]=r,e[8]=i,e[9]=L):L=e[9];const{recent:_,yours:y,others:w,isLoading:S,hasMore:k,isFetchingMore:j,fetchMore:C}=R1e(L),V=d&&p==="prs";let N;e[10]!==s||e[11]!==n||e[12]!==a||e[13]!==l||e[14]!==V||e[15]!==r?(N={orgId:s,orgSlug:n,target:r,owner:a,repo:l,enabled:V},e[10]=s,e[11]=n,e[12]=a,e[13]=l,e[14]=V,e[15]=r,e[16]=N):N=e[16];const{data:A,isLoading:P}=$P(N);let R,E,I,D,O,B,M,z,$;if(e[17]!==C||e[18]!==k||e[19]!==j||e[20]!==S||e[21]!==u||e[22]!==h||e[23]!==w||e[24]!==a||e[25]!==P||e[26]!==_||e[27]!==l||e[28]!==g||e[29]!==f||e[30]!==A||e[31]!==p||e[32]!==y){const K=A===void 0?[]:A,G=`${a}/${l}`;let Y;e[42]!==G?(Y=G.toLowerCase(),e[42]=G,e[43]=Y):Y=e[43];const Z=Y;let te;e[44]!==Z?(te=ne=>ne.headRepoFullName?.toLowerCase()===Z,e[44]=Z,e[45]=te):te=e[45];const X=K.filter(te);let ee;if(e[46]!==w||e[47]!==_||e[48]!==y){const ne=new Set;ee=[..._,...y,...w].filter(q=>ne.has(q.name)?!1:(ne.add(q.name),!0)),e[46]=w,e[47]=_,e[48]=y,e[49]=ee}else ee=e[49];const J=ee;O="flex flex-col";let Q;e[50]===Symbol.for("react.memo_cache_sentinel")?(Q=o.jsx(Qh,{className:"h-4 w-4 shrink-0"}),e[50]=Q):Q=e[50];let oe;e[51]!==f?(oe=f("thread.branchPicker.advancedBack"),e[51]=f,e[52]=oe):oe=e[52],e[53]!==h||e[54]!==oe?(B=o.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[Q,oe]}),e[53]=h,e[54]=oe,e[55]=B):B=e[55],E=vr,$=p==="branches"?$1e:void 0;let le;e[56]!==f||e[57]!==p?(le=f(p==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[56]=f,e[57]=p,e[58]=le):le=e[58],e[59]!==g||e[60]!==le?(I=o.jsx(Mi,{placeholder:le,value:g,onValueChange:x}),e[59]=g,e[60]=le,e[61]=I):I=e[61];let de;e[62]===Symbol.for("react.memo_cache_sentinel")?(de=ne=>{m(ne),x("")},e[62]=de):de=e[62];let se;e[63]!==f?(se=f("thread.branchPicker.branchesTab"),e[63]=f,e[64]=se):se=e[64];let ie;e[65]!==se?(ie=o.jsx(or,{value:"branches",className:"h-6 px-2.5 text-xs",children:se}),e[65]=se,e[66]=ie):ie=e[66];let he;e[67]!==f?(he=f("thread.branchPicker.prsTab"),e[67]=f,e[68]=he):he=e[68];let ue;e[69]!==he?(ue=o.jsx(or,{value:"prs",className:"h-6 px-2.5 text-xs",children:he}),e[69]=he,e[70]=ue):ue=e[70];let ce;e[71]!==ie||e[72]!==ue?(ce=o.jsxs(t0,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[ie,ue]}),e[71]=ie,e[72]=ue,e[73]=ce):ce=e[73],e[74]!==ce||e[75]!==p?(D=o.jsx(ad,{className:"px-2 pt-2 pb-1",value:p,onValueChange:de,children:ce}),e[74]=ce,e[75]=p,e[76]=D):D=e[76],R=Ii,e[77]!==C||e[78]!==p?(M=ne=>{const q=ne.currentTarget;p==="branches"&&q.scrollHeight-q.scrollTop-q.clientHeight<48&&C()},e[77]=C,e[78]=p,e[79]=M):M=e[79],z=p==="branches"?o.jsxs(o.Fragment,{children:[S&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingMore")}),!S&&J.length===0&&o.jsx(ri,{children:f("thread.branchPicker.noBranchesFound")}),J.length>0&&o.jsx(fn,{children:J.map(ne=>o.jsxs($s,{value:ne.name,className:"cursor-pointer",onSelect:()=>u(ne.name,ne.name),children:[o.jsx(qr,{className:"mr-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:ne.name})]},ne.name))}),k&&o.jsx("div",{className:"p-2",children:o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:j,onClick:C,children:f(j?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})})]}):o.jsxs(o.Fragment,{children:[P&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingPullRequests")}),!P&&X.length===0&&o.jsx(ri,{children:f("thread.branchPicker.noOpenPullRequests")}),X.length>0&&o.jsx(fn,{children:X.map(ne=>o.jsxs($s,{value:`#${ne.number} ${ne.title} ${ne.head}`,className:"cursor-pointer",onSelect:()=>u(ne.head,Ka(ne.title)),children:[o.jsx(Fo,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate",children:Ka(ne.title)}),o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",ne.number," · ",ne.head]})]})]},ne.number))})]}),e[17]=C,e[18]=k,e[19]=j,e[20]=S,e[21]=u,e[22]=h,e[23]=w,e[24]=a,e[25]=P,e[26]=_,e[27]=l,e[28]=g,e[29]=f,e[30]=A,e[31]=p,e[32]=y,e[33]=R,e[34]=E,e[35]=I,e[36]=D,e[37]=O,e[38]=B,e[39]=M,e[40]=z,e[41]=$}else R=e[33],E=e[34],I=e[35],D=e[36],O=e[37],B=e[38],M=e[39],z=e[40],$=e[41];let U;e[80]!==R||e[81]!==M||e[82]!==z?(U=o.jsx(R,{onScroll:M,children:z}),e[80]=R,e[81]=M,e[82]=z,e[83]=U):U=e[83];let H;e[84]!==E||e[85]!==I||e[86]!==D||e[87]!==U||e[88]!==$?(H=o.jsxs(E,{filter:$,children:[I,D,U]}),e[84]=E,e[85]=I,e[86]=D,e[87]=U,e[88]=$,e[89]=H):H=e[89];let W;return e[90]!==O||e[91]!==B||e[92]!==H?(W=o.jsxs("div",{className:O,children:[B,H]}),e[90]=O,e[91]=B,e[92]=H,e[93]=W):W=e[93],W}function $1e(t,e){return C2(t,e)?1:0}function B1e(t){const e=F.c(16),{locked:s,placement:n,value:i,virtualMcpId:r,userLabel:a,baseBranch:l,onChange:c,onCreateBranch:d,orgId:h,orgSlug:u,userId:f,target:p,owner:m,repo:g,sandboxMap:x}=t;let b;return e[0]!==l||e[1]!==s||e[2]!==c||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==m||e[7]!==n||e[8]!==g||e[9]!==x||e[10]!==p||e[11]!==f||e[12]!==a||e[13]!==i||e[14]!==r?(b=o.jsx(M1e,{virtualMcpId:r,userLabel:a,value:i,baseBranch:l,orgId:h,orgSlug:u,userId:f,target:p,owner:m,repo:g,sandboxMap:x,onChange:c,onCreateBranch:d,spawnsNewChat:s,placement:n}),e[0]=l,e[1]=s,e[2]=c,e[3]=d,e[4]=h,e[5]=u,e[6]=m,e[7]=n,e[8]=g,e[9]=x,e[10]=p,e[11]=f,e[12]=a,e[13]=i,e[14]=r,e[15]=b):b=e[15],b}function z1e(t){const e=F.c(2),{branchPill:s}=t;if(!s)return null;let n;return e[0]!==s?(n=o.jsx(o.Fragment,{children:s}),e[0]=s,e[1]=n):n=e[1],n}function F1e(t){const e=F.c(19),{virtualMcp:s,currentBranch:n}=t,i=D2(),r=Ts();let a;e[0]!==i?.messages||e[1]!==r?.isThreadLocked?(a=(i?.messages??[]).length>0||(r?.isThreadLocked??!1),e[0]=i?.messages,e[1]=r?.isThreadLocked,e[2]=a):a=e[2];const l=a,c=r?.setCurrentTaskBranch,d=r?.createTask;let h;e[3]!==r?.activeTask?.metadata||e[4]!==s?.metadata?(h=i9(s?.metadata)==="cms"&&H6(r?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=r?.activeTask?.metadata,e[4]=s?.metadata,e[5]=h):h=e[5];const u=h,f=aa(s),p=Un(f),{data:m}=On.useSession(),g=m?.user;let x;e[6]!==g?(x=Kg(g),e[6]=g,e[7]=x):x=e[7];const b=x,v=m?.user?.id??"",{org:L}=Ue(),_=Lg(s,n);let y;e[8]!==d||e[9]!==l||e[10]!==c?(y=V=>{l&&d?d({branch:V}):c&&c(V)},e[8]=d,e[9]=l,e[10]=c,e[11]=y):y=e[11];const w=y;let S;e[12]!==u||e[13]!==d||e[14]!==l||e[15]!==c?(S=V=>{(l||u)&&d?d({branch:V}):c&&c(V)},e[12]=u,e[13]=d,e[14]=l,e[15]=c,e[16]=S):S=e[16];const k=S,j=f&&wg(p)?o.jsx(B1e,{userLabel:b,virtualMcpId:s?.id??"",value:n,baseBranch:_,orgId:L.id,orgSlug:L.slug,userId:v,target:p,owner:f.owner,repo:f.name,sandboxMap:s?.metadata?.sandboxMap,onChange:w,onCreateBranch:k,locked:l,placement:"chat"},`${$8(p)}:${f.owner}/${f.name}`):null;let C;return e[17]!==j?(C=o.jsx(z1e,{branchPill:j}),e[17]=j,e[18]=C):C=e[18],C}function U1e(){const t=F.c(20),e=ae(),{threads:s}=s9(),{createNewTask:n}=oa(),i=M8(),r=l0();let a;t[0]!==r||t[1]!==s?(a=s.find(x=>x.id===r)?.branch??null,t[0]=r,t[1]=s,t[2]=a):a=t[2];const l=a;let c;t[3]!==i||t[4]!==n||t[5]!==l?(c=()=>{n(i,l)},t[3]=i,t[4]=n,t[5]=l,t[6]=c):c=t[6];const d=c;let h;t[7]!==e?(h=e("sidebar.taskGroupsList.newChat"),t[7]=e,t[8]=h):h=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Zu,{size:16}),t[9]=u):u=t[9];let f;t[10]!==d||t[11]!==h?(f=o.jsx(He,{asChild:!0,children:o.jsx("button",{type:"button",onClick:d,"aria-label":h,className:"flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:u})}),t[10]=d,t[11]=h,t[12]=f):f=t[12];let p;t[13]!==e?(p=e("sidebar.taskGroupsList.newChat"),t[13]=e,t[14]=p):p=t[14];let m;t[15]!==p?(m=o.jsx(Ke,{side:"bottom",children:p}),t[15]=p,t[16]=m):m=t[16];let g;return t[17]!==f||t[18]!==m?(g=o.jsxs(We,{children:[f,m]}),t[17]=f,t[18]=m,t[19]=g):g=t[19],g}function jm(t){const e=F.c(13),{label:s,value:n,onChange:i,options:r}=t;let a;e[0]!==s?(a=o.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let l;e[2]!==i?(l=u=>u&&i(u),e[2]=i,e[3]=l):l=e[3];let c;e[4]!==r?(c=r.map(H1e),e[4]=r,e[5]=c):c=e[5];let d;e[6]!==l||e[7]!==c||e[8]!==n?(d=o.jsx(d9,{type:"single",size:"sm",value:n,onValueChange:l,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=l,e[7]=c,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==a||e[11]!==d?(h=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a,d]}),e[10]=a,e[11]=d,e[12]=h):h=e[12],h}function H1e(t){return o.jsxs(Kc,{value:t.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[t.icon,t.label]},t.value)}function K1e(t){const e=F.c(91),{panel:s,className:n}=t,i=n===void 0?"md:size-[34px] rounded-lg":n,r=ae();let a;e[0]!==r?(a=r("sidebar.taskGroupsList.filterChats"),e[0]=r,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(ag,{size:16}),e[2]=l):l=e[2];let c;e[3]!==s.filtersActive?(c=s.filtersActive&&o.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"}),e[3]=s.filtersActive,e[4]=c):c=e[4];let d;e[5]!==i||e[6]!==s.filtersActive||e[7]!==a||e[8]!==c?(d=o.jsx(He,{asChild:!0,children:o.jsx(ws,{asChild:!0,children:o.jsxs($o,{"aria-label":a,active:s.filtersActive,className:i,children:[l,c]})})}),e[5]=i,e[6]=s.filtersActive,e[7]=a,e[8]=c,e[9]=d):d=e[9];let h;e[10]!==r?(h=r("sidebar.taskGroupsList.filterChats"),e[10]=r,e[11]=h):h=e[11];let u;e[12]!==h?(u=o.jsx(Ke,{side:"bottom",children:h}),e[12]=h,e[13]=u):u=e[13];let f;e[14]!==d||e[15]!==u?(f=o.jsxs(We,{children:[d,u]}),e[14]=d,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==r?(p=r("sidebar.taskGroupsList.filterView"),e[17]=r,e[18]=p):p=e[18];const m=s.groupBy;let g;e[19]!==s?(g=Z=>{qe("tasks_panel_group_by_changed",{to_value:Z}),s.setGroupBy(Z)},e[19]=s,e[20]=g):g=e[20];let x;e[21]!==r?(x=r("sidebar.taskGroupsList.viewList"),e[21]=r,e[22]=x):x=e[22];let b;e[23]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(SA,{size:13}),e[23]=b):b=e[23];let v;e[24]!==x?(v={value:"flat",label:x,icon:b},e[24]=x,e[25]=v):v=e[25];let L;e[26]!==r?(L=r("sidebar.taskGroupsList.viewStatus"),e[26]=r,e[27]=L):L=e[27];let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(kA,{size:13}),e[28]=_):_=e[28];let y;e[29]!==L?(y={value:"status",label:L,icon:_},e[29]=L,e[30]=y):y=e[30];let w;e[31]!==v||e[32]!==y?(w=[v,y],e[31]=v,e[32]=y,e[33]=w):w=e[33];let S;e[34]!==s.groupBy||e[35]!==g||e[36]!==w||e[37]!==p?(S=o.jsx(jm,{label:p,value:m,onChange:g,options:w}),e[34]=s.groupBy,e[35]=g,e[36]=w,e[37]=p,e[38]=S):S=e[38];let k;e[39]!==r?(k=r("sidebar.taskGroupsList.filterType"),e[39]=r,e[40]=k):k=e[40];const j=s.typeFilter;let C;e[41]!==s?(C=Z=>{qe("tasks_panel_filter_changed",{to_value:Z}),s.setTypeFilter(Z)},e[41]=s,e[42]=C):C=e[42];let V;e[43]!==r?(V=r("sidebar.taskGroupsList.typeAll"),e[43]=r,e[44]=V):V=e[44];let N;e[45]!==V?(N={value:"all",label:V},e[45]=V,e[46]=N):N=e[46];let A;e[47]!==r?(A=r("sidebar.taskGroupsList.typeChats"),e[47]=r,e[48]=A):A=e[48];let P;e[49]!==A?(P={value:"manual",label:A},e[49]=A,e[50]=P):P=e[50];let R;e[51]!==r?(R=r("sidebar.taskGroupsList.typeAuto"),e[51]=r,e[52]=R):R=e[52];let E;e[53]!==R?(E={value:"automation",label:R},e[53]=R,e[54]=E):E=e[54];let I;e[55]!==N||e[56]!==P||e[57]!==E?(I=[N,P,E],e[55]=N,e[56]=P,e[57]=E,e[58]=I):I=e[58];let D;e[59]!==s.typeFilter||e[60]!==k||e[61]!==C||e[62]!==I?(D=o.jsx(jm,{label:k,value:j,onChange:C,options:I}),e[59]=s.typeFilter,e[60]=k,e[61]=C,e[62]=I,e[63]=D):D=e[63];let O;e[64]!==r?(O=r("sidebar.taskGroupsList.filterScope"),e[64]=r,e[65]=O):O=e[65];const B=s.showAll?"team":"mine";let M;e[66]!==s?(M=Z=>s.setShowAll(Z==="team"),e[66]=s,e[67]=M):M=e[67];let z;e[68]!==r?(z=r("sidebar.taskGroupsList.scopeMine"),e[68]=r,e[69]=z):z=e[69];let $;e[70]!==z?($={value:"mine",label:z},e[70]=z,e[71]=$):$=e[71];let U;e[72]!==r?(U=r("sidebar.taskGroupsList.scopeTeam"),e[72]=r,e[73]=U):U=e[73];let H;e[74]!==U?(H={value:"team",label:U},e[74]=U,e[75]=H):H=e[75];let W;e[76]!==$||e[77]!==H?(W=[$,H],e[76]=$,e[77]=H,e[78]=W):W=e[78];let K;e[79]!==O||e[80]!==B||e[81]!==M||e[82]!==W?(K=o.jsx(jm,{label:O,value:B,onChange:M,options:W}),e[79]=O,e[80]=B,e[81]=M,e[82]=W,e[83]=K):K=e[83];let G;e[84]!==S||e[85]!==D||e[86]!==K?(G=o.jsxs(ks,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[S,D,K]}),e[84]=S,e[85]=D,e[86]=K,e[87]=G):G=e[87];let Y;return e[88]!==G||e[89]!==f?(Y=o.jsxs(js,{children:[f,G]}),e[88]=G,e[89]=f,e[90]=Y):Y=e[90],Y}function W1e(t,e){return t.filter(s=>s.id===e||!!s.trigger_id||P_(s))}function q1e(){const t=F.c(2),e=sl()??[];let s;return t[0]!==e?(s=n=>{if(!n)return;const i=e.find(r=>r.id===n);return i?i9(i.metadata):void 0},t[0]=e,t[1]=s):s=t[1],s}function G1e(t){const e=F.c(9),{virtualMcpId:s,size:n,showAutomationBadge:i}=t,r=n===void 0?"sm":n,a=ae();let l;e[0]!==r||e[1]!==s?(l=s?o.jsx(Y1e,{virtualMcpId:s,size:r}):o.jsx(Kr,{icon:null,name:"?",size:r}),e[0]=r,e[1]=s,e[2]=l):l=e[2];let c;e[3]!==i||e[4]!==a?(c=i&&o.jsx("span",{"aria-label":a("tasksPanel.mcpAvatar.automationTriggered"),className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:o.jsx(hr,{size:10,className:"text-white"})}),e[3]=i,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=o.jsxs("div",{className:"relative shrink-0",children:[l,c]}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function Y1e(t){const e=F.c(6),{virtualMcpId:s,size:n}=t,i=As(s);if(!i){let l;return e[0]!==n?(l=o.jsx(Kr,{icon:null,name:"?",size:n}),e[0]=n,e[1]=l):l=e[1],l}const r=i.icon??null;let a;return e[2]!==i.title||e[3]!==n||e[4]!==r?(a=o.jsx(Kr,{icon:r,name:i.title,size:n}),e[2]=i.title,e[3]=n,e[4]=r,e[5]=a):a=e[5],a}const Zy=["thread"];function Q1e(t){const e=F.c(53),{open:s,onOpenChange:n}=t,[i,r]=T.useState(""),{org:a}=Ue(),{setTaskId:l}=oa(),c=us(),d=ae();let h,u,f,p;e[0]!==a.id||e[1]!==i?(p=i.trim(),h=p?20:10,f=Yt,u=tt.globalSearch(a.id,p,h,Zy),e[0]=a.id,e[1]=i,e[2]=h,e[3]=u,e[4]=f,e[5]=p):(h=e[2],u=e[3],f=e[4],p=e[5]);let m;e[6]!==h||e[7]!==c||e[8]!==p?(m=async()=>{const O=await c.call("GLOBAL_SEARCH",{query:p,limit:h,types:[...Zy]});return{...O,items:O.items.filter(X1e)}},e[6]=h,e[7]=c,e[8]=p,e[9]=m):m=e[9];let g;e[10]!==s||e[11]!==u||e[12]!==m?(g={queryKey:u,enabled:s,queryFn:m,staleTime:1e4},e[10]=s,e[11]=u,e[12]=m,e[13]=g):g=e[13];const{data:x,isFetching:b}=f(g);let v;e[14]!==x?.items?(v=x?.items??[],e[14]=x?.items,e[15]=v):v=e[15];const L=v;let _;e[16]!==n?(_=O=>{O||r(""),n(O)},e[16]=n,e[17]=_):_=e[17];const y=_;let w;e[18]!==y||e[19]!==l?(w=O=>{y(!1),l(O.id,O.virtual_mcp_id??void 0)},e[18]=y,e[19]=l,e[20]=w):w=e[20];const S=w;let k;e[21]!==d?(k=d("tasksPanel.globalSearchDialog.title"),e[21]=d,e[22]=k):k=e[22];let j;e[23]!==k?(j=o.jsx(Kt,{children:k}),e[23]=k,e[24]=j):j=e[24];let C;e[25]!==d?(C=d("tasksPanel.globalSearchDialog.description"),e[25]=d,e[26]=C):C=e[26];let V;e[27]!==C?(V=o.jsx(Mn,{children:C}),e[27]=C,e[28]=V):V=e[28];let N;e[29]!==V||e[30]!==j?(N=o.jsxs(cs,{className:"sr-only",children:[j,V]}),e[29]=V,e[30]=j,e[31]=N):N=e[31];let A;e[32]!==d?(A=d("tasksPanel.globalSearchDialog.placeholder"),e[32]=d,e[33]=A):A=e[33];let P;e[34]!==i||e[35]!==A?(P=o.jsx(Mi,{value:i,onValueChange:r,placeholder:A}),e[34]=i,e[35]=A,e[36]=P):P=e[36];let R;e[37]!==S||e[38]!==b||e[39]!==L||e[40]!==d||e[41]!==p?(R=o.jsx(Ii,{children:b&&L.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:d("tasksPanel.globalSearchDialog.searching")}):L.length===0?o.jsx(ri,{children:d("tasksPanel.globalSearchDialog.noResults")}):o.jsx(fn,{heading:p?void 0:d("tasksPanel.globalSearchDialog.recent"),children:L.map(O=>O.type==="thread"?o.jsxs($s,{value:`thread:${O.id}:${O.title}`,onSelect:()=>S(O),className:"gap-2.5",children:[o.jsx(G1e,{virtualMcpId:O.virtual_mcp_id,size:"xs"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-foreground truncate",children:O.title||d("tasksPanel.globalSearchDialog.untitledChat")})}),o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date(O.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${O.id}`):null)})}),e[37]=S,e[38]=b,e[39]=L,e[40]=d,e[41]=p,e[42]=R):R=e[42];let E;e[43]!==P||e[44]!==R?(E=o.jsxs(vr,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[P,R]}),e[43]=P,e[44]=R,e[45]=E):E=e[45];let I;e[46]!==N||e[47]!==E?(I=o.jsxs(zt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[N,E]}),e[46]=N,e[47]=E,e[48]=I):I=e[48];let D;return e[49]!==y||e[50]!==s||e[51]!==I?(D=o.jsx(Ft,{open:s,onOpenChange:y,children:I}),e[49]=y,e[50]=s,e[51]=I,e[52]=D):D=e[52],D}function X1e(t){return t.type==="thread"}function J1e(t){const e=F.c(43),{branch:s,onOutcome:n}=t,i=ae();let r;e[0]!==n?(r=S=>{S||n("cancel")},e[0]=n,e[1]=r):r=e[1];let a;e[2]!==i?(a=i("sidebar.archiveWorktreeDialog.title"),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==a?(l=o.jsx(Xr,{children:a}),e[4]=a,e[5]=l):l=e[5];let c;e[6]!==i?(c=i("sidebar.archiveWorktreeDialog.stopsAndDeletesBefore"),e[6]=i,e[7]=c):c=e[7];let d;e[8]!==s?(d=o.jsx("span",{className:"font-mono",children:s}),e[8]=s,e[9]=d):d=e[9];let h;e[10]!==i?(h=i("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=i,e[11]=h):h=e[11];let u;e[12]!==c||e[13]!==d||e[14]!==h?(u=o.jsxs(Jr,{children:[c," ",d," ",h]}),e[12]=c,e[13]=d,e[14]=h,e[15]=u):u=e[15];let f;e[16]!==l||e[17]!==u?(f=o.jsxs(Qr,{children:[l,u]}),e[16]=l,e[17]=u,e[18]=f):f=e[18];let p;e[19]!==n?(p=()=>n("cancel"),e[19]=n,e[20]=p):p=e[20];let m;e[21]!==i?(m=i("sidebar.archiveWorktreeDialog.cancel"),e[21]=i,e[22]=m):m=e[22];let g;e[23]!==m||e[24]!==p?(g=o.jsx(eo,{onClick:p,children:m}),e[23]=m,e[24]=p,e[25]=g):g=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=re(A6({variant:"destructive"})),e[26]=x):x=e[26];let b;e[27]!==n?(b=()=>n("confirm"),e[27]=n,e[28]=b):b=e[28];let v;e[29]!==i?(v=i("sidebar.archiveWorktreeDialog.confirm"),e[29]=i,e[30]=v):v=e[30];let L;e[31]!==b||e[32]!==v?(L=o.jsx(to,{className:x,onClick:b,children:v}),e[31]=b,e[32]=v,e[33]=L):L=e[33];let _;e[34]!==g||e[35]!==L?(_=o.jsxs(Zr,{children:[g,L]}),e[34]=g,e[35]=L,e[36]=_):_=e[36];let y;e[37]!==_||e[38]!==f?(y=o.jsxs(Yr,{children:[f,_]}),e[37]=_,e[38]=f,e[39]=y):y=e[39];let w;return e[40]!==r||e[41]!==y?(w=o.jsx(Gr,{open:!0,onOpenChange:r,children:y}),e[40]=r,e[41]=y,e[42]=w):w=e[42],w}function Z1e(t,e,s){if(!s)return;const n=t.findIndex(i=>i.id===e);if(n!==-1){for(let i=n+1;i<t.length;i++){const r=t[i];if(r?.created_by===s)return r}for(let i=n-1;i>=0;i--){const r=t[i];if(r?.created_by===s)return r}}}function eme(t){return t==="ephemeral"||t.startsWith("thread:")}function lN(t){const e=F.c(45),{task:s,isActive:n,onClick:i,onArchive:r,showAutomationBadge:a,showAgentIcon:l,hideStatusIdle:c,indented:d}=t,h=ae(),u=pT(s.status),f=u.icon,p=s.metadata?.kind==="tool_call_run",m=As(p?void 0:s.virtual_mcp_id);let g;e[0]!==m?(g=aa(m),e[0]=m,e[1]=g):g=e[1];const x=g;gT(6e4);const b=a||!!s.trigger_id,v=s.id,L="button",_=0;let y;e[2]!==i?(y=M=>{M.target===M.currentTarget&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),i())},e[2]=i,e[3]=y):y=e[3];const w=d?"-ml-4 pl-6":"pl-[9px]",S=n?"bg-accent text-accent-foreground":"hover:bg-accent/60";let k;e[4]!==w||e[5]!==S?(k=re("group/row flex items-center gap-2 py-1.5 rounded-md cursor-pointer transition-colors",w,"focus-visible:outline-none focus-visible:inset-ring-2 focus-visible:inset-ring-ring/50",S),e[4]=w,e[5]=S,e[6]=k):k=e[6];let j;e[7]!==p||e[8]!==l||e[9]!==m?.icon||e[10]!==m?.title?(j=l&&!p&&o.jsx(Kr,{icon:m?.icon??null,name:m?.title??"?",size:"2xs"}),e[7]=p,e[8]=l,e[9]=m?.icon,e[10]=m?.title,e[11]=j):j=e[11];let C;e[12]!==b||e[13]!==h?(C=b&&o.jsx(hr,{size:12,"aria-label":h("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=b,e[13]=h,e[14]=C):C=e[14];let V;e[15]!==h||e[16]!==s.title?(V=s.title||h("tasksPanel.taskRow.untitledTask"),e[15]=h,e[16]=s.title,e[17]=V):V=e[17];let N;e[18]!==V?(N=o.jsx("div",{className:"text-sm text-foreground truncate",children:V}),e[18]=V,e[19]=N):N=e[19];let A;e[20]!==C||e[21]!==N?(A=o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[C,N]}),e[20]=C,e[21]=N,e[22]=A):A=e[22];let P;e[23]!==x||e[24]!==n||e[25]!==s.branch||e[26]!==s.updated_at?(P=s.updated_at&&o.jsxs("div",{className:re("flex items-center gap-1 text-[11px] min-w-0",n?"text-accent-foreground/70":"text-muted-foreground/60"),children:[s.branch&&!eme(s.branch)?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"truncate font-mono",children:s.branch}),o.jsx("span",{className:"shrink-0",children:"·"})]}):x?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"truncate",children:[x.owner,"/",x.name]}),o.jsx("span",{className:"shrink-0",children:"·"})]}):null,o.jsx("span",{className:"shrink-0",children:ud(new Date(s.updated_at))})]}),e[23]=x,e[24]=n,e[25]=s.branch,e[26]=s.updated_at,e[27]=P):P=e[27];let R;e[28]!==A||e[29]!==P?(R=o.jsxs("div",{className:"flex-1 min-w-0",children:[A,P]}),e[28]=A,e[29]=P,e[30]=R):R=e[30];const E="shrink-0 grid [grid-template-areas:'slot'] items-center justify-items-center",I=!c&&o.jsx("span",{className:re("[grid-area:slot] flex size-8 items-center justify-center pointer-events-none transition-opacity",r&&"group-hover/row:opacity-0"),"aria-label":h("tasksPanel.taskRow.statusLabel",{status:h(u.labelKey)}),children:s.status==="in_progress"?o.jsx(et,{className:re("size-3.5",u.iconClassName)}):o.jsx(f,{size:14,className:u.iconClassName})});let D;e[31]!==r||e[32]!==h?(D=r&&o.jsxs(We,{children:[o.jsx(He,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":h("tasksPanel.taskRow.archiveTask"),onClick:M=>{M.stopPropagation(),r()},className:"[grid-area:slot] opacity-0 pointer-events-none group-hover/row:opacity-100 group-hover/row:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto transition-opacity flex size-8 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:o.jsx(N6,{size:14})})}),o.jsx(Ke,{side:"right",children:h("tasksPanel.taskRow.archive")})]}),e[31]=r,e[32]=h,e[33]=D):D=e[33];let O;e[34]!==I||e[35]!==D?(O=o.jsxs("div",{className:E,children:[I,D]}),e[34]=I,e[35]=D,e[36]=O):O=e[36];let B;return e[37]!==i||e[38]!==R||e[39]!==O||e[40]!==y||e[41]!==k||e[42]!==j||e[43]!==s.id?(B=o.jsxs("div",{"data-task-id":v,role:L,tabIndex:_,onClick:i,onKeyDown:y,className:k,children:[j,R,O]}),e[37]=i,e[38]=R,e[39]=O,e[40]=y,e[41]=k,e[42]=j,e[43]=s.id,e[44]=B):B=e[44],B}const e6=["requires_action","in_progress","failed","expired","completed"];function tme(t){const e=new Map(e6.map(s=>[s,[]]));for(const s of t){const n=s.status??"completed";(e.get(n)??e.get("completed")).push(s)}return e6.map(s=>({status:s,threads:e.get(s)}))}const sme="sidebar.group.expanded.";function nme(t,e){const s=F.c(3),[n,i]=qf(`${sme}${t}`,e);let r;return s[0]!==n||s[1]!==i?(r=[n,i],s[0]=n,s[1]=i,s[2]=r):r=s[2],r}function cN(t){const e=F.c(18),{onClick:s,isFetching:n,indented:i}=t,r=ae();let a;e[0]!==r?(a=r("sidebar.showMoreButton.ariaLabel"),e[0]=r,e[1]=a):a=e[1];const l=i?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==l?(c=re("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",l,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==n?(d=n&&o.jsx(et,{className:"size-3.5"}),e[4]=n,e[5]=d):d=e[5];let h;e[6]!==n||e[7]!==r?(h=r(n?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=n,e[7]=r,e[8]=h):h=e[8];let u;e[9]!==h?(u=o.jsx("span",{children:h}),e[9]=h,e[10]=u):u=e[10];let f;return e[11]!==n||e[12]!==s||e[13]!==a||e[14]!==c||e[15]!==d||e[16]!==u?(f=o.jsxs("button",{type:"button","aria-label":a,onClick:s,disabled:n,className:c,children:[d,u]}),e[11]=n,e[12]=s,e[13]=a,e[14]=c,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function ime(t,e,s,n){return[t,e,s,n.type,n.member,n.currentUserId??""].join("|")}function rme(t){return t.member==="mine"&&!t.currentUserId}const dN=4;let Hh=0;const N2=[];function ome(){for(;Hh<dN&&N2.length>0;){const t=N2.shift();t&&t()}}function uN(t){return new Promise((e,s)=>{const n=()=>{Hh++,t().then(e,s).finally(()=>{Hh--,ome()})};Hh<dN?n():N2.push(n)})}const n1=10;function t6(t,e,s,n,i){const r={hidden:!1};n.member==="mine"&&n.currentUserId&&(r.created_by=n.currentUserId),n.type==="automation"&&(r.has_trigger=!0),n.type==="manual"&&(r.has_trigger=!1);const a={where:r,limit:i,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return a.status=e,a}function ame(t,e,s,n){let i=0;for(const r of t)hN(r,e,s,n)&&i++;return i}function Cm(t,e,s,n){return ame(t,e,s,n)}function lme(t,e){return!!(t>=n1||t===0&&e)}function s6(t,e){return t<e}function cme(t,e){return e===!1?!1:e===!0?!0:t}function hN(t,e,s,n){return!(t.hidden||(t.status??"completed")!==s||n.member==="mine"&&n.currentUserId&&t.created_by!==n.currentUserId||n.type==="automation"&&!t.trigger_id||n.type==="manual"&&t.trigger_id)}const Kf=new Map,Nh=new Map;function dme(t,e){return e?t>=n1?!0:null:!1}function n6(t){return Kf.get(t)}function ume(t,e){Kf.set(t,e)}function hme(t,e,s){const n=Kf.get(t);if(n!==void 0){s(n);return}let i=Nh.get(t);i||(i=uN(e).then(r=>(Kf.set(t,r),Nh.delete(t),r)).catch(()=>(Nh.delete(t),Promise.reject(new Error("group probe failed")))),Nh.set(t,i)),i.then(s,()=>s(!1))}function i6(t){const e=t,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===n1,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function fme(t,e,s,n,i){let r=0;for(const a of t)e.has(a.id)||hN(a,s,n,i)&&r++;return r}function mme(t,e,s,n){const i=F.c(8),{org:r}=Ue(),a=ime(r.id,t,e,s);let l;i[0]!==s?(l=rme(s),i[0]=s,i[1]=l):l=i[1];const c=l,[d,h]=T.useState({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==a&&h({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:null,serverHasMore:null});const u=n9(),{threads:f,hasMore:p}=s9(),m=Cm(f,t,e,s),g=lme(m,p),x=dme(m,p),b=us();if(d.identity===a&&d.serverHasMore===null){const S=x??n6(a);S!==void 0&&h({isFetching:!1,isProbing:!1,identity:a,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:S})}!c&&d.identity===a&&d.serverHasMore===null&&x===null&&n6(a)===void 0&&d.probeSubscribedIdentity!==a&&(h(S=>S.identity===a?{...S,isProbing:!0,probeSubscribedIdentity:a}:S),hme(a,async()=>{const S=t6(t,e,0,s,1),k=await b.call("COLLECTION_THREADS_LIST",S),{totalCount:j}=i6(k),C=Cm(u.threads.get(),t,e,s);return j===void 0?!1:s6(C,j)},S=>{h(k=>k.identity!==a?k:{...k,isProbing:!1,serverHasMore:S})}));const L=async function(){if(d.isFetching||d.isProbing||c)return;const k=a;h(j=>j.identity===k?{...j,isFetching:!0}:j);try{const j=Cm(f,t,e,s),C=t6(t,e,j,s,n1),V=await uN(()=>b.call("COLLECTION_THREADS_LIST",C)),{items:N,hasMore:A,totalCount:P}=i6(V),R=new Set(f.map(pme)),E=fme(N,R,t,e,s),I=j;u.mergeThreads(N),h(D=>{if(D.identity!==k)return D;let O;return P!==void 0?O=s6(I+E,P):O=N.length===0||E===0?!1:A,ume(k,O),{...D,isFetching:!1,serverHasMore:O}})}catch(j){const C=j,V=C instanceof Error?C.message:String(C);ye.error(`Could not load more tasks: ${V}`),h(N=>N.identity===k?{...N,isFetching:!1}:N)}},_=d.isFetching||d.isProbing,y=!c&&!_&&cme(g,d.serverHasMore);let w;return i[2]!==_||i[3]!==L||i[4]!==y||i[5]!==d.isProbing||i[6]!==d.serverHasMore?(w={hasMore:y,isFetching:_,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:L},i[2]=_,i[3]=L,i[4]=y,i[5]=d.isProbing,i[6]=d.serverHasMore,i[7]=w):w=i[7],w}function pme(t){return t.id}function gme(t){const e=F.c(20),{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:l,filters:c}=t,{isFetching:d,isProbing:h,loadMore:u,hasMore:f,serverHasMore:p}=mme("status",s,c),[m,g]=T.useState(!1);!m&&n.length===0&&p===!0&&!d&&!h&&(g(!0),queueMicrotask(()=>{u()}));let x;if(e[0]!==i||e[1]!==l||e[2]!==c||e[3]!==a||e[4]!==r||e[5]!==n){let L;e[7]!==i||e[8]!==l||e[9]!==c||e[10]!==a||e[11]!==r?(L=_=>o.jsx(lN,{task:_,isActive:i===_.id,onClick:()=>r(_),onArchive:l&&_.created_by===c.currentUserId?()=>a(_):void 0,showAutomationBadge:!!_.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},_.id),e[7]=i,e[8]=l,e[9]=c,e[10]=a,e[11]=r,e[12]=L):L=e[12],x=n.map(L),e[0]=i,e[1]=l,e[2]=c,e[3]=a,e[4]=r,e[5]=n,e[6]=x}else x=e[6];let b;e[13]!==f||e[14]!==d||e[15]!==u?(b=(f||d)&&o.jsx(cN,{onClick:()=>{u()},isFetching:d,indented:!0}),e[13]=f,e[14]=d,e[15]=u,e[16]=b):b=e[16];let v;return e[17]!==x||e[18]!==b?(v=o.jsxs(o.Fragment,{children:[x,b]}),e[17]=x,e[18]=b,e[19]=v):v=e[19],v}function xme(t){const e=F.c(39),{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:l,filters:c}=t,d=ae(),h=xT[s],u=h.icon,[f,p]=nme(`status-${s}`,!1);let m;e[0]!==f||e[1]!==p?(m=function(){p(!f)},e[0]=f,e[1]=p,e[2]=m):m=e[2];const g=m;let x;e[3]!==g?(x=C=>{C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),g())},e[3]=g,e[4]=x):x=e[4];let b;e[5]!==u||e[6]!==h.iconClassName?(b=o.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:o.jsx(u,{size:12,className:h.iconClassName})}),e[5]=u,e[6]=h.iconClassName,e[7]=b):b=e[7];let v;e[8]!==f?(v=o.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:f?o.jsx(hs,{size:14}):o.jsx(Ns,{size:14})}),e[8]=f,e[9]=v):v=e[9];let L;e[10]!==b||e[11]!==v?(L=o.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[b,v]}),e[10]=b,e[11]=v,e[12]=L):L=e[12];let _;e[13]!==h.labelKey||e[14]!==d?(_=d(h.labelKey),e[13]=h.labelKey,e[14]=d,e[15]=_):_=e[15];let y;e[16]!==_?(y=o.jsx("span",{className:"flex-1 truncate",children:_}),e[16]=_,e[17]=y):y=e[17];let w;e[18]!==n.length?(w=o.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:o.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:n.length})}),e[18]=n.length,e[19]=w):w=e[19];let S;e[20]!==f||e[21]!==g||e[22]!==x||e[23]!==L||e[24]!==y||e[25]!==w?(S=o.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":f,onClick:g,onKeyDown:x,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[L,y,w]}),e[20]=f,e[21]=g,e[22]=x,e[23]=L,e[24]=y,e[25]=w,e[26]=S):S=e[26];let k;e[27]!==i||e[28]!==l||e[29]!==f||e[30]!==c||e[31]!==a||e[32]!==r||e[33]!==s||e[34]!==n?(k=f&&o.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:o.jsx(gme,{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:l,filters:c})}),e[27]=i,e[28]=l,e[29]=f,e[30]=c,e[31]=a,e[32]=r,e[33]=s,e[34]=n,e[35]=k):k=e[35];let j;return e[36]!==k||e[37]!==S?(j=o.jsxs("div",{className:"flex flex-col gap-0.5",children:[S,k]}),e[36]=k,e[37]=S,e[38]=j):j=e[38],j}function bme(t){const e=F.c(38),{threads:s,groupBy:n,activeTaskId:i,onSelectTask:r,onArchiveTask:a,filters:l,hasMore:c,isFetchingMore:d,onLoadMore:h,filtersActive:u}=t;if(s.length===0&&!c&&!d){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(jA,{className:"size-6 opacity-60"}),e[0]=x):x=e[0];const b=u?"No chats match your filters":"No chats yet";let v;return e[1]!==b?(v=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[x,o.jsx("p",{className:"text-sm",children:b})]}),e[1]=b,e[2]=v):v=e[2],v}const f=s.length>1||c;if(n==="status"){let x;if(e[3]!==i||e[4]!==f||e[5]!==l||e[6]!==a||e[7]!==r||e[8]!==s){let v;e[10]!==i||e[11]!==f||e[12]!==l||e[13]!==a||e[14]!==r?(v=L=>o.jsx(xme,{status:L.status,threads:L.threads,activeTaskId:i,onSelectTask:r,onArchiveTask:a,canArchive:f,filters:l},L.status),e[10]=i,e[11]=f,e[12]=l,e[13]=a,e[14]=r,e[15]=v):v=e[15],x=tme(s).map(v),e[3]=i,e[4]=f,e[5]=l,e[6]=a,e[7]=r,e[8]=s,e[9]=x}else x=e[9];let b;return e[16]!==x?(b=o.jsx(o.Fragment,{children:x}),e[16]=x,e[17]=b):b=e[17],b}let p;if(e[18]!==i||e[19]!==f||e[20]!==l||e[21]!==a||e[22]!==r||e[23]!==s){let x;e[25]!==i||e[26]!==f||e[27]!==l||e[28]!==a||e[29]!==r?(x=b=>o.jsx(lN,{task:b,isActive:i===b.id,onClick:()=>r(b),onArchive:f&&b.created_by===l.currentUserId?()=>a(b):void 0,showAutomationBadge:!!b.trigger_id,showAgentIcon:!0},b.id),e[25]=i,e[26]=f,e[27]=l,e[28]=a,e[29]=r,e[30]=x):x=e[30],p=s.map(x),e[18]=i,e[19]=f,e[20]=l,e[21]=a,e[22]=r,e[23]=s,e[24]=p}else p=e[24];let m;e[31]!==c||e[32]!==d||e[33]!==h?(m=(c||d)&&o.jsx(cN,{onClick:h,isFetching:d}),e[31]=c,e[32]=d,e[33]=h,e[34]=m):m=e[34];let g;return e[35]!==p||e[36]!==m?(g=o.jsxs(o.Fragment,{children:[p,m]}),e[35]=p,e[36]=m,e[37]=g):g=e[37],g}function vme(t,e){return null}function yme(t,e){return t.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const _me=["archive","reclaim-worktree"],Lme=[];function wme(t){return t==="confirm"?_me:Lme}function Sme(t){const e=F.c(11),{panel:s}=t;let n;return e[0]!==s.activeTaskId||e[1]!==s.archiveTask||e[2]!==s.filters||e[3]!==s.filtersActive||e[4]!==s.groupBy||e[5]!==s.hasMore||e[6]!==s.isFetchingMore||e[7]!==s.loadMore||e[8]!==s.selectTask||e[9]!==s.threads?(n=o.jsx(bme,{threads:s.threads,groupBy:s.groupBy,activeTaskId:s.activeTaskId,onSelectTask:s.selectTask,onArchiveTask:s.archiveTask,filters:s.filters,hasMore:s.hasMore,isFetchingMore:s.isFetchingMore,onLoadMore:s.loadMore,filtersActive:s.filtersActive}),e[0]=s.activeTaskId,e[1]=s.archiveTask,e[2]=s.filters,e[3]=s.filtersActive,e[4]=s.groupBy,e[5]=s.hasMore,e[6]=s.isFetchingMore,e[7]=s.loadMore,e[8]=s.selectTask,e[9]=s.threads,e[10]=n):n=e[10],n}function kme(t){const e=F.c(83);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{onNavigate:n}=s,i=ae(),{data:r}=On.useSession(),a=r?.user?.id,{org:l}=Ue();let c;e[2]!==l.id?(c=ra(l.id),e[2]=l.id,e[3]=c):c=e[3];const d=c.id,h=q1e(),{threads:u,hasMore:f,isFetchingMore:p,fetchNextPage:m}=s9(),g=u.filter(Vme),{hide:x,setScope:b}=Ju(),v=Ks(),L=us(),{setTaskId:_,createNewTask:y}=oa(),w=I8(),S=l0();let k;e[4]!==S||e[5]!==u||e[6]!==w?(k=HP({routeAgentId:w,threadVirtualMcpId:u.find(pe=>pe.id===S)?.virtual_mcp_id}),e[4]=S,e[5]=u,e[6]=w,e[7]=k):k=e[7];const j=k;let C;e[8]!==n?(C=()=>{n?.()},e[8]=n,e[9]=C):C=e[9];const V=C,N=[...g].sort(Nme),[A,P]=T.useState("all"),[R,E]=T.useState("flat"),[I,D]=qf("sidebar-threads-scope-all",!1),[O,B]=T.useState(!1),[M,z]=T.useState(!1);let $;e[10]!==B?($=()=>{qe("tasks_panel_search_opened"),z(!0),B(!0)},e[10]=B,e[11]=$):$=e[11];const U=$,[H,W]=T.useState(null),K=a??null;let G;e[12]!==K||e[13]!==A?(G={type:A,member:"mine",currentUserId:K},e[12]=K,e[13]=A,e[14]=G):G=e[14];const Y=G,Z={};I||(Z.created_by="me"),b(Z);let te;e[15]!==a?(te=pe=>a?pe.filter(ke=>ke.created_by===a):[],e[15]=a,e[16]=te):te=e[16];const X=te;let ee;e[17]!==A?(ee=pe=>A==="automation"?pe.filter(Cme):A==="manual"?pe.filter(jme):pe,e[17]=A,e[18]=ee):ee=e[18];const J=ee,Q=W1e(J(I?N:X(N)),S);let oe;e[19]!==S||e[20]!==V||e[21]!==a||e[22]!==x||e[23]!==v||e[24]!==l.slug||e[25]!==_||e[26]!==Q?(oe=pe=>{const ke=pe.id===S,Te=x(pe.id);if(PT(pe.id),!ke)return Te;const we=Z1e(Q,pe.id,a);return V(),we?_(we.id,we.virtual_mcp_id):v({to:"/$org",params:{org:l.slug}}),Te},e[19]=S,e[20]=V,e[21]=a,e[22]=x,e[23]=v,e[24]=l.slug,e[25]=_,e[26]=Q,e[27]=oe):oe=e[27];const le=oe;let de;e[28]!==L||e[29]!==i?(de=async pe=>{try{await L.call("SANDBOX_DELETE",{virtualMcpId:pe.virtualMcpId,branch:pe.branch,removeWorktree:!0})}catch{ye.error(i("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:pe.branch}))}},e[28]=L,e[29]=i,e[30]=de):de=e[30];const se=de;let ie;e[31]!==u||e[32]!==le||e[33]!==a||e[34]!==W?(ie=pe=>{if(a&&pe.created_by&&pe.created_by!==a)return;const ke=vme();if(!ke||yme(u,ke)){le(pe);return}W({task:pe,target:ke})},e[31]=u,e[32]=le,e[33]=a,e[34]=W,e[35]=ie):ie=e[35];const he=ie;let ue;e[36]!==le||e[37]!==H||e[38]!==se||e[39]!==W?(ue=pe=>{const ke=H;ke&&(W(null),(async()=>{for(const Te of wme(pe))if(Te==="archive")try{await le(ke.task)}catch{return}else await se(ke.target)})())},e[36]=le,e[37]=H,e[38]=se,e[39]=W,e[40]=ue):ue=e[40];const ce=ue;let ne;e[41]!==V||e[42]!==_?(ne=pe=>{V(),_(pe.id,pe.virtual_mcp_id)},e[41]=V,e[42]=_,e[43]=ne):ne=e[43];const q=ne;let fe;e[44]!==j||e[45]!==S||e[46]!==u||e[47]!==V||e[48]!==y||e[49]!==a||e[50]!==d||e[51]!==h||e[52]!==_?(fe=()=>{const pe=j??d;qe("sidebar_new_thread_clicked",{virtual_mcp_id:pe}),V();const ke=BP(u,pe,a,h(pe));if(ke){_(ke.id,ke.virtual_mcp_id);return}const Te=u.find(we=>we.id===S)?.branch??null;y(pe,Te)},e[44]=j,e[45]=S,e[46]=u,e[47]=V,e[48]=y,e[49]=a,e[50]=d,e[51]=h,e[52]=_,e[53]=fe):fe=e[53];const ge=fe;let _e;e[54]!==m?(_e=()=>{m()},e[54]=m,e[55]=_e):_e=e[55];const Le=R!=="flat"||A!=="all"||I;let je;e[56]!==ce||e[57]!==H?(je=H?o.jsx(J1e,{branch:H.target.branch,onOutcome:ce}):null,e[56]=ce,e[57]=H,e[58]=je):je=e[58];let Ce;e[59]!==M||e[60]!==O||e[61]!==B?(Ce=M?o.jsx(Q1e,{open:O,onOpenChange:B}):null,e[59]=M,e[60]=O,e[61]=B,e[62]=Ce):Ce=e[62];let Pe;return e[63]!==S||e[64]!==he||e[65]!==Y||e[66]!==R||e[67]!==f||e[68]!==p||e[69]!==ge||e[70]!==U||e[71]!==q||e[72]!==E||e[73]!==D||e[74]!==P||e[75]!==I||e[76]!==_e||e[77]!==Le||e[78]!==je||e[79]!==Ce||e[80]!==A||e[81]!==Q?(Pe={threads:Q,activeTaskId:S,filters:Y,hasMore:f,isFetchingMore:p,loadMore:_e,groupBy:R,setGroupBy:E,typeFilter:A,setTypeFilter:P,showAll:I,setShowAll:D,filtersActive:Le,selectTask:q,archiveTask:he,newThread:ge,openSearch:U,reclaimDialog:je,searchDialog:Ce},e[63]=S,e[64]=he,e[65]=Y,e[66]=R,e[67]=f,e[68]=p,e[69]=ge,e[70]=U,e[71]=q,e[72]=E,e[73]=D,e[74]=P,e[75]=I,e[76]=_e,e[77]=Le,e[78]=je,e[79]=Ce,e[80]=A,e[81]=Q,e[82]=Pe):Pe=e[82],Pe}function jme(t){return!t.trigger_id}function Cme(t){return!!t.trigger_id}function Nme(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function Vme(t){return!t.hidden}function Tme(){const t=F.c(60),e=ae(),[s,n]=T.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={onNavigate:()=>n(!1)},t[0]=i):i=t[0];const r=kme(i),a=Ts()?.activeTask;let l;t[1]!==a?.title||t[2]!==r.activeTaskId||t[3]!==r.threads||t[4]!==e?(l=a?.title||r.threads.find(D=>D.id===r.activeTaskId)?.title||e("tasksPanel.taskRow.untitledTask"),t[1]=a?.title,t[2]=r.activeTaskId,t[3]=r.threads,t[4]=e,t[5]=l):l=t[5];const c=l;let d;t[6]!==r?(d=()=>{n(!1),r.openSearch()},t[6]=r,t[7]=d):d=t[7];const h=d;let u;t[8]!==e?(u=e("chat.threadsMenu.chats"),t[8]=e,t[9]=u):u=t[9];const f=s&&"bg-sidebar-accent";let p;t[10]!==f?(p=re("flex h-[34px] min-w-0 shrink items-center gap-1.5 rounded-lg px-2 text-sm text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",f),t[10]=f,t[11]=p):p=t[11];let m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(t8,{size:16,className:"shrink-0"}),t[12]=m):m=t[12];let g;t[13]!==c?(g=o.jsx("span",{className:"truncate max-w-[10rem] font-medium",children:c}),t[13]=c,t[14]=g):g=t[14];let x;t[15]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(hs,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[15]=x):x=t[15];let b;t[16]!==u||t[17]!==p||t[18]!==g?(b=o.jsx(He,{asChild:!0,children:o.jsx(ws,{asChild:!0,children:o.jsxs("button",{type:"button","aria-label":u,className:p,children:[m,g,x]})})}),t[16]=u,t[17]=p,t[18]=g,t[19]=b):b=t[19];let v;t[20]!==e?(v=e("chat.threadsMenu.chats"),t[20]=e,t[21]=v):v=t[21];let L;t[22]!==v?(L=o.jsx(Ke,{side:"bottom",children:v}),t[22]=v,t[23]=L):L=t[23];let _;t[24]!==L||t[25]!==b?(_=o.jsxs(We,{children:[b,L]}),t[24]=L,t[25]=b,t[26]=_):_=t[26];let y;t[27]!==r?(y=o.jsx(K1e,{panel:r,className:"size-8 rounded-lg"}),t[27]=r,t[28]=y):y=t[28];let w;t[29]!==e?(w=e("sidebar.taskGroupsList.searchChats"),t[29]=e,t[30]=w):w=t[30];let S;t[31]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(sg,{size:16}),t[31]=S):S=t[31];let k;t[32]!==h||t[33]!==w?(k=o.jsx($o,{"aria-label":w,onClick:h,className:"size-8 rounded-lg",children:S}),t[32]=h,t[33]=w,t[34]=k):k=t[34];let j;t[35]!==e?(j=e("sidebar.taskGroupsList.newChat"),t[35]=e,t[36]=j):j=t[36];let C;t[37]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(Zu,{size:16}),t[37]=C):C=t[37];let V;t[38]!==r.newThread||t[39]!==j?(V=o.jsx($o,{"aria-label":j,onClick:r.newThread,className:"size-8 rounded-lg",children:C}),t[38]=r.newThread,t[39]=j,t[40]=V):V=t[40];let N;t[41]!==k||t[42]!==V?(N=o.jsxs("div",{className:"flex items-center gap-0.5",children:[k,V]}),t[41]=k,t[42]=V,t[43]=N):N=t[43];let A;t[44]!==y||t[45]!==N?(A=o.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[y,N]}),t[44]=y,t[45]=N,t[46]=A):A=t[46];let P;t[47]!==r?(P=o.jsx("div",{className:"flex max-h-[60vh] min-h-0 flex-col gap-0.5 overflow-y-auto overscroll-contain",children:o.jsx(Sme,{panel:r})}),t[47]=r,t[48]=P):P=t[48];let R;t[49]!==A||t[50]!==P?(R=o.jsxs(ks,{align:"start",side:"bottom",onOpenAutoFocus:Ame,className:"flex w-80 flex-col gap-2 p-2",children:[A,P]}),t[49]=A,t[50]=P,t[51]=R):R=t[51];let E;t[52]!==s||t[53]!==_||t[54]!==R?(E=o.jsxs(js,{open:s,onOpenChange:n,children:[_,R]}),t[52]=s,t[53]=_,t[54]=R,t[55]=E):E=t[55];let I;return t[56]!==r.reclaimDialog||t[57]!==r.searchDialog||t[58]!==E?(I=o.jsxs(o.Fragment,{children:[E,r.searchDialog,r.reclaimDialog]}),t[56]=r.reclaimDialog,t[57]=r.searchDialog,t[58]=E,t[59]=I):I=t[59],I}function Ame(t){return t.preventDefault()}function fN(t){const e=F.c(4),{chatContent:s}=t;let n;e[0]!==s?(n=s??o.jsx(V_,{}),e[0]=s,e[1]=n):n=e[1];let i;return e[2]!==n?(i=o.jsx("div",{"data-testid":"chat-panel",className:"h-full min-h-0",children:n}),e[2]=n,e[3]=i):i=e[3],i}function Nm(t){const e=F.c(25),{side:s,open:n,disabled:i,onToggle:r}=t,a=ae();let l;e[0]!==n||e[1]!==s||e[2]!==a?(l=a(n?s==="left"?"agentShellLayout.toggleButtons.hideChat":"agentShellLayout.toggleButtons.hidePanel":s==="left"?"agentShellLayout.toggleButtons.showChat":"agentShellLayout.toggleButtons.showPanel"),e[0]=n,e[1]=s,e[2]=a,e[3]=l):l=e[3];const c=l;let d;e[4]!==r||e[5]!==n||e[6]!==s?(d=()=>{qe("agent_toolbar_toggled",{button:s==="left"?"chat":"main",next_state:n?"closed":"open"}),r()},e[4]=r,e[5]=n,e[6]=s,e[7]=d):d=e[7];const h=d;if(s==="left"){let g,x;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=re("flex h-10 md:h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-sm disabled:opacity-40",v7()),x=o.jsx(ng,{size:16}),e[8]=g,e[9]=x):(g=e[8],x=e[9]);let b;return e[10]!==i||e[11]!==c||e[12]!==h||e[13]!==g?(b=o.jsxs("button",{type:"button",disabled:i,onClick:h,className:g,children:[x,c]}),e[10]=i,e[11]=c,e[12]=h,e[13]=g,e[14]=b):b=e[14],b}let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(CA,{size:16}),e[15]=u):u=e[15];let f;e[16]!==i||e[17]!==c||e[18]!==h?(f=o.jsx(He,{asChild:!0,children:o.jsx($o,{"aria-label":c,disabled:i,onClick:h,className:"size-7 rounded-md disabled:opacity-40",children:u})}),e[16]=i,e[17]=c,e[18]=h,e[19]=f):f=e[19];let p;e[20]!==c?(p=o.jsx(Ke,{side:"bottom",children:c}),e[20]=c,e[21]=p):p=e[21];let m;return e[22]!==f||e[23]!==p?(m=o.jsxs(We,{children:[f,p]}),e[22]=f,e[23]=p,e[24]=m):m=e[24],m}const Vm="workspace-side-panel",r6="workspace-main-panel";function o6(t){const e=F.c(7),{children:s,header:n,testId:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=re("min-h-0 flex-1 overflow-hidden rounded-[0.75rem] bg-background card-shadow [transform:translateZ(0)]","flex flex-col"),e[0]=r):r=e[0];let a;e[1]!==s?(a=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s}),e[1]=s,e[2]=a):a=e[2];let l;return e[3]!==n||e[4]!==a||e[5]!==i?(l=o.jsx("div",{className:"flex h-full min-h-0 flex-col p-0.5",children:o.jsxs("div",{"data-testid":i,className:r,children:[n,a]})}),e[3]=n,e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Pme(t){const e=F.c(4),{virtualMcpId:s,taskId:n,disableActiveMainToggle:i}=t;let r;return e[0]!==i||e[1]!==n||e[2]!==s?(r=o.jsx(r9e,{virtualMcpId:s,taskId:n,disableActiveMainToggle:i}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3],r}function Eme(t){const e=F.c(80),{virtualMcpId:s,taskId:n,entity:i,sidePanelOpen:r,mainOpen:a,toggleSidePanel:l,toggleMain:c,chatContent:d}=t,[h,u]=QB(),f=T.useRef(null);let p;e[0]!==a||e[1]!==r?(p=iB({sidePanelOpen:r,mainOpen:a}),e[0]=a,e[1]=r,e[2]=p):p=e[2];const m=p,g=r&&a?h:m.side,x=100-g;let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(U1e,{}),e[3]=b):b=e[3];const v=b;let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Tme,{}),e[4]=L):L=e[4];const _=L;let y;e[5]!==i?(y=o.jsx(N1e,{virtualMcp:i}),e[5]=i,e[6]=y):y=e[6];const w=y,S=Ts()?.currentBranch??null,k=R8(i.metadata?.ui?.layout??null);let j;e[7]!==k||e[8]!==S||e[9]!==i?(j=Cg(k)?o.jsx(F1e,{virtualMcp:i,currentBranch:S}):null,e[7]=k,e[8]=S,e[9]=i,e[10]=j):j=e[10];const C=j;let V,N;e[11]!==x||e[12]!==g?(V=()=>{f.current?.setLayout({[Vm]:g,[r6]:x})},N=[g,x],e[11]=x,e[12]=g,e[13]=V,e[14]=N):(V=e[13],N=e[14]),T.useEffect(V,N);let A;e[15]!==a||e[16]!==r||e[17]!==c?(A=!a&&o.jsx(Nm,{side:"right",open:a,disabled:!r,onToggle:c}),e[15]=a,e[16]=r,e[17]=c,e[18]=A):A=e[18];let P;e[19]!==A?(P=o.jsxs(Tb,{children:[_,o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[v,A]})]}),e[19]=A,e[20]=P):P=e[20];const R=P,E=!a;let I;e[21]!==r||e[22]!==E||e[23]!==l?(I=o.jsx(Nm,{side:"left",open:r,disabled:E,onToggle:l}),e[21]=r,e[22]=E,e[23]=l,e[24]=I):I=e[24];const D=!r;let O;e[25]!==D||e[26]!==n||e[27]!==s?(O=o.jsx(Pme,{virtualMcpId:s,taskId:n,disableActiveMainToggle:D}),e[25]=D,e[26]=n,e[27]=s,e[28]=O):O=e[28];let B;e[29]!==I||e[30]!==O?(B=o.jsxs("div",{className:"flex min-w-0 shrink items-center gap-0.5 overflow-hidden",children:[I,O]}),e[29]=I,e[30]=O,e[31]=B):B=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-center",children:o.jsx(qZ,{className:"@max-sm/panel-header:hidden"})}),e[32]=M):M=e[32];let z;e[33]!==C?(z=o.jsx("div",{className:"flex min-w-0 shrink items-center justify-end",children:C}),e[33]=C,e[34]=z):z=e[34];const $=!r;let U;e[35]!==a||e[36]!==$||e[37]!==c?(U=o.jsx(Nm,{side:"right",open:a,disabled:$,onToggle:c}),e[35]=a,e[36]=$,e[37]=c,e[38]=U):U=e[38];let H;e[39]!==w||e[40]!==U?(H=o.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-1",children:[w,U]}),e[39]=w,e[40]=U,e[41]=H):H=e[41];let W;e[42]!==z||e[43]!==H?(W=o.jsxs("div",{className:"flex min-w-0 shrink items-center justify-end gap-1",children:[z,H]}),e[42]=z,e[43]=H,e[44]=W):W=e[44];let K;e[45]!==B||e[46]!==W?(K=o.jsxs(Tb,{className:"justify-between gap-2",children:[B,M,W]}),e[45]=B,e[46]=W,e[47]=K):K=e[47];const G=K,Y=`${s}-${n}`;let Z,te;e[48]===Symbol.for("react.memo_cache_sentinel")?(Z=re("flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-workspace-panel-open]]:!min-w-[320px]"),te={overflow:"visible"},e[48]=Z,e[49]=te):(Z=e[48],te=e[49]);let X;e[50]!==a||e[51]!==u||e[52]!==r?(X=(ge,_e)=>{const{isUserInteraction:Le}=_e,je=ge[Vm];Le&&r&&a&&typeof je=="number"&&je>0&&je<100&&u(je)},e[50]=a,e[51]=u,e[52]=r,e[53]=X):X=e[53];const ee=`${m.side}%`,J=r?"":void 0,Q=r?R:null;let oe;e[54]!==d||e[55]!==r?(oe=r&&o.jsx(fN,{chatContent:d}),e[54]=d,e[55]=r,e[56]=oe):oe=e[56];let le;e[57]!==Q||e[58]!==oe?(le=o.jsx(o6,{testId:"side-panel",header:Q,children:oe}),e[57]=Q,e[58]=oe,e[59]=le):le=e[59];let de;e[60]!==ee||e[61]!==J||e[62]!==le?(de=o.jsx(Ac,{id:Vm,defaultSize:ee,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":J,className:"min-w-0 overflow-hidden bg-sidebar",children:le}),e[60]=ee,e[61]=J,e[62]=le,e[63]=de):de=e[63];let se;e[64]===Symbol.for("react.memo_cache_sentinel")?(se=o.jsx(ip,{className:"bg-sidebar"}),e[64]=se):se=e[64];const ie=`${m.main}%`,he=a?"":void 0,ue=a?G:null;let ce;e[65]!==n||e[66]!==s?(ce=o.jsx(IC,{taskId:n,virtualMcpId:s}),e[65]=n,e[66]=s,e[67]=ce):ce=e[67];let ne;e[68]!==ue||e[69]!==ce?(ne=o.jsx(o6,{testId:"main-panel",header:ue,children:ce}),e[68]=ue,e[69]=ce,e[70]=ne):ne=e[70];let q;e[71]!==ie||e[72]!==he||e[73]!==ne?(q=o.jsx(Ac,{id:r6,defaultSize:ie,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":he,className:"min-w-0 overflow-hidden bg-sidebar",children:ne}),e[71]=ie,e[72]=he,e[73]=ne,e[74]=q):q=e[74];let fe;return e[75]!==Y||e[76]!==X||e[77]!==de||e[78]!==q?(fe=o.jsx(WZ,{children:o.jsxs(np,{ref:f,orientation:"horizontal",className:Z,style:te,onLayoutChanged:X,children:[de,se,q]},Y)}),e[75]=Y,e[76]=X,e[77]=de,e[78]=q,e[79]=fe):fe=e[79],fe}const Tm="__mobile-main-panel-tab-select__",V2="main";function Rme({tabs:t,activeTab:e,mainOpen:s,t:n}){const i=t.find(a=>a.id===e),r=n("mainPanelTabs.mobileMainPanelTabSelect.mainView");return s?i?.title??r:i?.title??t[0]?.title??r}const Dme={kind:"component",Component:ng},Mme={kind:"component",Component:X2},Ime={kind:"component",Component:Qo},Ome={kind:"component",Component:zr};function $me({tabs:t,overlayEnabled:e,t:s}){return[{value:"chat",title:s("mainPanelTabs.mobileMainPanelTabSelect.chat"),icon:Dme},...t.length>0?t.map(n=>({value:n.id,title:n.title,icon:n.icon})):[{value:V2,title:s("mainPanelTabs.mobileMainPanelTabSelect.mainView"),icon:Ome}],...e?[{value:"board",title:s("mainPanelTabs.mobileMainPanelTabSelect.tasks"),icon:Mme},{value:"files",title:s("mainPanelTabs.mobileMainPanelTabSelect.library"),icon:Ime}]:[]]}function Bme(t){const e=F.c(53),{virtualMcpId:s,taskId:n}=t,i=ae(),r=Ks(),{openPanel:a}=Di();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const c=ia(l);let d;e[1]!==n||e[2]!==s?(d={virtualMcpId:s,taskId:n},e[1]=n,e[2]=s,e[3]=d):d=e[3];const{tabs:h,activeTab:u,mainOpen:f}=e3(d),{org:p}=Ue(),m=w8();let g;e[4]!==p.id?(g=Yh(p.id),e[4]=p.id,e[5]=g):g=e[5];const x=s===g;let b,v,L,_,y,w,S,k,j,C;if(e[6]!==u||e[7]!==f||e[8]!==r||e[9]!==x||e[10]!==a||e[11]!==p.id||e[12]!==c.org||e[13]!==c.taskId||e[14]!==m||e[15]!==i||e[16]!==h||e[17]!==s){_=Symbol.for("react.early_return_sentinel");e:{const A=$me({tabs:h,overlayEnabled:!!(c.org&&c.taskId),t:i}),P=f?A.find($=>$.value===u)?.value??V2:"chat",R=A.find($=>$.value===P),E=R?.title??Rme({tabs:h,activeTab:u,mainOpen:f,t:i});let I;e[28]!==r?(I=$=>{r({to:".",search:U=>({...U,...oB($)}),replace:!0})},e[28]=r,e[29]=I):I=e[29];const D=I;let O;e[30]!==x||e[31]!==a||e[32]!==p.id||e[33]!==m||e[34]!==D||e[35]!==s?(O=$=>{if($!==Tm){if(qe("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:$,source:"mobile_select"}),W8({reportsOnly:m,onReportAgent:x,tabId:$})){a($,{virtualmcpid:Yh(p.id),search:Ume});return}if($==="chat"||$===V2){D($==="chat"?"chat":"main");return}a($,{search:Fme})}},e[30]=x,e[31]=a,e[32]=p.id,e[33]=m,e[34]=D,e[35]=s,e[36]=O):O=e[36];const B=O,M=A.find($=>$.value!==P);if(A.length===2&&M){_=o.jsxs("button",{type:"button",onClick:()=>B(M.value),"aria-label":i("mainPanelTabs.mobileMainPanelTabSelect.switchTo",{name:M.title}),className:"flex h-10 min-w-0 max-w-[7.5rem] items-center gap-1.5 rounded-md px-1.5 text-xs text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:o.jsx(Ff,{icon:M.icon,className:"size-5"})}),o.jsx("span",{className:"min-w-0 truncate",children:M.title})]});break e}v=xs,j=Tm,C=B;let z;e[37]!==i?(z=i("mainPanelTabs.mobileMainPanelTabSelect.view"),e[37]=i,e[38]=z):z=e[38],L=o.jsx(bs,{"aria-label":z,className:"h-10! w-full min-w-0 max-w-[7.5rem] rounded-md border-0 bg-transparent px-1.5 text-xs shadow-none [--card-shadow:none]",children:o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[R&&o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:o.jsx(Ff,{icon:R.icon,className:"size-5"})}),o.jsx("span",{className:"min-w-0 truncate",children:E})]})}),b=vs,y="end",w="w-56",e[39]!==E?(S=o.jsx(Rt,{value:Tm,disabled:!0,hideCheck:!0,className:"hidden",children:E}),e[39]=E,e[40]=S):S=e[40],k=A.map(zme)}e[6]=u,e[7]=f,e[8]=r,e[9]=x,e[10]=a,e[11]=p.id,e[12]=c.org,e[13]=c.taskId,e[14]=m,e[15]=i,e[16]=h,e[17]=s,e[18]=b,e[19]=v,e[20]=L,e[21]=_,e[22]=y,e[23]=w,e[24]=S,e[25]=k,e[26]=j,e[27]=C}else b=e[18],v=e[19],L=e[20],_=e[21],y=e[22],w=e[23],S=e[24],k=e[25],j=e[26],C=e[27];if(_!==Symbol.for("react.early_return_sentinel"))return _;let V;e[41]!==b||e[42]!==y||e[43]!==w||e[44]!==S||e[45]!==k?(V=o.jsxs(b,{align:y,className:w,children:[S,k]}),e[41]=b,e[42]=y,e[43]=w,e[44]=S,e[45]=k,e[46]=V):V=e[46];let N;return e[47]!==v||e[48]!==L||e[49]!==V||e[50]!==j||e[51]!==C?(N=o.jsxs(v,{value:j,onValueChange:C,children:[L,V]}),e[47]=v,e[48]=L,e[49]=V,e[50]=j,e[51]=C,e[52]=N):N=e[52],N}function zme(t){return o.jsx(Rt,{value:t.value,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:o.jsx(Ff,{icon:t.icon})}),o.jsx("span",{className:"min-w-0 truncate",children:t.title})]})},t.value)}function Fme(t){return{...t,sidepanel:!1}}function Ume(t){return{...t,thread:void 0,sidepanel:!1}}function Hme(t,e,s){const n=F.c(36),i=n9(),{locator:r}=Ue(),a=T.useSyncExternalStore(i.threads.subscribe,i.threads.get),l=T.useSyncExternalStore(i.threadsStatus.subscribe,i.threadsStatus.get);let c;n[0]!==t||n[1]!==a?(c=t===null?null:a.find(y=>y.id===t&&!y.partial)??null,n[0]=t,n[1]=a,n[2]=c):c=n[2];const d=c,[h,u]=T.useState(void 0);let f;n[3]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{u(void 0)},n[3]=f):f=n[3];let p;n[4]!==t?(p=[t],n[4]=t,n[5]=p):p=n[5],T.useEffect(f,p);let m,g;n[6]!==h||n[7]!==t||n[8]!==d||n[9]!==i||n[10]!==l.kind?(m=()=>{t!==null&&(d||l.kind!=="loading"&&h===void 0&&(u("pending"),i.fetchThreadIntoSlot(t).then(y=>{u(y)})))},g=[t,d,l.kind,h,i],n[6]=h,n[7]=t,n[8]=d,n[9]=i,n[10]=l.kind,n[11]=m,n[12]=g):(m=n[11],g=n[12]),T.useEffect(m,g);let x;n[13]!==s||n[14]!==r||n[15]!==i||n[16]!==e?(x={mutationFn:async y=>i.create({id:y,virtual_mcp_id:e,...s?{branch:s}:{},...BT(sessionStorage,r,y)})},n[13]=s,n[14]=r,n[15]=i,n[16]=e,n[17]=x):x=n[17];const b=Ds(x);let v,L;if(n[18]!==b||n[19]!==h||n[20]!==t||n[21]!==d||n[22]!==l.kind?(v=()=>{t!==null&&(d||h===null&&l.kind!=="loading"&&(b.isPending||b.variables!==t&&b.mutate(t)))},L=[t,d,h,l.kind,b],n[18]=b,n[19]=h,n[20]=t,n[21]=d,n[22]=l.kind,n[23]=v,n[24]=L):(v=n[23],L=n[24]),T.useEffect(v,L),t===null){let y;return n[25]===Symbol.for("react.memo_cache_sentinel")?(y={status:"ready",task:null},n[25]=y):y=n[25],y}if(d){let y;return n[26]!==d?(y={status:"ready",task:d},n[26]=d,n[27]=y):y=n[27],y}if(h&&typeof h=="object"){let y;return n[28]!==h?(y={status:"ready",task:h},n[28]=h,n[29]=y):y=n[29],y}if(b.data){let y;return n[30]!==b.data?(y={status:"ready",task:b.data},n[30]=b.data,n[31]=y):y=n[31],y}if(b.isError){let y;return n[32]!==b.error?(y={status:"error",error:b.error},n[32]=b.error,n[33]=y):y=n[33],y}if(b.isPending||l.kind!=="loading"){let y;return n[34]===Symbol.for("react.memo_cache_sentinel")?(y={status:"creating"},n[34]=y):y=n[34],y}let _;return n[35]===Symbol.for("react.memo_cache_sentinel")?(_={status:"loading"},n[35]=_):_=n[35],_}function Kme(){const t=F.c(31);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=ia(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[1]=n):n=t[1];const i=pr(n),r=s.org;if(!r||s.taskId!==void 0)return null;let a;t[2]!==s.panel||t[3]!==i.main?(a=lV(i.main,s.panel),t[2]=s.panel,t[3]=i.main,t[4]=a):a=t[4];const l=a;if(!l)return null;if(l.to===null){let u;return t[5]!==l.search?(u=o.jsx(ei,{to:".",search:f=>({...f,...l.search}),replace:!0}),t[5]=l.search,t[6]=u):u=t[6],u}if(l.to==="/$org/agents/{-$panel}"){let u;t[7]!==r||t[8]!==l.panel?(u={org:r,panel:l.panel},t[7]=r,t[8]=l.panel,t[9]=u):u=t[9];let f;t[10]!==l.search?(f=m=>({...m,...l.search}),t[10]=l.search,t[11]=f):f=t[11];let p;return t[12]!==u||t[13]!==f?(p=o.jsx(ei,{to:"/$org/agents/{-$panel}",params:u,search:f,replace:!0}),t[12]=u,t[13]=f,t[14]=p):p=t[14],p}if(l.to==="/$org/tasks/{-$taskKey}"){let u;t[15]!==r||t[16]!==s.taskKey?(u={org:r,taskKey:s.taskKey},t[15]=r,t[16]=s.taskKey,t[17]=u):u=t[17];let f;t[18]!==l.search?(f=m=>({...m,...l.search}),t[18]=l.search,t[19]=f):f=t[19];let p;return t[20]!==u||t[21]!==f?(p=o.jsx(ei,{to:"/$org/tasks/{-$taskKey}",params:u,search:f,replace:!0}),t[20]=u,t[21]=f,t[22]=p):p=t[22],p}let c;t[23]!==r?(c={org:r},t[23]=r,t[24]=c):c=t[24];let d;t[25]!==l.search?(d=u=>({...u,...l.search}),t[25]=l.search,t[26]=d):d=t[26];let h;return t[27]!==c||t[28]!==d||t[29]!==l.to?(h=o.jsx(ei,{to:l.to,params:c,search:d,replace:!0}),t[27]=c,t[28]=d,t[29]=l.to,t[30]=h):h=t[30],h}function Wme(){const t=F.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const s=ia(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[1]=n):n=t[1];const i=pr(n),{org:r,taskId:a}=s;if(!r||a===void 0)return null;let l;return t[2]!==r||t[3]!==i||t[4]!==a?(l=cV({org:r,taskId:a,search:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=l):l=t[5],l}function qme(){const t=F.c(29),e=Wme();if(!e)return null;if(e.to==="/$org/agents/{-$panel}"){let i;t[0]!==e.params.org||t[1]!==e.params.panel?(i={org:e.params.org,panel:e.params.panel},t[0]=e.params.org,t[1]=e.params.panel,t[2]=i):i=t[2];let r;t[3]!==e.params.project||t[4]!==e.search?(r=()=>({...e.search,virtualmcpid:e.params.project}),t[3]=e.params.project,t[4]=e.search,t[5]=r):r=t[5];let a;return t[6]!==i||t[7]!==r?(a=o.jsx(ei,{to:"/$org/agents/{-$panel}",params:i,search:r,replace:!0}),t[6]=i,t[7]=r,t[8]=a):a=t[8],a}if(e.to==="/$org/tasks/{-$taskKey}"){let i;t[9]!==e.params.org?(i={org:e.params.org},t[9]=e.params.org,t[10]=i):i=t[10];let r;return t[11]!==i||t[12]!==e.search?(r=o.jsx(ei,{to:"/$org/tasks/{-$taskKey}",params:i,search:e.search,replace:!0}),t[11]=i,t[12]=e.search,t[13]=r):r=t[13],r}if(e.to==="/$org/reports"){let i;t[14]!==e.params.org?(i={org:e.params.org},t[14]=e.params.org,t[15]=i):i=t[15];let r;return t[16]!==i||t[17]!==e.search?(r=o.jsx(ei,{to:"/$org/reports",params:i,search:e.search,replace:!0}),t[16]=i,t[17]=e.search,t[18]=r):r=t[18],r}if(e.to==="/$org/library"){let i;t[19]!==e.params.org?(i={org:e.params.org},t[19]=e.params.org,t[20]=i):i=t[20];let r;return t[21]!==i||t[22]!==e.search?(r=o.jsx(ei,{to:"/$org/library",params:i,search:e.search,replace:!0}),t[21]=i,t[22]=e.search,t[23]=r):r=t[23],r}let s;t[24]!==e.params.org?(s={org:e.params.org},t[24]=e.params.org,t[25]=s):s=t[25];let n;return t[26]!==s||t[27]!==e.search?(n=o.jsx(ei,{to:"/$org/home",params:s,search:e.search,replace:!0}),t[26]=s,t[27]=e.search,t[28]=n):n=t[28],n}function Gme(){const t=F.c(6),e=Za(),s=Ks();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const{preview:i}=pr(n);if(!e||!i)return null;let r;t[1]!==s?(r=()=>s({to:".",search:Yme}),t[1]=s,t[2]=r):r=t[2];let a;return t[3]!==i||t[4]!==r?(a=o.jsx(Fj,{previewPath:i,onClose:r,showSeeInLibrary:!0}),t[3]=i,t[4]=r,t[5]=a):a=t[5],a}function Yme(t){const{preview:e,...s}=t;return s}const Qme=T.createContext(null);function mN(){return T.useContext(Qme)}const Vc=T.createContext(null);function ho(){return T.use(Vc)}function pN(t){const e=F.c(13),{children:s}=t,n=ae(),i=ld(),r=mN(),a=l0()!==null;let l;e[0]!==a||e[1]!==i||e[2]!==r?(l=o.jsx(V_,{}),e[0]=a,e[1]=i,e[2]=r,e[3]=l):l=e[3];const c=l;let d;e[4]!==n?(d=n("agentShellLayout.agentShellLayout.chatLoadingError"),e[4]=n,e[5]=d):d=e[5];let h;e[6]!==d?(h=o.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:d}),e[6]=d,e[7]=h):h=e[7];const u=s??c;let f;e[8]!==u?(f=o.jsx(Ci,{children:u}),e[8]=u,e[9]=f):f=e[9];let p;return e[10]!==h||e[11]!==f?(p=o.jsx(tn,{fallback:h,children:f}),e[10]=h,e[11]=f,e[12]=p):p=e[12],p}function a6(t){const e=F.c(13),{threadId:s,children:n}=t;if(ae(),mN(),s===null){let r;return e[0]!==n?(r=o.jsx(ln.ThreadlessProvider,{children:n}),e[0]=n,e[1]=r):r=e[1],r}let i;return e[10]!==n||e[11]!==s?(i=o.jsx(ln.ActiveTaskProvider,{taskId:s,children:n}),e[10]=n,e[11]=s,e[12]=i):i=e[12],i}function gN(t){const e=F.c(3),{onNewTaskRef:s,createNewTask:n}=t;let i;return e[0]!==n||e[1]!==s?(i=()=>(s.current=n,()=>{s.current=null}),e[0]=n,e[1]=s,e[2]=i):i=e[2],T.useLayoutEffect(i),null}function l6({virtualMcpId:t,hasActiveGithubRepo:e,sandboxMap:s,children:n}){const i=ae(),{currentBranch:r,activeTask:a,setCurrentTaskBranch:l}=on(),c=ld(),d="agent-sandbox",{data:h}=On.useSession(),u=h?.user?.id,f=!E6({isDesktopApp:c,harnessId:a?.harness_id}),p=xz({agentSandboxMap:s,threadSandboxMap:a?.metadata?.sandboxMap,userId:u,ownerId:a?.created_by,branch:r}),m=e||xn(a?.metadata),g=T.useRef(null),x=f&&pz({threadLoaded:!!a,isOwner:!!u&&a?.created_by===u,hasActiveGithubRepo:m,branch:r??null,attempted:g.current===(a?.id??null)});T.useEffect(()=>{!x||!a||(g.current=a.id,l(Gc(h?.user?.name||h?.user?.email?.split("@")[0])))},[x,a,h,l]);const{org:b}=Ue(),v=i0("cms_auto_fresh_branch"),L=_n(t),_=T.useRef(null),y=v&&L.resolved&&L.runtime==="cms"&&!!b?.slug&&!!r&&_.current!==(a?.id??null),S=Yt({...L$({orgSlug:b?.slug??"",virtualMcpId:t,branch:r??""}),enabled:y}).data?.lastCommitAt??null;T.useEffect(()=>{!y||!a||y$(S,Date.now())&&(_.current=a.id,l(Gc(h?.user?.name||h?.user?.email?.split("@")[0])))},[y,S,a,h,l]);const k=As(t),j=Lg(k,r),{releases:C,createRelease:V}=k9(t),A=!!u&&a?.created_by===u&&!!r&&r!==j&&!C.some(M=>M.branch===r),P=T.useRef(null);T.useEffect(()=>{!A||!r||P.current!==r&&(P.current=r,V({branch:r,name:ep(C,i("thread.branchPicker.defaultVersionName")),color:Th(C.length),createdAt:new Date().toISOString()}).catch(()=>{}))},[A,r,C,V,i]);const R=L.resolved?L.runtime:null,E=eB(t,r??void 0),D=(u&&r?AR(p?.[u]?.[r]):{})[d]??null,O=D?.previewUrl??null,B=f&&R!=="cms"&&(!!D||E);return f?R==="cms"?o.jsx(Kb,{children:n},`${t}:${r??"no-branch"}:${a?.id??""}`):o.jsx(dz,{virtualMcpId:t,branch:r??null,previewUrl:O,enabled:B,children:o.jsx(jz,{executionEnabled:f,virtualMcpId:t,branch:r??null,userId:u??null,hasActiveGithubRepo:m,vmEntry:D,threadId:a?.id??null,children:o.jsx(Kb,{children:n},`${t}:${r??"no-branch"}:${a?.id??""}`)})},a?.id??"no-thread"):o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex h-full rounded-[0.75rem] bg-background card-shadow",children:o.jsx(Ti,{image:o.jsx(vn,{size:48,className:"text-muted-foreground"}),title:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWeb"),description:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWebDescription")})})})}function Xme(t){const e=F.c(15),{entity:s,virtualMcpId:n,layout:i,onNewTaskRef:r}=t;let a;e[0]!==i.createNewTask||e[1]!==r?(a=o.jsx(gN,{onNewTaskRef:r,createNewTask:i.createNewTask}),e[0]=i.createNewTask,e[1]=r,e[2]=a):a=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(pN,{}),e[3]=l):l=e[3];let c;e[4]!==s||e[5]!==i.mainOpen||e[6]!==i.sidePanelOpen||e[7]!==i.threadId||e[8]!==i.toggleMain||e[9]!==i.toggleSidePanel||e[10]!==n?(c=o.jsx(Ci,{children:o.jsx(Eme,{virtualMcpId:n,taskId:i.threadId,entity:s,sidePanelOpen:i.sidePanelOpen,mainOpen:i.mainOpen,toggleSidePanel:i.toggleSidePanel,toggleMain:i.toggleMain,chatContent:l})}),e[4]=s,e[5]=i.mainOpen,e[6]=i.sidePanelOpen,e[7]=i.threadId,e[8]=i.toggleMain,e[9]=i.toggleSidePanel,e[10]=n,e[11]=c):c=e[11];let d;return e[12]!==a||e[13]!==c?(d=o.jsxs(o.Fragment,{children:[a,c]}),e[12]=a,e[13]=c,e[14]=d):d=e[14],d}function Jme(t){const e=F.c(19),{virtualMcpId:s,layout:n,onNewTaskRef:i}=t,r=ae();let a;e[0]!==n.mainOpen||e[1]!==n.sidePanelOpen||e[2]!==n.sidePanelParamPresent?(a=rB({visibility:{sidePanelOpen:n.sidePanelOpen,mainOpen:n.mainOpen},sidePanelParamPresent:n.sidePanelParamPresent}),e[0]=n.mainOpen,e[1]=n.sidePanelOpen,e[2]=n.sidePanelParamPresent,e[3]=a):a=e[3];const l=a;let c;e[4]!==n.threadId||e[5]!==s?(c=o.jsx(KP.Tabs,{children:o.jsx(Bme,{virtualMcpId:s,taskId:n.threadId})}),e[4]=n.threadId,e[5]=s,e[6]=c):c=e[6];let d;e[7]!==n.createNewTask||e[8]!==i?(d=o.jsx(gN,{onNewTaskRef:i,createNewTask:n.createNewTask}),e[7]=n.createNewTask,e[8]=i,e[9]=d):d=e[9];let h;e[10]!==n.threadId||e[11]!==l||e[12]!==r||e[13]!==s?(h=o.jsx(Ci,{children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:l==="main"?o.jsx(tn,{fallback:o.jsx("div",{role:"alert",className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:r("agentShellLayout.agentShellLayout.somethingWentWrong")}),children:o.jsx(Ci,{children:o.jsx("div",{"data-testid":"main-panel",className:"h-full",children:o.jsx(IC,{taskId:n.threadId,virtualMcpId:s})})})}):o.jsx(fN,{chatContent:o.jsx(pN,{})})})}),e[10]=n.threadId,e[11]=l,e[12]=r,e[13]=s,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==d||e[17]!==h?(u=o.jsxs(o.Fragment,{children:[c,d,h]}),e[15]=c,e[16]=d,e[17]=h,e[18]=u):u=e[18],u}function Zme(){const t=F.c(109),e=ae(),s=Za(),n=Ks(),{org:i}=Ue();FP(i.slug);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const l=ia(r).org??"",c=l0(),d=M8(),h=I8(),[u]=T.useState(epe),{data:f}=On.useSession();let p;t[1]!==f?.user?.email||t[2]!==f?.user?.name?(p=()=>Gc(f?.user?.name||f?.user?.email?.split("@")[0]),t[1]=f?.user?.email,t[2]=f?.user?.name,t[3]=p):p=t[3];const[m]=T.useState(p),g=n9(),x=T.useSyncExternalStore(g.threads.subscribe,g.threads.get),b=T.useSyncExternalStore(g.threadsStatus.subscribe,g.threadsStatus.get),v=As(d);let L;t[4]!==v?(L=v&&aa(v),t[4]=v,t[5]=L):L=t[5];const _=!!L,y=Lg(v,null),w=Hme(c,d,m);lB(w.status==="ready"?w.task:null);const S=v?.metadata?.ui?.layout??null;let k;t[6]!==S?(k=S?{defaultMainView:S.defaultMainView??null,chatDefaultOpen:S.chatDefaultOpen??null}:null,t[6]=S,t[7]=k):k=t[7];const j=k;let C;t[8]!==d?(C={virtualMcpId:d,isAgentRoute:!0},t[8]=d,t[9]=C):C=t[9];const V=aB(j,C),N=T.useRef(null);let A,P;if(t[10]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{const H=W=>{U6(W)&&W.shiftKey&&W.code==="KeyS"&&!W.repeat&&(W.preventDefault(),N.current?.())};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},P=[],t[10]=A,t[11]=P):(A=t[10],P=t[11]),T.useEffect(A,P),c===null&&h&&v){if(b.kind==="loading"){let G;t[12]===Symbol.for("react.memo_cache_sentinel")?(G=o.jsx(et,{className:"size-4 mr-2"}),t[12]=G):G=t[12];let Y;t[13]!==e?(Y=e("agentShellLayout.agentShellLayout.creatingTask"),t[13]=e,t[14]=Y):Y=t[14];let Z;return t[15]!==Y?(Z=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{role:"status","aria-live":"polite",className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[G,Y]})}),t[15]=Y,t[16]=Z):Z=t[16],Z}let H;t[17]!==y||t[18]!==v.metadata||t[19]!==_||t[20]!==f?.user?.id||t[21]!==x||t[22]!==d?(H=zP(x,d,f?.user?.id,i9(v.metadata),_,{baseBranch:y}),t[17]=y,t[18]=v.metadata,t[19]=_,t[20]=f?.user?.id,t[21]=x,t[22]=d,t[23]=H):H=t[23];const K=H?.id??(_?u:null);if(K){let G;return t[24]!==K?(G=o.jsx(ei,{to:".",replace:!0,search:Y=>({...Y,thread:K})}),t[24]=K,t[25]=G):G=t[25],G}}const R=d;let E;t[26]!==v||t[27]!==d?(E={virtualMcpId:d,entity:v},t[26]=v,t[27]=d,t[28]=E):E=t[28];const I=E;if(w.status==="creating"||w.status==="loading"){let H;t[29]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(et,{className:"size-4 mr-2"}),t[29]=H):H=t[29];let W;t[30]!==e?(W=e("agentShellLayout.agentShellLayout.creatingTask"),t[30]=e,t[31]=W):W=t[31];let K;t[32]!==W?(K=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{role:"status","aria-live":"polite",className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[H,W]})}),t[32]=W,t[33]=K):K=t[33];let G;return t[34]!==I||t[35]!==K?(G=o.jsx(Vc,{value:I,children:K}),t[34]=I,t[35]=K,t[36]=G):G=t[36],G}if(w.status==="error"){let H;t[37]!==e?(H=e("agentShellLayout.agentShellLayout.taskUnavailable"),t[37]=e,t[38]=H):H=t[38];let W;t[39]!==H?(W=o.jsx("div",{className:"font-medium",children:H}),t[39]=H,t[40]=W):W=t[40];let K;t[41]!==w.error.message?(K=o.jsx("div",{className:"text-muted-foreground",children:w.error.message}),t[41]=w.error.message,t[42]=K):K=t[42];let G;t[43]!==K||t[44]!==W?(G=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{role:"alert",className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[W,K]})}),t[43]=K,t[44]=W,t[45]=G):G=t[45];let Y;return t[46]!==I||t[47]!==G?(Y=o.jsx(Vc,{value:I,children:G}),t[46]=I,t[47]=G,t[48]=Y):Y=t[48],Y}if(!v){let H;t[49]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(vn,{size:48,className:"text-muted-foreground"}),t[49]=H):H=t[49];let W;t[50]!==e?(W=e("agentShellLayout.agentShellLayout.agentNotFound"),t[50]=e,t[51]=W):W=t[51];let K;t[52]!==e||t[53]!==d?(K=e("agentShellLayout.agentShellLayout.agentNotFoundDescription",{virtualMcpId:d}),t[52]=e,t[53]=d,t[54]=K):K=t[54];let G;t[55]!==n||t[56]!==l?(G=()=>n({to:"/$org",params:{org:l}}),t[55]=n,t[56]=l,t[57]=G):G=t[57];let Y;t[58]!==e?(Y=e("agentShellLayout.agentShellLayout.goToOrgHome"),t[58]=e,t[59]=Y):Y=t[59];let Z;t[60]!==G||t[61]!==Y?(Z=o.jsx(me,{variant:"outline",onClick:G,children:Y}),t[60]=G,t[61]=Y,t[62]=Z):Z=t[62];let te;t[63]!==K||t[64]!==Z||t[65]!==W?(te=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx(Ti,{image:H,title:W,description:K,actions:Z})})}),t[63]=K,t[64]=Z,t[65]=W,t[66]=te):te=t[66];let X;return t[67]!==I||t[68]!==te?(X=o.jsx(Vc,{value:I,children:te}),t[67]=I,t[68]=te,t[69]=X):X=t[69],X}if(s){const H=w.status==="ready"?w.task:null,W=v?.metadata?.sandboxMap;let K;t[70]!==R||t[71]!==V?(K=o.jsx(Ci,{children:o.jsx(Jme,{virtualMcpId:R,layout:V,onNewTaskRef:N})}),t[70]=R,t[71]=V,t[72]=K):K=t[72];let G;t[73]!==V.providerKey||t[74]!==V.threadId||t[75]!==K?(G=o.jsx(a6,{threadId:V.threadId,children:K},V.providerKey),t[73]=V.providerKey,t[74]=V.threadId,t[75]=K,t[76]=G):G=t[76];let Y;t[77]!==_||t[78]!==G||t[79]!==W||t[80]!==d?(Y=o.jsx(l6,{virtualMcpId:d,hasActiveGithubRepo:_,sandboxMap:W,children:G}),t[77]=_,t[78]=G,t[79]=W,t[80]=d,t[81]=Y):Y=t[81];let Z;t[82]!==R||t[83]!==Y||t[84]!==H?(Z=o.jsx("div",{className:"flex flex-col flex-1 min-w-0 bg-background min-h-0",children:o.jsx(ln.Provider,{virtualMcpId:R,task:H,children:Y},R)}),t[82]=R,t[83]=Y,t[84]=H,t[85]=Z):Z=t[85];let te;return t[86]!==I||t[87]!==Z?(te=o.jsx(Vc,{value:I,children:Z}),t[86]=I,t[87]=Z,t[88]=te):te=t[88],te}const D=w.status==="ready"?w.task:null,O=v?.metadata?.sandboxMap;let B;t[89]!==v||t[90]!==V||t[91]!==d?(B=o.jsx(Ci,{children:o.jsx(Xme,{entity:v,virtualMcpId:d,layout:V,onNewTaskRef:N})}),t[89]=v,t[90]=V,t[91]=d,t[92]=B):B=t[92];let M;t[93]!==V.providerKey||t[94]!==V.threadId||t[95]!==B?(M=o.jsx(a6,{threadId:V.threadId,children:B},V.providerKey),t[93]=V.providerKey,t[94]=V.threadId,t[95]=B,t[96]=M):M=t[96];let z;t[97]!==_||t[98]!==M||t[99]!==O||t[100]!==d?(z=o.jsx(l6,{virtualMcpId:d,hasActiveGithubRepo:_,sandboxMap:O,children:M}),t[97]=_,t[98]=M,t[99]=O,t[100]=d,t[101]=z):z=t[101];let $;t[102]!==R||t[103]!==z||t[104]!==D?($=o.jsx(ln.Provider,{virtualMcpId:R,task:D,children:z},R),t[102]=R,t[103]=z,t[104]=D,t[105]=$):$=t[105];let U;return t[106]!==I||t[107]!==$?(U=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsx(Vc,{value:I,children:$})}),t[106]=I,t[107]=$,t[108]=U):U=t[108],U}function epe(){return crypto.randomUUID()}function tpe(){const t=F.c(3);let e,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(qme,{}),s=o.jsx(Kme,{}),t[0]=e,t[1]=s):(e=t[0],s=t[1]);let n;return t[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsxs(Ci,{children:[e,s,o.jsxs(nE,{children:[o.jsx(Zme,{}),o.jsx(Gme,{})]})]}),t[2]=n):n=t[2],n}const spe=Object.freeze(Object.defineProperty({__proto__:null,default:tpe,useInsetContext:ho},Symbol.toStringTag,{value:"Module"}));export{jL as $,$3e as A,B3e as B,kj as C,C3e as D,fh as E,j3e as F,z3 as G,zu as H,N3e as I,nre as J,GS as K,Mge as L,$g as M,jq as N,wS as O,r3 as P,Qc as Q,Aq as R,Bi as S,Xt as T,y0 as U,_0 as V,m3 as W,Xc as X,h3 as Y,KL as Z,c3 as _,j0 as a,s3e as a$,f3 as a0,fr as a1,Gae as a2,Qae as a3,In as a4,T3e as a5,u3 as a6,jj as a7,V3e as a8,Gge as a9,Qre as aA,w3e as aB,QS as aC,jf as aD,Mne as aE,Fge as aF,Mre as aG,x3e as aH,JS as aI,Xge as aJ,L3e as aK,k3e as aL,S3e as aM,Tre as aN,Pee as aO,Eee as aP,_3e as aQ,f4 as aR,Fk as aS,lle as aT,ed as aU,bd as aV,Uge as aW,Jge as aX,r3e as aY,hte as aZ,o3e as a_,Cf as aa,Ri as ab,Rk as ac,d3 as ad,Ck as ae,Cs as af,i3e as ag,p3e as ah,g3e as ai,wre as aj,g4 as ak,Bge as al,ij as am,Ore as an,loe as ao,z9 as ap,Q3 as aq,ho as ar,oae as as,wf as at,jp as au,Wa as av,y3e as aw,Rp as ax,cj as ay,Bre as az,no as b,nte as b0,Qge as b1,n3e as b2,t3e as b3,e3e as b4,f3e as b5,Dee as b6,F3 as b7,qge as b8,Yge as b9,A3e as bA,I3e as bB,Rf as bC,nle as bD,O3e as bE,$ge as bF,IS as bG,wee as bH,spe as bI,Wge as ba,m3e as bb,h4 as bc,KS as bd,HS as be,zge as bf,Ree as bg,Hge as bh,vse as bi,c3e as bj,d3e as bk,Zge as bl,l3e as bm,a3e as bn,u3e as bo,zre as bp,x4 as bq,v3e as br,ooe as bs,b3e as bt,P3e as bu,E3e as bv,D3e as bw,Ra as bx,M3e as by,R3e as bz,Sf as c,n4 as d,V0 as e,$c as f,kn as g,h3e as h,r4 as i,Toe as j,Ige as k,yf as l,Oge as m,wae as n,Kge as o,_n as p,Kee as q,rae as r,rN as s,ale as t,la as u,Wee as v,Xd as w,wj as x,Sc as y,kv as z};