decocms 4.321.4 → 4.321.6

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 (253) hide show
  1. package/dist/client/assets/{AlertCircle-Dv6G1zch.js → AlertCircle-CG7tfapy.js} +1 -1
  2. package/dist/client/assets/{AreaChart-Bh324PJ7.js → AreaChart-CZiIuPwc.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-Dyo7ZseM.js → ArrowLeft-Dexv6rHk.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-Dl1f2e9F.js → ArrowUp-CxKA4POx.js} +1 -1
  5. package/dist/client/assets/{Check-DiuzOTdo.js → Check-Jn0qXgT0.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-BTMeEcth.js → CheckCircle-BnpxIwzg.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CYJzqw1W.js → ChevronRight-CKftPemQ.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-C0Fdqi9U.js → ChevronSelectorVertical-BPOo032l.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CHN7dU5d.js → ChevronUp-BCwuiyHj.js} +1 -1
  10. package/dist/client/assets/{Copy01-CZOGrHZ9.js → Copy01-jXW2eGyY.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-CxZhImMf.js → CreditCard01-Zn4AjX46.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-CsIT64BQ.js → DotsVertical-C65YDOa_.js} +1 -1
  13. package/dist/client/assets/{Download01-DEU1JkfL.js → Download01-BpcIjY9x.js} +1 -1
  14. package/dist/client/assets/{ErrorBarContext-44kQWZkn.js → ErrorBarContext-3KuuNxaa.js} +1 -1
  15. package/dist/client/assets/{Eye-DNWGZGwG.js → Eye-DvBjB5D4.js} +1 -1
  16. package/dist/client/assets/{GitBranch01-4HvT92Fb.js → GitBranch01-Bde_Ik_K.js} +1 -1
  17. package/dist/client/assets/{Globe01-CySbwdvS.js → Globe01-D2uoGclE.js} +1 -1
  18. package/dist/client/assets/{HardDrive-CkhRSS5J.js → HardDrive-CBqO3DS3.js} +1 -1
  19. package/dist/client/assets/{Image01-CnSVldaE.js → Image01-0uExgWAI.js} +1 -1
  20. package/dist/client/assets/{Key01-BvfZtZef.js → Key01-BiKWCM1S.js} +1 -1
  21. package/dist/client/assets/{Link01-DELnIRjt.js → Link01-C7a_h6ys.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-6r85JlVB.js → LinkExternal01-D_IXdPPU.js} +1 -1
  23. package/dist/client/assets/{Monitor01-Ciyr-Z_-.js → Monitor01-CKYtARge.js} +1 -1
  24. package/dist/client/assets/{Package-CGoiEMne.js → Package-D0PXqO6P.js} +1 -1
  25. package/dist/client/assets/{Palette-CLInuq6o.js → Palette-CQVEzzhe.js} +1 -1
  26. package/dist/client/assets/{Play-CFcccqRE.js → Play-CONIoWIl.js} +1 -1
  27. package/dist/client/assets/{Plus-DfniZcTj.js → Plus-D7VA57q5.js} +1 -1
  28. package/dist/client/assets/{SearchMd-MV7l96VN.js → SearchMd-C1loDEwy.js} +1 -1
  29. package/dist/client/assets/{Sector-CXJOKUEx.js → Sector-DWJi3JDL.js} +1 -1
  30. package/dist/client/assets/{Settings02-DLKKNdDt.js → Settings02-DfFNQquZ.js} +1 -1
  31. package/dist/client/assets/{Share07-BdYeKEPF.js → Share07-8oXDBqwk.js} +1 -1
  32. package/dist/client/assets/{Shield01-Dbav6S5n.js → Shield01-CrPC_5gY.js} +1 -1
  33. package/dist/client/assets/{Stars01-PjG8UcMP.js → Stars01-BTmtR5If.js} +1 -1
  34. package/dist/client/assets/{Sun-DmqaD0GF.js → Sun-N_eYVUUU.js} +1 -1
  35. package/dist/client/assets/{Tool01-CdkG5j9q.js → Tool01-CtOHcy0Y.js} +1 -1
  36. package/dist/client/assets/{Tool02-CtS9_9Au.js → Tool02-DHxIusmd.js} +1 -1
  37. package/dist/client/assets/{Trash01-DpQq-xrz.js → Trash01-CHla-FrA.js} +1 -1
  38. package/dist/client/assets/{TrendUp01-Dwgdtlxo.js → TrendUp01-BctNF4vg.js} +1 -1
  39. package/dist/client/assets/{Upload01-C-aUSpkq.js → Upload01-VP9EBYtl.js} +1 -1
  40. package/dist/client/assets/{User01-CIlNhP30.js → User01-8XeMepHg.js} +1 -1
  41. package/dist/client/assets/{UserSquare-CDP0762p.js → UserSquare-BEv1iIj5.js} +1 -1
  42. package/dist/client/assets/{Users01-CJ-REDik.js → Users01-CvPFHBcf.js} +1 -1
  43. package/dist/client/assets/{Users03-C7y8d7lq.js → Users03-cesUeOsp.js} +1 -1
  44. package/dist/client/assets/{XCircle-D4lh-8UY.js → XCircle-DZJkY1-f.js} +1 -1
  45. package/dist/client/assets/{XClose-CUFBDVP-.js → XClose-mJWP0IZB.js} +1 -1
  46. package/dist/client/assets/{Zap-BD_2K_N7.js → Zap-JQtzyV8B.js} +1 -1
  47. package/dist/client/assets/{ZoomOut-CYflMQc3.js → ZoomOut-D8t79aO2.js} +1 -1
  48. package/dist/client/assets/{access-gate-B8SIJFr7.js → access-gate-DhjnuxYh.js} +1 -1
  49. package/dist/client/assets/{agent-icon-Dj2ko6xN.js → agent-icon-Dsw04fQF.js} +1 -1
  50. package/dist/client/assets/{agents-list-DedSGOjL.js → agents-list-BazgXeqr.js} +1 -1
  51. package/dist/client/assets/{ai-providers-PLInDAtU.js → ai-providers-C59crxe5.js} +1 -1
  52. package/dist/client/assets/{alert-D50pTGlG.js → alert-CctLdkUH.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-DN6vGwKb.js → alert-dialog-BU3enZKF.js} +1 -1
  54. package/dist/client/assets/{analytics-tab-DkOamiBu.js → analytics-tab-BAIQskOJ.js} +1 -1
  55. package/dist/client/assets/api-keys-8w-9P3dp.js +1 -0
  56. package/dist/client/assets/{api-keys-CUuIcLOK.js → api-keys-CwZoIgmV.js} +1 -1
  57. package/dist/client/assets/{app-editor-CXxJdDRj.js → app-editor-Bvzl_qDB.js} +1 -1
  58. package/dist/client/assets/{auth-BF15VDKW.js → auth-Ctf1zdSk.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-CfznBWAb.js → auth-catchall-DfbKNMqE.js} +1 -1
  60. package/dist/client/assets/{auth-entry-BmdnPyAe.js → auth-entry-BsXiAQoR.js} +1 -1
  61. package/dist/client/assets/{auth-split-layout-D8Qd5X5d.js → auth-split-layout-BwXlZwBP.js} +1 -1
  62. package/dist/client/assets/{authenticate-and-persist-oauth-ORS2OKxY.js → authenticate-and-persist-oauth-UjkEE9k3.js} +1 -1
  63. package/dist/client/assets/{automation-list-row-D_CbqNGG.js → automation-list-row-CakAIrvQ.js} +1 -1
  64. package/dist/client/assets/{automation-runs-oTVIsV-n.js → automation-runs-BP4svOKv.js} +1 -1
  65. package/dist/client/assets/{automations-CkLUemPj.js → automations-47G1qGwp.js} +1 -1
  66. package/dist/client/assets/{avatar-BLCEls6Y.js → avatar-ayySA21l.js} +1 -1
  67. package/dist/client/assets/{badge-CSQtV4I1.js → badge-BJg3YTbr.js} +1 -1
  68. package/dist/client/assets/{block-document-DHWwd1Xg.js → block-document-DOFjntDc.js} +1 -1
  69. package/dist/client/assets/{breadcrumb-BY2L4Yur.js → breadcrumb-B5Tcv0Uh.js} +1 -1
  70. package/dist/client/assets/{buckets-BgzCy0Wo.js → buckets-DCKwVcGS.js} +1 -1
  71. package/dist/client/assets/{bulk-category-panel-BsKaZScD.js → bulk-category-panel-BWY_YPZV.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-CpA6LOWl.js → capability-load-error-BERy8yZe.js} +1 -1
  73. package/dist/client/assets/{cards-DDW_x79J.js → cards-D9Ttj2cE.js} +1 -1
  74. package/dist/client/assets/{category-editor-Ddez8F9D.js → category-editor-BPZKWEN1.js} +1 -1
  75. package/dist/client/assets/{cdn-tab-DFZvtAMl.js → cdn-tab-BU_7vQmo.js} +1 -1
  76. package/dist/client/assets/{chart-CMxD7edM.js → chart-DxN2Cs4Z.js} +1 -1
  77. package/dist/client/assets/{chat-context-C5TtMbeA.js → chat-context-ffF_r7RU.js} +1 -1
  78. package/dist/client/assets/{checkbox-CHvOkNek.js → checkbox-DmweFMZg.js} +1 -1
  79. package/dist/client/assets/{choose-editor-Bl3IlbHF.js → choose-editor-ChPKiRJQ.js} +1 -1
  80. package/dist/client/assets/{cli-auth-success-CEFSPlKa.js → cli-auth-success-3b6OvqFq.js} +1 -1
  81. package/dist/client/assets/{client-icons-CIyJtQzW.js → client-icons-DX-H77xu.js} +1 -1
  82. package/dist/client/assets/{collection-detail-V8ouNFsx.js → collection-detail-CDYBCwYK.js} +1 -1
  83. package/dist/client/assets/{collection-display-button-ch8VsZJ-.js → collection-display-button-COCZggWW.js} +1 -1
  84. package/dist/client/assets/{collection-search-C0aemqyU.js → collection-search-DUFT-3aZ.js} +1 -1
  85. package/dist/client/assets/{collection-table-wrapper-RraLzE6q.js → collection-table-wrapper-CSMTQGj2.js} +1 -1
  86. package/dist/client/assets/{collection-tabs-DM3JgymS.js → collection-tabs-aHnkLK94.js} +1 -1
  87. package/dist/client/assets/{command-aq94pylP.js → command-CEQjEkRa.js} +1 -1
  88. package/dist/client/assets/{commerce-onboarding-C6pquuZu.js → commerce-onboarding-BVWKpNBX.js} +1 -1
  89. package/dist/client/assets/{connect-Db_FA2vM.js → connect-C6lph8Iz.js} +1 -1
  90. package/dist/client/assets/{connect-layout-DUtKqe8O.js → connect-layout-CS-AhNLB.js} +1 -1
  91. package/dist/client/assets/{connection-card-DZD9pIth.js → connection-card-Bwgx5OMm.js} +1 -1
  92. package/dist/client/assets/connection-detail-DCF5hqwD.js +1 -0
  93. package/dist/client/assets/{connection-form-helpers-CJ7gQUqN.js → connection-form-helpers-Cs1EiOkG.js} +1 -1
  94. package/dist/client/assets/connection-qt8m11-c.js +1 -0
  95. package/dist/client/assets/{connections-DP-c-cpk.js → connections-C_jYcs4m.js} +1 -1
  96. package/dist/client/assets/{create-organization-dialog-BFeoMeJI.js → create-organization-dialog--WflCODd.js} +1 -1
  97. package/dist/client/assets/{decopilot-sse-pool-B2Ek6f9E.js → decopilot-sse-pool-Cp5pr9Ve.js} +1 -1
  98. package/dist/client/assets/{dialog-BVuXhd_n.js → dialog-DDd8wUS7.js} +1 -1
  99. package/dist/client/assets/{domain-settings-Creutor_.js → domain-settings-b-Gf934e.js} +1 -1
  100. package/dist/client/assets/{drawer-CXBUq1b4.js → drawer-CxFI5tCn.js} +1 -1
  101. package/dist/client/assets/{dropdown-menu-7nrlUaMG.js → dropdown-menu-C3Gdadki.js} +1 -1
  102. package/dist/client/assets/{e2e-tab-Dr-mwFjd.js → e2e-tab-9O9jlog6.js} +1 -1
  103. package/dist/client/assets/{editor-CSXnkhqo.js → editor-B0M9C5II.js} +1 -1
  104. package/dist/client/assets/{empty-state-D1TMU-hy.js → empty-state-Cs8gUH2e.js} +1 -1
  105. package/dist/client/assets/{empty-state-N8rf9YSi.js → empty-state-L8hCXC--.js} +1 -1
  106. package/dist/client/assets/extract-connection-data-C2Ocp5Tk.js +1 -0
  107. package/dist/client/assets/{file-explorer-Ku7EjWAL.js → file-explorer-DTbMKDAB.js} +1 -1
  108. package/dist/client/assets/{file-type-icon-BnBH2hK9.js → file-type-icon-C5mq72Tm.js} +1 -1
  109. package/dist/client/assets/{folder-icon-1xzQyJ7C.js → folder-icon-Dt2zI1nQ.js} +1 -1
  110. package/dist/client/assets/{form-D7fAV9eN.js → form-DR4f8DO7.js} +1 -1
  111. package/dist/client/assets/{general-DLE7dZPk.js → general-uVPlw24q.js} +1 -1
  112. package/dist/client/assets/{github-repo-picker-CVdHp0M0.js → github-repo-picker-Dyu49H5P.js} +1 -1
  113. package/dist/client/assets/{hooks-y1rkw2ir.js → hooks-J2gbnuVW.js} +1 -1
  114. package/dist/client/assets/{hosting-tab-BAPE6MlT.js → hosting-tab-StoCQBLo.js} +1 -1
  115. package/dist/client/assets/{index-B9n6l693.js → index--9Kt6-Xb.js} +1 -1
  116. package/dist/client/assets/{index-DHZW87eM.js → index-B7iA3R9e.js} +1 -1
  117. package/dist/client/assets/{index-Ciqhx4Es.js → index-CAw6g9tV.js} +3 -3
  118. package/dist/client/assets/{index-BgfHML7J.js → index-CP6R9dTL.js} +1 -1
  119. package/dist/client/assets/{index-DK46XAl9.js → index-DH6qLcGa.js} +7 -7
  120. package/dist/client/assets/{index-o5eMIupH.js → index-DNghV_Kw.js} +1 -1
  121. package/dist/client/assets/{index-BOJEwmSU.js → index-DU91evk-.js} +1 -1
  122. package/dist/client/assets/{index-CmirxoQz.js → index-DaThHROC.js} +1 -1
  123. package/dist/client/assets/{index-Dr0vXAye.js → index-DahqZ1Pw.js} +1 -1
  124. package/dist/client/assets/{index-CbU-T1m1.js → index-hsED2j2G.js} +1 -1
  125. package/dist/client/assets/{index-redirect-Dy4llany.js → index-redirect-1FO2ZwBa.js} +1 -1
  126. package/dist/client/assets/{infra-billing-CDH62RCF.js → infra-billing-HsGxVjhH.js} +1 -1
  127. package/dist/client/assets/{input-HiBvv-tS.js → input-CRq9rZYf.js} +1 -1
  128. package/dist/client/assets/{integration-icon-B63L2HtM.js → integration-icon-gY5UnY38.js} +1 -1
  129. package/dist/client/assets/{invite-member-dialog-S-x8vUoc.js → invite-member-dialog-RPIPoLmq.js} +1 -1
  130. package/dist/client/assets/{label-CGF50XGa.js → label-ByckMHtZ.js} +1 -1
  131. package/dist/client/assets/{layout-Cf_v7v8J.js → layout-C0m5fUEQ.js} +1 -1
  132. package/dist/client/assets/{login-BRT3iRa2.js → login-nfCx3aQb.js} +1 -1
  133. package/dist/client/assets/{markdown-Srunai6w.js → markdown-C1VdpJ5j.js} +1 -1
  134. package/dist/client/assets/mcp-oauth-DwPFIejs.js +1 -0
  135. package/dist/client/assets/{members-_klSSf7w.js → members-BA8vVu_F.js} +1 -1
  136. package/dist/client/assets/{monaco-editor-BXDxtePS.js → monaco-editor-DhRI2q0D.js} +1 -1
  137. package/dist/client/assets/{monitoring-stats-row-D1pJtu9I.js → monitoring-stats-row-DLrfuurv.js} +1 -1
  138. package/dist/client/assets/{multi-select-BZ-tCaud.js → multi-select-BFhmckl1.js} +1 -1
  139. package/dist/client/assets/{oauth-callback-F8D4D968.js → oauth-callback-CWLRFYZ2.js} +1 -1
  140. package/dist/client/assets/{oauth-callback-ai-provider-DlKy27tT.js → oauth-callback-ai-provider-RePfP1QM.js} +1 -1
  141. package/dist/client/assets/{onboarding-CoNP24fk.js → onboarding-BneVgO60.js} +1 -1
  142. package/dist/client/assets/org-layout-CpgEGfxv.js +1 -0
  143. package/dist/client/assets/{organization-choice-nbe4I9kY.js → organization-choice-BqV4sYyS.js} +1 -1
  144. package/dist/client/assets/{orgs-o3NxI1V6.js → orgs-DEjfIaJ0.js} +1 -1
  145. package/dist/client/assets/{page-seo-form-DDV7VjV-.js → page-seo-form-D-Eqo-mJ.js} +1 -1
  146. package/dist/client/assets/{popover-CRkM20y5.js → popover-BIPtCsqc.js} +1 -1
  147. package/dist/client/assets/{post-calendar-BacBxT2V.js → post-calendar-Chm7CCue.js} +1 -1
  148. package/dist/client/assets/{post-editor-4rU4mFOM.js → post-editor-vBEo0v-g.js} +1 -1
  149. package/dist/client/assets/{primitives-RPdPdtiK.js → primitives-CmYrjVpf.js} +1 -1
  150. package/dist/client/assets/{profile-weZdXHvp.js → profile-Ce2FGBxd.js} +1 -1
  151. package/dist/client/assets/{project-app-view-Ben78Ktd.js → project-app-view-lSJv2DSd.js} +1 -1
  152. package/dist/client/assets/{prompts-DqEM2vI1.js → prompts-Dt2G3dg0.js} +1 -1
  153. package/dist/client/assets/record-editor-BC2iQPGE.js +1 -0
  154. package/dist/client/assets/redirect-editor-C7uuK_jN.js +1 -0
  155. package/dist/client/assets/registry-DwUHQ8Lv.js +2 -0
  156. package/dist/client/assets/{registry-layout-BmS41XeK.js → registry-layout-D1fFgR3o.js} +1 -1
  157. package/dist/client/assets/{reports-Ex-p9Q6U.js → reports-DILtNiYy.js} +1 -1
  158. package/dist/client/assets/{require-capability-B6bbEttD.js → require-capability-DMuYJppW.js} +1 -1
  159. package/dist/client/assets/{required-auth-layout-BNGtvzOt.js → required-auth-layout-632Nlbdk.js} +1 -1
  160. package/dist/client/assets/{reset-password-CKdYnon5.js → reset-password-Dt0s206r.js} +1 -1
  161. package/dist/client/assets/{review-settings-DHtFpGrU.js → review-settings-BSEiFN9m.js} +1 -1
  162. package/dist/client/assets/{roles-DEuEeqHH.js → roles-Ca_cW6OU.js} +1 -1
  163. package/dist/client/assets/{schema-BSi9J6XG.js → schema-BoK0jTZh.js} +1 -1
  164. package/dist/client/assets/{scroll-area-CjEkqIar.js → scroll-area-BI805ul_.js} +1 -1
  165. package/dist/client/assets/{search-input-kDCevv38.js → search-input-CFyqYOfd.js} +1 -1
  166. package/dist/client/assets/{secrets-FJlGtZJz.js → secrets-hJRzyq6I.js} +1 -1
  167. package/dist/client/assets/{sections-editor-Db_XanCD.js → sections-editor-CVFGArcx.js} +1 -1
  168. package/dist/client/assets/{select-Dx7GTm0n.js → select-Bnv10Fl8.js} +1 -1
  169. package/dist/client/assets/{select-model-BkS3JCk0.js → select-model-NQ0mnVuK.js} +1 -1
  170. package/dist/client/assets/{self-tool-result-9rkDiIrM.js → self-tool-result-Dc4tPK9T.js} +1 -1
  171. package/dist/client/assets/{seo-editor-BLeAZw1O.js → seo-editor-DlfpOYSl.js} +1 -1
  172. package/dist/client/assets/settings-layout-CypSCfpP.js +1 -0
  173. package/dist/client/assets/{settings-sidebar-BAeW8psv.js → settings-sidebar-BGOdVjou.js} +1 -1
  174. package/dist/client/assets/{shell-controls-jJMoCrxb.js → shell-controls-B8r3Mj0T.js} +1 -1
  175. package/dist/client/assets/{shell-layout-r6wI2dxA.js → shell-layout-X5sLDjab.js} +1 -1
  176. package/dist/client/assets/{skill-preview-BV5lD9Ur.js → skill-preview-DL4gp0ne.js} +1 -1
  177. package/dist/client/assets/{skills-mHNv9mjy.js → skills-BLjeFnB6.js} +1 -1
  178. package/dist/client/assets/{sso-DQXV-Z9b.js → sso-DmCj3IPC.js} +1 -1
  179. package/dist/client/assets/{store-B5QBWbgI.js → store-h_GKYo0A.js} +1 -1
  180. package/dist/client/assets/store-registry-Cre8_0ZD.js +2 -0
  181. package/dist/client/assets/{switch-U7uzAFmD.js → switch-DlPMc1e_.js} +1 -1
  182. package/dist/client/assets/{synced-repos-CPCzRDss.js → synced-repos-BhYGq1he.js} +1 -1
  183. package/dist/client/assets/{table-D3Y6ENY8.js → table-D_mk2-gB.js} +1 -1
  184. package/dist/client/assets/{tabs-DuT8Yq6b.js → tabs-xquvO62b.js} +1 -1
  185. package/dist/client/assets/{task-board-DWHUF-M8.js → task-board-DHq8t-_N.js} +1 -1
  186. package/dist/client/assets/task-route-DWU-0q6w.js +1 -0
  187. package/dist/client/assets/{tasks-Bj-Geic7.js → tasks-68OUM7rF.js} +1 -1
  188. package/dist/client/assets/{textarea-bCfy8lu-.js → textarea-BClvRA4H.js} +1 -1
  189. package/dist/client/assets/{thread-intent-CisrByhq.js → thread-intent-C3PV-LRn.js} +1 -1
  190. package/dist/client/assets/{thread-route-b08GDb6K.js → thread-route-CxY5TjeM.js} +1 -1
  191. package/dist/client/assets/{toggle-group-3YvrBCWM.js → toggle-group-d_5STaVP.js} +1 -1
  192. package/dist/client/assets/{toolbar-BtJG1jFO.js → toolbar-D-SXcT0t.js} +1 -1
  193. package/dist/client/assets/{toolbar-icon-button-CCWdMNhD.js → toolbar-icon-button-DSBvSnFI.js} +1 -1
  194. package/dist/client/assets/{track-CIoIWcra.js → track-Cc1S4yMy.js} +1 -1
  195. package/dist/client/assets/{types-BL_Cd649.js → types-B2KcVByH.js} +1 -1
  196. package/dist/client/assets/{use-ai-providers-ZNJMa2Qe.js → use-ai-providers-CiO6eVCB.js} +1 -1
  197. package/dist/client/assets/{use-automations-CO5qll04.js → use-automations-VoPscQxA.js} +1 -1
  198. package/dist/client/assets/{use-autosave-CWnBHJNw.js → use-autosave-D-iSKxnB.js} +1 -1
  199. package/dist/client/assets/{use-connection-BY4RTRF-.js → use-connection-GI8Focwr.js} +1 -1
  200. package/dist/client/assets/{use-copy-MarDfxAW.js → use-copy-C0nulXNR.js} +1 -1
  201. package/dist/client/assets/{use-create-virtual-mcp-BZY8HplW.js → use-create-virtual-mcp-D-L0PRaI.js} +1 -1
  202. package/dist/client/assets/{use-debounced-autosave-CKZ9WmVu.js → use-debounced-autosave-DJCeP_ec.js} +1 -1
  203. package/dist/client/assets/{use-debounced-value-DM_0TZ22.js → use-debounced-value-CozflcUh.js} +1 -1
  204. package/dist/client/assets/{use-decopilot-events-GHwUJFdQ.js → use-decopilot-events-Bs4lGo6F.js} +1 -1
  205. package/dist/client/assets/{use-delete-connection-p_Lc_Grq.js → use-delete-connection-T3Xjf9fU.js} +1 -1
  206. package/dist/client/assets/{use-deployment-admin-BZ1DWC9e.js → use-deployment-admin-R-YLZcXi.js} +1 -1
  207. package/dist/client/assets/{use-destination-route-BbzQn-n1.js → use-destination-route-C5lOfatk.js} +1 -1
  208. package/dist/client/assets/{use-file-configs-Dme4FNCs.js → use-file-configs-CjjmtK39.js} +1 -1
  209. package/dist/client/assets/{use-infinite-scroll-BnNCHFKn.js → use-infinite-scroll-DHeLsiAD.js} +1 -1
  210. package/dist/client/assets/{use-join-requests-Camfhmzs.js → use-join-requests-DP9WJAb0.js} +1 -1
  211. package/dist/client/assets/{use-mcp-auth-status-DwCKSgFq.js → use-mcp-auth-status-Dj0-A5Wa.js} +1 -1
  212. package/dist/client/assets/{use-mcp-client-CLQpYb65.js → use-mcp-client-BJohqqSd.js} +1 -1
  213. package/dist/client/assets/{use-mcp-prompts-B4YApHQz.js → use-mcp-prompts-DW-tAvJg.js} +1 -1
  214. package/dist/client/assets/{use-mcp-tools-DxNdkpqp.js → use-mcp-tools-vt3UNphZ.js} +1 -1
  215. package/dist/client/assets/{use-members-Nw1pRVDm.js → use-members-C7ip6O59.js} +1 -1
  216. package/dist/client/assets/use-navigate-to-agent-wxTo_2Wv.js +1 -0
  217. package/dist/client/assets/{use-org-auth-client-CKoQfJfQ.js → use-org-auth-client-DVDqxM9c.js} +1 -1
  218. package/dist/client/assets/{use-org-sso-DaGSGBc8.js → use-org-sso-3md051eT.js} +1 -1
  219. package/dist/client/assets/{use-organization-roles-G6vi9RUF.js → use-organization-roles-C7--at-2.js} +1 -1
  220. package/dist/client/assets/{use-organization-settings-Bj_N-FZ1.js → use-organization-settings-Dh58cpUx.js} +1 -1
  221. package/dist/client/assets/{use-panel-navigate-ChqtBgPV.js → use-panel-navigate-9qdFpFC-.js} +1 -1
  222. package/dist/client/assets/{use-project-scope-DuXQlLft.js → use-project-scope-NvD131m4.js} +1 -1
  223. package/dist/client/assets/{use-registry-connections-DzkmhEYo.js → use-registry-connections-DtpIh4N8.js} +1 -1
  224. package/dist/client/assets/{use-secrets-CPol22BF.js → use-secrets-N0I1WQgn.js} +1 -1
  225. package/dist/client/assets/{use-section-preview-base-CIXOY0XP.js → use-section-preview-base-DWl2Cfr4.js} +1 -1
  226. package/dist/client/assets/{use-status-sounds-DjB7YACH.js → use-status-sounds-BpKA8nWD.js} +1 -1
  227. package/dist/client/assets/{use-tags-DhPuQwXu.js → use-tags-EBwNPMg8.js} +1 -1
  228. package/dist/client/assets/{use-view-mode-XpzZpQOU.js → use-view-mode-CGTPphEX.js} +1 -1
  229. package/dist/client/assets/{use-virtual-mcp-Dc_tNJd3.js → use-virtual-mcp-B2TPjUHz.js} +1 -1
  230. package/dist/client/assets/useInfiniteQuery-Nq5i14p1.js +1 -0
  231. package/dist/client/assets/useSuspenseInfiniteQuery-ByY64uZl.js +1 -0
  232. package/dist/client/assets/{users-B-Fjt6R6.js → users-BPvwZmZl.js} +1 -1
  233. package/dist/client/assets/{variant-calendar-BXwjNPsZ.js → variant-calendar-CodpU1lu.js} +1 -1
  234. package/dist/client/assets/{view-mode-toggle-BMxnYhp9.js → view-mode-toggle-Ct7J-xLH.js} +1 -1
  235. package/dist/client/index.html +1 -1
  236. package/dist/server/cli.js +509 -509
  237. package/dist/server/server.js +355 -355
  238. package/package.json +1 -1
  239. package/dist/client/assets/api-keys-BT6wuuDI.js +0 -1
  240. package/dist/client/assets/connection-D4KVb2vi.js +0 -1
  241. package/dist/client/assets/connection-detail-Rd3BNYmU.js +0 -1
  242. package/dist/client/assets/extract-connection-data-fYPcP0VJ.js +0 -1
  243. package/dist/client/assets/mcp-oauth-Bmt9vIvY.js +0 -1
  244. package/dist/client/assets/org-layout-D6WucjyK.js +0 -1
  245. package/dist/client/assets/record-editor-CcDRxPdh.js +0 -1
  246. package/dist/client/assets/redirect-editor-DN0sxwSC.js +0 -1
  247. package/dist/client/assets/registry-4_qn65ff.js +0 -2
  248. package/dist/client/assets/settings-layout-B0kIHXCh.js +0 -1
  249. package/dist/client/assets/store-registry-8k7WpgtY.js +0 -2
  250. package/dist/client/assets/task-route-CushdBcU.js +0 -1
  251. package/dist/client/assets/use-navigate-to-agent-BP5fBiR_.js +0 -1
  252. package/dist/client/assets/useInfiniteQuery-DYvex915.js +0 -1
  253. package/dist/client/assets/useSuspenseInfiniteQuery-zzJOxA7J.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-Db_XanCD.js","assets/index-Ciqhx4Es.js","assets/index-DrotPsL6.css","assets/chat-context-C5TtMbeA.js","assets/use-panel-navigate-ChqtBgPV.js","assets/use-destination-route-BbzQn-n1.js","assets/thread-route-b08GDb6K.js","assets/dialog-BVuXhd_n.js","assets/Check-DiuzOTdo.js","assets/Copy01-CZOGrHZ9.js","assets/Download01-DEU1JkfL.js","assets/constants-DNuUCxmW.js","assets/thread-intent-CisrByhq.js","assets/slugify-CEUa2lfQ.js","assets/hooks-y1rkw2ir.js","assets/use-mcp-client-CLQpYb65.js","assets/auth-BF15VDKW.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-B2Ek6f9E.js","assets/task-board-DWHUF-M8.js","assets/schema-BSi9J6XG.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-Dc_tNJd3.js","assets/use-ai-providers-ZNJMa2Qe.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-GHwUJFdQ.js","assets/use-organization-settings-Bj_N-FZ1.js","assets/ChevronUp-CHN7dU5d.js","assets/agent-icon-Dj2ko6xN.js","assets/AlertCircle-Dv6G1zch.js","assets/Tool01-CdkG5j9q.js","assets/ArrowUp-Dl1f2e9F.js","assets/ArrowLeft-Dyo7ZseM.js","assets/Tool02-CtS9_9Au.js","assets/XCircle-D4lh-8UY.js","assets/TrendUp01-Dwgdtlxo.js","assets/ZoomOut-CYflMQc3.js","assets/Users03-C7y8d7lq.js","assets/CheckCircle-BTMeEcth.js","assets/ChevronRight-CYJzqw1W.js","assets/ChevronSelectorVertical-C0Fdqi9U.js","assets/DotsVertical-CsIT64BQ.js","assets/UserSquare-CDP0762p.js","assets/CreditCard01-CxZhImMf.js","assets/Settings02-DLKKNdDt.js","assets/Eye-DNWGZGwG.js","assets/Share07-BdYeKEPF.js","assets/GitBranch01-4HvT92Fb.js","assets/Globe01-CySbwdvS.js","assets/XClose-CUFBDVP-.js","assets/HardDrive-CkhRSS5J.js","assets/Image01-CnSVldaE.js","assets/Key01-BvfZtZef.js","assets/Link01-DELnIRjt.js","assets/LinkExternal01-6r85JlVB.js","assets/Monitor01-Ciyr-Z_-.js","assets/Sun-DmqaD0GF.js","assets/Package-CGoiEMne.js","assets/Palette-CLInuq6o.js","assets/Play-CFcccqRE.js","assets/Plus-DfniZcTj.js","assets/SearchMd-MV7l96VN.js","assets/Shield01-Dbav6S5n.js","assets/Stars01-PjG8UcMP.js","assets/Trash01-DpQq-xrz.js","assets/Upload01-C-aUSpkq.js","assets/User01-CIlNhP30.js","assets/Users01-CJ-REDik.js","assets/Zap-BD_2K_N7.js","assets/scroll-area-CjEkqIar.js","assets/select-Dx7GTm0n.js","assets/input-HiBvv-tS.js","assets/popover-CRkM20y5.js","assets/dropdown-menu-7nrlUaMG.js","assets/safe-image-url-D5z803Ot.js","assets/page-seo-form-DDV7VjV-.js","assets/label-CGF50XGa.js","assets/switch-U7uzAFmD.js","assets/use-section-preview-base-CIXOY0XP.js","assets/automation-runs-oTVIsV-n.js","assets/useInfiniteQuery-DYvex915.js","assets/use-infinite-scroll-BnNCHFKn.js","assets/use-connection-BY4RTRF-.js","assets/table-D3Y6ENY8.js","assets/empty-state-N8rf9YSi.js","assets/use-members-Nw1pRVDm.js","assets/use-org-auth-client-CKoQfJfQ.js","assets/use-automations-CO5qll04.js","assets/useSuspenseInfiniteQuery-zzJOxA7J.js","assets/avatar-BLCEls6Y.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-MarDfxAW.js","assets/markdown-Srunai6w.js","assets/monaco-editor-BXDxtePS.js","assets/editor-CSXnkhqo.js","assets/types-BL_Cd649.js","assets/shell-layout-r6wI2dxA.js","assets/use-project-scope-DuXQlLft.js","assets/github-repo-BpKUwJal.js","assets/command-aq94pylP.js","assets/index-BOJEwmSU.js","assets/required-auth-layout-BNGtvzOt.js","assets/use-org-sso-DaGSGBc8.js","assets/shell-layout-CuFt8bor.css","assets/integration-icon-B63L2HtM.js","assets/use-navigate-to-agent-BP5fBiR_.js","assets/use-mcp-prompts-B4YApHQz.js","assets/form-D7fAV9eN.js","assets/file-type-icon-BnBH2hK9.js","assets/drawer-CXBUq1b4.js","assets/collection-search-C0aemqyU.js","assets/use-mcp-tools-DxNdkpqp.js","assets/tabs-DuT8Yq6b.js","assets/toggle-group-3YvrBCWM.js","assets/task-route-CushdBcU.js","assets/toolbar-icon-button-CCWdMNhD.js","assets/github-repo-picker-CVdHp0M0.js","assets/use-debounced-value-DM_0TZ22.js","assets/authenticate-and-persist-oauth-ORS2OKxY.js","assets/mcp-oauth-Bmt9vIvY.js","assets/extract-connection-data-fYPcP0VJ.js","assets/metadata-dUsYcpuu.js","assets/connection-D4KVb2vi.js","assets/provision-repo-scoped-github-connection-WQFARyHG.js","assets/connection-card-DZD9pIth.js","assets/use-registry-connections-DzkmhEYo.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-bCfy8lu-.js","assets/connection-form-helpers-CJ7gQUqN.js","assets/collection-tabs-DM3JgymS.js","assets/badge-CSQtV4I1.js","assets/get-initials-D-f_fDFw.js","assets/select-model-BkS3JCk0.js","assets/checkbox-CHvOkNek.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-1xzQyJ7C.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-DjB7YACH.js","assets/toolbar-BtJG1jFO.js","assets/use-file-configs-Dme4FNCs.js","assets/site-slug-uya6Wp4-.js","assets/skill-preview-BV5lD9Ur.js","assets/pt-BR-CLy76QW2.js","assets/alert-dialog-DN6vGwKb.js","assets/use-debounced-autosave-CKZ9WmVu.js","assets/search-input-kDCevv38.js","assets/use-mcp-auth-status-DwCKSgFq.js","assets/use-secrets-CPol22BF.js","assets/client-icons-CIyJtQzW.js","assets/connect-layout-DUtKqe8O.js","assets/self-tool-result-9rkDiIrM.js","assets/track-CIoIWcra.js","assets/use-tags-DhPuQwXu.js","assets/breadcrumb-BY2L4Yur.js","assets/automation-list-row-D_CbqNGG.js","assets/site-error--i37Vnuw.js","assets/cards-DDW_x79J.js","assets/file-explorer-Ku7EjWAL.js","assets/app-editor-CXxJdDRj.js","assets/post-editor-4rU4mFOM.js","assets/multi-select-BZ-tCaud.js","assets/block-document-DHWwd1Xg.js","assets/primitives-RPdPdtiK.js","assets/use-autosave-CWnBHJNw.js","assets/record-editor-CcDRxPdh.js","assets/category-editor-Ddez8F9D.js","assets/bulk-category-panel-BsKaZScD.js","assets/index-BgfHML7J.js","assets/seo-editor-BLeAZw1O.js","assets/variant-calendar-BXwjNPsZ.js","assets/view-mode-toggle-BMxnYhp9.js","assets/post-calendar-BacBxT2V.js","assets/alert-D50pTGlG.js","assets/redirect-editor-DN0sxwSC.js","assets/project-app-view-Ben78Ktd.js","assets/hosting-tab-BAPE6MlT.js","assets/empty-state-D1TMU-hy.js","assets/e2e-tab-Dr-mwFjd.js","assets/analytics-tab-DkOamiBu.js","assets/chart-CMxD7edM.js","assets/index-Dr0vXAye.js","assets/AreaChart-Bh324PJ7.js","assets/cdn-tab-DFZvtAMl.js","assets/ErrorBarContext-44kQWZkn.js","assets/Sector-CXJOKUEx.js"])))=>i.map(i=>d[i]);
2
- import{n as Ns,r as A,ac as uC,ad as hC,ae as Et,af as Us,ag as De,ah as cr,ai as Ri,aj as fu,ak as fC,al as Li,am as mC,an as um,ao as Sy,c as F,W as He,l as re,j as o,E as sn,b as le,t as ve,a3 as Ko,I as Yl,h as it,a1 as Ke,a2 as We,a4 as qe,ap as Ks,J as ky,m as Mt,aq as o2,K as tt,a as vn,z as Kc,B as fe,ar as l2,as as jy,v as pr,at as xs,au as vl,av as yx,d as rn,a7 as Vs,e as Es,o as Ge,aw as pC,C as sl,ax as gC,ay as Cy,az as xC,aA as Qi,aB as e1,aC as In,aD as bC,aE as t1,aF as vC,aG as yC,aH as _C,aI as LC,aJ as a2,aK as c2,aL as Ny,aM as d2,x as Ef,aN as wC,aO as SC,aP as kC,aQ as Vy,aR as Yd,Y as wi,aS as mu,k as jC,u as nl,f as il,H as u2,aT as Sc,aU as CC,aV as _x,aW as hm,aa as Ty,a9 as Lx,aX as Ay,aY as Py,aZ as Ey,a_ as NC,a$ as VC,L as yl,b0 as Ry,b1 as TC,b2 as AC,b3 as PC,b4 as Rh,b5 as _l,b6 as tn,b7 as Dy,b8 as Iy,b9 as On,P as Mn,ab as EC,ba as RC,bb as Tt,bc as My,bd as Oy,be as $y,bf as By,bg as zy,bh as Fy,bi as DC,bj as IC,bk as MC,bl as OC,bm as Uy,bn as Gs,N as ni,bo as Hy,bp as $C,bq as BC,br as Ky,bs as zC,bt as FC,bu as UC,bv as HC,bw as jl,bx as KC,by as Wy,bz as WC,bA as qC,bB as GC,bC as YC,bD as JC,bE as QC,bF as XC,bG as ZC,bH as eN}from"./index-Ciqhx4Es.js";import{i as Rf,n as tN}from"./ArrowUp-Dl1f2e9F.js";import{u as Jl,a as ai,b as hs,c as on,d as qy,s as sN,e as nN,f as iN,g as rN,h as oN,i as lN,j as aN,k as h2,l as Gy,T as cN,A as dN,m as uN,n as hN,t as fN,o as mN,p as pN}from"./chat-context-C5TtMbeA.js";import{c as f2,s as Iu,g as Ur,P as Dh,d as m2,t as Ih,a as gN,M as xN,i as bN,b as Si,e as Wc,f as vN,D as yN,h as _N,j as LN,k as Pc,l as wN,m as SN,u as Df,E as kN,n as Mu,o as jN,F as CN,p as If,q as Mf,r as Yy,S as NN,v as VN,w as TN,x as AN,y as wx,z as PN,A as Jy,O as EN,B as Sx,C as Zi,G as RN,T as Br,H as DN,I as or,J as Io,K as fm,L as mm,N as Qy,Q as IN,R as Xy,U as MN,V as ci,W as ON,X as $N,Y as Zy,Z as Ar,_ as BN,$ as zN,a0 as e6,a1 as pl,a2 as kx,a3 as FN,a4 as UN,a5 as jx,a6 as HN,a7 as pu,a8 as Ql,a9 as dr,aa as Mh,ab as p2,ac as g2,ad as KN,ae as WN,af as qN,ag as GN,ah as YN,ai as JN,aj as QN,ak as Of,al as t6,am as s6,an as n6,ao as XN,ap as i6,aq as ZN,ar as eV,as as tV,at as sV,au as Ou,av as nV,aw as iV,ax as rV,ay as oV}from"./automation-runs-oTVIsV-n.js";import{c as ds,d as qt,b as Bt,D as zt,h as Nn,e as Gn,i as lV}from"./dialog-BVuXhd_n.js";import{c as aV,b as x2,a as b2,D as v2,d as cV}from"./drawer-CXBUq1b4.js";import{C as dV}from"./collection-search-C0aemqyU.js";import{u as Cs,a as uV}from"./use-mcp-client-CLQpYb65.js";import{a as Xl,i as pm,S as qc,b as hV,g as Oh,c as r6,R as fV,d as mV,W as Dd,C as pV}from"./constants-DNuUCxmW.js";import{u as o6,g as $f,l as gm}from"./use-mcp-prompts-B4YApHQz.js";import{t as bs,n as l6}from"./ChevronUp-CHN7dU5d.js";import{t as gV,z as xV,u as $u,a as y2,b as _2,c as Bf}from"./hooks-y1rkw2ir.js";import{K as bV,a as a6,i as L2,r as vV,s as c6,u as Zl,o as yV,f as _V}from"./shell-layout-r6wI2dxA.js";import{u as vs,a as w2,b as Gc,c as LV}from"./use-virtual-mcp-Dc_tNJd3.js";import{w as wV,A as SV,b as kV,c as zf,u as jV,r as CV,d as NV}from"./thread-route-b08GDb6K.js";import{r as d6,d as S2,a as k2,p as VV,b as TV,s as AV,c as PV}from"./thread-intent-CisrByhq.js";import{g as io,r as u6}from"./github-repo-BpKUwJal.js";import{u as h6,a as f6,b as m6}from"./use-mcp-tools-DxNdkpqp.js";import{i as gr,a as EV}from"./XCircle-D4lh-8UY.js";import{t as Ff,k as p6,l as j2,j as ea,m as g6,o as x6,p as b6,A as ur,q as v6,r as Ec,s as Wo,u as y6,v as ta,w as RV,x as DV,c as _6,y as $h,z as Uf,g as IV,B as MV,C as OV,D as $V,h as BV,E as Hf,F as sa,G as zV,H as C2,I as L6,J as w6,K as xm,L as s1,M as Cx,N as Kf,O as FV,P as UV,Q as HV,R as KV,S as WV,T as N2,U as S6,V as k6,W as j6,X as C6,Y as qV,Z as V2,_ as GV,$ as li,a0 as Nx,a1 as YV,a2 as JV,d as N6,a3 as T2,a4 as Yc,a5 as Hr,a6 as A2,a7 as Bu,a8 as QV,f as V6,i as Wf,a9 as XV,aa as P2,ab as ZV,ac as eT,ad as tT,ae as sT,af as nT,ag as iT,ah as $o,ai as Vx,aj as T6,ak as rT,al as oT,am as El,an as lT,ao as E2,ap as Tx,aq as aT,ar as cT,as as dT,at as A6,au as uT,av as hT,aw as fT,ax as mT,ay as pT,az as Jd,aA as gT,aB as xT,aC as P6,aD as E6,aE as bT,aF as vT,n as yT,aG as _T,aH as LT,aI as wT,aJ as ST}from"./agent-icon-Dj2ko6xN.js";import{i as $t}from"./Check-DiuzOTdo.js";import{a as ki}from"./Image01-CnSVldaE.js";import{i as Yn}from"./Upload01-C-aUSpkq.js";import{i as Vn}from"./AlertCircle-Dv6G1zch.js";import{a as hn}from"./Copy01-CZOGrHZ9.js";import{F as bm,a as R2,b as D2,c as I2,d as R6}from"./form-D7fAV9eN.js";import{d as It,S as ws,a as Ss,b as Rs,c as ks}from"./select-Dx7GTm0n.js";import{i as qf}from"./ArrowLeft-Dyo7ZseM.js";import{T as Cl,a as na,b as ii,c as Jc}from"./tabs-DuT8Yq6b.js";import{t as vm,i as M2}from"./Tool02-CtS9_9Au.js";import{T as Gf,a as Rc}from"./toggle-group-3YvrBCWM.js";import{I as vt}from"./input-HiBvv-tS.js";import{u as O2,A as D6,m as zu,S as lr,e as kT,c as jT,l as qo,P as un,T as qn,t as $2,a as ym,f as I6,g as Fu,h as B2,j as Uu,s as M6,k as _m,n as O6,o as CT,p as NT,q as VT,r as TT,v as AT,w as PT,x as ET,y as RT,z as $6,B as DT,i as IT,b as MT,E as OT,C as $T,D as BT,L as Lm,F as Ax,G as zT,H as FT,I as UT,J as HT,K as KT,N as WT}from"./task-route-CushdBcU.js";import{s as ji,i as z2,c as B6}from"./XClose-CUFBDVP-.js";import{M as qT,a as GT,m as Yf,i as YT,g as z6,b as JT,N as QT,c as XT}from"./select-model-BkS3JCk0.js";import{a as os,b as as,P as cs,c as ZT}from"./popover-CRkM20y5.js";import{t as Kr}from"./Stars01-PjG8UcMP.js";import{b as eA,a as F6,c as U6,u as Jf,d as H6}from"./use-organization-settings-Bj_N-FZ1.js";import{u as Qf,a as tA}from"./use-ai-providers-ZNJMa2Qe.js";import{g as K6,c as W6,b as jn,L as Xf,p as sA,s as nA,u as Hu,a as iA,f as rA,d as oA}from"./use-project-scope-DuXQlLft.js";import{f as lA,a as aA,u as gu,b as Ku,c as q6,d as cA,e as F2,g as G6,h as U2,i as dA,j as H2,k as xu,l as Y6,m as uA,n as J6,o as hA}from"./folder-icon-1xzQyJ7C.js";import{c as Ut,D as Ht,b as Kt,a as Je,d as er,e as tr,f as sr,g as Bh,h as Bo,i as Nl,j as gd}from"./dropdown-menu-7nrlUaMG.js";import{i as K2}from"./Link01-DELnIRjt.js";import{s as Gt}from"./Plus-DfniZcTj.js";import{p as fA,q as mA}from"./question-004-sINsf4GQ.js";import{A as Hs}from"./avatar-BLCEls6Y.js";import{u as Zf,a as W2}from"./use-members-Nw1pRVDm.js";import{i as Ws}from"./ChevronRight-CYJzqw1W.js";import{u as Wu}from"./use-is-desktop-app-BNujXJc_.js";import{a as Di,u as qu}from"./use-panel-navigate-ChqtBgPV.js";import{i as xr}from"./CheckCircle-BTMeEcth.js";import{I as ro}from"./integration-icon-B63L2HtM.js";import{u as pA,f as gA,a as xA}from"./use-navigate-to-agent-BP5fBiR_.js";import{e as Gu}from"./backoff-CrEUbyZT.js";import{u as bA}from"./use-status-sounds-DjB7YACH.js";import{E as Ci}from"./empty-state-N8rf9YSi.js";import{T as vA}from"./toolbar-BtJG1jFO.js";import{i as Go,n as yA,a as _A}from"./Share07-BdYeKEPF.js";import{i as zn}from"./Globe01-CySbwdvS.js";import{i as LA}from"./Monitor01-Ciyr-Z_-.js";import{u as Ni,a as q2,b as G2}from"./use-connection-BY4RTRF-.js";import{g as Q6}from"./types-BL_Cd649.js";import{F as Yo}from"./file-type-icon-BnBH2hK9.js";import{f as wA,d as Yu,s as Y2,c as SA,b as kA}from"./TrendUp01-Dwgdtlxo.js";import{i as Vi}from"./ZoomOut-CYflMQc3.js";import{i as nr}from"./GitBranch01-4HvT92Fb.js";import{a as J2}from"./Package-CGoiEMne.js";import{u as e9,a as X6}from"./use-file-configs-Dme4FNCs.js";import{r as Q2}from"./site-slug-uya6Wp4-.js";import{n as bu}from"./Download01-DEU1JkfL.js";import{n as fn}from"./LinkExternal01-6r85JlVB.js";import{D as Ll}from"./use-destination-route-BbzQn-n1.js";import{d as X2,g as jA,s as CA,a as NA,F as Z6,b as e8,f as t8,S as s8,c as VA}from"./skill-preview-BV5lD9Ur.js";import{i as t9}from"./Key01-BvfZtZef.js";import{p as Z2,b as cn,s as Dc,H as vu,h as yu,a as oc,c as n8,d as i8}from"./location-oTTXFrSF.js";import{m as TA,a as AA,M as Qc,b as PA,O as EA}from"./markdown-Srunai6w.js";import{p as RA,f as DA}from"./pt-BR-CLy76QW2.js";import{g as IA,e as MA}from"./extract-connection-data-fYPcP0VJ.js";import{a as OA,i as Px}from"./mcp-oauth-Bmt9vIvY.js";import{A as qr,a as Gr,b as Yr,c as Jr,d as Qr,e as Xr,f as Zr,g as eo}from"./alert-dialog-DN6vGwKb.js";import{T as Jo}from"./textarea-bCfy8lu-.js";import{i as Rl}from"./Play-CFcccqRE.js";import{s as nn}from"./Trash01-DpQq-xrz.js";import{u as zh}from"./use-debounced-autosave-CKZ9WmVu.js";import{S as ia}from"./scroll-area-CjEkqIar.js";import{i as _u}from"./SearchMd-MV7l96VN.js";import{C as Xc}from"./checkbox-CHvOkNek.js";import{S as s9}from"./search-input-kDCevv38.js";import{C as r8}from"./collection-tabs-DM3JgymS.js";import{T as o8,u as l8}from"./use-mcp-auth-status-DwCKSgFq.js";import{g as $A}from"./connection-slug-CITJ0kGN.js";import{a as BA,i as zA}from"./Settings02-DLKKNdDt.js";import{L as Dt}from"./label-CGF50XGa.js";import{S as Ti}from"./switch-U7uzAFmD.js";import{s as a8}from"./slugify-CEUa2lfQ.js";import{d as Zc}from"./delay-CnY5UFtP.js";import{G as mn,a as Ju,u as FA}from"./github-repo-picker-CVdHp0M0.js";import{s as c8}from"./User01-CIlNhP30.js";import{t as n9}from"./Users01-CJ-REDik.js";import{u as d8,a as u8}from"./use-secrets-CPol22BF.js";import{C as UA,a as HA,b as KA}from"./client-icons-CIyJtQzW.js";import{g as Cn}from"./get-initials-D-f_fDFw.js";import{S as is,D as h8,C as f8,R as WA,a as qA,i as m8,n as GA,b as YA}from"./task-board-DWHUF-M8.js";import{a as ed}from"./format-time-BnbuEtat.js";import{u as p8,d as JA,c as QA,C as eg,a as XA}from"./connect-layout-DUtKqe8O.js";import{l as g8,g as ZA}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{u as tg,a as eP,b as tP}from"./use-tags-DhPuQwXu.js";import{B as sP,a as nP,b as Ex,c as iP,d as rP,e as oP}from"./breadcrumb-BY2L4Yur.js";import{u as n1}from"./use-copy-MarDfxAW.js";import{i as sg,a as lP,c as aP,b as cP}from"./UserSquare-CDP0762p.js";import{C as Ii,a as di,b as ui,c as $n,d as ls,e as Ps,f as dP,g as Rx}from"./command-aq94pylP.js";import{u as uP}from"./use-org-auth-client-CKoQfJfQ.js";import{i as i9}from"./ChevronSelectorVertical-C0Fdqi9U.js";import{a as hP}from"./authenticate-and-persist-oauth-ORS2OKxY.js";import{w as Dx}from"./editor-CSXnkhqo.js";import{T as Mr,I as ng,p as fP}from"./toolbar-icon-button-CCWdMNhD.js";import{u as wm,C as mP,b as pP,p as x8,a as gP,s as Sm,n as xP}from"./self-tool-result-9rkDiIrM.js";import{M as td}from"./monaco-editor-BXDxtePS.js";import{i as bP,a as r9,b as ig}from"./Tool01-CdkG5j9q.js";import{a as km}from"./Palette-CLInuq6o.js";import{s as vP}from"./safe-image-url-D5z803Ot.js";import{s as Qu}from"./Eye-DNWGZGwG.js";import{i as o9}from"./DotsVertical-CsIT64BQ.js";import{u as l9}from"./use-debounced-value-DM_0TZ22.js";import{u as b8}from"./useInfiniteQuery-DYvex915.js";import{i as hr}from"./Zap-BD_2K_N7.js";import{B as yP}from"./badge-CSQtV4I1.js";import{u as Xu,a as _P,b as LP,c as wP,d as SP}from"./use-automations-CO5qll04.js";import{A as kP}from"./automation-list-row-D_CbqNGG.js";import{t as jP}from"./site-error--i37Vnuw.js";import{f as CP,p as NP,g as VP,u as TP,e as AP,a as PP,F as Zu,t as v8,S as EP,B as RP,b as y8,R as DP,c as IP}from"./cards-DDW_x79J.js";function _8(t,e){const s=Ns(e);return MP({filters:{...t,status:"pending"}},s).length}function Ix(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function MP(t={},e){const s=Ns(e).getMutationCache(),n=A.useRef(t),i=A.useRef(null);return i.current===null&&(i.current=Ix(s,t)),A.useEffect(()=>{n.current=t}),A.useSyncExternalStore(A.useCallback(r=>s.subscribe(()=>{const l=uC(i.current,Ix(s,n.current));i.current!==l&&(i.current=l,hC.schedule(r))}),[s]),()=>i.current,()=>i.current)}const Id=Et({connection_id:De().describe("Connection ID"),selected_tools:Us(De()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:Us(De()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:Us(De()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),L8=Id.extend({selected_tools:Id.shape.selected_tools.optional(),selected_resources:Id.shape.selected_resources.optional(),selected_prompts:Id.shape.selected_prompts.optional()}),OP=Et({connectionId:De(),toolName:De(),label:De(),icon:De().nullable().optional()}),$P=Et({id:De().describe("Stable id; used as React key and ?tab= value"),title:De().describe("Tab label"),icon:De().optional().describe("Optional lucide icon name"),view:Et({type:um("ext-app"),appId:De(),args:fu(De(),Sy()).optional()})}),BP=Ri(["on","off"]),zP=new Map([["manual","on"],["auto","on"]]),FP=Ri(["on","off","manual","auto"]);function UP(t){if(!t)return null;const e=zP.get(t);return e||(t==="on"||t==="off"?t:null)}const HP=Et({defaultMainView:Et({type:De(),id:De().optional(),toolName:De().optional()}).nullable().optional(),chatDefaultOpen:cr().nullable().optional(),cmsDefaultOpen:cr().nullable().optional(),cms:FP.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),tabs:Us($P).optional()});function e0(t){return UP(t?.cms)??"on"}function KP(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"site-editor"}}:{}}}const Mx=Et({tileId:De().optional(),connectionId:De().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:De().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:De().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:fu(De(),Sy()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Li().int().positive().optional(),maxHeight:Li().int().positive().optional()}),WP=Et({banner:De().nullable().optional(),bannerColor:De().nullable().optional(),icon:De().nullable().optional(),themeColor:De().nullable().optional(),pinnedViews:Us(OP).nullable().optional(),layout:HP.nullable().optional(),homeTile:Mx.nullable().optional(),homeTiles:Us(Mx).nullable().optional(),homePrompts:Us(De()).nullable().optional()}),t0=/^[A-Za-z_][A-Za-z0-9_]*$/,Ox=De().min(1).regex(t0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),qP=mC("kind",[Et({key:Ox,kind:um("literal"),value:De()}),Et({key:Ox,kind:um("secret"),secretId:De().min(1)})]),rg=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,GP=Et({host:De().min(1).regex(rg).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:De().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),YP=Et({selected:De().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:De().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:De().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:Us(qP).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:Us(GP).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.")}),JP=Et({url:De().describe("GitHub repository URL"),owner:De().describe("Repository owner"),name:De().describe("Repository name"),installationId:Li().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:De().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),QP=Ri(["agent-sandbox","local-api"]),XP={sandboxHandle:De().describe("Provider-specific handle"),previewUrl:De().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:De().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:Li().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:Et({packageManager:De().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:De().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:De().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.")},w8=Et(XP);function ZP(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]=w8.parse(i)}catch{}return s}const eE=fu(De().describe("userId"),fu(De().describe("branch"),fC(QP,w8))),tE=Et({id:De().describe("Stable identifier for this knowledge file"),name:De().describe("File name shown in the UI"),kind:Ri(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:De().describe("Org filesystem (Library) volume the file lives in"),path:De().describe("Path within the volume"),url:De().describe("Same-origin URL to read the file (display/download)"),contentType:De().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Li().nullable().optional().describe("File size in bytes"),addedAt:De().describe("ISO timestamp when the file was attached")}),sE=Us(tE).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."),nE=Ri(["smart","code-review","open"]),iE=nE.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."),rE=cr().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."),oE=cr().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."),lE=De().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."),aE=Et({branch:De().describe("Git branch backing this release"),name:De().describe('User-facing name, e.g. "Black Friday 2026"'),color:De().describe("Dot color token shown in the version switcher"),createdBy:De().optional().describe("User ID who created the release"),createdAt:De().optional().describe("ISO 8601 creation timestamp")}),cE=Us(aE).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."),dE=cr().nullable().optional().describe("Draft & Releases mode: gates the drafts UX (releases switcher, read-only production, publish-to-production). Off (default) keeps the classic branch/PR picker and post-publish behavior."),og={instructions:De().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:Us(De()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Us(De()).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:De().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:WP.nullable().optional().describe("UI customization settings"),githubRepo:JP.nullable().optional().describe("Linked GitHub repository"),runtime:YP.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:sE,siteSlug:De().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:iE,previewServerUrl:lE,productionUrl:De().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:cr().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:rE,releases:cE,draftsMode:dE,fastPreviewInPlace:oE},uE=Et({id:De().describe("Unique identifier"),title:De().describe("Human-readable name"),description:De().nullable().describe("Description"),icon:De().nullable().describe("Icon URL"),created_at:De().describe("Creation timestamp"),updated_at:De().describe("Last update timestamp"),created_by:De().describe("User ID who created this item"),updated_by:De().optional().describe("User ID who last updated this item"),organization_id:De().describe("Organization ID this item belongs to"),status:Ri(["active","inactive"]).describe("Current status"),pinned:cr().describe("Whether this space is pinned to the sidebar"),metadata:Et(og).extend({instructions:De().nullable().describe("Instructions also used as system prompt"),sandboxMap:eE.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:Us(Id).describe("Connections with their selected tools, resources, and prompts")}),S8=Et({title:De().min(1).max(120).describe("Short label shown on the chip"),description:De().max(280).optional().describe("One-line subtitle shown under the title"),text:De().min(1).describe("The message sent to the agent when the prompt is clicked")});Et({title:De().min(1).max(255).describe("Name for the virtual MCP"),description:De().nullable().optional().describe("Optional description"),icon:De().nullish().describe("Optional icon URL"),status:Ri(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:cr().optional().default(!1).describe("Pin to sidebar"),metadata:Et(og).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:Us(L8).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:Us(S8).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.")});Et({title:De().min(1).max(255).optional().describe("New name"),description:De().nullable().optional().describe("New description (null to clear)"),icon:De().nullish().describe("New icon URL"),status:Ri(["active","inactive"]).optional().describe("New status"),pinned:cr().optional().describe("Pin/unpin from sidebar"),metadata:Et(og).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:Us(L8).optional().describe("New connections (replaces existing)"),prompts:Us(S8).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).")});const $x=3,k8="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",hE="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function j8(t){const e=F.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:r,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=Ur(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 u=d,h=c.description||null;if(a==="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 T;e[7]!==j||e[8]!==C?(T=re(hE,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=T):T=e[9];let N;e[10]!==u?(N=o.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=N):N=e[11];let P;e[12]!==i?(P=i&&o.jsx(it,{size:"xs"}),e[12]=i,e[13]=P):P=e[13];let V;e[14]!==N||e[15]!==P?(V=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,P]}),e[14]=N,e[15]=P,e[16]=V):V=e[16];let E;e[17]!==h?(E=h&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=E):E=e[18];let R;return e[19]!==V||e[20]!==E||e[21]!==S||e[22]!==k||e[23]!==T?(R=o.jsxs("button",{type:"button",onClick:S,disabled:k,className:T,children:[V,E]}),e[19]=V,e[20]=E,e[21]=S,e[22]=k,e[23]=T,e[24]=R):R=e[24],R}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=r||i,p=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=re(k8,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==u?(b=o.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&o.jsx(it,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let _;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(_=o.jsx(Ke,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=_):_=e[40];const y=h??u;let L;e[41]!==y?(L=o.jsx(We,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=L):L=e[42];let w;return e[43]!==_||e[44]!==L?(w=o.jsxs(qe,{delayDuration:400,children:[_,L]}),e[43]=_,e[44]=L,e[45]=w):w=e[45],w}function fE(t){const e=F.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:l}=t,a=le(),[c,d]=A.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(N=>{const P=c.toLowerCase();return N.prompt.name.toLowerCase().includes(P)||(N.prompt.title??"").toLowerCase().includes(P)||(N.prompt.description??"").toLowerCase().includes(P)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=Yl();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==u||e[9]!==l?.name||e[10]!==i||e[11]!==r){let N;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==r?(N=P=>o.jsx(j8,{item:P,variant:"card",onSelect:V=>{i(!1),r(V)},isLoading:l?.name===P.prompt.name,isDisabled:u&&l?.name!==P.prompt.name},P.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=r,e[17]=N):N=e[17],g=f.map(N),e[7]=f,e[8]=u,e[9]=l?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==p||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:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==a?(v=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=N=>{N.key==="Escape"&&d("")},e[23]=_):_=e[23];let y;e[24]!==c||e[25]!==v?(y=o.jsx(dV,{value:c,onChange:d,placeholder:v,onKeyDown:_}),e[24]=c,e[25]=v,e[26]=y):y=e[26];const L=y;if(m){let N;e[27]!==a?(N=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=N):N=e[28];let P;e[29]!==N?(P=o.jsx(aV,{className:"sr-only",children:o.jsx(x2,{children:N})}),e[29]=N,e[30]=P):P=e[30];let V;e[31]!==a?(V=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=V):V=e[32];let E;e[33]!==V?(E=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:V})}),e[33]=V,e[34]=E):E=e[34];let R;e[35]!==b||e[36]!==L||e[37]!==E||e[38]!==P?(R=o.jsxs(b2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[P,E,L,b]}),e[35]=b,e[36]=L,e[37]=E,e[38]=P,e[39]=R):R=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==R?(I=o.jsx(Ko,{delayDuration:400,children:o.jsx(v2,{open:n,onOpenChange:i,children:R})}),e[40]=i,e[41]=n,e[42]=R,e[43]=I):I=e[43],I}let w;e[44]!==a?(w=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=w):w=e[45];let S;e[46]!==w?(S=o.jsx(ds,{className:"sr-only",children:o.jsx(qt,{children:w})}),e[46]=w,e[47]=S):S=e[47];let k;e[48]!==a?(k=a("chat.iceBreakers.promptsLabel"),e[48]=a,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]!==L||e[54]!==j||e[55]!==S?(C=o.jsxs(Bt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,L,b]}),e[52]=b,e[53]=L,e[54]=j,e[55]=S,e[56]=C):C=e[56];let T;return e[57]!==i||e[58]!==n||e[59]!==C?(T=o.jsx(Ko,{delayDuration:400,children:o.jsx(zt,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=T):T=e[60],T}function mE(t){const e=F.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,l=le(),[a,c]=A.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,$x),v=s.slice($x),_=!!i;let y;e[10]!==_||e[11]!==i?.name||e[12]!==n?(y=w=>o.jsx(j8,{item:w,onSelect:n,isLoading:i?.name===w.prompt.name,isDisabled:_&&i?.name!==w.prompt.name},w.prompt.name),e[10]=_,e[11]=i?.name,e[12]=n,e[13]=y):y=e[13];const L=b.map(y);d=Ko,m=400,e[14]!==r?(u=re("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=u):u=e[15],h=L,f=v.length>0&&o.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:re(k8,"hover:bg-muted/70 hover:text-foreground",_&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=u,e[7]=h,e[8]=f,e[9]=m}else d=e[5],u=e[6],h=e[7],f=e[8],m=e[9];let p;e[16]!==u||e[17]!==h||e[18]!==f?(p=o.jsxs("div",{className:u,children:[h,f]}),e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=o.jsx(fE,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=o.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function pE(){return null}function gE(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 xE(t){const e=F.c(31),{connectionId:s}=t,n=le(),{sendMessage:i}=ai(),{org:r}=He();let l;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(l={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=l):l=e[3];const a=Cs(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=o6(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const h=u;let f;e[8]!==h?(f=h.map(bE),e[8]=h,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=A.useReducer(gE,p),[b,v]=A.useState(null);let _;e[11]!==a||e[12]!==i||e[13]!==n?(_=async(V,E)=>{if(!a){ve.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const R=await $f(a,V.name,E);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[f2({id:V.name,name:Iu(V.name,Ur(V._meta)),metadata:R.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(I)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),ve.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=_):_=e[14];const y=_;let L;e[15]!==y?(L=async V=>{if(V.arguments&&V.arguments.length>0){x({type:"SELECT_PROMPT",prompt:V}),v(V);return}x({type:"START_LOADING",prompt:V}),await y(V)},e[15]=y,e[16]=L):L=e[16];const w=L;let S;e[17]!==b||e[18]!==y?(S=async V=>{b&&(x({type:"START_LOADING",prompt:b,arguments:V}),v(null),await y(b,V))},e[17]=b,e[18]=y,e[19]=S):S=e[19];const k=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==w||e[21]!==m||e[22]!==j?(C=o.jsx(mE,{items:m,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=m,e[22]=j,e[23]=C):C=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v(null),x({type:"RESET"})},e[24]=T):T=e[24];let N;e[25]!==b||e[26]!==k?(N=o.jsx(Dh,{prompt:b,setPrompt:T,onSubmit:k}),e[25]=b,e[26]=k,e[27]=N):N=e[27];let P;return e[28]!==C||e[29]!==N?(P=o.jsxs(o.Fragment,{children:[C,N]}),e[28]=C,e[29]=N,e[30]=P):P=e[30],P}function bE(t){return{prompt:t}}function vE(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:n}=Jl(),{org:i}=He();let r;e[0]!==i.id?(r=Xl(i.id),e[0]=i.id,e[1]=r):r=e[1];const l=r.id,a=n?.id??l;let c;e[2]!==s?(c=re("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(pE,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=o.jsx(xE,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=o.jsx(sn,{fallback:null,children:o.jsx(A.Suspense,{fallback:u,children:h},d)}),e[7]=d,e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const i1="cubic-bezier(0.645, 0.045, 0.355, 1)",yE=44,_E={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"},LE={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},wE={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Qo(t){const e=F.c(69),{icon:s,label:n,count:i,title:r,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=le(),[p,g]=A.useState(d),[x,b]=A.useState(!1);let v;e[0]!==h?(v=()=>{b(!0),h?.()},e[0]=h,e[1]=v):v=e[1];const _=v;if(x)return null;const y=LE[f],L=_E[f];let w;e[2]!==y||e[3]!==L?(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,L),e[2]=y,e[3]=L,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(SE),e[5]=S):S=e[5];const k=p&&"rounded-b-none",j=!p&&"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 T=wE[f];let N;e[9]!==T?(N=re("shrink-0",T),e[9]=T,e[10]=N):N=e[10];let P;e[11]!==s||e[12]!==N?(P=o.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=P):P=e[13];let V;e[14]!==n?(V=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=V):V=e[15];let E;e[16]!==i?(E=i?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=E):E=e[17];const R=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==R?(I=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(bs,{size:16,style:{transform:R,transition:`transform 180ms ${i1}`}})}),e[18]=R,e[19]=I):I=e[19];let D;e[20]!==m?(D=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=D):D=e[21];let O;e[22]!==m?(O=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=O):O=e[23];let $,M;e[24]!==_?($=J=>{J.stopPropagation(),_()},M=J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),J.stopPropagation(),_())},e[24]=_,e[25]=$,e[26]=M):($=e[25],M=e[26]);let z;e[27]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(Ks,{size:16}),e[27]=z):z=e[27];let B;e[28]!==D||e[29]!==O||e[30]!==$||e[31]!==M?(B=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:O,onClick:$,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]=$,e[31]=M,e[32]=B):B=e[32];let U;e[33]!==p||e[34]!==P||e[35]!==V||e[36]!==E||e[37]!==I||e[38]!==B||e[39]!==C?(U=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:C,children:[P,V,E,I,B]}),e[33]=p,e[34]=P,e[35]=V,e[36]=E,e[37]=I,e[38]=B,e[39]=C,e[40]=U):U=e[40];const H=p?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${i1}`},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 Q=p?1:0;let X;e[44]!==Q?(X={opacity:Q,transition:`opacity 120ms ${i1}`,maxHeight:"60vh"},e[44]=Q,e[45]=X):X=e[45];let se;e[46]!==r?(se=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]=se):se=e[47];let ne;e[48]!==c||e[49]!==r?(ne=c?o.jsx("div",{className:re("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=ne):ne=e[50];let te;e[51]!==se||e[52]!==ne?(te=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[se,ne]}),e[51]=se,e[52]=ne,e[53]=te):te=e[53];let ee;e[54]!==l||e[55]!==a?(ee=l||a?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:l}),o.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=ee):ee=e[56];let Y;e[57]!==X||e[58]!==te||e[59]!==ee?(Y=o.jsx("div",{style:K,children:o.jsxs("div",{className:"flex flex-col",style:X,children:[te,ee]})}),e[57]=X,e[58]=te,e[59]=ee,e[60]=Y):Y=e[60];let q;e[61]!==W||e[62]!==Y?(q=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:Y}),e[61]=W,e[62]=Y,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 SE(t){return!t}const kE=Et({content:De().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Ri(["pending","in_progress","completed"]),activeForm:De().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),C8=Et({todos:Us(kE)}),jE="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.";gV({description:jE,inputSchema:xV(C8),execute:async({todos:t})=>({ok:!0,count:t.length})});const CE="tool-todo_write",NE=new Set(["input-available","output-available"]);function VE(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!==CE||typeof r.state!="string"||!NE.has(r.state))continue;const l=C8.safeParse(r.input);if(l.success)return l.data.todos}}return[]}function N8(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:Ih(gN(n)),input:s.input})}return e}function V8(t){return t.at(-1)}function T8(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 TE(t){return t?t.message.startsWith("[CREDITS]"):!1}const AE="[SUBSCRIPTION_REQUIRED]";function A8(t){return t?.message.startsWith(AE)?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 PE={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function EE(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&TE(s))return{...PE,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(y=>y.type==="tool-user_ask").filter(y=>y.state!=="output-available").length,h=T8(a),f=N8(c),m=VE(e),p=i?null:A8(s),g=!i&&!!s&&!p,x=f.length>0||i&&r,b=h.length>0,_=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function P8(){const t=F.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=ai(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==r||t[2]!==e||t[3]!==l||t[4]!==a?(c=EE({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:r}),t[0]=i,t[1]=r,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function RE(){const t=P8();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function E8(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}const DE="__home__";function lg(t,e){return ky.chatDraft(t,e)}function IE(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function R8(t,e,s,n,i){const r=lg(e,s);if(E8(n)){t.removeItem(r);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(r,a)}catch(c){if(OE(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function Bx(t,e,s){const n=lg(e,s),i=t.getItem(n),r=IE(i);return i!==null&&r===null&&t.removeItem(n),r}function ME(t,e,s){t.removeItem(lg(e,s))}function OE(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function yn(t){const e=F.c(14),s=vs(t),n=hs(),i=s?.metadata,r=n?.activeTask,l=r?.metadata?.runtime;let a;e[0]!==l?(a=VV(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!r&&!r.partial,u=r?.metadata;let h;e[2]!==i||e[3]!==u?(h=d6(u,i),e[2]=i,e[3]=u,e[4]=h):h=e[4];const f=!!c||d&&!!s;let m;e[5]!==i?(m=S2(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=k2(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:h,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function $E(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function a9(t){return t?.name||t?.email?.split("@")[0]||void 0}function Dl(t){const e=$E(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}function D8(t){if(!t||typeof t!="object")return null;const e=t;return e.isError?e.content?.find(n=>n.type==="text")?.text?.trim()||"GitHub MCP tool returned an error":null}function ag(t){const e=D8(t);if(e)throw new Error(e)}function BE(t){try{return JSON.parse(t)}catch{return null}}function zE(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(r=>r.type==="text")?.text,n=s?BE(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function s0(t){const e=zE(t);return e===null?null:e}function I8(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function FE(t){if(!t||typeof t!="object")return null;const e=t.content?.find(i=>i.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],n=I8(s);return!n||!s?null:{number:n,htmlUrl:s}}function zx(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const Fx=/[\r\n<>]/,UE=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function n0(t){const e=t?.userName?.trim();if(!e||Fx.test(e))return null;const s=t?.userEmail?.trim();return!s||Fx.test(s)?{userName:e}:UE.test(s)?{userName:e,userEmail:s}:{userName:e}}function HE(t){return t.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-CVFGArcx.js","assets/index-CAw6g9tV.js","assets/index-DrotPsL6.css","assets/chat-context-ffF_r7RU.js","assets/use-panel-navigate-9qdFpFC-.js","assets/use-destination-route-C5lOfatk.js","assets/thread-route-CxY5TjeM.js","assets/dialog-DDd8wUS7.js","assets/Check-Jn0qXgT0.js","assets/Copy01-jXW2eGyY.js","assets/Download01-BpcIjY9x.js","assets/constants-DNuUCxmW.js","assets/thread-intent-C3PV-LRn.js","assets/slugify-CEUa2lfQ.js","assets/hooks-J2gbnuVW.js","assets/use-mcp-client-BJohqqSd.js","assets/auth-Ctf1zdSk.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-Cp5pr9Ve.js","assets/task-board-DHq8t-_N.js","assets/schema-BoK0jTZh.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-B2TPjUHz.js","assets/use-ai-providers-CiO6eVCB.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-Bs4lGo6F.js","assets/use-organization-settings-Dh58cpUx.js","assets/ChevronUp-BCwuiyHj.js","assets/agent-icon-Dsw04fQF.js","assets/AlertCircle-CG7tfapy.js","assets/Tool01-CtOHcy0Y.js","assets/ArrowUp-CxKA4POx.js","assets/ArrowLeft-Dexv6rHk.js","assets/Tool02-DHxIusmd.js","assets/XCircle-DZJkY1-f.js","assets/TrendUp01-BctNF4vg.js","assets/ZoomOut-D8t79aO2.js","assets/Users03-cesUeOsp.js","assets/CheckCircle-BnpxIwzg.js","assets/ChevronRight-CKftPemQ.js","assets/ChevronSelectorVertical-BPOo032l.js","assets/DotsVertical-C65YDOa_.js","assets/UserSquare-BEv1iIj5.js","assets/CreditCard01-Zn4AjX46.js","assets/Settings02-DfFNQquZ.js","assets/Eye-DvBjB5D4.js","assets/Share07-8oXDBqwk.js","assets/GitBranch01-Bde_Ik_K.js","assets/Globe01-D2uoGclE.js","assets/XClose-mJWP0IZB.js","assets/HardDrive-CBqO3DS3.js","assets/Image01-0uExgWAI.js","assets/Key01-BiKWCM1S.js","assets/Link01-C7a_h6ys.js","assets/LinkExternal01-D_IXdPPU.js","assets/Monitor01-CKYtARge.js","assets/Sun-N_eYVUUU.js","assets/Package-D0PXqO6P.js","assets/Palette-CQVEzzhe.js","assets/Play-CONIoWIl.js","assets/Plus-D7VA57q5.js","assets/SearchMd-C1loDEwy.js","assets/Shield01-CrPC_5gY.js","assets/Stars01-BTmtR5If.js","assets/Trash01-CHla-FrA.js","assets/Upload01-VP9EBYtl.js","assets/User01-8XeMepHg.js","assets/Users01-CvPFHBcf.js","assets/Zap-JQtzyV8B.js","assets/scroll-area-BI805ul_.js","assets/select-Bnv10Fl8.js","assets/input-CRq9rZYf.js","assets/popover-BIPtCsqc.js","assets/dropdown-menu-C3Gdadki.js","assets/safe-image-url-D5z803Ot.js","assets/page-seo-form-D-Eqo-mJ.js","assets/label-ByckMHtZ.js","assets/switch-DlPMc1e_.js","assets/use-section-preview-base-DWl2Cfr4.js","assets/automation-runs-BP4svOKv.js","assets/useInfiniteQuery-Nq5i14p1.js","assets/use-infinite-scroll-DHeLsiAD.js","assets/use-connection-GI8Focwr.js","assets/table-D_mk2-gB.js","assets/empty-state-L8hCXC--.js","assets/use-members-C7ip6O59.js","assets/use-org-auth-client-DVDqxM9c.js","assets/use-automations-VoPscQxA.js","assets/useSuspenseInfiniteQuery-ByY64uZl.js","assets/avatar-ayySA21l.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-C0nulXNR.js","assets/markdown-C1VdpJ5j.js","assets/monaco-editor-DhRI2q0D.js","assets/editor-B0M9C5II.js","assets/types-B2KcVByH.js","assets/shell-layout-X5sLDjab.js","assets/use-project-scope-NvD131m4.js","assets/github-repo-BpKUwJal.js","assets/command-CEQjEkRa.js","assets/index-DU91evk-.js","assets/required-auth-layout-632Nlbdk.js","assets/use-org-sso-3md051eT.js","assets/shell-layout-CuFt8bor.css","assets/integration-icon-gY5UnY38.js","assets/use-navigate-to-agent-wxTo_2Wv.js","assets/use-mcp-prompts-DW-tAvJg.js","assets/form-DR4f8DO7.js","assets/file-type-icon-C5mq72Tm.js","assets/drawer-CxFI5tCn.js","assets/collection-search-DUFT-3aZ.js","assets/use-mcp-tools-vt3UNphZ.js","assets/tabs-xquvO62b.js","assets/toggle-group-d_5STaVP.js","assets/task-route-DWU-0q6w.js","assets/toolbar-icon-button-DSBvSnFI.js","assets/github-repo-picker-Dyu49H5P.js","assets/use-debounced-value-CozflcUh.js","assets/authenticate-and-persist-oauth-UjkEE9k3.js","assets/mcp-oauth-DwPFIejs.js","assets/extract-connection-data-C2Ocp5Tk.js","assets/metadata-dUsYcpuu.js","assets/connection-qt8m11-c.js","assets/provision-repo-scoped-github-connection-WQFARyHG.js","assets/connection-card-Bwgx5OMm.js","assets/use-registry-connections-DtpIh4N8.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-BClvRA4H.js","assets/connection-form-helpers-Cs1EiOkG.js","assets/collection-tabs-aHnkLK94.js","assets/badge-BJg3YTbr.js","assets/get-initials-D-f_fDFw.js","assets/select-model-NQ0mnVuK.js","assets/checkbox-DmweFMZg.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-Dt2zI1nQ.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-BpKA8nWD.js","assets/toolbar-D-SXcT0t.js","assets/use-file-configs-CjjmtK39.js","assets/site-slug-uya6Wp4-.js","assets/skill-preview-DL4gp0ne.js","assets/pt-BR-CLy76QW2.js","assets/alert-dialog-BU3enZKF.js","assets/use-debounced-autosave-DJCeP_ec.js","assets/search-input-CFyqYOfd.js","assets/use-mcp-auth-status-Dj0-A5Wa.js","assets/use-secrets-N0I1WQgn.js","assets/client-icons-DX-H77xu.js","assets/connect-layout-CS-AhNLB.js","assets/self-tool-result-Dc4tPK9T.js","assets/track-Cc1S4yMy.js","assets/use-tags-EBwNPMg8.js","assets/breadcrumb-B5Tcv0Uh.js","assets/automation-list-row-CakAIrvQ.js","assets/site-error--i37Vnuw.js","assets/cards-D9Ttj2cE.js","assets/file-explorer-DTbMKDAB.js","assets/app-editor-Bvzl_qDB.js","assets/post-editor-vBEo0v-g.js","assets/multi-select-BFhmckl1.js","assets/block-document-DOFjntDc.js","assets/primitives-CmYrjVpf.js","assets/use-autosave-D-iSKxnB.js","assets/record-editor-BC2iQPGE.js","assets/category-editor-BPZKWEN1.js","assets/bulk-category-panel-BWY_YPZV.js","assets/index-CP6R9dTL.js","assets/seo-editor-DlfpOYSl.js","assets/variant-calendar-CodpU1lu.js","assets/view-mode-toggle-Ct7J-xLH.js","assets/post-calendar-Chm7CCue.js","assets/alert-CctLdkUH.js","assets/redirect-editor-C7uuK_jN.js","assets/project-app-view-lSJv2DSd.js","assets/hosting-tab-StoCQBLo.js","assets/empty-state-Cs8gUH2e.js","assets/e2e-tab-9O9jlog6.js","assets/analytics-tab-BAIQskOJ.js","assets/chart-DxN2Cs4Z.js","assets/index-DahqZ1Pw.js","assets/AreaChart-CZiIuPwc.js","assets/cdn-tab-BU_7vQmo.js","assets/ErrorBarContext-3KuuNxaa.js","assets/Sector-DWJi3JDL.js"])))=>i.map(i=>d[i]);
2
+ import{n as Ns,r as A,ac as uC,ad as hC,ae as Et,af as Us,ag as De,ah as cr,ai as Ri,aj as fu,ak as fC,al as Li,am as mC,an as um,ao as Sy,c as F,W as He,l as re,j as o,E as sn,b as le,t as ve,a3 as Ko,I as Yl,h as it,a1 as Ke,a2 as We,a4 as qe,ap as Ks,J as ky,m as Mt,aq as o2,K as tt,a as vn,z as Kc,B as fe,ar as l2,as as jy,v as pr,at as xs,au as vl,av as yx,d as rn,a7 as Vs,e as Es,o as Ge,aw as pC,C as sl,ax as gC,ay as Cy,az as xC,aA as Qi,aB as e1,aC as In,aD as bC,aE as t1,aF as vC,aG as yC,aH as _C,aI as LC,aJ as a2,aK as c2,aL as Ny,aM as d2,x as Ef,aN as wC,aO as SC,aP as kC,aQ as Vy,aR as Yd,Y as wi,aS as mu,k as jC,u as nl,f as il,H as u2,aT as Sc,aU as CC,aV as _x,aW as hm,aa as Ty,a9 as Lx,aX as Ay,aY as Py,aZ as Ey,a_ as NC,a$ as VC,L as yl,b0 as Ry,b1 as TC,b2 as AC,b3 as PC,b4 as Rh,b5 as _l,b6 as tn,b7 as Dy,b8 as Iy,b9 as On,P as Mn,ab as EC,ba as RC,bb as Tt,bc as My,bd as Oy,be as $y,bf as By,bg as zy,bh as Fy,bi as DC,bj as IC,bk as MC,bl as OC,bm as Uy,bn as Gs,N as ni,bo as Hy,bp as $C,bq as BC,br as Ky,bs as zC,bt as FC,bu as UC,bv as HC,bw as jl,bx as KC,by as Wy,bz as WC,bA as qC,bB as GC,bC as YC,bD as JC,bE as QC,bF as XC,bG as ZC,bH as eN}from"./index-CAw6g9tV.js";import{i as Rf,n as tN}from"./ArrowUp-CxKA4POx.js";import{u as Jl,a as ai,b as hs,c as on,d as qy,s as sN,e as nN,f as iN,g as rN,h as oN,i as lN,j as aN,k as h2,l as Gy,T as cN,A as dN,m as uN,n as hN,t as fN,o as mN,p as pN}from"./chat-context-ffF_r7RU.js";import{c as f2,s as Iu,g as Ur,P as Dh,d as m2,t as Ih,a as gN,M as xN,i as bN,b as Si,e as Wc,f as vN,D as yN,h as _N,j as LN,k as Pc,l as wN,m as SN,u as Df,E as kN,n as Mu,o as jN,F as CN,p as If,q as Mf,r as Yy,S as NN,v as VN,w as TN,x as AN,y as wx,z as PN,A as Jy,O as EN,B as Sx,C as Zi,G as RN,T as Br,H as DN,I as or,J as Io,K as fm,L as mm,N as Qy,Q as IN,R as Xy,U as MN,V as ci,W as ON,X as $N,Y as Zy,Z as Ar,_ as BN,$ as zN,a0 as e6,a1 as pl,a2 as kx,a3 as FN,a4 as UN,a5 as jx,a6 as HN,a7 as pu,a8 as Ql,a9 as dr,aa as Mh,ab as p2,ac as g2,ad as KN,ae as WN,af as qN,ag as GN,ah as YN,ai as JN,aj as QN,ak as Of,al as t6,am as s6,an as n6,ao as XN,ap as i6,aq as ZN,ar as eV,as as tV,at as sV,au as Ou,av as nV,aw as iV,ax as rV,ay as oV}from"./automation-runs-BP4svOKv.js";import{c as ds,d as qt,b as Bt,D as zt,h as Nn,e as Gn,i as lV}from"./dialog-DDd8wUS7.js";import{c as aV,b as x2,a as b2,D as v2,d as cV}from"./drawer-CxFI5tCn.js";import{C as dV}from"./collection-search-DUFT-3aZ.js";import{u as Cs,a as uV}from"./use-mcp-client-BJohqqSd.js";import{a as Xl,i as pm,S as qc,b as hV,g as Oh,c as r6,R as fV,d as mV,W as Dd,C as pV}from"./constants-DNuUCxmW.js";import{u as o6,g as $f,l as gm}from"./use-mcp-prompts-DW-tAvJg.js";import{t as bs,n as l6}from"./ChevronUp-BCwuiyHj.js";import{t as gV,z as xV,u as $u,a as y2,b as _2,c as Bf}from"./hooks-J2gbnuVW.js";import{K as bV,a as a6,i as L2,r as vV,s as c6,u as Zl,o as yV,f as _V}from"./shell-layout-X5sLDjab.js";import{u as vs,a as w2,b as Gc,c as LV}from"./use-virtual-mcp-B2TPjUHz.js";import{w as wV,A as SV,b as kV,c as zf,u as jV,r as CV,d as NV}from"./thread-route-CxY5TjeM.js";import{r as d6,d as S2,a as k2,p as VV,b as TV,s as AV,c as PV}from"./thread-intent-C3PV-LRn.js";import{g as io,r as u6}from"./github-repo-BpKUwJal.js";import{u as h6,a as f6,b as m6}from"./use-mcp-tools-vt3UNphZ.js";import{i as gr,a as EV}from"./XCircle-DZJkY1-f.js";import{t as Ff,k as p6,l as j2,j as ea,m as g6,o as x6,p as b6,A as ur,q as v6,r as Ec,s as Wo,u as y6,v as ta,w as RV,x as DV,c as _6,y as $h,z as Uf,g as IV,B as MV,C as OV,D as $V,h as BV,E as Hf,F as sa,G as zV,H as C2,I as L6,J as w6,K as xm,L as s1,M as Cx,N as Kf,O as FV,P as UV,Q as HV,R as KV,S as WV,T as N2,U as S6,V as k6,W as j6,X as C6,Y as qV,Z as V2,_ as GV,$ as li,a0 as Nx,a1 as YV,a2 as JV,d as N6,a3 as T2,a4 as Yc,a5 as Hr,a6 as A2,a7 as Bu,a8 as QV,f as V6,i as Wf,a9 as XV,aa as P2,ab as ZV,ac as eT,ad as tT,ae as sT,af as nT,ag as iT,ah as $o,ai as Vx,aj as T6,ak as rT,al as oT,am as El,an as lT,ao as E2,ap as Tx,aq as aT,ar as cT,as as dT,at as A6,au as uT,av as hT,aw as fT,ax as mT,ay as pT,az as Jd,aA as gT,aB as xT,aC as P6,aD as E6,aE as bT,aF as vT,n as yT,aG as _T,aH as LT,aI as wT,aJ as ST}from"./agent-icon-Dsw04fQF.js";import{i as $t}from"./Check-Jn0qXgT0.js";import{a as ki}from"./Image01-0uExgWAI.js";import{i as Yn}from"./Upload01-VP9EBYtl.js";import{i as Vn}from"./AlertCircle-CG7tfapy.js";import{a as hn}from"./Copy01-jXW2eGyY.js";import{F as bm,a as R2,b as D2,c as I2,d as R6}from"./form-DR4f8DO7.js";import{d as It,S as ws,a as Ss,b as Rs,c as ks}from"./select-Bnv10Fl8.js";import{i as qf}from"./ArrowLeft-Dexv6rHk.js";import{T as Cl,a as na,b as ii,c as Jc}from"./tabs-xquvO62b.js";import{t as vm,i as M2}from"./Tool02-DHxIusmd.js";import{T as Gf,a as Rc}from"./toggle-group-d_5STaVP.js";import{I as vt}from"./input-CRq9rZYf.js";import{u as O2,A as D6,m as zu,S as lr,f as kT,c as jT,l as qo,P as un,T as qn,t as $2,a as ym,g as I6,h as Fu,j as B2,k as Uu,s as M6,n as _m,o as O6,p as CT,q as NT,r as VT,v as TT,w as AT,x as PT,y as ET,z as RT,B as $6,C as DT,i as IT,b as MT,E as OT,D as $T,F as BT,L as Lm,G as Ax,H as zT,I as FT,J as UT,K as HT,M as KT,N as WT}from"./task-route-DWU-0q6w.js";import{s as ji,i as z2,c as B6}from"./XClose-mJWP0IZB.js";import{M as qT,a as GT,m as Yf,i as YT,g as z6,b as JT,N as QT,c as XT}from"./select-model-NQ0mnVuK.js";import{a as os,b as as,P as cs,c as ZT}from"./popover-BIPtCsqc.js";import{t as Kr}from"./Stars01-BTmtR5If.js";import{b as eA,a as F6,c as U6,u as Jf,d as H6}from"./use-organization-settings-Dh58cpUx.js";import{u as Qf,a as tA}from"./use-ai-providers-CiO6eVCB.js";import{g as K6,c as W6,b as jn,L as Xf,p as sA,s as nA,u as Hu,a as iA,f as rA,d as oA}from"./use-project-scope-NvD131m4.js";import{f as lA,a as aA,u as gu,b as Ku,c as q6,d as cA,e as F2,g as G6,h as U2,i as dA,j as H2,k as xu,l as Y6,m as uA,n as J6,o as hA}from"./folder-icon-Dt2zI1nQ.js";import{c as Ut,D as Ht,b as Kt,a as Je,d as er,e as tr,f as sr,g as Bh,h as Bo,i as Nl,j as gd}from"./dropdown-menu-C3Gdadki.js";import{i as K2}from"./Link01-C7a_h6ys.js";import{s as Gt}from"./Plus-D7VA57q5.js";import{p as fA,q as mA}from"./question-004-sINsf4GQ.js";import{A as Hs}from"./avatar-ayySA21l.js";import{u as Zf,a as W2}from"./use-members-C7ip6O59.js";import{i as Ws}from"./ChevronRight-CKftPemQ.js";import{u as Wu}from"./use-is-desktop-app-BNujXJc_.js";import{a as Di,u as qu}from"./use-panel-navigate-9qdFpFC-.js";import{i as xr}from"./CheckCircle-BnpxIwzg.js";import{I as ro}from"./integration-icon-gY5UnY38.js";import{u as pA,f as gA,a as xA}from"./use-navigate-to-agent-wxTo_2Wv.js";import{e as Gu}from"./backoff-CrEUbyZT.js";import{u as bA}from"./use-status-sounds-BpKA8nWD.js";import{E as Ci}from"./empty-state-L8hCXC--.js";import{T as vA}from"./toolbar-D-SXcT0t.js";import{i as Go,n as yA,a as _A}from"./Share07-8oXDBqwk.js";import{i as zn}from"./Globe01-D2uoGclE.js";import{i as LA}from"./Monitor01-CKYtARge.js";import{u as Ni,a as q2,b as G2}from"./use-connection-GI8Focwr.js";import{g as Q6}from"./types-B2KcVByH.js";import{F as Yo}from"./file-type-icon-C5mq72Tm.js";import{f as wA,d as Yu,s as Y2,c as SA,b as kA}from"./TrendUp01-BctNF4vg.js";import{i as Vi}from"./ZoomOut-D8t79aO2.js";import{i as nr}from"./GitBranch01-Bde_Ik_K.js";import{a as J2}from"./Package-D0PXqO6P.js";import{u as e9,a as X6}from"./use-file-configs-CjjmtK39.js";import{r as Q2}from"./site-slug-uya6Wp4-.js";import{n as bu}from"./Download01-BpcIjY9x.js";import{n as fn}from"./LinkExternal01-D_IXdPPU.js";import{D as Ll}from"./use-destination-route-C5lOfatk.js";import{d as X2,g as jA,s as CA,a as NA,F as Z6,b as e8,f as t8,S as s8,c as VA}from"./skill-preview-DL4gp0ne.js";import{i as t9}from"./Key01-BiKWCM1S.js";import{p as Z2,b as cn,s as Dc,H as vu,h as yu,a as oc,c as n8,d as i8}from"./location-oTTXFrSF.js";import{m as TA,a as AA,M as Qc,b as PA,O as EA}from"./markdown-C1VdpJ5j.js";import{p as RA,f as DA}from"./pt-BR-CLy76QW2.js";import{g as IA,e as MA}from"./extract-connection-data-C2Ocp5Tk.js";import{a as OA,i as Px}from"./mcp-oauth-DwPFIejs.js";import{A as qr,a as Gr,b as Yr,c as Jr,d as Qr,e as Xr,f as Zr,g as eo}from"./alert-dialog-BU3enZKF.js";import{T as Jo}from"./textarea-BClvRA4H.js";import{i as Rl}from"./Play-CONIoWIl.js";import{s as nn}from"./Trash01-CHla-FrA.js";import{u as zh}from"./use-debounced-autosave-DJCeP_ec.js";import{S as ia}from"./scroll-area-BI805ul_.js";import{i as _u}from"./SearchMd-C1loDEwy.js";import{C as Xc}from"./checkbox-DmweFMZg.js";import{S as s9}from"./search-input-CFyqYOfd.js";import{C as r8}from"./collection-tabs-aHnkLK94.js";import{T as o8,u as l8}from"./use-mcp-auth-status-Dj0-A5Wa.js";import{g as $A}from"./connection-slug-CITJ0kGN.js";import{a as BA,i as zA}from"./Settings02-DfFNQquZ.js";import{L as Dt}from"./label-ByckMHtZ.js";import{S as Ti}from"./switch-DlPMc1e_.js";import{s as a8}from"./slugify-CEUa2lfQ.js";import{d as Zc}from"./delay-CnY5UFtP.js";import{G as mn,a as Ju,u as FA}from"./github-repo-picker-Dyu49H5P.js";import{s as c8}from"./User01-8XeMepHg.js";import{t as n9}from"./Users01-CvPFHBcf.js";import{u as d8,a as u8}from"./use-secrets-N0I1WQgn.js";import{C as UA,a as HA,b as KA}from"./client-icons-DX-H77xu.js";import{g as Cn}from"./get-initials-D-f_fDFw.js";import{S as is,D as h8,C as f8,R as WA,a as qA,i as m8,n as GA,b as YA}from"./task-board-DHq8t-_N.js";import{a as ed}from"./format-time-BnbuEtat.js";import{u as p8,d as JA,c as QA,C as eg,a as XA}from"./connect-layout-CS-AhNLB.js";import{l as g8,g as ZA}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{u as tg,a as eP,b as tP}from"./use-tags-EBwNPMg8.js";import{B as sP,a as nP,b as Ex,c as iP,d as rP,e as oP}from"./breadcrumb-B5Tcv0Uh.js";import{u as n1}from"./use-copy-C0nulXNR.js";import{i as sg,a as lP,c as aP,b as cP}from"./UserSquare-BEv1iIj5.js";import{C as Ii,a as di,b as ui,c as $n,d as ls,e as Ps,f as dP,g as Rx}from"./command-CEQjEkRa.js";import{u as uP}from"./use-org-auth-client-DVDqxM9c.js";import{i as i9}from"./ChevronSelectorVertical-BPOo032l.js";import{a as hP}from"./authenticate-and-persist-oauth-UjkEE9k3.js";import{w as Dx}from"./editor-B0M9C5II.js";import{T as Mr,I as ng,p as fP}from"./toolbar-icon-button-DSBvSnFI.js";import{u as wm,C as mP,b as pP,p as x8,a as gP,s as Sm,n as xP}from"./self-tool-result-Dc4tPK9T.js";import{M as td}from"./monaco-editor-DhRI2q0D.js";import{i as bP,a as r9,b as ig}from"./Tool01-CtOHcy0Y.js";import{a as km}from"./Palette-CQVEzzhe.js";import{s as vP}from"./safe-image-url-D5z803Ot.js";import{s as Qu}from"./Eye-DvBjB5D4.js";import{i as o9}from"./DotsVertical-C65YDOa_.js";import{u as l9}from"./use-debounced-value-CozflcUh.js";import{u as b8}from"./useInfiniteQuery-Nq5i14p1.js";import{i as hr}from"./Zap-JQtzyV8B.js";import{B as yP}from"./badge-BJg3YTbr.js";import{u as Xu,a as _P,b as LP,c as wP,d as SP}from"./use-automations-VoPscQxA.js";import{A as kP}from"./automation-list-row-CakAIrvQ.js";import{t as jP}from"./site-error--i37Vnuw.js";import{f as CP,p as NP,g as VP,u as TP,e as AP,a as PP,F as Zu,t as v8,S as EP,B as RP,b as y8,R as DP,c as IP}from"./cards-D9Ttj2cE.js";function _8(t,e){const s=Ns(e);return MP({filters:{...t,status:"pending"}},s).length}function Ix(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function MP(t={},e){const s=Ns(e).getMutationCache(),n=A.useRef(t),i=A.useRef(null);return i.current===null&&(i.current=Ix(s,t)),A.useEffect(()=>{n.current=t}),A.useSyncExternalStore(A.useCallback(r=>s.subscribe(()=>{const l=uC(i.current,Ix(s,n.current));i.current!==l&&(i.current=l,hC.schedule(r))}),[s]),()=>i.current,()=>i.current)}const Id=Et({connection_id:De().describe("Connection ID"),selected_tools:Us(De()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:Us(De()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:Us(De()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),L8=Id.extend({selected_tools:Id.shape.selected_tools.optional(),selected_resources:Id.shape.selected_resources.optional(),selected_prompts:Id.shape.selected_prompts.optional()}),OP=Et({connectionId:De(),toolName:De(),label:De(),icon:De().nullable().optional()}),$P=Et({id:De().describe("Stable id; used as React key and ?tab= value"),title:De().describe("Tab label"),icon:De().optional().describe("Optional lucide icon name"),view:Et({type:um("ext-app"),appId:De(),args:fu(De(),Sy()).optional()})}),BP=Ri(["on","off"]),zP=new Map([["manual","on"],["auto","on"]]),FP=Ri(["on","off","manual","auto"]);function UP(t){if(!t)return null;const e=zP.get(t);return e||(t==="on"||t==="off"?t:null)}const HP=Et({defaultMainView:Et({type:De(),id:De().optional(),toolName:De().optional()}).nullable().optional(),chatDefaultOpen:cr().nullable().optional(),cmsDefaultOpen:cr().nullable().optional(),cms:FP.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),tabs:Us($P).optional()});function e0(t){return UP(t?.cms)??"on"}function KP(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"site-editor"}}:{}}}const Mx=Et({tileId:De().optional(),connectionId:De().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:De().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:De().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:fu(De(),Sy()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Li().int().positive().optional(),maxHeight:Li().int().positive().optional()}),WP=Et({banner:De().nullable().optional(),bannerColor:De().nullable().optional(),icon:De().nullable().optional(),themeColor:De().nullable().optional(),pinnedViews:Us(OP).nullable().optional(),layout:HP.nullable().optional(),homeTile:Mx.nullable().optional(),homeTiles:Us(Mx).nullable().optional(),homePrompts:Us(De()).nullable().optional()}),t0=/^[A-Za-z_][A-Za-z0-9_]*$/,Ox=De().min(1).regex(t0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),qP=mC("kind",[Et({key:Ox,kind:um("literal"),value:De()}),Et({key:Ox,kind:um("secret"),secretId:De().min(1)})]),rg=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,GP=Et({host:De().min(1).regex(rg).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:De().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),YP=Et({selected:De().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:De().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:De().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:Us(qP).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:Us(GP).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.")}),JP=Et({url:De().describe("GitHub repository URL"),owner:De().describe("Repository owner"),name:De().describe("Repository name"),installationId:Li().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:De().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),QP=Ri(["agent-sandbox","local-api"]),XP={sandboxHandle:De().describe("Provider-specific handle"),previewUrl:De().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:De().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:Li().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:Et({packageManager:De().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:De().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:De().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.")},w8=Et(XP);function ZP(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]=w8.parse(i)}catch{}return s}const eE=fu(De().describe("userId"),fu(De().describe("branch"),fC(QP,w8))),tE=Et({id:De().describe("Stable identifier for this knowledge file"),name:De().describe("File name shown in the UI"),kind:Ri(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:De().describe("Org filesystem (Library) volume the file lives in"),path:De().describe("Path within the volume"),url:De().describe("Same-origin URL to read the file (display/download)"),contentType:De().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Li().nullable().optional().describe("File size in bytes"),addedAt:De().describe("ISO timestamp when the file was attached")}),sE=Us(tE).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."),nE=Ri(["smart","code-review","open"]),iE=nE.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."),rE=cr().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."),oE=cr().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."),lE=De().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."),aE=Et({branch:De().describe("Git branch backing this release"),name:De().describe('User-facing name, e.g. "Black Friday 2026"'),color:De().describe("Dot color token shown in the version switcher"),createdBy:De().optional().describe("User ID who created the release"),createdAt:De().optional().describe("ISO 8601 creation timestamp")}),cE=Us(aE).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."),dE=cr().nullable().optional().describe("Draft & Releases mode: gates the drafts UX (releases switcher, read-only production, publish-to-production). Off (default) keeps the classic branch/PR picker and post-publish behavior."),og={instructions:De().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:Us(De()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Us(De()).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:De().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:WP.nullable().optional().describe("UI customization settings"),githubRepo:JP.nullable().optional().describe("Linked GitHub repository"),runtime:YP.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:sE,siteSlug:De().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:iE,previewServerUrl:lE,productionUrl:De().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:cr().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:rE,releases:cE,draftsMode:dE,fastPreviewInPlace:oE},uE=Et({id:De().describe("Unique identifier"),title:De().describe("Human-readable name"),description:De().nullable().describe("Description"),icon:De().nullable().describe("Icon URL"),created_at:De().describe("Creation timestamp"),updated_at:De().describe("Last update timestamp"),created_by:De().describe("User ID who created this item"),updated_by:De().optional().describe("User ID who last updated this item"),organization_id:De().describe("Organization ID this item belongs to"),status:Ri(["active","inactive"]).describe("Current status"),pinned:cr().describe("Whether this space is pinned to the sidebar"),metadata:Et(og).extend({instructions:De().nullable().describe("Instructions also used as system prompt"),sandboxMap:eE.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:Us(Id).describe("Connections with their selected tools, resources, and prompts")}),S8=Et({title:De().min(1).max(120).describe("Short label shown on the chip"),description:De().max(280).optional().describe("One-line subtitle shown under the title"),text:De().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});Et({title:De().min(1).max(255).describe("Name for the virtual MCP"),description:De().max(500).nullable().optional().describe("Optional description"),icon:De().nullish().describe("Optional icon URL"),status:Ri(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:cr().optional().default(!1).describe("Pin to sidebar"),metadata:Et(og).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:Us(L8).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:Us(S8).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.")});Et({title:De().min(1).max(255).optional().describe("New name"),description:De().max(500).nullable().optional().describe("New description (null to clear)"),icon:De().nullish().describe("New icon URL"),status:Ri(["active","inactive"]).optional().describe("New status"),pinned:cr().optional().describe("Pin/unpin from sidebar"),metadata:Et(og).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:Us(L8).optional().describe("New connections (replaces existing)"),prompts:Us(S8).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).")});const $x=3,k8="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",hE="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function j8(t){const e=F.c(46),{item:s,onSelect:n,isLoading:i,isDisabled:r,variant:l}=t,a=l===void 0?"pill":l,{prompt:c}=s;let d;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const S=Ur(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 u=d,h=c.description||null;if(a==="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 T;e[7]!==j||e[8]!==C?(T=re(hE,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=T):T=e[9];let N;e[10]!==u?(N=o.jsx("span",{className:"font-medium truncate capitalize",children:u}),e[10]=u,e[11]=N):N=e[11];let P;e[12]!==i?(P=i&&o.jsx(it,{size:"xs"}),e[12]=i,e[13]=P):P=e[13];let V;e[14]!==N||e[15]!==P?(V=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[N,P]}),e[14]=N,e[15]=P,e[16]=V):V=e[16];let E;e[17]!==h?(E=h&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h}),e[17]=h,e[18]=E):E=e[18];let R;return e[19]!==V||e[20]!==E||e[21]!==S||e[22]!==k||e[23]!==T?(R=o.jsxs("button",{type:"button",onClick:S,disabled:k,className:T,children:[V,E]}),e[19]=V,e[20]=E,e[21]=S,e[22]=k,e[23]=T,e[24]=R):R=e[24],R}let f;e[25]!==n||e[26]!==c?(f=()=>n(c),e[25]=n,e[26]=c,e[27]=f):f=e[27];const m=r||i,p=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==p||e[29]!==g?(x=re(k8,"hover:bg-muted/70 hover:text-foreground",p,g),e[28]=p,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==u?(b=o.jsx("span",{className:"capitalize",children:u}),e[31]=u,e[32]=b):b=e[32];let v;e[33]!==i?(v=i&&o.jsx(it,{size:"xs"}),e[33]=i,e[34]=v):v=e[34];let _;e[35]!==f||e[36]!==m||e[37]!==x||e[38]!==b||e[39]!==v?(_=o.jsx(Ke,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:m,className:x,children:[b,v]})}),e[35]=f,e[36]=m,e[37]=x,e[38]=b,e[39]=v,e[40]=_):_=e[40];const y=h??u;let L;e[41]!==y?(L=o.jsx(We,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=L):L=e[42];let w;return e[43]!==_||e[44]!==L?(w=o.jsxs(qe,{delayDuration:400,children:[_,L]}),e[43]=_,e[44]=L,e[45]=w):w=e[45],w}function fE(t){const e=F.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:l}=t,a=le(),[c,d]=A.useState(""),u=!!l;let h;e[0]!==s||e[1]!==c?(h=c.trim()?s.filter(N=>{const P=c.toLowerCase();return N.prompt.name.toLowerCase().includes(P)||(N.prompt.title??"").toLowerCase().includes(P)||(N.prompt.description??"").toLowerCase().includes(P)}):s,e[0]=s,e[1]=c,e[2]=h):h=e[2];const f=h,m=Yl();let p;e[3]!==f.length||e[4]!==c||e[5]!==a?(p=f.length===0&&o.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:a("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=f.length,e[4]=c,e[5]=a,e[6]=p):p=e[6];let g;if(e[7]!==f||e[8]!==u||e[9]!==l?.name||e[10]!==i||e[11]!==r){let N;e[13]!==u||e[14]!==l?.name||e[15]!==i||e[16]!==r?(N=P=>o.jsx(j8,{item:P,variant:"card",onSelect:V=>{i(!1),r(V)},isLoading:l?.name===P.prompt.name,isDisabled:u&&l?.name!==P.prompt.name},P.prompt.name),e[13]=u,e[14]=l?.name,e[15]=i,e[16]=r,e[17]=N):N=e[17],g=f.map(N),e[7]=f,e[8]=u,e[9]=l?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==p||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:[p,g]})}),e[18]=p,e[19]=g,e[20]=x):x=e[20];const b=x;let v;e[21]!==a?(v=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=N=>{N.key==="Escape"&&d("")},e[23]=_):_=e[23];let y;e[24]!==c||e[25]!==v?(y=o.jsx(dV,{value:c,onChange:d,placeholder:v,onKeyDown:_}),e[24]=c,e[25]=v,e[26]=y):y=e[26];const L=y;if(m){let N;e[27]!==a?(N=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=N):N=e[28];let P;e[29]!==N?(P=o.jsx(aV,{className:"sr-only",children:o.jsx(x2,{children:N})}),e[29]=N,e[30]=P):P=e[30];let V;e[31]!==a?(V=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=V):V=e[32];let E;e[33]!==V?(E=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:V})}),e[33]=V,e[34]=E):E=e[34];let R;e[35]!==b||e[36]!==L||e[37]!==E||e[38]!==P?(R=o.jsxs(b2,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[P,E,L,b]}),e[35]=b,e[36]=L,e[37]=E,e[38]=P,e[39]=R):R=e[39];let I;return e[40]!==i||e[41]!==n||e[42]!==R?(I=o.jsx(Ko,{delayDuration:400,children:o.jsx(v2,{open:n,onOpenChange:i,children:R})}),e[40]=i,e[41]=n,e[42]=R,e[43]=I):I=e[43],I}let w;e[44]!==a?(w=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=w):w=e[45];let S;e[46]!==w?(S=o.jsx(ds,{className:"sr-only",children:o.jsx(qt,{children:w})}),e[46]=w,e[47]=S):S=e[47];let k;e[48]!==a?(k=a("chat.iceBreakers.promptsLabel"),e[48]=a,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]!==L||e[54]!==j||e[55]!==S?(C=o.jsxs(Bt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[S,j,L,b]}),e[52]=b,e[53]=L,e[54]=j,e[55]=S,e[56]=C):C=e[56];let T;return e[57]!==i||e[58]!==n||e[59]!==C?(T=o.jsx(Ko,{delayDuration:400,children:o.jsx(zt,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=T):T=e[60],T}function mE(t){const e=F.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,l=le(),[a,c]=A.useState(!1);if(s.length===0)return null;let d,u,h,f,m;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,$x),v=s.slice($x),_=!!i;let y;e[10]!==_||e[11]!==i?.name||e[12]!==n?(y=w=>o.jsx(j8,{item:w,onSelect:n,isLoading:i?.name===w.prompt.name,isDisabled:_&&i?.name!==w.prompt.name},w.prompt.name),e[10]=_,e[11]=i?.name,e[12]=n,e[13]=y):y=e[13];const L=b.map(y);d=Ko,m=400,e[14]!==r?(u=re("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=u):u=e[15],h=L,f=v.length>0&&o.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:re(k8,"hover:bg-muted/70 hover:text-foreground",_&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:v.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=u,e[7]=h,e[8]=f,e[9]=m}else d=e[5],u=e[6],h=e[7],f=e[8],m=e[9];let p;e[16]!==u||e[17]!==h||e[18]!==f?(p=o.jsxs("div",{className:u,children:[h,f]}),e[16]=u,e[17]=h,e[18]=f,e[19]=p):p=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=o.jsx(fE,{items:s,open:a,onOpenChange:c,onSelect:n,loadingPrompt:i}),e[20]=s,e[21]=i,e[22]=a,e[23]=n,e[24]=g):g=e[24];let x;return e[25]!==d||e[26]!==m||e[27]!==p||e[28]!==g?(x=o.jsxs(d,{delayDuration:m,children:[p,g]}),e[25]=d,e[26]=m,e[27]=p,e[28]=g,e[29]=x):x=e[29],x}function pE(){return null}function gE(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 xE(t){const e=F.c(31),{connectionId:s}=t,n=le(),{sendMessage:i}=ai(),{org:r}=He();let l;e[0]!==s||e[1]!==r.id||e[2]!==r.slug?(l={connectionId:s,orgId:r.id,orgSlug:r.slug},e[0]=s,e[1]=r.id,e[2]=r.slug,e[3]=l):l=e[3];const a=Cs(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=o6(c);let u;e[6]!==d?.prompts?(u=d?.prompts??[],e[6]=d?.prompts,e[7]=u):u=e[7];const h=u;let f;e[8]!==h?(f=h.map(bE),e[8]=h,e[9]=f):f=e[9];const m=f;let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p={stage:"idle"},e[10]=p):p=e[10];const[g,x]=A.useReducer(gE,p),[b,v]=A.useState(null);let _;e[11]!==a||e[12]!==i||e[13]!==n?(_=async(V,E)=>{if(!a){ve.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const R=await $f(a,V.name,E);x({type:"RESET"});const I={type:"doc",content:[{type:"paragraph",content:[f2({id:V.name,name:Iu(V.name,Ur(V._meta)),metadata:R.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(I)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),ve.error(n("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=a,e[12]=i,e[13]=n,e[14]=_):_=e[14];const y=_;let L;e[15]!==y?(L=async V=>{if(V.arguments&&V.arguments.length>0){x({type:"SELECT_PROMPT",prompt:V}),v(V);return}x({type:"START_LOADING",prompt:V}),await y(V)},e[15]=y,e[16]=L):L=e[16];const w=L;let S;e[17]!==b||e[18]!==y?(S=async V=>{b&&(x({type:"START_LOADING",prompt:b,arguments:V}),v(null),await y(b,V))},e[17]=b,e[18]=y,e[19]=S):S=e[19];const k=S;if(m.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==w||e[21]!==m||e[22]!==j?(C=o.jsx(mE,{items:m,onSelect:w,loadingPrompt:j}),e[20]=w,e[21]=m,e[22]=j,e[23]=C):C=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v(null),x({type:"RESET"})},e[24]=T):T=e[24];let N;e[25]!==b||e[26]!==k?(N=o.jsx(Dh,{prompt:b,setPrompt:T,onSubmit:k}),e[25]=b,e[26]=k,e[27]=N):N=e[27];let P;return e[28]!==C||e[29]!==N?(P=o.jsxs(o.Fragment,{children:[C,N]}),e[28]=C,e[29]=N,e[30]=P):P=e[30],P}function bE(t){return{prompt:t}}function vE(t){const e=F.c(13),{className:s}=t,{selectedVirtualMcp:n}=Jl(),{org:i}=He();let r;e[0]!==i.id?(r=Xl(i.id),e[0]=i.id,e[1]=r):r=e[1];const l=r.id,a=n?.id??l;let c;e[2]!==s?(c=re("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(pE,{}),e[4]=u):u=e[4];let h;e[5]!==a?(h=o.jsx(xE,{connectionId:a}),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==d||e[8]!==h?(f=o.jsx(sn,{fallback:null,children:o.jsx(A.Suspense,{fallback:u,children:h},d)}),e[7]=d,e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==c||e[11]!==f?(m=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=m):m=e[12],m}const i1="cubic-bezier(0.645, 0.045, 0.355, 1)",yE=44,_E={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"},LE={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},wE={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function Qo(t){const e=F.c(69),{icon:s,label:n,count:i,title:r,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:u,onClose:h}=t,f=u===void 0?"default":u,m=le(),[p,g]=A.useState(d),[x,b]=A.useState(!1);let v;e[0]!==h?(v=()=>{b(!0),h?.()},e[0]=h,e[1]=v):v=e[1];const _=v;if(x)return null;const y=LE[f],L=_E[f];let w;e[2]!==y||e[3]!==L?(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,L),e[2]=y,e[3]=L,e[4]=w):w=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g(SE),e[5]=S):S=e[5];const k=p&&"rounded-b-none",j=!p&&"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 T=wE[f];let N;e[9]!==T?(N=re("shrink-0",T),e[9]=T,e[10]=N):N=e[10];let P;e[11]!==s||e[12]!==N?(P=o.jsx("span",{className:N,children:s}),e[11]=s,e[12]=N,e[13]=P):P=e[13];let V;e[14]!==n?(V=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=V):V=e[15];let E;e[16]!==i?(E=i?o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:i}):null,e[16]=i,e[17]=E):E=e[17];const R=p?"rotate(180deg)":"rotate(0deg)";let I;e[18]!==R?(I=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(bs,{size:16,style:{transform:R,transition:`transform 180ms ${i1}`}})}),e[18]=R,e[19]=I):I=e[19];let D;e[20]!==m?(D=m("chat.collapsibleHighlight.closeLabel"),e[20]=m,e[21]=D):D=e[21];let O;e[22]!==m?(O=m("chat.collapsibleHighlight.closeTitle"),e[22]=m,e[23]=O):O=e[23];let $,M;e[24]!==_?($=J=>{J.stopPropagation(),_()},M=J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),J.stopPropagation(),_())},e[24]=_,e[25]=$,e[26]=M):($=e[25],M=e[26]);let z;e[27]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(Ks,{size:16}),e[27]=z):z=e[27];let B;e[28]!==D||e[29]!==O||e[30]!==$||e[31]!==M?(B=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":D,title:O,onClick:$,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]=$,e[31]=M,e[32]=B):B=e[32];let U;e[33]!==p||e[34]!==P||e[35]!==V||e[36]!==E||e[37]!==I||e[38]!==B||e[39]!==C?(U=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":p,onClick:S,className:C,children:[P,V,E,I,B]}),e[33]=p,e[34]=P,e[35]=V,e[36]=E,e[37]=I,e[38]=B,e[39]=C,e[40]=U):U=e[40];const H=p?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${i1}`},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 Q=p?1:0;let X;e[44]!==Q?(X={opacity:Q,transition:`opacity 120ms ${i1}`,maxHeight:"60vh"},e[44]=Q,e[45]=X):X=e[45];let se;e[46]!==r?(se=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]=se):se=e[47];let ne;e[48]!==c||e[49]!==r?(ne=c?o.jsx("div",{className:re("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=ne):ne=e[50];let te;e[51]!==se||e[52]!==ne?(te=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[se,ne]}),e[51]=se,e[52]=ne,e[53]=te):te=e[53];let ee;e[54]!==l||e[55]!==a?(ee=l||a?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:l}),o.jsx("div",{className:"flex items-center gap-2",children:a})]})}):null,e[54]=l,e[55]=a,e[56]=ee):ee=e[56];let Y;e[57]!==X||e[58]!==te||e[59]!==ee?(Y=o.jsx("div",{style:K,children:o.jsxs("div",{className:"flex flex-col",style:X,children:[te,ee]})}),e[57]=X,e[58]=te,e[59]=ee,e[60]=Y):Y=e[60];let q;e[61]!==W||e[62]!==Y?(q=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:Y}),e[61]=W,e[62]=Y,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 SE(t){return!t}const kE=Et({content:De().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Ri(["pending","in_progress","completed"]),activeForm:De().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),C8=Et({todos:Us(kE)}),jE="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.";gV({description:jE,inputSchema:xV(C8),execute:async({todos:t})=>({ok:!0,count:t.length})});const CE="tool-todo_write",NE=new Set(["input-available","output-available"]);function VE(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!==CE||typeof r.state!="string"||!NE.has(r.state))continue;const l=C8.safeParse(r.input);if(l.success)return l.data.todos}}return[]}function N8(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:Ih(gN(n)),input:s.input})}return e}function V8(t){return t.at(-1)}function T8(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 TE(t){return t?t.message.startsWith("[CREDITS]"):!1}const AE="[SUBSCRIPTION_REQUIRED]";function A8(t){return t?.message.startsWith(AE)?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 PE={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function EE(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&TE(s))return{...PE,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,u=!!c.filter(y=>y.type==="tool-user_ask").filter(y=>y.state!=="output-available").length,h=T8(a),f=N8(c),m=VE(e),p=i?null:A8(s),g=!i&&!!s&&!p,x=f.length>0||i&&r,b=h.length>0,_=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(u||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:p,hasTodos:m.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:u,todos:m}}function P8(){const t=F.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=ai(),l=s??null,a=n??null;let c;return t[0]!==i||t[1]!==r||t[2]!==e||t[3]!==l||t[4]!==a?(c=EE({messages:e,error:l,finishReason:a,isStreaming:i,isWaitingForApprovals:r}),t[0]=i,t[1]=r,t[2]=e,t[3]=l,t[4]=a,t[5]=c):c=t[5],c}function RE(){const t=P8();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+ +!!t.subscriptionErrorKind+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function E8(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(s=>s.type==="hardBreak"||s.type==="text"&&(!s.text||s.text.trim()==="")):!1)}const DE="__home__";function lg(t,e){return ky.chatDraft(t,e)}function IE(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const s=e.tiptapDoc;return!s||typeof s!="object"||s.type!=="doc"||!Array.isArray(s.content)?null:s}function R8(t,e,s,n,i){const r=lg(e,s);if(E8(n)){t.removeItem(r);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(r,a)}catch(c){if(OE(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function Bx(t,e,s){const n=lg(e,s),i=t.getItem(n),r=IE(i);return i!==null&&r===null&&t.removeItem(n),r}function ME(t,e,s){t.removeItem(lg(e,s))}function OE(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function yn(t){const e=F.c(14),s=vs(t),n=hs(),i=s?.metadata,r=n?.activeTask,l=r?.metadata?.runtime;let a;e[0]!==l?(a=VV(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!r&&!r.partial,u=r?.metadata;let h;e[2]!==i||e[3]!==u?(h=d6(u,i),e[2]=i,e[3]=u,e[4]=h):h=e[4];const f=!!c||d&&!!s;let m;e[5]!==i?(m=S2(i),e[5]=i,e[6]=m):m=e[6];let p;e[7]!==i?(p=k2(i),e[7]=i,e[8]=p):p=e[8];let g;return e[9]!==h||e[10]!==f||e[11]!==m||e[12]!==p?(g={runtime:h,resolved:f,projectDefault:m,previewServerUrl:p},e[9]=h,e[10]=f,e[11]=m,e[12]=p,e[13]=g):g=e[13],g}function $E(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function a9(t){return t?.name||t?.email?.split("@")[0]||void 0}function Dl(t){const e=$E(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}function D8(t){if(!t||typeof t!="object")return null;const e=t;return e.isError?e.content?.find(n=>n.type==="text")?.text?.trim()||"GitHub MCP tool returned an error":null}function ag(t){const e=D8(t);if(e)throw new Error(e)}function BE(t){try{return JSON.parse(t)}catch{return null}}function zE(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(r=>r.type==="text")?.text,n=s?BE(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function s0(t){const e=zE(t);return e===null?null:e}function I8(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function FE(t){if(!t||typeof t!="object")return null;const e=t.content?.find(i=>i.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],n=I8(s);return!n||!s?null:{number:n,htmlUrl:s}}function zx(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const Fx=/[\r\n<>]/,UE=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function n0(t){const e=t?.userName?.trim();if(!e||Fx.test(e))return null;const s=t?.userEmail?.trim();return!s||Fx.test(s)?{userName:e}:UE.test(s)?{userName:e,userEmail:s}:{userName:e}}function HE(t){return t.split(`
3
3
  `).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
4
4
  `).trimEnd()}function KE(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function M8(t,e){const s=n0(e);if(!s)return t;const n=HE(t),i=KE(s);if(n.includes(i))return n;const r=n.trimEnd();return r.length>0?`${r}
5
5
 
@@ -621,10 +621,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
621
621
  22% { opacity: 0; }
622
622
  }
623
623
  `}),e[27]=L):L=e[27];let w;return e[28]!==y||e[29]!==h?(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:[h,y,L]}),e[28]=y,e[29]=h,e[30]=w):w=e[30],w}function Z0(t){const e=F.c(10),{phase:s,current:n,children:i}=t,r=s-n,l=r<0,a=r===0,c=l?90:r*-22,d=l?.94:1-Math.max(r,0)*.04,u=l?0:a?1:r===1?.8:.55,h=l?10:30-r,f=!a;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=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]=m):m=e[0];const p=`translateY(${c}px) scale(${d})`,g=a?"auto":"none";let x;e[1]!==u||e[2]!==p||e[3]!==g||e[4]!==h?(x={transform:p,opacity:u,zIndex:h,transitionDuration:"1000ms",pointerEvents:g},e[1]=u,e[2]=p,e[3]=g,e[4]=h,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:m,style:x,children:i}),e[6]=i,e[7]=f,e[8]=x,e[9]=b):b=e[9],b}function A9(t){const e=F.c(7),{showUrl:s}=t,n=s===void 0?!1:s;let i,r,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:re("size-2.5 rounded-full",ti)}),r=o.jsx("div",{className:re("size-2.5 rounded-full",ti)}),l=o.jsx("div",{className:re("size-2.5 rounded-full",ti)}),e[0]=i,e[1]=r,e[2]=l):(i=e[0],r=e[1],l=e[2]);let a;e[3]!==n?(a=n&&o.jsx("div",{className:re("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",Xi)}),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==a?(c=o.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[i,r,l,a]}),e[5]=a,e[6]=c):c=e[6],c}function tZ(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(A9,{}),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:YX.map(sZ)})})]}),t[1]=s):s=t[1],s}function sZ(t,e){if(e===Ww)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",ti),children:o.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${qw}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function nZ(){const t=F.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(A9,{}),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",Xi),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",Xi),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),o.jsx("div",{className:re("rounded-md",Xi),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=r):r=t[4],r}function iZ(){const t=F.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(A9,{}),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:XX.map(rZ)})})]}),t[1]=s):s=t[1],s}function rZ(t,e){return o.jsx("div",{className:re("aspect-square rounded-md",ZX[e]?"bg-chart-2/70":ti),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function oZ(){const t=F.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(A9,{showUrl:!0}),t[0]=e):e=t[0];let s,n,i,r,l;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",ti)}),i=o.jsx("div",{className:re("h-1.5 w-[55%] rounded-sm",ti)}),r=o.jsx("div",{className:re("h-1.5 w-[80%] rounded-sm",ti)}),l=o.jsx("div",{className:re("h-1.5 w-[50%] rounded-sm",ti)}),t[1]=s,t[2]=n,t[3]=i,t[4]=r,t[5]=l):(s=t[1],n=t[2],i=t[3],r=t[4],l=t[5]);let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=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,l,o.jsx("div",{className:"mt-auto",children:o.jsx("div",{className:re("h-4 rounded-md",ti)})})]}),t[6]=a):a=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",Xi)})]})}),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",Xi)}),o.jsx("div",{className:re("h-4 w-14 rounded-full",Xi)})]}),t[8]=d):d=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:re("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",Xi),children:[o.jsx("div",{className:re("h-1.5 w-[50%] rounded-sm",ti)}),o.jsx("div",{className:re("h-1 w-[75%] rounded-sm",ti)})]}),t[9]=u):u=t[9];let h;return t[10]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1",children:[a,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:[u,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[o.jsx("div",{className:re("rounded-md",Xi)}),o.jsx("div",{className:re("rounded-md",Xi)})]})]})]})]})]})]}),t[10]=h):h=t[10],h}function Tc(t){const e=F.c(52),s=le();if(t.kind==="starting"){let m;return e[0]!==t.claimPhase||e[1]!==t.progress?(m=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsx(eZ,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=m):m=e[2],m}if(t.kind==="errored"){const m=t.error.code===Im.githubNotAuthenticated,p=t.error.code===Im.githubConnectionMissing;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(sl,{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]!==p||e[9]!==m||e[10]!==t.error.message||e[11]!==s?(v=p?s("sandbox.stateCard.githubConnectionMissingMessage"):m?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[8]=p,e[9]=m,e[10]=t.error.message,e[11]=s,e[12]=v):v=e[12];let _;e[13]!==v?(_=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:v}),e[13]=v,e[14]=_):_=e[14];let y;e[15]!==p||e[16]!==m||e[17]!==t.connectionsHref||e[18]!==s?(y=(m||p)&&t.connectionsHref&&o.jsx(fe,{asChild:!0,children:o.jsx("a",{href:t.connectionsHref,children:s(p?"sandbox.stateCard.linkRepoAgain":"sandbox.stateCard.reconnectGithub")})}),e[15]=p,e[16]=m,e[17]=t.connectionsHref,e[18]=s,e[19]=y):y=e[19];const L=t.onRetry;let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(On,{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(fe,{variant:"outline",onClick:L,children:[w," ",S]}),e[23]=t.onRetry,e[24]=S,e[25]=k):k=e[25];let j;e[26]!==y||e[27]!==k?(j=o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[y,k]}),e[26]=y,e[27]=k,e[28]=j):j=e[28];let C;return e[29]!==j||e[30]!==b||e[31]!==_?(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,_,j]})}),e[29]=j,e[30]=b,e[31]=_,e[32]=C):C=e[32],C}let n;e[33]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(XV,{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 l;e[38]!==s?(l=s("sandbox.stateCard.resumeToContinue"),e[38]=s,e[39]=l):l=e[39];let a;e[40]!==l?(a=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:l}),e[40]=l,e[41]=a):a=e[41];const c=t.onResume;let d;e[42]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Rl,{className:"size-4"}),e[42]=d):d=e[42];let u;e[43]!==s?(u=s("sandbox.stateCard.resume"),e[43]=s,e[44]=u):u=e[44];let h;e[45]!==t.onResume||e[46]!==u?(h=o.jsxs(fe,{onClick:c,className:"mt-2",children:[d," ",u]}),e[45]=t.onResume,e[46]=u,e[47]=h):h=e[47];let f;return e[48]!==r||e[49]!==a||e[50]!==h?(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,a,h]})}),e[48]=r,e[49]=a,e[50]=h,e[51]=f):f=e[51],f}function N3(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function lZ(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 V3(t){try{return lZ(localStorage.getItem(t))}catch{return null}}function aZ(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function Gw(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 nb="site-links",cZ=/details?page|\bpdp\b/i,dZ=/listingpage|\bplp\b/i;function uZ(t,e,s){const n=new Set;for(const a of s)cZ.test(a)&&n.add("product"),dZ.test(a)&&n.add("category");const i=rf(Fo(t)),r=i[i.length-1],l=i[i.length-2];return r?.type==="text"&&r.text==="/p"&&l?.type==="param"&&l.name===e&&n.add("product"),e==="*"&&i.some(a=>a.type==="param"&&a.name==="*")&&n.add("category"),n}const hZ=["rosa","preto","pink","black"];function eh(t,e){const s=e.trim();return s?t(s):hZ.flatMap(n=>t(n))}function fZ(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 Yw=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function T3(t){return t.split("/")[0]??""}function mZ(t){const e=new Set;for(const s of t){const n=T3(s);Yw.has(n)&&e.add(n)}return e}function pZ(t,e){const s=T3(t);return!Yw.has(s)||e.size===0?!0:e.has(s)}const gZ=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>eh(s=>fZ(t,s),e),optionsFromPayload:th},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>eh(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:th},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>eh(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:th},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>eh(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:th},{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:wZ}];function xZ(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of gZ){if(d.kind!==a)continue;const u=n.find(h=>d.test(h)&&pZ(h,s));u&&c.push({cand:d,resolveType:u})}return c.find(d=>s.has(T3(d.resolveType)))??c[0]},r=(a,c,d)=>({kind:a.kind,id:`${a.kind}:${c}`,resolveType:c,clientFilter:a.clientFilter,isFallback:d,buildRequests:u=>a.buildRequests(c,u),optionsFromPayload:a.optionsFromPayload}),l=[];for(const a of["product","category"]){if(!t.has(a))continue;const c=i(a);c&&l.push(r(c.cand,c.resolveType,!1))}return t.size>0&&l.push(bZ(t.has("category")?"category":"product")),l}function bZ(t){return{kind:t,id:nb,resolveType:nb,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>NZ(e,s)}}function wl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function vZ(t,e,s){const n=new Set,i=new Set,r=l=>{if(Array.isArray(l)){for(const d of l)r(d);return}const a=wl(l);if(!a)return;const c=a.__resolveType;if(typeof c=="string"){if(s(c))n.add(c);else if(c in e&&!i.has(c)){i.add(c);const d=wl(e[c])?.__resolveType;typeof d=="string"&&s(d)&&n.add(c),r(e[c])}}for(const d of Object.values(a))r(d)};return r(t),n}function Jw(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 Qw(t){try{return decodeURIComponent(t)}catch{return t}}function yZ(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _Z(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=yZ(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function Xw(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=rf(Fo(e)),{pattern:r,order:l}=_Z(i),a=l.indexOf(s);if(a===-1)return null;const c=n.match(r);if(!c)return null;const d=c[a+1]?.replace(/^\/+|\/+$/g,"");return d?Qw(d):null}function th(t,e){const s=wl(t),n=Array.isArray(t)?t:Array.isArray(s?.products)?s.products:Array.isArray(s?.list)?s.list:[],i=[],r=new Set;for(const l of n){const a=wl(l);if(!a)continue;const c=Xw(a.url,e.template,e.paramName);if(!c||r.has(c))continue;r.add(c);const d=wl(a.isVariantOf),u=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,h=Array.isArray(a.image)?wl(a.image[0]):null,f=typeof h?.url=="string"?h.url:void 0;i.push({value:c,label:u,image:f})}return i}function LZ(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?Qw(s):null}function wZ(t){const e=[],s=new Set,n=(i,r)=>{const l=wl(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...r,a]:r,d=LZ(l.url);if(d&&!s.has(d)&&(s.add(d),e.push({value:d,label:c.join(" › ")||d})),Array.isArray(l.children))for(const u of l.children)n(u,c)};if(Array.isArray(t))for(const i of t)n(i,[]);return e}const SZ=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 kZ(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function jZ(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]??"",l=(n[2]??"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();e.push({href:r,text:l})}return e}function CZ(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,l=0;for(;(r=n.exec(t))!==null&&l++<3e3;){const a=(r[1]??"").replace(/\\\//g,"/");if(!a||s.has(a))continue;s.add(a);const c=t.slice(r.index,r.index+900).match(i)?.[1]?.replace(/\\\//g,"/");e.push({url:a,name:r[2]??"",image:c||void 0})}return e}function NZ(t,e){const s=[],n=new Set,i=(r,l,a,c)=>{if(s.length>=200)return;const d=Xw(r,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&SZ.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:kZ(d),kind:a,image:c}))};for(const{url:r,name:l,image:a}of CZ(t))i(r,l,"product",a);for(const{href:r,text:l}of jZ(t))r.startsWith("/")&&!r.startsWith("//")&&i(r,l,"category");return s}function wd(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 Zw=1e4;function VZ(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 TZ(t,{resolveType:e,props:s}){const n=await fetch(hw(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Zw)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function ib(t,e){const s=await fetch(uw(t,e),{signal:AbortSignal.timeout(Zw)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function AZ(t,e,s){const n=e.optionsFromPayload(await ib(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const r=Or(s.template,{[s.paramName]:i.value});if(r==="/")return n;try{const l=e.optionsFromPayload(await ib(t,r),s).filter(a=>a.kind==="product");return Jw([n,l])}catch{return n}}function PZ(t,e,s){return tt.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function EZ(t,e,s,n){if(e.homepageLinks)return AZ(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const r=await Promise.allSettled(i.map(a=>TZ(t,a))),l=r.filter(a=>a.status==="fulfilled").map(a=>a.value);if(l.length===0){const a=r.find(c=>c.status==="rejected");throw a?a.reason:new Error("Failed to fetch options")}return Jw(l.map(a=>e.optionsFromPayload(a,n)))}function ap(t,e,s,n,i){return{queryKey:PZ(t,e,s),queryFn:()=>EZ(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function Sd(t){const e=F.c(16),{heading:s,iconKind:n,options:i,template:r,paramName:l,keyPrefix:a,onSelect:c}=t;if(i.length===0)return null;let d;if(e[0]!==n||e[1]!==a||e[2]!==c||e[3]!==i||e[4]!==l||e[5]!==r){let h;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r?(h=f=>o.jsxs(ls,{value:`${a}:${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(P2,{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:Or(r,{[l]:f.value})})]})]},`${a}:${f.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=h):h=e[12],d=i.map(h),e[0]=n,e[1]=a,e[2]=c,e[3]=i,e[4]=l,e[5]=r,e[6]=d}else d=e[6];let u;return e[13]!==s||e[14]!==d?(u=o.jsx(Ps,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=u):u=e[15],u}function rb(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 RZ(t){const e=F.c(52),{sources:s,template:n,paramName:i,value:r,sandboxRef:l,onCommit:a}=t,c=le(),[d,u]=A.useState(!1),[h,f]=A.useState(""),[m,p]=A.useState(""),g=A.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=VZ(c),_=[...new Set(s.map(Ce=>b[Ce.kind].noun))].join(" or ");let y;e[0]!==c||e[1]!==_?(y=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:_}),e[0]=c,e[1]=_,e[2]=y):y=e[2];const L=y,w={template:n,paramName:i};let S;e[3]!==h?(S=(Ce,Ae)=>({source:Ce,query:Ae,options:Ce.clientFilter?wd(Ae.data??[],h):Ae.data??[]}),e[3]=h,e[4]=S):S=e[4];const k=S,j=s.filter(FZ),C=s.filter(zZ),T=wm({queries:j.map(Ce=>ap(l,Ce,m,w,d))});let N;e[5]!==T||e[6]!==k?(N=(Ce,Ae)=>k(Ce,T[Ae]),e[5]=T,e[6]=k,e[7]=N):N=e[7];const P=j.map(N),V=P.length===0||P.every(BZ),E=wm({queries:C.map(Ce=>ap(l,Ce,m,w,d&&V))});let R;e[8]!==E||e[9]!==k?(R=(Ce,Ae)=>k(Ce,E[Ae]),e[8]=E,e[9]=k,e[10]=R):R=e[10];const I=C.map(R),D=V?I:P,O=D.length===1&&D[0]?.source.homepageLinks?D[0]:null,M=O&&!O.query.isLoading&&!O.query.isError?O?.query.data??[]:[],z=wd(M.filter($Z),h),B=wd(M.filter(OZ),h),U=z.length>0&&B.length>0,H=Ce=>{u(Ce),g.current&&clearTimeout(g.current),f(Ce?r:""),p(Ce?r:"")};let W;e[11]===Symbol.for("react.memo_cache_sentinel")?(W=Ce=>{f(Ce),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{p(Ce)},300)},e[11]=W):W=e[11];const K=W,Q=Ce=>{a(Ce),H(!1)},X=vw(h),se=Or(n,{[i]:X}),ne=zt,te=Bt,ee="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",Y=MZ;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(ds,{className:"sr-only",children:o.jsx(qt,{children:q})}),e[15]=q,e[16]=oe):oe=e[16];let J;e[17]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(P2,{size:16,className:"shrink-0 text-foreground"}),e[17]=J):J=e[17];let ie;e[18]!==c?(ie=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=ie):ie=e[19];let Z;e[20]!==x?(Z=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]=Z):Z=e[21];let he;e[22]!==ie||e[23]!==Z?(he=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[J,o.jsxs("span",{className:"text-sm font-medium text-foreground",children:[ie," ",Z]})]}),e[22]=ie,e[23]=Z,e[24]=he):he=e[24];const de=Ii,ae=!1,ce="min-h-0 flex-1";let ue;e[25]!==L||e[26]!==h?(ue=o.jsx(di,{autoFocus:!0,placeholder:L,value:h,onValueChange:K}),e[25]=L,e[26]=h,e[27]=ue):ue=e[27];const G=ui,me="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let ye;e[28]!==c?(ye=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=ye):ye=e[29];let we;e[30]!==ye?(we=o.jsx($n,{children:ye}),e[30]=ye,e[31]=we):we=e[31];const Ne=X&&o.jsx(Ps,{className:"shrink-0",children:o.jsxs(ls,{value:`__raw__:${X}`,className:"gap-3 py-2",onSelect:()=>Q(X),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:X,paramLabel:x})}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:se})]})]})}),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(Sd,{heading:b.category.heading,iconKind:"category",options:z,template:n,paramName:i,keyPrefix:`${O?.source.id}:cat`,onSelect:Q})}),o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:o.jsx(Sd,{heading:b.product.heading,iconKind:"product",options:B,template:n,paramName:i,keyPrefix:`${O?.source.id}:prod`,onSelect:Q})})]}):o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:D.map(Ce=>{const{source:Ae,query:st,options:Be}=Ce,{noun:Ie}=b[Ae.kind];if(st.isLoading)return o.jsx(rb,{text:c("sandbox.pathParamPickerChip.loading",{noun:Ie})},Ae.id);if(st.isError)return o.jsx(rb,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},Ae.id);if(Ae.homepageLinks){const Oe=st.data??[];return o.jsxs(A.Fragment,{children:[o.jsx(Sd,{heading:b.category.heading,iconKind:"category",options:wd(Oe.filter(IZ),h),template:n,paramName:i,keyPrefix:`${Ae.id}:cat`,onSelect:Q}),o.jsx(Sd,{heading:b.product.heading,iconKind:"product",options:wd(Oe.filter(DZ),h),template:n,paramName:i,keyPrefix:`${Ae.id}:prod`,onSelect:Q})]},Ae.id)}return o.jsx(Sd,{heading:D.length>1?b[Ae.kind].heading:void 0,iconKind:Ae.kind,options:Be,template:n,paramName:i,keyPrefix:Ae.id,onSelect:Q},Ae.id)})});let _e;e[32]!==G||e[33]!==we||e[34]!==Ne||e[35]!==je?(_e=o.jsxs(G,{className:me,children:[we,Ne,je]}),e[32]=G,e[33]=we,e[34]=Ne,e[35]=je,e[36]=_e):_e=e[36];let Ve;e[37]!==de||e[38]!==ue||e[39]!==_e?(Ve=o.jsxs(de,{shouldFilter:ae,className:ce,children:[ue,_e]}),e[37]=de,e[38]=ue,e[39]=_e,e[40]=Ve):Ve=e[40];let xe;e[41]!==te||e[42]!==oe||e[43]!==he||e[44]!==Ve||e[45]!==Y?(xe=o.jsxs(te,{className:ee,onClick:Y,children:[oe,he,Ve]}),e[41]=te,e[42]=oe,e[43]=he,e[44]=Ve,e[45]=Y,e[46]=xe):xe=e[46];let Se;return e[47]!==ne||e[48]!==H||e[49]!==d||e[50]!==xe?(Se=o.jsx(ne,{open:d,onOpenChange:H,children:xe}),e[47]=ne,e[48]=H,e[49]=d,e[50]=xe,e[51]=Se):Se=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:Ce=>{Ce.stopPropagation(),H(!0)},children:r||x}),Se]})}function DZ(t){return t.kind==="product"}function IZ(t){return t.kind!=="product"}function MZ(t){return t.stopPropagation()}function OZ(t){return t.kind==="product"}function $Z(t){return t.kind!=="product"}function BZ(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function zZ(t){return t.isFallback}function FZ(t){return!t.isFallback}function UZ(t){const e=F.c(8),{sources:s,template:n,paramName:i,sandboxRef:r,onFill:l}=t;let a,c;if(e[0]!==i||e[1]!==r||e[2]!==s||e[3]!==n){const m={template:n,paramName:i},p=s.filter(HZ);c=wm,a=p.map(g=>ap(r,g,"",m,!0)),e[0]=i,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=c}else a=e[4],c=e[5];let d;e[6]!==a?(d={queries:a},e[6]=a,e[7]=d):d=e[7];const u=c(d),[h,f]=A.useState(!1);if(!h)for(const m of u){if(m.isLoading)break;const p=m.data?.[0];if(p){f(!0),queueMicrotask(()=>l(p.value));break}}return null}function HZ(t){return!t.isFallback}function KZ(t){const e=F.c(31),{name:s,value:n,onCommit:i}=t,r=le(),[l,a]=A.useState(n),[c,d]=A.useState(!1),u=A.useRef(!1);let h;e[0]!==s||e[1]!==r?(h=s==="*"?r("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=r,e[2]=h):h=e[2];const f=h,m=l||f;let p;e[3]!==m?(p=o.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:m}),e[3]=m,e[4]=p):p=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=>a(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"&&(u.current=!0,a(n),k.currentTarget.blur())},e[10]=n,e[11]=v):v=e[11];let _;e[12]!==l||e[13]!==i||e[14]!==n?(_=()=>{if(d(!1),u.current){u.current=!1;return}const k=vw(l);a(k),k!==n&&i(k)},e[12]=l,e[13]=i,e[14]=n,e[15]=_):_=e[15];let y;e[16]!==l||e[17]!==f||e[18]!==g||e[19]!==v||e[20]!==_?(y=o.jsx("input",{type:"text",value:l,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:WZ,onChange:x,onFocus:b,onKeyDown:v,onBlur:_}),e[16]=l,e[17]=f,e[18]=g,e[19]=v,e[20]=_,e[21]=y):y=e[21];let L;e[22]!==p||e[23]!==y?(L=o.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[p,y]}),e[22]=p,e[23]=y,e[24]=L):L=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(ZV,{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]!==L?(S=o.jsxs(o.Fragment,{children:[L,w]}),e[28]=w,e[29]=L,e[30]=S):S=e[30],S}function WZ(t){return t.stopPropagation()}function qZ(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 ob(t){if(!t.showPreviewToolbar)return!1;const e=t.blocksState;switch(e.kind){case"loading":return!1;case"empty":return e.reason!=="framework-missing";case"content":case"error":return!0}}const lb={resolveType:"website/pages/Page.tsx",seoResolveType:"website/sections/Seo/SeoV2.tsx"};function A3(t){return`pages-${encodeURIComponent(t)}-${crypto.randomUUID()}`}function eS(t,e){return{name:t,path:e,sections:[],seo:{__resolveType:lb.seoResolveType},__resolveType:lb.resolveType}}const GZ=700;function x0({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ns(),i=hs()?.taskId??null,r=g0(e),l=yn(e).runtime==="cms";return Es({mutationKey:bg(t,e,s),mutationFn:async({blockKey:a,data:c})=>{if(l){const f=await S7({orgSlug:t,virtualMcpId:e,branch:s},{set:{[a]:c}});return yg(n,{orgSlug:t,virtualMcpId:e,branch:s},f),await n.invalidateQueries({queryKey:m0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),f}const d=p0(r,X2(a)),u=JSON.stringify(c,null,2),h=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/write`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:d,content:u})});return h.ok?h.json():h9(h,"Write")},onMutate:async({blockKey:a,data:c})=>{const d=`${t}/${e}/${s}`,u=tt.decofile(d);await n.cancelQueries({queryKey:u});const h=n.getQueryData(u),f=!!h&&a in h,m=h?.[a];return n.setQueryData(u,p=>({...p??{},[a]:c})),{queryKey:u,blockKey:a,hadKey:f,previousValue:m}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>{if(!u)return u;if(!d.hadKey){const{[d.blockKey]:h,...f}=u;return f}return{...u,[d.blockKey]:d.previousValue}})},onSuccess:(a,{blockKey:c,data:d})=>{const u=`${t}/${e}/${s}`;n.setQueryData(tt.decofile(u),h=>({...h??{},[c]:d}))}})}function P3(t,e){const s=F.c(16),n=x0(t),i=le();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r=new Map,s[0]=r):r=s[0];const l=A.useRef(r);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a=new Map,s[1]=a):a=s[1];const c=A.useRef(a);let d;s[2]!==e||s[3]!==n||s[4]!==i?(d=v=>{const _=l.current.get(v);if(!_)return;const y=typeof _=="function"?_():_;l.current.delete(v),y&&n.mutate({blockKey:v,data:y},{onSuccess:()=>e?.onSaved?.(),onError:L=>ve.error(i("sectionsEditor.sectionsEditor.saveFailed",{error:L.message}))})},s[2]=e,s[3]=n,s[4]=i,s[5]=d):d=s[5];const u=d;let h;s[6]!==u?(h=()=>{for(const v of c.current.values())clearTimeout(v);c.current.clear();for(const v of[...l.current.keys()])u(v)},s[6]=u,s[7]=h):h=s[7];const f=h;let m,p;s[8]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{const v=c.current;return()=>{for(const _ of v.values())clearTimeout(_)}},p=[],s[8]=m,s[9]=p):(m=s[8],p=s[9]),A.useEffect(m,p);let g;s[10]!==u?(g=(v,_)=>{l.current.set(v,_);const y=c.current.get(v);y&&clearTimeout(y),c.current.set(v,setTimeout(()=>{c.current.delete(v),u(v)},GZ))},s[10]=u,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 YZ(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=x0(s);let i;return e[2]!==t||e[3]!==n?(i={mutationFn:async r=>{const{name:l,path:a,template:c}=r;if(!t?.virtualMcpId||!t.branch)throw new Error("Sandbox not ready");const d=A3(l),u=c?{...c,name:l,path:a}:eS(l,a);return await n.mutateAsync({blockKey:d,data:u}),{key:d,name:l,path:a}}},e[2]=t,e[3]=n,e[4]=i):i=e[4],Es(i)}const Uo="__blank__";function tS(t){const e=F.c(65),{id:s,value:n,onChange:i,templates:r,disabled:l}=t,a=le(),[c,d]=A.useState(!1);let u;if(e[0]!==r||e[1]!==n){let O;e[3]!==n?(O=$=>$.key===n,e[3]=n,e[4]=O):O=e[4],u=r.find(O),e[0]=r,e[1]=n,e[2]=u}else u=e[2];const h=u;let f;e[5]!==h?.name||e[6]!==a?(f=h?.name??a("sectionsEditor.pageTemplateSelect.blankPageDefaultLabel"),e[5]=h?.name,e[6]=a,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("span",{className:"truncate",children:f}),e[8]=f,e[9]=m):m=e[9];let p;e[10]!==h?(p=h?.path?o.jsx("span",{className:"truncate text-muted-foreground",children:h.path}):null,e[10]=h,e[11]=p):p=e[11];let g;e[12]!==m||e[13]!==p?(g=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m,p]}),e[12]=m,e[13]=p,e[14]=g):g=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(i9,{className:"shrink-0 opacity-50"}),e[15]=x):x=e[15];let b;e[16]!==l||e[17]!==s||e[18]!==c||e[19]!==g?(b=o.jsx(os,{asChild:!0,children:o.jsxs(fe,{id:s,type:"button",variant:"outline",role:"combobox","aria-expanded":c,disabled:l,className:"w-full justify-between font-normal",children:[g,x]})}),e[16]=l,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 _;e[22]!==a?(_=a("sectionsEditor.pageTemplateSelect.searchPlaceholder"),e[22]=a,e[23]=_):_=e[23];let y;e[24]!==_?(y=o.jsx(di,{placeholder:_,className:"h-9"}),e[24]=_,e[25]=y):y=e[25];let L;e[26]!==a?(L=a("sectionsEditor.pageTemplateSelect.noPagesFoundMessage"),e[26]=a,e[27]=L):L=e[27];let w;e[28]!==L?(w=o.jsx($n,{children:L}),e[28]=L,e[29]=w):w=e[29];let S;e[30]!==a?(S=a("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[30]=a,e[31]=S):S=e[31];let k;e[32]!==i?(k=()=>{i(Uo),d(!1)},e[32]=i,e[33]=k):k=e[33];let j;e[34]!==a?(j=a("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[34]=a,e[35]=j):j=e[35];const C=n===Uo?"opacity-100":"opacity-0";let T;e[36]!==C?(T=re("ml-auto",C),e[36]=C,e[37]=T):T=e[37];let N;e[38]!==T?(N=o.jsx($t,{className:T}),e[38]=T,e[39]=N):N=e[39];let P;e[40]!==S||e[41]!==k||e[42]!==j||e[43]!==N?(P=o.jsxs(ls,{value:S,onSelect:k,children:[j,N]}),e[40]=S,e[41]=k,e[42]=j,e[43]=N,e[44]=P):P=e[44];let V;if(e[45]!==i||e[46]!==r||e[47]!==n){let O;e[49]!==i||e[50]!==n?(O=$=>o.jsxs(ls,{value:`${$.name} ${$.path}`,onSelect:()=>{i($.key),d(!1)},children:[o.jsxs("div",{className:"flex min-w-0 flex-col",children:[o.jsx("span",{className:"truncate",children:$.name}),o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:$.path})]}),o.jsx($t,{className:re("ml-auto",n===$.key?"opacity-100":"opacity-0")})]},$.key),e[49]=i,e[50]=n,e[51]=O):O=e[51],V=r.map(O),e[45]=i,e[46]=r,e[47]=n,e[48]=V}else V=e[48];let E;e[52]!==P||e[53]!==V?(E=o.jsxs(Ps,{children:[P,V]}),e[52]=P,e[53]=V,e[54]=E):E=e[54];let R;e[55]!==w||e[56]!==E?(R=o.jsxs(ui,{onWheel:JZ,children:[w,E]}),e[55]=w,e[56]=E,e[57]=R):R=e[57];let I;e[58]!==y||e[59]!==R?(I=o.jsx(as,{className:"p-0",style:v,children:o.jsxs(Ii,{children:[y,R]})}),e[58]=y,e[59]=R,e[60]=I):I=e[60];let D;return e[61]!==c||e[62]!==I||e[63]!==b?(D=o.jsxs(cs,{open:c,onOpenChange:d,children:[b,I]}),e[61]=c,e[62]=I,e[63]=b,e[64]=D):D=e[64],D}function JZ(t){const e=t.deltaMode===1?16:1;t.currentTarget.scrollTop=t.currentTarget.scrollTop+t.deltaY*e}function QZ(t){const e=F.c(89),{open:s,onOpenChange:n,isPending:i,error:r,templates:l,onSubmit:a}=t,c=i===void 0?!1:i,d=le();let u;e[0]!==d?(u=d("sectionsEditor.createPageModal.defaultPageName"),e[0]=d,e[1]=u):u=e[1];const[h,f]=A.useState(u);let m;e[2]!==d?(m=d("sectionsEditor.createPageModal.defaultPagePath"),e[2]=d,e[3]=m):m=e[3];const[p,g]=A.useState(m),[x,b]=A.useState(Uo),[v,_]=A.useState(null),[y,L]=A.useState(s);s!==y&&(L(s),s&&(f(d("sectionsEditor.createPageModal.defaultPageName")),g(d("sectionsEditor.createPageModal.defaultPagePath")),b(Uo),_(null)));const w=!!l?.length;let S;e[4]!==c||e[5]!==n?(S=ie=>{!ie&&!c&&(_(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]!==h||e[9]!==a||e[10]!==p||e[11]!==w||e[12]!==x?(j=async ie=>{ie.preventDefault();const Z=h.trim(),he=p.trim();if(!Z||!he||c)return;const de=N9(he);if(de){_(de);return}_(null),await a({name:Z,path:he,templateKey:w&&x!==Uo?x:null})},e[7]=c,e[8]=h,e[9]=a,e[10]=p,e[11]=w,e[12]=x,e[13]=j):j=e[13];const C=j,T=v??r;let N;e[14]!==d?(N=d("sectionsEditor.createPageModal.title"),e[14]=d,e[15]=N):N=e[15];let P;e[16]!==N?(P=o.jsx(ds,{children:o.jsx(qt,{children:N})}),e[16]=N,e[17]=P):P=e[17];let V;e[18]!==d?(V=d("sectionsEditor.createPageModal.nameLabel"),e[18]=d,e[19]=V):V=e[19];let E;e[20]!==V?(E=o.jsx("label",{htmlFor:"new-page-name",className:"text-xs font-medium text-muted-foreground",children:V}),e[20]=V,e[21]=E):E=e[21];let R;e[22]===Symbol.for("react.memo_cache_sentinel")?(R=ie=>f(ie.target.value),e[22]=R):R=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]!==h||e[27]!==I?(D=o.jsx(vt,{id:"new-page-name",value:h,onChange:R,placeholder:I,autoFocus:!0,disabled:c}),e[25]=c,e[26]=h,e[27]=I,e[28]=D):D=e[28];let O;e[29]!==D||e[30]!==E?(O=o.jsxs("div",{className:"space-y-1.5",children:[E,D]}),e[29]=D,e[30]=E,e[31]=O):O=e[31];let $;e[32]!==d?($=d("sectionsEditor.createPageModal.pathLabel"),e[32]=d,e[33]=$):$=e[33];let M;e[34]!==$?(M=o.jsx("label",{htmlFor:"new-page-path",className:"text-xs font-medium text-muted-foreground",children:$}),e[34]=$,e[35]=M):M=e[35];let z;e[36]===Symbol.for("react.memo_cache_sentinel")?(z=ie=>g(ie.target.value),e[36]=z):z=e[36];let B;e[37]!==d?(B=d("sectionsEditor.createPageModal.pathPlaceholder"),e[37]=d,e[38]=B):B=e[38];let U;e[39]!==c||e[40]!==p||e[41]!==B?(U=o.jsx(vt,{id:"new-page-path",value:p,onChange:z,placeholder:B,disabled:c}),e[39]=c,e[40]=p,e[41]=B,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]!==l?(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(tS,{id:"new-page-template",value:x,onChange:b,templates:l??[],disabled:c})]}),e[46]=c,e[47]=w,e[48]=d,e[49]=x,e[50]=l,e[51]=W):W=e[51];let K;e[52]!==T?(K=T&&o.jsx("p",{className:"text-xs text-destructive",children:T}),e[52]=T,e[53]=K):K=e[53];let Q;e[54]!==O||e[55]!==H||e[56]!==W||e[57]!==K?(Q=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]=Q):Q=e[58];let X;e[59]!==n?(X=()=>n(!1),e[59]=n,e[60]=X):X=e[60];let se;e[61]!==d?(se=d("sectionsEditor.createPageModal.cancelButton"),e[61]=d,e[62]=se):se=e[62];let ne;e[63]!==c||e[64]!==X||e[65]!==se?(ne=o.jsx(fe,{type:"button",variant:"outline",onClick:X,disabled:c,children:se}),e[63]=c,e[64]=X,e[65]=se,e[66]=ne):ne=e[66];let te;e[67]!==c||e[68]!==h||e[69]!==p?(te=!h.trim()||!p.trim()||c,e[67]=c,e[68]=h,e[69]=p,e[70]=te):te=e[70];let ee;e[71]!==c||e[72]!==d?(ee=c?o.jsxs(o.Fragment,{children:[o.jsx(it,{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 Y;e[74]!==te||e[75]!==ee?(Y=o.jsx(fe,{type:"submit",disabled:te,children:ee}),e[74]=te,e[75]=ee,e[76]=Y):Y=e[76];let q;e[77]!==ne||e[78]!==Y?(q=o.jsxs(Gn,{children:[ne,Y]}),e[77]=ne,e[78]=Y,e[79]=q):q=e[79];let oe;e[80]!==C||e[81]!==Q||e[82]!==q||e[83]!==P?(oe=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:C,children:[P,Q,q]})}),e[80]=C,e[81]=Q,e[82]=q,e[83]=P,e[84]=oe):oe=e[84];let J;return e[85]!==k||e[86]!==s||e[87]!==oe?(J=o.jsx(zt,{open:s,onOpenChange:k,children:oe}),e[85]=k,e[86]=s,e[87]=oe,e[88]=J):J=e[88],J}const XZ={loaders:"loader",actions:"action"},sS=new Set(["workflows"]);function nS(t){return XZ[t]}function iS(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 ZZ(t,e,s){return/\.tsx?$/.test(e)?!0:iS(t,e,s)}function eee(t,e){const s=new Set,n=t.manifest?.blocks??{};for(const[i,r]of Object.entries(n))if(i.includes(e))for(const l of Object.keys(r))s.add(l);return s}function tee(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function rS(t,e){const s=t.manifest?.blocks??{},n=[],i=new Set;for(const[r,l]of Object.entries(s))if(r.includes(e))for(const a of Object.keys(l))i.add(a);for(const r of i){if(r.toLowerCase().includes("preview")||jw.has(r)||sS.has(E3(r))||tee(r,i))continue;const l=ll(r,t);if(l.hidden)continue;const a=l.title&&l.title!==r?l.title:gs(r);n.push({resolveType:r,title:a})}return n.sort((r,l)=>r.title.localeCompare(l.title))}function ab(t,e){return rS(t,e).length}function E3(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const see={deco:"Deco",std:"Deco Standard",website:"Website"};function nee(t){return see[t]??t}function oS(t){const e=E3(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 lS(t,e,s){const n=[];for(const[i,r]of Object.entries(e)){if(ZZ(t,i,s)||C9(i)||!r||typeof r!="object"||Array.isArray(r))continue;const l=r,a=l.__resolveType;typeof a=="string"&&(jw.has(a)||sS.has(E3(a))||iS(t,a,s)&&n.push({key:i,resolveType:a,title:typeof l.name=="string"&&l.name?l.name:i}))}return n.sort((i,r)=>i.title.localeCompare(r.title))}function aS(t,e){const s=t[e],n=typeof s?.__resolveType=="string"?s.__resolveType:"",{__resolveType:i,...r}=s??{},l=typeof s?.name=="string"&&s.name?s.name:e;return{resolveType:n,props:r,title:l}}function cS(t){const e=F.c(14),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,enabled:l}=t,a=l===void 0?!0:l;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=so({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},"config"),m=await fetch(f);return m.ok?(await m.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=r,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==a||e[11]!==c||e[12]!==d?(u={queryKey:c,queryFn:d,enabled:a,staleTime:1/0},e[10]=a,e[11]=c,e[12]=d,e[13]=u):u=e[13],Mt(u).data??null}const iee={target:null,editSeoPageKey:null,variantOverride:null};function ree(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 dS=A.createContext(null);function cb(t){const e=F.c(9),{children:s}=t,[n,i]=A.useReducer(ree,iee);let r,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=h=>i({type:"select",target:h}),l=h=>i({type:"edit-seo",target:h}),a=()=>i({type:"consume-edit-seo"}),c=h=>i({type:"variant-override",params:h}),e[0]=r,e[1]=l,e[2]=a,e[3]=c):(r=e[0],l=e[1],a=e[2],c=e[3]);let d;e[4]!==n?(d={state:n,selectTarget:r,editSeo:l,consumeEditSeo:a,setVariantOverride:c},e[4]=n,e[5]=d):d=e[5];let u;return e[6]!==s||e[7]!==d?(u=o.jsx(dS,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=u):u=e[8],u}function uS(){const t=A.use(dS);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}const hS=A.createContext(!1),oee=hS.Provider;function P9(){return A.useContext(hS)}const fS=A.createContext(null),lee=fS.Provider;function aee(){return A.useContext(fS)}function mS(t){const e=F.c(9),{readOnly:s,virtualMcpId:n,className:i,children:r}=t;let l;e[0]!==r||e[1]!==s?(l=o.jsx(oee,{value:s,children:r}),e[0]=r,e[1]=s,e[2]=l):l=e[2];let a;e[3]!==l||e[4]!==n?(a=o.jsx(lee,{value:n,children:l}),e[3]=l,e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==i||e[7]!==a?(c=o.jsx("div",{className:i,children:a}),e[6]=i,e[7]=a,e[8]=c):c=e[8],c}function cee(t){const e=F.c(8),{virtualMcpId:s}=t,n=le(),i=U8(s);let r;e[0]!==i?(r=()=>{i()},e[0]=i,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Gt,{size:14,className:"shrink-0"}),e[2]=l):l=e[2];let a;e[3]!==n?(a=n("thread.branchPicker.newVersion"),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==r||e[6]!==a?(c=o.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1.5 self-start rounded-md bg-background px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-background/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-foreground",children:[l,a]}),e[5]=r,e[6]=a,e[7]=c):c=e[7],c}function dee(){const t=F.c(9),e=le(),s=aee();let n;t[0]!==e?(n=e("sectionsEditor.readOnlyFieldTooltip"),t[0]=e,t[1]=n):n=t[1];let i;t[2]!==n?(i=o.jsx("p",{className:"text-xs text-balance",children:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]!==s?(r=s?o.jsx(cee,{virtualMcpId:s}):null,t[4]=s,t[5]=r):r=t[5];let l;return t[6]!==i||t[7]!==r?(l=o.jsxs(as,{align:"center",className:"flex w-fit max-w-[260px] flex-col gap-2.5 border-transparent bg-foreground p-3 text-background",children:[i,r]}),t[6]=i,t[7]=r,t[8]=l):l=t[8],l}function uee(t){const e=F.c(5),{children:s}=t;let n;e[0]!==s?(n=o.jsx(os,{asChild:!0,children:s}),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(dee,{}),e[2]=i):i=e[2];let r;return e[3]!==n?(r=o.jsxs(cs,{children:[n,i]}),e[3]=n,e[4]=r):r=e[4],r}function hee(t){const e=F.c(5),{children:s}=t;let n;e[0]!==s?(n=o.jsx("div",{inert:!0,children:s}),e[0]=s,e[1]=n):n=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"absolute inset-0 cursor-pointer"}),e[2]=i):i=e[2];let r;return e[3]!==n?(r=o.jsx(uee,{children:o.jsxs("div",{className:"relative opacity-70",children:[n,i]})}),e[3]=n,e[4]=r):r=e[4],r}function R3(t){return(e,s)=>{NA(e),t(e,s)}}const fee="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function E9(t){return vs(t)?.metadata?.fieldDescriptionTooltips??!1}function D3(t){const e=F.c(9),{description:s,virtualMcpId:n,children:i}=t,r=E9(n);if(!s||!r)return i;let l;e[0]!==i?(l=A.cloneElement(i,{className:re(i.props.className,fee)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx(Ke,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=o.jsx(We,{className:"max-w-64",children:s}),e[4]=s,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsxs(qe,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Fs(t){const e=F.c(17),{htmlFor:s,label:n,description:i,labelClassName:r,virtualMcpId:l}=t;if(!E9(l)){let u;e[0]!==s||e[1]!==n||e[2]!==r?(u=o.jsx(Dt,{htmlFor:s,className:r,children:n}),e[0]=s,e[1]=n,e[2]=r,e[3]=u):u=e[3];let h;e[4]!==i?(h=i&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[4]=i,e[5]=h):h=e[5];let f;return e[6]!==u||e[7]!==h?(f=o.jsxs("div",{className:"space-y-0.5",children:[u,h]}),e[6]=u,e[7]=h,e[8]=f):f=e[8],f}let c;e[9]!==s||e[10]!==n||e[11]!==r?(c=o.jsx(Dt,{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]!==l?(d=o.jsx(D3,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}const mee=ci.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 pee=mee;const gee=20,pS=(t,e=0)=>{const s=[];return!t.children.length||e>gee||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...pS(n,e+1))}),s},xee=t=>{if(!t.children.length)return;const e=pS(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}`)})},gS=sV.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&xee(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",dr(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}}}}),bee=ci.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=(e=Ou(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()}}}),xS=ci.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=(e=Ou(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()}}}),vee=ci.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=Ou(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()}}}),bS=ci.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=Ou(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()}}}),yee=ci.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=Ou(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()}}});ci.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(bee.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(xS.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(vee.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(bS.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(yee.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(gS.configure(this.options.textStyle)),t}});const _ee=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function Lee(t){const e=F.c(30),{editor:s,currentColor:n,open:i,onOpenChange:r}=t,l=le(),[a,c]=A.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 u=d;let h;e[3]!==s||e[4]!==r?(h=()=>{s.chain().focus().unsetColor().run(),r(!1)},e[3]=s,e[4]=r,e[5]=h):h=e[5];const f=h,m=i||n!==null;let p;e[6]!==l?(p=l("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=l,e[7]=p):p=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(km,{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 _;e[14]!==m||e[15]!==p||e[16]!==g||e[17]!==v?(_=o.jsx(Qt,{active:m,label:p,onClick:g,children:v}),e[14]=m,e[15]=p,e[16]=g,e[17]=v,e[18]=_):_=e[18];let y;e[19]!==u||e[20]!==f||e[21]!==n||e[22]!==a||e[23]!==r||e[24]!==i||e[25]!==l?(y=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:_ee.map(w=>o.jsx("button",{type:"button","aria-label":w,"aria-pressed":n===w,onMouseDown:kee,onClick:()=>u(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:a,onMouseDown:See,onChange:w=>c(w.target.value),onBlur:()=>u(a),className:"h-5 w-5 cursor-pointer rounded border-0 bg-transparent p-0"}),l("sectionsEditor.richTextColorControl.customLabel")]}),o.jsx("button",{type:"button",onMouseDown:wee,onClick:f,className:"rounded px-2 py-1 text-xs text-muted-foreground transition-colors cursor-pointer hover:bg-muted hover:text-foreground",children:l("sectionsEditor.richTextColorControl.defaultLabel")})]})]}),e[19]=u,e[20]=f,e[21]=n,e[22]=a,e[23]=r,e[24]=i,e[25]=l,e[26]=y):y=e[26];let L;return e[27]!==y||e[28]!==_?(L=o.jsxs("div",{className:"relative",children:[_,y]}),e[27]=y,e[28]=_,e[29]=L):L=e[29],L}function wee(t){return t.preventDefault()}function See(t){return t.stopPropagation()}function kee(t){return t.preventDefault()}const sh=[1,2,3,4,5,6];function jee(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 Cee=8,Nee=128,Vee=16,db=1;function Tee({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r,inline:l=!1}){const a=le(),c=typeof e=="string"?e:"",d=A.useRef(s);d.current=s;const[u,h]=A.useState(!1),[f,m]=A.useState(!1),p=Df({extensions:[If.configure({heading:l?!1:{levels:[...sh]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[pee.configure({types:["heading","paragraph"]})],gS,bS,xS],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:L})=>{const w=L.getHTML(),S=l?jee(w):w;d.current(S==="<p></p>"||S===""?"":S)}}),g=Zy({editor:p,selector:({editor:L})=>({bold:L?.isActive("bold")??!1,italic:L?.isActive("italic")??!1,underline:L?.isActive("underline")??!1,strike:L?.isActive("strike")??!1,headingLevel:sh.find(w=>L?.isActive("heading",{level:w})??!1)??0,fontSize:L?.getAttributes("textStyle").fontSize??null,color:L?.getAttributes("textStyle").color??null,bulletList:L?.isActive("bulletList")??!1,orderedList:L?.isActive("orderedList")??!1,link:L?.isActive("link")??!1,alignLeft:L?.isActive({textAlign:"left"})??!1,alignCenter:L?.isActive({textAlign:"center"})??!1,alignRight:L?.isActive({textAlign:"right"})??!1,alignJustify:L?.isActive({textAlign:"justify"})??!1})});if(!p)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=L=>{const w=p.chain().focus();if(L==="paragraph"){w.setParagraph().run();return}const S=sh.find(k=>`h${k}`===L);S&&w.setHeading({level:S}).run()},v=g.fontSize?parseInt(g.fontSize,10):NaN,_=Number.isFinite(v)?v:Vee,y=L=>{const w=Math.min(Nee,Math.max(Cee,L));p.chain().focus().setFontSize(`${w}px`).run()};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(Fs,{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(Qt,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>p.chain().focus().toggleBold().run(),children:o.jsx(k6,{size:14})}),o.jsx(Qt,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>p.chain().focus().toggleItalic().run(),children:o.jsx(j6,{size:14})}),o.jsx(Qt,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>p.chain().focus().toggleUnderline().run(),children:o.jsx(eT,{size:14})}),o.jsx(Qt,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>p.chain().focus().toggleStrike().run(),children:o.jsx(C6,{size:14})}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs(ws,{value:x,onValueChange:b,children:[o.jsx(Ss,{size:"sm","aria-label":a("sectionsEditor.richTextField.styleLabel"),onMouseDown:L=>L.preventDefault(),className:"w-[116px] gap-1 bg-transparent px-2 text-muted-foreground shadow-none! hover:bg-muted hover:text-foreground",children:o.jsx(Rs,{})}),o.jsxs(ks,{children:[o.jsx(It,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),sh.map(L=>o.jsx(It,{value:`h${L}`,children:a("sectionsEditor.richTextField.styleHeading",{level:L})},L))]})]})]}),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(Qt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>y(_-db),children:o.jsx(tT,{size:14})}),o.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:_}),o.jsx(Qt,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>y(_+db),children:o.jsx(Gt,{size:14})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Lee,{editor:p,currentColor:g.color,open:f,onOpenChange:m}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Qt,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>p.chain().focus().toggleBulletList().run(),children:o.jsx(z2,{size:14})}),o.jsx(Qt,{active:g.orderedList,label:a("sectionsEditor.richTextField.orderedList"),onClick:()=>p.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(vK,{editor:p,active:g.link,open:u,onOpenChange:h}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Qt,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>p.chain().focus().setTextAlign("left").run(),children:o.jsx(bP,{size:14})}),o.jsx(Qt,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>p.chain().focus().setTextAlign("center").run(),children:o.jsx(sT,{size:14})}),o.jsx(Qt,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>p.chain().focus().setTextAlign("right").run(),children:o.jsx(nT,{size:14})}),o.jsx(Qt,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>p.chain().focus().setTextAlign("justify").run(),children:o.jsx(iT,{size:14})})]})]}),o.jsx(Mf,{editor:p})]})]})}const _c=t=>String(t).padStart(2,"0"),Aee="1900-01-01",Pee="2099-12-31",Eee="1900-01-01T00:00",Ree="2099-12-31T23:59";function Dee(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()}-${_c(s.getUTCMonth()+1)}-${_c(s.getUTCDate())}`}function Iee(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function Mee(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${_c(e.getMonth()+1)}-${_c(e.getDate())}T${_c(e.getHours())}:${_c(e.getMinutes())}`}function Oee(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function $ee(t){const e=F.c(41),{id:s,withTime:n,value:i,onChange:r,calendarLabel:l}=t,[a,c]=A.useState(!1);let d;e[0]!==n?(d=O=>n?Mee(O):Dee(O),e[0]=n,e[1]=d):d=e[1];const u=d;let h;e[2]!==n?(h=O=>n?Oee(O):Iee(O),e[2]=n,e[3]=h):h=e[3];const f=h;let m;e[4]!==u||e[5]!==i?(m=()=>u(i),e[4]=u,e[5]=i,e[6]=m):m=e[6];const[p,g]=A.useState(m),[x,b]=A.useState(i);if(i!==x){b(i);const O=u(i);O!==p&&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 _=v;let y;if(e[10]!==i){const O=i?new Date(i):null;y=O&&!Number.isNaN(O.getTime())?O:null,e[10]=i,e[11]=y}else y=e[11];const L=y;let w;e[12]!==r||e[13]!==L||e[14]!==u||e[15]!==n?(w=O=>{if(!O)return;n&&L?O.setHours(L.getHours(),L.getMinutes(),0,0):O.setHours(0,0,0,0);const $=O.toISOString();g(u($)),b($),r($),c(!1)},e[12]=r,e[13]=L,e[14]=u,e[15]=n,e[16]=w):w=e[16];const S=w,k=n?"datetime-local":"date",j=n?Eee:Aee,C=n?Ree:Pee;let T;e[17]!==u||e[18]!==i?(T=()=>g(u(i)),e[17]=u,e[18]=i,e[19]=T):T=e[19];let N;e[20]!==_||e[21]!==s||e[22]!==p||e[23]!==T||e[24]!==k||e[25]!==j||e[26]!==C?(N=o.jsx(vt,{id:s,type:k,min:j,max:C,value:p,onChange:_,onBlur:T,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=_,e[21]=s,e[22]=p,e[23]=T,e[24]=k,e[25]=j,e[26]=C,e[27]=N):N=e[27];let P;e[28]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(Yc,{className:"h-4 w-4"}),e[28]=P):P=e[28];let V;e[29]!==l?(V=o.jsx(os,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:P})}),e[29]=l,e[30]=V):V=e[30];const E=L??void 0;let R;e[31]!==S||e[32]!==E?(R=o.jsx(as,{className:"w-auto p-0",align:"end",onCloseAutoFocus:Bee,children:o.jsx(Of,{mode:"single",selected:E,onSelect:S,initialFocus:!0})}),e[31]=S,e[32]=E,e[33]=R):R=e[33];let I;e[34]!==a||e[35]!==V||e[36]!==R?(I=o.jsxs(cs,{open:a,onOpenChange:c,children:[V,R]}),e[34]=a,e[35]=V,e[36]=R,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 Bee(t){return t.preventDefault()}function nh(t){const e=F.c(76),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=le(),d=typeof n=="string"?n:"",u=s.format;if(u==="rich-text"||u==="rich-text-inline"||u==="html"){const _=u==="rich-text-inline";let y;return e[0]!==l||e[1]!==i||e[2]!==r||e[3]!==a||e[4]!==s||e[5]!==_||e[6]!==n?(y=o.jsx(Tee,{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a,inline:_}),e[0]=l,e[1]=i,e[2]=r,e[3]=a,e[4]=s,e[5]=_,e[6]=n,e[7]=y):y=e[7],y}if(u==="textarea"||u==="markdown"){const _=a?.virtualMcpId;let y;e[8]!==l||e[9]!==r||e[10]!==s.description||e[11]!==_?(y=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[8]=l,e[9]=r,e[10]=s.description,e[11]=_,e[12]=y):y=e[12];let L;e[13]!==i?(L=k=>i(k.target.value),e[13]=i,e[14]=L):L=e[14];let w;e[15]!==r||e[16]!==d||e[17]!==L?(w=o.jsx(Jo,{id:r,value:d,onChange:L,rows:4}),e[15]=r,e[16]=d,e[17]=L,e[18]=w):w=e[18];let S;return e[19]!==y||e[20]!==w?(S=o.jsxs("div",{className:"space-y-2",children:[y,w]}),e[19]=y,e[20]=w,e[21]=S):S=e[21],S}const h=u==="date-time"||u==="datetime";if(u==="date"||h){const _=a?.virtualMcpId;let y;e[22]!==l||e[23]!==r||e[24]!==s.description||e[25]!==_?(y=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[22]=l,e[23]=r,e[24]=s.description,e[25]=_,e[26]=y):y=e[26];let L;e[27]!==c?(L=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=L):L=e[28];let w;e[29]!==h||e[30]!==i||e[31]!==r||e[32]!==d||e[33]!==L?(w=o.jsx($ee,{id:r,withTime:h,value:d,onChange:i,calendarLabel:L}),e[29]=h,e[30]=i,e[31]=r,e[32]=d,e[33]=L,e[34]=w):w=e[34];let S;return e[35]!==y||e[36]!==w?(S=o.jsxs("div",{className:"space-y-2",children:[y,w]}),e[35]=y,e[36]=w,e[37]=S):S=e[37],S}if(u==="color-input"||u==="color"){const _=a?.virtualMcpId;let y;e[38]!==l||e[39]!==r||e[40]!==s.description||e[41]!==_?(y=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[38]=l,e[39]=r,e[40]=s.description,e[41]=_,e[42]=y):y=e[42];const L=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]!==L||e[46]!==w?(S=o.jsx("input",{type:"color",value:L,onChange:w,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=L,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 T;return e[57]!==y||e[58]!==C?(T=o.jsxs("div",{className:"space-y-2",children:[y,C]}),e[57]=y,e[58]=C,e[59]=T):T=e[59],T}const f=a?.virtualMcpId;let m;e[60]!==l||e[61]!==r||e[62]!==s.description||e[63]!==f?(m=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:f}),e[60]=l,e[61]=r,e[62]=s.description,e[63]=f,e[64]=m):m=e[64];const p=u==="url"?"url":"text";let g;e[65]!==i?(g=_=>i(_.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]!==p||e[70]!==g||e[71]!==x?(b=o.jsx(vt,{id:r,type:p,value:d,onChange:g,placeholder:x,className:"h-10"}),e[67]=r,e[68]=d,e[69]=p,e[70]=g,e[71]=x,e[72]=b):b=e[72];let v;return e[73]!==m||e[74]!==b?(v=o.jsxs("div",{className:"space-y-2",children:[m,b]}),e[73]=m,e[74]=b,e[75]=v):v=e[75],v}const zee=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,Fee=/^[+-]?\d*$/;function Uee(t,e){return(e?Fee:zee).test(t)}function Hee(t){const e=F.c(16),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=typeof n=="number"?String(n):"",[d,u]=A.useState(c),[h,f]=A.useState(c);c!==h&&(f(c),d!==""&&c!==""&&Number(d)===Number(c)||u(c));const m=a?.virtualMcpId;let p;e[0]!==l||e[1]!==r||e[2]!==s.description||e[3]!==m?(p=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:m}),e[0]=l,e[1]=r,e[2]=s.description,e[3]=m,e[4]=p):p=e[4];const g=s.type==="integer"?"numeric":"decimal";let x;e[5]!==i||e[6]!==s.type?(x=_=>{const y=_.target.value,L=s.type==="integer";if(y!==""&&!Uee(y,L))return;u(y);const w=Number(y);i(y===""||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]!==p||e[14]!==b?(v=o.jsxs("div",{className:"space-y-2",children:[p,b]}),e[13]=p,e[14]=b,e[15]=v):v=e[15],v}function Kee(t){const e=F.c(14),{value:s,onChange:n,path:i,label:r,schema:l,sandbox:a}=t,c=typeof s=="boolean"?s:!1,d=a?.virtualMcpId;let u;e[0]!==r||e[1]!==i||e[2]!==l.description||e[3]!==d?(u=o.jsx(Fs,{htmlFor:i,label:r,description:l.description,virtualMcpId:d}),e[0]=r,e[1]=i,e[2]=l.description,e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=p=>n(p),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==c||e[8]!==i||e[9]!==h?(f=o.jsx(Ti,{id:i,checked:c,onCheckedChange:h}),e[7]=c,e[8]=i,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==u||e[12]!==f?(m=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u,f]}),e[11]=u,e[12]=f,e[13]=m):m=e[13],m}const I3="__enum_empty__",vS="__enum_clear__";function M3(t){return t===""?I3:String(t)}function Wee(t,e){if(t===I3)return"";const s=e.find(n=>M3(n)===t);return s!==void 0?s:t}function qee(t,e){if(t!==vS)return Wee(t,e)}function Gee(t,e){return t==null?e.some(s=>s==="")?I3:void 0:M3(t)}function Yee(t){return t===""?"":String(t)}function Jee(t){const e=F.c(39),{schema:s,value:n,onChange:i,path:r,label:l,required:a,sandbox:c}=t,d=le();let u;e[0]!==s.enum?(u=s.enum??[],e[0]=s.enum,e[1]=u):u=e[1];const h=u;let f;e[2]!==h||e[3]!==n?(f=Gee(n,h),e[2]=h,e[3]=n,e[4]=f):f=e[4];const m=f;let p;e[5]!==h||e[6]!==a?(p=!a&&!h.some(Xee),e[5]=h,e[6]=a,e[7]=p):p=e[7];const g=p,x=c?.virtualMcpId;let b;e[8]!==l||e[9]!==r||e[10]!==s.description||e[11]!==x?(b=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:x}),e[8]=l,e[9]=r,e[10]=s.description,e[11]=x,e[12]=b):b=e[12];let v;e[13]!==i||e[14]!==h?(v=T=>i(qee(T,h)),e[13]=i,e[14]=h,e[15]=v):v=e[15];let _;e[16]!==d?(_=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=_):_=e[17];let y;e[18]!==_?(y=o.jsx(Rs,{placeholder:_}),e[18]=_,e[19]=y):y=e[19];let L;e[20]!==r||e[21]!==y?(L=o.jsx(Ss,{id:r,className:"h-10 w-full min-w-0",children:y}),e[20]=r,e[21]=y,e[22]=L):L=e[22];let w;e[23]!==g||e[24]!==d?(w=g&&o.jsx(It,{value:vS,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]!==h?(S=h.map(Qee),e[26]=h,e[27]=S):S=e[27];let k;e[28]!==w||e[29]!==S?(k=o.jsxs(ks,{children:[w,S]}),e[28]=w,e[29]=S,e[30]=k):k=e[30];let j;e[31]!==m||e[32]!==k||e[33]!==v||e[34]!==L?(j=o.jsxs(ws,{value:m,onValueChange:v,children:[L,k]}),e[31]=m,e[32]=k,e[33]=v,e[34]=L,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 Qee(t){const e=M3(t);return o.jsx(It,{value:e,children:Yee(t)},e)}function Xee(t){return t===""}const yS={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function _S(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function nu(t){return _S(t)?.variants?.[0]?.rule?.__resolveType===ad}function ub(t){return{__resolveType:Zo,variants:[{value:t,rule:{__resolveType:ad}}]}}function LS(t){return nu(t)?_S(t)?.variants?.[0]?.value:t}function Lc(t){return nu(t)?LS(t):t}function O3(t){const e=t.__resolveType;if(typeof e!="string")return null;if(js(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function Zee(t){return t.includes("flags/multivariate")}function ete(t){return gs(t)}function tte(t){const e=t.title?sp(t.title)?.blockId:void 0;return e||(t.title&&!t.title.includes("/")?t.title:np(t.resolveType)??gs(t.resolveType))}function ste(t,e){const s=[...t],n=new Set(s.map(r=>r.resolveType)),i=(r,l)=>{!r||n.has(r)||(n.add(r),s.push({resolveType:r,title:l??ete(r)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const r=O3(e.editorValue);r?.includes("/")&&i(r)}return s}function nte(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(ri(r)){const h=e.find(f=>f.resolveType===r);return h?h.resolveType:r}const d=e.find(h=>G5(h.resolveType,r));if(d)return d.resolveType;const u=e.find(h=>h.resolveType===r);if(u)return u.resolveType;if(r.includes("/"))return r}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(u=>u.discriminatorValue===l||u.resolveType===l||G5(u.resolveType,l));if(d)return d.resolveType}let a=n,c=-1;for(const d of e){if(!d.schema?.properties)continue;const h=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>i[f]!==void 0).length;h>0&&h>c&&(c=h,a=d.resolveType)}return c>0,a}function hb(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=O3(t);if(!n)return s??null;if(!e)return n.includes("/")?null:s??null;const i=Bn(n,e);return i||(n.includes("/")?null:s??null)}function ite(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 wS(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!js(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function rte(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=O3(s);return n&&Zee(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function $3(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 ote=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),lte=5,ate=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function fb(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:ate.format(d)},l=r(n),a=r(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function zc(t,e=0){if(!t)return"Default";if(e>lte)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:l,devices:a=[]}=t,c=[...a];return i&&c.push("Mobile"),r&&c.push("Tablet"),l&&c.push("Desktop"),c.length>0?c.map(ote).join(" & "):gs(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return fb(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,l=[];return i&&l.push(i),r&&l.push(r),l.length>0?l.join(" - "):gs(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:r,pathname:l}=i??{};return r&&l?`Pathname ${r} ${l}`:gs(s)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:i,excludeLocations:r}=t,l=d=>[d.city,d.regionCode,d.country].filter(Boolean).join(" - "),a=i?.[0];if(a){const d=(i?.length??0)-1;return`${l(a)}${d>0?` +${d}`:""}`}const c=r?.[0];if(c){const d=(r?.length??0)-1;return`Except ${l(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 l=r==="OR"?"OR":"AND";return i.map(a=>zc(a,e+1)).join(` ${l} `)}return gs(s)}default:{const i=fb(t);return i||gs(s)||"Default"}}}function SS(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function kS(t,e){if(e.length===0)return 0;const s=SS(t);for(let r=0;r<e.length;r++){const l=e[r].discriminators;if(l&&Object.keys(l).length>0&&Object.entries(l).every(([c,d])=>s[c]===d))return r}let n=0,i=-1;for(let r=0;r<e.length;r++){const l=e[r],a=new Set(Object.keys(l.discriminators??{})),d=l.propertyKeys.filter(u=>!a.has(u)).filter(u=>s[u]!==void 0&&s[u]!==null&&s[u]!=="").length;d>i&&(i=d,n=r)}return n}function cte(t,e){const s=SS(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}const dte="$live/matchers/MatchAlways.ts";function ute(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType===x3||i.rule?.__resolveType===dte)??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 cp(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(cp);const e=t;if(e.__resolveType){const s=ute(e);return s===void 0?t:cp(s)}return jS(e)}function jS(t){const e={};for(const[s,n]of Object.entries(t))e[s]=cp(n);return e}function hte(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function CS(t){return t==null?"":Array.isArray(t)?t.map(CS).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function mf(t,e){if(!t.includes("{"))return;const s=jS(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,r,l)=>{const a=(r??l??"").trim();return CS(hte(s,a))}).trim()||void 0}function fte(t){return t.replace(/<[^>]*>/g,"").trim()}function mte(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function pte(t){return/^Option \d+$/.test(t)}function gte(t,e){if(e.includes("{"))return mf(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 NS(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=Lc(t);const i=wS(n);if(i&&(n=i,n=Lc(n)),s?.titleBy){const l=gte(n,s.titleBy);if(l)return l}if(s?.inlineUnionBranches?.length){const l=kS(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),a=s.inlineUnionBranches[l]?.title;if(a&&!pte(a)){const c=mf(a,n);if(c)return c;if(!a.includes("{"))return a}}for(const l of["name","label","title","alt","text","href","id","key"]){const a=n[l];if(typeof a=="string"&&a.trim()){const c=s?.properties?.[l]?.format;if(c==="rich-text"||c==="html"){const d=fte(a);if(d)return d;continue}return a}if(Array.isArray(a)){const c=a.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/")?zc(n):gs(r);if(s?.title){const l=mf(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function pf(t,e){return t.map((s,n)=>NS(s,n,e))}function VS(t,e,s){return NS(t,e,s)}function xte(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 mb(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=xte(e);if(!s)return;const n=mf(s,t);if(!n)return;const i=$3(n)||n;return vP(i)}function B3(t){return t===no||t===Zo}function R9(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function gf(t,e){const s=t.__resolveType??"";if(!s)return null;if(js(s)){const n=t.section??{};return TS(n,e)}if(B3(s)){const n=t.variants?.[0]?.value;return n?gf(n,e):null}return!ri(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:R9(s,e)}function TS(t,e){const s=t.__resolveType??"";if(!s)return null;if(B3(s)){const n=t.variants?.[0]?.value;return n?gf(n,e):null}return!ri(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:R9(s,e)}function AS(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!ri(n)||!Object.hasOwn(e,n))return null;const i=R9(n,e);return i?{blockKey:n,...i}:null}function Vpe(t,e){if(!e.isSavedBlock)return null;if(e.isHidden){const r=(js(t.__resolveType)?t.section:t)?.variants?.[0]?.value;if(!r)return null;const l=r.__resolveType??"";return js(l)?r.section?.__resolveType??l??null:l||null}return(e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType)||null}function bte(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 R9(n,s)}if(e.isHidden){const r=(js(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t,l=r.__resolveType??"",a=js(l)?r.section?.__resolveType??l:l;return B3(a)?null:gf(r,s)}if(e.isLazy||js(t.__resolveType)){const n=t.section??{};return TS(n,s)}return gf(t,s)}function kn(t){return typeof t=="string"?t:t.label}function dd(t){return typeof t=="object"}function pb(t){return dd(t)?t.arrayLabel:void 0}function gb(t){return dd(t)?t.fieldKey:void 0}function vte(t){return dd(t)?t.ownerPath:void 0}function xb(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function Vu(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ul(t){return t.normalize("NFC").trim()}function yte(t,e){return e.length>0&&Ul(kn(e[0]))===Ul(t)?e:[t,...e]}function _te(t,e){return e.map(s=>{if(!dd(s))return s;const n=s.ownerPath??[];return n[0]===t?s:{...s,ownerPath:[t,...n]}})}function Zt(t,e){return Ul(t)===Ul(e)}function xf(t,e){return Ul(t).replace(/\s+/g,"").toLowerCase()===Ul(e).replace(/\s+/g,"").toLowerCase()}function Lte(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||Zt(e,t)||s?.arrayKey!=null&&Zt(e,s.arrayKey)}function ih(t,e,s,n,i){const r=Ul(s);if(t.some(a=>Zt(kn(a),r)||Zt(kn(a),s)))return t;const l={label:s,itemIndex:n};return Lte(e,s,i)&&(l.arrayLabel=e),i?.arrayKey&&(l.fieldKey=i.arrayKey),[...t,l]}function wte(t,e){return t.slice(0,t.length-e.length)}function Ste(t,e,s,n){if(s.length===0)return s;const i=s[0];if(dd(i))return s;const r=n??Hl(t,e),l=kn(i);return Zt(l,r)||Zt(l,t)?s.slice(1):s}function Hl(t,e){return e.title??Vu(t)}function Tu(t,e,s){const n=s[t];if(!n)return Vu(t);const i=Hl(t,n);return e.some(l=>{if(l===t)return!1;const a=s[l];return a!=null&&Hl(l,a)===i})?Vu(t):i}function Tpe(t,e){return e.isMultivariateSectionTop?0:t-2}function Ape(t,e){return e<=0?[]:t.slice(0,e)}function Ac(t,e){return t.type==="array"&&t.items||T9(t)?!0:Array.isArray(e)}function PS(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&&(Ac(n)||n.type==="object"&&PS(n,e+1)))return!0}return!1}function ES(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("__")&&ES(n,e+1))return!0;return!1}function kte(t,e,s={}){const n=t.filter(i=>{const r=e[i];if(!r)return!1;if(r.type==="object"&&PS(r))return!0;const l=s[i];return l!=null&&typeof l=="object"&&!Array.isArray(l)?ES(l):!1});return n.length>1?new Set(n):new Set}function bb(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function jte(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=VS(t,e);return s===`Item ${e+1}`?void 0:s}function iu(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 l=jte(r,i);if(l&&Zt(l,e)||iu(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")&&(xf(Vu(i),e)||xf(i,e))||iu(r,e,s,n+1))return!0}return!1}function dp(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=Bn(i,s)?.properties;if(!r)return!1;const l=Object.keys(r);for(const a of l){const c=r[a];if(!c)continue;if(Ac(c)){const u=Tu(a,l,r);if(Zt(u,e)||Zt(a,e))return!0}const d=t[a];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&dp(d,e,s,n+1))return!0}return!1}function Sl(t,e,s,n,i,r){if(n.length===0)return null;const l=kn(n[0]),a=gb(n[0]);if(a!=null)for(const b of t){const v=e[b];if(!(!v||!Ac(v,s[b]))&&b===a)return b}const c=n.flatMap(b=>vte(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||!Ac(v,s[b]))continue;const _=Tu(b,t,e);if(Zt(l,_)||Zt(l,b)||n.some(y=>{if(Zt(kn(y),_)||Zt(kn(y),b))return!0;const L=pb(y);return L!=null&&(Zt(L,_)||Zt(L,b))}))return b}for(const b of t){const v=e[b];if(!v||!Ac(v,s[b]))continue;const _=s[b];if(!Array.isArray(_))continue;if(pf(_,v.items).some(L=>Zt(L,l)))return b}let d=null,u=!1,h=null,f=!1;for(const b of t){const v=e[b];if(v?.type!=="object"||!v.properties)continue;const _=Object.keys(v.properties),y=bb(s[b]),L=Tu(b,t,e);if((Zt(l,L)||Zt(l,b))&&Sl(_,v.properties,y,n.slice(1),i,r)!=null){d===null?d=b:u=!0;continue}Sl(_,v.properties,y,n,i,r)!=null&&(h===null?h=b:f=!0)}if(d!==null)return u?null:d;if(h!==null)return f?null:h;for(const b of t){const v=e[b];if(v?.type!=="inline-union"||!v.inlineUnionBranches?.length)continue;const _=bb(s[b]),y=Hl(b,v);for(const L of v.inlineUnionBranches){const w=L.schema?.properties;if(!w)continue;const S=Object.keys(w);if(Sl(S,w,_,n,i,r)||(Zt(l,y)||Zt(l,b))&&Sl(S,w,_,n.slice(1),i,r))return b}}let m=null;const p=[],g=n.map(pb).filter(b=>b!=null),x=n.map(gb).filter(b=>b!=null);for(const b of t){const v=e[b];if(v?.type!=="block-ref")continue;const _=Hl(b,v);if(l!==_&&l!==b){const y=s[b],w=(i?AS(y,i):null)?.data??y;(iu(w,l)||x.some(S=>iu(w,S)||dp(w,S,r))||g.some(S=>iu(w,S)||dp(w,S,r)))&&p.push(b);continue}if(n.length>1){const y=s[b];if(y&&typeof y=="object"&&!Array.isArray(y)){const L=kn(n[1]);if(Object.keys(y).some(S=>!S.startsWith("__")&&(xf(Vu(S),L)||xf(S,L))))return b}}m||(m=b)}return m||(p.length===1?p[0]:(p.length>1,null))}function Cte(t,e,s,n,i,r){return Sl(t,e,s,n,i,r)}function Nte(t,e,s,n,i,r,l){if(i.length===0||!s.properties)return!1;const a=Object.keys(s.properties);if(Sl(a,s.properties,n,i,r,l))return!0;const c=kn(i[0]);return!Zt(c,e)&&!Zt(c,t)?!1:i.length>1||Sl(a,s.properties,n,i.slice(1),r,l)!==null}function vb(t,e,s,n,i){if(!dd(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=pf(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&Zt(r[s.itemIndex],s.label))return s.itemIndex;if(n!=null&&n===s.itemIndex&&n>=0&&n<t.length)return n;const l=n!=null?r[n]:void 0;return l!==void 0&&Zt(l,s.label)?n:r.findIndex(a=>Zt(a,s.label))}function Vte(t,e,s,n,i,r){if(e.length===0)return null;for(let a=0;a<e.length;a++){const c=e[a],d=vb(s,n,c,i,r);if(d>=0)return{index:d,innerPath:e.slice(a+1),crumbIndex:a}}const l=e.findIndex(a=>Zt(kn(a),t));if(l>=0&&e.length>l+1){const a=e[l+1],c=vb(s,n,a,i,r);if(c>=0)return{index:c,innerPath:e.slice(l+2),crumbIndex:l+1}}return null}function T1(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===no}function Tte(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>T1(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>T1(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>T1(s.resolveType)):!1}function Ate(t,e){if(e==="global"||e==="sections"||T9(t))return!0;const s=t.type==="array"?t.items:void 0;return s?Tte(s):!1}function yb(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function RS(t){return t.map((e,s)=>({...e,index:s}))}function Pte(t,e){if(e===t.length)return t;if(e<t.length)return RS(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 Ete(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 Rte(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const Dte="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",Ite="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]",Mte="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 _b(t,e){return re("h-6 shrink-0 overflow-hidden",e?Dte:t?Mte:Ite)}function Ote(t){const e=F.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Uf,{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 l;e[3]!==s?(l=o.jsx("span",{className:"min-w-0 truncate",children:s}),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=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,l]})]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function $te(t){const e=F.c(75),{sortableId:s,labelText:n,imageSrc:i,hidden:r,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,u=le(),h=P9();let f;e[0]!==s?(f={id:s,animateLayoutChanges:Ute},e[0]=s,e[1]=f):f=e[1];const{attributes:m,listeners:p,setNodeRef:g,transform:x,isDragging:b}=Fg(f);let v;e[2]!==x?(v=fr.Transform.toString(x?{...x,x:0}:null),e[2]=x,e[3]=v):v=e[3];const _=b?0:void 0;let y;e[4]!==v||e[5]!==_?(y={transform:v,opacity:_},e[4]=v,e[5]=_,e[6]=y):y=e[6];const L=y;let w;e[7]!==m||e[8]!==h?(w=h?{}:m,e[7]=m,e[8]=h,e[9]=w):w=e[9];let S;e[10]!==p||e[11]!==h?(S=h?{}:p,e[10]=p,e[11]=h,e[12]=S):S=e[12];let k;e[13]!==a?(k=te=>{(te.key==="Enter"||te.key===" ")&&(te.preventDefault(),a())},e[13]=a,e[14]=k):k=e[14];const j=b?"cursor-grabbing":"cursor-pointer";let C;e[15]!==j?(C=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",j),e[15]=j,e[16]=C):C=e[16];let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Uf,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[17]=T):T=e[17];let N;e[18]!==i?(N=i&&o.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[18]=i,e[19]=N):N=e[19];const P=r&&"line-through opacity-50";let V;e[20]!==P?(V=re("min-w-0 flex-1 truncate text-sm",P),e[20]=P,e[21]=V):V=e[21];let E;e[22]!==n||e[23]!==V?(E=o.jsx("span",{className:V,children:n}),e[22]=n,e[23]=V,e[24]=E):E=e[24];let R;e[25]!==r||e[26]!==l||e[27]!==h||e[28]!==u?(R=l&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",disabled:h,"aria-label":u(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:re(_b(r===!0,r===!0)),onClick:te=>{te.stopPropagation(),l()},onPointerDown:Fte,children:r?o.jsx(zA,{size:14}):o.jsx(Qu,{size:14})})}),o.jsx(We,{side:"bottom",children:u(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[25]=r,e[26]=l,e[27]=h,e[28]=u,e[29]=R):R=e[29];let I;e[30]!==n||e[31]!==u?(I=u("sectionsEditor.arrayField.openActionsFor",{label:n}),e[30]=n,e[31]=u,e[32]=I):I=e[32];let D;e[33]!==r?(D=re(_b(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[33]=r,e[34]=D):D=e[34];let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(li,{size:14}),e[35]=O):O=e[35];let $;e[36]!==h||e[37]!==I||e[38]!==D?($=o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",disabled:h,"aria-label":I,className:D,onClick:zte,onPointerDown:Bte,children:O})}),e[36]=h,e[37]=I,e[38]=D,e[39]=$):$=e[39];let M;e[40]!==c?(M=te=>{te.stopPropagation(),c()},e[40]=c,e[41]=M):M=e[41];let z;e[42]===Symbol.for("react.memo_cache_sentinel")?(z=o.jsx(hn,{size:14}),e[42]=z):z=e[42];let B;e[43]!==u?(B=u("sectionsEditor.arrayField.duplicate"),e[43]=u,e[44]=B):B=e[44];let U;e[45]!==M||e[46]!==B?(U=o.jsxs(Je,{onClick:M,children:[z,B]}),e[45]=M,e[46]=B,e[47]=U):U=e[47];let H;e[48]!==d?(H=te=>{te.stopPropagation(),d()},e[48]=d,e[49]=H):H=e[49];let W;e[50]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(nn,{size:14}),e[50]=W):W=e[50];let K;e[51]!==u?(K=u("sectionsEditor.arrayField.delete"),e[51]=u,e[52]=K):K=e[52];let Q;e[53]!==H||e[54]!==K?(Q=o.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:H,children:[W,K]}),e[53]=H,e[54]=K,e[55]=Q):Q=e[55];let X;e[56]!==U||e[57]!==Q?(X=o.jsxs(Kt,{align:"end",children:[U,Q]}),e[56]=U,e[57]=Q,e[58]=X):X=e[58];let se;e[59]!==$||e[60]!==X?(se=o.jsxs(Ut,{children:[$,X]}),e[59]=$,e[60]=X,e[61]=se):se=e[61];let ne;return e[62]!==n||e[63]!==a||e[64]!==g||e[65]!==L||e[66]!==N||e[67]!==E||e[68]!==R||e[69]!==se||e[70]!==w||e[71]!==S||e[72]!==k||e[73]!==C?(ne=o.jsxs("div",{ref:g,style:L,...w,...S,role:"button",tabIndex:0,onClick:a,onKeyDown:k,className:C,title:n,children:[T,N,E,R,se]}),e[62]=n,e[63]=a,e[64]=g,e[65]=L,e[66]=N,e[67]=E,e[68]=R,e[69]=se,e[70]=w,e[71]=S,e[72]=k,e[73]=C,e[74]=ne):ne=e[74],ne}function Bte(t){return t.stopPropagation()}function zte(t){return t.stopPropagation()}function Fte(t){return t.stopPropagation()}function Ute(){return!1}function Hte(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 l=Bn(r,s);if(l?.properties&&Object.keys(l.properties).length>0)return l}}if(s&&n&&i){const l=Bn(n,s)?.properties?.[i]?.items;if(l?.properties&&Object.keys(l.properties).length>0)return{...l,titleBy:l.titleBy??e?.titleBy}}return e}function Kte(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function rh({schema:t,value:e,onChange:s,path:n,label:i,breadcrumbPath:r=[],onBreadcrumbChange:l,hasSiblingDrillDownFields:a,meta:c,decofile:d,onSaveReferencedBlock:u,containerResolveType:h,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}){const x=le(),b=P9(),v=E9(g?.virtualMcpId),_=Array.isArray(e)?e:[],y=t.items,L=Kte(n),w={arrayKey:L,hasSiblingDrillDownFields:a,itemLabelFromSchema:!!(y?.titleBy||y?.inlineUnionBranches?.length)},S=Ate(t,L),k=!S&&y?.type==="object",[j,C]=A.useState(null),T=Vte(i,r,_,y,j,L),N=T?.index??null;T===null?j!==null&&C(null):T.index!==j&&C(T.index);const[P,V]=A.useState(()=>yb(_.length)),[E,R]=A.useState(null),[I,D]=A.useState(n),[O,$]=A.useState(_.length),M=A.useRef(!1),z=A.useRef(null);I!==n?(D(n),$(_.length),V(yb(_.length)),C(null)):O!==_.length&&($(_.length),V(de=>Pte(de,_.length)));const B=(de,ae)=>VS(Lc(de),ae,y),U=de=>{if(M.current)return;const ae=B(_[de],de);C(de),l?.(ih(r,i,ae,de,w))},H=de=>{const ae=[..._,de];s(ae);const ce=ae.length-1;C(ce);const ue=B(de,ce);l?.(ih(r,i,ue,ce,w))},W=()=>{const de=y?.type,ae=y?.default!==void 0?y.default:de==="object"?{}:de==="block-ref"?(()=>{const me=y?.anyOfRefs?.[0]?.resolveType;return typeof me!="string"||su(me)?{}:{__resolveType:me}})():de==="number"||de==="integer"?0:de==="boolean"?!1:de==="array"?[]:"",ce=[..._,ae];s(ce);const ue=ce.length-1;C(ue);const G=B(ae,ue);l?.(ih(r,i,G,ue,w))},K=()=>{if(S){if(!f){ve.error(x("sectionsEditor.arrayField.startPreviewServer"));return}if(p){p({append:H});return}ve.error(x("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}W()},Q=de=>{const ae=_[de],ce=typeof structuredClone=="function"?structuredClone(ae):JSON.parse(JSON.stringify(ae??null)),ue=[..._.slice(0,de+1),ce,..._.slice(de+1)];s(ue),V(G=>Ete(G,de))},X=de=>{const ae=_[de],ce=[..._];ce[de]=nu(ae)?LS(ae):ub(ae),s(ce)},se=de=>{s(_.filter((ae,ce)=>ce!==de)),V(ae=>Rte(ae,de))},ne=(de,ae)=>{const ce=[..._];if(ce[de]=nu(_[de])?ub(ae):ae,s(ce),de===N&&T){const ue=B(_[de],de),G=B(ce[de],de);if(z.current={path:n,index:de,label:G},ue!==G){const me=[...r];me[T.crumbIndex]=xb(r[T.crumbIndex],G,de),l?.(me)}}},te=Rg(Mc(c0,{activationConstraint:{distance:8}}),Mc(a0,{coordinateGetter:Ug})),ee=P.map(de=>de.id),Y=de=>{R(String(de.active.id))},q=de=>{R(null);const{active:ae,over:ce}=de;if(!ce||ae.id===ce.id)return;const ue=ee.indexOf(String(ae.id)),G=ee.indexOf(String(ce.id));ue===-1||G===-1||(V(me=>RS(Oc([...me],ue,G))),s(Oc([..._],ue,G)),M.current=!0,requestAnimationFrame(()=>{M.current=!1}))},oe=()=>{R(null)},J=E?P.find(de=>de.id===E):null,ie=J!=null?_[J.index]:void 0,Z=J!=null&&ie!==void 0?pf(_,y)[J.index]:null,he=J!=null&&ie!==void 0?mb(Lc(ie),y):void 0;if(N!==null&&N<_.length){const de=Lc(_[N]),ae=Hte(de,y,c,h,L),ce=()=>{if(!T)return ih(r,i,B(de,N),N,w);const ue=r.slice(0,T.crumbIndex+1),G=z.current,me=G?.path===n&&G.index===N?G.label:B(de,N);return ue[T.crumbIndex]=xb(ue[T.crumbIndex],me,N),ue};return o.jsx("div",{className:"min-w-0",children:ae?.type==="object"&&ae.properties?o.jsx($i,{schema:ae,value:de,onChange:ue=>ne(N,ue),basePath:`${n}.${N}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:ue=>{l?.([...ce(),...ue])},meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,sandbox:g}):ae?Kl({schema:ae,value:de,onChange:ue=>ne(N,ue),path:`${n}.${N}`,required:!0,label:ae.title&&!ae.title.includes("{{")?ae.title:B(de,N),breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:ue=>{l?.([...ce(),...ue])},meta:c,decofile:d,onSaveReferencedBlock:u,previewBaseUrl:f,onAddSectionItem:m,onRequestAddSection:p,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(D3,{description:t.description,virtualMcpId:g?.virtualMcpId,children:o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:i})}),_.length>0&&o.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:_.length})]}),!v&&t.description&&o.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:t.description}),_.length>0&&o.jsx("div",{className:re(E&&"cursor-grabbing"),children:o.jsxs(Og,{sensors:te,collisionDetection:v_,onDragStart:Y,onDragEnd:q,onDragCancel:oe,children:[o.jsx(zg,{items:ee,strategy:Bg,children:o.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const de=pf(_,y);return P.map(ae=>{const ce=_[ae.index];if(ce===void 0)return null;const ue=de[ae.index]??B(ce,ae.index),G=mb(Lc(ce),y);return o.jsx($te,{sortableId:ae.id,labelText:ue,imageSrc:G,hidden:nu(ce),onToggleHidden:k?()=>X(ae.index):void 0,onOpen:()=>U(ae.index),onDuplicate:()=>Q(ae.index),onRemove:()=>se(ae.index)},ae.id)})})()})}),In.createPortal(o.jsx($g,{dropAnimation:yS,children:Z?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(Ote,{labelText:Z,imageSrc:he})}):null}),document.body)]})}),o.jsxs("button",{type:"button",disabled:b,onClick:K,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(Gt,{size:14}),x(S?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function Wte(t){const e=F.c(53),{schema:s,value:n,onChange:i,path:r,label:l,breadcrumbPath:a,onBreadcrumbChange:c,focused:d,meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}=t;let b;e[0]!==a?(b=a===void 0?[]:a,e[0]=a,e[1]=b):b=e[1];const v=b,[_,y]=A.useState(!1),L=E9(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]!==h||e[6]!==u||e[7]!==S||e[8]!==p||e[9]!==c||e[10]!==i||e[11]!==g||e[12]!==f||e[13]!==r||e[14]!==m||e[15]!==x||e[16]!==s?(k=o.jsx($i,{schema:s,value:S,onChange:i,basePath:r,breadcrumbPath:v,onBreadcrumbChange:c,meta:u,decofile:h,onSaveReferencedBlock:f,previewBaseUrl:m,onAddSectionItem:p,onRequestAddSection:g,sandbox:x}),e[4]=v,e[5]=h,e[6]=u,e[7]=S,e[8]=p,e[9]=c,e[10]=i,e[11]=g,e[12]=f,e[13]=r,e[14]=m,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 T=C;let N;e[20]!==v||e[21]!==h||e[22]!==T||e[23]!==l||e[24]!==u||e[25]!==S||e[26]!==s?(N=Nte(T,l,s,S,v,h,u),e[20]=v,e[21]=h,e[22]=T,e[23]=l,e[24]=u,e[25]=S,e[26]=s,e[27]=N):N=e[27];const V=_||N,E=`${r}-fields`;let R;e[28]===Symbol.for("react.memo_cache_sentinel")?(R=()=>y(qte),e[28]=R):R=e[28];let I;e[29]!==V?(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:V?o.jsx(bs,{size:16}):o.jsx(Ws,{size:16})}),e[29]=V,e[30]=I):I=e[30];const D=x?.virtualMcpId;let O;e[31]!==l?(O=o.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[31]=l,e[32]=O):O=e[32];let $;e[33]!==s.description||e[34]!==O||e[35]!==D?($=o.jsx(D3,{description:s.description,virtualMcpId:D,children:O}),e[33]=s.description,e[34]=O,e[35]=D,e[36]=$):$=e[36];let M;e[37]!==E||e[38]!==V||e[39]!==$||e[40]!==I?(M=o.jsxs("button",{type:"button","aria-expanded":V,"aria-controls":E,onClick:R,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,$]}),e[37]=E,e[38]=V,e[39]=$,e[40]=I,e[41]=M):M=e[41];let z;e[42]!==s.description||e[43]!==L?(z=!L&&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]=L,e[44]=z):z=e[44];let B;e[45]!==E||e[46]!==j||e[47]!==V?(B=V&&o.jsx("div",{id:E,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:j}),e[45]=E,e[46]=j,e[47]=V,e[48]=B):B=e[48];let U;return e[49]!==M||e[50]!==z||e[51]!==B?(U=o.jsxs("div",{className:"min-w-0 space-y-2",children:[M,z,B]}),e[49]=M,e[50]=z,e[51]=B,e[52]=U):U=e[52],U}function qte(t){return!t}function Ppe(t,e,s,n,i){const r={...t[e]};if(i.length>1){const l=r.sections,a=[...l?.variants??[]];a[n]&&(a[n]={...a[n],value:s}),r.sections={...l,variants:a}}else r.sections=s;return r}function Epe(t){return structuredClone(t)}function Rpe(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function DS(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 z3(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 F3(t){const e=F.c(61),{open:s,onOpenChange:n,defaultBlockId:i,isPending:r,onSubmit:l}=t,a=i===void 0?"":i,c=r===void 0?!1:r,[d,u]=A.useState(a),[h,f]=A.useState(s);s!==h&&(f(s),s&&u(a));let m;e[0]!==c||e[1]!==n?(m=z=>{!z&&!c&&n(!1)},e[0]=c,e[1]=n,e[2]=m):m=e[2];const p=m;let g;e[3]!==d||e[4]!==c||e[5]!==l?(g=async z=>{z.preventDefault();const B=d.trim();!B||c||await l(B)},e[3]=d,e[4]=c,e[5]=l,e[6]=g):g=e[6];const x=g,b=le();let v;e[7]!==b?(v=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=v):v=e[8];let _;e[9]!==v?(_=o.jsx(qt,{children:v}),e[9]=v,e[10]=_):_=e[10];let y;e[11]!==b?(y=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=y):y=e[12];let L;e[13]!==y?(L=o.jsx(Nn,{children:y}),e[13]=y,e[14]=L):L=e[14];let w;e[15]!==_||e[16]!==L?(w=o.jsxs(ds,{children:[_,L]}),e[15]=_,e[16]=L,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=>u(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 T;e[25]!==d||e[26]!==c||e[27]!==C?(T=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]=T):T=e[28];let N;e[29]!==k||e[30]!==T?(N=o.jsxs("div",{className:"py-4 space-y-2",children:[k,T]}),e[29]=k,e[30]=T,e[31]=N):N=e[31];let P;e[32]!==n?(P=()=>n(!1),e[32]=n,e[33]=P):P=e[33];let V;e[34]!==b?(V=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=V):V=e[35];let E;e[36]!==c||e[37]!==P||e[38]!==V?(E=o.jsx(fe,{type:"button",variant:"outline",onClick:P,disabled:c,children:V}),e[36]=c,e[37]=P,e[38]=V,e[39]=E):E=e[39];let R;e[40]!==d||e[41]!==c?(R=!d.trim()||c,e[40]=d,e[41]=c,e[42]=R):R=e[42];let I;e[43]!==c||e[44]!==b?(I=c?o.jsxs(o.Fragment,{children:[o.jsx(it,{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]!==R||e[47]!==I?(D=o.jsx(fe,{type:"submit",disabled:R,children:I}),e[46]=R,e[47]=I,e[48]=D):D=e[48];let O;e[49]!==E||e[50]!==D?(O=o.jsxs(Gn,{children:[E,D]}),e[49]=E,e[50]=D,e[51]=O):O=e[51];let $;e[52]!==x||e[53]!==N||e[54]!==O||e[55]!==w?($=o.jsx(Bt,{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]=$):$=e[56];let M;return e[57]!==p||e[58]!==s||e[59]!==$?(M=o.jsx(zt,{open:s,onOpenChange:p,children:$}),e[57]=p,e[58]=s,e[59]=$,e[60]=M):M=e[60],M}function Gte(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 Yte(t){const e=F.c(13),{blockKey:s}=t,n=le();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(zn,{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 l;e[3]!==r?(l=o.jsx(Ke,{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]=l):l=e[4];let a;e[5]!==s||e[6]!==n?(a=n("sectionsEditor.anyOfField.globalLoaderTooltip",{blockKey:s}),e[5]=s,e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(We,{side:"top",className:"max-w-[260px]",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(qe,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function Jte(t){const e=F.c(36),{path:s,open:n,onOpenChange:i,title:r,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:u}=t,h=le(),f=`${s}-loader-config`,m=a&&"ml-1";let p;e[0]!==m?(p=re("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=p):p=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(bs,{size:16}):o.jsx(Ws,{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(Yte,{blockKey:c}),e[9]=c,e[10]=v):v=e[10];let _;e[11]!==b||e[12]!==v?(_=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,v]}),e[11]=b,e[12]=v,e[13]=_):_=e[13];let y;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==_?(y=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,_]}),e[14]=f,e[15]=n,e[16]=g,e[17]=x,e[18]=_,e[19]=y):y=e[19];let L;e[20]!==c||e[21]!==d||e[22]!==u||e[23]!==h?(L=(d||u)&&o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":h("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:o.jsx(li,{size:16})})}),o.jsxs(Kt,{align:"end",className:"w-48",children:[c&&d&&o.jsxs(Je,{onClick:d,children:[o.jsx($o,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.detach")]}),!c&&u&&o.jsxs(Je,{onClick:u,children:[o.jsx(zn,{className:"h-4 w-4"}),h("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=u,e[23]=h,e[24]=L):L=e[24];let w;e[25]!==y||e[26]!==L?(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,L]}),e[25]=y,e[26]=L,e[27]=w):w=e[27];let S;e[28]!==f||e[29]!==l||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:l})}),e[28]=f,e[29]=l,e[30]=n,e[31]=S):S=e[31];let k;return e[32]!==w||e[33]!==S||e[34]!==p?(k=o.jsxs("div",{className:p,children:[w,S]}),e[32]=w,e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function Lb(t){const e=F.c(42),{schema:s,value:n,onChange:i,path:r,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}=t,g=le(),x=(s.anyOfRefs??[]).filter(Zte),b=u&&n?AS(n,u):null,v=b?.data??n,_=b?null:wS(v),y=_??v,L=ste(x,{savedBlockKey:b?.blockKey,editorValue:v}),w=L.length>0?nte(v,L,b?.blockKey):L[0]?.resolveType??"",k=s.type==="block-ref"&&L.some(Xte);let j;e[0]!==l||e[1]!==r?(j=l??(r.includes(".")?r.split(".")[0]:r),e[0]=l,e[1]=r,e[2]=j):j=e[2];const C=j;let T;e[3]!==a?(T=a??[],e[3]=a,e[4]=T):T=e[4];const N=T,P=k&&N.length>0&&kn(N[0])===C,V=P?N.slice(1):N,E=P?ne=>{c?.([C,...ne])}:c,[R,I]=A.useState(w),[D,O]=A.useState(w);D!==w&&(O(w),I(w));const[$,M]=A.useState(()=>rte(v,b?.blockKey)),[z,B]=A.useState(!1);if(L.length>0){const ne=R||w;let te;e[5]!==ne?(te=Ve=>Ve.resolveType===ne,e[5]=ne,e[6]=te):te=e[6];const ee=L.find(te),Y=hb(v,d,ee?.schema),q=ite(Y??ee?.schema??null,s.discriminatorKey),oe=s.discriminatorKey,J=Ve=>{I(Ve);const xe=L.find(Ie=>Ie.resolveType===Ve),Se=hb(v,d,xe?.schema),Ce=new Set(Object.keys((Se??xe?.schema)?.properties??{})),Ae=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},st=Object.fromEntries(Object.entries(Ae).filter(Ie=>{const[Oe]=Ie;return Ce.has(Oe)})),Be={...Gte(xe?.schema),...st};if(oe){const Ie=xe?.discriminatorValue??Ve;i({...Be,[oe]:Ie});return}if(su(Ve)){i(Be);return}i({...Be,__resolveType:Ve})};let ie;e[7]!==ne||e[8]!==oe||e[9]!==i?(ie=Ve=>{if(oe||!su(ne)||Ve===null||typeof Ve!="object"||Array.isArray(Ve)){i(Ve);return}const{__resolveType:xe,...Se}=Ve;i(Se)},e[7]=ne,e[8]=oe,e[9]=i,e[10]=ie):ie=e[10];const Z=ie,he=q?.properties?o.jsx($i,{schema:q,value:y,onChange:Ve=>{if(b&&h){h(b.blockKey,Ve);return}if(_){i({...v,section:Ve});return}Z(Ve)},basePath:r,breadcrumbPath:V,onBreadcrumbChange:E,meta:d,decofile:u,onSaveReferencedBlock:h,sandbox:f,previewBaseUrl:m,onRequestAddSection:p}):null;if(k&&he&&V.length>0){let Ve;return e[11]!==he?(Ve=o.jsx("div",{className:"min-w-0",children:he}),e[11]=he,e[12]=Ve):Ve=e[12],Ve}let de;e[13]!==r?(de=r.includes("."),e[13]=r,e[14]=de):de=e[14];const ae=de,ce=b?()=>{const{name:Ve,...xe}=b.data;i(xe)}:void 0,ue=!b&&!_&&!!h&&k&&!su(ne)&&ne.includes("/"),G=y&&typeof y=="object"&&!Array.isArray(y)?y:{},me=Ve=>{if(!h)return;const xe=Ve.trim(),Se=z3(xe,u??{});if(Se){ve.error(Se);return}h(xe,{...G,__resolveType:ne,name:xe}),i({__resolveType:xe}),B(!1),ve.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:xe}))},ye=f?.virtualMcpId;let we;e[15]!==l||e[16]!==r||e[17]!==s.description||e[18]!==ye?(we=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:ye}),e[15]=l,e[16]=r,e[17]=s.description,e[18]=ye,e[19]=we):we=e[19];let Ne;e[20]!==g?(Ne=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=Ne):Ne=e[21];let je;e[22]!==Ne?(je=o.jsx(Rs,{placeholder:Ne}),e[22]=Ne,e[23]=je):je=e[23];let _e;return e[24]!==r||e[25]!==je?(_e=o.jsx(Ss,{id:r,className:"w-full min-w-0",children:je}),e[24]=r,e[25]=je,e[26]=_e):_e=e[26],o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[we,o.jsxs(ws,{value:ne||void 0,onValueChange:J,children:[_e,o.jsx(ks,{children:L.map(Qte)})]})]}),he&&(k?o.jsx(Jte,{path:r,open:$,onOpenChange:M,title:g(ae?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:he,nestedBlockRef:ae,globalBlockKey:b?.blockKey,onDetach:ce,onMakeGlobal:ue?()=>B(!0):void 0}):he),ue&&o.jsx(F3,{open:z,onOpenChange:B,defaultBlockId:DS(gs(ne)),onSubmit:me})]})}if(s.anyOfRefs&&s.anyOfRefs.length>0)return null;const U=f?.virtualMcpId;let H;e[27]!==l||e[28]!==r||e[29]!==s.description||e[30]!==U?(H=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:U}),e[27]=l,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=ne=>i(ne.target.value),e[32]=i,e[33]=K):K=e[33];const Q=s.description??"";let X;e[34]!==r||e[35]!==W||e[36]!==K||e[37]!==Q?(X=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:Q}),e[34]=r,e[35]=W,e[36]=K,e[37]=Q,e[38]=X):X=e[38];let se;return e[39]!==H||e[40]!==X?(se=o.jsxs("div",{className:"space-y-1.5",children:[H,X]}),e[39]=H,e[40]=X,e[41]=se):se=e[41],se}function Qte(t){const e=tte(t);return o.jsx(It,{value:t.resolveType,children:e},t.resolveType)}function Xte(t){return t.resolveType.includes("/")&&!su(t.resolveType)}function Zte(t){return t.resolveType!==""}const A1=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function ese(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]??"",l=A1(i,"id");if(!l)continue;const a=A1(i,"viewBox"),c=A1(i,"fill"),d=['xmlns="http://www.w3.org/2000/svg"',a?`viewBox="${a}"`:"",c?`fill="${c}"`:""].filter(Boolean).join(" ");e[l]=`<svg ${d}>${r}</svg>`}return e}async function tse(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return ese(await e.text())}function sse(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 nse(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 ise(t,e){return t.length>0?t:e}function rse(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function ose({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 IS(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 lse(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function ase(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return IS(t.icon,e)}async function cse(t,e,s){const n={};s&&(n.term=s);const r=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,l=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new Error(`Failed to fetch dynamic options: ${l.status}`);const a=await l.json();return sse(a)}function wb(t){const e=F.c(9),{option:s,className:n,fg:i}=t;let r;e[0]!==i||e[1]!==s?(r=ase(s,i),e[0]=i,e[1]=s,e[2]=r):r=e[2];const l=r;if(!l)return null;const a=s.image?"rounded object-cover":"object-contain";let c;e[3]!==n||e[4]!==a?(c=re("shrink-0",a,n),e[3]=n,e[4]=a,e[5]=c):c=e[5];let d;return e[6]!==l||e[7]!==c?(d=o.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:c}),e[6]=l,e[7]=c,e[8]=d):d=e[8],d}function dse(t){const e=F.c(53),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=le(),d=s.options,u=a?.previewUrl,[h,f]=A.useState(!1),[m,p]=A.useState(""),[g,x]=A.useState(""),b=A.useRef(null);let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=Z=>{p(Z),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(Z)},300)},e[0]=v):v=e[0];const _=v,y=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",L=typeof n=="string"?n:"",w=s.format==="icon-select";let S;e[1]!==g||e[2]!==d||e[3]!==y?(S=tt.sandboxInvoke(y,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=y,e[4]=S):S=e[4];let k;e[5]!==g||e[6]!==d||e[7]!==u?(k=()=>cse(u,d,g||void 0),e[5]=g,e[6]=d,e[7]=u,e[8]=k):k=e[8];const j=!!u&&!!d&&(h||!!L);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 T=Mt(C),N=T.data??[];let P;e[13]!==y?(P=tt.sandboxSprite(y),e[13]=y,e[14]=P):P=e[14];let V;e[15]!==u||e[16]!==a?(V=()=>tse(mw({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,threadId:a.threadId,previewUrl:u},"/sprites.svg")),e[15]=u,e[16]=a,e[17]=V):V=e[17];const E=w&&!!a&&(h||!!L)&&(!d||T.isFetched&&N.length===0);let R;e[18]!==P||e[19]!==V||e[20]!==E?(R={queryKey:P,queryFn:V,enabled:E,staleTime:3e5,retry:1},e[18]=P,e[19]=V,e[20]=E,e[21]=R):R=e[21];const I=Mt(R),D=nse(s.enum),O=I.data??{},$=lse(),M=Object.fromEntries(Object.entries(O).map(Z=>{const[he,de]=Z;return[he,IS(de,$)]})),z=w&&Object.keys(M).length>0?D.map(Z=>({...Z,previewSrc:M[Z.value]})):D,B=ise(N,z),U=rse(B,m);let H;e[22]!==L?(H=Z=>Z.value===L,e[22]=L,e[23]=H):H=e[23];const W=B.find(H),K=m.trim(),Q=T.isFetched&&!T.isFetching&&m===g,X=ose({loaderPath:d,isIconSelect:w,enumFallbackCount:D.length,trimmedSearch:K,optionValues:B.map(use),optionsSettled:Q});if((!u||!d)&&D.length===0){const Z=a?.virtualMcpId;let he;e[24]!==l||e[25]!==r||e[26]!==s.description||e[27]!==Z?(he=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:Z}),e[24]=l,e[25]=r,e[26]=s.description,e[27]=Z,e[28]=he):he=e[28];let de;e[29]!==i?(de=ue=>i(ue.target.value),e[29]=i,e[30]=de):de=e[30];let ae;e[31]!==L||e[32]!==r||e[33]!==de?(ae=o.jsx(vt,{id:r,type:"text",value:L,onChange:de}),e[31]=L,e[32]=r,e[33]=de,e[34]=ae):ae=e[34];let ce;return e[35]!==he||e[36]!==ae?(ce=o.jsxs("div",{className:"space-y-2",children:[he,ae]}),e[35]=he,e[36]=ae,e[37]=ce):ce=e[37],ce}const ne=a?.virtualMcpId;let te;e[38]!==l||e[39]!==r||e[40]!==s.description||e[41]!==ne?(te=o.jsx(Fs,{htmlFor:r,label:l,description:s.description,virtualMcpId:ne}),e[38]=l,e[39]=r,e[40]=s.description,e[41]=ne,e[42]=te):te=e[42];const ee=W?o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(wb,{option:W,className:"h-6 w-6",fg:$}),o.jsx("span",{className:"truncate",children:W.label??W.value})]}):L?o.jsx("span",{className:"truncate",children:L}):o.jsx("span",{className:"text-muted-foreground",children:c("sectionsEditor.dynamicOptionsField.selectPlaceholder")});let Y;e[43]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(i9,{className:"size-4 shrink-0 opacity-50"}),e[43]=Y):Y=e[43];let q;e[44]!==h||e[45]!==ee?(q=o.jsx(os,{asChild:!0,children:o.jsxs(fe,{variant:"outline",role:"combobox","aria-expanded":h,className:"h-10 w-full justify-between font-normal",children:[ee,Y]})}),e[44]=h,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 J;e[48]!==c?(J=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=J):J=e[49];let ie;return e[50]!==m||e[51]!==J?(ie=o.jsx(di,{placeholder:J,className:"h-9",value:m,onValueChange:_}),e[50]=m,e[51]=J,e[52]=ie):ie=e[52],o.jsxs("div",{className:"space-y-2",children:[te,o.jsxs(cs,{open:h,onOpenChange:f,children:[q,o.jsx(as,{className:"p-0",style:oe,children:o.jsxs(Ii,{shouldFilter:!1,children:[ie,o.jsxs(ui,{children:[!X&&o.jsx($n,{children:T.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),o.jsx(Ps,{children:U.map(Z=>o.jsxs(ls,{value:Z.value,className:"cursor-pointer",onSelect:()=>{i(Z.value===L?"":Z.value),f(!1)},children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(wb,{option:Z,className:re(Z.image?"h-9 w-9":"h-6 w-6"),fg:$}),o.jsx("span",{className:"truncate",children:Z.label??Z.value})]}),o.jsx($t,{className:re("ml-auto size-4 shrink-0",L===Z.value?"opacity-100":"opacity-0")})]},Z.value))}),X&&o.jsx(Ps,{children:o.jsx(ls,{value:K,className:"cursor-pointer",onSelect:()=>{i(K),p(""),x(""),f(!1)},children:o.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:K})})})})]})]})})]})]})}function use(t){return t.value}function MS(t){const e=F.c(17),{org:s}=He(),n=Vs();let i,r,l,a;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,a=b8,l=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]=l,e[7]=a):(i=e[4],r=e[5],l=e[6],a=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 h=>{const{pageParam:f}=h;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 u;return e[13]!==l||e[14]!==c||e[15]!==d?(u={queryKey:l,enabled:c,staleTime:3e4,initialPageParam:null,queryFn:d,getNextPageParam:hse},e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],a(u)}function hse(t){return t.nextCursor??void 0}function D9(){const t=F.c(2),{org:e}=He();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 l=await r.text().catch(fse);let a=`${r.status} ${r.statusText}`;try{const c=JSON.parse(l);c.message&&(a=c.message)}catch{l&&(a=l.slice(0,200))}throw new Error(`Upload failed: ${a}`)}return await r.json()}},t[0]=e,t[1]=s):s=t[1],Es(s)}function fse(){return""}function mse(){const t=F.c(8),{org:e}=He(),s=Vs(),n=Ns();let i;t[0]!==s?(i=a=>s.call("FILE_OBJECT_DELETE",a),t[0]=s,t[1]=i):i=t[1];let r;t[2]!==e||t[3]!==n?(r=(a,c)=>{n.invalidateQueries({queryKey:tt.filePickerObjectsByConfig(e.id,c.configId)})},t[2]=e,t[3]=n,t[4]=r):r=t[4];let l;return t[5]!==i||t[6]!==r?(l={mutationFn:i,onSuccess:r},t[5]=i,t[6]=r,t[7]=l):l=t[7],Es(l)}function U3(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function OS(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function bf(t){const e=t.split("/");return e[e.length-1]??t}function $S(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const I9="file-picker:last-config-id";function BS(t){const e=F.c(31),s=le(),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 l;e[3]!==r?(l=o.jsx(qt,{children:r}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==s?(a=s("filePicker.filePickerDialog.description"),e[5]=s,e[6]=a):a=e[6];let c;e[7]!==a?(c=o.jsx(Nn,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=o.jsxs(ds,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let u;e[12]!==s?(u=b=>{const{error:v}=b;return o.jsx(pse,{error:v??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=u):u=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(tn,{className:"h-64 w-full"}),e[14]=h):h=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 m;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==f?(m=o.jsx(A.Suspense,{fallback:h,children:o.jsx(gse,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:f})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=f,e[20]=m):m=e[20];let p;e[21]!==m||e[22]!==u?(p=o.jsx(sn,{fallback:u,children:m}),e[21]=m,e[22]=u,e[23]=p):p=e[23];let g;e[24]!==p||e[25]!==d?(g=o.jsxs(Bt,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[d,p]}),e[24]=p,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(zt,{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 pse(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 gse(t){const e=F.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,r=X6();if(r.length===0){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(vse,{}),e[0]=p):p=e[0],p}if(n){let p;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],p=r.find(x),e[1]=r,e[2]=n,e[3]=p}else p=e[3];const g=p;if(g){let x;return e[6]!==g||e[7]!==s||e[8]!==i?(x=o.jsx(P1,{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 p=r[0];let g;return e[10]!==p||e[11]!==s||e[12]!==i?(g=o.jsx(P1,{config:p,mode:s,onSelect:i}),e[10]=p,e[11]=s,e[12]=i,e[13]=g):g=e[13],g}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=typeof window<"u"?window.localStorage.getItem(I9):null,e[14]=l):l=e[14];const a=l;let c;e[15]!==r?(c=r.find(p=>p.id===a)?.id??r[0].id,e[15]=r,e[16]=c):c=e[16];const d=c;let u;e[17]!==r?(u=r.map(xse),e[17]=r,e[18]=u):u=e[18];let h;e[19]!==u?(h=o.jsx(Jc,{className:"self-start",children:u}),e[19]=u,e[20]=h):h=e[20];let f;if(e[21]!==r||e[22]!==s||e[23]!==i){let p;e[25]!==s||e[26]!==i?(p=g=>o.jsx(Cl,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:o.jsx(P1,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=p):p=e[27],f=r.map(p),e[21]=r,e[22]=s,e[23]=i,e[24]=f}else f=e[24];let m;return e[28]!==d||e[29]!==h||e[30]!==f?(m=o.jsxs(na,{defaultValue:d,onValueChange:bse,className:"min-h-0 flex-1 flex flex-col",children:[h,f]}),e[28]=d,e[29]=h,e[30]=f,e[31]=m):m=e[31],m}function xse(t){return o.jsx(ii,{value:t.id,children:t.name},t.id)}function bse(t){typeof window<"u"&&window.localStorage.setItem(I9,t)}function vse(){const t=F.c(12),e=le();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(Yn,{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 l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=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,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function P1({config:t,mode:e,onSelect:s}){const n=le(),[i,r]=A.useState(""),l=l9(i,300),a=MS({configId:t.id,search:l,imageOnly:e==="image"}),c=D9(),[d,u]=A.useState(!1),h=A.useRef(null),f=e==="image"?"image/*":void 0;async function m(S){if(!S)return;const k=Array.from(S);if(k.length===0)return;let j=null;const C=[];for(const T of k)try{const N=await c.mutateAsync({configId:t.id,file:T});j??=N.publicUrl}catch(N){C.push(`${T.name} (${N instanceof Error?N.message:"upload failed"})`)}await a.refetch(),C.length>0&&ve.error(C.length===k.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:C.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:C.join("; ")})),j&&s(j)}function p(S){S.preventDefault(),u(!0)}function g(){u(!1)}function x(S){S.preventDefault(),S.stopPropagation(),u(!1),m(S.dataTransfer.files)}const v=(a.data?.pages??[]).flatMap(S=>S.items),_=v.filter(S=>e==="image"?U3(S.key):!0),y=l.trim(),L=v.length>0||i.trim().length>0,w=i!==l||a.isFetching&&!a.isFetchingNextPage;return o.jsxs("div",{className:"flex flex-col gap-3 min-h-0 flex-1",children:[o.jsxs("button",{type:"button",onClick:()=>h.current?.click(),onDragOver:p,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(Yn,{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:h,type:"file",accept:f,multiple:!0,className:"hidden",onChange:S=>{const k=Array.from(S.target.files??[]);S.target.value="",m(k)}})]}),L?o.jsx(s9,{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:[_.length===0?y?o.jsx(Lse,{query:y}):e==="image"&&v.length>0?o.jsx(_se,{}):o.jsx(yse,{}):e==="image"?o.jsx(wse,{items:_,onSelect:s}):o.jsx(Sse,{items:_,onSelect:s}),a.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(fe,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function yse(){const t=F.c(12),e=le();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(ki,{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 l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=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,l]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function _se(){const t=F.c(12),e=le();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(ki,{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 l;t[7]!==r?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=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,l]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Lse(t){const e=F.c(13),{query:s}=t,n=le();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(ki,{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 l;e[4]!==r?(l=o.jsx("p",{className:"text-sm font-medium",children:r}),e[4]=r,e[5]=l):l=e[5];let a;e[6]!==n?(a=n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx("p",{className:"text-xs text-muted-foreground",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||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,l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function wse(t){const e=F.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>o.jsx(zS,{item:a,variant:"image",onSelect:n},a.key),e[3]=n,e[4]=l):l=e[4],i=s.map(l),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 Sse(t){const e=F.c(7),{items:s,onSelect:n}=t;let i;if(e[0]!==s||e[1]!==n){let l;e[3]!==n?(l=a=>o.jsx("li",{children:o.jsx(zS,{item:a,variant:"row",onSelect:n})},a.key),e[3]=n,e[4]=l):l=e[4],i=s.map(l),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 zS(t){const e=F.c(58),{item:s,variant:n,onSelect:i}=t;let r;e[0]!==s.key?(r=OS(s.key),e[0]=s.key,e[1]=r):r=e[1];const l=r;if(n==="image"){let _;e[2]!==s.publicUrl||e[3]!==i?(_=()=>i(s.publicUrl),e[2]=s.publicUrl,e[3]=i,e[4]=_):_=e[4];let y;e[5]!==s.key||e[6]!==s.publicUrl?(y=o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:kse}),e[5]=s.key,e[6]=s.publicUrl,e[7]=y):y=e[7];let L;e[8]!==s.key||e[9]!==_||e[10]!==y?(L=o.jsx("button",{type:"button",onClick:_,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:y}),e[8]=s.key,e[9]=_,e[10]=y,e[11]=L):L=e[11];let w;e[12]!==l?(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:l}),e[12]=l,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(Sb,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=S):S=e[16];let k;e[17]!==s.key?(k=bf(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]!==L||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:[L,w,S,j]}),e[21]=L,e[22]=w,e[23]=S,e[24]=j,e[25]=C):C=e[25],C}let a;e[26]!==s.publicUrl||e[27]!==i?(a=()=>i(s.publicUrl),e[26]=s.publicUrl,e[27]=i,e[28]=a):a=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:U3(s.key)?o.jsx(ki,{size:16,className:"text-muted-foreground"}):o.jsx(Vi,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=bf(s.key),e[31]=s.key,e[32]=d):d=e[32];let u;e[33]!==d?(u=o.jsx("p",{className:"truncate text-sm font-medium",children:d}),e[33]=d,e[34]=u):u=e[34];let h;e[35]!==s.key?(h=o.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:s.key}),e[35]=s.key,e[36]=h):h=e[36];let f;e[37]!==u||e[38]!==h?(f=o.jsxs("div",{className:"min-w-0 flex-1",children:[u,h]}),e[37]=u,e[38]=h,e[39]=f):f=e[39];let m;e[40]!==l?(m=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}),e[40]=l,e[41]=m):m=e[41];let p;e[42]!==s.size?(p=$S(s.size),e[42]=s.size,e[43]=p):p=e[43];let g;e[44]!==p?(g=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:p}),e[44]=p,e[45]=g):g=e[45];let x;e[46]!==g||e[47]!==a||e[48]!==c||e[49]!==f||e[50]!==m?(x=o.jsxs("button",{type:"button",onClick:a,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[c,f,m,g]}),e[46]=g,e[47]=a,e[48]=c,e[49]=f,e[50]=m,e[51]=x):x=e[51];let b;e[52]!==s||e[53]!==i?(b=o.jsx(Sb,{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 kse(t){t.target.style.display="none"}function Sb(t){const e=F.c(39),{item:s,onSelect:n}=t,i=le(),[r,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(C){C.preventDefault(),C.stopPropagation();try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{ve.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(o9,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:Nse,"aria-label":d,children:u})}),e[6]=d,e[7]=h):h=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 m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx($t,{size:14}),e[11]=m):m=e[11];let p;e[12]!==i?(p=i("filePicker.filePickerDialog.useThis"),e[12]=i,e[13]=p):p=e[13];let g;e[14]!==f||e[15]!==p?(g=o.jsxs(Je,{onClick:f,children:[m,p]}),e[14]=f,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==r?(x=r?o.jsx($t,{size:14}):o.jsx(hn,{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(Je,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=v):v=e[25];const _=s.publicUrl;let y;e[26]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(fn,{size:14}),e[26]=y):y=e[26];let L;e[27]!==i?(L=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=L):L=e[28];let w;e[29]!==s.publicUrl||e[30]!==L?(w=o.jsx(Je,{asChild:!0,children:o.jsxs("a",{href:_,target:"_blank",rel:"noreferrer",onClick:jse,children:[y,L]})}),e[29]=s.publicUrl,e[30]=L,e[31]=w):w=e[31];let S;e[32]!==v||e[33]!==w||e[34]!==g?(S=o.jsxs(Kt,{align:"end",onClick:Cse,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]!==h?(k=o.jsxs(Ut,{children:[h,S]}),e[36]=S,e[37]=h,e[38]=k):k=e[38],k}function jse(t){return t.stopPropagation()}function Cse(t){return t.stopPropagation()}function Nse(t){return t.stopPropagation()}function FS(){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(Yn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function US(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function HS(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const Vse=["low","medium","high","original"];function KS(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function WS(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=Tse(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 qS(t,e,s){const n=t.indexOf("#"),i=n>=0?t.slice(n):"",r=n>=0?t.slice(0,n):t,l=r.indexOf("?"),a=l>=0?r.slice(0,l):r,c=(l>=0?r.slice(l+1).split("&"):[]).filter(Boolean).filter(d=>{const u=d.indexOf("=");return(u>=0?d.slice(0,u):d)!==e});return s!==void 0&&c.push(`${e}=${s}`),`${a}${c.length?`?${c.join("&")}`:""}${i}`}function Tse(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 Ase(t){if(!t)return;const e=WS(t,"quality");return KS(e)?e:void 0}function Pse(t,e){return qS(t,"quality",e)}function Ese(t){return t?WS(t,"muted")!=="false":!0}function Rse(t,e){return qS(t,"muted",e?void 0:"false")}function GS(t){const e=F.c(36),{value:s,onChange:n,showMuted:i}=t,r=i===void 0?!1:i,l=le(),a=A.useId();let c;e[0]!==s?(c=Ase(s),e[0]=s,e[1]=c):c=e[1];const d=c;let u;e[2]!==s?(u=Ese(s),e[2]=s,e[3]=u):u=e[3];const h=u;let f;e[4]!==l?(f=l("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=l,e[5]=f):f=e[5];let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(o9,{size:14}),e[6]=m):m=e[6];let p;e[7]!==f?(p=o.jsx(os,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":f,children:m})}),e[7]=f,e[8]=p):p=e[8];let g;e[9]!==l?(g=l("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=l,e[10]=g):g=e[10];let x;e[11]!==g?(x=o.jsx(Dt,{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(Pse(s,KS(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=v):v=e[15];let _;e[16]===Symbol.for("react.memo_cache_sentinel")?(_=Vse.map(Dse),e[16]=_):_=e[16];let y;e[17]!==v||e[18]!==b?(y=o.jsx(Gf,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:v,children:_}),e[17]=v,e[18]=b,e[19]=y):y=e[19];let L;e[20]!==y||e[21]!==x?(L=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,y]}),e[20]=y,e[21]=x,e[22]=L):L=e[22];let w;e[23]!==h||e[24]!==a||e[25]!==n||e[26]!==r||e[27]!==l||e[28]!==s?(w=r&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(Dt,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),o.jsx(Ti,{id:a,checked:h,onCheckedChange:j=>n(Rse(s,j))})]}),e[23]=h,e[24]=a,e[25]=n,e[26]=r,e[27]=l,e[28]=s,e[29]=w):w=e[29];let S;e[30]!==L||e[31]!==w?(S=o.jsx(as,{align:"end",className:"w-auto min-w-52 p-3",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[L,w]})}),e[30]=L,e[31]=w,e[32]=S):S=e[32];let k;return e[33]!==S||e[34]!==p?(k=o.jsxs(cs,{children:[p,S]}),e[33]=S,e[34]=p,e[35]=k):k=e[35],k}function Dse(t){return o.jsx(Rc,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function YS(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function kb(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 Ise(t){const e=F.c(81),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=le(),d=s.format==="video-uri",u=$3(n),[h,f]=A.useState(!1),[m,p]=A.useState(!1),g=u?US(u):"",x=g?HS(g):"",b=e9(),v=D9();let _;e[0]!==b.data?.configs?(_=b.data?.configs??[],e[0]=b.data?.configs,e[1]=_):_=e[1];const y=a?.siteSlug;let L;e[2]!==_||e[3]!==y?(L=zu(_,y),e[2]=_,e[3]=y,e[4]=L):L=e[4];const w=L;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(Y){if(!Y)return;let q=Array.from(Y);if(q.length===0)return;if(d&&(q=q.filter(Mse),q.length===0)){ve.error(c("sectionsEditor.fileField.videoFileError"));return}const oe=YS(b.data?.configs??[],w?.id,typeof window<"u"?window.localStorage.getItem(I9):null);if(!oe){f(!0);return}try{const J=await v.mutateAsync({configId:oe,file:q[0]});i(J.publicUrl),q.length>1&&ve.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:q[0].name}))}catch(J){const ie=J;ve.error(ie instanceof Error?ie.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]!==p?(j=function(Y){Y.preventDefault(),Y.dataTransfer.types.includes("Files")&&p(!0)},e[13]=p,e[14]=j):j=e[14];const C=j;let T;e[15]!==p?(T=function(Y){Y.currentTarget===Y.target&&p(!1)},e[15]=p,e[16]=T):T=e[16];const N=T;let P;e[17]!==k||e[18]!==p?(P=function(Y){Y.preventDefault(),Y.stopPropagation(),p(!1),k(Y.dataTransfer.files)},e[17]=k,e[18]=p,e[19]=P):P=e[19];const V=P,E=a?.virtualMcpId;let R;e[20]!==l||e[21]!==r||e[22]!==s.description||e[23]!==E?(R=o.jsx("div",{className:"min-w-0",children:o.jsx(Fs,{htmlFor:r,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:E})}),e[20]=l,e[21]=r,e[22]=s.description,e[23]=E,e[24]=R):R=e[24];const I=m&&"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 $;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==u||e[33]!==c||e[34]!==v.isPending?($=u?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:u,preload:"metadata",className:"h-full w-full object-contain"},u),o.jsx(FS,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx(Vx,{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(kb,{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(Vi,{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:u})]}),o.jsx(kb,{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(Vx,{size:20}):o.jsx(Vi,{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]=u,e[33]=c,e[34]=v.isPending,e[35]=$):$=e[35];let M;e[36]!==m||e[37]!==c?(M=m&&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]=m,e[37]=c,e[38]=M):M=e[38];let z;e[39]!==N||e[40]!==C||e[41]!==V||e[42]!==O||e[43]!==$||e[44]!==M?(z=o.jsxs("div",{onDragOver:C,onDragLeave:N,onDrop:V,className:O,children:[$,M]}),e[39]=N,e[40]=C,e[41]=V,e[42]=O,e[43]=$,e[44]=M,e[45]=z):z=e[45];let B;e[46]!==i?(B=ee=>i(ee.target.value),e[46]=i,e[47]=B):B=e[47];let U;e[48]!==r||e[49]!==u||e[50]!==B?(U=o.jsx(vt,{id:r,type:"url",value:u,onChange:B,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=r,e[49]=u,e[50]=B,e[51]=U):U=e[51];let H;e[52]!==f||e[53]!==u||e[54]!==c?(H=!u&&o.jsxs(fe,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[o.jsx(Yn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=u,e[54]=c,e[55]=H):H=e[55];let W;e[56]!==d||e[57]!==i||e[58]!==u?(W=d&&u&&o.jsx(GS,{value:u,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=u,e[59]=W):W=e[59];let K;e[60]!==i||e[61]!==u||e[62]!==c?(K=u&&o.jsx(fe,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:o.jsx(nn,{size:14})}),e[60]=i,e[61]=u,e[62]=c,e[63]=K):K=e[63];let Q;e[64]!==U||e[65]!==H||e[66]!==W||e[67]!==K?(Q=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]=Q):Q=e[68];let X;e[69]!==i?(X=ee=>i(ee),e[69]=i,e[70]=X):X=e[70];const se=w?.id??null;let ne;e[71]!==h||e[72]!==f||e[73]!==X||e[74]!==se?(ne=o.jsx(BS,{open:h,onOpenChange:f,mode:"any",onSelect:X,lockedConfigId:se}),e[71]=h,e[72]=f,e[73]=X,e[74]=se,e[75]=ne):ne=e[75];let te;return e[76]!==z||e[77]!==Q||e[78]!==ne||e[79]!==R?(te=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[R,z,Q,ne]}),e[76]=z,e[77]=Q,e[78]=ne,e[79]=R,e[80]=te):te=e[80],te}function Mse(t){return t.type.startsWith("video/")}const Ose=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function $se(t){const e=F.c(86),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=le(),d=$3(n),[u,h]=A.useState(!1),[f,m]=A.useState(!1),[p,g]=A.useState(!1),[x,b]=A.useState(!1),v=d?US(d):"",_=v?HS(v):"",y=e9(),L=D9();let w;e[0]!==y.data?.configs?(w=y.data?.configs??[],e[0]=y.data?.configs,e[1]=w):w=e[1];const S=a?.siteSlug;let k;e[2]!==w||e[3]!==S?(k=zu(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(Z){g(!1),b(!1),i(Z)},e[5]=i,e[6]=b,e[7]=g,e[8]=C):C=e[8];const T=C;let N;e[9]!==y.data?.configs||e[10]!==j?.id||e[11]!==h||e[12]!==T||e[13]!==c||e[14]!==L?(N=async function(Z){if(!Z)return;const he=Array.from(Z).filter(Bse);if(he.length===0){ve.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const de=YS(y.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(I9):null);if(!de){h(!0);return}try{const ae=await L.mutateAsync({configId:de,file:he[0]});T(ae.publicUrl),he.length>1&&ve.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:he[0].name}))}catch(ae){const ce=ae;ve.error(ce instanceof Error?ce.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=y.data?.configs,e[10]=j?.id,e[11]=h,e[12]=T,e[13]=c,e[14]=L,e[15]=N):N=e[15];const P=N;let V;e[16]!==m?(V=function(Z){Z.preventDefault(),Z.dataTransfer.types.includes("Files")&&m(!0)},e[16]=m,e[17]=V):V=e[17];const E=V;let R;e[18]!==m?(R=function(Z){Z.currentTarget===Z.target&&m(!1)},e[18]=m,e[19]=R):R=e[19];const I=R;let D;e[20]!==P||e[21]!==m?(D=function(Z){Z.preventDefault(),Z.stopPropagation(),m(!1),P(Z.dataTransfer.files)},e[20]=P,e[21]=m,e[22]=D):D=e[22];const O=D,$=a?.virtualMcpId;let M;e[23]!==l||e[24]!==r||e[25]!==s.description||e[26]!==$?(M=o.jsx("div",{className:"min-w-0",children:o.jsx(Fs,{htmlFor:r,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:$})}),e[23]=l,e[24]=r,e[25]=s.description,e[26]=$,e[27]=M):M=e[27];const z=f&&"border-primary ring-2 ring-primary/30",B=L.isPending&&"pointer-events-none opacity-60";let U;e[28]!==z||e[29]!==B?(U=re("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",z,B),e[28]=z,e[29]=B,e[30]=U):U=e[30];let H;e[31]!==_||e[32]!==v||e[33]!==x||e[34]!==p||e[35]!==l||e[36]!==b||e[37]!==g||e[38]!==h||e[39]!==d||e[40]!==c||e[41]!==L.isPending?(H=d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>h(!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:l,className:re("h-full w-full object-contain transition-opacity",!p&&"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(ki,{size:20}),o.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!x&&o.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),o.jsx(FS,{})]}),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}),_&&o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:_})]})]}):o.jsxs("button",{type:"button",onClick:()=>h(!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(ki,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:L.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]=_,e[32]=v,e[33]=x,e[34]=p,e[35]=l,e[36]=b,e[37]=g,e[38]=h,e[39]=d,e[40]=c,e[41]=L.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]!==E||e[48]!==O||e[49]!==U||e[50]!==H||e[51]!==W?(K=o.jsxs("div",{onDragOver:E,onDragLeave:I,onDrop:O,className:U,children:[H,W]}),e[46]=I,e[47]=E,e[48]=O,e[49]=U,e[50]=H,e[51]=W,e[52]=K):K=e[52];let Q;e[53]!==T?(Q=ie=>T(ie.target.value),e[53]=T,e[54]=Q):Q=e[54];let X;e[55]!==c?(X=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=X):X=e[56];let se;e[57]!==r||e[58]!==d||e[59]!==Q||e[60]!==X?(se=o.jsx(vt,{id:r,type:"url",value:d,onChange:Q,placeholder:X,className:"h-9 min-w-0 flex-1"}),e[57]=r,e[58]=d,e[59]=Q,e[60]=X,e[61]=se):se=e[61];let ne;e[62]!==h||e[63]!==d||e[64]!==c?(ne=!d&&o.jsxs(fe,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!0),className:"h-9 shrink-0",children:[o.jsx(Yn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=h,e[63]=d,e[64]=c,e[65]=ne):ne=e[65];let te;e[66]!==T||e[67]!==d||e[68]!==c?(te=d&&o.jsxs(o.Fragment,{children:[o.jsx(GS,{value:d,onChange:T}),o.jsx(fe,{type:"button",variant:"ghost",size:"sm",onClick:()=>T(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:o.jsx(nn,{size:14})})]}),e[66]=T,e[67]=d,e[68]=c,e[69]=te):te=e[69];let ee;e[70]!==se||e[71]!==ne||e[72]!==te?(ee=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[se,ne,te]}),e[70]=se,e[71]=ne,e[72]=te,e[73]=ee):ee=e[73];let Y;e[74]!==T?(Y=ie=>T(ie),e[74]=T,e[75]=Y):Y=e[75];const q=j?.id??null;let oe;e[76]!==u||e[77]!==h||e[78]!==Y||e[79]!==q?(oe=o.jsx(BS,{open:u,onOpenChange:h,mode:"image",onSelect:Y,lockedConfigId:q}),e[76]=u,e[77]=h,e[78]=Y,e[79]=q,e[80]=oe):oe=e[80];let J;return e[81]!==M||e[82]!==K||e[83]!==ee||e[84]!==oe?(J=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]=J):J=e[85],J}function Bse(t){return Ose.has(t.type||"")}const zse="0 0 1080 1080",Fse="matrix(1 0 0 1 540 540)",H3=[{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 Use({selected:t,onSelect:e}){const s=le(),[n,i]=A.useState(zse),r=l=>{if(l)try{const a=l.getBBox();if(!a.width||!a.height)return;const c=Math.max(a.width,a.height)*.04,d=`${a.x-c} ${a.y-c} ${a.width+c*2} ${a.height+c*2}`;i(u=>u===d?u: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:Fse,children:H3.map(l=>{const a=l.code===t;return o.jsx("g",{transform:l.gTransform,children:o.jsx("path",{d:l.d,transform:l.pathTransform,role:"button",tabIndex:0,"aria-label":l.name,"aria-pressed":a,onClick:()=>e(l.code),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),e(l.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",a?"fill-primary":"fill-muted-foreground/40")})},l.code)})})})}const Hse=[{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"}],Kse="BR";function Wse(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 qse(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 Gse(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function jb(t){const e=F.c(37),{id:s,options:n,value:i,placeholder:r,emptyMessage:l,onChange:a}=t,[c,d]=A.useState(!1);let u;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],u=n.find(S),e[0]=n,e[1]=i,e[2]=u}else u=e[2];const h=u;let f;e[5]!==r||e[6]!==h?(f=h?o.jsx("span",{className:"truncate",children:h.label}):o.jsx("span",{className:"text-muted-foreground",children:r}),e[5]=r,e[6]=h,e[7]=f):f=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(i9,{className:"size-4 shrink-0 opacity-50"}),e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==c||e[11]!==f?(p=o.jsx(os,{asChild:!0,children:o.jsxs(fe,{id:s,variant:"outline",role:"combobox","aria-expanded":c,className:"h-10 w-full justify-between font-normal",children:[f,m]})}),e[9]=s,e[10]=c,e[11]=f,e[12]=p):p=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(di,{placeholder:r,className:"h-9"}),e[14]=r,e[15]=x):x=e[15];let b;e[16]!==l?(b=o.jsx($n,{children:l}),e[16]=l,e[17]=b):b=e[17];let v;if(e[18]!==a||e[19]!==n||e[20]!==i){let S;e[22]!==a||e[23]!==i?(S=k=>o.jsxs(ls,{value:`${k.label} ${k.value}`,onSelect:()=>{a(k.value===i?"":k.value),d(!1)},children:[o.jsx("span",{className:"truncate",children:k.label}),o.jsx($t,{className:re("ml-auto size-4 shrink-0",i===k.value?"opacity-100":"opacity-0")})]},k.value),e[22]=a,e[23]=i,e[24]=S):S=e[24],v=n.map(S),e[18]=a,e[19]=n,e[20]=i,e[21]=v}else v=e[21];let _;e[25]!==v?(_=o.jsx(Ps,{children:v}),e[25]=v,e[26]=_):_=e[26];let y;e[27]!==b||e[28]!==_?(y=o.jsxs(ui,{children:[b,_]}),e[27]=b,e[28]=_,e[29]=y):y=e[29];let L;e[30]!==y||e[31]!==x?(L=o.jsx(as,{className:"p-0",style:g,children:o.jsxs(Ii,{children:[x,y]})}),e[30]=y,e[31]=x,e[32]=L):L=e[32];let w;return e[33]!==c||e[34]!==L||e[35]!==p?(w=o.jsxs(cs,{open:c,onOpenChange:d,children:[p,L]}),e[33]=c,e[34]=L,e[35]=p,e[36]=w):w=e[36],w}const Yse=Hse.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),Jse=H3.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function JS(t){const e=F.c(66),{schema:s,value:n,onChange:i,path:r,sandbox:l}=t,a=le();let c;e[0]!==n?(c=qse(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:u,regionCode:h,country:f}=d;let m;e[2]!==s.properties?(m=s.properties??{},e[2]=s.properties,e[3]=m):m=e[3];const p=m;let g;e[4]!==p.country?.title||e[5]!==a?(g=p.country?.title??a("sectionsEditor.locationField.countryDefault"),e[4]=p.country?.title,e[5]=a,e[6]=g):g=e[6];const x=g;let b;e[7]!==p.regionCode?.title||e[8]!==a?(b=p.regionCode?.title??a("sectionsEditor.locationField.regionDefault"),e[7]=p.regionCode?.title,e[8]=a,e[9]=b):b=e[9];const v=b;let _;e[10]!==p.city?.title||e[11]!==a?(_=p.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=p.city?.title,e[11]=a,e[12]=_):_=e[12];const y=_;let L;e[13]!==d||e[14]!==i?(L=j=>{i(Gse(d,j))},e[13]=d,e[14]=i,e[15]=L):L=e[15];const w=L,S=f===Kse;let k;if(e[16]!==u||e[17]!==y||e[18]!==f||e[19]!==x||e[20]!==w||e[21]!==S||e[22]!==r||e[23]!==h||e[24]!==v||e[25]!==l?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==a){let j;e[30]!==h?(j=U=>U.code===h,e[30]=h,e[31]=j):j=e[31];const C=H3.find(j),T=`${r}.country`;let N;e[32]!==s.title||e[33]!==a?(N=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=N):N=e[34];const P=l?.virtualMcpId;let V;e[35]!==s.description||e[36]!==N||e[37]!==P||e[38]!==T?(V=o.jsx(Fs,{htmlFor:T,label:N,description:s.description,virtualMcpId:P}),e[35]=s.description,e[36]=N,e[37]=P,e[38]=T,e[39]=V):V=e[39];const E=`${r}.country`;let R;e[40]!==x||e[41]!==E?(R=o.jsx(Dt,{htmlFor:E,className:"text-xs",children:x}),e[40]=x,e[41]=E,e[42]=R):R=e[42];const I=`${r}.country`;let D;e[43]!==a?(D=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=D):D=e[44];let O;e[45]!==a?(O=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=O):O=e[46];let $;e[47]!==w?($=U=>w({country:U,regionCode:"",city:""}),e[47]=w,e[48]=$):$=e[48];let M;e[49]!==f||e[50]!==I||e[51]!==D||e[52]!==O||e[53]!==$?(M=o.jsx(jb,{id:I,options:Yse,value:f,placeholder:D,emptyMessage:O,onChange:$}),e[49]=f,e[50]=I,e[51]=D,e[52]=O,e[53]=$,e[54]=M):M=e[54];let z;e[55]!==R||e[56]!==M?(z=o.jsxs("div",{className:"space-y-1.5",children:[R,M]}),e[55]=R,e[56]=M,e[57]=z):z=e[57];let B;e[58]!==f||e[59]!==w||e[60]!==S||e[61]!==r||e[62]!==h||e[63]!==v||e[64]!==a?(B=f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Dt,{htmlFor:`${r}.regionCode`,className:"text-xs",children:v}),S?o.jsxs("div",{className:"space-y-2",children:[o.jsx(Use,{selected:h,onSelect:U=>w({regionCode:U===h?"":U,city:""})}),o.jsx(jb,{id:`${r}.regionCode`,options:Jse,value:h,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:U=>w({regionCode:U,city:""})})]}):o.jsxs(o.Fragment,{children:[o.jsx(vt,{id:`${r}.regionCode`,type:"text",value:h,placeholder:a("sectionsEditor.locationField.regionCodePlaceholder"),onChange:U=>w({regionCode:U.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.regionCodeHelperText")})]})]}),e[58]=f,e[59]=w,e[60]=S,e[61]=r,e[62]=h,e[63]=v,e[64]=a,e[65]=B):B=e[65],k=o.jsxs("div",{className:"space-y-4",children:[V,z,B,f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Dt,{htmlFor:`${r}.city`,className:"text-xs",children:y}),o.jsx(vt,{id:`${r}.city`,type:"text",value:u,placeholder:S&&C?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:C.name}):a("sectionsEditor.locationField.cityPlaceholder"),onChange:U=>w({city:U.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=u,e[17]=y,e[18]=f,e[19]=x,e[20]=w,e[21]=S,e[22]=r,e[23]=h,e[24]=v,e[25]=l?.virtualMcpId,e[26]=s.description,e[27]=s.title,e[28]=a,e[29]=k}else k=e[29];return k}function Qse(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 Xse(t){const e=F.c(52),s=le(),{schema:n,value:i,onChange:r,path:l,label:a}=t;let c,d;e[0]!==n.inlineUnionBranches||e[1]!==i?(c=n.inlineUnionBranches??[],d=kS(i,c.map(Zse)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const u=d,[h,f]=A.useState(u),[m,p]=A.useState(u);m!==u&&(p(u),f(u));const g=Math.min(h,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 _;e[7]!==x?(_=x?Qse(x):null,e[7]=x,e[8]=_):_=e[8];const y=_;let L;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],L=cte(i,Object.keys(D)),e[9]=x?.schema?.properties,e[10]=i,e[11]=L}else L=e[11];const w=L;let S;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(S=a&&o.jsx(Fs,{htmlFor:l,label:a,description:n.description,virtualMcpId:t.sandbox?.virtualMcpId}),e[14]=a,e[15]=l,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(Rs,{placeholder:j}),e[21]=j,e[22]=C):C=e[22];let T;e[23]!==l||e[24]!==C?(T=o.jsx(Ss,{id:l,className:"w-full min-w-0",children:C}),e[23]=l,e[24]=C,e[25]=T):T=e[25];let N;if(e[26]!==c||e[27]!==s){let D;e[29]!==s?(D=(O,$)=>o.jsx(It,{value:String($),children:mte(O.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:$+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 P;e[31]!==N?(P=o.jsx(ks,{children:N}),e[31]=N,e[32]=P):P=e[32];let V;e[33]!==v||e[34]!==P||e[35]!==k||e[36]!==T?(V=o.jsxs(ws,{value:k,onValueChange:v,children:[T,P]}),e[33]=v,e[34]=P,e[35]=k,e[36]=T,e[37]=V):V=e[37];let E;e[38]!==V||e[39]!==S?(E=o.jsxs("div",{className:"space-y-1.5",children:[S,V]}),e[38]=V,e[39]=S,e[40]=E):E=e[40];let R;e[41]!==x||e[42]!==y||e[43]!==r||e[44]!==l||e[45]!==w||e[46]!==t||e[47]!==i?(R=x&&(Wse(x.schema?.properties)?o.jsx(JS,{...t,schema:x.schema,onChange:D=>r({...w,...D,...x.discriminators??{}})}):y?o.jsx($i,{schema:y,value:i,onChange:D=>r({...D,...x.discriminators??{}}),basePath:l,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]=y,e[43]=r,e[44]=l,e[45]=w,e[46]=t,e[47]=i,e[48]=R):R=e[48];let I;return e[49]!==E||e[50]!==R?(I=o.jsxs("div",{className:"space-y-3",children:[E,R]}),e[49]=E,e[50]=R,e[51]=I):I=e[51],I}function Zse(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const ene={lat:-21.9,lng:-41.42},up=1e5;let oh=null;function tne(t){return oh||(oh=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 a=window.google?.maps;a?e(a):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 l=document.createElement("script");l.src=`https://maps.googleapis.com/maps/api/js?key=${t}&v=weekly&libraries=maps`,l.async=!0,l.defer=!0,l.dataset.googleMapsLoader="true",l.addEventListener("load",i),l.addEventListener("error",()=>s(new Error("Failed to load Google Maps"))),document.head.appendChild(l)}),oh)}function sne(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:up}}function nne({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r}){const l=Sc().googleMapsApiKey,a=A.useRef(s);a.current=s;const c=A.useRef(sne(e)),[d,u]=A.useState(null),h=A.useRef(null),f=m=>{if(!m||!l)return;const p={disposed:!1,circle:null,listeners:[]};return tne(l).then(g=>{if(p.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:ene,v=x?.radius??up,_=new g.Map(m,{center:b,zoom:v?Math.round(Math.log2(768e4/v))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),y=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:_,center:b,radius:v});p.circle=y;const L=()=>{const S=y.getCenter(),k=y.getRadius();S&&a.current(`${S.lat()},${S.lng()},${k}`)},w=S=>{S&&p.listeners.push(S)};w(_.addListener("click",S=>{S.latLng&&(y.setCenter({lat:S.latLng.lat(),lng:S.latLng.lng()}),y.getRadius()||y.setRadius(up),L())})),w(y.addListener("radius_changed",L)),w(y.addListener("dragend",L))},g=>{p.disposed||u(g instanceof Error?g.message:"Failed to load map")}),()=>{p.disposed=!0;for(const g of p.listeners)try{g?.remove()}catch{}if(p.listeners=[],p.circle){try{p.circle.setMap(null)}catch{}p.circle=null}}};return h.current||(h.current=f),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Fs,{htmlFor:n,label:i,description:t.description,virtualMcpId:r?.virtualMcpId}),l?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:h.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 ine="oklch(0.65 0.15 160)",rne="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)]",QS="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)]",Dpe="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 Cb(t){return t.map(e=>e.label).join(`
624
- `)}function Nb(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function one(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 lne(t){return t.map((e,s)=>({...e,index:s}))}function XS(t){const e=F.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:l,onDelete:a}=t,c=le(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=re("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=u):u=e[1];let h;e[2]!==u?(h=o.jsx(Uf,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx($o,{className:"h-4 w-4 shrink-0",style:{color:ine}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==r||e[13]!==c?(p=!i&&o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{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:cne,onPointerDown:ane,children:o.jsx(li,{size:14})})}),o.jsxs(Kt,{align:"end",children:[r&&o.jsxs(Je,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(T6,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Je,{onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(hn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Je,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(nn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=r,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==h||e[16]!==m||e[17]!==p?(g=o.jsxs(o.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function ane(t){return t.stopPropagation()}function cne(t){return t.stopPropagation()}function dne(t){const e=F.c(27),{entry:s,selected:n,canDelete:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:une},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=Fg(d);let g;e[2]!==m?(g=fr.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?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 _;e[7]!==r?(_=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())},e[7]=r,e[8]=_):_=e[8];const y=p?"cursor-grabbing":"cursor-grab",L=n?QS:rne;let w;e[9]!==y||e[10]!==L?(w=re("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",y,L),e[9]=y,e[10]=L,e[11]=w):w=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(S=o.jsx(XS,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=S):S=e[17];let k;return e[18]!==u||e[19]!==h||e[20]!==r||e[21]!==f||e[22]!==v||e[23]!==_||e[24]!==w||e[25]!==S?(k=o.jsx("div",{ref:f,style:v,...u,...h,onClick:r,onKeyDown:_,className:w,children:S}),e[18]=u,e[19]=h,e[20]=r,e[21]=f,e[22]=v,e[23]=_,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function une(){return!1}function hne(t){const e=F.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=le(),m=n.length>1;let p;e[0]!==n?(p=()=>Nb(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=A.useState(p),[b,v]=A.useState(null),[_,y]=A.useState(s),[L,w]=A.useState(n.length);let S;e[2]!==n?(S=()=>Cb(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=A.useState(S),C=A.useRef(!1),T=Cb(n);_!==s?(y(s),w(n.length),j(T),x(Nb(n))):(L!==n.length||k!==T)&&(w(n.length),j(T),x(ae=>one(ae,n)));let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N={activationConstraint:{distance:8}},e[4]=N):N=e[4];let P;e[5]===Symbol.for("react.memo_cache_sentinel")?(P={coordinateGetter:Ug},e[5]=P):P=e[5];const V=Rg(Mc(c0,N),Mc(a0,P));let E;e[6]!==g?(E=g.map(fne),e[6]=g,e[7]=E):E=e[7];const R=E;let I;e[8]!==g?(I=ae=>{const ce=String(ae.active.id);v(g.find(ue=>ue.id===ce)??null)},e[8]=g,e[9]=I):I=e[9];const D=I;let O;e[10]!==R||e[11]!==u?(O=ae=>{v(null);const{active:ce,over:ue}=ae;if(!ue||ce.id===ue.id)return;const G=R.indexOf(String(ce.id)),me=R.indexOf(String(ue.id));G===-1||me===-1||(x(ye=>lne(Oc([...ye],G,me))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),u(G,me))},e[10]=R,e[11]=u,e[12]=O):O=e[12];const $=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const z=M;let B,U,H,W,K,Q,X,se,ne,te,ee,Y,q;if(e[14]!==m||e[15]!==g||e[16]!==R||e[17]!==$||e[18]!==D||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==r||e[25]!==i||e[26]!==V||e[27]!==f){const ae=Be=>{C.current||r(Be)};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 ue;e[43]!==ce?(ue=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ce}),e[43]=ce,e[44]=ue):ue=e[44];let G;e[45]!==f?(G=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=G):G=e[46];let me;e[47]===Symbol.for("react.memo_cache_sentinel")?(me=o.jsx(Gt,{size:14}),e[47]=me):me=e[47];let ye;e[48]!==h||e[49]!==G?(ye=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":G,className:"size-6",onClick:h,children:me})}),e[48]=h,e[49]=G,e[50]=ye):ye=e[50];let we;e[51]!==f?(we=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=we):we=e[52];let Ne;e[53]!==we?(Ne=o.jsx(We,{children:we}),e[53]=we,e[54]=Ne):Ne=e[54];let je;e[55]!==ye||e[56]!==Ne?(je=o.jsxs(qe,{children:[ye,Ne]}),e[55]=ye,e[56]=Ne,e[57]=je):je=e[57];let _e;e[58]!==f?(_e=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=_e):_e=e[59];let Ve;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ve=o.jsx(nn,{size:14}),e[60]=Ve):Ve=e[60];let xe;e[61]!==d||e[62]!==_e?(xe=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":_e,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Ve})}),e[61]=d,e[62]=_e,e[63]=xe):xe=e[63];let Se;e[64]!==f?(Se=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Se):Se=e[65];let Ce;e[66]!==Se?(Ce=o.jsx(We,{children:Se}),e[66]=Se,e[67]=Ce):Ce=e[67];let Ae;e[68]!==xe||e[69]!==Ce?(Ae=o.jsxs(qe,{children:[xe,Ce]}),e[68]=xe,e[69]=Ce,e[70]=Ae):Ae=e[70];let st;e[71]!==je||e[72]!==Ae?(st=o.jsxs("div",{className:"flex items-center gap-0.5",children:[je,Ae]}),e[71]=je,e[72]=Ae,e[73]=st):st=e[73],e[74]!==ue||e[75]!==st?(Y=o.jsxs("div",{className:"flex items-center justify-between",children:[ue,st]}),e[74]=ue,e[75]=st,e[76]=Y):Y=e[76],U=Og,Q=V,X=v_,se=D,ne=$,te=z,B=zg,W=R,K=Bg,q="space-y-0.5",H=g.map(Be=>o.jsx(dne,{entry:Be,selected:Be.index===i,canDelete:m,onSelect:()=>ae(Be.index),onRename:l?()=>l(Be.index):void 0,onDuplicate:()=>a(Be.index),onDelete:()=>c(Be.index)},Be.id)),e[14]=m,e[15]=g,e[16]=R,e[17]=$,e[18]=D,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=r,e[25]=i,e[26]=V,e[27]=f,e[28]=B,e[29]=U,e[30]=H,e[31]=W,e[32]=K,e[33]=Q,e[34]=X,e[35]=se,e[36]=ne,e[37]=te,e[38]=ee,e[39]=Y,e[40]=q}else B=e[28],U=e[29],H=e[30],W=e[31],K=e[32],Q=e[33],X=e[34],se=e[35],ne=e[36],te=e[37],ee=e[38],Y=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 J;e[80]!==B||e[81]!==W||e[82]!==K||e[83]!==oe?(J=o.jsx(B,{items:W,strategy:K,children:oe}),e[80]=B,e[81]=W,e[82]=K,e[83]=oe,e[84]=J):J=e[84];let ie;e[85]!==b||e[86]!==m?(ie=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",QS),children:o.jsx(XS,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=ie):ie=e[87];let Z;e[88]!==ie?(Z=In.createPortal(o.jsx($g,{dropAnimation:yS,children:ie}),document.body),e[88]=ie,e[89]=Z):Z=e[89];let he;e[90]!==U||e[91]!==Q||e[92]!==X||e[93]!==se||e[94]!==ne||e[95]!==te||e[96]!==J||e[97]!==Z?(he=o.jsxs(U,{sensors:Q,collisionDetection:X,onDragStart:se,onDragEnd:ne,onDragCancel:te,children:[J,Z]}),e[90]=U,e[91]=Q,e[92]=X,e[93]=se,e[94]=ne,e[95]=te,e[96]=J,e[97]=Z,e[98]=he):he=e[98];let de;return e[99]!==ee||e[100]!==Y||e[101]!==he?(de=o.jsxs("div",{className:ee,children:[Y,he]}),e[99]=ee,e[100]=Y,e[101]=he,e[102]=de):de=e[102],de}function fne(t){return t.id}const mne=[[/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"]],pne={"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 E1(t){return sa(t)!==void 0}function K3(t,e){if(e){if(E1(e))return e;const s=pne[e];if(s&&E1(s))return s}for(const[s,n]of mne)if(s.test(t)&&E1(n))return n;return"FilterLines"}function gne(t){return sa(t)??M2}function R1(t){const e=F.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let l;e[0]!==s?(l=gne(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=r==="sm"?"size-7":"size-9",d=r==="sm"?16:18;let u;e[2]!==c||e[3]!==i?(u=re("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let h;e[5]!==a||e[6]!==d?(h=o.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=o.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function Ipe(t,e){return rX(t,e).map(s=>{const n=e[s.blockKey]??{},i=Ew(aX(s.blockKey),e,t);return{blockKey:s.blockKey,title:Fl(s.blockKey,n),description:zc(i),iconName:K3(s.matcherResolveType)}})}const ZS="Users03";function xne(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function bne(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 l of Object.keys(r)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=ll(l,t);s.push({resolveType:l,title:a.title??gs(l),description:a.description,iconName:K3(l,a.icon)})}return s}function vne(t,e){if(!t)return ZS;const s=e.find(n=>n.resolveType===t);return s?s.iconName:K3(t)}function yne(t){const e=F.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=A.useState(!1),f=le(),p=(i?d.find(Y=>Y.blockKey===i):void 0)?.iconName??vne(s,r),g=sa(p);let x;e[0]!==a||e[1]!==h?(x=Y=>{a(Y),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==h?(v=Y=>{c?.(Y),h(!1)},e[3]=c,e[4]=h,e[5]=v):v=e[5];const _=v;let y;e[6]!==h?(y=()=>h(!0),e[6]=h,e[7]=y):y=e[7];let L;e[8]!==g?(L=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=L):L=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(bs,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==y||e[14]!==L||e[15]!==w?(k=o.jsxs("button",{type:"button",onClick:y,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:[L,w,S]}),e[13]=y,e[14]=L,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 T;e[21]!==f?(T=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=T):T=e[22];let N;e[23]!==T?(N=o.jsx(di,{placeholder:T}),e[23]=T,e[24]=N):N=e[24];let P;e[25]!==f?(P=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=P):P=e[26];let V;e[27]!==P?(V=o.jsx($n,{children:P}),e[27]=P,e[28]=V):V=e[28];let E;e[29]!==f?(E=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=E):E=e[30];let R;e[31]!==f?(R=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=R):R=e[32];const I=`${E} ${R}`;let D;e[33]!==b?(D=()=>b(""),e[33]=b,e[34]=D):D=e[34];const O=!s&&!i&&"bg-accent/60";let $;e[35]!==O?($=re("gap-2.5",O),e[35]=O,e[36]=$):$=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(R1,{iconName:ZS,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 B;e[40]!==z?(B=o.jsx("span",{className:"text-sm",children:z}),e[40]=z,e[41]=B):B=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]!==B||e[47]!==H?(W=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[B,H]}),e[46]=B,e[47]=H,e[48]=W):W=e[48];let K;e[49]!==I||e[50]!==D||e[51]!==$||e[52]!==W?(K=o.jsxs(ls,{value:I,onSelect:D,className:$,children:[M,W]}),e[49]=I,e[50]=D,e[51]=$,e[52]=W,e[53]=K):K=e[53];let Q;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let Y;e[59]!==i||e[60]!==s||e[61]!==b?(Y=q=>o.jsxs(ls,{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(R1,{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]=Y):Y=e[62],Q=r.map(Y),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=Q}else Q=e[58];let X;e[63]!==K||e[64]!==Q?(X=o.jsxs(Ps,{children:[K,Q]}),e[63]=K,e[64]=Q,e[65]=X):X=e[65];let se;e[66]!==i||e[67]!==d||e[68]!==_||e[69]!==f?(se=d.length>0&&o.jsx(Ps,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(Y=>o.jsxs(ls,{value:`${Y.title} ${Y.blockKey} ${Y.description??""}`,onSelect:()=>_(Y.blockKey),className:re("gap-2.5",i===Y.blockKey&&"bg-accent/60"),children:[o.jsx(R1,{iconName:Y.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:Y.title}),Y.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Y.description})]})]},Y.blockKey))}),e[66]=i,e[67]=d,e[68]=_,e[69]=f,e[70]=se):se=e[70];let ne;e[71]!==V||e[72]!==X||e[73]!==se?(ne=o.jsxs(ui,{children:[V,X,se]}),e[71]=V,e[72]=X,e[73]=se,e[74]=ne):ne=e[74];let te;e[75]!==u||e[76]!==h||e[77]!==C||e[78]!==N||e[79]!==ne||e[80]!==j?(te=o.jsxs(dP,{open:u,onOpenChange:h,title:j,description:C,className:"sm:max-w-lg",filter:xne,children:[N,ne]}),e[75]=u,e[76]=h,e[77]=C,e[78]=N,e[79]=ne,e[80]=j,e[81]=te):te=e[81];let ee;return e[82]!==te||e[83]!==k?(ee=o.jsxs(o.Fragment,{children:[k,te]}),e[82]=te,e[83]=k,e[84]=ee):ee=e[84],ee}const _ne="website/sections/Rendering/Lazy.tsx";function vf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function W3(t){if(!vf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&js(e)}function Lne(t){return t!=null}function hp(t){if(t==null)return t;if(W3(t)){const e=t.section;return e==null?null:vf(e)?e:{}}return vf(t)?t:void 0}function wne(t,e){return t===null?null:W3(e)?{...e,section:t}:t}function Mpe(t){return{__resolveType:t}}function Ope(t,e){if(!Lne(e))return null;if(t){const s=hp(e)??{};return{__resolveType:_ne,section:s}}return W3(e)?hp(e)??null:vf(e)?e:null}const Sne="General";function Fc(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function ek(t,e){return t===el?Sne:e}function tk(t){const e=lf(t),s=new Set,n=[];for(const i of e)Fc(i.resolveType)&&(ri(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:ek(i.resolveType,i.title),description:i.description})));return n}function q3(t){const e=of(t),s=Bn(e,t),n=tk(s?.properties?.seo);return n.length>0?n:kne(t)}function kne(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(!Fc(r))continue;const l=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:ek(r,l)})}return s}function sk(t){const e=q3(t),s=e.find(n=>n.resolveType===el);return s?s.resolveType:e[0]?.resolveType??el}function nk(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=Bn(s,t),i=tk(n?.properties?.seo);if(i.length>0)return i}return q3(t)}function jne(t,e){const s=nk(t,e),n=s.find(i=>i.resolveType===el);return n?n.resolveType:s[0]?.resolveType??sk(t)}function Cne(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:sk(t)}function Nne(t,e,s){const n=s.__resolveType;return typeof n=="string"&&Fc(n)?n:jne(t,e)}const Vne=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),el="website/sections/Seo/SeoV2.tsx",Tne=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function ru(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ane(t){return typeof t.__resolveType=="string"&&Fc(t.__resolveType)?!0:Tne.some(e=>e in t)}function Pne(t,e){for(const[s,n]of Object.entries(t)){if(!ru(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&Vne.has(r))continue;const l=i.seo;if(ru(l)){const a=l;if(Ane(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Nne(e,i,a):typeof a.__resolveType=="string"&&Fc(a.__resolveType)?a.__resolveType:el}}}for(const[s,n]of Object.entries(t)){if(!ru(n))continue;const i=n;if(typeof i.__resolveType=="string"&&Fc(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Ene(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function $pe(t,e,s){if(e.kind==="site"){const c=Pne(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?nk(s,c.blockData):void 0,build:d=>Ene(c,d)}:null}const n=t[e.pageKey];if(!ru(n))return null;const i=n,r=i.seo,l=hp(r),a=l&&ru(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:r,seoResolveType:s?Cne(s,a):typeof a?.__resolveType=="string"?a.__resolveType:el,seoTypeOptions:s?q3(s):void 0,build:c=>({...i,seo:c===null?null:wne(c,r)})}}const G3=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],Rne=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Dne=["jsonLD","title","description","noIndexing","configJsonLD"];function ik(t){return t===el||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Ine(t){switch(t){case"general":return G3;case"pdp":return Rne;case"plp":return Dne;default:return null}}function rk(t,e){const s=Ine(ik(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 Mne(){return G3.filter(t=>t!=="type")}function One(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function $ne(t,e){return t[e]===void 0}function Bne(t){const e=F.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:l}=t,a=le(),d=rk(s,el).properties??{},u=Mne();let h;e[0]!==r?(h=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=h):h=e[1];const f=h,[m,p]=A.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=A.useState(g);m!==l&&(p(l),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:$ne(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const _=v;let y;e[6]!==i||e[7]!==r||e[8]!==n?(y=(j,C)=>{b(N=>({...N,[j]:C}));const T={...n};if(C)delete T[j];else{const N=r?.[j];T[j]=N??(j==="type"?"website":"")}i(T)},e[6]=i,e[7]=r,e[8]=n,e[9]=y):y=e[9];const L=y,w="min-w-0 space-y-6",S=G3.map(j=>{const C=d[j];if(!C)return null;const T=f&&u.includes(j),N=T&&_(j),P=N?r?.[j]??n[j]:n[j],V=C.title??One(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:re(N&&"pointer-events-none opacity-60"),children:Kl({schema:C,value:P,onChange:E=>{N||i({...n,[j]:E})},path:j,label:V,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:zne})}),T&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ti,{id:`seo-use-default-${j}`,checked:N,onCheckedChange:E=>L(j,E)}),o.jsx(Dt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==l||e[11]!==S?(k=o.jsx("div",{className:w,children:S},l),e[10]=l,e[11]=S,e[12]=k):k=e[12],k}function zne(){}function Fne(t){const e=F.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(ik(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,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(Bne,{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 u;e[8]!==n||e[9]!==s?(u=rk(s,n),e[8]=n,e[9]=s,e[10]=u):u=e[10];const h=u;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=a??Une;let p;return e[12]!==h||e[13]!==r||e[14]!==l||e[15]!==m||e[16]!==i?(p=o.jsx($i,{schema:h,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},r),e[12]=h,e[13]=r,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function Une(){}function Hne(t){const e=F.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=le();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u);let m;e[1]!==h||e[2]!==d?(m=h.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($h,{className:"size-3.5"})}),h.map((x,b)=>{const v=b===h.length-1,_=kn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(h.slice(0,b+1)),title:_,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:_})]},`${_}-${b}`)})]}),e[1]=h,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==h||e[5]!==l||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=o.jsx($i,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:h,onBreadcrumbChange:f,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=h,e[5]=l,e[6]=r,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Bpe(t){const e=F.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:u,siteDefaultSeo:h,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const _=v;let y;e[2]!==s||e[3]!==_||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==r||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==u||e[15]!==h?(y=s&&n?u?o.jsx(Fne,{schema:s,resolveType:u,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:l,siteDefaultSeo:h}):o.jsx($i,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:_,onBreadcrumbChange:l,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=_,e[4]=m,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=r,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=u,e[15]=h,e[16]=y):y=e[16];const L=y;let w;e[17]!==c||e[18]!==L?(w=L??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=L,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 zpe="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 Fpe(t,e){return zX(t,e,zc)}function Upe(t){const e=F.c(71),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,l=le(),a=P9(),[c,d]=A.useState(n),[u,h]=A.useState(i),[f,m]=A.useState(s),[p,g]=A.useState(null),x=A.useRef(!1),[b,v]=A.useState(null);f!==s&&(m(s),d(n),h(i),g(null),v(null));let _;e[0]!==i||e[1]!==u?(_=()=>{if(x.current){x.current=!1;return}const Y=u.trim();if(Y===i.trim()){h(i),v(null);return}const q=N9(Y);if(q){v(q),h(i);return}v(null),g(Y)},e[0]=i,e[1]=u,e[2]=_):_=e[2];const y=_;let L;e[3]!==r||e[4]!==p?(L=()=>{p!==null&&(h(p),r("path",p),g(null))},e[3]=r,e[4]=p,e[5]=L):L=e[5];const w=L;let S;e[6]!==i?(S=()=>{h(i),g(null)},e[6]=i,e[7]=S):S=e[7];const k=S;let j;e[8]!==r?(j=Y=>{d(Y.target.value),r("name",Y.target.value)},e[8]=r,e[9]=j):j=e[9];let C;e[10]!==l?(C=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=C):C=e[11];let T;e[12]!==c||e[13]!==a||e[14]!==j||e[15]!==C?(T=o.jsx("input",{type:"text",value:c,readOnly:a,onChange:j,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:C}),e[12]=c,e[13]=a,e[14]=j,e[15]=C,e[16]=T):T=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=Y=>{h(Y.target.value),v(null)},e[17]=N):N=e[17];let P;e[18]!==i?(P=Y=>{Y.key==="Enter"?(Y.preventDefault(),Y.currentTarget.blur()):Y.key==="Escape"&&(Y.preventDefault(),x.current=!0,h(i),v(null),Y.currentTarget.blur())},e[18]=i,e[19]=P):P=e[19];let V;e[20]!==l?(V=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[20]=l,e[21]=V):V=e[21];let E;e[22]!==y||e[23]!==u||e[24]!==a||e[25]!==P||e[26]!==V?(E=o.jsx("input",{type:"text",value:u,readOnly:a,onChange:N,onBlur:y,onKeyDown:P,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:V}),e[22]=y,e[23]=u,e[24]=a,e[25]=P,e[26]=V,e[27]=E):E=e[27];let R;e[28]!==b?(R=b&&o.jsx("p",{className:"text-xs text-destructive",children:b}),e[28]=b,e[29]=R):R=e[29];const I=p!==null;let D;e[30]!==k?(D=Y=>{Y||k()},e[30]=k,e[31]=D):D=e[31];let O;e[32]!==l?(O=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[32]=l,e[33]=O):O=e[33];let $;e[34]!==O?($=o.jsx(Jr,{children:O}),e[34]=O,e[35]=$):$=e[35];const M=p??"";let z;e[36]!==i||e[37]!==l||e[38]!==M?(z=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:M}),e[36]=i,e[37]=l,e[38]=M,e[39]=z):z=e[39];let B;e[40]!==z?(B=o.jsx(Qr,{children:z}),e[40]=z,e[41]=B):B=e[41];let U;e[42]!==$||e[43]!==B?(U=o.jsxs(Yr,{children:[$,B]}),e[42]=$,e[43]=B,e[44]=U):U=e[44];let H;e[45]!==l?(H=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[45]=l,e[46]=H):H=e[46];let W;e[47]!==H?(W=o.jsx(Zr,{children:H}),e[47]=H,e[48]=W):W=e[48];let K;e[49]!==w?(K=Y=>{Y.preventDefault(),w()},e[49]=w,e[50]=K):K=e[50];let Q;e[51]!==l?(Q=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[51]=l,e[52]=Q):Q=e[52];let X;e[53]!==K||e[54]!==Q?(X=o.jsx(eo,{onClick:K,children:Q}),e[53]=K,e[54]=Q,e[55]=X):X=e[55];let se;e[56]!==W||e[57]!==X?(se=o.jsxs(Xr,{children:[W,X]}),e[56]=W,e[57]=X,e[58]=se):se=e[58];let ne;e[59]!==U||e[60]!==se?(ne=o.jsxs(Gr,{children:[U,se]}),e[59]=U,e[60]=se,e[61]=ne):ne=e[61];let te;e[62]!==I||e[63]!==D||e[64]!==ne?(te=o.jsx(qr,{open:I,onOpenChange:D,children:ne}),e[62]=I,e[63]=D,e[64]=ne,e[65]=te):te=e[65];let ee;return e[66]!==E||e[67]!==R||e[68]!==te||e[69]!==T?(ee=o.jsxs("div",{className:"space-y-1",children:[T,E,R,te]}),e[66]=E,e[67]=R,e[68]=te,e[69]=T,e[70]=ee):ee=e[70],ee}function Hpe(t){const e=F.c(13),{onClick:s}=t,n=le();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(Y2,{size:14}),e[2]=r):r=e[2];let l;e[3]!==s||e[4]!==i?(l=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{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]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(We,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(qe,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const Vb=new WeakMap;function Kne(t,e){let s=Vb.get(e);s||(s=new Map,Vb.set(e,s));let n=s.get(t);return n===void 0&&(n=Bn(t,e),s.set(t,n)),n}function Wne(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function qne(t,e){return{__resolveType:e,variants:[{rule:$c(),value:structuredClone(t)},{rule:$c(),value:structuredClone(t)}]}}function Gne(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>C3(n.rule));return s?s.value:e[e.length-1]?.value}function Yne(t){const e=[...t.variants],s=e[e.length-1],n={rule:$c(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function Jne(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function Qne(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Xne(t,e,s){return e<t?t-1:Math.min(t,s-1)}function Zne(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 eie(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function Tb(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const Ab=new WeakMap;function tie(t){let e=Ab.get(t);return e||(e=bne(t),Ab.set(t,e)),e}function ok(t){const e=F.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=le(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=A.useState(0);if(!Wne(l)){let $;e[0]!==r?($=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=$):$=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(Y2,{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 B;return e[5]!==z?(B=o.jsx(We,{children:z}),e[5]=z,e[6]=B):B=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":$,onClick:()=>{a(qne(l,s)),h(0)},children:M})}),B]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==r?(g=($,M)=>({index:M,label:zc($.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=r,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},_=v.__resolveType??"",y=b?.value,L=c?tie(c):[],w=_&&c?Kne(_,c):null,{__resolveType:S,...k}=v,j=()=>{a(Gne(f)),h(0)},C=()=>{const $=Yne(f);a($),h($.variants.length-1)},T=$=>{const M=Jne(f,$);M&&(a(M),h(Xne(p,$,M.variants.length)))},N=$=>{const M=Qne(f,$);a(M),h($+1)},P=($,M)=>{const z=Zne(f,$,M);a(z),p===$&&h(M)},V=$=>{const M=$?cX($,c):{__resolveType:x3};a(Tb(f,p,M))},E=$=>{const M=$,z=_?{...M,__resolveType:_}:{...M};a(Tb(f,p,z))},R=$=>{a(eie(f,p,$))},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(Dt,{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(hne,{listKey:I,variants:x,selectedIndex:p,onSelect:h,onDuplicate:N,onDelete:T,onRemoveAll:j,onReorder:P,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(yne,{currentRt:_,currentLabel:zc(v),matchers:L,onSelect:V}),w&&o.jsx("div",{className:"pt-1",children:o.jsx(Hne,{schema:w,value:k,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${_}`)})]}),n({...i,value:y,onChange:R})]})]})}const sie="website/loaders/secret.ts";function ou(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 nie(){return{__resolveType:sie,name:"",encrypted:""}}function iie(t){const{value:e,...s}=t;return s}function D1(t){const e=F.c(53),{schema:s,value:n,onChange:i,label:r,path:l,sandbox:a}=t,c=le();if(typeof n=="string"||n==null&&!ou(n)){const C=typeof n=="string"?n:"",T=a?.virtualMcpId;let N;e[0]!==r||e[1]!==l||e[2]!==s.description||e[3]!==T?(N=o.jsx(Fs,{htmlFor:l,label:r,description:s.description,virtualMcpId:T}),e[0]=r,e[1]=l,e[2]=s.description,e[3]=T,e[4]=N):N=e[4];let P;e[5]!==c?(P=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=P):P=e[6];let V;e[7]!==i?(V=I=>i(I.target.value),e[7]=i,e[8]=V):V=e[8];let E;e[9]!==l||e[10]!==C||e[11]!==P||e[12]!==V?(E=o.jsx(vt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:P,onChange:V,className:"h-10"}),e[9]=l,e[10]=C,e[11]=P,e[12]=V,e[13]=E):E=e[13];let R;return e[14]!==N||e[15]!==E?(R=o.jsxs("div",{className:"space-y-2",children:[N,E]}),e[14]=N,e[15]=E,e[16]=R):R=e[16],R}let d;e[17]!==n?(d=ou(n)?n:nie(),e[17]=n,e[18]=d):d=e[18];const u=d,h=typeof u.name=="string"?u.name:"",f=typeof u.encrypted=="string"&&u.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=o.jsx(Fs,{htmlFor:m,label:r,description:s.description,virtualMcpId:p}),e[19]=r,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==u||e[27]!==i?(v=C=>i({...u,name:C.target.value}),e[26]=u,e[27]=i,e[28]=v):v=e[28];let _;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==v?(_=o.jsx(vt,{id:x,value:h,placeholder:b,onChange:v,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=v,e[33]=_):_=e[33];const y=`${l}-value`;let L;e[34]!==f||e[35]!==c?(L=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=L):L=e[36];let w;e[37]!==u||e[38]!==f||e[39]!==i?(w=C=>{const T=C.target.value;if(!T){i(f?iie(u):u);return}i({...u,value:T})},e[37]=u,e[38]=f,e[39]=i,e[40]=w):w=e[40];let S;e[41]!==L||e[42]!==w||e[43]!==y?(S=o.jsx(vt,{id:y,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:L,onChange:w,className:"h-10"}),e[41]=L,e[42]=w,e[43]=y,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]!==_?(j=o.jsxs("div",{className:"space-y-2",children:[g,_,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function rie(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=[],l=d=>{d?.type==="object"&&d.properties&&r.push(d)};for(const d of s){const u=d.schema;if(u&&(u.type==="array"&&l(u.items),u.properties))for(const h of Object.values(u.properties))h?.type==="array"&&l(h.items)}if(r.length===0)return;if(i.length===0)return r.length===1?r[0]:void 0;let a,c=-1;for(const d of r){const u=d.properties??{},h=i.filter(f=>f in u).length*2+(d.titleBy?1:0);h>c&&(c=h,a=d)}return c>=2?a:void 0}function oie(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 lie=new Set(["__resolveType","@type"]);function aie(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 cie(t){if(T9(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 Pb(t){if(t.type==="array"&&t.items)return t;const e=t.items??cie(t);return e?{...t,type:"array",items:e}:null}function die(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 lk(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=Bn(n,s);return i?o.jsx($i,{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 Kl(t){const{schema:e,value:s}=t,n=a=>t.readOnly?o.jsx(hee,{children:a},t.path):a;if(ff(s)){const a=OX(s),c=Pb(e);if(a!==null&&c)return o.jsx(rh,{...t,schema:c,value:a,onChange:d=>t.onChange($X(s,d))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&T9(e)){const a=Pb(e);if(a)return o.jsx(rh,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!ff(s)&&e.type==="block-ref"){const a=rie(e,s)??oie(s);if(a){const c={...e,type:"array",items:a};return o.jsx(rh,{...t,schema:c,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(aie(e)){const a=e.anyOfRefs[0],c=a.schema?.properties?.variants?.items?.properties?.value,d=c&&c.type!=="block-ref"?c:e.plainSchema??c?.plainSchema??{type:"string"},u=h=>Kl({...h,schema:d});return o.jsx(ok,{...t,multivariateResolveType:a.resolveType,renderInnerField:u},t.path)}return e.anyOfRefs?o.jsx(Lb,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Xse,{...t},t.path);if(e.format==="image-uri")return n(o.jsx($se,{...t},t.path));if(e.format==="file-uri"||e.format==="video-uri")return n(o.jsx(Ise,{...t},t.path));if(e.format==="map")return n(o.jsx(nne,{...t},t.path));if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return n(o.jsx(dse,{...t},t.path));if(e.format==="location")return n(o.jsx(JS,{...t},t.path));if(e.enum&&e.enum.length>0)return n(o.jsx(Jee,{...t},t.path));if(e.type==="anyOf")return o.jsx(Lb,{...t},t.path);if(ou(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(D1,{...t},t.path);if(!e.format&&!e.enum){const a=lk(t);if(a)return a}const i=s??die(e.type,e.default);if(i==null)return ou(s)?n(o.jsx(D1,{...t},t.path)):null;if(ou(i))return n(o.jsx(D1,{...t,value:i},t.path));const r={...t,value:i},l=s==null?e.type??typeof i:Array.isArray(i)?"array":typeof i;if(l==="array"||Array.isArray(i))return o.jsx(rh,{...r},t.path);switch(l){case"boolean":return n(o.jsx(Kee,{...r},t.path));case"number":case"integer":return n(o.jsx(Hee,{...r},t.path));case"string":{const a=e.format;return n(a==="color-input"||a==="color"?o.jsx(nh,{...r},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(nh,{...r},t.path):o.jsx(nh,{...r},t.path))}case"object":return i!==null&&typeof i=="object"&&!Array.isArray(i)?o.jsx(Wte,{...r},t.path):null;default:return n(o.jsx(nh,{...r},t.path))}}function uie(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Kl({...t,schema:e});const s=lk(t);return s||Kl(e?{...t,schema:e}:t)}function $i({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}){const m=le(),p=P9(),g=t.properties;if(!g)return t.type==="inline-union"?Kl({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,readOnly:p}):null;if(MX(e)&&g.variants){const P=g.variants.items?.properties?.value;return o.jsx(ok,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:V=>uie(V,P)},n)}const x=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},b=Object.keys(g).filter(P=>!lie.has(P)&&g[P]?.hidden!==!0),v=new Set(t.required??[]);if(b.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const _=(P,V)=>{if(V===void 0){const{[P]:E,...R}=x;s(R);return}s({...x,[P]:V})},y=typeof x.__resolveType=="string"?x.__resolveType:void 0,L=b.filter(P=>{const V=g[P];return V!=null&&Ac(V,x[P])}).length>1,w=kte(b,g,x),S=i.length>0?Cte(b,g,x,i,a,l):null,k=S?g[S]:null,j=S&&k?[S]:b,C=S&&k?Ste(S,k,i,Tu(S,b,g)):i,T=wte(i,C),N=T.length>0&&r?P=>r([...T,...P]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:j.map(P=>{const V=g[P];if(!V)return null;const E=n?`${n}.${P}`:P,R=Tu(P,b,g),I=Hl(P,V),$=(T.length===0&&b.some(M=>{const z=g[M];return M!==P&&z!=null&&Hl(M,z)===I})||T.length===0&&w.has(P))&&N?V.type==="block-ref"?M=>N(_te(P,M)):M=>N(yte(R,M)):N;return Kl({schema:V,value:x[P],onChange:M=>_(P,M),path:E,label:R,readOnly:p,required:v.has(P),breadcrumbPath:C,onBreadcrumbChange:$,hasSiblingDrillDownFields:L,focused:S===P,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:y,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f})})})}function hie(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(it,{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($t,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const Eb=3e4;function fie(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 mie(t,{resolveType:e,props:s}){let n;try{n=await fetch(hw(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Eb)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${Eb/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let r=null,l=!1;try{r=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?r:i}function pie(t){const e=F.c(2);let s;return e[0]!==t?(s={mutationFn:n=>mie(t,n)},e[0]=t,e[1]=s):s=e[1],Es(s)}function ak({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f,showRun:m=!0}){const p=hs()?.taskId??null,g=le(),x=ao(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=Bn(a.resolveType,i),_=!v&&BQ(a.resolveType,i),y=_?zQ(c):null,L=v??y,[w,S]=A.useState(c),[k,j]=A.useState([]),[C,T]=A.useState(0),[N,P]=A.useState(!1),[V,E]=A.useState(null),[R,I]=A.useState(!1),[D,O]=A.useState(!1),[$,M]=A.useState(!1),z=V!==null,{save:B,flush:U,isPending:H}=P3({orgSlug:t,virtualMcpId:e,branch:s}),W=pie({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});A.useEffect(()=>()=>{U()},[]);const K=nS(l),Q=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,X={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},se=ie=>{S(ie),a.mode==="saved"&&B(a.blockKey,{__resolveType:a.resolveType,...ie})},ne=()=>{z?(E(null),P(!1),T(ie=>ie+1)):E(JSON.stringify(w,null,2))},te=ie=>{const Z=ie??"";try{const he=JSON.parse(Z);if(he&&typeof he=="object"&&!Array.isArray(he)){P(!1),se(he);return}P(!0)}catch{P(!0)}},ee=async ie=>{const Z=z3(ie,r);if(Z){ve.error(Z);return}await u(ie,{__resolveType:a.resolveType,...w}),I(!1)},Y=()=>{O(!0),W.mutate({resolveType:a.resolveType,props:w})},q=()=>{n&&window.open(fie(n,a.resolveType,w,Date.now()),"_blank","noopener")},oe=[a.title,...k],J=ie=>{j(k.slice(0,ie)),T(Z=>Z+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(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(qf,{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((ie,Z)=>{const he=Z===oe.length-1,de=kn(ie);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[Z>0&&o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>J(Z),title:de,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",he?"font-medium text-foreground":"text-muted-foreground"),children:de})]},`${de}-${Z}`)})}),a.mode==="saved"&&o.jsx(hie,{isPending:H,isError:!1}),m&&o.jsxs(fe,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:Y,disabled:W.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[W.isPending?o.jsx(it,{className:"size-3.5"}):o.jsx(Rl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:o.jsx(N2,{size:14})})}),o.jsx(We,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:z?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:ne,"aria-label":g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":z,children:z?o.jsx(Ks,{size:14}):o.jsx(ta,{size:14})})}),o.jsx(We,{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:a.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:K}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:Q,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&&$&&"hidden"),children:[o.jsx(ia,{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&&L===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})}),L?o.jsx($i,{schema:L,value:w,onChange:ie=>se(ie),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:h,sandbox:X},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),V!==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(td,{language:"json",height:"100%",code:V,onChange:te,onSave:ie=>{te(ie),U()}})})]})]}),D&&o.jsx(gie,{singular:K,result:{isPending:W.isPending,error:W.error,data:W.data,hasRun:W.status!=="idle"},expanded:$,onToggleExpand:()=>M(ie=>!ie),onOpenInNewTab:n?q:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(F3,{open:R,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:ee})]})}function gie(t){const e=F.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:l,onClose:a}=t,c=le();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 u=d,h=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==h?(f=re("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(fn,{size:14})})}),o.jsx(We,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=l,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(rT,{size:14}):o.jsx(S6,{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(Ke,{asChild:!0,children:o.jsx(fe,{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 _;e[22]!==i||e[23]!==c?(_=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=_):_=e[24];let y;e[25]!==_?(y=o.jsx(We,{side:"bottom",children:_}),e[25]=_,e[26]=y):y=e[26];let L;e[27]!==y||e[28]!==v?(L=o.jsxs(qe,{children:[v,y]}),e[27]=y,e[28]=v,e[29]=L):L=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(Ks,{size:14}),e[32]=S):S=e[32];let k;e[33]!==a||e[34]!==w?(k=o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":w,children:S}),e[33]=a,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==L||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,L,k]}),e[36]=L,e[37]=k,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==p?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=C):C=e[42];let T;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(T=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(it,{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(td,{language:"json",height:"100%",code:u,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]=u,e[47]=s,e[48]=c,e[49]=T):T=e[49];let N;return e[50]!==C||e[51]!==T||e[52]!==f?(N=o.jsxs("div",{className:f,children:[C,T]}),e[50]=C,e[51]=T,e[52]=f,e[53]=N):N=e[53],N}function xie(t){const e=F.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,blockKey:c}=t,d=le();let u;e[0]!==i||e[1]!==s||e[2]!==n?(u={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=u):u=e[3];const h=x0(u);let f;e[4]!==h?(f=R3((L,w)=>h.mutate({blockKey:L,data:w})),e[4]=h,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=aS(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let L;e[9]!==d?(L=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=L):L=e[10];let w;return e[11]!==L?(w=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:L}),e[11]=L,e[12]=w):w=e[12],w}const v=`loader:${c}`;let _;e[13]!==c||e[14]!==g||e[15]!==b?(_={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=_):_=e[16];let y;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==h.isPending||e[24]!==m||e[25]!==v||e[26]!==_||e[27]!==n?(y=o.jsx(ak,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:"loaders",target:_,initialValue:x,isCreating:h.isPending,onCreate:bie,onSaveReferencedBlock:m,showRun:!1},v),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=r,e[22]=x,e[23]=h.isPending,e[24]=m,e[25]=v,e[26]=_,e[27]=n,e[28]=y):y=e[28],y}async function bie(){}const vie="https://github.com/decocms/blocks";function yie(){const t=F.c(14),e=le();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(oT,{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 l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(fn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==r?(a=o.jsx(fe,{size:"sm",asChild:!0,children:o.jsxs("a",{href:vie,target:"_blank",rel:"noreferrer",children:[r,l]})}),t[8]=r,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=o.jsx(Ci,{className:"h-full w-full",image:s,title:n,description:i,actions:a}),t[10]=n,t[11]=i,t[12]=a,t[13]=c):c=t[13],c}function _ie(t){const e=F.c(15),{source:s,onRetry:n}=t,i=le();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 l=r;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Vn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=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 u;e[8]!==n||e[9]!==d?(u=o.jsx(fe,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=u):u=e[10];let h;return e[11]!==l||e[12]!==c||e[13]!==u?(h=o.jsx(Ci,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}const Lie=A.lazy(()=>Gs(()=>import("./sections-editor-Db_XanCD.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])).then(t=>({default:t.SectionsEditor})));function Rb(t){const e=F.c(60),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:l}=He(),{currentBranch:a,taskId:c}=on(),d=vs(s),u=hg(d,a);let h;e[0]!==u||e[1]!==d?(h=sd(d)&&u,e[0]=u,e[1]=d,e[2]=h):h=e[2];const f=h,m=hi(),p=rl(),g=uS(),x=m.lifecycle.phase==="running",b=p.previewUrl;let v;e[3]!==a||e[4]!==l||e[5]!==b||e[6]!==c||e[7]!==s?(v=a?{orgSlug:l.slug,virtualMcpId:s,branch:a,threadId:c??null,previewUrl:b}:null,e[3]=a,e[4]=l,e[5]=b,e[6]=c,e[7]=s,e[8]=v):v=e[8];const _=v;let y;e[9]!==x?(y={fetchEnabled:x},e[9]=x,e[10]=y):y=e[10];const L=j9(_,y);let w;e[11]!==x?(w={fetchEnabled:x},e[11]=x,e[12]=w):w=e[12];const S=k3(_,w),k=Dw({lifecyclePhase:m.lifecycle.phase,decofile:uf(L),meta:uf(S),hasEditableContent:w3(L.data,S.data),fastPreviewActive:yn(s).runtime==="cms"});if(k.kind==="loading"){let H;return e[13]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(jl,{}),e[13]=H):H=e[13],H}if(k.kind==="empty"){let H;return e[14]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(yie,{}),e[14]=H):H=e[14],H}if(k.kind==="error"){let H;e[15]!==L||e[16]!==p||e[17]!==S||e[18]!==k.source?(H=()=>{if(k.source==="sandbox"){p.retry();return}Promise.all([L.refetch(),S.refetch()])},e[15]=L,e[16]=p,e[17]=S,e[18]=k.source,e[19]=H):H=e[19];const W=H;let K;return e[20]!==W||e[21]!==k.source?(K=o.jsx(_ie,{source:k.source,onRetry:W}),e[20]=W,e[21]=k.source,e[22]=K):K=e[22],K}let j;e[23]!==f||e[24]!==s?(j=H=>o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:o.jsx(mS,{readOnly:f,virtualMcpId:s,className:"h-full min-h-0",children:H})}),e[23]=f,e[24]=s,e[25]=j):j=e[25];const C=j,T=g.state.target;if(T?.kind==="loader"&&L.data&&S.data){const H=a??"",W=b??null;let K;e[26]!==L.data||e[27]!==S.data||e[28]!==l.slug||e[29]!==H||e[30]!==W||e[31]!==T.key||e[32]!==s?(K=o.jsx(xie,{orgSlug:l.slug,virtualMcpId:s,branch:H,previewUrl:W,meta:S.data,decofile:L.data,blockKey:T.key}),e[26]=L.data,e[27]=S.data,e[28]=l.slug,e[29]=H,e[30]=W,e[31]=T.key,e[32]=s,e[33]=K):K=e[33];let Q;return e[34]!==C||e[35]!==K?(Q=C(K),e[34]=C,e[35]=K,e[36]=Q):Q=e[36],Q}let N;e[37]!==a||e[38]!==l.slug||e[39]!==T||e[40]!==s?(N=T||!a?null:V3(N3(l.slug,s,a)),e[37]=a,e[38]=l.slug,e[39]=T,e[40]=s,e[41]=N):N=e[41];const P=N;let V="/",E=null,R=null;T?.kind==="page"?(V=T.path,E=T.key):T?.kind==="section"?R=T.key:P&&(V=P.path,E=P.pageKey);const I=E?`page:${E}`:R?`section:${R}`:`path:${V}`;let D;e[42]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})}),e[42]=D):D=e[42];const O=a??"",$=b??void 0,M=R?null:r,z=!!E&&g.state.editSeoPageKey===E;let B;e[43]!==R||e[44]!==E||e[45]!==V||e[46]!==I||e[47]!==i||e[48]!==l.slug||e[49]!==$||e[50]!==M||e[51]!==z||e[52]!==O||e[53]!==s||e[54]!==g.consumeEditSeo||e[55]!==g.setVariantOverride?(B=o.jsx(A.Suspense,{fallback:D,children:o.jsx(Lie,{orgSlug:l.slug,virtualMcpId:s,branch:O,previewReady:!0,previewUrl:$,currentPath:V,activePageBlockKey:E,activeGlobalBlockKey:R,externalSelection:M,initialEditSeo:z,onExitSeo:g.consumeEditSeo,onVariantPreviewOverride:g.setVariantOverride,onViewJsonFile:i},I)}),e[43]=R,e[44]=E,e[45]=V,e[46]=I,e[47]=i,e[48]=l.slug,e[49]=$,e[50]=M,e[51]=z,e[52]=O,e[53]=s,e[54]=g.consumeEditSeo,e[55]=g.setVariantOverride,e[56]=B):B=e[56];let U;return e[57]!==C||e[58]!==B?(U=C(B),e[57]=C,e[58]=B,e[59]=U):U=e[59],U}function Db(t){const e=F.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,l=le(),{org:a}=He(),{currentBranch:c,taskId:d}=on(),h=rl().previewUrl;let f;e[0]!==c||e[1]!==a.slug||e[2]!==h||e[3]!==d||e[4]!==s?(f=c?{orgSlug:a.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:h}:null,e[0]=c,e[1]=a.slug,e[2]=h,e[3]=d,e[4]=s,e[5]=f):f=e[5];const p=j9(f),g=c??"";let x;e[6]!==a.slug||e[7]!==g||e[8]!==s?(x={orgSlug:a.slug,virtualMcpId:s,branch:g},e[6]=a.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:v}=P3(x),_=p.data?.[n],y=p.data===void 0&&p.isLoading,L=p.data!==void 0&&_===void 0,w=!c||L||y;let S;e[10]!==_?(S=_===void 0?"":JSON.stringify(_,null,2),e[10]=_,e[11]=S):S=e[11];const k=S;let j;e[12]!==n||e[13]!==w||e[14]!==b?(j=$=>{if(w)return;let M;try{M=JSON.parse($)}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 T;e[16]!==v?(T=()=>({flush:v}),e[16]=v,e[17]=T):T=e[17],A.useImperativeHandle(r,T);let N;e[18]!==l?(N=l("sectionsEditor.pageJsonDialog.titleShort"),e[18]=l,e[19]=N):N=e[19];let P;e[20]!==N?(P=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N}),e[20]=N,e[21]=P):P=e[21];let V;e[22]!==l?(V=l("sectionsEditor.pageJsonDialog.close"),e[22]=l,e[23]=V):V=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ks,{size:14}),e[24]=E):E=e[24];let R;e[25]!==i||e[26]!==V?(R=o.jsx(fe,{variant:"ghost",size:"icon",onClick:i,"aria-label":V,className:"size-7 shrink-0",children:E}),e[25]=i,e[26]=V,e[27]=R):R=e[27];let I;e[28]!==R||e[29]!==P?(I=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[P,R]}),e[28]=R,e[29]=P,e[30]=I):I=e[30];let D;e[31]!==p.data||e[32]!==v||e[33]!==k||e[34]!==y||e[35]!==L||e[36]!==n||e[37]!==w||e[38]!==C||e[39]!==l?(D=y?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})}):L?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",l("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(td,{code:k,language:"json",readOnly:w,height:"100%",onChange:$=>C($??""),onSave:$=>{C($),v()}},`${n}:${p.data===void 0?"loading":"ready"}`)}),e[31]=p.data,e[32]=v,e[33]=k,e[34]=y,e[35]=L,e[36]=n,e[37]=w,e[38]=C,e[39]=l,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 wie(t,e){return t===e?"preview":e}function Sie(t){return t.runtime==="cms"&&t.cmsMode!=="off"?"blocks":"preview"}const kie=500,jie={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},Ib=1,I1=["desktop","mobile","tablet"],Mb={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Ob(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Cie(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 lh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function M1(t,e){try{return new URL(t,e).href}catch{return null}}function Nie(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),r=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let u=40;return d===0?u+=30:/[\s/-]/.test(c[d-1]??"")&&(u+=20),u+=Math.round(s.length/c.length*20),u};let a=Math.max(l(n),l(i));return r.at(-1)===s?a=Math.max(a,95):r.includes(s)&&(a=Math.max(a,90)),a}function Vie(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Tie({virtualMcpId:t}){const e=le(),s=Wu(),n=Yl(),i=wQ(),{openPanel:r}=Di(),{currentBranch:l,taskId:a}=on(),c=uS(),d=ao(),u=yn(t),h=e0(d?.entity?.id===t?d.entity.metadata?.ui?.layout??null:null),f=be=>r(be),[m,p]=A.useState(()=>Sie({runtime:u.runtime,cmsMode:h})),[g,x]=A.useState("desktop"),[b,v]=A.useState(null),[_,y]=A.useState(null),L=A.useRef(null),w=A.useRef(null),[S,k]=A.useState(!1),j=A.useRef(null),C=()=>{j.current?.flush(),k(!1)},T=()=>k(be=>(be&&j.current?.flush(),!be)),[N,P]=A.useState({width:0,height:0}),[V,E]=A.useState(null),[R,I]=A.useState(!1),[D,O]=A.useState(""),$=A.useRef(null),[M,z]=A.useState(!1),[B,U]=A.useState(),[H,W]=A.useState(null),[K,Q]=A.useState(null),[X,se]=A.useState(null),[ne,te]=A.useState("/"),[ee,Y]=A.useState(null),[q,oe]=A.useState({}),[J,ie]=A.useState(!1),Z=A.useRef(null),he=()=>{ie(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>ie(!1),15e3)},de=()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),ie(!1)},{org:ae}=He(),ce=hi(),ue=rl(),G=ue.vmEntry,me=ue.previewUrl,ye=ce.lifecycle.phase,we=ye==="running",Ne=s;cS({orgSlug:ae.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:Ne});const je=null,_e=d?.entity?.id===t?k2(d.entity.metadata):null,Ve=d?.entity?.id===t&&u.runtime==="cms",xe=u.projectDefault==="cms",Se=_X({sandboxUrl:me,previewServerUrl:_e,fastPreviewActive:Ve}),Ce=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:me}:null,Ae=j9(Ce,{fetchEnabled:we}),st=k3(Ce,{fetchEnabled:we}),Be=Ae.data,Ie=st.data,Oe=`${t}:${l??""}`,[mt,lt]=A.useState(null),Xe=Dw({lifecyclePhase:ye,decofile:uf(Ae),meta:uf(st),hasEditableContent:w3(Be,Ie),fastPreviewActive:Ve,frameworkKnownMissing:mt===Oe});Xe.kind==="empty"&&Xe.reason==="framework-missing"&&mt!==Oe&&lt(Oe);const nt=Be?cf(Be).sort((be,Pe)=>be.name.localeCompare(Pe.name)):[],Fe=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l}:null,dt=YZ(Fe),et=Be&&Ie?S3(Be,Ie):[],rt=Be&&Ie?lS(Ie,Be,"loaders"):[],gt=D?(()=>{const be=D.toLowerCase();return nt.map(Pe=>({page:Pe,score:Nie(Pe.name,Pe.path,be)})).filter(({score:Pe})=>Pe>0).sort((Pe,ut)=>ut.score-Pe.score||Pe.page.path.length-ut.page.path.length).map(({page:Pe})=>Pe)})():nt,pe=et.filter(be=>{if(!D)return!0;const Pe=D.toLowerCase();return be.name.toLowerCase().includes(Pe)||be.key.toLowerCase().includes(Pe)||be.resolveType.toLowerCase().includes(Pe)}),Me=rt.filter(be=>{if(!D)return!0;const Pe=D.toLowerCase();return be.title.toLowerCase().includes(Pe)||be.key.toLowerCase().includes(Pe)||be.resolveType.toLowerCase().includes(Pe)}),Ze=K?rt.find(be=>be.key===K)??null:null,ct=Fo,_t=H||K?null:ip(nt,ne,ee),wt=H?H.name:Ze?.title??_t?.name,ze=_t?.key??null,yt=_t?.path??null,At=(ze?q[ze]:void 0)??{},ht=Or(ne,At),ft={};if(we&&me&&Ie&&Be){const be=eee(Ie,"loaders"),Pe=ze?Be[ze]:void 0,ut=vZ(Pe,Be,ss=>be.has(ss)),Vt=mZ(ut);for(const ss of rf(ne)){if(ss.type!=="param")continue;const pn=uZ(ne,ss.name,ut),Ys=xZ(pn,be,Vt);Ys.length>0&&(ft[ss.name]=Ys)}}const at=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,pt=Be&&ze?Hw(Be,ze,0):[],Lt=Be?$w(pt,Be):[],bt=Lt.map(be=>be.isSavedBlock?be.label:""),Ft=Lt.map(be=>be.isSavedBlock?"global":be.isMultivariate?"variant":"normal"),ge=pt.map(be=>op(be,Be??{})),Ee=A.useRef(null),Re=A.useRef(null),ke=ce.status.state==="paused",ot=ce.phase,Le=Gw({claimPhase:ot,lifecycle:ce.lifecycle}),Qe=ue.previewState,St=ue.userStopped,ys=j3(ae.slug,t??"",l??""),{url:ts}=Ow(Ve&&t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,previewServerUrl:_e??null,path:ht}:null),Rn=xe&&u.runtime==="sandbox",kt=fQ({previewState:Qe,progressStatus:Le.status,previewServerUrl:_e,fastPreviewActive:Ve,fastPreviewReady:!!ts,codingSession:Rn}),Jn=kt.mode!=="none",vr=kt.mode==="production"&&kt.iframeBase?lh(kt.iframeBase):null,co=!s,Qn=kt.mode==="production"?vr:lh(me),uo=d?.entity?.id===t&&d.entity.metadata?.fastPreviewInPlace===!0,_n=kt.mode==="production"&&Ve&&uo&&m==="blocks",yr=A.useRef(null);_n||(yr.current=ts);const Bi=yr.current,ho=_n?Bi??ts:ts,Ms=Cie(kt.mode==="sandbox"?Q0(Ob(X??M1(ht,kt.iframeBase)??kt.iframeBase,g),c.state.variantOverride??[]):kt.mode==="production"&&co?Q0(Ob(Mw(X??ho??M1(ht,kt.iframeBase)??kt.iframeBase,kt.showWakingPill?vX:null),g),c.state.variantOverride??[]):null);A.useEffect(()=>{},[s,vr,V]);const _r="sandbox.preview.openInNewTab",fa=ts??(kt.iframeBase?M1(ht,kt.iframeBase):null),fo=kt.mode==="production"?fa?Q0(fa,c.state.variantOverride??[]):null:Ms??kt.iframeBase,mo=async()=>{const be=fo;if(be){window.open(be,"_blank","noopener");return}},Lr=t&&l?N3(ae.slug,t,l):null,fi=be=>{Lr&&aZ(Lr,be)},fs=c.state.target;A.useEffect(()=>{if(!(!fs||!Se||!Ie))if(fs.kind==="page"){const be=q[fs.key]??{};Re.current=Or(fs.path,be),W(null),Q(null),se(null),Y(fs.key),te(fs.path),fi({path:fs.path,pageKey:fs.key,params:be})}else if(fs.kind==="loader")Re.current=null,W(null),Q(fs.key),se(null);else{const be=et.find(Pe=>Pe.key===fs.key);if(be){Re.current=null;const Pe=of(Ie);Q(null),W(be),se(Z5(Se,Pe,be.key))}}},[fs,Se,Ie,q]),A.useEffect(()=>{!ze||yt===null||fs?.kind==="page"&&fs.key===ze&&fs.path===yt||c.selectTarget({kind:"page",key:ze,path:yt})},[ze,yt,fs]);const[ma,po]=A.useState(null);if(Qe.kind==="iframe"&&ma!==Qe.previewUrl){const be=ma!==null;po(Qe.previewUrl);const Pe=Lr?V3(Lr):null;if(Pe){if(Re.current=Or(Pe.path,Pe.params),te(Pe.path),Y(Pe.pageKey),se(null),W(null),Q(null),Pe.pageKey&&Object.keys(Pe.params).length>0){const ut=Pe.pageKey;oe(Vt=>({...Vt,[ut]:Pe.params}))}}else be&&(Re.current=null,te("/"),se(null),Y(null),W(null),Q(null))}Ee.current=Ms;const wr=xQ({iframeRef:L,src:kt.mode==="sandbox"?Ms:null,active:kt.mode==="sandbox"}),Sr=A.useRef(null);A.useEffect(()=>{if(!ts||!Ms||Sr.current===ts)return;Sr.current=ts;const be=L.current;be&&be.getAttribute("src")!==Ms&&(he(),be.src=Ms)},[ts,Ms]);const kr=()=>{const be=L.current?.contentWindow,Pe=Qn;if(!be||!Pe||!Be||!ze)return;const ut=Be[ze];if(!ut||typeof ut!="object")return;const Vt=yX({previewBaseUrl:Pe,pageBlock:ut,decofile:Be,path:ht,pathTemplate:ne});if(!Vt)return;const ss=Q0(Vt.src,c.state.variantOverride??[]);be.postMessage({type:"cms-editor::render",src:ss,body:Vt.body},Pe)},mi=A.useRef(null);A.useEffect(()=>{if(!_n||H||K||!ze||!Be){mi.current=null;return}const be=JSON.stringify({page:ze,path:ht,pathTemplate:ne,decofile:Be});if(mi.current===be)return;const Pe=mi.current===null;mi.current=be,!Pe&&kr()},[Be,_n,H,K,ze,ht,ne]);const zi=A.useRef(null);A.useEffect(()=>{if(!_n||H||K||!ze||!Be){zi.current=null;return}const be=JSON.stringify(c.state.variantOverride??null),Pe=zi.current;zi.current={page:ze,sig:be},!(!Pe||Pe.page!==ze||Pe.sig===be)&&kr()},[c.state.variantOverride,_n,H,K,ze]);const go=!!t&&!!l&&!ce.notFound&&!St&&!ke&&(ot?.kind==="ready"||ye!=="idle"),Os=kt.mode!=="sandbox"&&m==="visual"?"preview":m;A.useEffect(()=>{const be=Qn;if(!be)return;const Pe=ut=>{if(ut.origin===be)if(ut.data?.type==="visual-editor::element-clicked"){const Vt=jX.safeParse(ut.data.payload);Vt.success&&v(Vt.data)}else if(ut.data?.type==="cms-editor::section-clicked"){const Vt=VX.safeParse(ut.data.payload);Vt.success&&y({index:Vt.data.sectionIndex,seq:Vt.data.clickSeq})}else ut.data?.type==="cms-editor::render-start"?he():(ut.data?.type==="cms-editor::render-end"||ut.data?.type==="cms-editor::render-error")&&de()};return window.addEventListener("message",Pe),()=>window.removeEventListener("message",Pe)},[Qn]);const jr=()=>{const be=L.current?.contentWindow,Pe=lh(me);!be||!Pe||be.postMessage({type:"visual-editor::activate",script:CX},Pe)},H9=()=>{const be=L.current?.contentWindow,Pe=lh(me);!be||!Pe||be.postMessage({type:"visual-editor::deactivate"},Pe)},Fi=()=>{const be=L.current?.contentWindow,Pe=Qn;!be||!Pe||(be.postMessage(kt.mode==="production"?{type:"editor::inject",args:{script:tb}}:{type:"visual-editor::activate",script:tb},Pe),be.postMessage({type:"cms-editor::set-labels",labels:bt,kinds:Ft,keys:ge},Pe))},xo=()=>{const be=L.current?.contentWindow,Pe=Qn;!be||!Pe||be.postMessage({type:"cms-editor::deactivate"},Pe)},pi=be=>{const Pe=m;!n&&be!==Pe&&(be==="blocks"?w.current?.resize("30%"):w.current?.collapse()),be!=="blocks"&&C(),p(be),v(null),y(null),be!=="blocks"&&Q(null),Pe==="visual"&&H9(),be==="visual"&&jr(),Pe==="blocks"&&be!=="blocks"&&xo(),be==="blocks"&&Fi()},Cr=be=>{pi(wie(m,be))},bo=()=>{if(!L.current||!Ms)return;he();const be=L.current;be.src=Ms};T$(()=>{const be=L.current;if(!be)return;he();const Pe=document.activeElement,ut=be.tabIndex;be.tabIndex=-1,be.style.pointerEvents="none",be.blur(),Vie(be,Ee.current);let Vt;const ss=()=>{clearTimeout(Vt),be.tabIndex=ut,be.style.pointerEvents="";const pn=document.activeElement;(!pn||pn===document.body||pn===be)&&Pe?.focus(),be.removeEventListener("load",ss)};be.addEventListener("load",ss),Vt=setTimeout(ss,3e3)});const vo=()=>{const be=I1.indexOf(g);x(I1[(be+1)%I1.length])},yo=async()=>{let be=null;try{be=L.current?.contentWindow?.location?.href??null}catch{}const Pe=be??Ms??me;if(Pe)try{await navigator.clipboard.writeText(Pe),ve.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{ve.error(e("sandbox.preview.failedToCopyUrl"))}},Ui=(be,Pe)=>{if(!ze)return;const ut=ze,Vt={...At,[be]:Pe};Re.current=Or(ne,Vt),oe(ss=>({...ss,[ut]:Vt})),fi({path:ne,pageKey:ut,params:Vt})},Nr=qZ({iframeBase:kt.iframeBase,resolvedPath:ht,activeGlobalSectionName:H?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),cl=be=>{const Pe=q[be.key]??{},ut=Or(be.path,Pe);(H||ct(ut)!==ct(ht))&&he(),Re.current=ut,W(null),Q(null),se(null),y(null),Y(be.key),te(be.path),fi({path:be.path,pageKey:be.key,params:Pe}),c.selectTarget({kind:"page",key:be.key,path:be.path})},_o=be=>{if(!Se||!Ie){ve.error(e("sandbox.preview.previewMetadataNotReady"));return}he(),Re.current=null;const Pe=of(Ie),ut=Z5(Se,Pe,be.key);W(be),Q(null),se(ut),y(null),c.selectTarget({kind:"section",key:be.key})},md=be=>{W(null),Q(be.key),se(null),pi("blocks"),c.selectTarget({kind:"loader",key:be.key})},pa=async({name:be,path:Pe,templateKey:ut})=>{if(!t||!l)return;const Vt=N9(Pe);if(Vt){U(Vt);return}const ss=Pe.trim().startsWith("/")?Pe.trim():`/${Pe.trim()}`;if(nt.some(Ys=>ct(Ys.path)===ct(ss))){U(e("sandbox.preview.pageAlreadyExists",{path:ss}));return}let pn;if(ut&&(pn=Be?.[ut],!pn)){U(e("sandbox.preview.templateNoLongerExists"));return}U(void 0);try{const Ys=await dt.mutateAsync({name:be,path:ss,template:pn});z(!1),ve.success(e("sandbox.preview.pageCreated",{name:be})),await Zc(kie),cl({key:Ys.key,name:Ys.name,path:Ys.path}),pi("blocks")}catch(Ys){U(Ys instanceof Error?Ys.message:e("sandbox.preview.failedToCreatePage"))}},gi=Jn&&(go||kt.mode==="production"),pd=u.runtime==="cms"&&ob({showPreviewToolbar:gi,blocksState:Xe}),Vr=gi?o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{onClick:bo,"aria-label":e("sandbox.preview.refresh"),children:o.jsx(On,{size:16})})}),o.jsx(We,{side:"bottom",children:e("sandbox.preview.refresh")})]}),pd?o.jsxs("div",{ref:$,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(be=>!be),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(Wo,{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(El,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:re("text-[13px] font-medium text-foreground",wt==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:wt??Nr}),!H&&!K&&wt!=null&&ne&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:rf(ne).map((be,Pe)=>{if(be.type==="text")return o.jsx("span",{className:re(Pe===0?"min-w-0 truncate":"shrink-0"),children:be.text},`text-${Pe}`);const ut=ft[be.name];return ut&&at?o.jsx(RZ,{sources:ut,template:ne,paramName:be.name,value:At[be.name]??"",sandboxRef:at,onCommit:Vt=>Ui(be.name,Vt)},`${ze}:${be.name}`):o.jsx(KZ,{name:be.name,value:At[be.name]??"",onCommit:Vt=>Ui(be.name,Vt)},`${ze}:${be.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>I(be=>!be),"aria-label":e("sandbox.preview.choosePage"),children:o.jsx(bs,{size:12,className:re("shrink-0 text-muted-foreground transition-transform",R&&"rotate-180")})})]}),R&&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(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:D,onChange:be=>O(be.target.value),onKeyDown:be=>{if(be.key!=="Enter")return;const Pe=D.trim();if(!Pe)return;const ut=gt.find(Vt=>ct(Vt.path)===ct(Pe));ut&&(be.preventDefault(),I(!1),O(""),cl(ut))},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:be=>{be.preventDefault(),I(!1),O(""),U(void 0),z(!0)},children:[o.jsx(Gt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),gt.length===0&&pe.length===0&&Me.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:nt.length===0&&et.length===0&&rt.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[gt.length>0&&o.jsx("div",{className:"p-1.5",children:gt.map(be=>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:Pe=>{Pe.preventDefault(),I(!1),O(""),cl(be)},children:[o.jsx($o,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.path})]},be.key))}),pe.length>0&&o.jsxs("div",{className:re("p-1.5",gt.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")}),pe.map(be=>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:Pe=>{Pe.preventDefault(),I(!1),O(""),_o(be)},children:[o.jsx(Wo,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]}),Me.length>0&&o.jsxs("div",{className:re("p-1.5",(gt.length>0||pe.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")}),Me.map(be=>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:Pe=>{Pe.preventDefault(),I(!1),O(""),md(be)},children:[o.jsx(El,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]})]})]})]}):o.jsx("span",{className:"min-w-0 truncate px-2 text-[13px] text-muted-foreground",children:Nr}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{"aria-label":e(_r),onClick:()=>{mo()},children:o.jsx(fn,{size:16})})}),o.jsx(We,{side:"bottom",children:e(_r)})]})]}):null,Lo=gi?o.jsx("div",{className:"flex min-w-0 items-center gap-0.5",children:Vr}):null,wo=n&&h!=="off"&&ob({showPreviewToolbar:gi,blocksState:Xe})?o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{onClick:()=>Cr("blocks"),"aria-pressed":Os==="blocks","aria-label":e(Os==="blocks"?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),active:Os==="blocks",children:o.jsx(lT,{size:16})})}),o.jsx(We,{side:"bottom",children:e(Os==="blocks"?"sandbox.preview.exitEditor":"sandbox.preview.editContent")})]}):null,Hi=gi?o.jsx("div",{className:"flex shrink-0 items-center",children:o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon-sm",className:ng,"aria-label":e("sandbox.preview.moreOptions"),children:o.jsx(li,{size:14})})}),o.jsxs(Kt,{align:"end",className:"w-44",children:[o.jsxs(Je,{onClick:yo,children:[o.jsx(hn,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),Be&&Ie&&o.jsxs(o.Fragment,{children:[o.jsx(Nl,{}),ze&&o.jsxs(Je,{onClick:()=>{c.editSeo({kind:"page",key:ze,path:ne}),pi("blocks")},children:[o.jsx(E2,{size:14}),e("sandbox.preview.editSeo")]}),ze&&o.jsxs(Je,{onClick:()=>{try{f(KC(yJ(ze)))}catch{ve.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[o.jsx(ta,{size:14}),e("sandbox.preview.viewJson")]})]}),je]})]})}):null,So=kt.mode==="sandbox",xi=jie[g],ko=g==="desktop"&&(N.width===0||N.width>=xi.width+2*Ib),ga=ko?1:Math.min(N.width>0?N.width/(xi.width+2*Ib):1,1),jo=ko?{width:"100%",height:"100%"}:{width:`${xi.width}px`,height:N.height>0?`${N.height/ga}px`:`${xi.height}px`,transform:`scale(${ga})`,transformOrigin:"top center"},Tr=Jn?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:[So&&o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{onClick:()=>Cr("visual"),"aria-pressed":m==="visual","aria-label":e("sandbox.preview.visualEditor"),active:m==="visual",className:"rounded-full",children:o.jsx(Tx,{size:16})})}),o.jsx(We,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{onClick:vo,"aria-label":e(Mb[g]),className:"rounded-full",children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[g==="mobile"&&o.jsx(aT,{size:16}),g==="tablet"&&o.jsx(cT,{size:16}),g==="desktop"&&o.jsx(dT,{size:16})]},g)})}),o.jsx(We,{side:"top",children:e(Mb[g])})]})]})}):null,Co=(n||!!K)&&Os==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[at&&Object.entries(ft).map(([be,Pe])=>(At[be]??"")===""?o.jsx(UZ,{sources:Pe,template:ne,paramName:be,sandboxRef:at,onFill:ut=>Ui(be,ut)},`${ze}:${be}`):null),i?o.jsxs(o.Fragment,{children:[gi&&o.jsx(_Q,{children:Lo}),o.jsx(LQ,{children:Hi})]}):(gi||Hi)&&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 flex-1 items-center justify-start",children:wo}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Vr}),o.jsx("div",{className:"flex flex-1 items-center justify-end",children:Hi})]}),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(Rb,{virtualMcpId:t,externalSelection:_,onViewJsonFile:T}),S&&ze&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(Db,{ref:j,virtualMcpId:t,pageKey:ze,onClose:C})}),n&&Tr]}):o.jsxs(Rm,{orientation:"horizontal",disabled:Os!=="blocks",children:[o.jsx(yc,{ref:w,id:"preview-blocks-editor",defaultSize:Os==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Os==="blocks"&&o.jsx(Rb,{virtualMcpId:t,externalSelection:_,onViewJsonFile:T})}),Os==="blocks"&&o.jsx(Dm,{withHandle:!0}),o.jsx(yc,{id:"preview-canvas",defaultSize:Os==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(Rm,{orientation:"horizontal",disabled:!(S&&ze),children:[S&&ze&&o.jsxs(o.Fragment,{children:[o.jsx(yc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(Db,{ref:j,virtualMcpId:t,pageKey:ze,onClose:C})}),o.jsx(Dm,{withHandle:!0})]}),o.jsx(yc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:be=>{if(!be)return;const Pe=()=>P(Vt=>Vt.width===be.clientWidth&&Vt.height===be.clientHeight?Vt:{width:be.clientWidth,height:be.clientHeight});Pe();const ut=new ResizeObserver(Pe);return ut.observe(be),()=>ut.disconnect()},className:re("h-full relative overflow-clip flex justify-center",Jn&&!ko&&"bg-muted/30"),children:[(J||ys)&&Jn&&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"})}),kt.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Tc,{kind:"starting",progress:Le,claimPhase:ot})}),Qe.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Tc,{kind:"suspended",onResume:ue.resume})}),Qe.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Tc,{kind:"errored",error:Qe.error,onRetry:ue.retry,connectionsHref:`/${ae.slug}/settings/connections`})}),kt.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(it,{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")})]})]}),Os==="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(Tx,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Os==="visual"&&b&&o.jsx(WX,{element:b,onDismiss:()=>v(null)}),Tr,Jn&&Ms&&o.jsx("div",{className:re("shrink-0",!ko&&"border-x border-border bg-background shadow-sm"),style:jo,children:o.jsx("iframe",{ref:L,src:Ms,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:wr.handleError,onLoad:()=>{if(wr.handleLoad(),de(),kt.mode!=="sandbox"){kt.mode==="production"&&!kt.showWakingPill&&m==="blocks"&&Fi();return}if(Ge("vm_preview_loaded",{view_mode:m,vm_id:G?.sandboxHandle??null}),!H)try{const be=L.current?.contentWindow?.location?.pathname;if(!be)return;const Pe=Re.current;if(Pe!==null&&(Re.current=null,ct(be)!==ct(Pe))||ct(be)===ct(ht))return;te(be),fi({path:be,pageKey:ee,params:At})}catch{}m==="visual"&&jr(),m==="blocks"&&Fi()}},kt.iframeBase)})]})})]})})]})}),o.jsx(QZ,{open:M,onOpenChange:z,isPending:dt.isPending,error:B,templates:nt,onSubmit:pa})]})}function Aie(t){const e=F.c(22),{virtualMcpId:s}=t,n=le(),i=vs(s),{activeTask:r,taskId:l,currentBranch:a}=on(),c=t_(l),[d,u]=A.useState(!1);if(s_({threadId:l,sandboxBranch:r?.branch??a,agentHasRepo:jn(i?.metadata),threadHasRepo:jn(c)||jn(r?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(mn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=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=()=>u(!0),b=o.jsx(mn,{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 _;e[9]!==v?(_=o.jsxs(fe,{onClick:x,children:[b,v]}),e[9]=v,e[10]=_):_=e[10];let y;e[11]!==p||e[12]!==g||e[13]!==_?(y=o.jsx(Ci,{className:"h-full",image:m,title:p,description:g,actions:_}),e[11]=p,e[12]=g,e[13]=_,e[14]=y):y=e[14];let L;e[15]!==d?(L=o.jsx(Ju,{open:d,onOpenChange:u,mode:"agent"}),e[15]=d,e[16]=L):L=e[16];let w;return e[17]!==y||e[18]!==L?(w=o.jsxs(o.Fragment,{children:[y,L]}),e[17]=y,e[18]=L,e[19]=w):w=e[19],w}let f;return e[20]!==s?(f=o.jsx(Tie,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const Pie=A.lazy(()=>Gs(()=>import("./file-explorer-Ku7EjWAL.js"),__vite__mapDeps([160,1,2,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,96,98,90,99,100,101,102,103,104,105,72,146,144,94,138,110,80,81,82,83,84,85,86,87,88,89,91,92,93,95,97,106,107,108,109,77,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,139,140,141,142,143,145,147,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.FileExplorer})));function Eie(t){const e=F.c(26),{openPath:s}=t,n=le(),i=ao(),{org:r}=He(),{currentBranch:l,taskId:a}=on(),c=i?.entity?.id??null,d=Wu(),u=rl(),h=hi();u.vmEntry,h.lifecycle.phase;const f=d,m=c??"",p=l??"",g=a??null,x=f;let b;e[0]!==r.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=r.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],cS(b);const v=null;if(!c||!l){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(Ci,{className:"h-full",title:k,description:j}),e[10]=k,e[11]=j,e[12]=C):C=e[12],C}let _;e[13]!==v||e[14]!==n?(_=v,e[13]=v,e[14]=n,e[15]=_):_=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})}),e[16]=y):y=e[16];const L=a??null;let w;e[17]!==l||e[18]!==s||e[19]!==r.slug||e[20]!==L||e[21]!==c?(w=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(A.Suspense,{fallback:y,children:o.jsx(Pie,{orgSlug:r.slug,virtualMcpId:c,branch:l,threadId:L,openPath:s})})}),e[17]=l,e[18]=s,e[19]=r.slug,e[20]=L,e[21]=c,e[22]=w):w=e[22];let S;return e[23]!==_||e[24]!==w?(S=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[_,w]}),e[23]=_,e[24]=w,e[25]=S):S=e[25],S}function Rie(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 Die(t,e,s){return typeof t!="string"?null:Rie(Bn(t,e),s)}function ck(t,e,s){if(!e||typeof t!="string")return!1;const n=Die(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Iie({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ns(),i=hs()?.taskId??null,r=g0(e),l=yn(e).runtime==="cms";return Es({mutationKey:bg(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const u=await S7({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return yg(n,{orgSlug:t,virtualMcpId:e,branch:s},u),await n.invalidateQueries({queryKey:m0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=p0(r,X2(a)),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():h9(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=tt.decofile(c);await n.cancelQueries({queryKey:d});const u=n.getQueryData(d),h=!!u&&a in u,f=u?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:h,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>d.hadKey?{...u??{},[d.blockKey]:d.previousValue}:u)},onSuccess:()=>{n.invalidateQueries({queryKey:tt.liveMeta(t,e,s)})}})}function hc(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 l;return e[4]!==r?(l=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=l):l=e[5],l}function M9(t,e){return`${t}-${e}`}function dk(t,e){return`site/apps/${t}/${e}.ts`}function uk(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 Mie(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Oie(t){return t==="local"?"Custom":"Installed"}function hk(t,e,s){const n=new Set([M9(t,e),e].map(r=>r.toLowerCase())),i=dk(t,e);for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(r.toLowerCase())||a.__resolveType===i)return r}return null}function $ie(t,e){const s=t.vendor.alias,n=t.name,i=hk(s,n,e);return{id:M9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:dk(s,n),blockKey:i,installed:i!==null}}function Bie(t,e,s){if(t===L3)return null;const n=uk(t);if(!n)return null;const{vendor:i,app:r}=n,l=hk(i,r,s),a=ll(t,e);return{id:M9(i,r),app:r,vendor:i,title:a.title??r,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function zie(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Bc(t,e)||!bw(n))return null;const i=uk(n)??Mie(t);if(!i)return null;const r=ll(n,s),{vendor:l,app:a}=i;return{id:M9(l,a),app:a,vendor:l,title:r.title??df(t,e,s),description:r.description??"",category:Oie(l),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function Fie(t,e,s){const n=new Map;for(const r of t){const l=$ie(r,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const l=Bie(r,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=zie(r,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(Uie)}function Uie(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function Hie(){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 Kie(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 l;n[1]!==i?(l={queryKey:r,queryFn:Hie,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Mt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?Fie(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,u=a.isLoading&&!a.isError;let h;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==u?(h={catalog:d,isLoading:u,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=u,n[11]=h):h=n[11],h}function Wie(t){const e=F.c(86),{active:s,counts:n,showBlog:i,onSelect:r}=t,l=le();let a;e[0]!==l?(a=l("sandbox.collectionsSidebar.content"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(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:a})}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("sandbox.collectionsSidebar.pages"),e[4]=l,e[5]=d):d=e[5];const u=s==="pages";let h;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==u?(h=o.jsx(Fn,{id:"pages",icon:$o,label:d,count:n.pages,active:u,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==r||e[15]!==f||e[16]!==m?(p=o.jsx(Fn,{id:"sections",icon:Wo,label:f,count:n.sections,active:m,onSelect:r}),e[13]=n.sections,e[14]=r,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==r||e[22]!==x||e[23]!==g?(b=o.jsx(Fn,{id:"apps",icon:B6,label:g,count:n.apps,active:x,onSelect:r}),e[20]=n.apps,e[21]=r,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==l?(v=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=v):v=e[26];const _=s==="redirects";let y;e[27]!==n.redirects||e[28]!==r||e[29]!==v||e[30]!==_?(y=o.jsx(Fn,{id:"redirects",icon:A6,label:v,count:n.redirects,active:_,onSelect:r}),e[27]=n.redirects,e[28]=r,e[29]=v,e[30]=_,e[31]=y):y=e[31];let L;e[32]!==l?(L=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=L):L=e[33];const w=s==="loaders";let S;e[34]!==n.loaders||e[35]!==r||e[36]!==L||e[37]!==w?(S=o.jsx(Fn,{id:"loaders",icon:El,label:L,count:n.loaders,active:w,onSelect:r}),e[34]=n.loaders,e[35]=r,e[36]=L,e[37]=w,e[38]=S):S=e[38];let k;e[39]!==l?(k=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=k):k=e[40];const j=s==="actions";let C;e[41]!==n.actions||e[42]!==r||e[43]!==k||e[44]!==j?(C=o.jsx(Fn,{id:"actions",icon:hr,label:k,count:n.actions,active:j,onSelect:r}),e[41]=n.actions,e[42]=r,e[43]=k,e[44]=j,e[45]=C):C=e[45];let T;e[46]!==l?(T=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=T):T=e[47];const N=s==="site";let P;e[48]!==r||e[49]!==T||e[50]!==N?(P=o.jsx(Fn,{id:"site",icon:x6,label:T,active:N,onSelect:r}),e[48]=r,e[49]=T,e[50]=N,e[51]=P):P=e[51];let V;e[52]!==l?(V=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=V):V=e[53];const E=s==="seo";let R;e[54]!==r||e[55]!==V||e[56]!==E?(R=o.jsx(Fn,{id:"seo",icon:E2,label:V,active:E,onSelect:r}),e[54]=r,e[55]=V,e[56]=E,e[57]=R):R=e[57];let I;e[58]!==l?(I=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=I):I=e[59];const D=s==="calendar";let O;e[60]!==r||e[61]!==I||e[62]!==D?(O=o.jsx(Fn,{id:"calendar",icon:Yc,label:I,active:D,onSelect:r}),e[60]=r,e[61]=I,e[62]=D,e[63]=O):O=e[63];let $;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==r||e[69]!==i||e[70]!==l?($=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(Ec,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),o.jsx(Fn,{id:"posts",icon:Vi,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(Fn,{id:"authors",icon:n9,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(Fn,{id:"categories",icon:T2,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(Fn,{id:"post-schedule",icon:uT,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:r})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=r,e[69]=i,e[70]=l,e[71]=$):$=e[71];let M;e[72]!==b||e[73]!==y||e[74]!==S||e[75]!==C||e[76]!==P||e[77]!==R||e[78]!==O||e[79]!==$||e[80]!==h||e[81]!==p?(M=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,y,S,C,P,R,O,$]}),e[72]=b,e[73]=y,e[74]=S,e[75]=C,e[76]=P,e[77]=R,e[78]=O,e[79]=$,e[80]=h,e[81]=p,e[82]=M):M=e[82];let z;return e[83]!==c||e[84]!==M?(z=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=z):z=e[85],z}function Fn(t){const e=F.c(18),{id:s,icon:n,label:i,count:r,active:l,onSelect:a}=t;let c;e[0]!==s||e[1]!==a?(c=()=>a(s),e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let u;e[3]!==d?(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",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==i?(f=o.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==r?(m=r!==void 0&&o.jsx("span",{className:re("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:r}),e[9]=l,e[10]=r,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==u||e[14]!==h||e[15]!==f||e[16]!==m?(p=o.jsxs("button",{type:"button",onClick:c,className:u,children:[h,f,m]}),e[12]=c,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function qie(t){const e=F.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:r,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=Gw({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==a?(c=o.jsx(Tc,{kind:"starting",progress:a,claimPhase:n}),e[3]=n,e[4]=a,e[5]=c):c=e[5],c}case"suspended":{let a;return e[6]!==r?(a=o.jsx(Tc,{kind:"suspended",onResume:r}),e[6]=r,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==r||e[10]!==s.error?(a=o.jsx(Tc,{kind:"errored",error:s.error,onRetry:r,connectionsHref:l}),e[8]=l,e[9]=r,e[10]=s.error,e[11]=a):a=e[11],a}}}const Gie=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Yie(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&&!Gie.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function $b(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 Jie(t,e){const s=Fo,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let r=2;r<1e3;r++){const l=`${n}-copy-${r}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function Qie(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 Xie(t){const e=A3(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Zie(t,e){return eS(t,e)}const ere=1e3;function tre(t,e){for(let s=0;s<ere;s++){const n=A3(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const sre={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},nre={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},ire={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function rre(t){const e=F.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=le(),[p,g]=A.useState(i),[x,b]=A.useState(r),[v,_]=A.useState(Uo),[y,L]=A.useState(null),[w,S]=A.useState(s);s!==w&&(S(s),s&&(g(i),b(r),_(Uo),L(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=de=>{!de&&!f&&(L(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const C=j;let T;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(T=async de=>{de.preventDefault();const ae=p.trim(),ce=x.trim();if(!ae||!ce||f)return;const ue=N9(ce);if(ue){L(ue);return}const G=d?.({name:ae,path:ce});if(G){L(G);return}L(null),await u({name:ae,path:ce,templateKey:k&&v!==Uo?v:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=T):T=e[10];const N=T,P=y??a,V=sre[n];let E;e[11]!==m||e[12]!==V?(E=m(V),e[11]=m,e[12]=V,e[13]=E):E=e[13];let R;e[14]!==E?(R=o.jsx(ds,{children:o.jsx(qt,{children:E})}),e[14]=E,e[15]=R):R=e[15];let I;e[16]!==f||e[17]!==k||e[18]!==m||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:m("sandbox.pageFormDialog.labelTemplate")}),o.jsx(tS,{id:"page-form-template",value:v,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=m,e[19]=v,e[20]=c,e[21]=I):I=e[21];let D;e[22]!==m?(D=m("sandbox.pageFormDialog.labelName"),e[22]=m,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 $;e[26]===Symbol.for("react.memo_cache_sentinel")?($=de=>g(de.target.value),e[26]=$):$=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let z;e[29]!==f||e[30]!==p||e[31]!==M?(z=o.jsx(vt,{id:"page-form-name",value:p,onChange:$,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=M,e[32]=z):z=e[32];let B;e[33]!==z||e[34]!==O?(B=o.jsxs("div",{className:"space-y-1.5",children:[O,z]}),e[33]=z,e[34]=O,e[35]=B):B=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,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=de=>b(de.target.value),e[40]=W):W=e[40];let K;e[41]!==m?(K=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=K):K=e[42];let Q;e[43]!==f||e[44]!==x||e[45]!==K?(Q=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]=Q):Q=e[46];let X;e[47]!==H||e[48]!==Q?(X=o.jsxs("div",{className:"space-y-1.5",children:[H,Q]}),e[47]=H,e[48]=Q,e[49]=X):X=e[49];let se;e[50]!==P?(se=P&&o.jsx("p",{className:"text-xs text-destructive",children:P}),e[50]=P,e[51]=se):se=e[51];let ne;e[52]!==B||e[53]!==X||e[54]!==se||e[55]!==I?(ne=o.jsxs("div",{className:"space-y-4 py-4",children:[I,B,X,se]}),e[52]=B,e[53]=X,e[54]=se,e[55]=I,e[56]=ne):ne=e[56];let te;e[57]!==h?(te=()=>h(!1),e[57]=h,e[58]=te):te=e[58];let ee;e[59]!==m?(ee=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=ee):ee=e[60];let Y;e[61]!==f||e[62]!==te||e[63]!==ee?(Y=o.jsx(fe,{type:"button",variant:"outline",onClick:te,disabled:f,children:ee}),e[61]=f,e[62]=te,e[63]=ee,e[64]=Y):Y=e[64];let q;e[65]!==f||e[66]!==p||e[67]!==x?(q=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=q):q=e[68];let oe;e[69]!==f||e[70]!==n||e[71]!==m?(oe=f?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"size-3.5"}),m(ire[n])]}):m(nre[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=oe):oe=e[72];let J;e[73]!==q||e[74]!==oe?(J=o.jsx(fe,{type:"submit",disabled:q,children:oe}),e[73]=q,e[74]=oe,e[75]=J):J=e[75];let ie;e[76]!==Y||e[77]!==J?(ie=o.jsxs(Gn,{children:[Y,J]}),e[76]=Y,e[77]=J,e[78]=ie):ie=e[78];let Z;e[79]!==N||e[80]!==ne||e[81]!==ie||e[82]!==R?(Z=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[R,ne,ie]})}),e[79]=N,e[80]=ne,e[81]=ie,e[82]=R,e[83]=Z):Z=e[83];let he;return e[84]!==C||e[85]!==s||e[86]!==Z?(he=o.jsx(zt,{open:s,onOpenChange:C,children:Z}),e[84]=C,e[85]=s,e[86]=Z,e[87]=he):he=e[87],he}function ore(t){const e=F.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:l,onOpenChange:a}=t,c=r===void 0?!1:r,d=le(),[u,h]=A.useState(i),[f,m]=A.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=W=>{!W&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==u||e[5]!==l?(x=async W=>{W.preventDefault();const K=u.trim();!K||c||await l(K)},e[3]=c,e[4]=u,e[5]=l,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 _;e[9]!==v?(_=o.jsx(qt,{children:v}),e[9]=v,e[10]=_):_=e[10];let y;e[11]!==d?(y=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=y):y=e[12];let L;e[13]!==y?(L=o.jsx(Nn,{children:y}),e[13]=y,e[14]=L):L=e[14];let w;e[15]!==_||e[16]!==L?(w=o.jsxs(ds,{children:[_,L]}),e[15]=_,e[16]=L,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=>h(W.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==u?(C=o.jsx(vt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=C):C=e[25];let T;e[26]!==k||e[27]!==C?(T=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=T):T=e[28];let N;e[29]!==d?(N=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=N):N=e[30];let P;e[31]!==N?(P=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:N}),e[31]=N,e[32]=P):P=e[32];let V;e[33]!==n?(V=o.jsx(vt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=V):V=e[34];let E;e[35]!==P||e[36]!==V?(E=o.jsxs("div",{className:"space-y-1.5",children:[P,V]}),e[35]=P,e[36]=V,e[37]=E):E=e[37];let R;e[38]!==T||e[39]!==E?(R=o.jsxs("div",{className:"space-y-4 py-4",children:[T,E]}),e[38]=T,e[39]=E,e[40]=R):R=e[40];let I;e[41]!==a?(I=()=>a(!1),e[41]=a,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(fe,{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 $;e[49]!==c||e[50]!==u?($=!u.trim()||c,e[49]=c,e[50]=u,e[51]=$):$=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(it,{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]!==$||e[56]!==M?(z=o.jsx(fe,{type:"submit",disabled:$,children:M}),e[55]=$,e[56]=M,e[57]=z):z=e[57];let B;e[58]!==O||e[59]!==z?(B=o.jsxs(Gn,{children:[O,z]}),e[58]=O,e[59]=z,e[60]=B):B=e[60];let U;e[61]!==b||e[62]!==R||e[63]!==B||e[64]!==w?(U=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[w,R,B]})}),e[61]=b,e[62]=R,e[63]=B,e[64]=w,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=o.jsx(zt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function lre(t){const e=F.c(7),{type:s}=t,n=YQ[s];let i;e[0]!==n?(i=o.jsx(Ke,{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 l;e[2]!==r?(l=o.jsx(We,{side:"left",children:r}),e[2]=r,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=o.jsxs(qe,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const O1={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Y3=["posts","authors","categories"],lu={posts:"post",authors:"author",categories:"category"};function au(t){return Y3.includes(t)}const J3={posts:"post",authors:"author",categories:"category"},fk={posts:O1.post,authors:O1.author,categories:O1.category},are=Object.fromEntries(Object.entries(fk).map(([t,e])=>[e,t]));function cre(t){return typeof t=="string"?are[t]??null:null}function tl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function rs(t){return typeof t=="string"?t:""}function dre(t,e){switch(t){case"posts":return{label:rs(e.title)||"Untitled post",subtitle:rs(e.slug)};case"authors":return{label:rs(e.name)||"Unnamed author",subtitle:rs(e.email)};case"categories":return{label:rs(e.name)||"Unnamed category",subtitle:rs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function mk(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=tl(n);if(!i)continue;const r=cre(i.__resolveType);if(!r)continue;const l=tl(i[J3[r]])??{},{label:a,subtitle:c}=dre(r,l);e[r].push({key:s,kind:r,label:a,subtitle:c})}for(const s of Y3)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function ure(t,e){return mk(t)[e]}function Au(t,e){return ure(t,e).map(s=>({key:s.key,payload:Fd(tl(t[s.key])??void 0,e)}))}const Bb=Object.freeze({});function Fd(t,e){return t?tl(t[J3[e]])??Bb:Bb}function fc(t,e,s){return{name:t,__resolveType:fk[e],[J3[e]]:s}}function Kpe({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=f=>typeof f=="string"?f:rs(tl(f)?.[s]),l=f=>typeof f=="string"?f:rs(tl(f)?.name),a=f=>{const m=r(f),p=m?t.find(({payload:x})=>rs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>rs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:rs(m.name)||rs(m[s])||f})),d=new Map,u=[];return i.forEach((f,m)=>{const p=a(f);if(p){u.includes(p.key)||u.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),u.push(g),c.push({value:g,label:l(f)||r(f)||"Unknown"})}),{options:c,selectedValues:u,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function Wl(t){return Array.isArray(t)?t:[]}function Wr(t){if(typeof t=="string")return t;const e=tl(t);return e?rs(e.slug):""}function hre(t){if(typeof t=="string")return t;const e=tl(t);return e?rs(e.email):""}function pk(t){const e=[];return rs(t.title).trim()||e.push("Title"),rs(t.slug).trim()||e.push("Slug"),Wl(t.categories).map(Wr).filter(Boolean).length===0&&e.push("Category"),rs(t.excerpt).trim()||e.push("Excerpt"),rs(t.image).trim()||e.push("Cover image"),e}const gk=8;function xk(t){const e=rs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function Wpe(t,e){return e!=="published"||xk(t)==="published"?!1:pk(t).length>0}function fre(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,gk).toISOString()}function qpe(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=rs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?fre(s):n}}function bk(t){return Au(t,"posts").map(({key:e,payload:s})=>({key:e,title:rs(s.title)||"Untitled post",slug:rs(s.slug),date:rs(s.date),scheduledDatetime:rs(s.scheduledDatetime),categorySlugs:Wl(s.categories).map(Wr).filter(Boolean),authorEmails:Wl(s.authors).map(hre).filter(Boolean),missing:pk(s),status:xk(s)}))}function mre(t,e){const s=Wl(t.categories);return s.some(n=>Wr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function pre(t,e){const s=Wl(t.categories);return s.length===1&&Wr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function Gpe(t,e,s){const n=Wl(t.categories);if(!n.some(a=>Wr(a)===e))return t;const i=n.map(a=>{const c=Wr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),r=new Set,l=i.filter(a=>{const c=Wr(a);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:l}}function gre(t,e){const s=Wl(t.categories);return s.some(n=>Wr(n)===e)?{...t,categories:s.filter(n=>Wr(n)!==e)}:t}function zb(t){return{...t,dateModified:new Date().toISOString()}}function fp(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 $1(t,e){const s=`collections/blog/${e}/${fp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function vk(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${fp(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-${fp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const xre={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"}},Fb="Box";function bre(t){return t.startsWith("site/")?"site":"app"}function vre(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function kd(...t){for(const e of t)if(e!==void 0)return e}function Ype(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(!Lre(r)||e.has(r))continue;e.add(r);const l=ll(r,t),a=yre(r),c=xre[a],d=bre(r),u=(d==="site"?kd(l.title,c?.title):kd(c?.title,l.title))??a,h=d==="site"?kd(l.description,c?.description):kd(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&vre(f)?f:void 0,p=m!==void 0?c?.iconName??Fb:kd(f,c?.iconName)??Fb;s.push({resolveType:r,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function yre(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const _re=["blog/sections/blocks/","site/sections/Blog/Post/"];function Lre(t){return _re.some(e=>t.startsWith(e))}const Jpe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Qpe=["January","February","March","April","May","June","July","August","September","October","November","December"],yk=1440*60*1e3;function Tl(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function Xpe(t){return new Date(t.getFullYear(),t.getMonth(),1)}function Zpe(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function yf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function mp(t,e){return Math.round((Tl(t).getTime()-Tl(e).getTime())/yk)}function wre(t){const e=(t.getTime()-Tl(t).getTime())/yk;return Math.min(Math.max(e,0),1)}function Ub(t,e){return mp(t,e)+wre(t)}function e2e(t){const e=yf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(yf(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 t2e(t,e){const s=Tl(t[0]),n=yf(s,7),i=s.getTime(),r=n.getTime(),l=[];for(const d of e){const u=Tl(d.start),h=Tl(d.end);if(h.getTime()<s.getTime()||u.getTime()>=n.getTime())continue;const f=u.getTime()<s.getTime()?s:u,m=h.getTime()>=n.getTime()?yf(n,-1):h,p=mp(f,s),g=mp(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),v=Ub(new Date(x),s),_=Math.max(Ub(new Date(b),s)-v,0);_<=0||l.push({variant:d,startCol:p,span:g,leftUnits:v,widthUnits:_})}l.sort((d,u)=>d.startCol-u.startCol||u.span-d.span||d.variant.blockKey.localeCompare(u.variant.blockKey));const a=[],c=[];for(const d of l){let u=a.findIndex(h=>h<=d.startCol);u===-1&&(u=a.length,a.push(0)),a[u]=d.startCol+d.span,c.push({...d,lane:u})}return c}function _f(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const _k=/^(\d{4})-(\d{2})-(\d{2})$/;function Lf(t){const e=t.trim();if(!e)return null;const s=_k.exec(e);if(s){const i=Number(s[1]),r=Number(s[2])-1,l=Number(s[3]),a=new Date(i,r,l);return a.getMonth()===r&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:Tl(n)}function Sre(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),gk);return{...vk("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:_f(t)}}function kre(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(_k.test(e))return Lf(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function jre(t,e){const s=kre(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:"")===_f(s)&&(i.date=_f(n)),i}function Cre(t){return Lf(t.scheduledDatetime)??Lf(t.date)}function s2e(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:Lf(i.scheduledDatetime)!==null},l=Cre(i);if(!l){s.push(r);continue}const a=_f(l),c=e.get(a);c?c.push(r):e.set(a,[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 Nre="0.161.0",Vre="0.162.0",n2e="deno task update";function Hb(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Kb(t,e){const s=Hb(t),n=Hb(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 Lk=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Tre(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=Lk.exec(s)?.[1];if(n)return n}return null}function Are(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=Lk.exec(n)?.[1];if(i)return i}return null}function Pre(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Tre(t.denoJson)??Are(t.meta);return!e||Kb(e,Nre)<0?{kind:"outdated",version:e}:Kb(e,Vre)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function i2e(t){return t.kind==="publish-only"||t.kind==="full"}function r2e(t){return t.kind==="full"}function Ere(t){const e=F.c(16),s=vs(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=g0(t.virtualMcpId),i=hs()?.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 l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const f=await f3({...t,threadId:i},p0(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==r||e[9]!==l||e[10]!==a?(c={queryKey:r,queryFn:l,enabled:a,staleTime:3e5},e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Mt(c),u=d??null;let h;return e[12]!==s||e[13]!==t.meta||e[14]!==u?(h=Pre({packageManager:s,denoJson:u,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=u,e[15]=h):h=e[15],h}function Rre({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=le(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=A.useState(!1),[h,f]=A.useState(c),[m,p]=A.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},v=async _=>{if(!i||m)return;let y;try{y=JSON.parse(_)}catch{ve.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(y),ve.success(r("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(L){ve.error(r("sectionsEditor.pageJsonDialog.saveError",{error:L instanceof Error?L.message:String(L)}))}finally{p(!1)}};return o.jsx(zt,{open:t,onOpenChange:e,children:o.jsxs(Bt,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(ds,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(qt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(fe,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(xr,{size:12}):o.jsx(hn,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(fe,{size:"sm",onClick:()=>v(h),disabled:!x||m,className:"h-7 text-xs",children:r(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?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(td,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{v(_)}})})]})})}function vi(t){const e=F.c(45),{icon:s,logoUrl:n,title:i,subtitle:r,active:l,accent:a,variantCount:c,trailing:d,selectable:u,selectionActive:h,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=a==="global";let _;e[0]!==s||e[1]!==l||e[2]!==v||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(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(We,{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",v?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:re("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:g3}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=_):_=e[5];const y=_,L=l?v?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":v?"hover:bg-global-section/10":"hover:bg-muted";let w;e[6]!==L?(w=re("group relative flex min-w-0 items-center rounded-md transition-colors",L),e[6]=L,e[7]=w):w=e[7];let S;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==i?(S=u&&o.jsx("span",{className:re("flex shrink-0 items-center pl-2.5 transition-opacity",f||h?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Dre,children:o.jsx(Xc,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=i,e[13]=S):S=e[13];const k=m&&!l&&"text-destructive";let j;e[14]!==k?(j=re("block truncate text-sm font-medium",k),e[14]=k,e[15]=j):j=e[15];let C;e[16]!==j||e[17]!==i?(C=o.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=C):C=e[18];const T=l?"text-accent-foreground/70":"text-muted-foreground";let N;e[19]!==T?(N=re("block truncate text-xs",T),e[19]=T,e[20]=N):N=e[20];let P;e[21]!==r||e[22]!==N?(P=o.jsx("span",{className:N,children:r}),e[21]=r,e[22]=N,e[23]=P):P=e[23];let V;e[24]!==P||e[25]!==C?(V=o.jsxs("span",{className:"min-w-0 flex-1",children:[C,P]}),e[24]=P,e[25]=C,e[26]=V):V=e[26];let E;e[27]!==l||e[28]!==m||e[29]!==p?(E=m&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:re("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:o.jsx(Vn,{size:14})})}),p&&o.jsx(We,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=E):E=e[30];let R;e[31]!==x||e[32]!==y||e[33]!==V||e[34]!==E||e[35]!==d?(R=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,V,E,d]}),e[31]=x,e[32]=y,e[33]=V,e[34]=E,e[35]=d,e[36]=R):R=e[36];let I;e[37]!==l||e[38]!==b?(I=b&&o.jsx("div",{className:re("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=I):I=e[39];let D;return e[40]!==R||e[41]!==I||e[42]!==w||e[43]!==S?(D=o.jsxs("div",{className:w,children:[S,R,I]}),e[40]=R,e[41]=I,e[42]=w,e[43]=S,e[44]=D):D=e[44],D}function Dre(t){return t.stopPropagation()}function Mo(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 l;e[2]!==n?(l=o.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(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,l,a]}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Ire={loaders:El,actions:hr},Mre={loaders:"Loaders",actions:"Actions"},Ore={analytics:kA,blog:Ec,commerce:SA,site:hT,website:zn};function $re(t,e){return e===0?Ore[t.toLowerCase()]??Go:Go}function ah(t,e){return e===0?nee(t):t}function Bre(t){const e=F.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c}=t,d=le();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u),[m,p]=A.useState(null),[g,x]=A.useState(""),[b,v]=A.useState(Gre),[_,y]=A.useState(c);_!==c&&(y(c),f([]),p(null),x(""),v(new Set));let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=U=>{v(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},e[1]=L):L=e[1];const w=L;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=x0(S);let j;e[6]!==k?(j=R3((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const C=j;let T;e[8]!==c?(T=nS(c),e[8]=c,e[9]=T):T=e[9];const N=T,P=Ire[c];let V,E,R,I,D,O,$;if(e[10]!==P||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==m||e[23]!==N||e[24]!==d||e[25]!==n){R=Symbol.for("react.early_return_sentinel");e:{const U=[...lS(l,a,c).map(qre),...rS(l,c).map(Wre)],H=g.trim().toLowerCase(),W=H.length>0,K=W?U.filter(xe=>xe.title.toLowerCase().includes(H)||xe.resolveType.toLowerCase().includes(H)):[],Q=new Map,X=[],se=new Map;if(!W){for(const xe of U){const Se=xe.folderPath;if(!(Se.length<h.length)&&h.every((Ce,Ae)=>Se[Ae]===Ce))if(Se.length===h.length)if(xe.savedKey!==void 0){const Ce=se.get(xe.resolveType);Ce?Ce.push(xe):se.set(xe.resolveType,[xe])}else X.push(xe);else{const Ce=Se[h.length],Ae=Q.get(Ce)??{count:0,savedCount:0};xe.savedKey!==void 0?Ae.savedCount=Ae.savedCount+1:Ae.count=Ae.count+1,Q.set(Ce,Ae)}}X.sort(Kre);for(const xe of se.values())xe.sort(Hre)}const ne=[...se.entries()].filter(xe=>{const[Se]=xe;return!X.some(Ce=>Ce.resolveType===Se)}).flatMap(Ure).sort(Fre);let te;e[33]!==h?(te=(xe,Se)=>ah(xe.name,h.length).localeCompare(ah(Se.name,h.length)),e[33]=h,e[34]=te):te=e[34];const ee=[...Q.entries()].map(zre).sort(te);let Y;e[35]===Symbol.for("react.memo_cache_sentinel")?(Y=xe=>{p(xe.savedKey!==void 0?{mode:"saved",key:xe.savedKey}:{mode:"available",resolveType:xe.resolveType,title:xe.title})},e[35]=Y):Y=e[35];const q=Y;let oe;e[36]!==k||e[37]!==N||e[38]!==d?(oe=async(xe,Se)=>{await k.mutateAsync({blockKey:xe,data:Se}),ve.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:N,blockId:xe})),p({mode:"saved",key:xe})},e[36]=k,e[37]=N,e[38]=d,e[39]=oe):oe=e[39];const J=oe;let ie;e[40]!==a||e[41]!==m?(ie=Yre(m,a),e[40]=a,e[41]=m,e[42]=ie):ie=e[42];const Z=ie;if(Z){const xe=`${Z.mode}:${Z.mode==="saved"?Z.blockKey:Z.resolveType}`;let Se;e[43]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>p(null),e[43]=Se):Se=e[43];let Ce;e[44]!==i||e[45]!==a||e[46]!==J||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==r||e[51]!==k.isPending||e[52]!==C||e[53]!==xe||e[54]!==Z.editorTarget||e[55]!==Z.initialValue||e[56]!==n?(Ce=o.jsx(ak,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c,target:Z.editorTarget,initialValue:Z.initialValue,isCreating:k.isPending,onCreate:J,onSaveReferencedBlock:C,onBack:Se},xe),e[44]=i,e[45]=a,e[46]=J,e[47]=c,e[48]=l,e[49]=s,e[50]=r,e[51]=k.isPending,e[52]=C,e[53]=xe,e[54]=Z.editorTarget,e[55]=Z.initialValue,e[56]=n,e[57]=Ce):Ce=e[57],R=Ce;break e}$="flex h-full w-full min-w-0 flex-col";let he;e[58]!==d?(he=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=he):he=e[59];let de;e[60]===Symbol.for("react.memo_cache_sentinel")?(de=()=>f([]),e[60]=de):de=e[60];const ae=h.length===0?"font-medium text-foreground":"text-muted-foreground";let ce;e[61]!==ae?(ce=re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ae),e[61]=ae,e[62]=ce):ce=e[62];const ue=Mre[c];let G;e[63]!==ce||e[64]!==ue?(G=o.jsx("button",{type:"button",onClick:de,className:ce,children:ue}),e[63]=ce,e[64]=ue,e[65]=G):G=e[65];let me;e[66]!==h?(me=h.map((xe,Se)=>{const Ce=Se===h.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(h.slice(0,Se+1)),className:re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Ce?"font-medium text-foreground":"text-muted-foreground"),children:ah(xe,Se)})]},`${xe}-${Se}`)}),e[66]=h,e[67]=me):me=e[67];let ye;e[68]!==he||e[69]!==G||e[70]!==me?(ye=o.jsxs("nav",{"aria-label":he,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[G,me]}),e[68]=he,e[69]=G,e[70]=me,e[71]=ye):ye=e[71];let we;e[72]===Symbol.for("react.memo_cache_sentinel")?(we=o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=we):we=e[72];let Ne;e[73]===Symbol.for("react.memo_cache_sentinel")?(Ne=xe=>x(xe.target.value),e[73]=Ne):Ne=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 _e;e[77]!==c||e[78]!==d?(_e=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=_e):_e=e[79];let Ve;e[80]!==g||e[81]!==je||e[82]!==_e?(Ve=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[we,o.jsx("input",{type:"text",value:g,onChange:Ne,placeholder:je,"aria-label":_e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=je,e[82]=_e,e[83]=Ve):Ve=e[83],e[84]!==ye||e[85]!==Ve?(E=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ye,Ve]}),e[84]=ye,e[85]=Ve,e[86]=E):E=e[86],V=ia,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(Mo,{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(xe=>o.jsx(vi,{icon:P,accent:xe.savedKey!==void 0?"global":void 0,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)},xe.savedKey??xe.resolveType))}):ee.length===0&&X.length===0&&ne.length===0?o.jsx(Mo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.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(xe=>{const Se=$re(xe.name,h.length);return o.jsxs("button",{type:"button",onClick:()=>f([...h,xe.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(Se,{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:ah(xe.name,h.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[xe.count," ",xe.count===1?N:c,xe.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:xe.savedCount})]})]})]})]},xe.name)})}),(X.length>0||ne.length>0)&&o.jsxs("div",{className:re("flex flex-col gap-1",ee.length>0&&"mt-4"),children:[X.map(xe=>{const Se=se.get(xe.resolveType)??[],Ce=b.has(xe.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(vi,{icon:P,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)}),Se.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>w(xe.resolveType),"aria-expanded":Ce,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:g3},children:[Ce?o.jsx(bs,{size:12,className:"shrink-0"}):o.jsx(Ws,{size:12,className:"shrink-0"}),d(Ce?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Se.length,")"]}),Ce&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Se.map(Ae=>o.jsx(vi,{icon:P,accent:"global",title:Ae.title,subtitle:Ae.resolveType,active:!1,onClick:()=>q(Ae)},Ae.savedKey))})]})]},xe.resolveType)}),ne.map(xe=>o.jsx(vi,{icon:P,accent:"global",title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)},xe.savedKey))]})]})}e[10]=P,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=m,e[23]=N,e[24]=d,e[25]=n,e[26]=V,e[27]=E,e[28]=R,e[29]=I,e[30]=D,e[31]=O,e[32]=$}else V=e[26],E=e[27],R=e[28],I=e[29],D=e[30],O=e[31],$=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;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]!==V||e[91]!==M||e[92]!==O?(z=o.jsx(V,{className:O,children:M}),e[90]=V,e[91]=M,e[92]=O,e[93]=z):z=e[93];let B;return e[94]!==E||e[95]!==z||e[96]!==$?(B=o.jsxs("div",{className:$,children:[E,z]}),e[94]=E,e[95]=z,e[96]=$,e[97]=B):B=e[97],B}function zre(t){const[e,s]=t;return{name:e,...s}}function Fre(t,e){return t.title.localeCompare(e.title)}function Ure(t){const[,e]=t;return e}function Hre(t,e){return t.title.localeCompare(e.title)}function Kre(t,e){return t.title.localeCompare(e.title)}function Wre(t){return{resolveType:t.resolveType,title:t.title,folderPath:oS(t.resolveType)}}function qre(t){return{resolveType:t.resolveType,title:t.title,folderPath:oS(t.resolveType),savedKey:t.key}}function Gre(){return new Set}function Yre(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}=aS(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function Jre(t){const e=F.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=le(),g=ao(),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,_]=A.useState(b);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[1]=y):y=e[1];const[L,w]=A.useState(y),[S,k]=A.useState(0),[j,C]=A.useState(!1);let T;e[2]!==l||e[3]!==c?(T=Bn(c,l),e[2]=l,e[3]=c,e[4]=T):T=e[4];const N=T,P=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,V=hs()?.taskId??null,E=r??void 0;let R;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==V||e[10]!==n?(R={orgSlug:s,virtualMcpId:n,branch:i,threadId:V,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=V,e[10]=n,e[11]=R):R=e[11];const I=R;let D,O,$,M,z,B,U,H;if(e[12]!==a||e[13]!==L||e[14]!==v||e[15]!==f||e[16]!==p||e[17]!==d){const ce=[d,...L],ue=me=>{w(L.slice(0,me)),k(Qre)};let G;e[26]!==a||e[27]!==v||e[28]!==f?(G=async me=>{const ye=z3(me,a);if(ye){ve.error(ye);return}await f(me,v),C(!1)},e[26]=a,e[27]=v,e[28]=f,e[29]=G):G=e[29],D=G,M="flex h-full w-full min-w-0",$="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]!==p?(z=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=z):z=e[31],B="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ce.map((me,ye)=>{const we=ye===ce.length-1,Ne=kn(me);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ye>0&&o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ue(ye),title:Ne,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",we?"font-medium text-foreground":"text-muted-foreground"),children:Ne})]},`${Ne}-${ye}`)}),e[12]=a,e[13]=L,e[14]=v,e[15]=f,e[16]=p,e[17]=d,e[18]=D,e[19]=O,e[20]=$,e[21]=M,e[22]=z,e[23]=B,e[24]=U,e[25]=H}else D=e[18],O=e[19],$=e[20],M=e[21],z=e[22],B=e[23],U=e[24],H=e[25];let W;e[32]!==z||e[33]!==B||e[34]!==U?(W=o.jsx("nav",{"aria-label":z,className:B,children:U}),e[32]=z,e[33]=B,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 Q;e[37]!==p?(Q=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=Q):Q=e[38];let X;e[39]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx(N2,{size:14}),e[39]=X):X=e[39];let se;e[40]!==h||e[41]!==Q?(se=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:K,"aria-label":Q,children:X})}),e[40]=h,e[41]=Q,e[42]=se):se=e[42];let ne;e[43]!==p?(ne=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=ne):ne=e[44];let te;e[45]!==ne?(te=o.jsx(We,{side:"bottom",children:ne}),e[45]=ne,e[46]=te):te=e[46];let ee;e[47]!==se||e[48]!==te?(ee=o.jsxs(qe,{children:[se,te]}),e[47]=se,e[48]=te,e[49]=ee):ee=e[49];let Y;e[50]!==W||e[51]!==ee||e[52]!==H?(Y=o.jsxs("div",{className:H,children:[W,ee]}),e[50]=W,e[51]=ee,e[52]=H,e[53]=Y):Y=e[53];const q="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",oe=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:P});let J;e[54]!==oe?(J=o.jsx("p",{className:q,children:oe}),e[54]=oe,e[55]=J):J=e[55];let ie;e[56]!==O||e[57]!==Y||e[58]!==J?(ie=o.jsxs("div",{className:O,children:[Y,J]}),e[56]=O,e[57]=Y,e[58]=J,e[59]=ie):ie=e[59];let Z;e[60]!==a||e[61]!==L||e[62]!==S||e[63]!==v||e[64]!==l||e[65]!==m||e[66]!==I||e[67]!==N||e[68]!==p?(Z=o.jsx(ia,{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($i,{schema:N,value:v,onChange:ce=>_(ce),basePath:"",breadcrumbPath:L,onBreadcrumbChange:w,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:I},S):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=L,e[62]=S,e[63]=v,e[64]=l,e[65]=m,e[66]=I,e[67]=N,e[68]=p,e[69]=Z):Z=e[69];let he;e[70]!==$||e[71]!==ie||e[72]!==Z?(he=o.jsxs("div",{className:$,children:[ie,Z]}),e[70]=$,e[71]=ie,e[72]=Z,e[73]=he):he=e[73];let de;e[74]!==u||e[75]!==D||e[76]!==h||e[77]!==j?(de=o.jsx(F3,{open:j,onOpenChange:C,defaultBlockId:u,isPending:h,onSubmit:D}),e[74]=u,e[75]=D,e[76]=h,e[77]=j,e[78]=de):de=e[78];let ae;return e[79]!==M||e[80]!==he||e[81]!==de?(ae=o.jsxs("div",{className:M,children:[he,de]}),e[79]=M,e[80]=he,e[81]=de,e[82]=ae):ae=e[82],ae}function Qre(t){return t+1}var Xre=Object.prototype.toString,ud=Array.isArray||function(e){return Xre.call(e)==="[object Array]"};function Q3(t){return typeof t=="function"}function Zre(t){return ud(t)?"array":typeof t}function B1(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Wb(t,e){return t!=null&&typeof t=="object"&&e in t}function eoe(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var toe=RegExp.prototype.test;function soe(t,e){return toe.call(t,e)}var noe=/\S/;function ioe(t){return!soe(noe,t)}var roe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function ooe(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return roe[s]})}var loe=/\s*/,aoe=/\s+/,qb=/\s*=/,coe=/\s*\}/,doe=/#|\^|\/|>|\{|&|=|!/;function uoe(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],l=!1,a=!1,c="",d=0;function u(){if(l&&!a)for(;r.length;)delete i[r.pop()];else r=[];l=!1,a=!1}var h,f,m;function p(k){if(typeof k=="string"&&(k=k.split(aoe,2)),!ud(k)||k.length!==2)throw new Error("Invalid tags: "+k);h=new RegExp(B1(k[0])+"\\s*"),f=new RegExp("\\s*"+B1(k[1])),m=new RegExp("\\s*"+B1("}"+k[1]))}p(e||Ei.tags);for(var g=new b0(t),x,b,v,_,y,L;!g.eos();){if(x=g.pos,v=g.scanUntil(h),v)for(var w=0,S=v.length;w<S;++w)_=v.charAt(w),ioe(_)?(r.push(i.length),c+=_):(a=!0,s=!0,c+=" "),i.push(["text",_,x,x+1]),x+=1,_===`
624
+ `)}function Nb(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function one(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 lne(t){return t.map((e,s)=>({...e,index:s}))}function XS(t){const e=F.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:l,onDelete:a}=t,c=le(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let u;e[0]!==d?(u=re("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=u):u=e[1];let h;e[2]!==u?(h=o.jsx(Uf,{className:u}),e[2]=u,e[3]=h):h=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx($o,{className:"h-4 w-4 shrink-0",style:{color:ine}}),e[4]=f):f=e[4];let m;e[5]!==s?(m=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==r||e[13]!==c?(p=!i&&o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{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:cne,onPointerDown:ane,children:o.jsx(li,{size:14})})}),o.jsxs(Kt,{align:"end",children:[r&&o.jsxs(Je,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(T6,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Je,{onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(hn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Je,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(nn,{size:14}),c("sectionsEditor.sectionVariantList.delete")]})]})]}),e[7]=n,e[8]=i,e[9]=s,e[10]=a,e[11]=l,e[12]=r,e[13]=c,e[14]=p):p=e[14];let g;return e[15]!==h||e[16]!==m||e[17]!==p?(g=o.jsxs(o.Fragment,{children:[h,f,m,p]}),e[15]=h,e[16]=m,e[17]=p,e[18]=g):g=e[18],g}function ane(t){return t.stopPropagation()}function cne(t){return t.stopPropagation()}function dne(t){const e=F.c(27),{entry:s,selected:n,canDelete:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c}=t;let d;e[0]!==s.id?(d={id:s.id,animateLayoutChanges:une},e[0]=s.id,e[1]=d):d=e[1];const{attributes:u,listeners:h,setNodeRef:f,transform:m,isDragging:p}=Fg(d);let g;e[2]!==m?(g=fr.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=g):g=e[3];const x=p?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 _;e[7]!==r?(_=j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),r())},e[7]=r,e[8]=_):_=e[8];const y=p?"cursor-grabbing":"cursor-grab",L=n?QS:rne;let w;e[9]!==y||e[10]!==L?(w=re("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",y,L),e[9]=y,e[10]=L,e[11]=w):w=e[11];let S;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(S=o.jsx(XS,{label:s.label,canDelete:i,onRename:l,onDuplicate:a,onDelete:c}),e[12]=i,e[13]=s.label,e[14]=c,e[15]=a,e[16]=l,e[17]=S):S=e[17];let k;return e[18]!==u||e[19]!==h||e[20]!==r||e[21]!==f||e[22]!==v||e[23]!==_||e[24]!==w||e[25]!==S?(k=o.jsx("div",{ref:f,style:v,...u,...h,onClick:r,onKeyDown:_,className:w,children:S}),e[18]=u,e[19]=h,e[20]=r,e[21]=f,e[22]=v,e[23]=_,e[24]=w,e[25]=S,e[26]=k):k=e[26],k}function une(){return!1}function hne(t){const e=F.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:u,onAdd:h}=t,f=le(),m=n.length>1;let p;e[0]!==n?(p=()=>Nb(n),e[0]=n,e[1]=p):p=e[1];const[g,x]=A.useState(p),[b,v]=A.useState(null),[_,y]=A.useState(s),[L,w]=A.useState(n.length);let S;e[2]!==n?(S=()=>Cb(n),e[2]=n,e[3]=S):S=e[3];const[k,j]=A.useState(S),C=A.useRef(!1),T=Cb(n);_!==s?(y(s),w(n.length),j(T),x(Nb(n))):(L!==n.length||k!==T)&&(w(n.length),j(T),x(ae=>one(ae,n)));let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N={activationConstraint:{distance:8}},e[4]=N):N=e[4];let P;e[5]===Symbol.for("react.memo_cache_sentinel")?(P={coordinateGetter:Ug},e[5]=P):P=e[5];const V=Rg(Mc(c0,N),Mc(a0,P));let E;e[6]!==g?(E=g.map(fne),e[6]=g,e[7]=E):E=e[7];const R=E;let I;e[8]!==g?(I=ae=>{const ce=String(ae.active.id);v(g.find(ue=>ue.id===ce)??null)},e[8]=g,e[9]=I):I=e[9];const D=I;let O;e[10]!==R||e[11]!==u?(O=ae=>{v(null);const{active:ce,over:ue}=ae;if(!ue||ce.id===ue.id)return;const G=R.indexOf(String(ce.id)),me=R.indexOf(String(ue.id));G===-1||me===-1||(x(ye=>lne(Oc([...ye],G,me))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),u(G,me))},e[10]=R,e[11]=u,e[12]=O):O=e[12];const $=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{v(null)},e[13]=M):M=e[13];const z=M;let B,U,H,W,K,Q,X,se,ne,te,ee,Y,q;if(e[14]!==m||e[15]!==g||e[16]!==R||e[17]!==$||e[18]!==D||e[19]!==h||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==r||e[25]!==i||e[26]!==V||e[27]!==f){const ae=Be=>{C.current||r(Be)};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 ue;e[43]!==ce?(ue=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ce}),e[43]=ce,e[44]=ue):ue=e[44];let G;e[45]!==f?(G=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=G):G=e[46];let me;e[47]===Symbol.for("react.memo_cache_sentinel")?(me=o.jsx(Gt,{size:14}),e[47]=me):me=e[47];let ye;e[48]!==h||e[49]!==G?(ye=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":G,className:"size-6",onClick:h,children:me})}),e[48]=h,e[49]=G,e[50]=ye):ye=e[50];let we;e[51]!==f?(we=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=we):we=e[52];let Ne;e[53]!==we?(Ne=o.jsx(We,{children:we}),e[53]=we,e[54]=Ne):Ne=e[54];let je;e[55]!==ye||e[56]!==Ne?(je=o.jsxs(qe,{children:[ye,Ne]}),e[55]=ye,e[56]=Ne,e[57]=je):je=e[57];let _e;e[58]!==f?(_e=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=_e):_e=e[59];let Ve;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ve=o.jsx(nn,{size:14}),e[60]=Ve):Ve=e[60];let xe;e[61]!==d||e[62]!==_e?(xe=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":_e,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Ve})}),e[61]=d,e[62]=_e,e[63]=xe):xe=e[63];let Se;e[64]!==f?(Se=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Se):Se=e[65];let Ce;e[66]!==Se?(Ce=o.jsx(We,{children:Se}),e[66]=Se,e[67]=Ce):Ce=e[67];let Ae;e[68]!==xe||e[69]!==Ce?(Ae=o.jsxs(qe,{children:[xe,Ce]}),e[68]=xe,e[69]=Ce,e[70]=Ae):Ae=e[70];let st;e[71]!==je||e[72]!==Ae?(st=o.jsxs("div",{className:"flex items-center gap-0.5",children:[je,Ae]}),e[71]=je,e[72]=Ae,e[73]=st):st=e[73],e[74]!==ue||e[75]!==st?(Y=o.jsxs("div",{className:"flex items-center justify-between",children:[ue,st]}),e[74]=ue,e[75]=st,e[76]=Y):Y=e[76],U=Og,Q=V,X=v_,se=D,ne=$,te=z,B=zg,W=R,K=Bg,q="space-y-0.5",H=g.map(Be=>o.jsx(dne,{entry:Be,selected:Be.index===i,canDelete:m,onSelect:()=>ae(Be.index),onRename:l?()=>l(Be.index):void 0,onDuplicate:()=>a(Be.index),onDelete:()=>c(Be.index)},Be.id)),e[14]=m,e[15]=g,e[16]=R,e[17]=$,e[18]=D,e[19]=h,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=r,e[25]=i,e[26]=V,e[27]=f,e[28]=B,e[29]=U,e[30]=H,e[31]=W,e[32]=K,e[33]=Q,e[34]=X,e[35]=se,e[36]=ne,e[37]=te,e[38]=ee,e[39]=Y,e[40]=q}else B=e[28],U=e[29],H=e[30],W=e[31],K=e[32],Q=e[33],X=e[34],se=e[35],ne=e[36],te=e[37],ee=e[38],Y=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 J;e[80]!==B||e[81]!==W||e[82]!==K||e[83]!==oe?(J=o.jsx(B,{items:W,strategy:K,children:oe}),e[80]=B,e[81]=W,e[82]=K,e[83]=oe,e[84]=J):J=e[84];let ie;e[85]!==b||e[86]!==m?(ie=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",QS),children:o.jsx(XS,{label:b.label,canDelete:m,dragging:!0})}):null,e[85]=b,e[86]=m,e[87]=ie):ie=e[87];let Z;e[88]!==ie?(Z=In.createPortal(o.jsx($g,{dropAnimation:yS,children:ie}),document.body),e[88]=ie,e[89]=Z):Z=e[89];let he;e[90]!==U||e[91]!==Q||e[92]!==X||e[93]!==se||e[94]!==ne||e[95]!==te||e[96]!==J||e[97]!==Z?(he=o.jsxs(U,{sensors:Q,collisionDetection:X,onDragStart:se,onDragEnd:ne,onDragCancel:te,children:[J,Z]}),e[90]=U,e[91]=Q,e[92]=X,e[93]=se,e[94]=ne,e[95]=te,e[96]=J,e[97]=Z,e[98]=he):he=e[98];let de;return e[99]!==ee||e[100]!==Y||e[101]!==he?(de=o.jsxs("div",{className:ee,children:[Y,he]}),e[99]=ee,e[100]=Y,e[101]=he,e[102]=de):de=e[102],de}function fne(t){return t.id}const mne=[[/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"]],pne={"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 E1(t){return sa(t)!==void 0}function K3(t,e){if(e){if(E1(e))return e;const s=pne[e];if(s&&E1(s))return s}for(const[s,n]of mne)if(s.test(t)&&E1(n))return n;return"FilterLines"}function gne(t){return sa(t)??M2}function R1(t){const e=F.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let l;e[0]!==s?(l=gne(s),e[0]=s,e[1]=l):l=e[1];const a=l,c=r==="sm"?"size-7":"size-9",d=r==="sm"?16:18;let u;e[2]!==c||e[3]!==i?(u=re("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let h;e[5]!==a||e[6]!==d?(h=o.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=h):h=e[7];let f;return e[8]!==u||e[9]!==h?(f=o.jsx("div",{className:u,children:h}),e[8]=u,e[9]=h,e[10]=f):f=e[10],f}function Ipe(t,e){return rX(t,e).map(s=>{const n=e[s.blockKey]??{},i=Ew(aX(s.blockKey),e,t);return{blockKey:s.blockKey,title:Fl(s.blockKey,n),description:zc(i),iconName:K3(s.matcherResolveType)}})}const ZS="Users03";function xne(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function bne(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 l of Object.keys(r)){if(l.toLowerCase().includes("always")||n.has(l))continue;n.add(l);const a=ll(l,t);s.push({resolveType:l,title:a.title??gs(l),description:a.description,iconName:K3(l,a.icon)})}return s}function vne(t,e){if(!t)return ZS;const s=e.find(n=>n.resolveType===t);return s?s.iconName:K3(t)}function yne(t){const e=F.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[u,h]=A.useState(!1),f=le(),p=(i?d.find(Y=>Y.blockKey===i):void 0)?.iconName??vne(s,r),g=sa(p);let x;e[0]!==a||e[1]!==h?(x=Y=>{a(Y),h(!1)},e[0]=a,e[1]=h,e[2]=x):x=e[2];const b=x;let v;e[3]!==c||e[4]!==h?(v=Y=>{c?.(Y),h(!1)},e[3]=c,e[4]=h,e[5]=v):v=e[5];const _=v;let y;e[6]!==h?(y=()=>h(!0),e[6]=h,e[7]=y):y=e[7];let L;e[8]!==g?(L=g&&o.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[8]=g,e[9]=L):L=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(bs,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=S):S=e[12];let k;e[13]!==y||e[14]!==L||e[15]!==w?(k=o.jsxs("button",{type:"button",onClick:y,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:[L,w,S]}),e[13]=y,e[14]=L,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 T;e[21]!==f?(T=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=T):T=e[22];let N;e[23]!==T?(N=o.jsx(di,{placeholder:T}),e[23]=T,e[24]=N):N=e[24];let P;e[25]!==f?(P=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=P):P=e[26];let V;e[27]!==P?(V=o.jsx($n,{children:P}),e[27]=P,e[28]=V):V=e[28];let E;e[29]!==f?(E=f("sectionsEditor.matcherPicker.alwaysLabel"),e[29]=f,e[30]=E):E=e[30];let R;e[31]!==f?(R=f("sectionsEditor.matcherPicker.targetAllUsers"),e[31]=f,e[32]=R):R=e[32];const I=`${E} ${R}`;let D;e[33]!==b?(D=()=>b(""),e[33]=b,e[34]=D):D=e[34];const O=!s&&!i&&"bg-accent/60";let $;e[35]!==O?($=re("gap-2.5",O),e[35]=O,e[36]=$):$=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(R1,{iconName:ZS,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 B;e[40]!==z?(B=o.jsx("span",{className:"text-sm",children:z}),e[40]=z,e[41]=B):B=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]!==B||e[47]!==H?(W=o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[B,H]}),e[46]=B,e[47]=H,e[48]=W):W=e[48];let K;e[49]!==I||e[50]!==D||e[51]!==$||e[52]!==W?(K=o.jsxs(ls,{value:I,onSelect:D,className:$,children:[M,W]}),e[49]=I,e[50]=D,e[51]=$,e[52]=W,e[53]=K):K=e[53];let Q;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let Y;e[59]!==i||e[60]!==s||e[61]!==b?(Y=q=>o.jsxs(ls,{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(R1,{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]=Y):Y=e[62],Q=r.map(Y),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=Q}else Q=e[58];let X;e[63]!==K||e[64]!==Q?(X=o.jsxs(Ps,{children:[K,Q]}),e[63]=K,e[64]=Q,e[65]=X):X=e[65];let se;e[66]!==i||e[67]!==d||e[68]!==_||e[69]!==f?(se=d.length>0&&o.jsx(Ps,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(Y=>o.jsxs(ls,{value:`${Y.title} ${Y.blockKey} ${Y.description??""}`,onSelect:()=>_(Y.blockKey),className:re("gap-2.5",i===Y.blockKey&&"bg-accent/60"),children:[o.jsx(R1,{iconName:Y.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:Y.title}),Y.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Y.description})]})]},Y.blockKey))}),e[66]=i,e[67]=d,e[68]=_,e[69]=f,e[70]=se):se=e[70];let ne;e[71]!==V||e[72]!==X||e[73]!==se?(ne=o.jsxs(ui,{children:[V,X,se]}),e[71]=V,e[72]=X,e[73]=se,e[74]=ne):ne=e[74];let te;e[75]!==u||e[76]!==h||e[77]!==C||e[78]!==N||e[79]!==ne||e[80]!==j?(te=o.jsxs(dP,{open:u,onOpenChange:h,title:j,description:C,className:"sm:max-w-lg",filter:xne,children:[N,ne]}),e[75]=u,e[76]=h,e[77]=C,e[78]=N,e[79]=ne,e[80]=j,e[81]=te):te=e[81];let ee;return e[82]!==te||e[83]!==k?(ee=o.jsxs(o.Fragment,{children:[k,te]}),e[82]=te,e[83]=k,e[84]=ee):ee=e[84],ee}const _ne="website/sections/Rendering/Lazy.tsx";function vf(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function W3(t){if(!vf(t))return!1;const e=t.__resolveType;return typeof e=="string"&&js(e)}function Lne(t){return t!=null}function hp(t){if(t==null)return t;if(W3(t)){const e=t.section;return e==null?null:vf(e)?e:{}}return vf(t)?t:void 0}function wne(t,e){return t===null?null:W3(e)?{...e,section:t}:t}function Mpe(t){return{__resolveType:t}}function Ope(t,e){if(!Lne(e))return null;if(t){const s=hp(e)??{};return{__resolveType:_ne,section:s}}return W3(e)?hp(e)??null:vf(e)?e:null}const Sne="General";function Fc(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function ek(t,e){return t===el?Sne:e}function tk(t){const e=lf(t),s=new Set,n=[];for(const i of e)Fc(i.resolveType)&&(ri(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:ek(i.resolveType,i.title),description:i.description})));return n}function q3(t){const e=of(t),s=Bn(e,t),n=tk(s?.properties?.seo);return n.length>0?n:kne(t)}function kne(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(!Fc(r))continue;const l=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:ek(r,l)})}return s}function sk(t){const e=q3(t),s=e.find(n=>n.resolveType===el);return s?s.resolveType:e[0]?.resolveType??el}function nk(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=Bn(s,t),i=tk(n?.properties?.seo);if(i.length>0)return i}return q3(t)}function jne(t,e){const s=nk(t,e),n=s.find(i=>i.resolveType===el);return n?n.resolveType:s[0]?.resolveType??sk(t)}function Cne(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:sk(t)}function Nne(t,e,s){const n=s.__resolveType;return typeof n=="string"&&Fc(n)?n:jne(t,e)}const Vne=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),el="website/sections/Seo/SeoV2.tsx",Tne=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function ru(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ane(t){return typeof t.__resolveType=="string"&&Fc(t.__resolveType)?!0:Tne.some(e=>e in t)}function Pne(t,e){for(const[s,n]of Object.entries(t)){if(!ru(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&Vne.has(r))continue;const l=i.seo;if(ru(l)){const a=l;if(Ane(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Nne(e,i,a):typeof a.__resolveType=="string"&&Fc(a.__resolveType)?a.__resolveType:el}}}for(const[s,n]of Object.entries(t)){if(!ru(n))continue;const i=n;if(typeof i.__resolveType=="string"&&Fc(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function Ene(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function $pe(t,e,s){if(e.kind==="site"){const c=Pne(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?nk(s,c.blockData):void 0,build:d=>Ene(c,d)}:null}const n=t[e.pageKey];if(!ru(n))return null;const i=n,r=i.seo,l=hp(r),a=l&&ru(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:r,seoResolveType:s?Cne(s,a):typeof a?.__resolveType=="string"?a.__resolveType:el,seoTypeOptions:s?q3(s):void 0,build:c=>({...i,seo:c===null?null:wne(c,r)})}}const G3=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],Rne=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],Dne=["jsonLD","title","description","noIndexing","configJsonLD"];function ik(t){return t===el||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function Ine(t){switch(t){case"general":return G3;case"pdp":return Rne;case"plp":return Dne;default:return null}}function rk(t,e){const s=Ine(ik(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 Mne(){return G3.filter(t=>t!=="type")}function One(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function $ne(t,e){return t[e]===void 0}function Bne(t){const e=F.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:l}=t,a=le(),d=rk(s,el).properties??{},u=Mne();let h;e[0]!==r?(h=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=h):h=e[1];const f=h,[m,p]=A.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=A.useState(g);m!==l&&(p(l),b({}));let v;e[3]!==x||e[4]!==n?(v=j=>x[j]!==void 0?x[j]:$ne(n,j),e[3]=x,e[4]=n,e[5]=v):v=e[5];const _=v;let y;e[6]!==i||e[7]!==r||e[8]!==n?(y=(j,C)=>{b(N=>({...N,[j]:C}));const T={...n};if(C)delete T[j];else{const N=r?.[j];T[j]=N??(j==="type"?"website":"")}i(T)},e[6]=i,e[7]=r,e[8]=n,e[9]=y):y=e[9];const L=y,w="min-w-0 space-y-6",S=G3.map(j=>{const C=d[j];if(!C)return null;const T=f&&u.includes(j),N=T&&_(j),P=N?r?.[j]??n[j]:n[j],V=C.title??One(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:re(N&&"pointer-events-none opacity-60"),children:Kl({schema:C,value:P,onChange:E=>{N||i({...n,[j]:E})},path:j,label:V,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:zne})}),T&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ti,{id:`seo-use-default-${j}`,checked:N,onCheckedChange:E=>L(j,E)}),o.jsx(Dt,{htmlFor:`seo-use-default-${j}`,className:"text-xs font-normal text-muted-foreground",children:a("sectionsEditor.generalSeoForm.useDefault")})]})]},j)});let k;return e[10]!==l||e[11]!==S?(k=o.jsx("div",{className:w,children:S},l),e[10]=l,e[11]=S,e[12]=k):k=e[12],k}function zne(){}function Fne(t){const e=F.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(ik(n)==="general"){let g;e[0]!==l?(g=b=>l(b),e[0]=l,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(Bne,{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 u;e[8]!==n||e[9]!==s?(u=rk(s,n),e[8]=n,e[9]=s,e[10]=u):u=e[10];const h=u;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const m=a??Une;let p;return e[12]!==h||e[13]!==r||e[14]!==l||e[15]!==m||e[16]!==i?(p=o.jsx($i,{schema:h,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:m},r),e[12]=h,e[13]=r,e[14]=l,e[15]=m,e[16]=i,e[17]=p):p=e[17],p}function Une(){}function Hne(t){const e=F.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=le();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u);let m;e[1]!==h||e[2]!==d?(m=h.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($h,{className:"size-3.5"})}),h.map((x,b)=>{const v=b===h.length-1,_=kn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(h.slice(0,b+1)),title:_,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:_})]},`${_}-${b}`)})]}),e[1]=h,e[2]=d,e[3]=m):m=e[3];let p;e[4]!==h||e[5]!==l||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(p=o.jsx($i,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:h,onBreadcrumbChange:f,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=h,e[5]=l,e[6]=r,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"space-y-2",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Bpe(t){const e=F.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:u,siteDefaultSeo:h,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const _=v;let y;e[2]!==s||e[3]!==_||e[4]!==m||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==r||e[10]!==b||e[11]!==p||e[12]!==x||e[13]!==g||e[14]!==u||e[15]!==h?(y=s&&n?u?o.jsx(Fne,{schema:s,resolveType:u,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:l,siteDefaultSeo:h}):o.jsx($i,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:_,onBreadcrumbChange:l,meta:f,decofile:m,onSaveReferencedBlock:p,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=_,e[4]=m,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=r,e[10]=b,e[11]=p,e[12]=x,e[13]=g,e[14]=u,e[15]=h,e[16]=y):y=e[16];const L=y;let w;e[17]!==c||e[18]!==L?(w=L??o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=L,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 zpe="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 Fpe(t,e){return zX(t,e,zc)}function Upe(t){const e=F.c(71),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,l=le(),a=P9(),[c,d]=A.useState(n),[u,h]=A.useState(i),[f,m]=A.useState(s),[p,g]=A.useState(null),x=A.useRef(!1),[b,v]=A.useState(null);f!==s&&(m(s),d(n),h(i),g(null),v(null));let _;e[0]!==i||e[1]!==u?(_=()=>{if(x.current){x.current=!1;return}const Y=u.trim();if(Y===i.trim()){h(i),v(null);return}const q=N9(Y);if(q){v(q),h(i);return}v(null),g(Y)},e[0]=i,e[1]=u,e[2]=_):_=e[2];const y=_;let L;e[3]!==r||e[4]!==p?(L=()=>{p!==null&&(h(p),r("path",p),g(null))},e[3]=r,e[4]=p,e[5]=L):L=e[5];const w=L;let S;e[6]!==i?(S=()=>{h(i),g(null)},e[6]=i,e[7]=S):S=e[7];const k=S;let j;e[8]!==r?(j=Y=>{d(Y.target.value),r("name",Y.target.value)},e[8]=r,e[9]=j):j=e[9];let C;e[10]!==l?(C=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=C):C=e[11];let T;e[12]!==c||e[13]!==a||e[14]!==j||e[15]!==C?(T=o.jsx("input",{type:"text",value:c,readOnly:a,onChange:j,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:C}),e[12]=c,e[13]=a,e[14]=j,e[15]=C,e[16]=T):T=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=Y=>{h(Y.target.value),v(null)},e[17]=N):N=e[17];let P;e[18]!==i?(P=Y=>{Y.key==="Enter"?(Y.preventDefault(),Y.currentTarget.blur()):Y.key==="Escape"&&(Y.preventDefault(),x.current=!0,h(i),v(null),Y.currentTarget.blur())},e[18]=i,e[19]=P):P=e[19];let V;e[20]!==l?(V=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[20]=l,e[21]=V):V=e[21];let E;e[22]!==y||e[23]!==u||e[24]!==a||e[25]!==P||e[26]!==V?(E=o.jsx("input",{type:"text",value:u,readOnly:a,onChange:N,onBlur:y,onKeyDown:P,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:V}),e[22]=y,e[23]=u,e[24]=a,e[25]=P,e[26]=V,e[27]=E):E=e[27];let R;e[28]!==b?(R=b&&o.jsx("p",{className:"text-xs text-destructive",children:b}),e[28]=b,e[29]=R):R=e[29];const I=p!==null;let D;e[30]!==k?(D=Y=>{Y||k()},e[30]=k,e[31]=D):D=e[31];let O;e[32]!==l?(O=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[32]=l,e[33]=O):O=e[33];let $;e[34]!==O?($=o.jsx(Jr,{children:O}),e[34]=O,e[35]=$):$=e[35];const M=p??"";let z;e[36]!==i||e[37]!==l||e[38]!==M?(z=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:M}),e[36]=i,e[37]=l,e[38]=M,e[39]=z):z=e[39];let B;e[40]!==z?(B=o.jsx(Qr,{children:z}),e[40]=z,e[41]=B):B=e[41];let U;e[42]!==$||e[43]!==B?(U=o.jsxs(Yr,{children:[$,B]}),e[42]=$,e[43]=B,e[44]=U):U=e[44];let H;e[45]!==l?(H=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[45]=l,e[46]=H):H=e[46];let W;e[47]!==H?(W=o.jsx(Zr,{children:H}),e[47]=H,e[48]=W):W=e[48];let K;e[49]!==w?(K=Y=>{Y.preventDefault(),w()},e[49]=w,e[50]=K):K=e[50];let Q;e[51]!==l?(Q=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[51]=l,e[52]=Q):Q=e[52];let X;e[53]!==K||e[54]!==Q?(X=o.jsx(eo,{onClick:K,children:Q}),e[53]=K,e[54]=Q,e[55]=X):X=e[55];let se;e[56]!==W||e[57]!==X?(se=o.jsxs(Xr,{children:[W,X]}),e[56]=W,e[57]=X,e[58]=se):se=e[58];let ne;e[59]!==U||e[60]!==se?(ne=o.jsxs(Gr,{children:[U,se]}),e[59]=U,e[60]=se,e[61]=ne):ne=e[61];let te;e[62]!==I||e[63]!==D||e[64]!==ne?(te=o.jsx(qr,{open:I,onOpenChange:D,children:ne}),e[62]=I,e[63]=D,e[64]=ne,e[65]=te):te=e[65];let ee;return e[66]!==E||e[67]!==R||e[68]!==te||e[69]!==T?(ee=o.jsxs("div",{className:"space-y-1",children:[T,E,R,te]}),e[66]=E,e[67]=R,e[68]=te,e[69]=T,e[70]=ee):ee=e[70],ee}function Hpe(t){const e=F.c(13),{onClick:s}=t,n=le();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(Y2,{size:14}),e[2]=r):r=e[2];let l;e[3]!==s||e[4]!==i?(l=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{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]=l):l=e[5];let a;e[6]!==n?(a=n("sectionsEditor.sectionsEditorPanels.addVariant"),e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx(We,{side:"bottom",children:a}),e[8]=a,e[9]=c):c=e[9];let d;return e[10]!==l||e[11]!==c?(d=o.jsxs(qe,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const Vb=new WeakMap;function Kne(t,e){let s=Vb.get(e);s||(s=new Map,Vb.set(e,s));let n=s.get(t);return n===void 0&&(n=Bn(t,e),s.set(t,n)),n}function Wne(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function qne(t,e){return{__resolveType:e,variants:[{rule:$c(),value:structuredClone(t)},{rule:$c(),value:structuredClone(t)}]}}function Gne(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>C3(n.rule));return s?s.value:e[e.length-1]?.value}function Yne(t){const e=[...t.variants],s=e[e.length-1],n={rule:$c(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function Jne(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function Qne(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Xne(t,e,s){return e<t?t-1:Math.min(t,s-1)}function Zne(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 eie(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function Tb(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const Ab=new WeakMap;function tie(t){let e=Ab.get(t);return e||(e=bne(t),Ab.set(t,e)),e}function ok(t){const e=F.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=le(),{value:l,onChange:a,meta:c,path:d}=i,[u,h]=A.useState(0);if(!Wne(l)){let $;e[0]!==r?($=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=$):$=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(Y2,{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 B;return e[5]!==z?(B=o.jsx(We,{children:z}),e[5]=z,e[6]=B):B=e[6],o.jsxs("div",{className:"relative grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":$,onClick:()=>{a(qne(l,s)),h(0)},children:M})}),B]}),n(i)]})}const f=l,m=f.variants,p=Math.min(u,m.length-1);let g;e[7]!==r?(g=($,M)=>({index:M,label:zc($.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=r,e[8]=g):g=e[8];const x=m.map(g),b=m[p],v=b?.rule??{},_=v.__resolveType??"",y=b?.value,L=c?tie(c):[],w=_&&c?Kne(_,c):null,{__resolveType:S,...k}=v,j=()=>{a(Gne(f)),h(0)},C=()=>{const $=Yne(f);a($),h($.variants.length-1)},T=$=>{const M=Jne(f,$);M&&(a(M),h(Xne(p,$,M.variants.length)))},N=$=>{const M=Qne(f,$);a(M),h($+1)},P=($,M)=>{const z=Zne(f,$,M);a(z),p===$&&h(M)},V=$=>{const M=$?cX($,c):{__resolveType:x3};a(Tb(f,p,M))},E=$=>{const M=$,z=_?{...M,__resolveType:_}:{...M};a(Tb(f,p,z))},R=$=>{a(eie(f,p,$))},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(Dt,{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(hne,{listKey:I,variants:x,selectedIndex:p,onSelect:h,onDuplicate:N,onDelete:T,onRemoveAll:j,onReorder:P,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(yne,{currentRt:_,currentLabel:zc(v),matchers:L,onSelect:V}),w&&o.jsx("div",{className:"pt-1",children:o.jsx(Hne,{schema:w,value:k,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${p}-${_}`)})]}),n({...i,value:y,onChange:R})]})]})}const sie="website/loaders/secret.ts";function ou(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 nie(){return{__resolveType:sie,name:"",encrypted:""}}function iie(t){const{value:e,...s}=t;return s}function D1(t){const e=F.c(53),{schema:s,value:n,onChange:i,label:r,path:l,sandbox:a}=t,c=le();if(typeof n=="string"||n==null&&!ou(n)){const C=typeof n=="string"?n:"",T=a?.virtualMcpId;let N;e[0]!==r||e[1]!==l||e[2]!==s.description||e[3]!==T?(N=o.jsx(Fs,{htmlFor:l,label:r,description:s.description,virtualMcpId:T}),e[0]=r,e[1]=l,e[2]=s.description,e[3]=T,e[4]=N):N=e[4];let P;e[5]!==c?(P=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=P):P=e[6];let V;e[7]!==i?(V=I=>i(I.target.value),e[7]=i,e[8]=V):V=e[8];let E;e[9]!==l||e[10]!==C||e[11]!==P||e[12]!==V?(E=o.jsx(vt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:P,onChange:V,className:"h-10"}),e[9]=l,e[10]=C,e[11]=P,e[12]=V,e[13]=E):E=e[13];let R;return e[14]!==N||e[15]!==E?(R=o.jsxs("div",{className:"space-y-2",children:[N,E]}),e[14]=N,e[15]=E,e[16]=R):R=e[16],R}let d;e[17]!==n?(d=ou(n)?n:nie(),e[17]=n,e[18]=d):d=e[18];const u=d,h=typeof u.name=="string"?u.name:"",f=typeof u.encrypted=="string"&&u.encrypted,m=`${l}-name`,p=a?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==m||e[22]!==p?(g=o.jsx(Fs,{htmlFor:m,label:r,description:s.description,virtualMcpId:p}),e[19]=r,e[20]=s.description,e[21]=m,e[22]=p,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let v;e[26]!==u||e[27]!==i?(v=C=>i({...u,name:C.target.value}),e[26]=u,e[27]=i,e[28]=v):v=e[28];let _;e[29]!==h||e[30]!==x||e[31]!==b||e[32]!==v?(_=o.jsx(vt,{id:x,value:h,placeholder:b,onChange:v,className:"h-10"}),e[29]=h,e[30]=x,e[31]=b,e[32]=v,e[33]=_):_=e[33];const y=`${l}-value`;let L;e[34]!==f||e[35]!==c?(L=c(f?"sectionsEditor.secretField.leaveBlankPlaceholder":"sectionsEditor.secretField.secretValuePlaceholder"),e[34]=f,e[35]=c,e[36]=L):L=e[36];let w;e[37]!==u||e[38]!==f||e[39]!==i?(w=C=>{const T=C.target.value;if(!T){i(f?iie(u):u);return}i({...u,value:T})},e[37]=u,e[38]=f,e[39]=i,e[40]=w):w=e[40];let S;e[41]!==L||e[42]!==w||e[43]!==y?(S=o.jsx(vt,{id:y,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:L,onChange:w,className:"h-10"}),e[41]=L,e[42]=w,e[43]=y,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]!==_?(j=o.jsxs("div",{className:"space-y-2",children:[g,_,S,k]}),e[48]=S,e[49]=k,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function rie(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=[],l=d=>{d?.type==="object"&&d.properties&&r.push(d)};for(const d of s){const u=d.schema;if(u&&(u.type==="array"&&l(u.items),u.properties))for(const h of Object.values(u.properties))h?.type==="array"&&l(h.items)}if(r.length===0)return;if(i.length===0)return r.length===1?r[0]:void 0;let a,c=-1;for(const d of r){const u=d.properties??{},h=i.filter(f=>f in u).length*2+(d.titleBy?1:0);h>c&&(c=h,a=d)}return c>=2?a:void 0}function oie(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 lie=new Set(["__resolveType","@type"]);function aie(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 cie(t){if(T9(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 Pb(t){if(t.type==="array"&&t.items)return t;const e=t.items??cie(t);return e?{...t,type:"array",items:e}:null}function die(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 lk(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=Bn(n,s);return i?o.jsx($i,{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 Kl(t){const{schema:e,value:s}=t,n=a=>t.readOnly?o.jsx(hee,{children:a},t.path):a;if(ff(s)){const a=OX(s),c=Pb(e);if(a!==null&&c)return o.jsx(rh,{...t,schema:c,value:a,onChange:d=>t.onChange($X(s,d))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&T9(e)){const a=Pb(e);if(a)return o.jsx(rh,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!ff(s)&&e.type==="block-ref"){const a=rie(e,s)??oie(s);if(a){const c={...e,type:"array",items:a};return o.jsx(rh,{...t,schema:c,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(aie(e)){const a=e.anyOfRefs[0],c=a.schema?.properties?.variants?.items?.properties?.value,d=c&&c.type!=="block-ref"?c:e.plainSchema??c?.plainSchema??{type:"string"},u=h=>Kl({...h,schema:d});return o.jsx(ok,{...t,multivariateResolveType:a.resolveType,renderInnerField:u},t.path)}return e.anyOfRefs?o.jsx(Lb,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Xse,{...t},t.path);if(e.format==="image-uri")return n(o.jsx($se,{...t},t.path));if(e.format==="file-uri"||e.format==="video-uri")return n(o.jsx(Ise,{...t},t.path));if(e.format==="map")return n(o.jsx(nne,{...t},t.path));if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return n(o.jsx(dse,{...t},t.path));if(e.format==="location")return n(o.jsx(JS,{...t},t.path));if(e.enum&&e.enum.length>0)return n(o.jsx(Jee,{...t},t.path));if(e.type==="anyOf")return o.jsx(Lb,{...t},t.path);if(ou(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(D1,{...t},t.path);if(!e.format&&!e.enum){const a=lk(t);if(a)return a}const i=s??die(e.type,e.default);if(i==null)return ou(s)?n(o.jsx(D1,{...t},t.path)):null;if(ou(i))return n(o.jsx(D1,{...t,value:i},t.path));const r={...t,value:i},l=s==null?e.type??typeof i:Array.isArray(i)?"array":typeof i;if(l==="array"||Array.isArray(i))return o.jsx(rh,{...r},t.path);switch(l){case"boolean":return n(o.jsx(Kee,{...r},t.path));case"number":case"integer":return n(o.jsx(Hee,{...r},t.path));case"string":{const a=e.format;return n(a==="color-input"||a==="color"?o.jsx(nh,{...r},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(nh,{...r},t.path):o.jsx(nh,{...r},t.path))}case"object":return i!==null&&typeof i=="object"&&!Array.isArray(i)?o.jsx(Wte,{...r},t.path):null;default:return n(o.jsx(nh,{...r},t.path))}}function uie(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return Kl({...t,schema:e});const s=lk(t);return s||Kl(e?{...t,schema:e}:t)}function $i({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f}){const m=le(),p=P9(),g=t.properties;if(!g)return t.type==="inline-union"?Kl({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,readOnly:p}):null;if(MX(e)&&g.variants){const P=g.variants.items?.properties?.value;return o.jsx(ok,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:V=>uie(V,P)},n)}const x=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},b=Object.keys(g).filter(P=>!lie.has(P)&&g[P]?.hidden!==!0),v=new Set(t.required??[]);if(b.length===0)return o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sectionsEditor.sectionsEditor.noEditableFields")});const _=(P,V)=>{if(V===void 0){const{[P]:E,...R}=x;s(R);return}s({...x,[P]:V})},y=typeof x.__resolveType=="string"?x.__resolveType:void 0,L=b.filter(P=>{const V=g[P];return V!=null&&Ac(V,x[P])}).length>1,w=kte(b,g,x),S=i.length>0?Cte(b,g,x,i,a,l):null,k=S?g[S]:null,j=S&&k?[S]:b,C=S&&k?Ste(S,k,i,Tu(S,b,g)):i,T=wte(i,C),N=T.length>0&&r?P=>r([...T,...P]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:j.map(P=>{const V=g[P];if(!V)return null;const E=n?`${n}.${P}`:P,R=Tu(P,b,g),I=Hl(P,V),$=(T.length===0&&b.some(M=>{const z=g[M];return M!==P&&z!=null&&Hl(M,z)===I})||T.length===0&&w.has(P))&&N?V.type==="block-ref"?M=>N(_te(P,M)):M=>N(yte(R,M)):N;return Kl({schema:V,value:x[P],onChange:M=>_(P,M),path:E,label:R,readOnly:p,required:v.has(P),breadcrumbPath:C,onBreadcrumbChange:$,hasSiblingDrillDownFields:L,focused:S===P,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:y,previewBaseUrl:d,onAddSectionItem:u,onRequestAddSection:h,sandbox:f})})})}function hie(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(it,{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($t,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const Eb=3e4;function fie(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 mie(t,{resolveType:e,props:s}){let n;try{n=await fetch(hw(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Eb)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${Eb/1e3}s — the block may be slow or the preview unresponsive.`):a}const i=await n.text();let r=null,l=!1;try{r=i?JSON.parse(i):null,l=!0}catch{}if(!n.ok){const a=l&&r&&typeof r=="object"&&"error"in r&&typeof r.error=="string"?r.error:i||`Run failed (${n.status})`;throw new Error(a)}return l?r:i}function pie(t){const e=F.c(2);let s;return e[0]!==t?(s={mutationFn:n=>mie(t,n)},e[0]=t,e[1]=s):s=e[1],Es(s)}function ak({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:l,target:a,initialValue:c,isCreating:d,onCreate:u,onSaveReferencedBlock:h,onBack:f,showRun:m=!0}){const p=hs()?.taskId??null,g=le(),x=ao(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,v=Bn(a.resolveType,i),_=!v&&BQ(a.resolveType,i),y=_?zQ(c):null,L=v??y,[w,S]=A.useState(c),[k,j]=A.useState([]),[C,T]=A.useState(0),[N,P]=A.useState(!1),[V,E]=A.useState(null),[R,I]=A.useState(!1),[D,O]=A.useState(!1),[$,M]=A.useState(!1),z=V!==null,{save:B,flush:U,isPending:H}=P3({orgSlug:t,virtualMcpId:e,branch:s}),W=pie({orgSlug:t,virtualMcpId:e,branch:s,threadId:p});A.useEffect(()=>()=>{U()},[]);const K=nS(l),Q=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,X={orgSlug:t,virtualMcpId:e,branch:s,threadId:p,previewUrl:n??void 0,siteSlug:b},se=ie=>{S(ie),a.mode==="saved"&&B(a.blockKey,{__resolveType:a.resolveType,...ie})},ne=()=>{z?(E(null),P(!1),T(ie=>ie+1)):E(JSON.stringify(w,null,2))},te=ie=>{const Z=ie??"";try{const he=JSON.parse(Z);if(he&&typeof he=="object"&&!Array.isArray(he)){P(!1),se(he);return}P(!0)}catch{P(!0)}},ee=async ie=>{const Z=z3(ie,r);if(Z){ve.error(Z);return}await u(ie,{__resolveType:a.resolveType,...w}),I(!1)},Y=()=>{O(!0),W.mutate({resolveType:a.resolveType,props:w})},q=()=>{n&&window.open(fie(n,a.resolveType,w,Date.now()),"_blank","noopener")},oe=[a.title,...k],J=ie=>{j(k.slice(0,ie)),T(Z=>Z+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(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(qf,{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((ie,Z)=>{const he=Z===oe.length-1,de=kn(ie);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[Z>0&&o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>J(Z),title:de,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",he?"font-medium text-foreground":"text-muted-foreground"),children:de})]},`${de}-${Z}`)})}),a.mode==="saved"&&o.jsx(hie,{isPending:H,isError:!1}),m&&o.jsxs(fe,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:Y,disabled:W.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[W.isPending?o.jsx(it,{className:"size-3.5"}):o.jsx(Rl,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>I(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:o.jsx(N2,{size:14})})}),o.jsx(We,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:z?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:ne,"aria-label":g(z?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":z,children:z?o.jsx(Ks,{size:14}):o.jsx(ta,{size:14})})}),o.jsx(We,{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:a.mode==="saved"?g("sandbox.runnableBlockEditor.savedModeDescription",{singular:K}):g("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:Q,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&&$&&"hidden"),children:[o.jsx(ia,{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&&L===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})}),L?o.jsx($i,{schema:L,value:w,onChange:ie=>se(ie),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:h,sandbox:X},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),V!==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(td,{language:"json",height:"100%",code:V,onChange:te,onSave:ie=>{te(ie),U()}})})]})]}),D&&o.jsx(gie,{singular:K,result:{isPending:W.isPending,error:W.error,data:W.data,hasRun:W.status!=="idle"},expanded:$,onToggleExpand:()=>M(ie=>!ie),onOpenInNewTab:n?q:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(F3,{open:R,onOpenChange:I,defaultBlockId:"",isPending:d,onSubmit:ee})]})}function gie(t){const e=F.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:l,onClose:a}=t,c=le();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 u=d,h=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==h?(f=re("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=f):f=e[3];let m;e[4]!==c?(m=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=m):m=e[5];let p;e[6]!==m?(p=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:m}),e[6]=m,e[7]=p):p=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(fn,{size:14})})}),o.jsx(We,{side:"bottom",children:c("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:s})})]}),e[8]=l,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(rT,{size:14}):o.jsx(S6,{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(Ke,{asChild:!0,children:o.jsx(fe,{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 _;e[22]!==i||e[23]!==c?(_=c(i?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=i,e[23]=c,e[24]=_):_=e[24];let y;e[25]!==_?(y=o.jsx(We,{side:"bottom",children:_}),e[25]=_,e[26]=y):y=e[26];let L;e[27]!==y||e[28]!==v?(L=o.jsxs(qe,{children:[v,y]}),e[27]=y,e[28]=v,e[29]=L):L=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(Ks,{size:14}),e[32]=S):S=e[32];let k;e[33]!==a||e[34]!==w?(k=o.jsx(fe,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":w,children:S}),e[33]=a,e[34]=w,e[35]=k):k=e[35];let j;e[36]!==L||e[37]!==k||e[38]!==g?(j=o.jsxs("div",{className:"flex items-center gap-0.5",children:[g,L,k]}),e[36]=L,e[37]=k,e[38]=g,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==p?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[p,j]}),e[40]=j,e[41]=p,e[42]=C):C=e[42];let T;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==u||e[47]!==s||e[48]!==c?(T=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(it,{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(td,{language:"json",height:"100%",code:u,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]=u,e[47]=s,e[48]=c,e[49]=T):T=e[49];let N;return e[50]!==C||e[51]!==T||e[52]!==f?(N=o.jsxs("div",{className:f,children:[C,T]}),e[50]=C,e[51]=T,e[52]=f,e[53]=N):N=e[53],N}function xie(t){const e=F.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,blockKey:c}=t,d=le();let u;e[0]!==i||e[1]!==s||e[2]!==n?(u={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=u):u=e[3];const h=x0(u);let f;e[4]!==h?(f=R3((L,w)=>h.mutate({blockKey:L,data:w})),e[4]=h,e[5]=f):f=e[5];const m=f;let p;e[6]!==c||e[7]!==a?(p=aS(a,c),e[6]=c,e[7]=a,e[8]=p):p=e[8];const{resolveType:g,props:x,title:b}=p;if(!g){let L;e[9]!==d?(L=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=L):L=e[10];let w;return e[11]!==L?(w=o.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:L}),e[11]=L,e[12]=w):w=e[12],w}const v=`loader:${c}`;let _;e[13]!==c||e[14]!==g||e[15]!==b?(_={mode:"saved",blockKey:c,resolveType:g,title:b},e[13]=c,e[14]=g,e[15]=b,e[16]=_):_=e[16];let y;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==h.isPending||e[24]!==m||e[25]!==v||e[26]!==_||e[27]!==n?(y=o.jsx(ak,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:"loaders",target:_,initialValue:x,isCreating:h.isPending,onCreate:bie,onSaveReferencedBlock:m,showRun:!1},v),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=r,e[22]=x,e[23]=h.isPending,e[24]=m,e[25]=v,e[26]=_,e[27]=n,e[28]=y):y=e[28],y}async function bie(){}const vie="https://github.com/decocms/blocks";function yie(){const t=F.c(14),e=le();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(oT,{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 l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(fn,{size:14}),t[7]=l):l=t[7];let a;t[8]!==r?(a=o.jsx(fe,{size:"sm",asChild:!0,children:o.jsxs("a",{href:vie,target:"_blank",rel:"noreferrer",children:[r,l]})}),t[8]=r,t[9]=a):a=t[9];let c;return t[10]!==n||t[11]!==i||t[12]!==a?(c=o.jsx(Ci,{className:"h-full w-full",image:s,title:n,description:i,actions:a}),t[10]=n,t[11]=i,t[12]=a,t[13]=c):c=t[13],c}function _ie(t){const e=F.c(15),{source:s,onRetry:n}=t,i=le();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 l=r;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Vn,{size:48,className:"text-muted-foreground"}),e[3]=a):a=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 u;e[8]!==n||e[9]!==d?(u=o.jsx(fe,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=u):u=e[10];let h;return e[11]!==l||e[12]!==c||e[13]!==u?(h=o.jsx(Ci,{image:a,title:c,description:l,actions:u}),e[11]=l,e[12]=c,e[13]=u,e[14]=h):h=e[14],h}const Lie=A.lazy(()=>Gs(()=>import("./sections-editor-CVFGArcx.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])).then(t=>({default:t.SectionsEditor})));function Rb(t){const e=F.c(60),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:l}=He(),{currentBranch:a,taskId:c}=on(),d=vs(s),u=hg(d,a);let h;e[0]!==u||e[1]!==d?(h=sd(d)&&u,e[0]=u,e[1]=d,e[2]=h):h=e[2];const f=h,m=hi(),p=rl(),g=uS(),x=m.lifecycle.phase==="running",b=p.previewUrl;let v;e[3]!==a||e[4]!==l||e[5]!==b||e[6]!==c||e[7]!==s?(v=a?{orgSlug:l.slug,virtualMcpId:s,branch:a,threadId:c??null,previewUrl:b}:null,e[3]=a,e[4]=l,e[5]=b,e[6]=c,e[7]=s,e[8]=v):v=e[8];const _=v;let y;e[9]!==x?(y={fetchEnabled:x},e[9]=x,e[10]=y):y=e[10];const L=j9(_,y);let w;e[11]!==x?(w={fetchEnabled:x},e[11]=x,e[12]=w):w=e[12];const S=k3(_,w),k=Dw({lifecyclePhase:m.lifecycle.phase,decofile:uf(L),meta:uf(S),hasEditableContent:w3(L.data,S.data),fastPreviewActive:yn(s).runtime==="cms"});if(k.kind==="loading"){let H;return e[13]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(jl,{}),e[13]=H):H=e[13],H}if(k.kind==="empty"){let H;return e[14]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(yie,{}),e[14]=H):H=e[14],H}if(k.kind==="error"){let H;e[15]!==L||e[16]!==p||e[17]!==S||e[18]!==k.source?(H=()=>{if(k.source==="sandbox"){p.retry();return}Promise.all([L.refetch(),S.refetch()])},e[15]=L,e[16]=p,e[17]=S,e[18]=k.source,e[19]=H):H=e[19];const W=H;let K;return e[20]!==W||e[21]!==k.source?(K=o.jsx(_ie,{source:k.source,onRetry:W}),e[20]=W,e[21]=k.source,e[22]=K):K=e[22],K}let j;e[23]!==f||e[24]!==s?(j=H=>o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:o.jsx(mS,{readOnly:f,virtualMcpId:s,className:"h-full min-h-0",children:H})}),e[23]=f,e[24]=s,e[25]=j):j=e[25];const C=j,T=g.state.target;if(T?.kind==="loader"&&L.data&&S.data){const H=a??"",W=b??null;let K;e[26]!==L.data||e[27]!==S.data||e[28]!==l.slug||e[29]!==H||e[30]!==W||e[31]!==T.key||e[32]!==s?(K=o.jsx(xie,{orgSlug:l.slug,virtualMcpId:s,branch:H,previewUrl:W,meta:S.data,decofile:L.data,blockKey:T.key}),e[26]=L.data,e[27]=S.data,e[28]=l.slug,e[29]=H,e[30]=W,e[31]=T.key,e[32]=s,e[33]=K):K=e[33];let Q;return e[34]!==C||e[35]!==K?(Q=C(K),e[34]=C,e[35]=K,e[36]=Q):Q=e[36],Q}let N;e[37]!==a||e[38]!==l.slug||e[39]!==T||e[40]!==s?(N=T||!a?null:V3(N3(l.slug,s,a)),e[37]=a,e[38]=l.slug,e[39]=T,e[40]=s,e[41]=N):N=e[41];const P=N;let V="/",E=null,R=null;T?.kind==="page"?(V=T.path,E=T.key):T?.kind==="section"?R=T.key:P&&(V=P.path,E=P.pageKey);const I=E?`page:${E}`:R?`section:${R}`:`path:${V}`;let D;e[42]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})}),e[42]=D):D=e[42];const O=a??"",$=b??void 0,M=R?null:r,z=!!E&&g.state.editSeoPageKey===E;let B;e[43]!==R||e[44]!==E||e[45]!==V||e[46]!==I||e[47]!==i||e[48]!==l.slug||e[49]!==$||e[50]!==M||e[51]!==z||e[52]!==O||e[53]!==s||e[54]!==g.consumeEditSeo||e[55]!==g.setVariantOverride?(B=o.jsx(A.Suspense,{fallback:D,children:o.jsx(Lie,{orgSlug:l.slug,virtualMcpId:s,branch:O,previewReady:!0,previewUrl:$,currentPath:V,activePageBlockKey:E,activeGlobalBlockKey:R,externalSelection:M,initialEditSeo:z,onExitSeo:g.consumeEditSeo,onVariantPreviewOverride:g.setVariantOverride,onViewJsonFile:i},I)}),e[43]=R,e[44]=E,e[45]=V,e[46]=I,e[47]=i,e[48]=l.slug,e[49]=$,e[50]=M,e[51]=z,e[52]=O,e[53]=s,e[54]=g.consumeEditSeo,e[55]=g.setVariantOverride,e[56]=B):B=e[56];let U;return e[57]!==C||e[58]!==B?(U=C(B),e[57]=C,e[58]=B,e[59]=U):U=e[59],U}function Db(t){const e=F.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,l=le(),{org:a}=He(),{currentBranch:c,taskId:d}=on(),h=rl().previewUrl;let f;e[0]!==c||e[1]!==a.slug||e[2]!==h||e[3]!==d||e[4]!==s?(f=c?{orgSlug:a.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:h}:null,e[0]=c,e[1]=a.slug,e[2]=h,e[3]=d,e[4]=s,e[5]=f):f=e[5];const p=j9(f),g=c??"";let x;e[6]!==a.slug||e[7]!==g||e[8]!==s?(x={orgSlug:a.slug,virtualMcpId:s,branch:g},e[6]=a.slug,e[7]=g,e[8]=s,e[9]=x):x=e[9];const{save:b,flush:v}=P3(x),_=p.data?.[n],y=p.data===void 0&&p.isLoading,L=p.data!==void 0&&_===void 0,w=!c||L||y;let S;e[10]!==_?(S=_===void 0?"":JSON.stringify(_,null,2),e[10]=_,e[11]=S):S=e[11];const k=S;let j;e[12]!==n||e[13]!==w||e[14]!==b?(j=$=>{if(w)return;let M;try{M=JSON.parse($)}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 T;e[16]!==v?(T=()=>({flush:v}),e[16]=v,e[17]=T):T=e[17],A.useImperativeHandle(r,T);let N;e[18]!==l?(N=l("sectionsEditor.pageJsonDialog.titleShort"),e[18]=l,e[19]=N):N=e[19];let P;e[20]!==N?(P=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N}),e[20]=N,e[21]=P):P=e[21];let V;e[22]!==l?(V=l("sectionsEditor.pageJsonDialog.close"),e[22]=l,e[23]=V):V=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ks,{size:14}),e[24]=E):E=e[24];let R;e[25]!==i||e[26]!==V?(R=o.jsx(fe,{variant:"ghost",size:"icon",onClick:i,"aria-label":V,className:"size-7 shrink-0",children:E}),e[25]=i,e[26]=V,e[27]=R):R=e[27];let I;e[28]!==R||e[29]!==P?(I=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[P,R]}),e[28]=R,e[29]=P,e[30]=I):I=e[30];let D;e[31]!==p.data||e[32]!==v||e[33]!==k||e[34]!==y||e[35]!==L||e[36]!==n||e[37]!==w||e[38]!==C||e[39]!==l?(D=y?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})}):L?o.jsxs("div",{className:"p-4 text-xs font-mono text-foreground/60",children:["// ",l("sectionsEditor.pageJsonDialog.pageNotFound")]}):o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(td,{code:k,language:"json",readOnly:w,height:"100%",onChange:$=>C($??""),onSave:$=>{C($),v()}},`${n}:${p.data===void 0?"loading":"ready"}`)}),e[31]=p.data,e[32]=v,e[33]=k,e[34]=y,e[35]=L,e[36]=n,e[37]=w,e[38]=C,e[39]=l,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 wie(t,e){return t===e?"preview":e}function Sie(t){return t.runtime==="cms"&&t.cmsMode!=="off"?"blocks":"preview"}const kie=500,jie={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},Ib=1,I1=["desktop","mobile","tablet"],Mb={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Ob(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Cie(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 lh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function M1(t,e){try{return new URL(t,e).href}catch{return null}}function Nie(t,e,s){const n=t.toLowerCase(),i=e.toLowerCase(),r=i.split("/").filter(Boolean),l=c=>{if(c===s)return 100;const d=c.indexOf(s);if(d===-1)return 0;let u=40;return d===0?u+=30:/[\s/-]/.test(c[d-1]??"")&&(u+=20),u+=Math.round(s.length/c.length*20),u};let a=Math.max(l(n),l(i));return r.at(-1)===s?a=Math.max(a,95):r.includes(s)&&(a=Math.max(a,90)),a}function Vie(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function Tie({virtualMcpId:t}){const e=le(),s=Wu(),n=Yl(),i=wQ(),{openPanel:r}=Di(),{currentBranch:l,taskId:a}=on(),c=uS(),d=ao(),u=yn(t),h=e0(d?.entity?.id===t?d.entity.metadata?.ui?.layout??null:null),f=be=>r(be),[m,p]=A.useState(()=>Sie({runtime:u.runtime,cmsMode:h})),[g,x]=A.useState("desktop"),[b,v]=A.useState(null),[_,y]=A.useState(null),L=A.useRef(null),w=A.useRef(null),[S,k]=A.useState(!1),j=A.useRef(null),C=()=>{j.current?.flush(),k(!1)},T=()=>k(be=>(be&&j.current?.flush(),!be)),[N,P]=A.useState({width:0,height:0}),[V,E]=A.useState(null),[R,I]=A.useState(!1),[D,O]=A.useState(""),$=A.useRef(null),[M,z]=A.useState(!1),[B,U]=A.useState(),[H,W]=A.useState(null),[K,Q]=A.useState(null),[X,se]=A.useState(null),[ne,te]=A.useState("/"),[ee,Y]=A.useState(null),[q,oe]=A.useState({}),[J,ie]=A.useState(!1),Z=A.useRef(null),he=()=>{ie(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>ie(!1),15e3)},de=()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),ie(!1)},{org:ae}=He(),ce=hi(),ue=rl(),G=ue.vmEntry,me=ue.previewUrl,ye=ce.lifecycle.phase,we=ye==="running",Ne=s;cS({orgSlug:ae.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:Ne});const je=null,_e=d?.entity?.id===t?k2(d.entity.metadata):null,Ve=d?.entity?.id===t&&u.runtime==="cms",xe=u.projectDefault==="cms",Se=_X({sandboxUrl:me,previewServerUrl:_e,fastPreviewActive:Ve}),Ce=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:me}:null,Ae=j9(Ce,{fetchEnabled:we}),st=k3(Ce,{fetchEnabled:we}),Be=Ae.data,Ie=st.data,Oe=`${t}:${l??""}`,[mt,lt]=A.useState(null),Xe=Dw({lifecyclePhase:ye,decofile:uf(Ae),meta:uf(st),hasEditableContent:w3(Be,Ie),fastPreviewActive:Ve,frameworkKnownMissing:mt===Oe});Xe.kind==="empty"&&Xe.reason==="framework-missing"&&mt!==Oe&&lt(Oe);const nt=Be?cf(Be).sort((be,Pe)=>be.name.localeCompare(Pe.name)):[],Fe=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l}:null,dt=YZ(Fe),et=Be&&Ie?S3(Be,Ie):[],rt=Be&&Ie?lS(Ie,Be,"loaders"):[],gt=D?(()=>{const be=D.toLowerCase();return nt.map(Pe=>({page:Pe,score:Nie(Pe.name,Pe.path,be)})).filter(({score:Pe})=>Pe>0).sort((Pe,ut)=>ut.score-Pe.score||Pe.page.path.length-ut.page.path.length).map(({page:Pe})=>Pe)})():nt,pe=et.filter(be=>{if(!D)return!0;const Pe=D.toLowerCase();return be.name.toLowerCase().includes(Pe)||be.key.toLowerCase().includes(Pe)||be.resolveType.toLowerCase().includes(Pe)}),Me=rt.filter(be=>{if(!D)return!0;const Pe=D.toLowerCase();return be.title.toLowerCase().includes(Pe)||be.key.toLowerCase().includes(Pe)||be.resolveType.toLowerCase().includes(Pe)}),Ze=K?rt.find(be=>be.key===K)??null:null,ct=Fo,_t=H||K?null:ip(nt,ne,ee),wt=H?H.name:Ze?.title??_t?.name,ze=_t?.key??null,yt=_t?.path??null,At=(ze?q[ze]:void 0)??{},ht=Or(ne,At),ft={};if(we&&me&&Ie&&Be){const be=eee(Ie,"loaders"),Pe=ze?Be[ze]:void 0,ut=vZ(Pe,Be,ss=>be.has(ss)),Vt=mZ(ut);for(const ss of rf(ne)){if(ss.type!=="param")continue;const pn=uZ(ne,ss.name,ut),Ys=xZ(pn,be,Vt);Ys.length>0&&(ft[ss.name]=Ys)}}const at=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,pt=Be&&ze?Hw(Be,ze,0):[],Lt=Be?$w(pt,Be):[],bt=Lt.map(be=>be.isSavedBlock?be.label:""),Ft=Lt.map(be=>be.isSavedBlock?"global":be.isMultivariate?"variant":"normal"),ge=pt.map(be=>op(be,Be??{})),Ee=A.useRef(null),Re=A.useRef(null),ke=ce.status.state==="paused",ot=ce.phase,Le=Gw({claimPhase:ot,lifecycle:ce.lifecycle}),Qe=ue.previewState,St=ue.userStopped,ys=j3(ae.slug,t??"",l??""),{url:ts}=Ow(Ve&&t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,previewServerUrl:_e??null,path:ht}:null),Rn=xe&&u.runtime==="sandbox",kt=fQ({previewState:Qe,progressStatus:Le.status,previewServerUrl:_e,fastPreviewActive:Ve,fastPreviewReady:!!ts,codingSession:Rn}),Jn=kt.mode!=="none",vr=kt.mode==="production"&&kt.iframeBase?lh(kt.iframeBase):null,co=!s,Qn=kt.mode==="production"?vr:lh(me),uo=d?.entity?.id===t&&d.entity.metadata?.fastPreviewInPlace===!0,_n=kt.mode==="production"&&Ve&&uo&&m==="blocks",yr=A.useRef(null);_n||(yr.current=ts);const Bi=yr.current,ho=_n?Bi??ts:ts,Ms=Cie(kt.mode==="sandbox"?Q0(Ob(X??M1(ht,kt.iframeBase)??kt.iframeBase,g),c.state.variantOverride??[]):kt.mode==="production"&&co?Q0(Ob(Mw(X??ho??M1(ht,kt.iframeBase)??kt.iframeBase,kt.showWakingPill?vX:null),g),c.state.variantOverride??[]):null);A.useEffect(()=>{},[s,vr,V]);const _r="sandbox.preview.openInNewTab",fa=ts??(kt.iframeBase?M1(ht,kt.iframeBase):null),fo=kt.mode==="production"?fa?Q0(fa,c.state.variantOverride??[]):null:Ms??kt.iframeBase,mo=async()=>{const be=fo;if(be){window.open(be,"_blank","noopener");return}},Lr=t&&l?N3(ae.slug,t,l):null,fi=be=>{Lr&&aZ(Lr,be)},fs=c.state.target;A.useEffect(()=>{if(!(!fs||!Se||!Ie))if(fs.kind==="page"){const be=q[fs.key]??{};Re.current=Or(fs.path,be),W(null),Q(null),se(null),Y(fs.key),te(fs.path),fi({path:fs.path,pageKey:fs.key,params:be})}else if(fs.kind==="loader")Re.current=null,W(null),Q(fs.key),se(null);else{const be=et.find(Pe=>Pe.key===fs.key);if(be){Re.current=null;const Pe=of(Ie);Q(null),W(be),se(Z5(Se,Pe,be.key))}}},[fs,Se,Ie,q]),A.useEffect(()=>{!ze||yt===null||fs?.kind==="page"&&fs.key===ze&&fs.path===yt||c.selectTarget({kind:"page",key:ze,path:yt})},[ze,yt,fs]);const[ma,po]=A.useState(null);if(Qe.kind==="iframe"&&ma!==Qe.previewUrl){const be=ma!==null;po(Qe.previewUrl);const Pe=Lr?V3(Lr):null;if(Pe){if(Re.current=Or(Pe.path,Pe.params),te(Pe.path),Y(Pe.pageKey),se(null),W(null),Q(null),Pe.pageKey&&Object.keys(Pe.params).length>0){const ut=Pe.pageKey;oe(Vt=>({...Vt,[ut]:Pe.params}))}}else be&&(Re.current=null,te("/"),se(null),Y(null),W(null),Q(null))}Ee.current=Ms;const wr=xQ({iframeRef:L,src:kt.mode==="sandbox"?Ms:null,active:kt.mode==="sandbox"}),Sr=A.useRef(null);A.useEffect(()=>{if(!ts||!Ms||Sr.current===ts)return;Sr.current=ts;const be=L.current;be&&be.getAttribute("src")!==Ms&&(he(),be.src=Ms)},[ts,Ms]);const kr=()=>{const be=L.current?.contentWindow,Pe=Qn;if(!be||!Pe||!Be||!ze)return;const ut=Be[ze];if(!ut||typeof ut!="object")return;const Vt=yX({previewBaseUrl:Pe,pageBlock:ut,decofile:Be,path:ht,pathTemplate:ne});if(!Vt)return;const ss=Q0(Vt.src,c.state.variantOverride??[]);be.postMessage({type:"cms-editor::render",src:ss,body:Vt.body},Pe)},mi=A.useRef(null);A.useEffect(()=>{if(!_n||H||K||!ze||!Be){mi.current=null;return}const be=JSON.stringify({page:ze,path:ht,pathTemplate:ne,decofile:Be});if(mi.current===be)return;const Pe=mi.current===null;mi.current=be,!Pe&&kr()},[Be,_n,H,K,ze,ht,ne]);const zi=A.useRef(null);A.useEffect(()=>{if(!_n||H||K||!ze||!Be){zi.current=null;return}const be=JSON.stringify(c.state.variantOverride??null),Pe=zi.current;zi.current={page:ze,sig:be},!(!Pe||Pe.page!==ze||Pe.sig===be)&&kr()},[c.state.variantOverride,_n,H,K,ze]);const go=!!t&&!!l&&!ce.notFound&&!St&&!ke&&(ot?.kind==="ready"||ye!=="idle"),Os=kt.mode!=="sandbox"&&m==="visual"?"preview":m;A.useEffect(()=>{const be=Qn;if(!be)return;const Pe=ut=>{if(ut.origin===be)if(ut.data?.type==="visual-editor::element-clicked"){const Vt=jX.safeParse(ut.data.payload);Vt.success&&v(Vt.data)}else if(ut.data?.type==="cms-editor::section-clicked"){const Vt=VX.safeParse(ut.data.payload);Vt.success&&y({index:Vt.data.sectionIndex,seq:Vt.data.clickSeq})}else ut.data?.type==="cms-editor::render-start"?he():(ut.data?.type==="cms-editor::render-end"||ut.data?.type==="cms-editor::render-error")&&de()};return window.addEventListener("message",Pe),()=>window.removeEventListener("message",Pe)},[Qn]);const jr=()=>{const be=L.current?.contentWindow,Pe=lh(me);!be||!Pe||be.postMessage({type:"visual-editor::activate",script:CX},Pe)},H9=()=>{const be=L.current?.contentWindow,Pe=lh(me);!be||!Pe||be.postMessage({type:"visual-editor::deactivate"},Pe)},Fi=()=>{const be=L.current?.contentWindow,Pe=Qn;!be||!Pe||(be.postMessage(kt.mode==="production"?{type:"editor::inject",args:{script:tb}}:{type:"visual-editor::activate",script:tb},Pe),be.postMessage({type:"cms-editor::set-labels",labels:bt,kinds:Ft,keys:ge},Pe))},xo=()=>{const be=L.current?.contentWindow,Pe=Qn;!be||!Pe||be.postMessage({type:"cms-editor::deactivate"},Pe)},pi=be=>{const Pe=m;!n&&be!==Pe&&(be==="blocks"?w.current?.resize("30%"):w.current?.collapse()),be!=="blocks"&&C(),p(be),v(null),y(null),be!=="blocks"&&Q(null),Pe==="visual"&&H9(),be==="visual"&&jr(),Pe==="blocks"&&be!=="blocks"&&xo(),be==="blocks"&&Fi()},Cr=be=>{pi(wie(m,be))},bo=()=>{if(!L.current||!Ms)return;he();const be=L.current;be.src=Ms};T$(()=>{const be=L.current;if(!be)return;he();const Pe=document.activeElement,ut=be.tabIndex;be.tabIndex=-1,be.style.pointerEvents="none",be.blur(),Vie(be,Ee.current);let Vt;const ss=()=>{clearTimeout(Vt),be.tabIndex=ut,be.style.pointerEvents="";const pn=document.activeElement;(!pn||pn===document.body||pn===be)&&Pe?.focus(),be.removeEventListener("load",ss)};be.addEventListener("load",ss),Vt=setTimeout(ss,3e3)});const vo=()=>{const be=I1.indexOf(g);x(I1[(be+1)%I1.length])},yo=async()=>{let be=null;try{be=L.current?.contentWindow?.location?.href??null}catch{}const Pe=be??Ms??me;if(Pe)try{await navigator.clipboard.writeText(Pe),ve.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{ve.error(e("sandbox.preview.failedToCopyUrl"))}},Ui=(be,Pe)=>{if(!ze)return;const ut=ze,Vt={...At,[be]:Pe};Re.current=Or(ne,Vt),oe(ss=>({...ss,[ut]:Vt})),fi({path:ne,pageKey:ut,params:Vt})},Nr=qZ({iframeBase:kt.iframeBase,resolvedPath:ht,activeGlobalSectionName:H?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),cl=be=>{const Pe=q[be.key]??{},ut=Or(be.path,Pe);(H||ct(ut)!==ct(ht))&&he(),Re.current=ut,W(null),Q(null),se(null),y(null),Y(be.key),te(be.path),fi({path:be.path,pageKey:be.key,params:Pe}),c.selectTarget({kind:"page",key:be.key,path:be.path})},_o=be=>{if(!Se||!Ie){ve.error(e("sandbox.preview.previewMetadataNotReady"));return}he(),Re.current=null;const Pe=of(Ie),ut=Z5(Se,Pe,be.key);W(be),Q(null),se(ut),y(null),c.selectTarget({kind:"section",key:be.key})},md=be=>{W(null),Q(be.key),se(null),pi("blocks"),c.selectTarget({kind:"loader",key:be.key})},pa=async({name:be,path:Pe,templateKey:ut})=>{if(!t||!l)return;const Vt=N9(Pe);if(Vt){U(Vt);return}const ss=Pe.trim().startsWith("/")?Pe.trim():`/${Pe.trim()}`;if(nt.some(Ys=>ct(Ys.path)===ct(ss))){U(e("sandbox.preview.pageAlreadyExists",{path:ss}));return}let pn;if(ut&&(pn=Be?.[ut],!pn)){U(e("sandbox.preview.templateNoLongerExists"));return}U(void 0);try{const Ys=await dt.mutateAsync({name:be,path:ss,template:pn});z(!1),ve.success(e("sandbox.preview.pageCreated",{name:be})),await Zc(kie),cl({key:Ys.key,name:Ys.name,path:Ys.path}),pi("blocks")}catch(Ys){U(Ys instanceof Error?Ys.message:e("sandbox.preview.failedToCreatePage"))}},gi=Jn&&(go||kt.mode==="production"),pd=u.runtime==="cms"&&ob({showPreviewToolbar:gi,blocksState:Xe}),Vr=gi?o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{onClick:bo,"aria-label":e("sandbox.preview.refresh"),children:o.jsx(On,{size:16})})}),o.jsx(We,{side:"bottom",children:e("sandbox.preview.refresh")})]}),pd?o.jsxs("div",{ref:$,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(be=>!be),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(Wo,{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(El,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:re("text-[13px] font-medium text-foreground",wt==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:wt??Nr}),!H&&!K&&wt!=null&&ne&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:rf(ne).map((be,Pe)=>{if(be.type==="text")return o.jsx("span",{className:re(Pe===0?"min-w-0 truncate":"shrink-0"),children:be.text},`text-${Pe}`);const ut=ft[be.name];return ut&&at?o.jsx(RZ,{sources:ut,template:ne,paramName:be.name,value:At[be.name]??"",sandboxRef:at,onCommit:Vt=>Ui(be.name,Vt)},`${ze}:${be.name}`):o.jsx(KZ,{name:be.name,value:At[be.name]??"",onCommit:Vt=>Ui(be.name,Vt)},`${ze}:${be.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>I(be=>!be),"aria-label":e("sandbox.preview.choosePage"),children:o.jsx(bs,{size:12,className:re("shrink-0 text-muted-foreground transition-transform",R&&"rotate-180")})})]}),R&&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(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:D,onChange:be=>O(be.target.value),onKeyDown:be=>{if(be.key!=="Enter")return;const Pe=D.trim();if(!Pe)return;const ut=gt.find(Vt=>ct(Vt.path)===ct(Pe));ut&&(be.preventDefault(),I(!1),O(""),cl(ut))},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:be=>{be.preventDefault(),I(!1),O(""),U(void 0),z(!0)},children:[o.jsx(Gt,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),gt.length===0&&pe.length===0&&Me.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:nt.length===0&&et.length===0&&rt.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[gt.length>0&&o.jsx("div",{className:"p-1.5",children:gt.map(be=>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:Pe=>{Pe.preventDefault(),I(!1),O(""),cl(be)},children:[o.jsx($o,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.path})]},be.key))}),pe.length>0&&o.jsxs("div",{className:re("p-1.5",gt.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")}),pe.map(be=>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:Pe=>{Pe.preventDefault(),I(!1),O(""),_o(be)},children:[o.jsx(Wo,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]}),Me.length>0&&o.jsxs("div",{className:re("p-1.5",(gt.length>0||pe.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")}),Me.map(be=>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:Pe=>{Pe.preventDefault(),I(!1),O(""),md(be)},children:[o.jsx(El,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:be.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:be.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},be.key))]})]})]})]}):o.jsx("span",{className:"min-w-0 truncate px-2 text-[13px] text-muted-foreground",children:Nr}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{"aria-label":e(_r),onClick:()=>{mo()},children:o.jsx(fn,{size:16})})}),o.jsx(We,{side:"bottom",children:e(_r)})]})]}):null,Lo=gi?o.jsx("div",{className:"flex min-w-0 items-center gap-0.5",children:Vr}):null,wo=n&&h!=="off"&&ob({showPreviewToolbar:gi,blocksState:Xe})?o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{onClick:()=>Cr("blocks"),"aria-pressed":Os==="blocks","aria-label":e(Os==="blocks"?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),active:Os==="blocks",children:o.jsx(lT,{size:16})})}),o.jsx(We,{side:"bottom",children:e(Os==="blocks"?"sandbox.preview.exitEditor":"sandbox.preview.editContent")})]}):null,Hi=gi?o.jsx("div",{className:"flex shrink-0 items-center",children:o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon-sm",className:ng,"aria-label":e("sandbox.preview.moreOptions"),children:o.jsx(li,{size:14})})}),o.jsxs(Kt,{align:"end",className:"w-44",children:[o.jsxs(Je,{onClick:yo,children:[o.jsx(hn,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),Be&&Ie&&o.jsxs(o.Fragment,{children:[o.jsx(Nl,{}),ze&&o.jsxs(Je,{onClick:()=>{c.editSeo({kind:"page",key:ze,path:ne}),pi("blocks")},children:[o.jsx(E2,{size:14}),e("sandbox.preview.editSeo")]}),ze&&o.jsxs(Je,{onClick:()=>{try{f(KC(yJ(ze)))}catch{ve.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[o.jsx(ta,{size:14}),e("sandbox.preview.viewJson")]})]}),je]})]})}):null,So=kt.mode==="sandbox",xi=jie[g],ko=g==="desktop"&&(N.width===0||N.width>=xi.width+2*Ib),ga=ko?1:Math.min(N.width>0?N.width/(xi.width+2*Ib):1,1),jo=ko?{width:"100%",height:"100%"}:{width:`${xi.width}px`,height:N.height>0?`${N.height/ga}px`:`${xi.height}px`,transform:`scale(${ga})`,transformOrigin:"top center"},Tr=Jn?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:[So&&o.jsxs(o.Fragment,{children:[o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{onClick:()=>Cr("visual"),"aria-pressed":m==="visual","aria-label":e("sandbox.preview.visualEditor"),active:m==="visual",className:"rounded-full",children:o.jsx(Tx,{size:16})})}),o.jsx(We,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{onClick:vo,"aria-label":e(Mb[g]),className:"rounded-full",children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[g==="mobile"&&o.jsx(aT,{size:16}),g==="tablet"&&o.jsx(cT,{size:16}),g==="desktop"&&o.jsx(dT,{size:16})]},g)})}),o.jsx(We,{side:"top",children:e(Mb[g])})]})]})}):null,Co=(n||!!K)&&Os==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[at&&Object.entries(ft).map(([be,Pe])=>(At[be]??"")===""?o.jsx(UZ,{sources:Pe,template:ne,paramName:be,sandboxRef:at,onFill:ut=>Ui(be,ut)},`${ze}:${be}`):null),i?o.jsxs(o.Fragment,{children:[gi&&o.jsx(_Q,{children:Lo}),o.jsx(LQ,{children:Hi})]}):(gi||Hi)&&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 flex-1 items-center justify-start",children:wo}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Vr}),o.jsx("div",{className:"flex flex-1 items-center justify-end",children:Hi})]}),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(Rb,{virtualMcpId:t,externalSelection:_,onViewJsonFile:T}),S&&ze&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(Db,{ref:j,virtualMcpId:t,pageKey:ze,onClose:C})}),n&&Tr]}):o.jsxs(Rm,{orientation:"horizontal",disabled:Os!=="blocks",children:[o.jsx(yc,{ref:w,id:"preview-blocks-editor",defaultSize:Os==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:Os==="blocks"&&o.jsx(Rb,{virtualMcpId:t,externalSelection:_,onViewJsonFile:T})}),Os==="blocks"&&o.jsx(Dm,{withHandle:!0}),o.jsx(yc,{id:"preview-canvas",defaultSize:Os==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(Rm,{orientation:"horizontal",disabled:!(S&&ze),children:[S&&ze&&o.jsxs(o.Fragment,{children:[o.jsx(yc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(Db,{ref:j,virtualMcpId:t,pageKey:ze,onClose:C})}),o.jsx(Dm,{withHandle:!0})]}),o.jsx(yc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:be=>{if(!be)return;const Pe=()=>P(Vt=>Vt.width===be.clientWidth&&Vt.height===be.clientHeight?Vt:{width:be.clientWidth,height:be.clientHeight});Pe();const ut=new ResizeObserver(Pe);return ut.observe(be),()=>ut.disconnect()},className:re("h-full relative overflow-clip flex justify-center",Jn&&!ko&&"bg-muted/30"),children:[(J||ys)&&Jn&&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"})}),kt.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Tc,{kind:"starting",progress:Le,claimPhase:ot})}),Qe.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Tc,{kind:"suspended",onResume:ue.resume})}),Qe.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Tc,{kind:"errored",error:Qe.error,onRetry:ue.retry,connectionsHref:`/${ae.slug}/settings/connections`})}),kt.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(it,{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")})]})]}),Os==="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(Tx,{size:12}),e("sandbox.preview.clickElementToAsk")]}),Os==="visual"&&b&&o.jsx(WX,{element:b,onDismiss:()=>v(null)}),Tr,Jn&&Ms&&o.jsx("div",{className:re("shrink-0",!ko&&"border-x border-border bg-background shadow-sm"),style:jo,children:o.jsx("iframe",{ref:L,src:Ms,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:wr.handleError,onLoad:()=>{if(wr.handleLoad(),de(),kt.mode!=="sandbox"){kt.mode==="production"&&!kt.showWakingPill&&m==="blocks"&&Fi();return}if(Ge("vm_preview_loaded",{view_mode:m,vm_id:G?.sandboxHandle??null}),!H)try{const be=L.current?.contentWindow?.location?.pathname;if(!be)return;const Pe=Re.current;if(Pe!==null&&(Re.current=null,ct(be)!==ct(Pe))||ct(be)===ct(ht))return;te(be),fi({path:be,pageKey:ee,params:At})}catch{}m==="visual"&&jr(),m==="blocks"&&Fi()}},kt.iframeBase)})]})})]})})]})}),o.jsx(QZ,{open:M,onOpenChange:z,isPending:dt.isPending,error:B,templates:nt,onSubmit:pa})]})}function Aie(t){const e=F.c(22),{virtualMcpId:s}=t,n=le(),i=vs(s),{activeTask:r,taskId:l,currentBranch:a}=on(),c=t_(l),[d,u]=A.useState(!1);if(s_({threadId:l,sandboxBranch:r?.branch??a,agentHasRepo:jn(i?.metadata),threadHasRepo:jn(c)||jn(r?.metadata)})==="none"){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(mn,{className:"size-7 text-foreground"})}),e[0]=m):m=e[0];let p;e[1]!==n?(p=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=p):p=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=()=>u(!0),b=o.jsx(mn,{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 _;e[9]!==v?(_=o.jsxs(fe,{onClick:x,children:[b,v]}),e[9]=v,e[10]=_):_=e[10];let y;e[11]!==p||e[12]!==g||e[13]!==_?(y=o.jsx(Ci,{className:"h-full",image:m,title:p,description:g,actions:_}),e[11]=p,e[12]=g,e[13]=_,e[14]=y):y=e[14];let L;e[15]!==d?(L=o.jsx(Ju,{open:d,onOpenChange:u,mode:"agent"}),e[15]=d,e[16]=L):L=e[16];let w;return e[17]!==y||e[18]!==L?(w=o.jsxs(o.Fragment,{children:[y,L]}),e[17]=y,e[18]=L,e[19]=w):w=e[19],w}let f;return e[20]!==s?(f=o.jsx(Tie,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const Pie=A.lazy(()=>Gs(()=>import("./file-explorer-DTbMKDAB.js"),__vite__mapDeps([160,1,2,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,96,98,90,99,100,101,102,103,104,105,72,146,144,94,138,110,80,81,82,83,84,85,86,87,88,89,91,92,93,95,97,106,107,108,109,77,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,139,140,141,142,143,145,147,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.FileExplorer})));function Eie(t){const e=F.c(26),{openPath:s}=t,n=le(),i=ao(),{org:r}=He(),{currentBranch:l,taskId:a}=on(),c=i?.entity?.id??null,d=Wu(),u=rl(),h=hi();u.vmEntry,h.lifecycle.phase;const f=d,m=c??"",p=l??"",g=a??null,x=f;let b;e[0]!==r.slug||e[1]!==m||e[2]!==p||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:m,branch:p,threadId:g,enabled:x},e[0]=r.slug,e[1]=m,e[2]=p,e[3]=g,e[4]=x,e[5]=b):b=e[5],cS(b);const v=null;if(!c||!l){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(Ci,{className:"h-full",title:k,description:j}),e[10]=k,e[11]=j,e[12]=C):C=e[12],C}let _;e[13]!==v||e[14]!==n?(_=v,e[13]=v,e[14]=n,e[15]=_):_=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})}),e[16]=y):y=e[16];const L=a??null;let w;e[17]!==l||e[18]!==s||e[19]!==r.slug||e[20]!==L||e[21]!==c?(w=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(A.Suspense,{fallback:y,children:o.jsx(Pie,{orgSlug:r.slug,virtualMcpId:c,branch:l,threadId:L,openPath:s})})}),e[17]=l,e[18]=s,e[19]=r.slug,e[20]=L,e[21]=c,e[22]=w):w=e[22];let S;return e[23]!==_||e[24]!==w?(S=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[_,w]}),e[23]=_,e[24]=w,e[25]=S):S=e[25],S}function Rie(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 Die(t,e,s){return typeof t!="string"?null:Rie(Bn(t,e),s)}function ck(t,e,s){if(!e||typeof t!="string")return!1;const n=Die(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function Iie({orgSlug:t,virtualMcpId:e,branch:s}){const n=Ns(),i=hs()?.taskId??null,r=g0(e),l=yn(e).runtime==="cms";return Es({mutationKey:bg(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const u=await S7({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return yg(n,{orgSlug:t,virtualMcpId:e,branch:s},u),await n.invalidateQueries({queryKey:m0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=p0(r,X2(a)),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():h9(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=tt.decofile(c);await n.cancelQueries({queryKey:d});const u=n.getQueryData(d),h=!!u&&a in u,f=u?.[a];return n.setQueryData(d,m=>{if(!m)return m;const{[a]:p,...g}=m;return g}),{queryKey:d,blockKey:a,hadKey:h,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,u=>d.hadKey?{...u??{},[d.blockKey]:d.previousValue}:u)},onSuccess:()=>{n.invalidateQueries({queryKey:tt.liveMeta(t,e,s)})}})}function hc(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 l;return e[4]!==r?(l=o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=l):l=e[5],l}function M9(t,e){return`${t}-${e}`}function dk(t,e){return`site/apps/${t}/${e}.ts`}function uk(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 Mie(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function Oie(t){return t==="local"?"Custom":"Installed"}function hk(t,e,s){const n=new Set([M9(t,e),e].map(r=>r.toLowerCase())),i=dk(t,e);for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=l;if(n.has(r.toLowerCase())||a.__resolveType===i)return r}return null}function $ie(t,e){const s=t.vendor.alias,n=t.name,i=hk(s,n,e);return{id:M9(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:dk(s,n),blockKey:i,installed:i!==null}}function Bie(t,e,s){if(t===L3)return null;const n=uk(t);if(!n)return null;const{vendor:i,app:r}=n,l=hk(i,r,s),a=ll(t,e);return{id:M9(i,r),app:r,vendor:i,title:a.title??r,description:a.description??"",category:"Others",logo:a.logo??a.icon,resolveType:t,blockKey:l,installed:l!==null}}function zie(t,e,s){const n=e.__resolveType;if(typeof n!="string"||Bc(t,e)||!bw(n))return null;const i=uk(n)??Mie(t);if(!i)return null;const r=ll(n,s),{vendor:l,app:a}=i;return{id:M9(l,a),app:a,vendor:l,title:r.title??df(t,e,s),description:r.description??"",category:Oie(l),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function Fie(t,e,s){const n=new Map;for(const r of t){const l=$ie(r,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const l=Bie(r,e,s);!l||n.has(l.id)||n.set(l.id,l)}for(const[r,l]of Object.entries(s)){if(r.includes("/")||!l||typeof l!="object"||Array.isArray(l))continue;const a=zie(r,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(Uie)}function Uie(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function Hie(){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 Kie(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 l;n[1]!==i?(l={queryKey:r,queryFn:Hie,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Mt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?Fie(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,u=a.isLoading&&!a.isError;let h;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==u?(h={catalog:d,isLoading:u,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=u,n[11]=h):h=n[11],h}function Wie(t){const e=F.c(86),{active:s,counts:n,showBlog:i,onSelect:r}=t,l=le();let a;e[0]!==l?(a=l("sandbox.collectionsSidebar.content"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(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:a})}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("sandbox.collectionsSidebar.pages"),e[4]=l,e[5]=d):d=e[5];const u=s==="pages";let h;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==u?(h=o.jsx(Fn,{id:"pages",icon:$o,label:d,count:n.pages,active:u,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const m=s==="sections";let p;e[13]!==n.sections||e[14]!==r||e[15]!==f||e[16]!==m?(p=o.jsx(Fn,{id:"sections",icon:Wo,label:f,count:n.sections,active:m,onSelect:r}),e[13]=n.sections,e[14]=r,e[15]=f,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==l?(g=l("sandbox.collectionsSidebar.apps"),e[18]=l,e[19]=g):g=e[19];const x=s==="apps";let b;e[20]!==n.apps||e[21]!==r||e[22]!==x||e[23]!==g?(b=o.jsx(Fn,{id:"apps",icon:B6,label:g,count:n.apps,active:x,onSelect:r}),e[20]=n.apps,e[21]=r,e[22]=x,e[23]=g,e[24]=b):b=e[24];let v;e[25]!==l?(v=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=v):v=e[26];const _=s==="redirects";let y;e[27]!==n.redirects||e[28]!==r||e[29]!==v||e[30]!==_?(y=o.jsx(Fn,{id:"redirects",icon:A6,label:v,count:n.redirects,active:_,onSelect:r}),e[27]=n.redirects,e[28]=r,e[29]=v,e[30]=_,e[31]=y):y=e[31];let L;e[32]!==l?(L=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=L):L=e[33];const w=s==="loaders";let S;e[34]!==n.loaders||e[35]!==r||e[36]!==L||e[37]!==w?(S=o.jsx(Fn,{id:"loaders",icon:El,label:L,count:n.loaders,active:w,onSelect:r}),e[34]=n.loaders,e[35]=r,e[36]=L,e[37]=w,e[38]=S):S=e[38];let k;e[39]!==l?(k=l("sandbox.collectionsSidebar.actions"),e[39]=l,e[40]=k):k=e[40];const j=s==="actions";let C;e[41]!==n.actions||e[42]!==r||e[43]!==k||e[44]!==j?(C=o.jsx(Fn,{id:"actions",icon:hr,label:k,count:n.actions,active:j,onSelect:r}),e[41]=n.actions,e[42]=r,e[43]=k,e[44]=j,e[45]=C):C=e[45];let T;e[46]!==l?(T=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=T):T=e[47];const N=s==="site";let P;e[48]!==r||e[49]!==T||e[50]!==N?(P=o.jsx(Fn,{id:"site",icon:x6,label:T,active:N,onSelect:r}),e[48]=r,e[49]=T,e[50]=N,e[51]=P):P=e[51];let V;e[52]!==l?(V=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=V):V=e[53];const E=s==="seo";let R;e[54]!==r||e[55]!==V||e[56]!==E?(R=o.jsx(Fn,{id:"seo",icon:E2,label:V,active:E,onSelect:r}),e[54]=r,e[55]=V,e[56]=E,e[57]=R):R=e[57];let I;e[58]!==l?(I=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=I):I=e[59];const D=s==="calendar";let O;e[60]!==r||e[61]!==I||e[62]!==D?(O=o.jsx(Fn,{id:"calendar",icon:Yc,label:I,active:D,onSelect:r}),e[60]=r,e[61]=I,e[62]=D,e[63]=O):O=e[63];let $;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==r||e[69]!==i||e[70]!==l?($=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(Ec,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),o.jsx(Fn,{id:"posts",icon:Vi,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(Fn,{id:"authors",icon:n9,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(Fn,{id:"categories",icon:T2,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(Fn,{id:"post-schedule",icon:uT,label:l("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:r})]}),e[64]=s,e[65]=n.authors,e[66]=n.categories,e[67]=n.posts,e[68]=r,e[69]=i,e[70]=l,e[71]=$):$=e[71];let M;e[72]!==b||e[73]!==y||e[74]!==S||e[75]!==C||e[76]!==P||e[77]!==R||e[78]!==O||e[79]!==$||e[80]!==h||e[81]!==p?(M=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,p,b,y,S,C,P,R,O,$]}),e[72]=b,e[73]=y,e[74]=S,e[75]=C,e[76]=P,e[77]=R,e[78]=O,e[79]=$,e[80]=h,e[81]=p,e[82]=M):M=e[82];let z;return e[83]!==c||e[84]!==M?(z=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=z):z=e[85],z}function Fn(t){const e=F.c(18),{id:s,icon:n,label:i,count:r,active:l,onSelect:a}=t;let c;e[0]!==s||e[1]!==a?(c=()=>a(s),e[0]=s,e[1]=a,e[2]=c):c=e[2];const d=l?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let u;e[3]!==d?(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",d),e[3]=d,e[4]=u):u=e[4];let h;e[5]!==n?(h=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=h):h=e[6];let f;e[7]!==i?(f=o.jsx("span",{className:"flex-1 truncate",children:i}),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==l||e[10]!==r?(m=r!==void 0&&o.jsx("span",{className:re("shrink-0 text-xs tabular-nums",l?"text-accent-foreground/70":"text-muted-foreground/70"),children:r}),e[9]=l,e[10]=r,e[11]=m):m=e[11];let p;return e[12]!==c||e[13]!==u||e[14]!==h||e[15]!==f||e[16]!==m?(p=o.jsxs("button",{type:"button",onClick:c,className:u,children:[h,f,m]}),e[12]=c,e[13]=u,e[14]=h,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function qie(t){const e=F.c(12),{state:s,claimPhase:n,lifecycle:i,onStart:r,connectionsHref:l}=t;switch(s.kind){case"starting":{let a;e[0]!==n||e[1]!==i?(a=Gw({claimPhase:n,lifecycle:i}),e[0]=n,e[1]=i,e[2]=a):a=e[2];let c;return e[3]!==n||e[4]!==a?(c=o.jsx(Tc,{kind:"starting",progress:a,claimPhase:n}),e[3]=n,e[4]=a,e[5]=c):c=e[5],c}case"suspended":{let a;return e[6]!==r?(a=o.jsx(Tc,{kind:"suspended",onResume:r}),e[6]=r,e[7]=a):a=e[7],a}case"errored":{let a;return e[8]!==l||e[9]!==r||e[10]!==s.error?(a=o.jsx(Tc,{kind:"errored",error:s.error,onRetry:r,connectionsHref:l}),e[8]=l,e[9]=r,e[10]=s.error,e[11]=a):a=e[11],a}}}const Gie=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Yie(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&&!Gie.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function $b(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 Jie(t,e){const s=Fo,n=e.replace(/-copy(?:-\d+)?$/,""),i=`${n}-copy`;if(!t.has(s(i)))return i;for(let r=2;r<1e3;r++){const l=`${n}-copy-${r}`;if(!t.has(s(l)))return l}return`${n}-copy-${Date.now()}`}function Qie(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 Xie(t){const e=A3(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Zie(t,e){return eS(t,e)}const ere=1e3;function tre(t,e){for(let s=0;s<ere;s++){const n=A3(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const sre={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},nre={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},ire={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function rre(t){const e=F.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:l,error:a,templates:c,validate:d,onSubmit:u,onOpenChange:h}=t,f=l===void 0?!1:l,m=le(),[p,g]=A.useState(i),[x,b]=A.useState(r),[v,_]=A.useState(Uo),[y,L]=A.useState(null),[w,S]=A.useState(s);s!==w&&(S(s),s&&(g(i),b(r),_(Uo),L(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==h?(j=de=>{!de&&!f&&(L(null),h(!1))},e[0]=f,e[1]=h,e[2]=j):j=e[2];const C=j;let T;e[3]!==f||e[4]!==p||e[5]!==u||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(T=async de=>{de.preventDefault();const ae=p.trim(),ce=x.trim();if(!ae||!ce||f)return;const ue=N9(ce);if(ue){L(ue);return}const G=d?.({name:ae,path:ce});if(G){L(G);return}L(null),await u({name:ae,path:ce,templateKey:k&&v!==Uo?v:null})},e[3]=f,e[4]=p,e[5]=u,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=T):T=e[10];const N=T,P=y??a,V=sre[n];let E;e[11]!==m||e[12]!==V?(E=m(V),e[11]=m,e[12]=V,e[13]=E):E=e[13];let R;e[14]!==E?(R=o.jsx(ds,{children:o.jsx(qt,{children:E})}),e[14]=E,e[15]=R):R=e[15];let I;e[16]!==f||e[17]!==k||e[18]!==m||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:m("sandbox.pageFormDialog.labelTemplate")}),o.jsx(tS,{id:"page-form-template",value:v,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=m,e[19]=v,e[20]=c,e[21]=I):I=e[21];let D;e[22]!==m?(D=m("sandbox.pageFormDialog.labelName"),e[22]=m,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 $;e[26]===Symbol.for("react.memo_cache_sentinel")?($=de=>g(de.target.value),e[26]=$):$=e[26];let M;e[27]!==m?(M=m("sandbox.pageFormDialog.placeholderName"),e[27]=m,e[28]=M):M=e[28];let z;e[29]!==f||e[30]!==p||e[31]!==M?(z=o.jsx(vt,{id:"page-form-name",value:p,onChange:$,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=p,e[31]=M,e[32]=z):z=e[32];let B;e[33]!==z||e[34]!==O?(B=o.jsxs("div",{className:"space-y-1.5",children:[O,z]}),e[33]=z,e[34]=O,e[35]=B):B=e[35];let U;e[36]!==m?(U=m("sandbox.pageFormDialog.labelPath"),e[36]=m,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=de=>b(de.target.value),e[40]=W):W=e[40];let K;e[41]!==m?(K=m("sandbox.pageFormDialog.placeholderPath"),e[41]=m,e[42]=K):K=e[42];let Q;e[43]!==f||e[44]!==x||e[45]!==K?(Q=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]=Q):Q=e[46];let X;e[47]!==H||e[48]!==Q?(X=o.jsxs("div",{className:"space-y-1.5",children:[H,Q]}),e[47]=H,e[48]=Q,e[49]=X):X=e[49];let se;e[50]!==P?(se=P&&o.jsx("p",{className:"text-xs text-destructive",children:P}),e[50]=P,e[51]=se):se=e[51];let ne;e[52]!==B||e[53]!==X||e[54]!==se||e[55]!==I?(ne=o.jsxs("div",{className:"space-y-4 py-4",children:[I,B,X,se]}),e[52]=B,e[53]=X,e[54]=se,e[55]=I,e[56]=ne):ne=e[56];let te;e[57]!==h?(te=()=>h(!1),e[57]=h,e[58]=te):te=e[58];let ee;e[59]!==m?(ee=m("sandbox.pageFormDialog.buttonCancel"),e[59]=m,e[60]=ee):ee=e[60];let Y;e[61]!==f||e[62]!==te||e[63]!==ee?(Y=o.jsx(fe,{type:"button",variant:"outline",onClick:te,disabled:f,children:ee}),e[61]=f,e[62]=te,e[63]=ee,e[64]=Y):Y=e[64];let q;e[65]!==f||e[66]!==p||e[67]!==x?(q=!p.trim()||!x.trim()||f,e[65]=f,e[66]=p,e[67]=x,e[68]=q):q=e[68];let oe;e[69]!==f||e[70]!==n||e[71]!==m?(oe=f?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"size-3.5"}),m(ire[n])]}):m(nre[n]),e[69]=f,e[70]=n,e[71]=m,e[72]=oe):oe=e[72];let J;e[73]!==q||e[74]!==oe?(J=o.jsx(fe,{type:"submit",disabled:q,children:oe}),e[73]=q,e[74]=oe,e[75]=J):J=e[75];let ie;e[76]!==Y||e[77]!==J?(ie=o.jsxs(Gn,{children:[Y,J]}),e[76]=Y,e[77]=J,e[78]=ie):ie=e[78];let Z;e[79]!==N||e[80]!==ne||e[81]!==ie||e[82]!==R?(Z=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:N,children:[R,ne,ie]})}),e[79]=N,e[80]=ne,e[81]=ie,e[82]=R,e[83]=Z):Z=e[83];let he;return e[84]!==C||e[85]!==s||e[86]!==Z?(he=o.jsx(zt,{open:s,onOpenChange:C,children:Z}),e[84]=C,e[85]=s,e[86]=Z,e[87]=he):he=e[87],he}function ore(t){const e=F.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:l,onOpenChange:a}=t,c=r===void 0?!1:r,d=le(),[u,h]=A.useState(i),[f,m]=A.useState(s);s!==f&&(m(s),s&&h(i));let p;e[0]!==c||e[1]!==a?(p=W=>{!W&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=p):p=e[2];const g=p;let x;e[3]!==c||e[4]!==u||e[5]!==l?(x=async W=>{W.preventDefault();const K=u.trim();!K||c||await l(K)},e[3]=c,e[4]=u,e[5]=l,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 _;e[9]!==v?(_=o.jsx(qt,{children:v}),e[9]=v,e[10]=_):_=e[10];let y;e[11]!==d?(y=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=y):y=e[12];let L;e[13]!==y?(L=o.jsx(Nn,{children:y}),e[13]=y,e[14]=L):L=e[14];let w;e[15]!==_||e[16]!==L?(w=o.jsxs(ds,{children:[_,L]}),e[15]=_,e[16]=L,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=>h(W.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==u?(C=o.jsx(vt,{id:"section-rename-name",value:u,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=u,e[25]=C):C=e[25];let T;e[26]!==k||e[27]!==C?(T=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=T):T=e[28];let N;e[29]!==d?(N=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=N):N=e[30];let P;e[31]!==N?(P=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:N}),e[31]=N,e[32]=P):P=e[32];let V;e[33]!==n?(V=o.jsx(vt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=V):V=e[34];let E;e[35]!==P||e[36]!==V?(E=o.jsxs("div",{className:"space-y-1.5",children:[P,V]}),e[35]=P,e[36]=V,e[37]=E):E=e[37];let R;e[38]!==T||e[39]!==E?(R=o.jsxs("div",{className:"space-y-4 py-4",children:[T,E]}),e[38]=T,e[39]=E,e[40]=R):R=e[40];let I;e[41]!==a?(I=()=>a(!1),e[41]=a,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(fe,{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 $;e[49]!==c||e[50]!==u?($=!u.trim()||c,e[49]=c,e[50]=u,e[51]=$):$=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(it,{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]!==$||e[56]!==M?(z=o.jsx(fe,{type:"submit",disabled:$,children:M}),e[55]=$,e[56]=M,e[57]=z):z=e[57];let B;e[58]!==O||e[59]!==z?(B=o.jsxs(Gn,{children:[O,z]}),e[58]=O,e[59]=z,e[60]=B):B=e[60];let U;e[61]!==b||e[62]!==R||e[63]!==B||e[64]!==w?(U=o.jsx(Bt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[w,R,B]})}),e[61]=b,e[62]=R,e[63]=B,e[64]=w,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=o.jsx(zt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function lre(t){const e=F.c(7),{type:s}=t,n=YQ[s];let i;e[0]!==n?(i=o.jsx(Ke,{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 l;e[2]!==r?(l=o.jsx(We,{side:"left",children:r}),e[2]=r,e[3]=l):l=e[3];let a;return e[4]!==i||e[5]!==l?(a=o.jsxs(qe,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const O1={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Y3=["posts","authors","categories"],lu={posts:"post",authors:"author",categories:"category"};function au(t){return Y3.includes(t)}const J3={posts:"post",authors:"author",categories:"category"},fk={posts:O1.post,authors:O1.author,categories:O1.category},are=Object.fromEntries(Object.entries(fk).map(([t,e])=>[e,t]));function cre(t){return typeof t=="string"?are[t]??null:null}function tl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function rs(t){return typeof t=="string"?t:""}function dre(t,e){switch(t){case"posts":return{label:rs(e.title)||"Untitled post",subtitle:rs(e.slug)};case"authors":return{label:rs(e.name)||"Unnamed author",subtitle:rs(e.email)};case"categories":return{label:rs(e.name)||"Unnamed category",subtitle:rs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function mk(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=tl(n);if(!i)continue;const r=cre(i.__resolveType);if(!r)continue;const l=tl(i[J3[r]])??{},{label:a,subtitle:c}=dre(r,l);e[r].push({key:s,kind:r,label:a,subtitle:c})}for(const s of Y3)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function ure(t,e){return mk(t)[e]}function Au(t,e){return ure(t,e).map(s=>({key:s.key,payload:Fd(tl(t[s.key])??void 0,e)}))}const Bb=Object.freeze({});function Fd(t,e){return t?tl(t[J3[e]])??Bb:Bb}function fc(t,e,s){return{name:t,__resolveType:fk[e],[J3[e]]:s}}function Kpe({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=f=>typeof f=="string"?f:rs(tl(f)?.[s]),l=f=>typeof f=="string"?f:rs(tl(f)?.name),a=f=>{const m=r(f),p=m?t.find(({payload:x})=>rs(x[s])===m):void 0;if(p)return p;const g=l(f);return g?t.find(({payload:x})=>rs(x.name)===g):void 0},c=t.map(({key:f,payload:m})=>({value:f,label:rs(m.name)||rs(m[s])||f})),d=new Map,u=[];return i.forEach((f,m)=>{const p=a(f);if(p){u.includes(p.key)||u.push(p.key);return}const g=`unresolved:${m}`;d.set(g,f),u.push(g),c.push({value:g,label:l(f)||r(f)||"Unknown"})}),{options:c,selectedValues:u,refsForValues:f=>f.map(m=>{const p=t.find(g=>g.key===m);return p?n(p.payload):d.get(m)}).filter(m=>m!==void 0)}}function Wl(t){return Array.isArray(t)?t:[]}function Wr(t){if(typeof t=="string")return t;const e=tl(t);return e?rs(e.slug):""}function hre(t){if(typeof t=="string")return t;const e=tl(t);return e?rs(e.email):""}function pk(t){const e=[];return rs(t.title).trim()||e.push("Title"),rs(t.slug).trim()||e.push("Slug"),Wl(t.categories).map(Wr).filter(Boolean).length===0&&e.push("Category"),rs(t.excerpt).trim()||e.push("Excerpt"),rs(t.image).trim()||e.push("Cover image"),e}const gk=8;function xk(t){const e=rs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function Wpe(t,e){return e!=="published"||xk(t)==="published"?!1:pk(t).length>0}function fre(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,gk).toISOString()}function qpe(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=rs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?fre(s):n}}function bk(t){return Au(t,"posts").map(({key:e,payload:s})=>({key:e,title:rs(s.title)||"Untitled post",slug:rs(s.slug),date:rs(s.date),scheduledDatetime:rs(s.scheduledDatetime),categorySlugs:Wl(s.categories).map(Wr).filter(Boolean),authorEmails:Wl(s.authors).map(hre).filter(Boolean),missing:pk(s),status:xk(s)}))}function mre(t,e){const s=Wl(t.categories);return s.some(n=>Wr(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function pre(t,e){const s=Wl(t.categories);return s.length===1&&Wr(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function Gpe(t,e,s){const n=Wl(t.categories);if(!n.some(a=>Wr(a)===e))return t;const i=n.map(a=>{const c=Wr(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),r=new Set,l=i.filter(a=>{const c=Wr(a);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:l}}function gre(t,e){const s=Wl(t.categories);return s.some(n=>Wr(n)===e)?{...t,categories:s.filter(n=>Wr(n)!==e)}:t}function zb(t){return{...t,dateModified:new Date().toISOString()}}function fp(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 $1(t,e){const s=`collections/blog/${e}/${fp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function vk(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${fp(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-${fp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const xre={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"}},Fb="Box";function bre(t){return t.startsWith("site/")?"site":"app"}function vre(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function kd(...t){for(const e of t)if(e!==void 0)return e}function Ype(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(!Lre(r)||e.has(r))continue;e.add(r);const l=ll(r,t),a=yre(r),c=xre[a],d=bre(r),u=(d==="site"?kd(l.title,c?.title):kd(c?.title,l.title))??a,h=d==="site"?kd(l.description,c?.description):kd(c?.description,l.description),f=d==="site"?l.icon:void 0,m=f&&vre(f)?f:void 0,p=m!==void 0?c?.iconName??Fb:kd(f,c?.iconName)??Fb;s.push({resolveType:r,title:u,description:h,iconName:p,iconUrl:m,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function yre(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const _re=["blog/sections/blocks/","site/sections/Blog/Post/"];function Lre(t){return _re.some(e=>t.startsWith(e))}const Jpe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Qpe=["January","February","March","April","May","June","July","August","September","October","November","December"],yk=1440*60*1e3;function Tl(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function Xpe(t){return new Date(t.getFullYear(),t.getMonth(),1)}function Zpe(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function yf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function mp(t,e){return Math.round((Tl(t).getTime()-Tl(e).getTime())/yk)}function wre(t){const e=(t.getTime()-Tl(t).getTime())/yk;return Math.min(Math.max(e,0),1)}function Ub(t,e){return mp(t,e)+wre(t)}function e2e(t){const e=yf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(yf(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 t2e(t,e){const s=Tl(t[0]),n=yf(s,7),i=s.getTime(),r=n.getTime(),l=[];for(const d of e){const u=Tl(d.start),h=Tl(d.end);if(h.getTime()<s.getTime()||u.getTime()>=n.getTime())continue;const f=u.getTime()<s.getTime()?s:u,m=h.getTime()>=n.getTime()?yf(n,-1):h,p=mp(f,s),g=mp(m,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),v=Ub(new Date(x),s),_=Math.max(Ub(new Date(b),s)-v,0);_<=0||l.push({variant:d,startCol:p,span:g,leftUnits:v,widthUnits:_})}l.sort((d,u)=>d.startCol-u.startCol||u.span-d.span||d.variant.blockKey.localeCompare(u.variant.blockKey));const a=[],c=[];for(const d of l){let u=a.findIndex(h=>h<=d.startCol);u===-1&&(u=a.length,a.push(0)),a[u]=d.startCol+d.span,c.push({...d,lane:u})}return c}function _f(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const _k=/^(\d{4})-(\d{2})-(\d{2})$/;function Lf(t){const e=t.trim();if(!e)return null;const s=_k.exec(e);if(s){const i=Number(s[1]),r=Number(s[2])-1,l=Number(s[3]),a=new Date(i,r,l);return a.getMonth()===r&&a.getDate()===l?a:null}const n=new Date(e);return Number.isNaN(n.getTime())?null:Tl(n)}function Sre(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),gk);return{...vk("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:_f(t)}}function kre(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(_k.test(e))return Lf(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function jre(t,e){const s=kre(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:"")===_f(s)&&(i.date=_f(n)),i}function Cre(t){return Lf(t.scheduledDatetime)??Lf(t.date)}function s2e(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:Lf(i.scheduledDatetime)!==null},l=Cre(i);if(!l){s.push(r);continue}const a=_f(l),c=e.get(a);c?c.push(r):e.set(a,[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 Nre="0.161.0",Vre="0.162.0",n2e="deno task update";function Hb(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Kb(t,e){const s=Hb(t),n=Hb(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 Lk=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Tre(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=Lk.exec(s)?.[1];if(n)return n}return null}function Are(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=Lk.exec(n)?.[1];if(i)return i}return null}function Pre(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Tre(t.denoJson)??Are(t.meta);return!e||Kb(e,Nre)<0?{kind:"outdated",version:e}:Kb(e,Vre)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function i2e(t){return t.kind==="publish-only"||t.kind==="full"}function r2e(t){return t.kind==="full"}function Ere(t){const e=F.c(16),s=vs(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=g0(t.virtualMcpId),i=hs()?.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 l;e[4]!==n||e[5]!==t||e[6]!==i?(l=async()=>{const f=await f3({...t,threadId:i},p0(n,"deno.json"));return f.kind==="data"?f.data:null},e[4]=n,e[5]=t,e[6]=i,e[7]=l):l=e[7];const a=s==="deno";let c;e[8]!==r||e[9]!==l||e[10]!==a?(c={queryKey:r,queryFn:l,enabled:a,staleTime:3e5},e[8]=r,e[9]=l,e[10]=a,e[11]=c):c=e[11];const{data:d}=Mt(c),u=d??null;let h;return e[12]!==s||e[13]!==t.meta||e[14]!==u?(h=Pre({packageManager:s,denoJson:u,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=u,e[15]=h):h=e[15],h}function Rre({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=le(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,u]=A.useState(!1),[h,f]=A.useState(c),[m,p]=A.useState(!1),g=!i||a,x=h!==c,b=()=>{navigator.clipboard.writeText(h).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)})},v=async _=>{if(!i||m)return;let y;try{y=JSON.parse(_)}catch{ve.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}p(!0);try{await i(y),ve.success(r("sectionsEditor.pageJsonDialog.saveSuccess")),e(!1)}catch(L){ve.error(r("sectionsEditor.pageJsonDialog.saveError",{error:L instanceof Error?L.message:String(L)}))}finally{p(!1)}};return o.jsx(zt,{open:t,onOpenChange:e,children:o.jsxs(Bt,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(ds,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(qt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(fe,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(xr,{size:12}):o.jsx(hn,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(fe,{size:"sm",onClick:()=>v(h),disabled:!x||m,className:"h-7 text-xs",children:r(m?"sectionsEditor.pageJsonDialog.saving":"sectionsEditor.pageJsonDialog.save")})]})]}),a?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(td,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{v(_)}})})]})})}function vi(t){const e=F.c(45),{icon:s,logoUrl:n,title:i,subtitle:r,active:l,accent:a,variantCount:c,trailing:d,selectable:u,selectionActive:h,selected:f,invalid:m,invalidReason:p,onToggleSelect:g,onClick:x,menu:b}=t,v=a==="global";let _;e[0]!==s||e[1]!==l||e[2]!==v||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(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(We,{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",v?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:re("shrink-0",!v&&(l?"text-accent-foreground":"text-muted-foreground")),style:v?{color:g3}:void 0})}),e[0]=s,e[1]=l,e[2]=v,e[3]=n,e[4]=c,e[5]=_):_=e[5];const y=_,L=l?v?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":v?"hover:bg-global-section/10":"hover:bg-muted";let w;e[6]!==L?(w=re("group relative flex min-w-0 items-center rounded-md transition-colors",L),e[6]=L,e[7]=w):w=e[7];let S;e[8]!==g||e[9]!==u||e[10]!==f||e[11]!==h||e[12]!==i?(S=u&&o.jsx("span",{className:re("flex shrink-0 items-center pl-2.5 transition-opacity",f||h?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:Dre,children:o.jsx(Xc,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=u,e[10]=f,e[11]=h,e[12]=i,e[13]=S):S=e[13];const k=m&&!l&&"text-destructive";let j;e[14]!==k?(j=re("block truncate text-sm font-medium",k),e[14]=k,e[15]=j):j=e[15];let C;e[16]!==j||e[17]!==i?(C=o.jsx("span",{className:j,children:i}),e[16]=j,e[17]=i,e[18]=C):C=e[18];const T=l?"text-accent-foreground/70":"text-muted-foreground";let N;e[19]!==T?(N=re("block truncate text-xs",T),e[19]=T,e[20]=N):N=e[20];let P;e[21]!==r||e[22]!==N?(P=o.jsx("span",{className:N,children:r}),e[21]=r,e[22]=N,e[23]=P):P=e[23];let V;e[24]!==P||e[25]!==C?(V=o.jsxs("span",{className:"min-w-0 flex-1",children:[C,P]}),e[24]=P,e[25]=C,e[26]=V):V=e[26];let E;e[27]!==l||e[28]!==m||e[29]!==p?(E=m&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:re("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:o.jsx(Vn,{size:14})})}),p&&o.jsx(We,{side:"bottom",children:p})]}),e[27]=l,e[28]=m,e[29]=p,e[30]=E):E=e[30];let R;e[31]!==x||e[32]!==y||e[33]!==V||e[34]!==E||e[35]!==d?(R=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,V,E,d]}),e[31]=x,e[32]=y,e[33]=V,e[34]=E,e[35]=d,e[36]=R):R=e[36];let I;e[37]!==l||e[38]!==b?(I=b&&o.jsx("div",{className:re("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=I):I=e[39];let D;return e[40]!==R||e[41]!==I||e[42]!==w||e[43]!==S?(D=o.jsxs("div",{className:w,children:[S,R,I]}),e[40]=R,e[41]=I,e[42]=w,e[43]=S,e[44]=D):D=e[44],D}function Dre(t){return t.stopPropagation()}function Mo(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 l;e[2]!==n?(l=o.jsx("div",{children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==i?(a=i&&o.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:i}),e[4]=i,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(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,l,a]}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}const Ire={loaders:El,actions:hr},Mre={loaders:"Loaders",actions:"Actions"},Ore={analytics:kA,blog:Ec,commerce:SA,site:hT,website:zn};function $re(t,e){return e===0?Ore[t.toLowerCase()]??Go:Go}function ah(t,e){return e===0?nee(t):t}function Bre(t){const e=F.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c}=t,d=le();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[h,f]=A.useState(u),[m,p]=A.useState(null),[g,x]=A.useState(""),[b,v]=A.useState(Gre),[_,y]=A.useState(c);_!==c&&(y(c),f([]),p(null),x(""),v(new Set));let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=U=>{v(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},e[1]=L):L=e[1];const w=L;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=x0(S);let j;e[6]!==k?(j=R3((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const C=j;let T;e[8]!==c?(T=nS(c),e[8]=c,e[9]=T):T=e[9];const N=T,P=Ire[c];let V,E,R,I,D,O,$;if(e[10]!==P||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==h||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==m||e[23]!==N||e[24]!==d||e[25]!==n){R=Symbol.for("react.early_return_sentinel");e:{const U=[...lS(l,a,c).map(qre),...rS(l,c).map(Wre)],H=g.trim().toLowerCase(),W=H.length>0,K=W?U.filter(xe=>xe.title.toLowerCase().includes(H)||xe.resolveType.toLowerCase().includes(H)):[],Q=new Map,X=[],se=new Map;if(!W){for(const xe of U){const Se=xe.folderPath;if(!(Se.length<h.length)&&h.every((Ce,Ae)=>Se[Ae]===Ce))if(Se.length===h.length)if(xe.savedKey!==void 0){const Ce=se.get(xe.resolveType);Ce?Ce.push(xe):se.set(xe.resolveType,[xe])}else X.push(xe);else{const Ce=Se[h.length],Ae=Q.get(Ce)??{count:0,savedCount:0};xe.savedKey!==void 0?Ae.savedCount=Ae.savedCount+1:Ae.count=Ae.count+1,Q.set(Ce,Ae)}}X.sort(Kre);for(const xe of se.values())xe.sort(Hre)}const ne=[...se.entries()].filter(xe=>{const[Se]=xe;return!X.some(Ce=>Ce.resolveType===Se)}).flatMap(Ure).sort(Fre);let te;e[33]!==h?(te=(xe,Se)=>ah(xe.name,h.length).localeCompare(ah(Se.name,h.length)),e[33]=h,e[34]=te):te=e[34];const ee=[...Q.entries()].map(zre).sort(te);let Y;e[35]===Symbol.for("react.memo_cache_sentinel")?(Y=xe=>{p(xe.savedKey!==void 0?{mode:"saved",key:xe.savedKey}:{mode:"available",resolveType:xe.resolveType,title:xe.title})},e[35]=Y):Y=e[35];const q=Y;let oe;e[36]!==k||e[37]!==N||e[38]!==d?(oe=async(xe,Se)=>{await k.mutateAsync({blockKey:xe,data:Se}),ve.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:N,blockId:xe})),p({mode:"saved",key:xe})},e[36]=k,e[37]=N,e[38]=d,e[39]=oe):oe=e[39];const J=oe;let ie;e[40]!==a||e[41]!==m?(ie=Yre(m,a),e[40]=a,e[41]=m,e[42]=ie):ie=e[42];const Z=ie;if(Z){const xe=`${Z.mode}:${Z.mode==="saved"?Z.blockKey:Z.resolveType}`;let Se;e[43]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>p(null),e[43]=Se):Se=e[43];let Ce;e[44]!==i||e[45]!==a||e[46]!==J||e[47]!==c||e[48]!==l||e[49]!==s||e[50]!==r||e[51]!==k.isPending||e[52]!==C||e[53]!==xe||e[54]!==Z.editorTarget||e[55]!==Z.initialValue||e[56]!==n?(Ce=o.jsx(ak,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c,target:Z.editorTarget,initialValue:Z.initialValue,isCreating:k.isPending,onCreate:J,onSaveReferencedBlock:C,onBack:Se},xe),e[44]=i,e[45]=a,e[46]=J,e[47]=c,e[48]=l,e[49]=s,e[50]=r,e[51]=k.isPending,e[52]=C,e[53]=xe,e[54]=Z.editorTarget,e[55]=Z.initialValue,e[56]=n,e[57]=Ce):Ce=e[57],R=Ce;break e}$="flex h-full w-full min-w-0 flex-col";let he;e[58]!==d?(he=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=he):he=e[59];let de;e[60]===Symbol.for("react.memo_cache_sentinel")?(de=()=>f([]),e[60]=de):de=e[60];const ae=h.length===0?"font-medium text-foreground":"text-muted-foreground";let ce;e[61]!==ae?(ce=re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ae),e[61]=ae,e[62]=ce):ce=e[62];const ue=Mre[c];let G;e[63]!==ce||e[64]!==ue?(G=o.jsx("button",{type:"button",onClick:de,className:ce,children:ue}),e[63]=ce,e[64]=ue,e[65]=G):G=e[65];let me;e[66]!==h?(me=h.map((xe,Se)=>{const Ce=Se===h.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(h.slice(0,Se+1)),className:re("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Ce?"font-medium text-foreground":"text-muted-foreground"),children:ah(xe,Se)})]},`${xe}-${Se}`)}),e[66]=h,e[67]=me):me=e[67];let ye;e[68]!==he||e[69]!==G||e[70]!==me?(ye=o.jsxs("nav",{"aria-label":he,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[G,me]}),e[68]=he,e[69]=G,e[70]=me,e[71]=ye):ye=e[71];let we;e[72]===Symbol.for("react.memo_cache_sentinel")?(we=o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=we):we=e[72];let Ne;e[73]===Symbol.for("react.memo_cache_sentinel")?(Ne=xe=>x(xe.target.value),e[73]=Ne):Ne=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 _e;e[77]!==c||e[78]!==d?(_e=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:c}),e[77]=c,e[78]=d,e[79]=_e):_e=e[79];let Ve;e[80]!==g||e[81]!==je||e[82]!==_e?(Ve=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[we,o.jsx("input",{type:"text",value:g,onChange:Ne,placeholder:je,"aria-label":_e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=je,e[82]=_e,e[83]=Ve):Ve=e[83],e[84]!==ye||e[85]!==Ve?(E=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[ye,Ve]}),e[84]=ye,e[85]=Ve,e[86]=E):E=e[86],V=ia,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(Mo,{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(xe=>o.jsx(vi,{icon:P,accent:xe.savedKey!==void 0?"global":void 0,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)},xe.savedKey??xe.resolveType))}):ee.length===0&&X.length===0&&ne.length===0?o.jsx(Mo,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:h.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(xe=>{const Se=$re(xe.name,h.length);return o.jsxs("button",{type:"button",onClick:()=>f([...h,xe.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(Se,{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:ah(xe.name,h.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[xe.count," ",xe.count===1?N:c,xe.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:xe.savedCount})]})]})]})]},xe.name)})}),(X.length>0||ne.length>0)&&o.jsxs("div",{className:re("flex flex-col gap-1",ee.length>0&&"mt-4"),children:[X.map(xe=>{const Se=se.get(xe.resolveType)??[],Ce=b.has(xe.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(vi,{icon:P,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)}),Se.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>w(xe.resolveType),"aria-expanded":Ce,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:g3},children:[Ce?o.jsx(bs,{size:12,className:"shrink-0"}):o.jsx(Ws,{size:12,className:"shrink-0"}),d(Ce?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Se.length,")"]}),Ce&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Se.map(Ae=>o.jsx(vi,{icon:P,accent:"global",title:Ae.title,subtitle:Ae.resolveType,active:!1,onClick:()=>q(Ae)},Ae.savedKey))})]})]},xe.resolveType)}),ne.map(xe=>o.jsx(vi,{icon:P,accent:"global",title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)},xe.savedKey))]})]})}e[10]=P,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=h,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=m,e[23]=N,e[24]=d,e[25]=n,e[26]=V,e[27]=E,e[28]=R,e[29]=I,e[30]=D,e[31]=O,e[32]=$}else V=e[26],E=e[27],R=e[28],I=e[29],D=e[30],O=e[31],$=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;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]!==V||e[91]!==M||e[92]!==O?(z=o.jsx(V,{className:O,children:M}),e[90]=V,e[91]=M,e[92]=O,e[93]=z):z=e[93];let B;return e[94]!==E||e[95]!==z||e[96]!==$?(B=o.jsxs("div",{className:$,children:[E,z]}),e[94]=E,e[95]=z,e[96]=$,e[97]=B):B=e[97],B}function zre(t){const[e,s]=t;return{name:e,...s}}function Fre(t,e){return t.title.localeCompare(e.title)}function Ure(t){const[,e]=t;return e}function Hre(t,e){return t.title.localeCompare(e.title)}function Kre(t,e){return t.title.localeCompare(e.title)}function Wre(t){return{resolveType:t.resolveType,title:t.title,folderPath:oS(t.resolveType)}}function qre(t){return{resolveType:t.resolveType,title:t.title,folderPath:oS(t.resolveType),savedKey:t.key}}function Gre(){return new Set}function Yre(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}=aS(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function Jre(t){const e=F.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:u,isCreating:h,onCreate:f,onSaveReferencedBlock:m}=t,p=le(),g=ao(),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,_]=A.useState(b);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[1]=y):y=e[1];const[L,w]=A.useState(y),[S,k]=A.useState(0),[j,C]=A.useState(!1);let T;e[2]!==l||e[3]!==c?(T=Bn(c,l),e[2]=l,e[3]=c,e[4]=T):T=e[4];const N=T,P=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,V=hs()?.taskId??null,E=r??void 0;let R;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==V||e[10]!==n?(R={orgSlug:s,virtualMcpId:n,branch:i,threadId:V,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=V,e[10]=n,e[11]=R):R=e[11];const I=R;let D,O,$,M,z,B,U,H;if(e[12]!==a||e[13]!==L||e[14]!==v||e[15]!==f||e[16]!==p||e[17]!==d){const ce=[d,...L],ue=me=>{w(L.slice(0,me)),k(Qre)};let G;e[26]!==a||e[27]!==v||e[28]!==f?(G=async me=>{const ye=z3(me,a);if(ye){ve.error(ye);return}await f(me,v),C(!1)},e[26]=a,e[27]=v,e[28]=f,e[29]=G):G=e[29],D=G,M="flex h-full w-full min-w-0",$="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]!==p?(z=p("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=p,e[31]=z):z=e[31],B="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ce.map((me,ye)=>{const we=ye===ce.length-1,Ne=kn(me);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ye>0&&o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>ue(ye),title:Ne,className:re("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",we?"font-medium text-foreground":"text-muted-foreground"),children:Ne})]},`${Ne}-${ye}`)}),e[12]=a,e[13]=L,e[14]=v,e[15]=f,e[16]=p,e[17]=d,e[18]=D,e[19]=O,e[20]=$,e[21]=M,e[22]=z,e[23]=B,e[24]=U,e[25]=H}else D=e[18],O=e[19],$=e[20],M=e[21],z=e[22],B=e[23],U=e[24],H=e[25];let W;e[32]!==z||e[33]!==B||e[34]!==U?(W=o.jsx("nav",{"aria-label":z,className:B,children:U}),e[32]=z,e[33]=B,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 Q;e[37]!==p?(Q=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=p,e[38]=Q):Q=e[38];let X;e[39]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx(N2,{size:14}),e[39]=X):X=e[39];let se;e[40]!==h||e[41]!==Q?(se=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{size:"icon",className:"size-8 shrink-0",disabled:h,onClick:K,"aria-label":Q,children:X})}),e[40]=h,e[41]=Q,e[42]=se):se=e[42];let ne;e[43]!==p?(ne=p("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=p,e[44]=ne):ne=e[44];let te;e[45]!==ne?(te=o.jsx(We,{side:"bottom",children:ne}),e[45]=ne,e[46]=te):te=e[46];let ee;e[47]!==se||e[48]!==te?(ee=o.jsxs(qe,{children:[se,te]}),e[47]=se,e[48]=te,e[49]=ee):ee=e[49];let Y;e[50]!==W||e[51]!==ee||e[52]!==H?(Y=o.jsxs("div",{className:H,children:[W,ee]}),e[50]=W,e[51]=ee,e[52]=H,e[53]=Y):Y=e[53];const q="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",oe=p("sandbox.availableSectionEditor.localEditsHint",{typeLabel:P});let J;e[54]!==oe?(J=o.jsx("p",{className:q,children:oe}),e[54]=oe,e[55]=J):J=e[55];let ie;e[56]!==O||e[57]!==Y||e[58]!==J?(ie=o.jsxs("div",{className:O,children:[Y,J]}),e[56]=O,e[57]=Y,e[58]=J,e[59]=ie):ie=e[59];let Z;e[60]!==a||e[61]!==L||e[62]!==S||e[63]!==v||e[64]!==l||e[65]!==m||e[66]!==I||e[67]!==N||e[68]!==p?(Z=o.jsx(ia,{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($i,{schema:N,value:v,onChange:ce=>_(ce),basePath:"",breadcrumbPath:L,onBreadcrumbChange:w,meta:l,decofile:a,onSaveReferencedBlock:m,sandbox:I},S):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:p("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=L,e[62]=S,e[63]=v,e[64]=l,e[65]=m,e[66]=I,e[67]=N,e[68]=p,e[69]=Z):Z=e[69];let he;e[70]!==$||e[71]!==ie||e[72]!==Z?(he=o.jsxs("div",{className:$,children:[ie,Z]}),e[70]=$,e[71]=ie,e[72]=Z,e[73]=he):he=e[73];let de;e[74]!==u||e[75]!==D||e[76]!==h||e[77]!==j?(de=o.jsx(F3,{open:j,onOpenChange:C,defaultBlockId:u,isPending:h,onSubmit:D}),e[74]=u,e[75]=D,e[76]=h,e[77]=j,e[78]=de):de=e[78];let ae;return e[79]!==M||e[80]!==he||e[81]!==de?(ae=o.jsxs("div",{className:M,children:[he,de]}),e[79]=M,e[80]=he,e[81]=de,e[82]=ae):ae=e[82],ae}function Qre(t){return t+1}var Xre=Object.prototype.toString,ud=Array.isArray||function(e){return Xre.call(e)==="[object Array]"};function Q3(t){return typeof t=="function"}function Zre(t){return ud(t)?"array":typeof t}function B1(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Wb(t,e){return t!=null&&typeof t=="object"&&e in t}function eoe(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var toe=RegExp.prototype.test;function soe(t,e){return toe.call(t,e)}var noe=/\S/;function ioe(t){return!soe(noe,t)}var roe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function ooe(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return roe[s]})}var loe=/\s*/,aoe=/\s+/,qb=/\s*=/,coe=/\s*\}/,doe=/#|\^|\/|>|\{|&|=|!/;function uoe(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],l=!1,a=!1,c="",d=0;function u(){if(l&&!a)for(;r.length;)delete i[r.pop()];else r=[];l=!1,a=!1}var h,f,m;function p(k){if(typeof k=="string"&&(k=k.split(aoe,2)),!ud(k)||k.length!==2)throw new Error("Invalid tags: "+k);h=new RegExp(B1(k[0])+"\\s*"),f=new RegExp("\\s*"+B1(k[1])),m=new RegExp("\\s*"+B1("}"+k[1]))}p(e||Ei.tags);for(var g=new b0(t),x,b,v,_,y,L;!g.eos();){if(x=g.pos,v=g.scanUntil(h),v)for(var w=0,S=v.length;w<S;++w)_=v.charAt(w),ioe(_)?(r.push(i.length),c+=_):(a=!0,s=!0,c+=" "),i.push(["text",_,x,x+1]),x+=1,_===`
625
625
  `&&(u(),c="",d=0,s=!1);if(!g.scan(h))break;if(l=!0,b=g.scan(doe)||"name",g.scan(loe),b==="="?(v=g.scanUntil(qb),g.scan(qb),g.scanUntil(f)):b==="{"?(v=g.scanUntil(m),g.scan(coe),g.scanUntil(f),b="&"):v=g.scanUntil(f),!g.scan(f))throw new Error("Unclosed tag at "+g.pos);if(b==">"?y=[b,v,x,g.pos,c,d,s]:y=[b,v,x,g.pos],d++,i.push(y),b==="#"||b==="^")n.push(y);else if(b==="/"){if(L=n.pop(),!L)throw new Error('Unopened section "'+v+'" at '+x);if(L[1]!==v)throw new Error('Unclosed section "'+L[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?a=!0:b==="="&&p(v)}if(u(),L=n.pop(),L)throw new Error('Unclosed section "'+L[1]+'" at '+g.pos);return foe(hoe(i))}function hoe(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 foe(t){for(var e=[],s=e,n=[],i,r,l=0,a=t.length;l<a;++l)switch(i=t[l],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 b0(t){this.string=t,this.tail=t,this.pos=0}b0.prototype.eos=function(){return this.tail===""};b0.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};b0.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 Uc(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Uc.prototype.push=function(e){return new Uc(e,this)};Uc.prototype.lookup=function(e){var s=this.cache,n;if(s.hasOwnProperty(e))n=s[e];else{for(var i=this,r,l,a,c=!1;i;){if(e.indexOf(".")>0)for(r=i.view,l=e.split("."),a=0;r!=null&&a<l.length;)a===l.length-1&&(c=Wb(r,l[a])||eoe(r,l[a])),r=r[l[a++]];else r=i.view[e],c=Wb(i.view,e);if(c){n=r;break}i=i.parent}s[e]=n}return Q3(n)&&(n=n.call(this.view)),n};function An(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}An.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};An.prototype.parse=function(e,s){var n=this.templateCache,i=e+":"+(s||Ei.tags).join(":"),r=typeof n<"u",l=r?n.get(i):void 0;return l==null&&(l=uoe(e,s),r&&n.set(i,l)),l};An.prototype.render=function(e,s,n,i){var r=this.getConfigTags(i),l=this.parse(e,r),a=s instanceof Uc?s:new Uc(s,void 0);return this.renderTokens(l,a,n,e,i)};An.prototype.renderTokens=function(e,s,n,i,r){for(var l="",a,c,d,u=0,h=e.length;u<h;++u)d=void 0,a=e[u],c=a[0],c==="#"?d=this.renderSection(a,s,n,i,r):c==="^"?d=this.renderInverted(a,s,n,i,r):c===">"?d=this.renderPartial(a,s,n,r):c==="&"?d=this.unescapedValue(a,s):c==="name"?d=this.escapedValue(a,s,r):c==="text"&&(d=this.rawValue(a)),d!==void 0&&(l+=d);return l};An.prototype.renderSection=function(e,s,n,i,r){var l=this,a="",c=s.lookup(e[1]);function d(f){return l.render(f,s,n,r)}if(c){if(ud(c))for(var u=0,h=c.length;u<h;++u)a+=this.renderTokens(e[4],s.push(c[u]),n,i,r);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(e[4],s.push(c),n,i,r);else if(Q3(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&&(a+=c)}else a+=this.renderTokens(e[4],s,n,i,r);return a}};An.prototype.renderInverted=function(e,s,n,i,r){var l=s.lookup(e[1]);if(!l||ud(l)&&l.length===0)return this.renderTokens(e[4],s,n,i,r)};An.prototype.indentPartial=function(e,s,n){for(var i=s.replace(/[^ \t]/g,""),r=e.split(`
626
626
  `),l=0;l<r.length;l++)r[l].length&&(l>0||!n)&&(r[l]=i+r[l]);return r.join(`
627
- `)};An.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),l=Q3(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],u=l;c==0&&d&&(u=this.indentPartial(l,d,a));var h=this.parse(u,r);return this.renderTokens(h,s,n,u,i)}}};An.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};An.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ei.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Ei.escape?String(r):i(r)};An.prototype.rawValue=function(e){return e[1]};An.prototype.getConfigTags=function(e){return ud(e)?e:e&&typeof e=="object"?e.tags:void 0};An.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!ud(e))return e.escape};var Ei={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){Pu.templateCache=t},get templateCache(){return Pu.templateCache}},Pu=new An;Ei.clearCache=function(){return Pu.clearCache()};Ei.parse=function(e,s){return Pu.parse(e,s)};Ei.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Zre(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Pu.render(e,s,n,i)};Ei.escape=ooe;Ei.Scanner=b0;Ei.Context=Uc;Ei.Writer=An;function moe(t,e){const s={__resolveType:t},n=$w([s],e)[0];return n?bte(s,n,e):null}function poe({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:l,onSaveReferencedBlock:a}){const c=le(),d=ao(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=A.useState(()=>moe(l,r)),[f,m]=A.useState(h?.data??{}),[p,g]=A.useState([]),[x,b]=A.useState(0),[v,_]=A.useState(!1),[y,L]=A.useState(null),w=y!==null,{save:S,flush:k}=P3({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?Bn(h.resolveType,i):null,C=r[l],T=C?Fl(l,C):l,N=hs()?.taskId??null,P={orgSlug:t,virtualMcpId:e,branch:s,threadId:N,previewUrl:n??void 0,siteSlug:u},V=O=>{m(O),S(l,O)},E=()=>{w?(L(null),_(!1),b(O=>O+1)):L(JSON.stringify(f,null,2))},R=O=>{const $=O??"";try{const M=JSON.parse($);if(M&&typeof M=="object"&&!Array.isArray(M)){_(!1),V(M);return}_(!0)}catch{_(!0)}},I=[T,...p],D=O=>{g(p.slice(0,O)),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:g3},"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,$)=>{const M=$===I.length-1,z=kn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>D($),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}-${$}`)})}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?o.jsx(Ks,{size:14}):o.jsx(ta,{size:14})})}),o.jsx(We,{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(ia,{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($i,{schema:j,value:f,onChange:O=>V(O),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:a,sandbox:P},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),y!==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(td,{language:"json",height:"100%",code:y,onChange:R,onSave:O=>{R(O),k()}})})]})]})]})})}function goe(t){const e=F.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=le();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(Mo,{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=DS(s.title),e[7]=s.title,e[8]=v):v=e[8];let _;e[9]!==u||e[10]!==s.resolveType?(_=(L,w)=>u(s.resolveType,L,w),e[9]=u,e[10]=s.resolveType,e[11]=_):_=e[11];let y;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==h||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==_||e[24]!==i?(y=o.jsx(Jre,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:_,onSaveReferencedBlock:h},g),e[12]=r,e[13]=c,e[14]=d,e[15]=a,e[16]=h,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=_,e[24]=i,e[25]=y):y=e[25],y}const m=`saved:${s.key}`;let p;return e[26]!==r||e[27]!==c||e[28]!==a||e[29]!==h||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=o.jsx(poe,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=r,e[27]=c,e[28]=a,e[29]=h,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const Gb="__all__",Yb={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},xoe={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},kh={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Jb="status:";function Qb(t){if(!t.startsWith(Jb))return null;const e=t.slice(Jb.length);return e in kh?e:null}const Xb=A.forwardRef(function(e,s){const n=F.c(20);let i,r,l,a,c;n[0]!==e?({icon:i,active:r,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=l,n[4]=a,n[5]=c):(i=n[1],r=n[2],l=n[3],a=n[4],c=n[5]);const d=r?"text-foreground":"text-muted-foreground";let u;n[6]!==l||n[7]!==d?(u=re("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=u):u=n[8];let h;n[9]!==i?(h=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=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 m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(bs,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==u||n[17]!==h||n[18]!==f?(p=o.jsxs(fe,{ref:s,type:"button",variant:"ghost",size:"sm",className:u,...a,children:[h,f,m]}),n[14]=a,n[15]=s,n[16]=u,n[17]=h,n[18]=f,n[19]=p):p=n[19],p});function X3(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 boe(t){const e=F.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onStatusFilterChange:h,onSortChange:f}=t,m=le();let p;if(e[0]!==s||e[1]!==r){let Z;e[3]!==r?(Z=he=>he.slug===r,e[3]=r,e[4]=Z):Z=e[4],p=s.find(Z),e[0]=s,e[1]=r,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let Z;e[8]!==l?(Z=he=>he.email===l,e[8]=l,e[9]=Z):Z=e[9],x=n.find(Z),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(r||l||a);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(_=g?.name??b?.name??m(a?kh[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=_):_=e[14];const y=_,L=r?`cat:${r}`:l?`author:${l}`:a?`status:${a}`:Gb;let w;e[15]!==u||e[16]!==d||e[17]!==h?(w=()=>{d(null),u(null),h(null)},e[15]=u,e[16]=d,e[17]=h,e[18]=w):w=e[18];const S=w;let k;e[19]!==S||e[20]!==u||e[21]!==d||e[22]!==h?(k=Z=>{Z.startsWith("cat:")?(u(null),h(null),d(Z.slice(4))):Z.startsWith("author:")?(d(null),h(null),u(Z.slice(7))):Qb(Z)?(d(null),u(null),h(Qb(Z))):S()},e[19]=S,e[20]=u,e[21]=d,e[22]=h,e[23]=k):k=e[23];const j=k;let C;e[24]!==y||e[25]!==v?(C=o.jsx(Ht,{asChild:!0,children:o.jsx(Xb,{icon:fT,active:v,value:y,className:"min-w-0 shrink"})}),e[24]=y,e[25]=v,e[26]=C):C=e[26];let T;e[27]!==m?(T=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=T):T=e[28];let N;e[29]!==T?(N=o.jsx(gd,{children:T}),e[29]=T,e[30]=N):N=e[30];let P;e[31]!==m?(P=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=P):P=e[32];let V;e[33]!==P?(V=o.jsx(Bo,{value:Gb,children:P}),e[33]=P,e[34]=V):V=e[34];let E;e[35]!==m?(E=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=E):E=e[36];let R;e[37]!==E?(R=o.jsx(gd,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=R):R=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(kh),e[39]=I):I=e[39];let D;e[40]!==i||e[41]!==m?(D=I.map(Z=>o.jsxs(Bo,{value:`status:${Z}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(kh[Z])}),o.jsx(X3,{count:i[Z]})]},`status:${Z}`)),e[40]=i,e[41]=m,e[42]=D):D=e[42];let O;e[43]!==s.length||e[44]!==m?(O=s.length>0&&o.jsx(gd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=O):O=e[45];let $;e[46]!==s?($=s.map(yoe),e[46]=s,e[47]=$):$=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&o.jsx(gd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let z;e[51]!==n?(z=n.map(voe),e[51]=n,e[52]=z):z=e[52];let B;e[53]!==L||e[54]!==j||e[55]!==V||e[56]!==R||e[57]!==D||e[58]!==O||e[59]!==$||e[60]!==M||e[61]!==z?(B=o.jsxs(Bh,{value:L,onValueChange:j,children:[V,R,D,O,$,M,z]}),e[53]=L,e[54]=j,e[55]=V,e[56]=R,e[57]=D,e[58]=O,e[59]=$,e[60]=M,e[61]=z,e[62]=B):B=e[62];let U;e[63]!==B||e[64]!==N?(U=o.jsxs(Kt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[N,B]}),e[63]=B,e[64]=N,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=o.jsxs(Ut,{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]!==m?(W=v&&o.jsx(_oe,{label:m("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=v,e[71]=m,e[72]=W):W=e[72];const K=xoe[c];let Q;e[73]!==m||e[74]!==K?(Q=m(K),e[73]=m,e[74]=K,e[75]=Q):Q=e[75];let X;e[76]!==Q?(X=o.jsx(Ht,{asChild:!0,children:o.jsx(Xb,{icon:mT,active:!0,value:Q})}),e[76]=Q,e[77]=X):X=e[77];let se;e[78]!==m?(se=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=se):se=e[79];let ne;e[80]!==se?(ne=o.jsx(gd,{children:se}),e[80]=se,e[81]=ne):ne=e[81];let te;e[82]!==f?(te=Z=>f(Z),e[82]=f,e[83]=te):te=e[83];let ee;e[84]===Symbol.for("react.memo_cache_sentinel")?(ee=Object.keys(Yb),e[84]=ee):ee=e[84];let Y;e[85]!==m?(Y=ee.map(Z=>o.jsx(Bo,{value:Z,children:m(Yb[Z])},Z)),e[85]=m,e[86]=Y):Y=e[86];let q;e[87]!==c||e[88]!==te||e[89]!==Y?(q=o.jsx(Bh,{value:c,onValueChange:te,children:Y}),e[87]=c,e[88]=te,e[89]=Y,e[90]=q):q=e[90];let oe;e[91]!==ne||e[92]!==q?(oe=o.jsxs(Kt,{align:"end",className:"w-44",children:[ne,q]}),e[91]=ne,e[92]=q,e[93]=oe):oe=e[93];let J;e[94]!==X||e[95]!==oe?(J=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs(Ut,{children:[X,oe]})}),e[94]=X,e[95]=oe,e[96]=J):J=e[96];let ie;return e[97]!==H||e[98]!==W||e[99]!==J?(ie=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,W,J]}),e[97]=H,e[98]=W,e[99]=J,e[100]=ie):ie=e[100],ie}function voe(t){return o.jsxs(Bo,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(X3,{count:t.count})]},`author:${t.email}`)}function yoe(t){return o.jsxs(Bo,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(X3,{count:t.count})]},`cat:${t.slug}`)}function _oe(t){const e=F.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ks,{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 Loe(t){const e=F.c(18),{checked:s,disabled:n,onToggle:i}=t,r=le();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r?(a=r(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=r,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:woe,children:o.jsx(Xc,{checked:s,disabled:n,onCheckedChange:l,"aria-label":a})})}),e[5]=s,e[6]=n,e[7]=l,e[8]=a,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 u;e[13]!==d?(u=o.jsx(We,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=o.jsxs(qe,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function woe(t){return t.stopPropagation()}function Soe(t){const e=F.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:l}=t,a=le();let c;e[0]!==n||e[1]!==i?(c=o.jsx(Loe,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let u;e[6]!==d?(u=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=u):u=e[7];const h=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(nn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==h||e[13]!==f?(p=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:r,"aria-label":f,children:m})}),e[11]=r,e[12]=h,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(We,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ks,{size:14}),e[24]=_):_=e[24];let y;e[25]!==l||e[26]!==v?(y=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:_})}),e[25]=l,e[26]=v,e[27]=y):y=e[27];let L;e[28]!==a?(L=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=L):L=e[29];let w;e[30]!==L?(w=o.jsx(We,{side:"bottom",children:L}),e[30]=L,e[31]=w):w=e[31];let S;e[32]!==y||e[33]!==w?(S=o.jsxs(qe,{children:[y,w]}),e[32]=y,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]!==u?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,u,k]}),e[38]=c,e[39]=k,e[40]=u,e[41]=j):j=e[41],j}function jd(t){const e=F.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:l,onDelete:a}=t,c=le();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(li,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=o.jsx(Ht,{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:koe,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(Je,{onClick:n,children:[o.jsx(r9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&o.jsxs(Je,{onClick:s,children:[o.jsx(hn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&o.jsxs(o.Fragment,{children:[o.jsx(Nl,{}),o.jsxs(Je,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(Y2,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==r||e[15]!==l||e[16]!==c?(g=(r||l)&&o.jsxs(o.Fragment,{children:[o.jsx(Nl,{}),r&&o.jsxs(Je,{onClick:r,children:[o.jsx(E2,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&o.jsxs(Je,{onClick:l,children:[o.jsx(ta,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=r,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Nl,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(nn,{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 _;e[22]!==a||e[23]!==v?(_=o.jsxs(Je,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=_):_=e[24];let y;e[25]!==_||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(y=o.jsxs(Kt,{align:"end",className:"w-44",children:[f,m,p,g,x,_]}),e[25]=_,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=y):y=e[30];let L;return e[31]!==y||e[32]!==h?(L=o.jsxs(Ut,{children:[h,y]}),e[31]=y,e[32]=h,e[33]=L):L=e[33],L}function koe(t){return t.stopPropagation()}function joe(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Coe(t){const e=new Map;for(const s of t){const n=joe(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 Zb(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 l;e[2]!==s?(l=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:r,children:[l,n]}),e[4]=n,e[5]=r,e[6]=l,e[7]=a):a=e[7],a}const ev=A.lazy(()=>Gs(()=>import("./app-editor-CXxJdDRj.js"),__vite__mapDeps([161,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,70,71,28,79,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,72,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,77,110,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.AppEditor}))),Noe=A.lazy(()=>Gs(()=>import("./post-editor-4rU4mFOM.js"),__vite__mapDeps([162,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,72,77,163,133,136,101,102,73,114,78,130,164,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,103,104,105,106,107,108,109,110,165,166,111,112,113,71,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,131,132,74,134,135,137,138,139,140,141,142,143,144,145,146,147,70,148,149,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.PostEditor}))),Voe=A.lazy(()=>Gs(()=>import("./record-editor-CcDRxPdh.js"),__vite__mapDeps([167,1,2,72,77,71,8,28,130,165,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,9,44,10,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,166,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,73,118,119,120,121,122,123,124,125,126,127,128,129,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,70,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.RecordEditor}))),Toe=A.lazy(()=>Gs(()=>import("./category-editor-Ddez8F9D.js"),__vite__mapDeps([168,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,146,72,77,164,101,102,73,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,103,104,105,106,107,108,109,110,165,166,111,112,113,71,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,147,70,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.CategoryEditor}))),Aoe=A.lazy(()=>Gs(()=>import("./bulk-category-panel-BsKaZScD.js"),__vite__mapDeps([169,1,2,37,77,170,42,71,8,28])).then(t=>({default:t.BulkCategoryPanel}))),Poe=A.lazy(()=>Gs(()=>import("./sections-editor-Db_XanCD.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])).then(t=>({default:t.SectionsEditor}))),Eoe=A.lazy(()=>Gs(()=>import("./seo-editor-BLeAZw1O.js"),__vite__mapDeps([171,1,2,40,29,30,31,32,33,34,35,36,37,38,39,8,28,41,42,43,9,44,10,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,76,77,78,75,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,72,110,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,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])).then(t=>({default:t.SeoEditor}))),Roe=A.lazy(()=>Gs(()=>import("./variant-calendar-BXwjNPsZ.js"),__vite__mapDeps([172,1,2,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,77,70,71,78,173,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,72,110,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.VariantCalendar}))),Doe=A.lazy(()=>Gs(()=>import("./post-calendar-BacBxT2V.js"),__vite__mapDeps([174,1,2,30,29,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,175,70,71,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,77,72,110,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.PostCalendar}))),Ioe=A.lazy(()=>Gs(()=>import("./redirect-editor-DN0sxwSC.js"),__vite__mapDeps([176,1,2,136,8,72,77,71,28,166,32,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,80,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,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,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,137,138,139,140,141,142,143,144,145,146,147,70,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.RedirectEditor})));function Moe(t){const e=F.c(20),{deepLinkPage:s}=t,n=ao(),{currentBranch:i}=on(),{org:r}=He(),l=n?.entity?.id??null,a=hi(),c=rl(),{runtime:d,previewServerUrl:u}=yn(l),h=d==="cms";let f;e[0]!==h||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=Yie({fastPreviewActive:h,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=h,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=o.jsx(qie,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Mo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=h?u:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==p||e[18]!==l?(g=o.jsx($oe,{orgSlug:r.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const tv=2e3,Ooe=15;function sv(t,e,s,n){return typeof e!="string"||s&&(ck(e,s,n)||t.state.dataUpdateCount>=Ooe)?!1:tv}function $oe({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:l,sandboxWarming:a}){const c=le(),d=hs()?.taskId??null,u=vs(e),h=hg(u,s),f=sd(u)&&h,m={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:p,isLoading:g}=j9(m,{fetchEnabled:l}),[x,b]=A.useState("pages"),[v,_]=A.useState(null),[y,L]=A.useState(null),w=!!(r?.pageId||r?.path||r?.pathTemplate),[S,k]=A.useState(!1);if(w&&!S&&v===null&&p){k(!0);const ge=tX(cf(p),r??{});ge&&(b("pages"),_({collection:"pages",key:ge.key,path:ge.path}))}const[j,C]=A.useState(""),[T,N]=A.useState(null),[P,V]=A.useState(null),[E,R]=A.useState(null),[I,D]=A.useState("date-desc"),[O,$]=A.useState(()=>new Set),[M,z]=A.useState(null),B=()=>{$(new Set),z(null)},U=ge=>{_(ge),L(null)},[H,W]=A.useState(x);H!==x&&(W(x),C(""),N(null),V(null),R(null),D("date-desc"),$(new Set),z(null));const{data:K,isLoading:Q,isFetching:X}=k3(m,{fetchEnabled:l,refetchInterval:ge=>{const Ee=ge.state.data;if(x==="apps"&&v&&v.collection==="apps"){const Re=p?.[v.key];return sv(ge,typeof Re?.__resolveType=="string"?Re.__resolveType:void 0,Ee)}if(x==="site"&&p){const Re=Ee?rp(p,Ee):null,ke=p.site,ot=Re?.resolveType??(typeof ke?.__resolveType=="string"?ke.__resolveType:void 0);return sv(ge,ot,Ee,["seo"])}return!1}}),se=(ge,Ee)=>!ck(ge,K,Ee)&&(Q||X),{catalog:ne,isLoading:te}=Kie(K??void 0,p??void 0,{enabled:x==="apps"}),ee=Ere({orgSlug:t,virtualMcpId:e,branch:s,meta:K}),Y=x0(m),q=Iie(m),[oe,J]=A.useState(null),[ie,Z]=A.useState(),[he,de]=A.useState(null),[ae,ce]=A.useState(null),[ue,G]=A.useState(null),me=!p||!K;if(g||Q||me&&a)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})});if(me)return o.jsx(Mo,{title:"Could not load site data."});const ye=cf(p).sort((ge,Ee)=>ge.name.localeCompare(Ee.name)),we=Nw(p).sort((ge,Ee)=>ge.from.localeCompare(Ee.from)),Ne=S3(p,K),je=x==="sections"?WQ(K):[],_e=rp(p,K),Ve=mk(p),xe=Y3.some(ge=>Ve[ge].length>0),Se=au(x)?Ve[x]:[],Ce=(xe?Au(p,"categories"):[]).map(({key:ge,payload:Ee})=>{const Re=typeof Ee.slug=="string"?Ee.slug:"",ke=typeof Ee.name=="string"?Ee.name:"";return{slug:Re||ge,name:ke||Re||ge}}).filter(ge=>ge.slug).sort((ge,Ee)=>ge.name.localeCompare(Ee.name)),Ae=x==="posts"&&(O.size>0||M!==null),st=Ae?bk(p).filter(ge=>O.has(ge.key)):[],Be=ab(K,"loaders"),Ie=ab(K,"actions");if(!w3(p,K)&&!xe&&Be===0&&Ie===0)return o.jsx(Mo,{icon:Vn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Oe={pages:ye.length,sections:Ne.length,apps:ne.length,loaders:Be,actions:Ie,redirects:we.length,posts:Ve.posts.length,authors:Ve.authors.length,categories:Ve.categories.length},mt=new Set(ye.map(ge=>Fo(ge.path))),lt=new Set(ye.map(ge=>ge.name)),Xe=new Set(Ne.map(ge=>ge.name)),nt=async ge=>{const Ee=p[ge.key];if(!Ee)return;const Re=Uw(p,ge.key),ke=Hw(p,ge.key,Math.max(0,Re-1)),ot=FX(Ee.sections,ke);if(ot)try{await Y.mutateAsync({blockKey:ge.key,data:{...Ee,sections:ot}}),ve.success(`Variant added to "${ge.name}"`),_({collection:"pages",key:ge.key,path:ge.path})}catch(Le){ve.error(Le instanceof Error?Le.message:"Could not add variant")}},Fe=()=>{Z(void 0),J({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},dt=ge=>{Z(void 0),J({mode:"duplicate",sourceKey:ge.key,initialName:$b(lt,ge.name),initialPath:Jie(mt,ge.path)})},et=ge=>{Z(void 0),J({mode:"rename",sourceKey:ge.key,initialName:ge.name,initialPath:ge.path})},rt=async ge=>{if(!oe)return;const{mode:Ee,sourceKey:Re}=oe;try{if(Ee==="create"){let ke;if(ge.templateKey){const Le=p[ge.templateKey];if(!Le)throw new Error("Selected template no longer exists.");ke={...Le,name:ge.name,path:ge.path}}else ke=Zie(ge.name,ge.path);const ot=tre(p,ge.name);await Y.mutateAsync({blockKey:ot,data:ke}),ve.success(`Created "${ge.name}"`),_({collection:"pages",key:ot,path:ge.path})}else if(Ee==="duplicate"&&Re){const ke=p[Re];if(!ke)throw new Error("Source page not found");const{key:ot,data:Le}=Xie({source:ke,pages:ye,newName:ge.name,newPath:ge.path});await Y.mutateAsync({blockKey:ot,data:Le}),ve.success(`Duplicated as "${ge.name}"`),_({collection:"pages",key:ot,path:ge.path})}else if(Ee==="rename"&&Re){const ke=p[Re];if(!ke)throw new Error("Page not found");const ot={...ke,name:ge.name,path:ge.path};await Y.mutateAsync({blockKey:Re,data:ot}),ve.success("Page updated"),v?.collection==="pages"&&v.key===Re&&_({collection:"pages",key:Re,path:ge.path})}J(null)}catch(ke){Z(ke instanceof Error?ke.message:"Save failed")}},gt=({path:ge})=>{if(!oe)return null;const Ee=Fo(ge);return(oe.mode==="rename"?Fo(oe.initialPath):null)!==Ee&&mt.has(Ee)?`A page with path "${ge}" already exists.`:null},pe=async(ge,Ee,Re)=>{await Y.mutateAsync({blockKey:Ee,data:{...Re,name:Ee,__resolveType:ge}}),ve.success(c("sandbox.contentBrowser.createdSection",{name:Ee})),_({collection:"sections",key:Ee})},Me=R3((ge,Ee)=>Y.mutate({blockKey:ge,data:Ee})),Ze=async ge=>{const Ee=p[ge.key];if(!Ee){ve.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Re=Qie(p,ge.key),ke=$b(Xe,ge.name),ot={...Ee,name:ke};try{await Y.mutateAsync({blockKey:Re,data:ot}),ve.success(c("sandbox.contentBrowser.duplicatedSection",{name:ge.name})),_({collection:"sections",key:Re})}catch(Le){ve.error(Le instanceof Error?Le.message:c("sandbox.contentBrowser.duplicateFailed"))}},ct=async ge=>{if(!he)return;const Ee=p[he];if(!Ee){ve.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await Y.mutateAsync({blockKey:he,data:{...Ee,name:ge}}),ve.success(c("sandbox.contentBrowser.sectionRenamed")),de(null)}catch(Re){ve.error(Re instanceof Error?Re.message:c("sandbox.contentBrowser.renameFailed"))}},_t=async()=>{const ge="/redirect-from",Ee=eX(p,ge),Re=QQ({from:ge,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await Y.mutateAsync({blockKey:Ee,data:Re}),ve.success("Created redirect"),_({collection:"redirects",key:Ee})}catch(ke){ve.error(ke instanceof Error?ke.message:"Could not create redirect")}},wt=async ge=>{const Ee=$1(p,ge),Re=fc(Ee,ge,vk(ge));try{await Y.mutateAsync({blockKey:Ee,data:Re}),ve.success(`Created ${lu[ge]}`),_({collection:ge,key:Ee})}catch(ke){ve.error(ke instanceof Error?ke.message:"Could not create")}},ze=async ge=>{const Ee=$1(p,"posts"),Re=fc(Ee,"posts",Sre(ge));try{await Y.mutateAsync({blockKey:Ee,data:Re}),ve.success(c("sandbox.postCalendar.createdScheduledPost")),b("posts"),W("posts"),_({collection:"posts",key:Ee}),L(null)}catch(ke){ve.error(ke instanceof Error?ke.message:c("sandbox.postCalendar.couldNotCreate"))}},yt=async(ge,Ee)=>{const Re=p[ge],ke=Re?jre(Fd(Re,"posts"),Ee):null;if(!ke){ve.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await Y.mutateAsync({blockKey:ge,data:fc(ge,"posts",ke)})}catch(ot){ve.error(ot instanceof Error?ot.message:c("sandbox.postCalendar.couldNotReschedule"))}},At=async ge=>{const Ee=p[ge.key];if(!Ee){ve.error("Record not found.");return}const Re=$1(p,ge.kind),ke=ge.kind==="posts"?"title":"name",ot={...structuredClone(Fd(Ee,ge.kind)),[ke]:`${ge.label} (copy)`};try{await Y.mutateAsync({blockKey:Re,data:fc(Re,ge.kind,ot)}),ve.success(`Duplicated "${ge.label}"`),_({collection:ge.kind,key:Re})}catch(Le){ve.error(Le instanceof Error?Le.message:"Duplicate failed")}},ht=ge=>{$(Ee=>{const Re=new Set(Ee);return Re.has(ge)?Re.delete(ge):Re.add(ge),Re})},ft=ge=>{b("posts"),W("posts"),_(null),L(null),C(""),N(null),V(null),R(null),D("date-desc"),$(new Set),z(ge||null)},at=async(ge,Ee)=>{const Re=[...O];let ke=0;for(const ot of Re){const Le=p[ot],Qe=Fd(Le,"posts"),St=ge==="add"?mre(Qe,Ee):pre(Qe,Ee);St!==Qe&&(await Y.mutateAsync({blockKey:ot,data:fc(ot,"posts",zb(St))}),ke+=1)}return ke},pt=async(ge,Ee)=>{const Re=O.size;try{const ke=await at(ge,Ee),ot=ge==="add"?"Added to":"Moved",Le=Re-ke;ve.success(`${ot} ${ke} ${ke===1?"post":"posts"}`+(Le>0?` (${Le} already set)`:"")),B()}catch(ke){ve.error(ke instanceof Error?ke.message:"Bulk update failed")}},Lt=async()=>{if(ae)try{if(ae.kind==="blog-bulk"){for(const ke of ae.keys)await q.mutateAsync({blockKey:ke});ve.success(`Deleted ${ae.count} ${ae.count===1?"post":"posts"}`),v&&v.collection!=="available-section"&&ae.keys.includes(v.key)&&_(null),B(),ce(null);return}const{kind:ge,key:Ee,label:Re}=ae;if(ge==="blog"){if(ae.blogKind==="categories"){const ke=Fd(p[Ee],"categories").slug,ot=typeof ke=="string"?ke:"";if(ot)for(const{key:Le,payload:Qe}of Au(p,"posts")){const St=gre(Qe,ot);St!==Qe&&await Y.mutateAsync({blockKey:Le,data:fc(Le,"posts",zb(St))})}}await q.mutateAsync({blockKey:Ee})}else await q.mutateAsync({blockKey:Ee});ve.success(`Deleted "${Re}"`),v&&v.collection!=="available-section"&&v.key===Ee&&_(null),ce(null)}catch(ge){ve.error(ge instanceof Error?ge.message:"Delete failed")}},bt=q.isPending||Y.isPending,Ft=ae?.kind==="blog"?lu[ae.blogKind]:ae?.kind==="blog-bulk"?`${ae.count} ${ae.count===1?"post":"posts"}`:ae?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(Wie,{active:x,counts:Oe,showBlog:xe,onSelect:ge=>{b(ge),_(null),L(null)}}),x!=="seo"&&x!=="site"&&x!=="calendar"&&x!=="post-schedule"&&x!=="loaders"&&x!=="actions"&&o.jsx(Boe,{activeCollection:x,pages:ye,redirects:we,sections:Ne,availableSections:je,appCatalog:ne,appCatalogLoading:te,blogEntries:Se,decofile:p,searchQuery:j,onSearchChange:C,postCategoryFilter:T,postAuthorFilter:P,postStatusFilter:E,postSort:I,onPostCategoryFilterChange:ge=>{N(ge),$(new Set)},onPostAuthorFilterChange:ge=>{V(ge),$(new Set)},onPostStatusFilterChange:ge=>{R(ge),$(new Set)},onPostSortChange:D,selectedPostKeys:O,postBulkPanelOpen:Ae,onTogglePostSelect:ht,onSelectAllPosts:ge=>$(new Set(ge)),onClearPostSelection:()=>$(new Set),onExitPostSelection:B,onBulkDeletePosts:()=>ce({kind:"blog-bulk",keys:[...O],count:O.size}),selection:v,onSelect:U,onCreate:()=>{x==="pages"?Fe():x==="redirects"?_t():au(x)&&wt(x)},onDuplicatePage:dt,onRenamePage:et,onAddPageVariant:nt,onDeletePage:ge=>ce({kind:"page",key:ge.key,label:ge.name}),onEditPageSeo:ge=>{const Ee={collection:"pages",key:ge.key,path:ge.path};_(Ee),L(ge.key)},onViewPageJson:ge=>G(ge.key),onDuplicateSection:Ze,onRenameSection:ge=>de(ge.key),onDeleteSection:ge=>ce({kind:"section",key:ge.key,label:ge.name}),onDeleteRedirect:ge=>ce({kind:"redirect",key:ge.key,label:ge.from||ge.key}),onDuplicateBlog:At,onDeleteBlog:ge=>ce({kind:"blog",blogKind:ge.kind,key:ge.key,label:ge.label})}),o.jsx(mS,{readOnly:f,virtualMcpId:e,className:"flex-1 min-w-0",children:x==="loaders"||x==="actions"?o.jsx(Bre,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:K,decofile:p,kind:x}):o.jsx(A.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})}),children:x==="calendar"?o.jsx(Roe,{decofile:p}):x==="post-schedule"?o.jsx(Doe,{decofile:p,support:ee,isCreating:Y.isPending,onCreate:ge=>{ze(ge)},onReschedule:(ge,Ee)=>{yt(ge,Ee)},onSelect:ge=>{b("posts"),W("posts"),_({collection:"posts",key:ge}),L(null)}}):x==="site"?_e?o.jsx(ev,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:_e.key,block:p[_e.key],decofile:p,meta:K,title:"Site",excludeFields:["seo"],schemaPending:se(_e.resolveType,["seo"]),previewBaseUrl:n},`site:${_e.key}`):o.jsx(Mo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):x==="seo"?o.jsx(Eoe,{orgSlug:t,virtualMcpId:e,branch:s,decofile:p,meta:K,target:{kind:"site"},previewBaseUrl:i}):x==="sections"?o.jsx(goe,{selection:v?.collection==="sections"||v?.collection==="available-section"?v:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:K,decofile:p,isCreating:Y.isPending,onCreateAvailable:pe,onSaveReferencedBlock:Me}):Ae?o.jsx(Aoe,{posts:st,categories:Ce,initialSlug:M,isPending:Y.isPending,onApply:(ge,Ee)=>{pt(ge,Ee)},onClose:B},M??"selection"):v&&v.collection!=="available-section"?v.collection==="apps"?o.jsx(ev,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:v.key,block:p[v.key],decofile:p,meta:K,previewBaseUrl:n,schemaPending:se(typeof p[v.key]?.__resolveType=="string"?String(p[v.key].__resolveType):void 0)},`app:${v.key}`):v.collection==="posts"?o.jsx(Noe,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:v.key,block:p[v.key],decofile:p,meta:K,previewBaseUrl:i},`post:${v.key}`):v.collection==="categories"?o.jsx(Toe,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:v.key,block:p[v.key],decofile:p,meta:K,onManagePosts:ft,onOpenPost:ge=>{b("posts"),W("posts"),_({collection:"posts",key:ge}),L(null)},previewBaseUrl:i},`category:${v.key}`):v.collection==="authors"?o.jsx(Voe,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:v.key,block:p[v.key]},`authors:${v.key}`):v.collection==="redirects"?o.jsx(Ioe,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:v.key,block:p[v.key]},`redirect:${v.key}`):o.jsx(Poe,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:v.collection==="pages"?v.path:"/",activePageBlockKey:v.collection==="pages"?v.key:null,activeGlobalBlockKey:v.collection==="sections"?v.key:null,initialEditSeo:v.collection==="pages"&&y===v.key,onExitSeo:()=>L(null)},v.collection==="pages"?`page:${v.key}`:`section:${v.key}`):o.jsx(Mo,{title:`Select ${au(x)?`a ${lu[x]}`:x==="pages"?"a page":x==="apps"?"an app":x==="redirects"?"a redirect":"a section"} to edit`,description:x==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),oe&&o.jsx(rre,{open:!!oe,mode:oe.mode,initialName:oe.initialName,initialPath:oe.initialPath,isPending:Y.isPending,error:ie,templates:ye,validate:gt,onSubmit:rt,onOpenChange:ge=>{ge||(J(null),Z(void 0))}}),he&&o.jsx(ore,{open:!!he,blockKey:he,initialName:Ne.find(ge=>ge.key===he)?.name??he,isPending:Y.isPending,onSubmit:ct,onOpenChange:ge=>{ge||de(null)}}),ue&&o.jsx(Rre,{open:!!ue,onOpenChange:ge=>{ge||G(null)},pageKey:ue,decofile:p,onSave:ge=>Y.mutateAsync({blockKey:ue,data:ge})}),o.jsx(qr,{open:!!ae,onOpenChange:ge=>{!ge&&!bt&&ce(null)},children:o.jsxs(Gr,{children:[o.jsxs(Yr,{children:[o.jsx(Jr,{children:`Delete ${Ft}?`}),o.jsx(Qr,{children:ae?.kind==="section"?`"${ae.label}" will be removed. Pages that still reference it will lose this section.`:ae?.kind==="blog-bulk"?`${ae.count} ${ae.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:ae?`"${ae.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(Xr,{children:[o.jsx(Zr,{disabled:bt,children:"Cancel"}),o.jsx(eo,{onClick:ge=>{ge.preventDefault(),Lt()},disabled:bt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:bt?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function Boe(t){const e=F.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:u,searchQuery:h,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:_,onPostSortChange:y,selectedPostKeys:L,postBulkPanelOpen:w,onTogglePostSelect:S,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:T,selection:N,onSelect:P,onCreate:V,onDuplicatePage:E,onRenamePage:R,onAddPageVariant:I,onDeletePage:D,onEditPageSeo:O,onViewPageJson:$,onDuplicateSection:M,onRenameSection:z,onDeleteSection:B,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:W}=t;let K,Q,X,se,ne,te,ee;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==u||e[6]!==I||e[7]!==T||e[8]!==j||e[9]!==V||e[10]!==W||e[11]!==D||e[12]!==U||e[13]!==B||e[14]!==H||e[15]!==E||e[16]!==M||e[17]!==O||e[18]!==C||e[19]!==v||e[20]!==b||e[21]!==y||e[22]!==_||e[23]!==R||e[24]!==z||e[25]!==f||e[26]!==P||e[27]!==k||e[28]!==S||e[29]!==$||e[30]!==n||e[31]!==p||e[32]!==w||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==h||e[38]!==r||e[39]!==L||e[40]!==N){const J=h.toLowerCase(),ie=n.filter(pe=>!J||pe.name.toLowerCase().includes(J)||pe.path.toLowerCase().includes(J)),Z=i.filter(pe=>!J||pe.from.toLowerCase().includes(J)||pe.to.toLowerCase().includes(J)),he=r.filter(pe=>!J||pe.name.toLowerCase().includes(J)||pe.key.toLowerCase().includes(J)||pe.resolveType.toLowerCase().includes(J)),de=l.filter(pe=>!J||pe.title.toLowerCase().includes(J)||pe.resolveType.toLowerCase().includes(J)||(pe.description?.toLowerCase().includes(J)??!1)),ae=Coe(he),ce=a.filter(pe=>!J||pe.title.toLowerCase().includes(J)||pe.app.toLowerCase().includes(J)||pe.vendor.toLowerCase().includes(J)||pe.category.toLowerCase().includes(J)),ue=d.filter(pe=>!J||pe.label.toLowerCase().includes(J)||pe.subtitle.toLowerCase().includes(J)),G=s==="posts",me=Hoe,ye=G?bk(u):[],we=new Map,Ne=new Map,je={published:0,scheduled:0,draft:0};for(const pe of ye)je[pe.status]=je[pe.status]+1;for(const pe of ye){for(const Me of pe.categorySlugs)we.set(Me,(we.get(Me)??0)+1);for(const Me of pe.authorEmails)Ne.set(Me,(Ne.get(Me)??0)+1)}const _e=(G?Au(u,"categories"):[]).map(pe=>{const{key:Me,payload:Ze}=pe,ct=me(Ze.slug)||Me;return{slug:ct,name:me(Ze.name)||me(Ze.slug)||Me,count:we.get(ct)??0}}).filter(Uoe),Ve=(G?Au(u,"authors"):[]).map(pe=>{const{key:Me,payload:Ze}=pe,ct=me(Ze.email);return{email:ct,name:me(Ze.name)||me(Ze.email)||Me,count:Ne.get(ct)??0}}).filter(Foe);let xe;e[48]!==m?(xe=pe=>!m||pe.categorySlugs.includes(m),e[48]=m,e[49]=xe):xe=e[49];let Se;e[50]!==p?(Se=pe=>!p||pe.authorEmails.includes(p),e[50]=p,e[51]=Se):Se=e[51];let Ce;e[52]!==g?(Ce=pe=>!g||pe.status===g,e[52]=g,e[53]=Ce):Ce=e[53];let Ae;e[54]!==x?(Ae=(pe,Me)=>{if(x==="az")return pe.title.localeCompare(Me.title);if(x==="za")return Me.title.localeCompare(pe.title);const Ze=pe.date.localeCompare(Me.date);return x==="date-asc"?Ze:-Ze},e[54]=x,e[55]=Ae):Ae=e[55];const st=ye.filter(pe=>!J||pe.title.toLowerCase().includes(J)||pe.slug.toLowerCase().includes(J)).filter(xe).filter(Se).filter(Ce).sort(Ae),Be=L.size,Ie=st.map(zoe),Oe=Ie.length>0&&Ie.every(pe=>L.has(pe)),mt=Be>0||w,lt=()=>{Oe?j():k(Ie)},Xe=`Search ${s}…`,nt=au(s)?`Create new ${lu[s]}`:s==="redirects"?"Create new redirect":"Create new page",Fe=s!=="apps"&&s!=="sections";ne="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let dt;e[56]===Symbol.for("react.memo_cache_sentinel")?(dt=o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=dt):dt=e[56];let et;e[57]!==f?(et=pe=>f(pe.target.value),e[57]=f,e[58]=et):et=e[58];let rt;e[59]!==Xe||e[60]!==h||e[61]!==et?(rt=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[dt,o.jsx("input",{type:"text",value:h,onChange:et,placeholder:Xe,"aria-label":Xe,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=Xe,e[60]=h,e[61]=et,e[62]=rt):rt=e[62];let gt;e[63]!==nt||e[64]!==V||e[65]!==Fe?(gt=Fe&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",onClick:V,"aria-label":nt,children:o.jsx(Gt,{size:14})})}),o.jsx(We,{side:"bottom",children:nt})]}),e[63]=nt,e[64]=V,e[65]=Fe,e[66]=gt):gt=e[66],e[67]!==rt||e[68]!==gt?(te=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[rt,gt]}),e[67]=rt,e[68]=gt,e[69]=te):te=e[69],ee=G&&(mt?o.jsx(Soe,{count:Be,allSelected:Oe,onToggleSelectAll:lt,onDelete:T,onExit:C}):o.jsx(boe,{categories:_e,authors:Ve,categoryFilter:m,statusCounts:je,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:_,onSortChange:y})),K=ia,se="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",Q="flex flex-col gap-1 p-1.5",X=s==="pages"?ie.length===0?o.jsx(hc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):ie.map(pe=>{const Me=N?.collection==="pages"&&N.key===pe.key,Ze=Uw(u,pe.key);return o.jsx(vi,{icon:$o,title:pe.name,subtitle:pe.path,active:Me,variantCount:Ze,onClick:()=>P({collection:"pages",key:pe.key,path:pe.path}),menu:o.jsx(jd,{onDuplicate:()=>E(pe),onRename:()=>R(pe),onAddVariant:()=>I(pe),onEditSeo:()=>O(pe),onViewJson:()=>$(pe),onDelete:()=>D(pe)})},pe.key)}):s==="sections"?he.length===0&&de.length===0?o.jsx(hc,{hasItems:r.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[ae.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Zb,{icon:Wo,label:"Saved sections"}),ae.map(pe=>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:pe.label}),pe.sections.map(Me=>{const Ze=N?.collection==="sections"&&N.key===Me.key;return o.jsx(vi,{icon:Wo,accent:"global",title:Me.name,subtitle:pe.label,active:Ze,onClick:()=>P({collection:"sections",key:Me.key}),menu:o.jsx(jd,{onDuplicate:()=>M(Me),onRename:()=>z(Me),onDelete:()=>B(Me)})},Me.key)})]},pe.label))]}),de.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Zb,{icon:$o,label:"Available sections",className:re(ae.length>0&&"mt-3")}),de.map(pe=>{const Me=N?.collection==="available-section"&&N.resolveType===pe.resolveType,Ze=pe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(vi,{icon:$o,title:pe.title,subtitle:Ze??pe.resolveType,active:Me,onClick:()=>P({collection:"available-section",resolveType:pe.resolveType,title:pe.title})},pe.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(it,{className:"size-4.5 text-muted-foreground"})}):ce.length===0?o.jsx(hc,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ce.map(pe=>{const Me=N?.collection==="apps"&&pe.blockKey!==null&&N.key===pe.blockKey;return o.jsx(vi,{icon:B6,logoUrl:pe.logo,title:pe.title,subtitle:pe.category,active:Me,trailing:pe.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(!pe.installed||!pe.blockKey){ve.message(`${pe.title} is not installed on this site.`);return}P({collection:"apps",key:pe.blockKey})}},pe.id)}):s==="redirects"?Z.length===0?o.jsx(hc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):Z.map(pe=>o.jsx(vi,{icon:A6,title:pe.from||"(no source)",subtitle:`→ ${pe.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===pe.key,trailing:o.jsx(lre,{type:pe.type}),onClick:()=>P({collection:"redirects",key:pe.key}),menu:o.jsx(jd,{onDelete:()=>U(pe)})},pe.key)):G?st.length===0?o.jsx(hc,{hasItems:ye.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):st.map(pe=>{const Me={key:pe.key,kind:"posts",label:pe.title,subtitle:pe.slug};return o.jsx(vi,{icon:Vi,title:pe.title,subtitle:pe.slug||"no slug",invalid:pe.missing.length>0,invalidReason:`Missing: ${pe.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===pe.key,selectable:!0,selectionActive:mt,selected:L.has(pe.key),onToggleSelect:()=>S(pe.key),onClick:()=>mt?S(pe.key):P({collection:"posts",key:pe.key}),menu:o.jsx(jd,{onDuplicate:()=>H(Me),onDelete:()=>W(Me)})},pe.key)}):ue.length===0?o.jsx(hc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${au(s)?lu[s]:"item"}.`}):ue.map(pe=>{const Me=N?.collection===pe.kind&&N.key===pe.key;return o.jsx(vi,{icon:pe.kind==="posts"?Vi:pe.kind==="authors"?n9:T2,title:pe.label,subtitle:pe.subtitle,active:Me,onClick:()=>P({collection:pe.kind,key:pe.key}),menu:o.jsx(jd,{onDuplicate:()=>H(pe),onDelete:()=>W(pe)})},pe.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=u,e[6]=I,e[7]=T,e[8]=j,e[9]=V,e[10]=W,e[11]=D,e[12]=U,e[13]=B,e[14]=H,e[15]=E,e[16]=M,e[17]=O,e[18]=C,e[19]=v,e[20]=b,e[21]=y,e[22]=_,e[23]=R,e[24]=z,e[25]=f,e[26]=P,e[27]=k,e[28]=S,e[29]=$,e[30]=n,e[31]=p,e[32]=w,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=h,e[38]=r,e[39]=L,e[40]=N,e[41]=K,e[42]=Q,e[43]=X,e[44]=se,e[45]=ne,e[46]=te,e[47]=ee}else K=e[41],Q=e[42],X=e[43],se=e[44],ne=e[45],te=e[46],ee=e[47];let Y;e[70]!==Q||e[71]!==X?(Y=o.jsx("div",{className:Q,children:X}),e[70]=Q,e[71]=X,e[72]=Y):Y=e[72];let q;e[73]!==K||e[74]!==se||e[75]!==Y?(q=o.jsx(K,{className:se,children:Y}),e[73]=K,e[74]=se,e[75]=Y,e[76]=q):q=e[76];let oe;return e[77]!==ne||e[78]!==te||e[79]!==ee||e[80]!==q?(oe=o.jsxs("div",{className:ne,children:[te,ee,q]}),e[77]=ne,e[78]=te,e[79]=ee,e[80]=q,e[81]=oe):oe=e[81],oe}function zoe(t){return t.key}function Foe(t){return t.email}function Uoe(t){return t.slug}function Hoe(t){return typeof t=="string"?t:""}function Koe(t){const e=F.c(25),{virtualMcpId:s}=t,n=le(),[i,r]=A.useState(!1),l=vs(s),{activeTask:a}=on();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},e[0]=c):c=e[0];const d=nl(c);if(!(jn(l?.metadata)||jn(a?.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(mn,{className:"size-7 text-foreground"})}),e[1]=f):f=e[1];let m;e[2]!==n?(m=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==n?(p=n("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=n,e[5]=p):p=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>r(!0),x=o.jsx(mn,{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(fe,{onClick:g,children:[x,b]}),e[10]=b,e[11]=v):v=e[11];let _;e[12]!==m||e[13]!==p||e[14]!==v?(_=o.jsx(Ci,{className:"h-full",image:f,title:m,description:p,actions:v}),e[12]=m,e[13]=p,e[14]=v,e[15]=_):_=e[15];let y;e[16]!==i?(y=o.jsx(Ju,{open:i,onOpenChange:r,mode:"agent"}),e[16]=i,e[17]=y):y=e[17];let L;return e[18]!==y||e[19]!==_?(L=o.jsxs(o.Fragment,{children:[_,y]}),e[18]=y,e[19]=_,e[20]=L):L=e[20],L}let h;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(h=o.jsx(Moe,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=h):h=e[24],h}function Woe(){const t=F.c(3),[e,s]=A.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>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 qoe(t){const e=F.c(6),{virtualMcpId:s}=t,n=vs(s),i=X6();let r;e[0]!==i||e[1]!==n?(r=zu(i,Q2(n)),e[0]=i,e[1]=n,e[2]=r):r=e[2];const l=r;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Goe,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=o.jsx(Qoe,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function Goe(){const t=F.c(12),e=le();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(J2,{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 l;t[7]!==r?(l=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=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,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Yoe(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function Joe(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function Qoe(t){const e=F.c(99),{config:s}=t,n=le(),[i,r]=A.useState(""),l=l9(i,300);let a;e[0]!==s.id||e[1]!==l?(a={configId:s.id,search:l},e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const c=MS(a),d=D9(),[u,h]=A.useState(!1),[f,m]=A.useState(null),p=A.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 B=[];for(const U of z)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const W=H;B.push(`${U.name} (${W instanceof Error?W.message:"upload failed"})`)}await c.refetch(),B.length>0&&ve.error(B.length===z.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:B.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:B.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(),h(!0)},e[8]=b):b=e[8];const v=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){h(!1)},e[9]=_):_=e[9];const y=_;let L;e[10]!==x?(L=function(M){M.preventDefault(),M.stopPropagation(),h(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=L):L=e[11];const w=L,[S,k]=Woe();let j,C,T,N,P,V;if(e[12]!==s.name||e[13]!==l||e[14]!==k||e[15]!==S||e[16]!==x||e[17]!==u||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(Xoe),z=Joe(M,Yoe(S)),B=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;P="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 Q;e[38]!==K?(Q=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:K}),e[38]=K,e[39]=Q):Q=e[39];let X;e[40]!==W||e[41]!==Q?(X=o.jsxs("div",{className:"min-w-0",children:[W,Q]}),e[40]=W,e[41]=Q,e[42]=X):X=e[42];let se;e[43]===Symbol.for("react.memo_cache_sentinel")?(se=()=>p.current?.click(),e[43]=se):se=e[43];let ne;e[44]!==d.isPending?(ne=d.isPending?o.jsx(it,{className:"size-3.5"}):o.jsx(Yn,{size:14}),e[44]=d.isPending,e[45]=ne):ne=e[45];let te;e[46]!==n||e[47]!==d.isPending?(te=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=te):te=e[48];let ee;e[49]!==ne||e[50]!==te||e[51]!==d.isPending?(ee=o.jsxs(fe,{type:"button",size:"sm",disabled:d.isPending,onClick:se,children:[ne,te]}),e[49]=ne,e[50]=te,e[51]=d.isPending,e[52]=ee):ee=e[52];let Y;e[53]!==x?(Y=o.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ue=>{const G=Array.from(ue.target.files??[]);ue.target.value="",x(G)}}),e[53]=x,e[54]=Y):Y=e[54],e[55]!==X||e[56]!==ee||e[57]!==Y?(V=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[X,ee,Y]}),e[55]=X,e[56]=ee,e[57]=Y,e[58]=V):V=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(s9,{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=()=>p.current?.click(),e[65]=oe):oe=e[65];const J=u&&"border-primary bg-primary/5",ie=d.isPending&&"pointer-events-none opacity-60";let Z;e[66]!==J||e[67]!==ie?(Z=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",J,ie),e[66]=J,e[67]=ie,e[68]=Z):Z=e[68];let he;e[69]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx(Yn,{size:16,className:"text-muted-foreground"}),e[69]=he):he=e[69];let de;e[70]!==n?(de=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=de):de=e[71];let ae;e[72]!==n?(ae=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=ae):ae=e[73];let ce;e[74]!==de||e[75]!==ae?(ce=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[de," ",ae]}),e[74]=de,e[75]=ae,e[76]=ce):ce=e[76],e[77]!==w||e[78]!==Z||e[79]!==ce?(C=o.jsxs("button",{type:"button",onClick:oe,onDragOver:v,onDragLeave:y,onDrop:w,className:Z,children:[he,ce]}),e[77]=w,e[78]=Z,e[79]=ce,e[80]=C):C=e[80],T="min-h-0 flex-1 overflow-y-auto pr-1",N=M.length===0?B?o.jsx(nv,{title:n("filePicker.filePickerDialog.noMatches",{query:B}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(nv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:z.map((ue,G)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ue.map(me=>o.jsx(Zoe,{item:me,onDelete:()=>m(me)},me.key))},G))}),e[12]=s.name,e[13]=l,e[14]=k,e[15]=S,e[16]=x,e[17]=u,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]=T,e[28]=N,e[29]=P,e[30]=V}else j=e[25],C=e[26],T=e[27],N=e[28],P=e[29],V=e[30];let E;e[81]!==c||e[82]!==n?(E=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(fe,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=E):E=e[83];let R;e[84]!==E||e[85]!==T||e[86]!==N?(R=o.jsxs("div",{className:T,children:[N,E]}),e[84]=E,e[85]=T,e[86]=N,e[87]=R):R=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let D;e[89]!==s.id||e[90]!==f?(D=o.jsx(sle,{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]!==R||e[95]!==D||e[96]!==P||e[97]!==V?(O=o.jsxs("div",{className:P,children:[V,j,C,R,D]}),e[92]=j,e[93]=C,e[94]=R,e[95]=D,e[96]=P,e[97]=V,e[98]=O):O=e[98],O}function Xoe(t){return t.items}function nv(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(ki,{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 l;e[3]!==n?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=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,l]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Zoe(t){const e=F.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=OS(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let l;e[2]!==s.key?(l=U3(s.key),e[2]=s.key,e[3]=l):l=e[3];const a=l;let c;e[4]!==a||e[5]!==s.key||e[6]!==s.publicUrl?(c=a?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:ele}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Vi,{size:28,className:"text-muted-foreground"})}),e[4]=a,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 u=s.key;let h;e[12]!==s.key?(h=bf(s.key),e[12]=s.key,e[13]=h):h=e[13];let f;e[14]!==s.key||e[15]!==h?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:u,children:h}),e[14]=s.key,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=$S(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==r||e[20]!==m?(p=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",m]}),e[19]=r,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(tle,{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 ele(t){t.target.style.display="none"}function tle(t){const e=F.c(36),{item:s,onDelete:n}=t,i=le(),[r,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{ve.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(o9,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==r?(f=r?o.jsx($t,{size:14}):o.jsx(hn,{size:14}),e[8]=r,e[9]=f):f=e[9];let m;e[10]!==r||e[11]!==i?(m=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs(Je,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(fn,{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(Je,{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 _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(nn,{size:14}),e[23]=_):_=e[23];let y;e[24]!==i?(y=i("assets.browser.deleteAction"),e[24]=i,e[25]=y):y=e[25];let L;e[26]!==n||e[27]!==y?(L=o.jsxs(Je,{variant:"destructive",onClick:n,children:[_,y]}),e[26]=n,e[27]=y,e[28]=L):L=e[28];let w;e[29]!==v||e[30]!==L||e[31]!==p?(w=o.jsxs(Kt,{align:"end",children:[p,v,L]}),e[29]=v,e[30]=L,e[31]=p,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==h?(S=o.jsxs(Ut,{children:[h,w]}),e[33]=w,e[34]=h,e[35]=S):S=e[35],S}function sle(t){const e=F.c(47),{configId:s,item:n,onClose:i}=t,r=le(),l=mse();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==r?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),ve.success(r("assets.browser.deleted")),i()}catch{ve.error(r("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=r,e[5]=a):a=e[5];const c=a,d=!!n;let u;e[6]!==i?(u=N=>!N&&i(),e[6]=i,e[7]=u):u=e[7];let h;e[8]!==r?(h=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=h):h=e[9];let f;e[10]!==h?(f=o.jsx(Jr,{children:h}),e[10]=h,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==r?(m=r("assets.browser.deleteConfirmDescription",{name:n?bf(n.key):""}),e[12]=n,e[13]=r,e[14]=m):m=e[14];let p;e[15]!==m?(p=o.jsx(Qr,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=o.jsxs(Yr,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==r?(b=r("assets.browser.deleteCancel"),e[20]=r,e[21]=b):b=e[21];let v;e[22]!==l.isPending||e[23]!==b?(v=o.jsx(Zr,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=v):v=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=re(Wy({variant:"destructive"})),e[25]=_):_=e[25];const y=l.isPending;let L;e[26]!==c?(L=N=>{N.preventDefault(),c()},e[26]=c,e[27]=L):L=e[27];let w;e[28]!==l.isPending?(w=l.isPending?o.jsx(it,{className:"size-3.5"}):null,e[28]=l.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]!==l.isPending||e[33]!==L||e[34]!==w||e[35]!==S?(k=o.jsxs(eo,{className:_,disabled:y,onClick:L,children:[w,S]}),e[32]=l.isPending,e[33]=L,e[34]=w,e[35]=S,e[36]=k):k=e[36];let j;e[37]!==v||e[38]!==k?(j=o.jsxs(Xr,{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(Gr,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let T;return e[43]!==C||e[44]!==d||e[45]!==u?(T=o.jsx(qr,{open:d,onOpenChange:u,children:C}),e[43]=C,e[44]=d,e[45]=u,e[46]=T):T=e[46],T}const z1={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:ea},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Kr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:g6}},nle=["fast","smart","thinking"];function ile(t){const e=F.c(19),{tier:s,onSelect:n}=t,i=le(),[r,l]=A.useState(!1),a=z1[s].icon;let c;e[0]!==a?(c=o.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=z1[s];let u;e[2]!==i||e[3]!==d.labelKey?(u=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=u):u=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(bs,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=o.jsx(os,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,u,h]})}),e[6]=c,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=nle.map(x=>{const b=z1[x],v=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),l(!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($t,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsx(as,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==r||e[16]!==f||e[17]!==p?(g=o.jsxs(cs,{open:r,onOpenChange:l,children:[f,p]}),e[15]=r,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function rle(t){const e=F.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,l=le(),[a,c]=A.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=u):u=e[3];let h;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?o.jsx(A.Suspense,{fallback:o.jsx(fe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:o.jsx(ole,{override:i,onOverrideChange:r})}):o.jsx(ile,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=h):h=e[10];let f;e[11]!==r?(f=v=>{c(v),v||r(null)},e[11]=r,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=o.jsx(Ti,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==h||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h,g]}),e[21]=h,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==u||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[u,x]}),e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function ole(t){const e=F.c(25),{override:s,onOverrideChange:n}=t,i=le(),r=Qf(),l=r[0]?.id??null;let a;e[0]!==l||e[1]!==r||e[2]!==s?.credentialId?(a=r.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=r,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=A.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==r?(u=r.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=r,e[7]=u):u=e[7];const h=u;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 m=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 p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==h||e[18]!==n?(g=b=>{const v=b.keyId??h??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=h,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==h||e[21]!==m||e[22]!==p||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(XT,{variant:"bordered",placeholder:p,model:m,credentialId:h,onCredentialChange:d,onModelChange:g})}),e[20]=h,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const wk=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:ig,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:zn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:ki},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:nr},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Bu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Go,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:Wf},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:r9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:j2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:_u},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Go},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:pT}]},{key:"context",headingKey:"automations.automationConfig.context",icon:El,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:El},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Ec},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Ec}]}],lle=wk.flatMap(t=>t.tools.map(e=>e.name));function ale(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function cle(t){const e=F.c(12),{agentId:s,value:n,onChange:i}=t,r=le();let l;e[0]!==r?(l=r("automations.automationConfig.toolsLabel"),e[0]=r,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==r||e[7]!==n?(c=s?o.jsx(A.Suspense,{fallback:o.jsxs(fe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(ig,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(dle,{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]!==a||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function iv(t){const e=F.c(17),{value:s,checked:n,onToggle:i,title:r,description:l,leading:a}=t;let c;e[0]!==n?(c=o.jsx(Xc,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&o.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==r?(u=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]!==u||e[9]!==h?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[u,h]}),e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=o.jsxs(ls,{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]=m):m=e[16],m}function rv(t){const e=F.c(27),{conn:s,label:n,icon:i,on:r,total:l,onToggle:a}=t,c=le(),d=r===l;let u;e[0]!==i||e[1]!==s?(u=s?o.jsx(ro,{icon:s.icon,name:s.title,size:"2xs"}):i?o.jsx(i,{size:14,className:"text-muted-foreground"}):o.jsx(aP,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=u):u=e[2];let h;e[3]!==s?.title||e[4]!==n||e[5]!==c?(h=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=h):h=e[6];let f;e[7]!==h?(f=o.jsx("span",{className:"truncate",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==r||e[10]!==l?(m=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[r,"/",l]}),e[9]=r,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=_=>{_.stopPropagation(),a()},e[12]=a,e[13]=p):p=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]!==p||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==u||e[24]!==f||e[25]!==b?(v=o.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function dle(t){const e=F.c(83),{agentId:s,value:n,onChange:i}=t,r=le(),{org:l}=He(),[a,c]=A.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const u=Cs(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=f6(h),p=Ni();let g,x,b,v,_,y,L,w,S,k,j,C,T;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==r||e[12]!==n){const R=new Map(p.map(ple)),I=new Map;for(const ae of f?.tools??[]){const ce=Ur(ae._meta)??"__other__",ue=Iu(ae.name,ce==="__other__"?void 0:ce),G=ae.title,me=G&&G!==ae.name?G:ale(ue);I.has(ce)||I.set(ce,{clientId:ce,conn:R.get(ce),tools:[]}),I.get(ce).tools.push({name:ae.name,display:me,description:ae.description})}const D=[...I.values()].sort(mle),O=(f?.tools??[]).map(fle),$=[...lle,...O],M=n===null?new Set($):new Set(n),z=$.every(ae=>M.has(ae)),B=ae=>i($.every(ce=>ae.has(ce))?null:[...ae]),U=ae=>{const ce=new Set(M);ce.has(ae)?ce.delete(ae):ce.add(ae),B(ce)},H=(ae,ce)=>{const ue=new Set(M);for(const G of ae)ce?ue.add(G):ue.delete(G);B(ue)};v=cs,T=a,_=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(ig,{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 Q=!z&&o.jsxs(yP,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",$.length]});let X;e[30]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx(bs,{size:14,className:"text-muted-foreground"}),e[30]=X):X=e[30],e[31]!==K||e[32]!==Q?(y=o.jsx(os,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,K,Q,X]})}),e[31]=K,e[32]=Q,e[33]=y):y=e[33],b=as,j="p-0 w-80",C="start",x=Ii;let se;e[34]!==r?(se=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=se):se=e[35],e[36]!==se?(S=o.jsx(di,{placeholder:se}),e[36]=se,e[37]=S):S=e[37];const ne=z?r("automations.automationConfig.allToolsEnabled",{count:$.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:$.length});let te;e[38]!==ne?(te=o.jsx("span",{className:"text-xs text-muted-foreground",children:ne}),e[38]=ne,e[39]=te):te=e[39];let ee;e[40]!==i?(ee=()=>i(null),e[40]=i,e[41]=ee):ee=e[41];let Y;e[42]!==r?(Y=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=Y):Y=e[43];let q;e[44]!==z||e[45]!==ee||e[46]!==Y?(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:Y}),e[44]=z,e[45]=ee,e[46]=Y,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 J;e[49]!==i?(J=()=>i([]),e[49]=i,e[50]=J):J=e[50];const ie=M.size===0;let Z;e[51]!==r?(Z=r("automations.automationConfig.clear"),e[51]=r,e[52]=Z):Z=e[52];let he;e[53]!==J||e[54]!==ie||e[55]!==Z?(he=o.jsx("button",{type:"button",onClick:J,disabled:ie,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:Z}),e[53]=J,e[54]=ie,e[55]=Z,e[56]=he):he=e[56];let de;e[57]!==q||e[58]!==he?(de=o.jsxs("div",{className:"flex items-center gap-2",children:[q,oe,he]}),e[57]=q,e[58]=he,e[59]=de):de=e[59],e[60]!==te||e[61]!==de?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[te,de]}),e[60]=te,e[61]=de,e[62]=k):k=e[62],g=ui,L="max-h-80",w=m?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($n,{children:r("automations.automationConfig.noToolsFound")}),wk.map(ae=>{const ce=ae.tools.map(hle),ue=ce.filter(G=>M.has(G)).length;return o.jsx(Ps,{heading:o.jsx(rv,{label:r(ae.headingKey),icon:ae.icon,on:ue,total:ce.length,onToggle:()=>H(ce,ue!==ce.length)}),children:ae.tools.map(G=>o.jsx(iv,{value:`${r(G.titleKey)} ${G.name}`,checked:M.has(G.name),onToggle:()=>U(G.name),title:r(G.titleKey),description:r(G.descriptionKey),leading:o.jsx(G.icon,{size:16,className:"text-muted-foreground"})},G.name))},ae.key)}),D.map(ae=>{const ce=ae.tools.map(ule),ue=ce.filter(G=>M.has(G)).length;return o.jsx(Ps,{heading:o.jsx(rv,{conn:ae.conn,on:ue,total:ce.length,onToggle:()=>H(ce,ue!==ce.length)}),children:ae.tools.map(G=>o.jsx(iv,{value:`${G.display} ${G.name} ${ae.conn?.title??""}`,checked:M.has(G.name),onToggle:()=>U(G.name),title:G.display,description:G.description},G.name))},ae.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=_,e[18]=y,e[19]=L,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=C,e[25]=T}else g=e[13],x=e[14],b=e[15],v=e[16],_=e[17],y=e[18],L=e[19],w=e[20],S=e[21],k=e[22],j=e[23],C=e[24],T=e[25];let N;e[63]!==g||e[64]!==L||e[65]!==w?(N=o.jsx(g,{className:L,children:w}),e[63]=g,e[64]=L,e[65]=w,e[66]=N):N=e[66];let P;e[67]!==x||e[68]!==N||e[69]!==S||e[70]!==k?(P=o.jsxs(x,{children:[S,k,N]}),e[67]=x,e[68]=N,e[69]=S,e[70]=k,e[71]=P):P=e[71];let V;e[72]!==b||e[73]!==P||e[74]!==j||e[75]!==C?(V=o.jsx(b,{className:j,align:C,children:P}),e[72]=b,e[73]=P,e[74]=j,e[75]=C,e[76]=V):V=e[76];let E;return e[77]!==v||e[78]!==_||e[79]!==y||e[80]!==V||e[81]!==T?(E=o.jsxs(v,{open:T,onOpenChange:_,children:[y,V]}),e[77]=v,e[78]=_,e[79]=y,e[80]=V,e[81]=T,e[82]=E):E=e[82],E}function ule(t){return t.name}function hle(t){return t.name}function fle(t){return t.name}function mle(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function ple(t){return[t.id,t]}function cu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function gle(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 a=parseInt(i[1]??"1");return a%7===0?`Every ${a/7} weeks`:`Every ${a} days`}const r=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(r){const a=(r[2]??"0").padStart(2,"0"),c=(r[1]??"0").padStart(2,"0");return`Every day at ${a}:${c} UTC`}const l=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(l){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(l[3]??"0")]??"day",d=(l[2]??"0").padStart(2,"0"),u=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${u} UTC`}return t}function xle(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 ble(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 vle(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const yle=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function _le({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const l=le(),{triggerAdd:a}=Xu(),[c,d]=A.useState(!1),u=e??c,h=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),ve.success(l("automations.addStarterPopover.starterAdded")),h(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");ve.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});h(!1),p.webhook?r?.(p.webhook):ve.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");ve.error(g)}};return o.jsxs(Ut,{open:u,onOpenChange:h,children:[o.jsx(Ht,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",children:[o.jsx(Gt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),o.jsxs(Kt,{align:"end",className:"w-[200px]",children:[o.jsxs(er,{children:[o.jsxs(tr,{className:"gap-2.5",children:[o.jsx(Jd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),o.jsx(sr,{className:"w-[160px]",children:yle.map(p=>o.jsxs(Je,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[o.jsx(Jd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),o.jsxs(Je,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[o.jsx(Jd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),o.jsxs(Je,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[o.jsx(hr,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),o.jsxs(Je,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[o.jsx(zn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Sk(t){const e=F.c(39),{open:s,onOpenChange:n,url:i,token:r,title:l,description:a}=t,c=l===void 0?"Webhook ready":l,d=a===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":a,u=le(),[h,f]=A.useState(null),[m,p]=A.useState("curl"),[g,x]=A.useState("header"),b=A.useId();let v;e[0]!==u?(v=async(D,O)=>{try{await navigator.clipboard.writeText(D),f(O),ve.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ve.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=v):v=e[1];const _=v;let y;e[2]!==g||e[3]!==r||e[4]!==i?(y=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=y):y=e[5];const L=y,w=i&&r?g==="header"?`curl -X POST "${L}" \\
627
+ `)};An.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),l=Q3(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],u=l;c==0&&d&&(u=this.indentPartial(l,d,a));var h=this.parse(u,r);return this.renderTokens(h,s,n,u,i)}}};An.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};An.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Ei.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Ei.escape?String(r):i(r)};An.prototype.rawValue=function(e){return e[1]};An.prototype.getConfigTags=function(e){return ud(e)?e:e&&typeof e=="object"?e.tags:void 0};An.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!ud(e))return e.escape};var Ei={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){Pu.templateCache=t},get templateCache(){return Pu.templateCache}},Pu=new An;Ei.clearCache=function(){return Pu.clearCache()};Ei.parse=function(e,s){return Pu.parse(e,s)};Ei.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Zre(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Pu.render(e,s,n,i)};Ei.escape=ooe;Ei.Scanner=b0;Ei.Context=Uc;Ei.Writer=An;function moe(t,e){const s={__resolveType:t},n=$w([s],e)[0];return n?bte(s,n,e):null}function poe({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:l,onSaveReferencedBlock:a}){const c=le(),d=ao(),u=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[h]=A.useState(()=>moe(l,r)),[f,m]=A.useState(h?.data??{}),[p,g]=A.useState([]),[x,b]=A.useState(0),[v,_]=A.useState(!1),[y,L]=A.useState(null),w=y!==null,{save:S,flush:k}=P3({orgSlug:t,virtualMcpId:e,branch:s}),j=h?.resolveType?Bn(h.resolveType,i):null,C=r[l],T=C?Fl(l,C):l,N=hs()?.taskId??null,P={orgSlug:t,virtualMcpId:e,branch:s,threadId:N,previewUrl:n??void 0,siteSlug:u},V=O=>{m(O),S(l,O)},E=()=>{w?(L(null),_(!1),b(O=>O+1)):L(JSON.stringify(f,null,2))},R=O=>{const $=O??"";try{const M=JSON.parse($);if(M&&typeof M=="object"&&!Array.isArray(M)){_(!1),V(M);return}_(!0)}catch{_(!0)}},I=[T,...p],D=O=>{g(p.slice(0,O)),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:g3},"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,$)=>{const M=$===I.length-1,z=kn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[$>0&&o.jsx(Ws,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>D($),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}-${$}`)})}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:w?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(w?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":w,children:w?o.jsx(Ks,{size:14}):o.jsx(ta,{size:14})})}),o.jsx(We,{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(ia,{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($i,{schema:j,value:f,onChange:O=>V(O),basePath:"",breadcrumbPath:p,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:a,sandbox:P},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),y!==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(td,{language:"json",height:"100%",code:y,onChange:R,onSave:O=>{R(O),k()}})})]})]})]})})}function goe(t){const e=F.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:u,onSaveReferencedBlock:h}=t,f=le();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(Mo,{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=DS(s.title),e[7]=s.title,e[8]=v):v=e[8];let _;e[9]!==u||e[10]!==s.resolveType?(_=(L,w)=>u(s.resolveType,L,w),e[9]=u,e[10]=s.resolveType,e[11]=_):_=e[11];let y;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==h||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==_||e[24]!==i?(y=o.jsx(Jre,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:v,isCreating:d,onCreate:_,onSaveReferencedBlock:h},g),e[12]=r,e[13]=c,e[14]=d,e[15]=a,e[16]=h,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=_,e[24]=i,e[25]=y):y=e[25],y}const m=`saved:${s.key}`;let p;return e[26]!==r||e[27]!==c||e[28]!==a||e[29]!==h||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==m||e[34]!==i?(p=o.jsx(poe,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:h},m),e[26]=r,e[27]=c,e[28]=a,e[29]=h,e[30]=n,e[31]=l,e[32]=s.key,e[33]=m,e[34]=i,e[35]=p):p=e[35],p}const Gb="__all__",Yb={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},xoe={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},kh={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Jb="status:";function Qb(t){if(!t.startsWith(Jb))return null;const e=t.slice(Jb.length);return e in kh?e:null}const Xb=A.forwardRef(function(e,s){const n=F.c(20);let i,r,l,a,c;n[0]!==e?({icon:i,active:r,value:c,className:l,...a}=e,n[0]=e,n[1]=i,n[2]=r,n[3]=l,n[4]=a,n[5]=c):(i=n[1],r=n[2],l=n[3],a=n[4],c=n[5]);const d=r?"text-foreground":"text-muted-foreground";let u;n[6]!==l||n[7]!==d?(u=re("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=u):u=n[8];let h;n[9]!==i?(h=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=h):h=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 m;n[13]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(bs,{size:12,className:"shrink-0 opacity-60"}),n[13]=m):m=n[13];let p;return n[14]!==a||n[15]!==s||n[16]!==u||n[17]!==h||n[18]!==f?(p=o.jsxs(fe,{ref:s,type:"button",variant:"ghost",size:"sm",className:u,...a,children:[h,f,m]}),n[14]=a,n[15]=s,n[16]=u,n[17]=h,n[18]=f,n[19]=p):p=n[19],p});function X3(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 boe(t){const e=F.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onStatusFilterChange:h,onSortChange:f}=t,m=le();let p;if(e[0]!==s||e[1]!==r){let Z;e[3]!==r?(Z=he=>he.slug===r,e[3]=r,e[4]=Z):Z=e[4],p=s.find(Z),e[0]=s,e[1]=r,e[2]=p}else p=e[2];const g=p;let x;if(e[5]!==l||e[6]!==n){let Z;e[8]!==l?(Z=he=>he.email===l,e[8]=l,e[9]=Z):Z=e[9],x=n.find(Z),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,v=!!(r||l||a);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==m?(_=g?.name??b?.name??m(a?kh[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=m,e[14]=_):_=e[14];const y=_,L=r?`cat:${r}`:l?`author:${l}`:a?`status:${a}`:Gb;let w;e[15]!==u||e[16]!==d||e[17]!==h?(w=()=>{d(null),u(null),h(null)},e[15]=u,e[16]=d,e[17]=h,e[18]=w):w=e[18];const S=w;let k;e[19]!==S||e[20]!==u||e[21]!==d||e[22]!==h?(k=Z=>{Z.startsWith("cat:")?(u(null),h(null),d(Z.slice(4))):Z.startsWith("author:")?(d(null),h(null),u(Z.slice(7))):Qb(Z)?(d(null),u(null),h(Qb(Z))):S()},e[19]=S,e[20]=u,e[21]=d,e[22]=h,e[23]=k):k=e[23];const j=k;let C;e[24]!==y||e[25]!==v?(C=o.jsx(Ht,{asChild:!0,children:o.jsx(Xb,{icon:fT,active:v,value:y,className:"min-w-0 shrink"})}),e[24]=y,e[25]=v,e[26]=C):C=e[26];let T;e[27]!==m?(T=m("sandbox.postToolbar.filterBy"),e[27]=m,e[28]=T):T=e[28];let N;e[29]!==T?(N=o.jsx(gd,{children:T}),e[29]=T,e[30]=N):N=e[30];let P;e[31]!==m?(P=m("sandbox.postToolbar.allPosts"),e[31]=m,e[32]=P):P=e[32];let V;e[33]!==P?(V=o.jsx(Bo,{value:Gb,children:P}),e[33]=P,e[34]=V):V=e[34];let E;e[35]!==m?(E=m("sandbox.postToolbar.statusLabel"),e[35]=m,e[36]=E):E=e[36];let R;e[37]!==E?(R=o.jsx(gd,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=R):R=e[38];let I;e[39]===Symbol.for("react.memo_cache_sentinel")?(I=Object.keys(kh),e[39]=I):I=e[39];let D;e[40]!==i||e[41]!==m?(D=I.map(Z=>o.jsxs(Bo,{value:`status:${Z}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m(kh[Z])}),o.jsx(X3,{count:i[Z]})]},`status:${Z}`)),e[40]=i,e[41]=m,e[42]=D):D=e[42];let O;e[43]!==s.length||e[44]!==m?(O=s.length>0&&o.jsx(gd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=m,e[45]=O):O=e[45];let $;e[46]!==s?($=s.map(yoe),e[46]=s,e[47]=$):$=e[47];let M;e[48]!==n.length||e[49]!==m?(M=n.length>0&&o.jsx(gd,{className:"text-muted-foreground/70",children:m("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=m,e[50]=M):M=e[50];let z;e[51]!==n?(z=n.map(voe),e[51]=n,e[52]=z):z=e[52];let B;e[53]!==L||e[54]!==j||e[55]!==V||e[56]!==R||e[57]!==D||e[58]!==O||e[59]!==$||e[60]!==M||e[61]!==z?(B=o.jsxs(Bh,{value:L,onValueChange:j,children:[V,R,D,O,$,M,z]}),e[53]=L,e[54]=j,e[55]=V,e[56]=R,e[57]=D,e[58]=O,e[59]=$,e[60]=M,e[61]=z,e[62]=B):B=e[62];let U;e[63]!==B||e[64]!==N?(U=o.jsxs(Kt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[N,B]}),e[63]=B,e[64]=N,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=o.jsxs(Ut,{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]!==m?(W=v&&o.jsx(_oe,{label:m("sandbox.postToolbar.clearFilter"),onClick:S}),e[69]=S,e[70]=v,e[71]=m,e[72]=W):W=e[72];const K=xoe[c];let Q;e[73]!==m||e[74]!==K?(Q=m(K),e[73]=m,e[74]=K,e[75]=Q):Q=e[75];let X;e[76]!==Q?(X=o.jsx(Ht,{asChild:!0,children:o.jsx(Xb,{icon:mT,active:!0,value:Q})}),e[76]=Q,e[77]=X):X=e[77];let se;e[78]!==m?(se=m("sandbox.postToolbar.sortBy"),e[78]=m,e[79]=se):se=e[79];let ne;e[80]!==se?(ne=o.jsx(gd,{children:se}),e[80]=se,e[81]=ne):ne=e[81];let te;e[82]!==f?(te=Z=>f(Z),e[82]=f,e[83]=te):te=e[83];let ee;e[84]===Symbol.for("react.memo_cache_sentinel")?(ee=Object.keys(Yb),e[84]=ee):ee=e[84];let Y;e[85]!==m?(Y=ee.map(Z=>o.jsx(Bo,{value:Z,children:m(Yb[Z])},Z)),e[85]=m,e[86]=Y):Y=e[86];let q;e[87]!==c||e[88]!==te||e[89]!==Y?(q=o.jsx(Bh,{value:c,onValueChange:te,children:Y}),e[87]=c,e[88]=te,e[89]=Y,e[90]=q):q=e[90];let oe;e[91]!==ne||e[92]!==q?(oe=o.jsxs(Kt,{align:"end",className:"w-44",children:[ne,q]}),e[91]=ne,e[92]=q,e[93]=oe):oe=e[93];let J;e[94]!==X||e[95]!==oe?(J=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs(Ut,{children:[X,oe]})}),e[94]=X,e[95]=oe,e[96]=J):J=e[96];let ie;return e[97]!==H||e[98]!==W||e[99]!==J?(ie=o.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[H,W,J]}),e[97]=H,e[98]=W,e[99]=J,e[100]=ie):ie=e[100],ie}function voe(t){return o.jsxs(Bo,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(X3,{count:t.count})]},`author:${t.email}`)}function yoe(t){return o.jsxs(Bo,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(X3,{count:t.count})]},`cat:${t.slug}`)}function _oe(t){const e=F.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ks,{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 Loe(t){const e=F.c(18),{checked:s,disabled:n,onToggle:i}=t,r=le();let l;e[0]!==i?(l=()=>i(),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r?(a=r(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=r,e[4]=a):a=e[4];let c;e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==a?(c=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:woe,children:o.jsx(Xc,{checked:s,disabled:n,onCheckedChange:l,"aria-label":a})})}),e[5]=s,e[6]=n,e[7]=l,e[8]=a,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 u;e[13]!==d?(u=o.jsx(We,{side:"bottom",children:d}),e[13]=d,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==u?(h=o.jsxs(qe,{children:[c,u]}),e[15]=c,e[16]=u,e[17]=h):h=e[17],h}function woe(t){return t.stopPropagation()}function Soe(t){const e=F.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:l}=t,a=le();let c;e[0]!==n||e[1]!==i?(c=o.jsx(Loe,{checked:n,onToggle:i}),e[0]=n,e[1]=i,e[2]=c):c=e[2];let d;e[3]!==s||e[4]!==a?(d=a("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=a,e[5]=d):d=e[5];let u;e[6]!==d?(u=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=u):u=e[7];const h=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(nn,{size:14}),e[10]=m):m=e[10];let p;e[11]!==r||e[12]!==h||e[13]!==f?(p=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:h,onClick:r,"aria-label":f,children:m})}),e[11]=r,e[12]=h,e[13]=f,e[14]=p):p=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(We,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==p||e[20]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[19]=p,e[20]=x,e[21]=b):b=e[21];let v;e[22]!==a?(v=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ks,{size:14}),e[24]=_):_=e[24];let y;e[25]!==l||e[26]!==v?(y=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":v,children:_})}),e[25]=l,e[26]=v,e[27]=y):y=e[27];let L;e[28]!==a?(L=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=L):L=e[29];let w;e[30]!==L?(w=o.jsx(We,{side:"bottom",children:L}),e[30]=L,e[31]=w):w=e[31];let S;e[32]!==y||e[33]!==w?(S=o.jsxs(qe,{children:[y,w]}),e[32]=y,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]!==u?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,u,k]}),e[38]=c,e[39]=k,e[40]=u,e[41]=j):j=e[41],j}function jd(t){const e=F.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:l,onDelete:a}=t,c=le();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(li,{size:14}),e[2]=u):u=e[2];let h;e[3]!==d?(h=o.jsx(Ht,{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:koe,children:u})}),e[3]=d,e[4]=h):h=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(Je,{onClick:n,children:[o.jsx(r9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let m;e[8]!==s||e[9]!==c?(m=s&&o.jsxs(Je,{onClick:s,children:[o.jsx(hn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=m):m=e[10];let p;e[11]!==i||e[12]!==c?(p=i&&o.jsxs(o.Fragment,{children:[o.jsx(Nl,{}),o.jsxs(Je,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(Y2,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=p):p=e[13];let g;e[14]!==r||e[15]!==l||e[16]!==c?(g=(r||l)&&o.jsxs(o.Fragment,{children:[o.jsx(Nl,{}),r&&o.jsxs(Je,{onClick:r,children:[o.jsx(E2,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&o.jsxs(Je,{onClick:l,children:[o.jsx(ta,{size:14}),c("sandbox.itemActions.viewJson")]})]}),e[14]=r,e[15]=l,e[16]=c,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Nl,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(nn,{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 _;e[22]!==a||e[23]!==v?(_=o.jsxs(Je,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,v]}),e[22]=a,e[23]=v,e[24]=_):_=e[24];let y;e[25]!==_||e[26]!==f||e[27]!==m||e[28]!==p||e[29]!==g?(y=o.jsxs(Kt,{align:"end",className:"w-44",children:[f,m,p,g,x,_]}),e[25]=_,e[26]=f,e[27]=m,e[28]=p,e[29]=g,e[30]=y):y=e[30];let L;return e[31]!==y||e[32]!==h?(L=o.jsxs(Ut,{children:[h,y]}),e[31]=y,e[32]=h,e[33]=L):L=e[33],L}function koe(t){return t.stopPropagation()}function joe(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Coe(t){const e=new Map;for(const s of t){const n=joe(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 Zb(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 l;e[2]!==s?(l=o.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=l):l=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==l?(a=o.jsxs("div",{className:r,children:[l,n]}),e[4]=n,e[5]=r,e[6]=l,e[7]=a):a=e[7],a}const ev=A.lazy(()=>Gs(()=>import("./app-editor-Bvzl_qDB.js"),__vite__mapDeps([161,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,70,71,28,79,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,72,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,77,110,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.AppEditor}))),Noe=A.lazy(()=>Gs(()=>import("./post-editor-vBEo0v-g.js"),__vite__mapDeps([162,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,72,77,163,133,136,101,102,73,114,78,130,164,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,103,104,105,106,107,108,109,110,165,166,111,112,113,71,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,131,132,74,134,135,137,138,139,140,141,142,143,144,145,146,147,70,148,149,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.PostEditor}))),Voe=A.lazy(()=>Gs(()=>import("./record-editor-BC2iQPGE.js"),__vite__mapDeps([167,1,2,72,77,71,8,28,130,165,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,9,44,10,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,166,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,73,118,119,120,121,122,123,124,125,126,127,128,129,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,70,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.RecordEditor}))),Toe=A.lazy(()=>Gs(()=>import("./category-editor-BPZKWEN1.js"),__vite__mapDeps([168,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,146,72,77,164,101,102,73,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,103,104,105,106,107,108,109,110,165,166,111,112,113,71,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,147,70,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.CategoryEditor}))),Aoe=A.lazy(()=>Gs(()=>import("./bulk-category-panel-BWY_YPZV.js"),__vite__mapDeps([169,1,2,37,77,170,42,71,8,28])).then(t=>({default:t.BulkCategoryPanel}))),Poe=A.lazy(()=>Gs(()=>import("./sections-editor-CVFGArcx.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])).then(t=>({default:t.SectionsEditor}))),Eoe=A.lazy(()=>Gs(()=>import("./seo-editor-DlfpOYSl.js"),__vite__mapDeps([171,1,2,40,29,30,31,32,33,34,35,36,37,38,39,8,28,41,42,43,9,44,10,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,76,77,78,75,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,72,110,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,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])).then(t=>({default:t.SeoEditor}))),Roe=A.lazy(()=>Gs(()=>import("./variant-calendar-CodpU1lu.js"),__vite__mapDeps([172,1,2,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,77,70,71,78,173,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,72,110,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.VariantCalendar}))),Doe=A.lazy(()=>Gs(()=>import("./post-calendar-Chm7CCue.js"),__vite__mapDeps([174,1,2,30,29,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,175,70,71,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,77,72,110,111,112,113,114,115,116,117,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.PostCalendar}))),Ioe=A.lazy(()=>Gs(()=>import("./redirect-editor-C7uuK_jN.js"),__vite__mapDeps([176,1,2,136,8,72,77,71,28,166,32,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,80,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,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,73,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,74,134,135,137,138,139,140,141,142,143,144,145,146,147,70,148,149,78,150,151,152,153,154,155,156,75,157,158,159])).then(t=>({default:t.RedirectEditor})));function Moe(t){const e=F.c(20),{deepLinkPage:s}=t,n=ao(),{currentBranch:i}=on(),{org:r}=He(),l=n?.entity?.id??null,a=hi(),c=rl(),{runtime:d,previewServerUrl:u}=yn(l),h=d==="cms";let f;e[0]!==h||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=Yie({fastPreviewActive:h,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=h,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const m=f;if(m.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==m.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=o.jsx(qie,{state:m.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=m.state,e[5]=c.start,e[6]=x,e[7]=a.lifecycle,e[8]=a.phase,e[9]=b):b=e[9],b}if(!l||!i){let x;return e[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Mo,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const p=h?u:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==m.devServerReady||e[14]!==m.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==p||e[18]!==l?(g=o.jsx($oe,{orgSlug:r.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:p,deepLinkPage:s,devServerReady:m.devServerReady,sandboxWarming:m.sandboxWarming}),e[11]=i,e[12]=s,e[13]=m.devServerReady,e[14]=m.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=p,e[18]=l,e[19]=g):g=e[19],g}const tv=2e3,Ooe=15;function sv(t,e,s,n){return typeof e!="string"||s&&(ck(e,s,n)||t.state.dataUpdateCount>=Ooe)?!1:tv}function $oe({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:l,sandboxWarming:a}){const c=le(),d=hs()?.taskId??null,u=vs(e),h=hg(u,s),f=sd(u)&&h,m={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:p,isLoading:g}=j9(m,{fetchEnabled:l}),[x,b]=A.useState("pages"),[v,_]=A.useState(null),[y,L]=A.useState(null),w=!!(r?.pageId||r?.path||r?.pathTemplate),[S,k]=A.useState(!1);if(w&&!S&&v===null&&p){k(!0);const ge=tX(cf(p),r??{});ge&&(b("pages"),_({collection:"pages",key:ge.key,path:ge.path}))}const[j,C]=A.useState(""),[T,N]=A.useState(null),[P,V]=A.useState(null),[E,R]=A.useState(null),[I,D]=A.useState("date-desc"),[O,$]=A.useState(()=>new Set),[M,z]=A.useState(null),B=()=>{$(new Set),z(null)},U=ge=>{_(ge),L(null)},[H,W]=A.useState(x);H!==x&&(W(x),C(""),N(null),V(null),R(null),D("date-desc"),$(new Set),z(null));const{data:K,isLoading:Q,isFetching:X}=k3(m,{fetchEnabled:l,refetchInterval:ge=>{const Ee=ge.state.data;if(x==="apps"&&v&&v.collection==="apps"){const Re=p?.[v.key];return sv(ge,typeof Re?.__resolveType=="string"?Re.__resolveType:void 0,Ee)}if(x==="site"&&p){const Re=Ee?rp(p,Ee):null,ke=p.site,ot=Re?.resolveType??(typeof ke?.__resolveType=="string"?ke.__resolveType:void 0);return sv(ge,ot,Ee,["seo"])}return!1}}),se=(ge,Ee)=>!ck(ge,K,Ee)&&(Q||X),{catalog:ne,isLoading:te}=Kie(K??void 0,p??void 0,{enabled:x==="apps"}),ee=Ere({orgSlug:t,virtualMcpId:e,branch:s,meta:K}),Y=x0(m),q=Iie(m),[oe,J]=A.useState(null),[ie,Z]=A.useState(),[he,de]=A.useState(null),[ae,ce]=A.useState(null),[ue,G]=A.useState(null),me=!p||!K;if(g||Q||me&&a)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})});if(me)return o.jsx(Mo,{title:"Could not load site data."});const ye=cf(p).sort((ge,Ee)=>ge.name.localeCompare(Ee.name)),we=Nw(p).sort((ge,Ee)=>ge.from.localeCompare(Ee.from)),Ne=S3(p,K),je=x==="sections"?WQ(K):[],_e=rp(p,K),Ve=mk(p),xe=Y3.some(ge=>Ve[ge].length>0),Se=au(x)?Ve[x]:[],Ce=(xe?Au(p,"categories"):[]).map(({key:ge,payload:Ee})=>{const Re=typeof Ee.slug=="string"?Ee.slug:"",ke=typeof Ee.name=="string"?Ee.name:"";return{slug:Re||ge,name:ke||Re||ge}}).filter(ge=>ge.slug).sort((ge,Ee)=>ge.name.localeCompare(Ee.name)),Ae=x==="posts"&&(O.size>0||M!==null),st=Ae?bk(p).filter(ge=>O.has(ge.key)):[],Be=ab(K,"loaders"),Ie=ab(K,"actions");if(!w3(p,K)&&!xe&&Be===0&&Ie===0)return o.jsx(Mo,{icon:Vn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const Oe={pages:ye.length,sections:Ne.length,apps:ne.length,loaders:Be,actions:Ie,redirects:we.length,posts:Ve.posts.length,authors:Ve.authors.length,categories:Ve.categories.length},mt=new Set(ye.map(ge=>Fo(ge.path))),lt=new Set(ye.map(ge=>ge.name)),Xe=new Set(Ne.map(ge=>ge.name)),nt=async ge=>{const Ee=p[ge.key];if(!Ee)return;const Re=Uw(p,ge.key),ke=Hw(p,ge.key,Math.max(0,Re-1)),ot=FX(Ee.sections,ke);if(ot)try{await Y.mutateAsync({blockKey:ge.key,data:{...Ee,sections:ot}}),ve.success(`Variant added to "${ge.name}"`),_({collection:"pages",key:ge.key,path:ge.path})}catch(Le){ve.error(Le instanceof Error?Le.message:"Could not add variant")}},Fe=()=>{Z(void 0),J({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},dt=ge=>{Z(void 0),J({mode:"duplicate",sourceKey:ge.key,initialName:$b(lt,ge.name),initialPath:Jie(mt,ge.path)})},et=ge=>{Z(void 0),J({mode:"rename",sourceKey:ge.key,initialName:ge.name,initialPath:ge.path})},rt=async ge=>{if(!oe)return;const{mode:Ee,sourceKey:Re}=oe;try{if(Ee==="create"){let ke;if(ge.templateKey){const Le=p[ge.templateKey];if(!Le)throw new Error("Selected template no longer exists.");ke={...Le,name:ge.name,path:ge.path}}else ke=Zie(ge.name,ge.path);const ot=tre(p,ge.name);await Y.mutateAsync({blockKey:ot,data:ke}),ve.success(`Created "${ge.name}"`),_({collection:"pages",key:ot,path:ge.path})}else if(Ee==="duplicate"&&Re){const ke=p[Re];if(!ke)throw new Error("Source page not found");const{key:ot,data:Le}=Xie({source:ke,pages:ye,newName:ge.name,newPath:ge.path});await Y.mutateAsync({blockKey:ot,data:Le}),ve.success(`Duplicated as "${ge.name}"`),_({collection:"pages",key:ot,path:ge.path})}else if(Ee==="rename"&&Re){const ke=p[Re];if(!ke)throw new Error("Page not found");const ot={...ke,name:ge.name,path:ge.path};await Y.mutateAsync({blockKey:Re,data:ot}),ve.success("Page updated"),v?.collection==="pages"&&v.key===Re&&_({collection:"pages",key:Re,path:ge.path})}J(null)}catch(ke){Z(ke instanceof Error?ke.message:"Save failed")}},gt=({path:ge})=>{if(!oe)return null;const Ee=Fo(ge);return(oe.mode==="rename"?Fo(oe.initialPath):null)!==Ee&&mt.has(Ee)?`A page with path "${ge}" already exists.`:null},pe=async(ge,Ee,Re)=>{await Y.mutateAsync({blockKey:Ee,data:{...Re,name:Ee,__resolveType:ge}}),ve.success(c("sandbox.contentBrowser.createdSection",{name:Ee})),_({collection:"sections",key:Ee})},Me=R3((ge,Ee)=>Y.mutate({blockKey:ge,data:Ee})),Ze=async ge=>{const Ee=p[ge.key];if(!Ee){ve.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Re=Qie(p,ge.key),ke=$b(Xe,ge.name),ot={...Ee,name:ke};try{await Y.mutateAsync({blockKey:Re,data:ot}),ve.success(c("sandbox.contentBrowser.duplicatedSection",{name:ge.name})),_({collection:"sections",key:Re})}catch(Le){ve.error(Le instanceof Error?Le.message:c("sandbox.contentBrowser.duplicateFailed"))}},ct=async ge=>{if(!he)return;const Ee=p[he];if(!Ee){ve.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await Y.mutateAsync({blockKey:he,data:{...Ee,name:ge}}),ve.success(c("sandbox.contentBrowser.sectionRenamed")),de(null)}catch(Re){ve.error(Re instanceof Error?Re.message:c("sandbox.contentBrowser.renameFailed"))}},_t=async()=>{const ge="/redirect-from",Ee=eX(p,ge),Re=QQ({from:ge,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await Y.mutateAsync({blockKey:Ee,data:Re}),ve.success("Created redirect"),_({collection:"redirects",key:Ee})}catch(ke){ve.error(ke instanceof Error?ke.message:"Could not create redirect")}},wt=async ge=>{const Ee=$1(p,ge),Re=fc(Ee,ge,vk(ge));try{await Y.mutateAsync({blockKey:Ee,data:Re}),ve.success(`Created ${lu[ge]}`),_({collection:ge,key:Ee})}catch(ke){ve.error(ke instanceof Error?ke.message:"Could not create")}},ze=async ge=>{const Ee=$1(p,"posts"),Re=fc(Ee,"posts",Sre(ge));try{await Y.mutateAsync({blockKey:Ee,data:Re}),ve.success(c("sandbox.postCalendar.createdScheduledPost")),b("posts"),W("posts"),_({collection:"posts",key:Ee}),L(null)}catch(ke){ve.error(ke instanceof Error?ke.message:c("sandbox.postCalendar.couldNotCreate"))}},yt=async(ge,Ee)=>{const Re=p[ge],ke=Re?jre(Fd(Re,"posts"),Ee):null;if(!ke){ve.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await Y.mutateAsync({blockKey:ge,data:fc(ge,"posts",ke)})}catch(ot){ve.error(ot instanceof Error?ot.message:c("sandbox.postCalendar.couldNotReschedule"))}},At=async ge=>{const Ee=p[ge.key];if(!Ee){ve.error("Record not found.");return}const Re=$1(p,ge.kind),ke=ge.kind==="posts"?"title":"name",ot={...structuredClone(Fd(Ee,ge.kind)),[ke]:`${ge.label} (copy)`};try{await Y.mutateAsync({blockKey:Re,data:fc(Re,ge.kind,ot)}),ve.success(`Duplicated "${ge.label}"`),_({collection:ge.kind,key:Re})}catch(Le){ve.error(Le instanceof Error?Le.message:"Duplicate failed")}},ht=ge=>{$(Ee=>{const Re=new Set(Ee);return Re.has(ge)?Re.delete(ge):Re.add(ge),Re})},ft=ge=>{b("posts"),W("posts"),_(null),L(null),C(""),N(null),V(null),R(null),D("date-desc"),$(new Set),z(ge||null)},at=async(ge,Ee)=>{const Re=[...O];let ke=0;for(const ot of Re){const Le=p[ot],Qe=Fd(Le,"posts"),St=ge==="add"?mre(Qe,Ee):pre(Qe,Ee);St!==Qe&&(await Y.mutateAsync({blockKey:ot,data:fc(ot,"posts",zb(St))}),ke+=1)}return ke},pt=async(ge,Ee)=>{const Re=O.size;try{const ke=await at(ge,Ee),ot=ge==="add"?"Added to":"Moved",Le=Re-ke;ve.success(`${ot} ${ke} ${ke===1?"post":"posts"}`+(Le>0?` (${Le} already set)`:"")),B()}catch(ke){ve.error(ke instanceof Error?ke.message:"Bulk update failed")}},Lt=async()=>{if(ae)try{if(ae.kind==="blog-bulk"){for(const ke of ae.keys)await q.mutateAsync({blockKey:ke});ve.success(`Deleted ${ae.count} ${ae.count===1?"post":"posts"}`),v&&v.collection!=="available-section"&&ae.keys.includes(v.key)&&_(null),B(),ce(null);return}const{kind:ge,key:Ee,label:Re}=ae;if(ge==="blog"){if(ae.blogKind==="categories"){const ke=Fd(p[Ee],"categories").slug,ot=typeof ke=="string"?ke:"";if(ot)for(const{key:Le,payload:Qe}of Au(p,"posts")){const St=gre(Qe,ot);St!==Qe&&await Y.mutateAsync({blockKey:Le,data:fc(Le,"posts",zb(St))})}}await q.mutateAsync({blockKey:Ee})}else await q.mutateAsync({blockKey:Ee});ve.success(`Deleted "${Re}"`),v&&v.collection!=="available-section"&&v.key===Ee&&_(null),ce(null)}catch(ge){ve.error(ge instanceof Error?ge.message:"Delete failed")}},bt=q.isPending||Y.isPending,Ft=ae?.kind==="blog"?lu[ae.blogKind]:ae?.kind==="blog-bulk"?`${ae.count} ${ae.count===1?"post":"posts"}`:ae?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(Wie,{active:x,counts:Oe,showBlog:xe,onSelect:ge=>{b(ge),_(null),L(null)}}),x!=="seo"&&x!=="site"&&x!=="calendar"&&x!=="post-schedule"&&x!=="loaders"&&x!=="actions"&&o.jsx(Boe,{activeCollection:x,pages:ye,redirects:we,sections:Ne,availableSections:je,appCatalog:ne,appCatalogLoading:te,blogEntries:Se,decofile:p,searchQuery:j,onSearchChange:C,postCategoryFilter:T,postAuthorFilter:P,postStatusFilter:E,postSort:I,onPostCategoryFilterChange:ge=>{N(ge),$(new Set)},onPostAuthorFilterChange:ge=>{V(ge),$(new Set)},onPostStatusFilterChange:ge=>{R(ge),$(new Set)},onPostSortChange:D,selectedPostKeys:O,postBulkPanelOpen:Ae,onTogglePostSelect:ht,onSelectAllPosts:ge=>$(new Set(ge)),onClearPostSelection:()=>$(new Set),onExitPostSelection:B,onBulkDeletePosts:()=>ce({kind:"blog-bulk",keys:[...O],count:O.size}),selection:v,onSelect:U,onCreate:()=>{x==="pages"?Fe():x==="redirects"?_t():au(x)&&wt(x)},onDuplicatePage:dt,onRenamePage:et,onAddPageVariant:nt,onDeletePage:ge=>ce({kind:"page",key:ge.key,label:ge.name}),onEditPageSeo:ge=>{const Ee={collection:"pages",key:ge.key,path:ge.path};_(Ee),L(ge.key)},onViewPageJson:ge=>G(ge.key),onDuplicateSection:Ze,onRenameSection:ge=>de(ge.key),onDeleteSection:ge=>ce({kind:"section",key:ge.key,label:ge.name}),onDeleteRedirect:ge=>ce({kind:"redirect",key:ge.key,label:ge.from||ge.key}),onDuplicateBlog:At,onDeleteBlog:ge=>ce({kind:"blog",blogKind:ge.kind,key:ge.key,label:ge.label})}),o.jsx(mS,{readOnly:f,virtualMcpId:e,className:"flex-1 min-w-0",children:x==="loaders"||x==="actions"?o.jsx(Bre,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:K,decofile:p,kind:x}):o.jsx(A.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(it,{className:"size-5 text-muted-foreground"})}),children:x==="calendar"?o.jsx(Roe,{decofile:p}):x==="post-schedule"?o.jsx(Doe,{decofile:p,support:ee,isCreating:Y.isPending,onCreate:ge=>{ze(ge)},onReschedule:(ge,Ee)=>{yt(ge,Ee)},onSelect:ge=>{b("posts"),W("posts"),_({collection:"posts",key:ge}),L(null)}}):x==="site"?_e?o.jsx(ev,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:_e.key,block:p[_e.key],decofile:p,meta:K,title:"Site",excludeFields:["seo"],schemaPending:se(_e.resolveType,["seo"]),previewBaseUrl:n},`site:${_e.key}`):o.jsx(Mo,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):x==="seo"?o.jsx(Eoe,{orgSlug:t,virtualMcpId:e,branch:s,decofile:p,meta:K,target:{kind:"site"},previewBaseUrl:i}):x==="sections"?o.jsx(goe,{selection:v?.collection==="sections"||v?.collection==="available-section"?v:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:K,decofile:p,isCreating:Y.isPending,onCreateAvailable:pe,onSaveReferencedBlock:Me}):Ae?o.jsx(Aoe,{posts:st,categories:Ce,initialSlug:M,isPending:Y.isPending,onApply:(ge,Ee)=>{pt(ge,Ee)},onClose:B},M??"selection"):v&&v.collection!=="available-section"?v.collection==="apps"?o.jsx(ev,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:v.key,block:p[v.key],decofile:p,meta:K,previewBaseUrl:n,schemaPending:se(typeof p[v.key]?.__resolveType=="string"?String(p[v.key].__resolveType):void 0)},`app:${v.key}`):v.collection==="posts"?o.jsx(Noe,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:v.key,block:p[v.key],decofile:p,meta:K,previewBaseUrl:i},`post:${v.key}`):v.collection==="categories"?o.jsx(Toe,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:v.key,block:p[v.key],decofile:p,meta:K,onManagePosts:ft,onOpenPost:ge=>{b("posts"),W("posts"),_({collection:"posts",key:ge}),L(null)},previewBaseUrl:i},`category:${v.key}`):v.collection==="authors"?o.jsx(Voe,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:v.key,block:p[v.key]},`authors:${v.key}`):v.collection==="redirects"?o.jsx(Ioe,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:v.key,block:p[v.key]},`redirect:${v.key}`):o.jsx(Poe,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:v.collection==="pages"?v.path:"/",activePageBlockKey:v.collection==="pages"?v.key:null,activeGlobalBlockKey:v.collection==="sections"?v.key:null,initialEditSeo:v.collection==="pages"&&y===v.key,onExitSeo:()=>L(null)},v.collection==="pages"?`page:${v.key}`:`section:${v.key}`):o.jsx(Mo,{title:`Select ${au(x)?`a ${lu[x]}`:x==="pages"?"a page":x==="apps"?"an app":x==="redirects"?"a redirect":"a section"} to edit`,description:x==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),oe&&o.jsx(rre,{open:!!oe,mode:oe.mode,initialName:oe.initialName,initialPath:oe.initialPath,isPending:Y.isPending,error:ie,templates:ye,validate:gt,onSubmit:rt,onOpenChange:ge=>{ge||(J(null),Z(void 0))}}),he&&o.jsx(ore,{open:!!he,blockKey:he,initialName:Ne.find(ge=>ge.key===he)?.name??he,isPending:Y.isPending,onSubmit:ct,onOpenChange:ge=>{ge||de(null)}}),ue&&o.jsx(Rre,{open:!!ue,onOpenChange:ge=>{ge||G(null)},pageKey:ue,decofile:p,onSave:ge=>Y.mutateAsync({blockKey:ue,data:ge})}),o.jsx(qr,{open:!!ae,onOpenChange:ge=>{!ge&&!bt&&ce(null)},children:o.jsxs(Gr,{children:[o.jsxs(Yr,{children:[o.jsx(Jr,{children:`Delete ${Ft}?`}),o.jsx(Qr,{children:ae?.kind==="section"?`"${ae.label}" will be removed. Pages that still reference it will lose this section.`:ae?.kind==="blog-bulk"?`${ae.count} ${ae.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:ae?`"${ae.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(Xr,{children:[o.jsx(Zr,{disabled:bt,children:"Cancel"}),o.jsx(eo,{onClick:ge=>{ge.preventDefault(),Lt()},disabled:bt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:bt?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function Boe(t){const e=F.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:u,searchQuery:h,onSearchChange:f,postCategoryFilter:m,postAuthorFilter:p,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:v,onPostStatusFilterChange:_,onPostSortChange:y,selectedPostKeys:L,postBulkPanelOpen:w,onTogglePostSelect:S,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:T,selection:N,onSelect:P,onCreate:V,onDuplicatePage:E,onRenamePage:R,onAddPageVariant:I,onDeletePage:D,onEditPageSeo:O,onViewPageJson:$,onDuplicateSection:M,onRenameSection:z,onDeleteSection:B,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:W}=t;let K,Q,X,se,ne,te,ee;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==u||e[6]!==I||e[7]!==T||e[8]!==j||e[9]!==V||e[10]!==W||e[11]!==D||e[12]!==U||e[13]!==B||e[14]!==H||e[15]!==E||e[16]!==M||e[17]!==O||e[18]!==C||e[19]!==v||e[20]!==b||e[21]!==y||e[22]!==_||e[23]!==R||e[24]!==z||e[25]!==f||e[26]!==P||e[27]!==k||e[28]!==S||e[29]!==$||e[30]!==n||e[31]!==p||e[32]!==w||e[33]!==m||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==h||e[38]!==r||e[39]!==L||e[40]!==N){const J=h.toLowerCase(),ie=n.filter(pe=>!J||pe.name.toLowerCase().includes(J)||pe.path.toLowerCase().includes(J)),Z=i.filter(pe=>!J||pe.from.toLowerCase().includes(J)||pe.to.toLowerCase().includes(J)),he=r.filter(pe=>!J||pe.name.toLowerCase().includes(J)||pe.key.toLowerCase().includes(J)||pe.resolveType.toLowerCase().includes(J)),de=l.filter(pe=>!J||pe.title.toLowerCase().includes(J)||pe.resolveType.toLowerCase().includes(J)||(pe.description?.toLowerCase().includes(J)??!1)),ae=Coe(he),ce=a.filter(pe=>!J||pe.title.toLowerCase().includes(J)||pe.app.toLowerCase().includes(J)||pe.vendor.toLowerCase().includes(J)||pe.category.toLowerCase().includes(J)),ue=d.filter(pe=>!J||pe.label.toLowerCase().includes(J)||pe.subtitle.toLowerCase().includes(J)),G=s==="posts",me=Hoe,ye=G?bk(u):[],we=new Map,Ne=new Map,je={published:0,scheduled:0,draft:0};for(const pe of ye)je[pe.status]=je[pe.status]+1;for(const pe of ye){for(const Me of pe.categorySlugs)we.set(Me,(we.get(Me)??0)+1);for(const Me of pe.authorEmails)Ne.set(Me,(Ne.get(Me)??0)+1)}const _e=(G?Au(u,"categories"):[]).map(pe=>{const{key:Me,payload:Ze}=pe,ct=me(Ze.slug)||Me;return{slug:ct,name:me(Ze.name)||me(Ze.slug)||Me,count:we.get(ct)??0}}).filter(Uoe),Ve=(G?Au(u,"authors"):[]).map(pe=>{const{key:Me,payload:Ze}=pe,ct=me(Ze.email);return{email:ct,name:me(Ze.name)||me(Ze.email)||Me,count:Ne.get(ct)??0}}).filter(Foe);let xe;e[48]!==m?(xe=pe=>!m||pe.categorySlugs.includes(m),e[48]=m,e[49]=xe):xe=e[49];let Se;e[50]!==p?(Se=pe=>!p||pe.authorEmails.includes(p),e[50]=p,e[51]=Se):Se=e[51];let Ce;e[52]!==g?(Ce=pe=>!g||pe.status===g,e[52]=g,e[53]=Ce):Ce=e[53];let Ae;e[54]!==x?(Ae=(pe,Me)=>{if(x==="az")return pe.title.localeCompare(Me.title);if(x==="za")return Me.title.localeCompare(pe.title);const Ze=pe.date.localeCompare(Me.date);return x==="date-asc"?Ze:-Ze},e[54]=x,e[55]=Ae):Ae=e[55];const st=ye.filter(pe=>!J||pe.title.toLowerCase().includes(J)||pe.slug.toLowerCase().includes(J)).filter(xe).filter(Se).filter(Ce).sort(Ae),Be=L.size,Ie=st.map(zoe),Oe=Ie.length>0&&Ie.every(pe=>L.has(pe)),mt=Be>0||w,lt=()=>{Oe?j():k(Ie)},Xe=`Search ${s}…`,nt=au(s)?`Create new ${lu[s]}`:s==="redirects"?"Create new redirect":"Create new page",Fe=s!=="apps"&&s!=="sections";ne="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let dt;e[56]===Symbol.for("react.memo_cache_sentinel")?(dt=o.jsx(Yu,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=dt):dt=e[56];let et;e[57]!==f?(et=pe=>f(pe.target.value),e[57]=f,e[58]=et):et=e[58];let rt;e[59]!==Xe||e[60]!==h||e[61]!==et?(rt=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[dt,o.jsx("input",{type:"text",value:h,onChange:et,placeholder:Xe,"aria-label":Xe,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=Xe,e[60]=h,e[61]=et,e[62]=rt):rt=e[62];let gt;e[63]!==nt||e[64]!==V||e[65]!==Fe?(gt=Fe&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",onClick:V,"aria-label":nt,children:o.jsx(Gt,{size:14})})}),o.jsx(We,{side:"bottom",children:nt})]}),e[63]=nt,e[64]=V,e[65]=Fe,e[66]=gt):gt=e[66],e[67]!==rt||e[68]!==gt?(te=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[rt,gt]}),e[67]=rt,e[68]=gt,e[69]=te):te=e[69],ee=G&&(mt?o.jsx(Soe,{count:Be,allSelected:Oe,onToggleSelectAll:lt,onDelete:T,onExit:C}):o.jsx(boe,{categories:_e,authors:Ve,categoryFilter:m,statusCounts:je,authorFilter:p,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:v,onStatusFilterChange:_,onSortChange:y})),K=ia,se="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",Q="flex flex-col gap-1 p-1.5",X=s==="pages"?ie.length===0?o.jsx(hc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):ie.map(pe=>{const Me=N?.collection==="pages"&&N.key===pe.key,Ze=Uw(u,pe.key);return o.jsx(vi,{icon:$o,title:pe.name,subtitle:pe.path,active:Me,variantCount:Ze,onClick:()=>P({collection:"pages",key:pe.key,path:pe.path}),menu:o.jsx(jd,{onDuplicate:()=>E(pe),onRename:()=>R(pe),onAddVariant:()=>I(pe),onEditSeo:()=>O(pe),onViewJson:()=>$(pe),onDelete:()=>D(pe)})},pe.key)}):s==="sections"?he.length===0&&de.length===0?o.jsx(hc,{hasItems:r.length>0||l.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):o.jsxs(o.Fragment,{children:[ae.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Zb,{icon:Wo,label:"Saved sections"}),ae.map(pe=>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:pe.label}),pe.sections.map(Me=>{const Ze=N?.collection==="sections"&&N.key===Me.key;return o.jsx(vi,{icon:Wo,accent:"global",title:Me.name,subtitle:pe.label,active:Ze,onClick:()=>P({collection:"sections",key:Me.key}),menu:o.jsx(jd,{onDuplicate:()=>M(Me),onRename:()=>z(Me),onDelete:()=>B(Me)})},Me.key)})]},pe.label))]}),de.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Zb,{icon:$o,label:"Available sections",className:re(ae.length>0&&"mt-3")}),de.map(pe=>{const Me=N?.collection==="available-section"&&N.resolveType===pe.resolveType,Ze=pe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(vi,{icon:$o,title:pe.title,subtitle:Ze??pe.resolveType,active:Me,onClick:()=>P({collection:"available-section",resolveType:pe.resolveType,title:pe.title})},pe.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(it,{className:"size-4.5 text-muted-foreground"})}):ce.length===0?o.jsx(hc,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ce.map(pe=>{const Me=N?.collection==="apps"&&pe.blockKey!==null&&N.key===pe.blockKey;return o.jsx(vi,{icon:B6,logoUrl:pe.logo,title:pe.title,subtitle:pe.category,active:Me,trailing:pe.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(!pe.installed||!pe.blockKey){ve.message(`${pe.title} is not installed on this site.`);return}P({collection:"apps",key:pe.blockKey})}},pe.id)}):s==="redirects"?Z.length===0?o.jsx(hc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):Z.map(pe=>o.jsx(vi,{icon:A6,title:pe.from||"(no source)",subtitle:`→ ${pe.to||"(no target)"}`,active:N?.collection==="redirects"&&N.key===pe.key,trailing:o.jsx(lre,{type:pe.type}),onClick:()=>P({collection:"redirects",key:pe.key}),menu:o.jsx(jd,{onDelete:()=>U(pe)})},pe.key)):G?st.length===0?o.jsx(hc,{hasItems:ye.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):st.map(pe=>{const Me={key:pe.key,kind:"posts",label:pe.title,subtitle:pe.slug};return o.jsx(vi,{icon:Vi,title:pe.title,subtitle:pe.slug||"no slug",invalid:pe.missing.length>0,invalidReason:`Missing: ${pe.missing.join(", ")}`,active:N?.collection==="posts"&&N.key===pe.key,selectable:!0,selectionActive:mt,selected:L.has(pe.key),onToggleSelect:()=>S(pe.key),onClick:()=>mt?S(pe.key):P({collection:"posts",key:pe.key}),menu:o.jsx(jd,{onDuplicate:()=>H(Me),onDelete:()=>W(Me)})},pe.key)}):ue.length===0?o.jsx(hc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${au(s)?lu[s]:"item"}.`}):ue.map(pe=>{const Me=N?.collection===pe.kind&&N.key===pe.key;return o.jsx(vi,{icon:pe.kind==="posts"?Vi:pe.kind==="authors"?n9:T2,title:pe.label,subtitle:pe.subtitle,active:Me,onClick:()=>P({collection:pe.kind,key:pe.key}),menu:o.jsx(jd,{onDuplicate:()=>H(pe),onDelete:()=>W(pe)})},pe.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=u,e[6]=I,e[7]=T,e[8]=j,e[9]=V,e[10]=W,e[11]=D,e[12]=U,e[13]=B,e[14]=H,e[15]=E,e[16]=M,e[17]=O,e[18]=C,e[19]=v,e[20]=b,e[21]=y,e[22]=_,e[23]=R,e[24]=z,e[25]=f,e[26]=P,e[27]=k,e[28]=S,e[29]=$,e[30]=n,e[31]=p,e[32]=w,e[33]=m,e[34]=x,e[35]=g,e[36]=i,e[37]=h,e[38]=r,e[39]=L,e[40]=N,e[41]=K,e[42]=Q,e[43]=X,e[44]=se,e[45]=ne,e[46]=te,e[47]=ee}else K=e[41],Q=e[42],X=e[43],se=e[44],ne=e[45],te=e[46],ee=e[47];let Y;e[70]!==Q||e[71]!==X?(Y=o.jsx("div",{className:Q,children:X}),e[70]=Q,e[71]=X,e[72]=Y):Y=e[72];let q;e[73]!==K||e[74]!==se||e[75]!==Y?(q=o.jsx(K,{className:se,children:Y}),e[73]=K,e[74]=se,e[75]=Y,e[76]=q):q=e[76];let oe;return e[77]!==ne||e[78]!==te||e[79]!==ee||e[80]!==q?(oe=o.jsxs("div",{className:ne,children:[te,ee,q]}),e[77]=ne,e[78]=te,e[79]=ee,e[80]=q,e[81]=oe):oe=e[81],oe}function zoe(t){return t.key}function Foe(t){return t.email}function Uoe(t){return t.slug}function Hoe(t){return typeof t=="string"?t:""}function Koe(t){const e=F.c(25),{virtualMcpId:s}=t,n=le(),[i,r]=A.useState(!1),l=vs(s),{activeTask:a}=on();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={strict:!1},e[0]=c):c=e[0];const d=nl(c);if(!(jn(l?.metadata)||jn(a?.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(mn,{className:"size-7 text-foreground"})}),e[1]=f):f=e[1];let m;e[2]!==n?(m=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=m):m=e[3];let p;e[4]!==n?(p=n("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=n,e[5]=p):p=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>r(!0),x=o.jsx(mn,{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(fe,{onClick:g,children:[x,b]}),e[10]=b,e[11]=v):v=e[11];let _;e[12]!==m||e[13]!==p||e[14]!==v?(_=o.jsx(Ci,{className:"h-full",image:f,title:m,description:p,actions:v}),e[12]=m,e[13]=p,e[14]=v,e[15]=_):_=e[15];let y;e[16]!==i?(y=o.jsx(Ju,{open:i,onOpenChange:r,mode:"agent"}),e[16]=i,e[17]=y):y=e[17];let L;return e[18]!==y||e[19]!==_?(L=o.jsxs(o.Fragment,{children:[_,y]}),e[18]=y,e[19]=_,e[20]=L):L=e[20],L}let h;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(h=o.jsx(Moe,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=h):h=e[24],h}function Woe(){const t=F.c(3),[e,s]=A.useState(-1);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l=>{if(!l)return;const a=()=>s(l.clientWidth);a();const c=new ResizeObserver(a);return c.observe(l),()=>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 qoe(t){const e=F.c(6),{virtualMcpId:s}=t,n=vs(s),i=X6();let r;e[0]!==i||e[1]!==n?(r=zu(i,Q2(n)),e[0]=i,e[1]=n,e[2]=r):r=e[2];const l=r;if(!l){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Goe,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=o.jsx(Qoe,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function Goe(){const t=F.c(12),e=le();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(J2,{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 l;t[7]!==r?(l=o.jsx("p",{className:"mt-1 max-w-sm text-xs text-muted-foreground",children:r}),t[7]=r,t[8]=l):l=t[8];let a;return t[9]!==i||t[10]!==l?(a=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,l]})]}),t[9]=i,t[10]=l,t[11]=a):a=t[11],a}function Yoe(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function Joe(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function Qoe(t){const e=F.c(99),{config:s}=t,n=le(),[i,r]=A.useState(""),l=l9(i,300);let a;e[0]!==s.id||e[1]!==l?(a={configId:s.id,search:l},e[0]=s.id,e[1]=l,e[2]=a):a=e[2];const c=MS(a),d=D9(),[u,h]=A.useState(!1),[f,m]=A.useState(null),p=A.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 B=[];for(const U of z)try{await d.mutateAsync({configId:s.id,file:U})}catch(H){const W=H;B.push(`${U.name} (${W instanceof Error?W.message:"upload failed"})`)}await c.refetch(),B.length>0&&ve.error(B.length===z.length?n("filePicker.filePickerDialog.uploadFailedAll",{errors:B.join("; ")}):n("filePicker.filePickerDialog.uploadFailedSome",{errors:B.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(),h(!0)},e[8]=b):b=e[8];const v=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){h(!1)},e[9]=_):_=e[9];const y=_;let L;e[10]!==x?(L=function(M){M.preventDefault(),M.stopPropagation(),h(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=L):L=e[11];const w=L,[S,k]=Woe();let j,C,T,N,P,V;if(e[12]!==s.name||e[13]!==l||e[14]!==k||e[15]!==S||e[16]!==x||e[17]!==u||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(Xoe),z=Joe(M,Yoe(S)),B=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;P="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 Q;e[38]!==K?(Q=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:K}),e[38]=K,e[39]=Q):Q=e[39];let X;e[40]!==W||e[41]!==Q?(X=o.jsxs("div",{className:"min-w-0",children:[W,Q]}),e[40]=W,e[41]=Q,e[42]=X):X=e[42];let se;e[43]===Symbol.for("react.memo_cache_sentinel")?(se=()=>p.current?.click(),e[43]=se):se=e[43];let ne;e[44]!==d.isPending?(ne=d.isPending?o.jsx(it,{className:"size-3.5"}):o.jsx(Yn,{size:14}),e[44]=d.isPending,e[45]=ne):ne=e[45];let te;e[46]!==n||e[47]!==d.isPending?(te=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=te):te=e[48];let ee;e[49]!==ne||e[50]!==te||e[51]!==d.isPending?(ee=o.jsxs(fe,{type:"button",size:"sm",disabled:d.isPending,onClick:se,children:[ne,te]}),e[49]=ne,e[50]=te,e[51]=d.isPending,e[52]=ee):ee=e[52];let Y;e[53]!==x?(Y=o.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:ue=>{const G=Array.from(ue.target.files??[]);ue.target.value="",x(G)}}),e[53]=x,e[54]=Y):Y=e[54],e[55]!==X||e[56]!==ee||e[57]!==Y?(V=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[X,ee,Y]}),e[55]=X,e[56]=ee,e[57]=Y,e[58]=V):V=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(s9,{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=()=>p.current?.click(),e[65]=oe):oe=e[65];const J=u&&"border-primary bg-primary/5",ie=d.isPending&&"pointer-events-none opacity-60";let Z;e[66]!==J||e[67]!==ie?(Z=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",J,ie),e[66]=J,e[67]=ie,e[68]=Z):Z=e[68];let he;e[69]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx(Yn,{size:16,className:"text-muted-foreground"}),e[69]=he):he=e[69];let de;e[70]!==n?(de=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=de):de=e[71];let ae;e[72]!==n?(ae=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=ae):ae=e[73];let ce;e[74]!==de||e[75]!==ae?(ce=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[de," ",ae]}),e[74]=de,e[75]=ae,e[76]=ce):ce=e[76],e[77]!==w||e[78]!==Z||e[79]!==ce?(C=o.jsxs("button",{type:"button",onClick:oe,onDragOver:v,onDragLeave:y,onDrop:w,className:Z,children:[he,ce]}),e[77]=w,e[78]=Z,e[79]=ce,e[80]=C):C=e[80],T="min-h-0 flex-1 overflow-y-auto pr-1",N=M.length===0?B?o.jsx(nv,{title:n("filePicker.filePickerDialog.noMatches",{query:B}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(nv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:z.map((ue,G)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:ue.map(me=>o.jsx(Zoe,{item:me,onDelete:()=>m(me)},me.key))},G))}),e[12]=s.name,e[13]=l,e[14]=k,e[15]=S,e[16]=x,e[17]=u,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]=T,e[28]=N,e[29]=P,e[30]=V}else j=e[25],C=e[26],T=e[27],N=e[28],P=e[29],V=e[30];let E;e[81]!==c||e[82]!==n?(E=c.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(fe,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(it,{className:"size-3.5"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})}),e[81]=c,e[82]=n,e[83]=E):E=e[83];let R;e[84]!==E||e[85]!==T||e[86]!==N?(R=o.jsxs("div",{className:T,children:[N,E]}),e[84]=E,e[85]=T,e[86]=N,e[87]=R):R=e[87];let I;e[88]===Symbol.for("react.memo_cache_sentinel")?(I=()=>m(null),e[88]=I):I=e[88];let D;e[89]!==s.id||e[90]!==f?(D=o.jsx(sle,{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]!==R||e[95]!==D||e[96]!==P||e[97]!==V?(O=o.jsxs("div",{className:P,children:[V,j,C,R,D]}),e[92]=j,e[93]=C,e[94]=R,e[95]=D,e[96]=P,e[97]=V,e[98]=O):O=e[98],O}function Xoe(t){return t.items}function nv(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(ki,{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 l;e[3]!==n?(l=o.jsx("p",{className:"text-xs text-muted-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==l?(a=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,l]}),e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Zoe(t){const e=F.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=OS(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let l;e[2]!==s.key?(l=U3(s.key),e[2]=s.key,e[3]=l):l=e[3];const a=l;let c;e[4]!==a||e[5]!==s.key||e[6]!==s.publicUrl?(c=a?o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"block h-auto w-full",onError:ele}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(Vi,{size:28,className:"text-muted-foreground"})}),e[4]=a,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 u=s.key;let h;e[12]!==s.key?(h=bf(s.key),e[12]=s.key,e[13]=h):h=e[13];let f;e[14]!==s.key||e[15]!==h?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:u,children:h}),e[14]=s.key,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==s.size?(m=$S(s.size),e[17]=s.size,e[18]=m):m=e[18];let p;e[19]!==r||e[20]!==m?(p=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",m]}),e[19]=r,e[20]=m,e[21]=p):p=e[21];let g;e[22]!==f||e[23]!==p?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,p]}),e[22]=f,e[23]=p,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(tle,{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 ele(t){t.target.style.display="none"}function tle(t){const e=F.c(36),{item:s,onDelete:n}=t,i=le(),[r,l]=A.useState(!1);let a;e[0]!==s.publicUrl||e[1]!==i?(a=async function(){try{await navigator.clipboard.writeText(s.publicUrl),l(!0),window.setTimeout(()=>l(!1),1500)}catch{ve.error(i("filePicker.filePickerDialog.failedToCopyUrl"))}},e[0]=s.publicUrl,e[1]=i,e[2]=a):a=e[2];const c=a;let d;e[3]!==i?(d=i("filePicker.filePickerDialog.assetActions"),e[3]=i,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(o9,{size:14}),e[5]=u):u=e[5];let h;e[6]!==d?(h=o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:u})}),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==r?(f=r?o.jsx($t,{size:14}):o.jsx(hn,{size:14}),e[8]=r,e[9]=f):f=e[9];let m;e[10]!==r||e[11]!==i?(m=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=m):m=e[12];let p;e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs(Je,{onClick:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(fn,{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(Je,{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 _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(nn,{size:14}),e[23]=_):_=e[23];let y;e[24]!==i?(y=i("assets.browser.deleteAction"),e[24]=i,e[25]=y):y=e[25];let L;e[26]!==n||e[27]!==y?(L=o.jsxs(Je,{variant:"destructive",onClick:n,children:[_,y]}),e[26]=n,e[27]=y,e[28]=L):L=e[28];let w;e[29]!==v||e[30]!==L||e[31]!==p?(w=o.jsxs(Kt,{align:"end",children:[p,v,L]}),e[29]=v,e[30]=L,e[31]=p,e[32]=w):w=e[32];let S;return e[33]!==w||e[34]!==h?(S=o.jsxs(Ut,{children:[h,w]}),e[33]=w,e[34]=h,e[35]=S):S=e[35],S}function sle(t){const e=F.c(47),{configId:s,item:n,onClose:i}=t,r=le(),l=mse();let a;e[0]!==s||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==r?(a=async function(){if(n)try{await l.mutateAsync({configId:s,key:n.key}),ve.success(r("assets.browser.deleted")),i()}catch{ve.error(r("assets.browser.deleteFailed"))}},e[0]=s,e[1]=l,e[2]=n,e[3]=i,e[4]=r,e[5]=a):a=e[5];const c=a,d=!!n;let u;e[6]!==i?(u=N=>!N&&i(),e[6]=i,e[7]=u):u=e[7];let h;e[8]!==r?(h=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=h):h=e[9];let f;e[10]!==h?(f=o.jsx(Jr,{children:h}),e[10]=h,e[11]=f):f=e[11];let m;e[12]!==n||e[13]!==r?(m=r("assets.browser.deleteConfirmDescription",{name:n?bf(n.key):""}),e[12]=n,e[13]=r,e[14]=m):m=e[14];let p;e[15]!==m?(p=o.jsx(Qr,{children:m}),e[15]=m,e[16]=p):p=e[16];let g;e[17]!==f||e[18]!==p?(g=o.jsxs(Yr,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=g):g=e[19];const x=l.isPending;let b;e[20]!==r?(b=r("assets.browser.deleteCancel"),e[20]=r,e[21]=b):b=e[21];let v;e[22]!==l.isPending||e[23]!==b?(v=o.jsx(Zr,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=v):v=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=re(Wy({variant:"destructive"})),e[25]=_):_=e[25];const y=l.isPending;let L;e[26]!==c?(L=N=>{N.preventDefault(),c()},e[26]=c,e[27]=L):L=e[27];let w;e[28]!==l.isPending?(w=l.isPending?o.jsx(it,{className:"size-3.5"}):null,e[28]=l.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]!==l.isPending||e[33]!==L||e[34]!==w||e[35]!==S?(k=o.jsxs(eo,{className:_,disabled:y,onClick:L,children:[w,S]}),e[32]=l.isPending,e[33]=L,e[34]=w,e[35]=S,e[36]=k):k=e[36];let j;e[37]!==v||e[38]!==k?(j=o.jsxs(Xr,{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(Gr,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let T;return e[43]!==C||e[44]!==d||e[45]!==u?(T=o.jsx(qr,{open:d,onOpenChange:u,children:C}),e[43]=C,e[44]=d,e[45]=u,e[46]=T):T=e[46],T}const z1={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:ea},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Kr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:g6}},nle=["fast","smart","thinking"];function ile(t){const e=F.c(19),{tier:s,onSelect:n}=t,i=le(),[r,l]=A.useState(!1),a=z1[s].icon;let c;e[0]!==a?(c=o.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=c):c=e[1];const d=z1[s];let u;e[2]!==i||e[3]!==d.labelKey?(u=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=u):u=e[4];let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(bs,{size:14,className:"text-muted-foreground"}),e[5]=h):h=e[5];let f;e[6]!==c||e[7]!==u?(f=o.jsx(os,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,u,h]})}),e[6]=c,e[7]=u,e[8]=f):f=e[8];let m;e[9]!==n||e[10]!==i||e[11]!==s?(m=nle.map(x=>{const b=z1[x],v=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),l(!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($t,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;e[13]!==m?(p=o.jsx(as,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:m})}),e[13]=m,e[14]=p):p=e[14];let g;return e[15]!==r||e[16]!==f||e[17]!==p?(g=o.jsxs(cs,{open:r,onOpenChange:l,children:[f,p]}),e[15]=r,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function rle(t){const e=F.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,l=le(),[a,c]=A.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let u;e[2]!==d?(u=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=u):u=e[3];let h;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(h=a?o.jsx(A.Suspense,{fallback:o.jsx(fe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:o.jsx(ole,{override:i,onOverrideChange:r})}):o.jsx(ile,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=h):h=e[10];let f;e[11]!==r?(f=v=>{c(v),v||r(null)},e[11]=r,e[12]=f):f=e[12];let m;e[13]!==f||e[14]!==a?(m=o.jsx(Ti,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=m):m=e[15];let p;e[16]!==l?(p=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==p?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20];let x;e[21]!==h||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[h,g]}),e[21]=h,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==u||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[u,x]}),e[24]=u,e[25]=x,e[26]=b):b=e[26],b}function ole(t){const e=F.c(25),{override:s,onOverrideChange:n}=t,i=le(),r=Qf(),l=r[0]?.id??null;let a;e[0]!==l||e[1]!==r||e[2]!==s?.credentialId?(a=r.some(b=>b.id===s?.credentialId)?s?.credentialId??null:l,e[0]=l,e[1]=r,e[2]=s?.credentialId,e[3]=a):a=e[3];const[c,d]=A.useState(a);let u;e[4]!==c||e[5]!==l||e[6]!==r?(u=r.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=r,e[7]=u):u=e[7];const h=u;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 m=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 p;e[15]!==i?(p=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=p):p=e[16];let g;e[17]!==h||e[18]!==n?(g=b=>{const v=b.keyId??h??"";d(v),n({modelId:b.modelId,credentialId:v,title:b.title??b.modelId})},e[17]=h,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==h||e[21]!==m||e[22]!==p||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(XT,{variant:"bordered",placeholder:p,model:m,credentialId:h,onCredentialChange:d,onModelChange:g})}),e[20]=h,e[21]=m,e[22]=p,e[23]=g,e[24]=x):x=e[24],x}const wk=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:ig,tools:[{name:"web_search",titleKey:"automations.automationConfig.toolWebSearch",descriptionKey:"automations.automationConfig.toolWebSearchDesc",icon:zn},{name:"generate_image",titleKey:"automations.automationConfig.toolGenerateImage",descriptionKey:"automations.automationConfig.toolGenerateImageDesc",icon:ki},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:nr},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:Bu}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:Go,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:Wf},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:r9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:j2},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:_u},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:Go},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:pT}]},{key:"context",headingKey:"automations.automationConfig.context",icon:El,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:El},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Ec},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Ec}]}],lle=wk.flatMap(t=>t.tools.map(e=>e.name));function ale(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function cle(t){const e=F.c(12),{agentId:s,value:n,onChange:i}=t,r=le();let l;e[0]!==r?(l=r("automations.automationConfig.toolsLabel"),e[0]=r,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s||e[5]!==i||e[6]!==r||e[7]!==n?(c=s?o.jsx(A.Suspense,{fallback:o.jsxs(fe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(ig,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(dle,{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]!==a||e[10]!==c?(d=o.jsxs("div",{className:"flex flex-col gap-2",children:[a,c]}),e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function iv(t){const e=F.c(17),{value:s,checked:n,onToggle:i,title:r,description:l,leading:a}=t;let c;e[0]!==n?(c=o.jsx(Xc,{checked:n,className:"pointer-events-none mt-0.5"}),e[0]=n,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&o.jsx("span",{className:"mt-px shrink-0",children:a}),e[2]=a,e[3]=d):d=e[3];let u;e[4]!==r?(u=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=u):u=e[5];let h;e[6]!==l?(h=l&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=h):h=e[7];let f;e[8]!==u||e[9]!==h?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[u,h]}),e[8]=u,e[9]=h,e[10]=f):f=e[10];let m;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(m=o.jsxs(ls,{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]=m):m=e[16],m}function rv(t){const e=F.c(27),{conn:s,label:n,icon:i,on:r,total:l,onToggle:a}=t,c=le(),d=r===l;let u;e[0]!==i||e[1]!==s?(u=s?o.jsx(ro,{icon:s.icon,name:s.title,size:"2xs"}):i?o.jsx(i,{size:14,className:"text-muted-foreground"}):o.jsx(aP,{size:14,className:"text-muted-foreground"}),e[0]=i,e[1]=s,e[2]=u):u=e[2];let h;e[3]!==s?.title||e[4]!==n||e[5]!==c?(h=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=h):h=e[6];let f;e[7]!==h?(f=o.jsx("span",{className:"truncate",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==r||e[10]!==l?(m=o.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[r,"/",l]}),e[9]=r,e[10]=l,e[11]=m):m=e[11];let p;e[12]!==a?(p=_=>{_.stopPropagation(),a()},e[12]=a,e[13]=p):p=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]!==p||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:p,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==m||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=b):b=e[22];let v;return e[23]!==u||e[24]!==f||e[25]!==b?(v=o.jsxs("div",{className:"flex items-center gap-2",children:[u,f,b]}),e[23]=u,e[24]=f,e[25]=b,e[26]=v):v=e[26],v}function dle(t){const e=F.c(83),{agentId:s,value:n,onChange:i}=t,r=le(),{org:l}=He(),[a,c]=A.useState(!1);let d;e[0]!==s||e[1]!==l.id||e[2]!==l.slug?(d={connectionId:s,orgId:l.id,orgSlug:l.slug},e[0]=s,e[1]=l.id,e[2]=l.slug,e[3]=d):d=e[3];const u=Cs(d);let h;e[4]!==u?(h={client:u},e[4]=u,e[5]=h):h=e[5];const{data:f,isLoading:m}=f6(h),p=Ni();let g,x,b,v,_,y,L,w,S,k,j,C,T;if(e[6]!==p||e[7]!==f?.tools||e[8]!==m||e[9]!==i||e[10]!==a||e[11]!==r||e[12]!==n){const R=new Map(p.map(ple)),I=new Map;for(const ae of f?.tools??[]){const ce=Ur(ae._meta)??"__other__",ue=Iu(ae.name,ce==="__other__"?void 0:ce),G=ae.title,me=G&&G!==ae.name?G:ale(ue);I.has(ce)||I.set(ce,{clientId:ce,conn:R.get(ce),tools:[]}),I.get(ce).tools.push({name:ae.name,display:me,description:ae.description})}const D=[...I.values()].sort(mle),O=(f?.tools??[]).map(fle),$=[...lle,...O],M=n===null?new Set($):new Set(n),z=$.every(ae=>M.has(ae)),B=ae=>i($.every(ce=>ae.has(ce))?null:[...ae]),U=ae=>{const ce=new Set(M);ce.has(ae)?ce.delete(ae):ce.add(ae),B(ce)},H=(ae,ce)=>{const ue=new Set(M);for(const G of ae)ce?ue.add(G):ue.delete(G);B(ue)};v=cs,T=a,_=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(ig,{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 Q=!z&&o.jsxs(yP,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",$.length]});let X;e[30]===Symbol.for("react.memo_cache_sentinel")?(X=o.jsx(bs,{size:14,className:"text-muted-foreground"}),e[30]=X):X=e[30],e[31]!==K||e[32]!==Q?(y=o.jsx(os,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,K,Q,X]})}),e[31]=K,e[32]=Q,e[33]=y):y=e[33],b=as,j="p-0 w-80",C="start",x=Ii;let se;e[34]!==r?(se=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=se):se=e[35],e[36]!==se?(S=o.jsx(di,{placeholder:se}),e[36]=se,e[37]=S):S=e[37];const ne=z?r("automations.automationConfig.allToolsEnabled",{count:$.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:$.length});let te;e[38]!==ne?(te=o.jsx("span",{className:"text-xs text-muted-foreground",children:ne}),e[38]=ne,e[39]=te):te=e[39];let ee;e[40]!==i?(ee=()=>i(null),e[40]=i,e[41]=ee):ee=e[41];let Y;e[42]!==r?(Y=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=Y):Y=e[43];let q;e[44]!==z||e[45]!==ee||e[46]!==Y?(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:Y}),e[44]=z,e[45]=ee,e[46]=Y,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 J;e[49]!==i?(J=()=>i([]),e[49]=i,e[50]=J):J=e[50];const ie=M.size===0;let Z;e[51]!==r?(Z=r("automations.automationConfig.clear"),e[51]=r,e[52]=Z):Z=e[52];let he;e[53]!==J||e[54]!==ie||e[55]!==Z?(he=o.jsx("button",{type:"button",onClick:J,disabled:ie,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:Z}),e[53]=J,e[54]=ie,e[55]=Z,e[56]=he):he=e[56];let de;e[57]!==q||e[58]!==he?(de=o.jsxs("div",{className:"flex items-center gap-2",children:[q,oe,he]}),e[57]=q,e[58]=he,e[59]=de):de=e[59],e[60]!==te||e[61]!==de?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[te,de]}),e[60]=te,e[61]=de,e[62]=k):k=e[62],g=ui,L="max-h-80",w=m?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($n,{children:r("automations.automationConfig.noToolsFound")}),wk.map(ae=>{const ce=ae.tools.map(hle),ue=ce.filter(G=>M.has(G)).length;return o.jsx(Ps,{heading:o.jsx(rv,{label:r(ae.headingKey),icon:ae.icon,on:ue,total:ce.length,onToggle:()=>H(ce,ue!==ce.length)}),children:ae.tools.map(G=>o.jsx(iv,{value:`${r(G.titleKey)} ${G.name}`,checked:M.has(G.name),onToggle:()=>U(G.name),title:r(G.titleKey),description:r(G.descriptionKey),leading:o.jsx(G.icon,{size:16,className:"text-muted-foreground"})},G.name))},ae.key)}),D.map(ae=>{const ce=ae.tools.map(ule),ue=ce.filter(G=>M.has(G)).length;return o.jsx(Ps,{heading:o.jsx(rv,{conn:ae.conn,on:ue,total:ce.length,onToggle:()=>H(ce,ue!==ce.length)}),children:ae.tools.map(G=>o.jsx(iv,{value:`${G.display} ${G.name} ${ae.conn?.title??""}`,checked:M.has(G.name),onToggle:()=>U(G.name),title:G.display,description:G.description},G.name))},ae.clientId)})]}),e[6]=p,e[7]=f?.tools,e[8]=m,e[9]=i,e[10]=a,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=v,e[17]=_,e[18]=y,e[19]=L,e[20]=w,e[21]=S,e[22]=k,e[23]=j,e[24]=C,e[25]=T}else g=e[13],x=e[14],b=e[15],v=e[16],_=e[17],y=e[18],L=e[19],w=e[20],S=e[21],k=e[22],j=e[23],C=e[24],T=e[25];let N;e[63]!==g||e[64]!==L||e[65]!==w?(N=o.jsx(g,{className:L,children:w}),e[63]=g,e[64]=L,e[65]=w,e[66]=N):N=e[66];let P;e[67]!==x||e[68]!==N||e[69]!==S||e[70]!==k?(P=o.jsxs(x,{children:[S,k,N]}),e[67]=x,e[68]=N,e[69]=S,e[70]=k,e[71]=P):P=e[71];let V;e[72]!==b||e[73]!==P||e[74]!==j||e[75]!==C?(V=o.jsx(b,{className:j,align:C,children:P}),e[72]=b,e[73]=P,e[74]=j,e[75]=C,e[76]=V):V=e[76];let E;return e[77]!==v||e[78]!==_||e[79]!==y||e[80]!==V||e[81]!==T?(E=o.jsxs(v,{open:T,onOpenChange:_,children:[y,V]}),e[77]=v,e[78]=_,e[79]=y,e[80]=V,e[81]=T,e[82]=E):E=e[82],E}function ule(t){return t.name}function hle(t){return t.name}function fle(t){return t.name}function mle(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function ple(t){return[t.id,t]}function cu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function gle(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 a=parseInt(i[1]??"1");return a%7===0?`Every ${a/7} weeks`:`Every ${a} days`}const r=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(r){const a=(r[2]??"0").padStart(2,"0"),c=(r[1]??"0").padStart(2,"0");return`Every day at ${a}:${c} UTC`}const l=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(l){const c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(l[3]??"0")]??"day",d=(l[2]??"0").padStart(2,"0"),u=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${u} UTC`}return t}function xle(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 ble(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 vle(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const yle=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function _le({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const l=le(),{triggerAdd:a}=Xu(),[c,d]=A.useState(!1),u=e??c,h=p=>{s?s(p):d(p)},f=async p=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:p}),ve.success(l("automations.addStarterPopover.starterAdded")),h(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");ve.error(x)}},m=async()=>{try{const p=await a.mutateAsync({automation_id:t,type:"webhook"});h(!1),p.webhook?r?.(p.webhook):ve.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(p){const g=p instanceof Error?p.message:l("automations.addStarterPopover.failedAddWebhookStarter");ve.error(g)}};return o.jsxs(Ut,{open:u,onOpenChange:h,children:[o.jsx(Ht,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",children:[o.jsx(Gt,{size:14}),l("automations.addStarterPopover.addStarter")]})}),o.jsxs(Kt,{align:"end",className:"w-[200px]",children:[o.jsxs(er,{children:[o.jsxs(tr,{className:"gap-2.5",children:[o.jsx(Jd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),o.jsx(sr,{className:"w-[160px]",children:yle.map(p=>o.jsxs(Je,{className:"gap-2.5",onSelect:()=>f(p.cron),disabled:a.isPending,children:[o.jsx(Jd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:p.label})]},p.cron))})]}),o.jsxs(Je,{className:"gap-2.5",onSelect:()=>{h(!1),n?.()},children:[o.jsx(Jd,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),o.jsxs(Je,{className:"gap-2.5",onSelect:()=>{h(!1),i?.()},children:[o.jsx(hr,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),o.jsxs(Je,{className:"gap-2.5",onSelect:()=>{m()},disabled:a.isPending,children:[o.jsx(zn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function Sk(t){const e=F.c(39),{open:s,onOpenChange:n,url:i,token:r,title:l,description:a}=t,c=l===void 0?"Webhook ready":l,d=a===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":a,u=le(),[h,f]=A.useState(null),[m,p]=A.useState("curl"),[g,x]=A.useState("header"),b=A.useId();let v;e[0]!==u?(v=async(D,O)=>{try{await navigator.clipboard.writeText(D),f(O),ve.success(u("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ve.error(u("automations.webhookSecretDialog.failedCopy"))}},e[0]=u,e[1]=v):v=e[1];const _=v;let y;e[2]!==g||e[3]!==r||e[4]!==i?(y=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=y):y=e[5];const L=y,w=i&&r?g==="header"?`curl -X POST "${L}" \\
628
628
  -H "Authorization: Bearer ${r}" \\
629
629
  -H "Content-Type: application/json" \\
630
630
  -d '{"hello":"world"}'`:`curl -X POST "${L}" \\
@@ -643,7 +643,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
643
643
  },
644
644
  body: JSON.stringify({ hello: "world" }),
645
645
  });`:"",k=m==="curl"?w:S;let j;e[6]!==c?(j=o.jsx(qt,{children:c}),e[6]=c,e[7]=j):j=e[7];let C;e[8]!==d?(C=o.jsx(Nn,{children:d}),e[8]=d,e[9]=C):C=e[9];let T;e[10]!==j||e[11]!==C?(T=o.jsxs(ds,{children:[j,C]}),e[10]=j,e[11]=C,e[12]=T):T=e[12];let N;e[13]!==g||e[14]!==h||e[15]!==_||e[16]!==L||e[17]!==m||e[18]!==k||e[19]!==u||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:u("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:L}),o.jsxs(fe,{size:"sm",variant:"outline",onClick:()=>_(L,"url"),children:[o.jsx(hn,{size:13}),u(h==="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:u("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(fe,{size:"sm",variant:"outline",onClick:()=>_(r,"token"),children:[o.jsx(hn,{size:13}),u(h==="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:u("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(na,{value:m,onValueChange:D=>p(D),children:o.jsxs(Jc,{className:"h-8 p-[2px]",children:[o.jsx(ii,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),o.jsx(ii,{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(Xc,{id:b,checked:g==="url",onCheckedChange:D=>x(D?"url":"header")}),u("automations.webhookSecretDialog.tokenInUrl")]})]}),o.jsxs(fe,{size:"sm",variant:"outline",onClick:()=>_(k,"example"),children:[o.jsx(hn,{size:13}),u(h==="example"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]}),o.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:o.jsx(td,{code:k,language:m==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[13]=g,e[14]=h,e[15]=_,e[16]=L,e[17]=m,e[18]=k,e[19]=u,e[20]=r,e[21]=b,e[22]=i,e[23]=N):N=e[23];let P;e[24]!==n?(P=()=>n(!1),e[24]=n,e[25]=P):P=e[25];let V;e[26]!==u?(V=u("automations.webhookSecretDialog.done"),e[26]=u,e[27]=V):V=e[27];let E;e[28]!==V||e[29]!==P?(E=o.jsx(Gn,{children:o.jsx(fe,{onClick:P,children:V})}),e[28]=V,e[29]=P,e[30]=E):E=e[30];let R;e[31]!==E||e[32]!==T||e[33]!==N?(R=o.jsxs(Bt,{className:"max-w-lg",children:[T,N,E]}),e[31]=E,e[32]=T,e[33]=N,e[34]=R):R=e[34];let I;return e[35]!==n||e[36]!==s||e[37]!==R?(I=o.jsx(zt,{open:s,onOpenChange:n,children:R}),e[35]=n,e[36]=s,e[37]=R,e[38]=I):I=e[38],I}function Lle(t){const e=F.c(137),{trigger:s,automationId:n,connectionName:i}=t,r=le(),{triggerAdd:l,triggerRemove:a,triggerRotateToken:c}=Xu(),[d,u]=A.useState(!1),[h,f]=A.useState(!1),[m,p]=A.useState(null);let g;e[0]!==s.cron_expression?(g=s.cron_expression?ble(s.cron_expression):null,e[0]=s.cron_expression,e[1]=g):g=e[1];const x=g,[b,v]=A.useState(x?.count??1),[_,y]=A.useState(!1),[L,w]=A.useState(s.cron_expression??""),S=a.isPending||l.isPending||c.isPending,k=s.type==="cron",j=s.type==="webhook";let C;e[2]!==n||e[3]!==a||e[4]!==r||e[5]!==s.id?(C=async()=>{try{await a.mutateAsync({trigger_id:s.id,automation_id:n}),ve.success(r("automations.triggerCard.starterRemoved"))}catch{ve.error(r("automations.triggerCard.failedToRemoveStarter"))}u(!1)},e[2]=n,e[3]=a,e[4]=r,e[5]=s.id,e[6]=C):C=e[6];const T=C;let N;e[7]!==l||e[8]!==n||e[9]!==a||e[10]!==s.id?(N=async Oe=>{await l.mutateAsync({automation_id:n,type:"cron",cron_expression:Oe}),await a.mutateAsync({trigger_id:s.id,automation_id:n})},e[7]=l,e[8]=n,e[9]=a,e[10]=s.id,e[11]=N):N=e[11];const P=N;let V;e[12]!==L||e[13]!==P||e[14]!==r||e[15]!==s.cron_expression?(V=async()=>{const Oe=L.trim();if(!Oe||!cu(Oe)||Oe===s.cron_expression){y(!1),w(s.cron_expression??"");return}try{await P(Oe),y(!1)}catch{ve.error(r("automations.triggerCard.failedToUpdateStarter")),w(s.cron_expression??""),y(!1)}},e[12]=L,e[13]=P,e[14]=r,e[15]=s.cron_expression,e[16]=V):V=e[16];const E=V;let R;e[17]!==n||e[18]!==c||e[19]!==s.id?(R=async()=>{f(!1);try{const Oe=await c.mutateAsync({trigger_id:s.id,automation_id:n});p({url:Oe.url,token:Oe.token})}catch(Oe){const mt=Oe,lt=mt instanceof Error?mt.message:"Failed to rotate token";ve.error(lt)}},e[17]=n,e[18]=c,e[19]=s.id,e[20]=R):R=e[20];const I=R;let D;e[21]!==x||e[22]!==P||e[23]!==r||e[24]!==s.cron_expression?(D=async Oe=>{if(!x)return;const mt=x.unit==="minutes"?5:1,lt=Math.max(mt,Oe);lt!==Oe&&v(lt);const Xe=xle(lt,x.unit);if(Xe!==s.cron_expression)try{await P(Xe)}catch{ve.error(r("automations.triggerCard.failedToUpdateStarter")),v(x.count)}},e[21]=x,e[22]=P,e[23]=r,e[24]=s.cron_expression,e[25]=D):D=e[25];const O=D;let $;e[26]!==k||e[27]!==j?($=k?o.jsx(Jd,{size:14,className:"text-muted-foreground shrink-0"}):j?o.jsx(zn,{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]=$):$=e[28];let M;e[29]!==i||e[30]!==b||e[31]!==L||e[32]!==O||e[33]!==E||e[34]!==x||e[35]!==k||e[36]!==_||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:Oe=>v(parseInt(Oe.target.value)||1),onBlur:()=>O(b),onKeyDown:Oe=>{Oe.key==="Enter"&&Oe.target.blur(),Oe.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:vle(x.unit,b)})]}):k&&_?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"text",value:L,onChange:Oe=>w(Oe.target.value),onBlur:E,onKeyDown:Oe=>{Oe.key==="Enter"&&Oe.target.blur(),Oe.key==="Escape"&&(y(!1),w(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),L&&!cu(L)&&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?gle(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(wle).join(", ")})]}),e[29]=i,e[30]=b,e[31]=L,e[32]=O,e[33]=E,e[34]=x,e[35]=k,e[36]=_,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(it,{className:"size-[13px] text-muted-foreground"}),e[44]=S,e[45]=z):z=e[45];let B;e[46]!==x||e[47]!==k||e[48]!==_||e[49]!==s.cron_expression?(B=k&&!x&&!_&&o.jsx(fe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{w(s.cron_expression??""),y(!0)},children:o.jsx(r9,{size:13,className:"text-muted-foreground"})}),e[46]=x,e[47]=k,e[48]=_,e[49]=s.cron_expression,e[50]=B):B=e[50];let U;e[51]!==j||e[52]!==r?(U=j&&o.jsx(fe,{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(On,{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(fe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>u(!0),children:o.jsx(ji,{size:13,className:"text-muted-foreground"})}),e[54]=H):H=e[54];let W;e[55]!==B||e[56]!==U||e[57]!==z?(W=o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[z,B,U,H]}),e[55]=B,e[56]=U,e[57]=z,e[58]=W):W=e[58];let K;e[59]!==W||e[60]!==$||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:[$,M,W]}),e[59]=W,e[60]=$,e[61]=M,e[62]=K):K=e[62];let Q;e[63]!==r?(Q=r("automations.triggerCard.removeStarter"),e[63]=r,e[64]=Q):Q=e[64];let X;e[65]!==Q?(X=o.jsx(Jr,{children:Q}),e[65]=Q,e[66]=X):X=e[66];let se;e[67]!==r?(se=r("automations.triggerCard.confirmRemoveStarter"),e[67]=r,e[68]=se):se=e[68];let ne;e[69]!==se?(ne=o.jsx(Qr,{children:se}),e[69]=se,e[70]=ne):ne=e[70];let te;e[71]!==X||e[72]!==ne?(te=o.jsxs(Yr,{children:[X,ne]}),e[71]=X,e[72]=ne,e[73]=te):te=e[73];let ee;e[74]!==r?(ee=r("automations.triggerCard.cancel"),e[74]=r,e[75]=ee):ee=e[75];let Y;e[76]!==ee?(Y=o.jsx(Zr,{children:ee}),e[76]=ee,e[77]=Y):Y=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]!==T||e[81]!==q?(oe=o.jsx(eo,{onClick:T,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q}),e[80]=T,e[81]=q,e[82]=oe):oe=e[82];let J;e[83]!==Y||e[84]!==oe?(J=o.jsxs(Xr,{children:[Y,oe]}),e[83]=Y,e[84]=oe,e[85]=J):J=e[85];let ie;e[86]!==te||e[87]!==J?(ie=o.jsxs(Gr,{children:[te,J]}),e[86]=te,e[87]=J,e[88]=ie):ie=e[88];let Z;e[89]!==d||e[90]!==ie?(Z=o.jsx(qr,{open:d,onOpenChange:u,children:ie}),e[89]=d,e[90]=ie,e[91]=Z):Z=e[91];let he;e[92]!==r?(he=r("automations.triggerCard.rotateWebhookToken"),e[92]=r,e[93]=he):he=e[93];let de;e[94]!==he?(de=o.jsx(Jr,{children:he}),e[94]=he,e[95]=de):de=e[95];let ae;e[96]!==r?(ae=r("automations.triggerCard.rotateWebhookTokenDescription"),e[96]=r,e[97]=ae):ae=e[97];let ce;e[98]!==ae?(ce=o.jsx(Qr,{children:ae}),e[98]=ae,e[99]=ce):ce=e[99];let ue;e[100]!==de||e[101]!==ce?(ue=o.jsxs(Yr,{children:[de,ce]}),e[100]=de,e[101]=ce,e[102]=ue):ue=e[102];let G;e[103]!==r?(G=r("automations.triggerCard.cancel"),e[103]=r,e[104]=G):G=e[104];let me;e[105]!==G?(me=o.jsx(Zr,{children:G}),e[105]=G,e[106]=me):me=e[106];let ye;e[107]!==r?(ye=r("automations.triggerCard.rotate"),e[107]=r,e[108]=ye):ye=e[108];let we;e[109]!==I||e[110]!==ye?(we=o.jsx(eo,{onClick:I,children:ye}),e[109]=I,e[110]=ye,e[111]=we):we=e[111];let Ne;e[112]!==me||e[113]!==we?(Ne=o.jsxs(Xr,{children:[me,we]}),e[112]=me,e[113]=we,e[114]=Ne):Ne=e[114];let je;e[115]!==ue||e[116]!==Ne?(je=o.jsxs(Gr,{children:[ue,Ne]}),e[115]=ue,e[116]=Ne,e[117]=je):je=e[117];let _e;e[118]!==h||e[119]!==je?(_e=o.jsx(qr,{open:h,onOpenChange:f,children:je}),e[118]=h,e[119]=je,e[120]=_e):_e=e[120];const Ve=m!==null;let xe;e[121]===Symbol.for("react.memo_cache_sentinel")?(xe=Oe=>{Oe||p(null)},e[121]=xe):xe=e[121];const Se=m?.url??null,Ce=m?.token??null;let Ae;e[122]!==r?(Ae=r("automations.triggerCard.newWebhookToken"),e[122]=r,e[123]=Ae):Ae=e[123];let st;e[124]!==r?(st=r("automations.triggerCard.newWebhookTokenDescription"),e[124]=r,e[125]=st):st=e[125];let Be;e[126]!==Ve||e[127]!==Se||e[128]!==Ce||e[129]!==Ae||e[130]!==st?(Be=o.jsx(Sk,{open:Ve,onOpenChange:xe,url:Se,token:Ce,title:Ae,description:st}),e[126]=Ve,e[127]=Se,e[128]=Ce,e[129]=Ae,e[130]=st,e[131]=Be):Be=e[131];let Ie;return e[132]!==K||e[133]!==Z||e[134]!==_e||e[135]!==Be?(Ie=o.jsxs(o.Fragment,{children:[K,Z,_e,Be]}),e[132]=K,e[133]=Z,e[134]=_e,e[135]=Be,e[136]=Ie):Ie=e[136],Ie}function wle(t){const[e,s]=t;return`${e}: ${s}`}function Sle(t){const e=F.c(70),{automationId:s,onDone:n}=t,i=le();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const l=Ni(r),[a,c]=A.useState(),[d,u]=A.useState();let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h={},e[1]=h):h=e[1];const[f,m]=A.useState(h),{triggerAdd:p}=Xu(),{data:g,isLoading:x}=_P(a);let b,v,_,y,L,w;if(e[2]!==p||e[3]!==s||e[4]!==a||e[5]!==d||e[6]!==x||e[7]!==n||e[8]!==f||e[9]!==i||e[10]!==l||e[11]!==g){const j=g?.find(z=>z.type===d);let C;e[18]!==p||e[19]!==s||e[20]!==a||e[21]!==d||e[22]!==n||e[23]!==f||e[24]!==i?(C=async()=>{if(!(!a||!d))try{await p.mutateAsync({automation_id:s,type:"event",event_type:d,connection_id:a,params:f}),Ge("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:a,event_type:d}),ve.success(i("automations.eventTriggerForm.successAdded")),n()}catch{ve.error(i("automations.eventTriggerForm.errorFailed"))}},e[18]=p,e[19]=s,e[20]=a,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 T;e[26]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(hr,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=T):T=e[26];let N;e[27]!==i?(N=i("automations.eventTriggerForm.title"),e[27]=i,e[28]=N):N=e[28];let P;e[29]!==N?(P=o.jsx("span",{className:"text-sm font-medium",children:N}),e[29]=N,e[30]=P):P=e[30];let V;e[31]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(ji,{size:13}),e[31]=V):V=e[31];let E;e[32]!==n?(E=o.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:n,children:V}),e[32]=n,e[33]=E):E=e[33],e[34]!==P||e[35]!==E?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[T,P,E]}),e[34]=P,e[35]=E,e[36]=_):_=e[36];const R=a??"";let I;e[37]===Symbol.for("react.memo_cache_sentinel")?(I=z=>{c(z),u(void 0),m({})},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(Ss,{className:"w-full",children:o.jsx(Rs,{placeholder:D})}),e[40]=D,e[41]=O):O=e[41];let $;e[42]!==i||e[43]!==l?($=l.length===0?o.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:i("automations.eventTriggerForm.noConnectionsWithTrigger")}):l.map(Cle),e[42]=i,e[43]=l,e[44]=$):$=e[44];let M;e[45]!==$?(M=o.jsx(ks,{children:$}),e[45]=$,e[46]=M):M=e[46],e[47]!==R||e[48]!==O||e[49]!==M?(y=o.jsxs(ws,{value:R,onValueChange:I,children:[O,M]}),e[47]=R,e[48]=O,e[49]=M,e[50]=y):y=e[50],e[51]!==a||e[52]!==d||e[53]!==x||e[54]!==i||e[55]!==g?(L=a&&o.jsxs(ws,{value:d??"",onValueChange:z=>{u(z),m({})},children:[o.jsx(Ss,{className:"w-full",children:x?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(it,{className:"size-[13px]"}),i("automations.eventTriggerForm.loadingEvents")]}):o.jsx(Rs,{placeholder:i("automations.eventTriggerForm.selectEventTypePlaceholder"),children:d??i("automations.eventTriggerForm.selectEventTypePlaceholder")})}),o.jsx(ks,{children:g?.map(jle)})]}),e[51]=a,e[52]=d,e[53]=x,e[54]=i,e[55]=g,e[56]=L):L=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[B,U]=z;return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("label",{className:"text-xs text-muted-foreground",children:[B,U.description&&o.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",U.description]})]}),U.enum?o.jsxs(ws,{value:f[B]??"",onValueChange:H=>m(W=>({...W,[B]:H})),children:[o.jsx(Ss,{className:"w-full",children:o.jsx(Rs,{placeholder:i("automations.eventTriggerForm.selectParamPlaceholder",{key:B})})}),o.jsx(ks,{children:U.enum.map(kle)})]}):o.jsx("input",{type:"text",value:f[B]??"",onChange:H=>m(W=>({...W,[B]:H.target.value})),placeholder:U.description??B,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},B)})}),e[2]=p,e[3]=s,e[4]=a,e[5]=d,e[6]=x,e[7]=n,e[8]=f,e[9]=i,e[10]=l,e[11]=g,e[12]=b,e[13]=v,e[14]=_,e[15]=y,e[16]=L,e[17]=w}else b=e[12],v=e[13],_=e[14],y=e[15],L=e[16],w=e[17];let S;e[57]!==p||e[58]!==a||e[59]!==d||e[60]!==b||e[61]!==i?(S=a&&d&&o.jsx(fe,{size:"sm",onClick:b,disabled:p.isPending,children:p.isPending?o.jsx(it,{className:"size-[13px]"}):i("automations.eventTriggerForm.addTriggerButton")}),e[57]=p,e[58]=a,e[59]=d,e[60]=b,e[61]=i,e[62]=S):S=e[62];let k;return e[63]!==v||e[64]!==_||e[65]!==y||e[66]!==L||e[67]!==w||e[68]!==S?(k=o.jsxs("div",{className:v,children:[_,y,L,w,S]}),e[63]=v,e[64]=_,e[65]=y,e[66]=L,e[67]=w,e[68]=S,e[69]=k):k=e[69],k}function kle(t){return o.jsx(It,{value:t,children:t},t)}function jle(t){return o.jsx(It,{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 Cle(t){return o.jsx(It,{value:t.id,children:t.title},t.id)}const Nle=30;function Vle(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 Tle({automationId:t,automation:e,onBack:s,onDelete:n}){const i=le(),r=e.virtual_mcp_id,{org:l}=He(),{update:a,triggerAdd:c,run:d}=Xu(),u=Ni(),h=new Map(u.map(q=>[q.id,q.title])),{openTask:f}=on(),{openSidePanel:m}=Zl(),{sendMessage:p}=ai(),g=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[x,b]=A.useState(g),[v,_]=A.useState(!1),[y,L]=A.useState(!1),[w,S]=A.useState(!1),[k,j]=A.useState(""),[C,T]=A.useState(!1),[N,P]=A.useState(null),[V,E]=A.useState(!1),[R,I]=A.useState(!1),[D,O]=A.useState(!1),$=async()=>{if(V)return;const oe=mN(x).filter(J=>J.type==="text").map(J=>J.text).join(`
646
- `);if(oe.trim()){E(!0);try{te(),Ge("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:oe.length}),m(),await p({tiptapDoc:n_({managerAgentId:r6.AUTOMATION_MANAGER(l.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:oe})})}finally{E(!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,B=l2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:z,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=B.watch("active"),[H,W]=A.useReducer(Vle,null),K=()=>{H!==null&&(Ge("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"}))},Q=async()=>{const q=B.control._formState.dirtyFields,oe=Object.keys(q);if(oe.length===0&&!D)return!0;const J=B.getValues(),ie=B.control._defaultValues;B.reset(J,{keepValues:!0});const Z=D;O(!1);const he={tier:J.tier,...J.modelOverride?{modelId:J.modelOverride.modelId,credentialId:J.modelOverride.credentialId,modelTitle:J.modelOverride.title}:{}},de={id:t,name:J.name,active:J.active,models:he,tools:J.tools,maxAgentSteps:J.maxAgentSteps,messages:fN(x),temperature:0};try{await a.mutateAsync(de)}catch{return B.reset(ie,{keepValues:!0}),Z&&O(!0),!1}const ae=[...oe];return Z&&ae.push("messages"),W({type:"accumulate",now:Date.now(),fields:ae}),ne(),!0},{schedule:X,flush:se}=zh({save:Q}),{schedule:ne,flush:te}=zh({delayMs:3e4,save:async()=>K()});A.useEffect(()=>{const q=B.watch(()=>X());return()=>q.unsubscribe()},[]);const ee=q=>{if(b(q),!R){I(!0);return}O(!0),X()},Y=async()=>{Ge("automation_test_clicked",{automation_id:t,agent_id:r});const q=await se();if(te(),!!q){if(!x){ve.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const oe=await d.mutateAsync(t);oe.threadId&&(m(),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(fe,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(qf,{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(xs,{control:B.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(fe,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(nn,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xs,{control:B.control,name:"active",render:({field:q})=>o.jsx(Ti,{checked:q.value,onCheckedChange:oe=>{q.onChange(oe),se()},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(i_,{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(_le,{automationId:t,open:v,onOpenChange:_,onCustomSelect:()=>{S(!0),T(!1),j("")},onEventSelect:()=>{T(!0),S(!1)},onWebhookCreated:q=>{Ge("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),P(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:()=>_(!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(Lle,{trigger:q,automationId:t,connectionName:q.connection_id?h.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(Jd,{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||!cu(q)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:q}),Ge("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ve.success(i("automations.automationDetail.starterAdded")),S(!1),j("")}catch{ve.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async q=>{const oe=k.trim();q.key==="Enter"&&oe&&cu(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&&!cu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(it,{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(ji,{size:13})})]}),C&&o.jsx(A.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(it,{className:"size-[13px] text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(Sle,{automationId:t,onDone:()=>T(!1)})}),o.jsx(Sk,{open:N!==null,onOpenChange:q=>{q||P(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(fe,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:V||!x,onClick:$,children:[o.jsx(Kr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(y7,{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(_7,{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(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(fe,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Y,disabled:!r,children:[o.jsx(Rf,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(We,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(n6,{open:y,onOpenChange:L,className:"flex flex-col gap-2.5",children:[o.jsxs(t6,{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(bs,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(s6,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(rle,{tier:B.watch("tier"),onTierChange:q=>B.setValue("tier",q,{shouldDirty:!0}),override:B.watch("modelOverride"),onOverrideChange:q=>B.setValue("modelOverride",q,{shouldDirty:!0})}),o.jsx(cle,{agentId:r||null,value:B.watch("tools"),onChange:q=>B.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:Nle}),value:B.watch("maxAgentSteps")??"",onChange:q=>{const oe=q.target.value.trim(),J=oe===""?null:Number(oe);B.setValue("maxAgentSteps",J===null||Number.isNaN(J)?null:J,{shouldDirty:!0})}})]})]})]})]})]})}const kk=[{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 jk(t){const e=kk.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Ale(t){const e=F.c(16),{automationId:s,triggerIds:n}=t,i=le(),[r,l]=A.useState("30d"),[a,c]=A.useState(Ple);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;l(b),c(jk(b))},e[0]=d):d=e[0];let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Ss,{className:"w-44",children:o.jsx(Rs,{})}),e[1]=u):u=e[1];let h;e[2]!==i?(h=kk.map(x=>o.jsx(It,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=h):h=e[3];let f;e[4]!==h?(f=o.jsx(ks,{children:h}),e[4]=h,e[5]=f):f=e[5];let m;e[6]!==f||e[7]!==r?(m=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(ws,{value:r,onValueChange:d,children:[u,f]})}),e[6]=f,e[7]=r,e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==a||e[11]!==n?(p=o.jsx(nV,{automationId:s,triggerIds:n,range:a}),e[9]=s,e[10]=a,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Ple(){return jk("30d")}function Ele(t){const e=F.c(5),{tabId:s}=t;let n;e[0]!==s?(n=Ty(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(jl,{}),e[2]=r):r=e[2];let l;return e[3]!==i.id?(l=o.jsx(A.Suspense,{fallback:r,children:o.jsx(Rle,{id:i.id})}),e[3]=i.id,e[4]=l):l=e[4],l}function Rle(t){const e=F.c(41),{id:s}=t,n=le(),{openPanel:i}=Di(),{data:r,isLoading:l}=LP(s),[a,c]=A.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const u=d;if(l){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(jl,{}),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 T;return e[5]!==C?(T=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]=T):T=e[6],T}let h;e[7]!==r.triggers?(h=r.triggers.map(Dle),e[7]=r.triggers,e[8]=h):h=e[8];const f=h;let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(qf,{size:14}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==u||e[13]!==p?(g=o.jsxs(fe,{variant:"ghost",size:"sm",onClick:u,children:[m,p]}),e[12]=u,e[13]=p,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 _;e[21]!==v?(_={id:"runs",label:v},e[21]=v,e[22]=_):_=e[22];let y;e[23]!==b||e[24]!==_?(y=[b,_],e[23]=b,e[24]=_,e[25]=y):y=e[25];let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=C=>c(C),e[26]=L):L=e[26];let w;e[27]!==y||e[28]!==a?(w=o.jsx(r8,{tabs:y,activeTab:a,onTabChange:L}),e[27]=y,e[28]=a,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]!==a||e[36]!==f?(k=a==="settings"?o.jsx(Tle,{automationId:s,automation:r}):o.jsx(Ale,{automationId:s,triggerIds:f}),e[33]=r,e[34]=s,e[35]=a,e[36]=f,e[37]=k):k=e[37];let j;return e[38]!==S||e[39]!==k?(j=o.jsx(Mn,{children:o.jsx(Mn.Content,{children:o.jsxs(Mn.Body,{children:[S,k]})})}),e[38]=S,e[39]=k,e[40]=j):j=e[40],j}function Dle(t){return t.id}function Ile(t){const e=F.c(29),{virtualMcpId:s}=t,n=le(),{openPanel:i}=Di(),{data:r}=wP(s),l=r===void 0?[]:r,{create:a}=Xu(),[c,d]=A.useState(""),u=c.toLowerCase(),h=l.filter(R=>R.name.toLowerCase().includes(u));let f;e[0]!==i?(f=R=>i(`automation:${R}`),e[0]=i,e[1]=f):f=e[1];const m=f,p=async()=>{if(a.isPending)return;Ge("automation_new_clicked",{virtual_mcp_id:s,existing_count:l.length});const R=await a.mutateAsync(SP(s));m(R.id)},g=a.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Gt,{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]!==a.isPending||e[6]!==p||e[7]!==b?(v=o.jsxs(fe,{size:"sm",onClick:p,disabled:g,children:[x,b]}),e[5]=a.isPending,e[6]=p,e[7]=b,e[8]=v):v=e[8];const _=v,y=Mn,L=Mn,w=Mn;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(Mn.Title,{children:S}),e[11]=S,e[12]=k):k=e[12];const j=l.length>0&&o.jsx(s9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let C;e[13]!==_||e[14]!==j?(C=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,_]}),e[13]=_,e[14]=j,e[15]=C):C=e[15];let T;e[16]!==k||e[17]!==C?(T=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=T):T=e[18];const N=l.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ci,{image:o.jsx(hr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:_})}):h.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ci,{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:h.map(R=>o.jsx(kP,{automation:R,onClick:()=>m(R.id)},R.id))});let P;e[19]!==T||e[20]!==N||e[21]!==w.Body?(P=o.jsxs(w.Body,{children:[T,N]}),e[19]=T,e[20]=N,e[21]=w.Body,e[22]=P):P=e[22];let V;e[23]!==P||e[24]!==L.Content?(V=o.jsx(L.Content,{children:P}),e[23]=P,e[24]=L.Content,e[25]=V):V=e[25];let E;return e[26]!==y||e[27]!==V?(E=o.jsx(y,{children:V}),e[26]=y,e[27]=V,e[28]=E):E=e[28],E}function Mle(t){const e=F.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(jl,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(A.Suspense,{fallback:n,children:o.jsx(Ile,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function Ole(t){const e=F.c(60),{file:s,onClose:n}=t,i=le();let r,l;e[0]!==s.filename?(r=o.jsx(Yo,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),l=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=l):(r=e[1],l=e[2]);let a;e[3]!==s.size?(a=t8(s.size),e[3]=s.size,e[4]=a):a=e[4];let c;e[5]!==a?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==l||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,l,c]}),e[7]=r,e[8]=l,e[9]=c,e[10]=d):d=e[10];let u;e[11]!==i?(u=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(bu,{size:14}),e[13]=h):h=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:h}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let m;e[17]!==u||e[18]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":u,asChild:!0,children:f})}),e[17]=u,e[18]=f,e[19]=m):m=e[19];let p;e[20]!==i?(p=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=p):p=e[21];let g;e[22]!==p?(g=o.jsx(We,{side:"bottom",children:p}),e[22]=p,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==m?(x=o.jsxs(qe,{children:[m,g]}),e[24]=g,e[25]=m,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 _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(fn,{size:14}),e[31]=_):_=e[31];let y;e[32]!==b||e[33]!==v?(y=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:_})}),e[32]=b,e[33]=v,e[34]=y):y=e[34];let L;e[35]!==i?(L=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=L):L=e[36];let w;e[37]!==L?(w=o.jsx(We,{side:"bottom",children:L}),e[37]=L,e[38]=w):w=e[38];let S;e[39]!==y||e[40]!==w?(S=o.jsxs(qe,{children:[y,w]}),e[39]=y,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(ji,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let T;e[48]!==i?(T=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=T):T=e[49];let N;e[50]!==T?(N=o.jsx(We,{side:"bottom",children:T}),e[50]=T,e[51]=N):N=e[51];let P;e[52]!==C||e[53]!==N?(P=o.jsxs(qe,{children:[C,N]}),e[52]=C,e[53]=N,e[54]=P):P=e[54];let V;return e[55]!==x||e[56]!==S||e[57]!==P||e[58]!==d?(V=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,S,P]}),e[55]=x,e[56]=S,e[57]=P,e[58]=d,e[59]=V):V=e[59],V}function $le(t){const e=F.c(31),{fileKey:s,taskId:n}=t,i=le(),{closePanel:r}=Di(),{data:l,isPending:a}=Jy(n);let c;e[0]!==s||e[1]!==l?(c=l?.find(g=>g.key===s)??null,e[0]=s,e[1]=l,e[2]=c):c=e[2];const d=c;let u;e[3]!==r?(u=()=>r(),e[3]=r,e[4]=u):u=e[4];const h=u;if(!d){if(a){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(Z6,{})}),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(Yo,{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 _;e[14]!==i?(_=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=_):_=e[15];let y;e[16]!==h||e[17]!==_?(y=o.jsx(fe,{variant:"ghost",size:"sm",onClick:h,children:_}),e[16]=h,e[17]=_,e[18]=y):y=e[18];let L;return e[19]!==x||e[20]!==v||e[21]!==y?(L=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,v,y]}),e[19]=x,e[20]=v,e[21]=y,e[22]=L):L=e[22],L}let f;e[23]!==d||e[24]!==h?(f=o.jsx(Ole,{file:d,onClose:h}),e[23]=d,e[24]=h,e[25]=f):f=e[25];let m;e[26]!==d?(m=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(e8,{file:d})}),e[26]=d,e[27]=m):m=e[27];let p;return e[28]!==f||e[29]!==m?(p=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,m]}),e[28]=f,e[29]=m,e[30]=p):p=e[30],p}function Ble(t){const e=F.c(7),{onClose:s}=t,n=le();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 l;return e[4]!==s||e[5]!==r?(l=o.jsx(eg,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=l):l=e[6],l}function zle(){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(Ble,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(mP,{}),t[4]=r):r=t[4];let l;t[5]!==n?(l=o.jsx(A.Suspense,{fallback:o.jsx(eg,{onClose:n,footer:null,children:r}),children:o.jsx(Fle,{onDone:n,onClose:n})}),t[5]=n,t[6]=l):l=t[6];let a;return t[7]!==i||t[8]!==l?(a=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(sn,{fallback:i,children:l})}),t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function Fle(t){const e=F.c(46),{onDone:s,onClose:n}=t,i=le(),{org:r}=He();let l;e[0]!==r.id?(l=Dd.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=l):l=e[1];const a=l;let c;e[2]!==r.id||e[3]!==r.slug?(c={connectionId:qc,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=Cs(c);let u;e[5]!==a||e[6]!==r||e[7]!==d?(u={selfClient:d,org:r,cdConnectionId:a},e[5]=a,e[6]=r,e[7]=d,e[8]=u):u=e[8];const h=pP(u),[f,m]=A.useState(!1),[p,g]=A.useState(null);let x;e[9]!==d?(x={mutationFn:async V=>x8(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:V}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Es(x);let v;e[11]!==s||e[12]!==b||e[13]!==h||e[14]!==i?(v=async()=>{if(g(null),h)try{await b.mutateAsync(h)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=h,e[14]=i,e[15]=v):v=e[15];const _=v;let y;e[16]!==p?(y=p?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:p}):null,e[16]=p,e[17]=y):y=e[17];let L;e[18]!==b.isPending||e[19]!==i?(L=b.isPending?i("routes.commerceOnboarding.connectSourcesTab.refreshing"):i("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=i,e[20]=L):L=e[20];let w;e[21]!==_?(w=()=>{_()},e[21]=_,e[22]=w):w=e[22];let S;e[23]!==f||e[24]!==b.isPending||e[25]!==L||e[26]!==w?(S=o.jsx(XA,{ready:f,pending:b.isPending,label:L,onClick:w}),e[23]=f,e[24]=b.isPending,e[25]=L,e[26]=w,e[27]=S):S=e[27];let k;e[28]!==y||e[29]!==S?(k=o.jsxs(o.Fragment,{children:[y,S]}),e[28]=y,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 T;e[35]!==a||e[36]!==r||e[37]!==h?(T=o.jsx(gP,{org:r,cdConnectionId:a,siteUrl:h,onReadinessChange:m}),e[35]=a,e[36]=r,e[37]=h,e[38]=T):T=e[38];let N;e[39]!==C||e[40]!==T?(N=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,T]}),e[39]=C,e[40]=T,e[41]=N):N=e[41];let P;return e[42]!==n||e[43]!==k||e[44]!==N?(P=o.jsx(eg,{onClose:n,footer:k,children:N}),e[42]=n,e[43]=k,e[44]=N,e[45]=P):P=e[45],P}const Ule=A.lazy(()=>Gs(()=>import("./project-app-view-Ben78Ktd.js"),__vite__mapDeps([177,1,2,80,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,81,82,83,15,11,16,23,84,85,86,87,88,89,90,91,92,93,94,7,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,77,72,110,113,153,122,123,124,125,119,120,121,154,111,112,71,114,115,116,117,73,118,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,70,148,149,78,150,151,152,155,156,75,157,158,159])).then(t=>({default:t.AppViewContent})));function Hle(){const t=F.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:i}=p8();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(jl,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(jl,{}),t[1]=d):d=t[1];let u;return t[2]!==i?(u=o.jsx(A.Suspense,{fallback:d,children:o.jsx(Ule,{connectionId:i,toolName:pV})}),t[2]=i,t[3]=u):u=t[3],u}let r;t[4]!==n?(r=()=>o.jsx(Ck,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(jl,{}),t[6]=l):l=t[6];let a;t[7]!==n?(a=o.jsx(A.Suspense,{fallback:l,children:o.jsx(Wle,{claimedSiteUrl:n})}),t[7]=n,t[8]=a):a=t[8];let c;return t[9]!==r||t[10]!==a?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(sn,{fallback:r,children:a})}),t[9]=r,t[10]=a,t[11]=c):c=t[11],c}const Kle=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Ck(t){const e=F.c(27),{claimedSiteUrl:s,children:n}=t,i=le(),r=s??void 0;let l;e[0]!==r?(l=Sm(r),e[0]=r,e[1]=l):l=e[1];const a=l;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(Om,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(Om,{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 u;e[5]!==d?(u=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=u):u=e[6];let h;e[7]!==i?(h=i("reports.emptyState.description"),e[7]=i,e[8]=h):h=e[8];let f;e[9]!==h?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:h}),e[9]=h,e[10]=f):f=e[10];let m;e[11]!==u||e[12]!==f?(m=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[u,f]}),e[11]=u,e[12]=f,e[13]=m):m=e[13];let p;e[14]!==n||e[15]!==a?(p=n??(a?o.jsx("p",{className:"text-sm text-muted-foreground",children:a}):null),e[14]=n,e[15]=a,e[16]=p):p=e[16];let g;e[17]!==i?(g=Kle.map(_=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:i(_)},_)),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]!==p?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[p,x]}),e[21]=x,e[22]=p,e[23]=b):b=e[23];let v;return e[24]!==b||e[25]!==m?(v=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,m,b]}),e[24]=b,e[25]=m,e[26]=v):v=e[26],v}function Wle(t){const e=F.c(46),{claimedSiteUrl:s}=t,n=le(),i=rn(),{org:r}=He();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:qc,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const a=Cs(l);let c;e[3]!==s?(c=Sm(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,u]=A.useState(c),[h,f]=A.useState(null);let m;e[5]!==a?(m={mutationFn:async E=>x8(await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}})),retry:!1},e[5]=a,e[6]=m):m=e[6];const p=Es(m);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==p?(g=async E=>{const R=xP(E);if(!R.ok){f(R.error);return}f(null);const I=Sm(R.value)??void 0;Ge("reports_start_diagnostic_submitted",{organization_id:r.id,domain:I});try{await p.mutateAsync(R.value)}catch(D){const O=D;Ge("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:Ll.agents,params:{org:r.slug,panel:void 0},search:{virtualmcpid:Xl(r.id).id,connect:"1",siteUrl:R.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=p,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=E=>{E.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const v=b;let _;e[15]!==n?(_=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=_):_=e[16];let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=E=>u(E.target.value),e[17]=y):y=e[17];let L;e[18]!==n?(L=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=L):L=e[19];const w=!!h;let S;e[20]!==p.isPending||e[21]!==d||e[22]!==_||e[23]!==L||e[24]!==w?(S=o.jsx(vt,{"aria-label":_,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:y,placeholder:L,"aria-invalid":w,disabled:p.isPending}),e[20]=p.isPending,e[21]=d,e[22]=_,e[23]=L,e[24]=w,e[25]=S):S=e[25];let k;e[26]!==p.isPending||e[27]!==n?(k=p.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=p.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]!==p.isPending||e[31]!==k?(C=o.jsxs(fe,{type:"submit",className:"shrink-0",disabled:p.isPending,children:[k,j]}),e[30]=p.isPending,e[31]=k,e[32]=C):C=e[32];let T;e[33]!==S||e[34]!==C?(T=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]=T):T=e[35];let N;e[36]!==h||e[37]!==n?(N=h?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:jP(n,h)}):null,e[36]=h,e[37]=n,e[38]=N):N=e[38];let P;e[39]!==v||e[40]!==T||e[41]!==N?(P=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:v,children:[T,N]}),e[39]=v,e[40]=T,e[41]=N,e[42]=P):P=e[42];let V;return e[43]!==s||e[44]!==P?(V=o.jsx(Ck,{claimedSiteUrl:s,children:P}),e[43]=s,e[44]=P,e[45]=V):V=e[45],V}function qle(t){return[Dd.SELF(t),Dd.REGISTRY(t),Dd.COMMUNITY_REGISTRY(t),Dd.DEV_ASSETS(t)]}function Gle(t,e){const s=new Set(qle(e));return t.some(n=>!s.has(n.id))}function Yle(){const t=F.c(78),e=le(),{org:s}=He(),n=Ni();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"mcp-github"},t[0]=i):i=t[0];const r=Ni(i),{projects:l}=Hu(),a=Zf();let c;t[1]!==s.slug?(c={org:s.slug},t[1]=s.slug,t[2]=c):c=t[2];const d=c;let u;t[3]!==e?(u=e("discover.setup.connectTitle"),t[3]=e,t[4]=u):u=t[4];let h;t[5]!==e?(h=e("discover.setup.connectBody"),t[5]=e,t[6]=h):h=t[6];let f;t[7]!==n||t[8]!==s.id?(f=Gle(n,s.id),t[7]=n,t[8]=s.id,t[9]=f):f=t[9];let m;t[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(El,{size:18}),t[10]=m):m=t[10];let p;t[11]===Symbol.for("react.memo_cache_sentinel")?(p={tab:"all"},t[11]=p):p=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(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(yl,{to:"/$org/settings/connections",params:d,search:p,children:g})}),t[14]=d,t[15]=g,t[16]=x):x=t[16];let b;t[17]!==u||t[18]!==h||t[19]!==f||t[20]!==x?(b={key:"connect",title:u,body:h,done:f,icon:m,action:x},t[17]=u,t[18]=h,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 _;t[24]!==e?(_=e("discover.setup.githubBody"),t[24]=e,t[25]=_):_=t[25];const y=r.length>0;let L;t[26]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(mn,{className:"size-[18px]"}),t[26]=L):L=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(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(yl,{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]!==_||t[35]!==y||t[36]!==k?(j={key:"github",title:v,body:_,done:y,icon:L,action:k},t[33]=v,t[34]=_,t[35]=y,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 T;t[40]!==e?(T=e("discover.setup.projectBody"),t[40]=e,t[41]=T):T=t[41];const N=l.length>0;let P;t[42]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(Gt,{size:18}),t[42]=P):P=t[42];let V;t[43]!==s.slug?(V={org:s.slug,panel:void 0},t[43]=s.slug,t[44]=V):V=t[44];let E;t[45]===Symbol.for("react.memo_cache_sentinel")?(E={virtualmcpid:void 0},t[45]=E):E=t[45];let R;t[46]!==e?(R=e("discover.setup.projectAction"),t[46]=e,t[47]=R):R=t[47];let I;t[48]!==V||t[49]!==R?(I=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(yl,{to:Ll.agents,params:V,search:E,children:R})}),t[48]=V,t[49]=R,t[50]=I):I=t[50];let D;t[51]!==C||t[52]!==T||t[53]!==N||t[54]!==I?(D={key:"project",title:C,body:T,done:N,icon:P,action:I},t[51]=C,t[52]=T,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 $;t[58]!==e?($=e("discover.setup.inviteBody"),t[58]=e,t[59]=$):$=t[59];let M;t[60]!==a.data?.data?.members?(M=a.data?.data?.members??[],t[60]=a.data?.data?.members,t[61]=M):M=t[61];const z=M.length>1;let B;t[62]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(n9,{size:18}),t[62]=B):B=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(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(yl,{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]!==$||t[70]!==z||t[71]!==H?(W={key:"invite",title:O,body:$,done:z,icon:B,action:H},t[68]=O,t[69]=$,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 Jle(){const t=F.c(51),e=le(),{projects:s}=Hu();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={slug:"mcp-github"},t[0]=n):n=t[0];const i=Ni(n),r=e9();let l;t[1]!==s?(l=s.some(Xle),t[1]=s,t[2]=l):l=t[2];const a=l;let c;t[3]!==s?(c=s.some(Qle),t[3]=s,t[4]=c):c=t[4];const d=c;let u;if(t[5]!==r||t[6]!==s){let V;t[8]!==r?(V=E=>zu(r.data?.configs??[],Q2(E)),t[8]=r,t[9]=V):V=t[9],u=s.some(V),t[5]=r,t[6]=s,t[7]=u}else u=t[7];const h=u;let f;t[10]!==e?(f=e("discover.capabilities.previewTitle"),t[10]=e,t[11]=f):f=t[11];let m;t[12]!==e?(m=e("discover.capabilities.previewRequirement"),t[12]=e,t[13]=m):m=t[13];let p;t[14]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Vi,{size:18}),t[14]=p):p=t[14];let g;t[15]!==a||t[16]!==f||t[17]!==m?(g={key:"preview",title:f,requirement:m,satisfied:a,icon:p},t[15]=a,t[16]=f,t[17]=m,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&&a;let _;t[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(mn,{className:"size-[18px]"}),t[23]=_):_=t[23];let y;t[24]!==v||t[25]!==x||t[26]!==b?(y={key:"git",title:x,requirement:b,satisfied:v,icon:_},t[24]=v,t[25]=x,t[26]=b,t[27]=y):y=t[27];let L;t[28]!==e?(L=e("discover.capabilities.contentTitle"),t[28]=e,t[29]=L):L=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(Vi,{size:18}),t[32]=S):S=t[32];let k;t[33]!==d||t[34]!==L||t[35]!==w?(k={key:"content",title:L,requirement:w,satisfied:d,icon:S},t[33]=d,t[34]=L,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 T;t[41]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(ki,{size:18}),t[41]=T):T=t[41];let N;t[42]!==h||t[43]!==j||t[44]!==C?(N={key:"assets",title:j,requirement:C,satisfied:h,icon:T},t[42]=h,t[43]=j,t[44]=C,t[45]=N):N=t[45];let P;return t[46]!==y||t[47]!==k||t[48]!==N||t[49]!==g?(P=[g,y,k,N],t[46]=y,t[47]=k,t[48]=N,t[49]=g,t[50]=P):P=t[50],P}function Qle(t){return!!io(t)&&e0(t.metadata?.ui?.layout)!=="off"}function Xle(t){return io(t)}function F1(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 l;e[2]!==n?(l=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==r||e[5]!==l?(a=o.jsxs("div",{className:"flex flex-col gap-1",children:[r,l]}),e[4]=r,e[5]=l,e[6]=a):a=e[6];let c;return e[7]!==i||e[8]!==a?(c=o.jsxs("section",{className:"flex flex-col gap-3",children:[a,i]}),e[7]=i,e[8]=a,e[9]=c):c=e[9],c}function Zle(){const t=F.c(63),e=le(),{org:s}=He(),n=Yle(),i=Jle();let r;t[0]!==n?(r=n.filter(sae),t[0]=n,t[1]=r):r=t[1];const l=r;let a;t[2]!==e?(a=e("discover.title"),t[2]=e,t[3]=a):a=t[3];let c;t[4]!==a?(c=o.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a}),t[4]=a,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 u;t[8]!==d?(u=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:d}),t[8]=d,t[9]=u):u=t[9];let h;t[10]!==c||t[11]!==u?(h=o.jsxs("header",{className:"flex flex-col gap-2",children:[c,u]}),t[10]=c,t[11]=u,t[12]=h):h=t[12];let f;t[13]!==e?(f=e("discover.setup.title"),t[13]=e,t[14]=f):f=t[14];let m;t[15]!==l.length||t[16]!==e?(m=l.length===0?e("discover.setup.allDone"):e("discover.setup.description"),t[15]=l.length,t[16]=e,t[17]=m):m=t[17];let p;t[18]!==n?(p=n.map(tae),t[18]=n,t[19]=p):p=t[19];let g;t[20]!==p?(g=o.jsx("ul",{className:"flex flex-col gap-2",children:p}),t[20]=p,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==m||t[24]!==g?(x=o.jsx(F1,{title:f,description:m,children:g}),t[22]=f,t[23]=m,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 _;if(t[30]!==i||t[31]!==e){let E;t[33]!==e?(E=R=>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",R.satisfied?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:R.satisfied?o.jsx($t,{size:18}):R.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:R.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:R.satisfied?e("discover.capabilities.ready"):R.requirement})]})]},R.key),t[33]=e,t[34]=E):E=t[34],_=i.map(E),t[30]=i,t[31]=e,t[32]=_}else _=t[32];let y;t[35]!==_?(y=o.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:_}),t[35]=_,t[36]=y):y=t[36];let L;t[37]!==b||t[38]!==v||t[39]!==y?(L=o.jsx(F1,{title:b,description:v,children:y}),t[37]=b,t[38]=v,t[39]=y,t[40]=L):L=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 T;t[50]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(gr,{size:18}),t[50]=T):T=t[50];let N;t[51]!==k||t[52]!==C?(N=o.jsx("div",{children:o.jsx(fe,{asChild:!0,size:"lg",children:o.jsxs(yl,{to:"/$org/settings/connections",params:k,search:j,onClick:eae,children:[C,T]})})}),t[51]=k,t[52]=C,t[53]=N):N=t[53];let P;t[54]!==w||t[55]!==S||t[56]!==N?(P=o.jsx(F1,{title:w,description:S,children:N}),t[54]=w,t[55]=S,t[56]=N,t[57]=P):P=t[57];let V;return t[58]!==x||t[59]!==L||t[60]!==P||t[61]!==h?(V=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:[h,x,L,P]})}),t[58]=x,t[59]=L,t[60]=P,t[61]=h,t[62]=V):V=t[62],V}function eae(){return Ge("discover_catalog_opened",{})}function tae(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($t,{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 sae(t){return!t.done}function nae(t){const e=F.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,l=le();let a;e[0]!==s?(a=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=a):a=e[1];const c=a;let d;e[2]!==n||e[3]!==l?(d=n.deckDetected&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(Ry,{size:14})})}),o.jsx(We,{side:"bottom",children:n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=l,e[4]=d):d=e[4];let u;e[5]!==c?(u=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=u):u=e[6];let h;e[7]!==c?(h=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=h):h=e[8];let f;e[9]!==c||e[10]!==u||e[11]!==h?(f=o.jsx("button",{type:"button",onClick:u,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:h}),e[9]=c,e[10]=u,e[11]=h,e[12]=f):f=e[12];let m;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==l?(m=n.agentUpdated&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(On,{size:12}),l("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(We,{side:"bottom",children:l("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=l,e[16]=m):m=e[16];let p;e[17]!==n.saving||e[18]!==l?(p=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:l("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=l,e[19]=p):p=e[19];let g;e[20]!==n||e[21]!==l?(g=n.deckDetected&&n.writable&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInline"),className:re(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(T6,{size:14})})}),o.jsx(We,{side:"bottom",children:n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=l,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==i||e[25]!==n.deckDetected||e[26]!==l?(x=n.deckDetected?o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),children:o.jsx(bu,{size:14})})}),o.jsxs(Kt,{align:"end",children:[o.jsxs(Je,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(gT,{size:14}),l("deck.deckToolbar.exportAsPdf")]}),o.jsx(Je,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(Wf,{size:14}),l("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx(bu,{size:14})})})}),o.jsx(We,{side:"bottom",children:l("deck.deckToolbar.download")})]}),e[23]=c,e[24]=i,e[25]=n.deckDetected,e[26]=l,e[27]=x):x=e[27];let b;e[28]!==l?(b=l("deck.deckToolbar.openInNewTab"),e[28]=l,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 _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(fn,{size:14}),e[32]=_):_=e[32];let y;e[33]!==b||e[34]!==v?(y=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:_})}),e[33]=b,e[34]=v,e[35]=y):y=e[35];let L;e[36]!==l?(L=l("deck.deckToolbar.openInNewTab"),e[36]=l,e[37]=L):L=e[37];let w;e[38]!==L?(w=o.jsx(We,{side:"bottom",children:L}),e[38]=L,e[39]=w):w=e[39];let S;e[40]!==y||e[41]!==w?(S=o.jsxs(qe,{children:[y,w]}),e[40]=y,e[41]=w,e[42]=S):S=e[42];let k;return e[43]!==S||e[44]!==d||e[45]!==f||e[46]!==m||e[47]!==p||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,m,p,g,x,S,r]}),e[43]=S,e[44]=d,e[45]=f,e[46]=m,e[47]=p,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const xc=1;function iae(t){if(typeof t!="object"||t===null||t.v!==xc||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 Ao extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function Nk(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function rae(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?Nk(s).length:null}function oae(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new Ao("no <deck-viewer> element in source","no-viewer");const i=Nk(n),r=e.kind==="move"?e.from:e.at,l=i[r];if(!l)throw new Ao(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new Ao("cannot remove the last slide","bad-op");l.remove();break}case"duplicate":{const c=l.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");l.after(c);break}case"move":{if(e.to<0||e.to>=i.length)throw new Ao(`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(l,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new Ao(`invalid attribute name: ${e.name}`,"bad-op");l.setAttribute(e.name,e.value);break}case"remove-attr":{l.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new Ao("replace html has no root element","bad-op");l.replaceWith(s.importNode(d,!0));break}default:throw new Ao(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
646
+ `);if(oe.trim()){E(!0);try{te(),Ge("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:oe.length}),m(),await p({tiptapDoc:n_({managerAgentId:r6.AUTOMATION_MANAGER(l.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:oe})})}finally{E(!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,B=l2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:z,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=B.watch("active"),[H,W]=A.useReducer(Vle,null),K=()=>{H!==null&&(Ge("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"}))},Q=async()=>{const q=B.control._formState.dirtyFields,oe=Object.keys(q);if(oe.length===0&&!D)return!0;const J=B.getValues(),ie=B.control._defaultValues;B.reset(J,{keepValues:!0});const Z=D;O(!1);const he={tier:J.tier,...J.modelOverride?{modelId:J.modelOverride.modelId,credentialId:J.modelOverride.credentialId,modelTitle:J.modelOverride.title}:{}},de={id:t,name:J.name,active:J.active,models:he,tools:J.tools,maxAgentSteps:J.maxAgentSteps,messages:fN(x),temperature:0};try{await a.mutateAsync(de)}catch{return B.reset(ie,{keepValues:!0}),Z&&O(!0),!1}const ae=[...oe];return Z&&ae.push("messages"),W({type:"accumulate",now:Date.now(),fields:ae}),ne(),!0},{schedule:X,flush:se}=zh({save:Q}),{schedule:ne,flush:te}=zh({delayMs:3e4,save:async()=>K()});A.useEffect(()=>{const q=B.watch(()=>X());return()=>q.unsubscribe()},[]);const ee=q=>{if(b(q),!R){I(!0);return}O(!0),X()},Y=async()=>{Ge("automation_test_clicked",{automation_id:t,agent_id:r});const q=await se();if(te(),!!q){if(!x){ve.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const oe=await d.mutateAsync(t);oe.threadId&&(m(),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(fe,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(qf,{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(xs,{control:B.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(fe,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(nn,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xs,{control:B.control,name:"active",render:({field:q})=>o.jsx(Ti,{checked:q.value,onCheckedChange:oe=>{q.onChange(oe),se()},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(i_,{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(_le,{automationId:t,open:v,onOpenChange:_,onCustomSelect:()=>{S(!0),T(!1),j("")},onEventSelect:()=>{T(!0),S(!1)},onWebhookCreated:q=>{Ge("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),P(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:()=>_(!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(Lle,{trigger:q,automationId:t,connectionName:q.connection_id?h.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(Jd,{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||!cu(q)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:q}),Ge("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ve.success(i("automations.automationDetail.starterAdded")),S(!1),j("")}catch{ve.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async q=>{const oe=k.trim();q.key==="Enter"&&oe&&cu(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&&!cu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(it,{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(ji,{size:13})})]}),C&&o.jsx(A.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(it,{className:"size-[13px] text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(Sle,{automationId:t,onDone:()=>T(!1)})}),o.jsx(Sk,{open:N!==null,onOpenChange:q=>{q||P(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(fe,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:V||!x,onClick:$,children:[o.jsx(Kr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(y7,{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(_7,{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(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(fe,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Y,disabled:!r,children:[o.jsx(Rf,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(We,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(n6,{open:y,onOpenChange:L,className:"flex flex-col gap-2.5",children:[o.jsxs(t6,{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(bs,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(s6,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(rle,{tier:B.watch("tier"),onTierChange:q=>B.setValue("tier",q,{shouldDirty:!0}),override:B.watch("modelOverride"),onOverrideChange:q=>B.setValue("modelOverride",q,{shouldDirty:!0})}),o.jsx(cle,{agentId:r||null,value:B.watch("tools"),onChange:q=>B.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:Nle}),value:B.watch("maxAgentSteps")??"",onChange:q=>{const oe=q.target.value.trim(),J=oe===""?null:Number(oe);B.setValue("maxAgentSteps",J===null||Number.isNaN(J)?null:J,{shouldDirty:!0})}})]})]})]})]})]})}const kk=[{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 jk(t){const e=kk.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Ale(t){const e=F.c(16),{automationId:s,triggerIds:n}=t,i=le(),[r,l]=A.useState("30d"),[a,c]=A.useState(Ple);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;l(b),c(jk(b))},e[0]=d):d=e[0];let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Ss,{className:"w-44",children:o.jsx(Rs,{})}),e[1]=u):u=e[1];let h;e[2]!==i?(h=kk.map(x=>o.jsx(It,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=h):h=e[3];let f;e[4]!==h?(f=o.jsx(ks,{children:h}),e[4]=h,e[5]=f):f=e[5];let m;e[6]!==f||e[7]!==r?(m=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(ws,{value:r,onValueChange:d,children:[u,f]})}),e[6]=f,e[7]=r,e[8]=m):m=e[8];let p;e[9]!==s||e[10]!==a||e[11]!==n?(p=o.jsx(nV,{automationId:s,triggerIds:n,range:a}),e[9]=s,e[10]=a,e[11]=n,e[12]=p):p=e[12];let g;return e[13]!==m||e[14]!==p?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[m,p]}),e[13]=m,e[14]=p,e[15]=g):g=e[15],g}function Ple(){return jk("30d")}function Ele(t){const e=F.c(5),{tabId:s}=t;let n;e[0]!==s?(n=Ty(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(jl,{}),e[2]=r):r=e[2];let l;return e[3]!==i.id?(l=o.jsx(A.Suspense,{fallback:r,children:o.jsx(Rle,{id:i.id})}),e[3]=i.id,e[4]=l):l=e[4],l}function Rle(t){const e=F.c(41),{id:s}=t,n=le(),{openPanel:i}=Di(),{data:r,isLoading:l}=LP(s),[a,c]=A.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const u=d;if(l){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(jl,{}),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 T;return e[5]!==C?(T=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]=T):T=e[6],T}let h;e[7]!==r.triggers?(h=r.triggers.map(Dle),e[7]=r.triggers,e[8]=h):h=e[8];const f=h;let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(qf,{size:14}),e[9]=m):m=e[9];let p;e[10]!==n?(p=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=p):p=e[11];let g;e[12]!==u||e[13]!==p?(g=o.jsxs(fe,{variant:"ghost",size:"sm",onClick:u,children:[m,p]}),e[12]=u,e[13]=p,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 _;e[21]!==v?(_={id:"runs",label:v},e[21]=v,e[22]=_):_=e[22];let y;e[23]!==b||e[24]!==_?(y=[b,_],e[23]=b,e[24]=_,e[25]=y):y=e[25];let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=C=>c(C),e[26]=L):L=e[26];let w;e[27]!==y||e[28]!==a?(w=o.jsx(r8,{tabs:y,activeTab:a,onTabChange:L}),e[27]=y,e[28]=a,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]!==a||e[36]!==f?(k=a==="settings"?o.jsx(Tle,{automationId:s,automation:r}):o.jsx(Ale,{automationId:s,triggerIds:f}),e[33]=r,e[34]=s,e[35]=a,e[36]=f,e[37]=k):k=e[37];let j;return e[38]!==S||e[39]!==k?(j=o.jsx(Mn,{children:o.jsx(Mn.Content,{children:o.jsxs(Mn.Body,{children:[S,k]})})}),e[38]=S,e[39]=k,e[40]=j):j=e[40],j}function Dle(t){return t.id}function Ile(t){const e=F.c(29),{virtualMcpId:s}=t,n=le(),{openPanel:i}=Di(),{data:r}=wP(s),l=r===void 0?[]:r,{create:a}=Xu(),[c,d]=A.useState(""),u=c.toLowerCase(),h=l.filter(R=>R.name.toLowerCase().includes(u));let f;e[0]!==i?(f=R=>i(`automation:${R}`),e[0]=i,e[1]=f):f=e[1];const m=f,p=async()=>{if(a.isPending)return;Ge("automation_new_clicked",{virtual_mcp_id:s,existing_count:l.length});const R=await a.mutateAsync(SP(s));m(R.id)},g=a.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Gt,{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]!==a.isPending||e[6]!==p||e[7]!==b?(v=o.jsxs(fe,{size:"sm",onClick:p,disabled:g,children:[x,b]}),e[5]=a.isPending,e[6]=p,e[7]=b,e[8]=v):v=e[8];const _=v,y=Mn,L=Mn,w=Mn;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(Mn.Title,{children:S}),e[11]=S,e[12]=k):k=e[12];const j=l.length>0&&o.jsx(s9,{value:c,onChange:d,placeholder:n("automations.automationsList.searchPlaceholder"),className:"w-full md:w-[375px]"});let C;e[13]!==_||e[14]!==j?(C=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[j,_]}),e[13]=_,e[14]=j,e[15]=C):C=e[15];let T;e[16]!==k||e[17]!==C?(T=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=T):T=e[18];const N=l.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ci,{image:o.jsx(hr,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:_})}):h.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Ci,{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:h.map(R=>o.jsx(kP,{automation:R,onClick:()=>m(R.id)},R.id))});let P;e[19]!==T||e[20]!==N||e[21]!==w.Body?(P=o.jsxs(w.Body,{children:[T,N]}),e[19]=T,e[20]=N,e[21]=w.Body,e[22]=P):P=e[22];let V;e[23]!==P||e[24]!==L.Content?(V=o.jsx(L.Content,{children:P}),e[23]=P,e[24]=L.Content,e[25]=V):V=e[25];let E;return e[26]!==y||e[27]!==V?(E=o.jsx(y,{children:V}),e[26]=y,e[27]=V,e[28]=E):E=e[28],E}function Mle(t){const e=F.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(jl,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(A.Suspense,{fallback:n,children:o.jsx(Ile,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function Ole(t){const e=F.c(60),{file:s,onClose:n}=t,i=le();let r,l;e[0]!==s.filename?(r=o.jsx(Yo,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),l=o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=l):(r=e[1],l=e[2]);let a;e[3]!==s.size?(a=t8(s.size),e[3]=s.size,e[4]=a):a=e[4];let c;e[5]!==a?(c=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==l||e[9]!==c?(d=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,l,c]}),e[7]=r,e[8]=l,e[9]=c,e[10]=d):d=e[10];let u;e[11]!==i?(u=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(bu,{size:14}),e[13]=h):h=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:h}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let m;e[17]!==u||e[18]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":u,asChild:!0,children:f})}),e[17]=u,e[18]=f,e[19]=m):m=e[19];let p;e[20]!==i?(p=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=p):p=e[21];let g;e[22]!==p?(g=o.jsx(We,{side:"bottom",children:p}),e[22]=p,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==m?(x=o.jsxs(qe,{children:[m,g]}),e[24]=g,e[25]=m,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 _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(fn,{size:14}),e[31]=_):_=e[31];let y;e[32]!==b||e[33]!==v?(y=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:_})}),e[32]=b,e[33]=v,e[34]=y):y=e[34];let L;e[35]!==i?(L=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=L):L=e[36];let w;e[37]!==L?(w=o.jsx(We,{side:"bottom",children:L}),e[37]=L,e[38]=w):w=e[38];let S;e[39]!==y||e[40]!==w?(S=o.jsxs(qe,{children:[y,w]}),e[39]=y,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(ji,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let T;e[48]!==i?(T=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=T):T=e[49];let N;e[50]!==T?(N=o.jsx(We,{side:"bottom",children:T}),e[50]=T,e[51]=N):N=e[51];let P;e[52]!==C||e[53]!==N?(P=o.jsxs(qe,{children:[C,N]}),e[52]=C,e[53]=N,e[54]=P):P=e[54];let V;return e[55]!==x||e[56]!==S||e[57]!==P||e[58]!==d?(V=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,S,P]}),e[55]=x,e[56]=S,e[57]=P,e[58]=d,e[59]=V):V=e[59],V}function $le(t){const e=F.c(31),{fileKey:s,taskId:n}=t,i=le(),{closePanel:r}=Di(),{data:l,isPending:a}=Jy(n);let c;e[0]!==s||e[1]!==l?(c=l?.find(g=>g.key===s)??null,e[0]=s,e[1]=l,e[2]=c):c=e[2];const d=c;let u;e[3]!==r?(u=()=>r(),e[3]=r,e[4]=u):u=e[4];const h=u;if(!d){if(a){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(Z6,{})}),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(Yo,{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 _;e[14]!==i?(_=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=_):_=e[15];let y;e[16]!==h||e[17]!==_?(y=o.jsx(fe,{variant:"ghost",size:"sm",onClick:h,children:_}),e[16]=h,e[17]=_,e[18]=y):y=e[18];let L;return e[19]!==x||e[20]!==v||e[21]!==y?(L=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,v,y]}),e[19]=x,e[20]=v,e[21]=y,e[22]=L):L=e[22],L}let f;e[23]!==d||e[24]!==h?(f=o.jsx(Ole,{file:d,onClose:h}),e[23]=d,e[24]=h,e[25]=f):f=e[25];let m;e[26]!==d?(m=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(e8,{file:d})}),e[26]=d,e[27]=m):m=e[27];let p;return e[28]!==f||e[29]!==m?(p=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,m]}),e[28]=f,e[29]=m,e[30]=p):p=e[30],p}function Ble(t){const e=F.c(7),{onClose:s}=t,n=le();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 l;return e[4]!==s||e[5]!==r?(l=o.jsx(eg,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=l):l=e[6],l}function zle(){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(Ble,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(mP,{}),t[4]=r):r=t[4];let l;t[5]!==n?(l=o.jsx(A.Suspense,{fallback:o.jsx(eg,{onClose:n,footer:null,children:r}),children:o.jsx(Fle,{onDone:n,onClose:n})}),t[5]=n,t[6]=l):l=t[6];let a;return t[7]!==i||t[8]!==l?(a=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(sn,{fallback:i,children:l})}),t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function Fle(t){const e=F.c(46),{onDone:s,onClose:n}=t,i=le(),{org:r}=He();let l;e[0]!==r.id?(l=Dd.COMMERCE_DISCOVERY(r.id),e[0]=r.id,e[1]=l):l=e[1];const a=l;let c;e[2]!==r.id||e[3]!==r.slug?(c={connectionId:qc,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=Cs(c);let u;e[5]!==a||e[6]!==r||e[7]!==d?(u={selfClient:d,org:r,cdConnectionId:a},e[5]=a,e[6]=r,e[7]=d,e[8]=u):u=e[8];const h=pP(u),[f,m]=A.useState(!1),[p,g]=A.useState(null);let x;e[9]!==d?(x={mutationFn:async V=>x8(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:V}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Es(x);let v;e[11]!==s||e[12]!==b||e[13]!==h||e[14]!==i?(v=async()=>{if(g(null),h)try{await b.mutateAsync(h)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=h,e[14]=i,e[15]=v):v=e[15];const _=v;let y;e[16]!==p?(y=p?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:p}):null,e[16]=p,e[17]=y):y=e[17];let L;e[18]!==b.isPending||e[19]!==i?(L=b.isPending?i("routes.commerceOnboarding.connectSourcesTab.refreshing"):i("routes.commerceOnboarding.connectSourcesTab.refresh"),e[18]=b.isPending,e[19]=i,e[20]=L):L=e[20];let w;e[21]!==_?(w=()=>{_()},e[21]=_,e[22]=w):w=e[22];let S;e[23]!==f||e[24]!==b.isPending||e[25]!==L||e[26]!==w?(S=o.jsx(XA,{ready:f,pending:b.isPending,label:L,onClick:w}),e[23]=f,e[24]=b.isPending,e[25]=L,e[26]=w,e[27]=S):S=e[27];let k;e[28]!==y||e[29]!==S?(k=o.jsxs(o.Fragment,{children:[y,S]}),e[28]=y,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 T;e[35]!==a||e[36]!==r||e[37]!==h?(T=o.jsx(gP,{org:r,cdConnectionId:a,siteUrl:h,onReadinessChange:m}),e[35]=a,e[36]=r,e[37]=h,e[38]=T):T=e[38];let N;e[39]!==C||e[40]!==T?(N=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,T]}),e[39]=C,e[40]=T,e[41]=N):N=e[41];let P;return e[42]!==n||e[43]!==k||e[44]!==N?(P=o.jsx(eg,{onClose:n,footer:k,children:N}),e[42]=n,e[43]=k,e[44]=N,e[45]=P):P=e[45],P}const Ule=A.lazy(()=>Gs(()=>import("./project-app-view-lSJv2DSd.js"),__vite__mapDeps([177,1,2,80,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,81,82,83,15,11,16,23,84,85,86,87,88,89,90,91,92,93,94,7,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,77,72,110,113,153,122,123,124,125,119,120,121,154,111,112,71,114,115,116,117,73,118,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,70,148,149,78,150,151,152,155,156,75,157,158,159])).then(t=>({default:t.AppViewContent})));function Hle(){const t=F.c(12),{diagnostic:e,isLoading:s,siteUrl:n,connectionId:i}=p8();if(s){let d;return t[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(jl,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(jl,{}),t[1]=d):d=t[1];let u;return t[2]!==i?(u=o.jsx(A.Suspense,{fallback:d,children:o.jsx(Ule,{connectionId:i,toolName:pV})}),t[2]=i,t[3]=u):u=t[3],u}let r;t[4]!==n?(r=()=>o.jsx(Ck,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(jl,{}),t[6]=l):l=t[6];let a;t[7]!==n?(a=o.jsx(A.Suspense,{fallback:l,children:o.jsx(Wle,{claimedSiteUrl:n})}),t[7]=n,t[8]=a):a=t[8];let c;return t[9]!==r||t[10]!==a?(c=o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto",children:o.jsx(sn,{fallback:r,children:a})}),t[9]=r,t[10]=a,t[11]=c):c=t[11],c}const Kle=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function Ck(t){const e=F.c(27),{claimedSiteUrl:s,children:n}=t,i=le(),r=s??void 0;let l;e[0]!==r?(l=Sm(r),e[0]=r,e[1]=l):l=e[1];const a=l;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(Om,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(Om,{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 u;e[5]!==d?(u=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=u):u=e[6];let h;e[7]!==i?(h=i("reports.emptyState.description"),e[7]=i,e[8]=h):h=e[8];let f;e[9]!==h?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:h}),e[9]=h,e[10]=f):f=e[10];let m;e[11]!==u||e[12]!==f?(m=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[u,f]}),e[11]=u,e[12]=f,e[13]=m):m=e[13];let p;e[14]!==n||e[15]!==a?(p=n??(a?o.jsx("p",{className:"text-sm text-muted-foreground",children:a}):null),e[14]=n,e[15]=a,e[16]=p):p=e[16];let g;e[17]!==i?(g=Kle.map(_=>o.jsx("li",{className:"rounded-full border border-border bg-card px-3 py-1 text-xs text-muted-foreground",children:i(_)},_)),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]!==p?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[p,x]}),e[21]=x,e[22]=p,e[23]=b):b=e[23];let v;return e[24]!==b||e[25]!==m?(v=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,m,b]}),e[24]=b,e[25]=m,e[26]=v):v=e[26],v}function Wle(t){const e=F.c(46),{claimedSiteUrl:s}=t,n=le(),i=rn(),{org:r}=He();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:qc,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const a=Cs(l);let c;e[3]!==s?(c=Sm(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,u]=A.useState(c),[h,f]=A.useState(null);let m;e[5]!==a?(m={mutationFn:async E=>x8(await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}})),retry:!1},e[5]=a,e[6]=m):m=e[6];const p=Es(m);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==p?(g=async E=>{const R=xP(E);if(!R.ok){f(R.error);return}f(null);const I=Sm(R.value)??void 0;Ge("reports_start_diagnostic_submitted",{organization_id:r.id,domain:I});try{await p.mutateAsync(R.value)}catch(D){const O=D;Ge("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:Ll.agents,params:{org:r.slug,panel:void 0},search:{virtualmcpid:Xl(r.id).id,connect:"1",siteUrl:R.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=p,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=E=>{E.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const v=b;let _;e[15]!==n?(_=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=_):_=e[16];let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=E=>u(E.target.value),e[17]=y):y=e[17];let L;e[18]!==n?(L=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=L):L=e[19];const w=!!h;let S;e[20]!==p.isPending||e[21]!==d||e[22]!==_||e[23]!==L||e[24]!==w?(S=o.jsx(vt,{"aria-label":_,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:y,placeholder:L,"aria-invalid":w,disabled:p.isPending}),e[20]=p.isPending,e[21]=d,e[22]=_,e[23]=L,e[24]=w,e[25]=S):S=e[25];let k;e[26]!==p.isPending||e[27]!==n?(k=p.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=p.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]!==p.isPending||e[31]!==k?(C=o.jsxs(fe,{type:"submit",className:"shrink-0",disabled:p.isPending,children:[k,j]}),e[30]=p.isPending,e[31]=k,e[32]=C):C=e[32];let T;e[33]!==S||e[34]!==C?(T=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]=T):T=e[35];let N;e[36]!==h||e[37]!==n?(N=h?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:jP(n,h)}):null,e[36]=h,e[37]=n,e[38]=N):N=e[38];let P;e[39]!==v||e[40]!==T||e[41]!==N?(P=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:v,children:[T,N]}),e[39]=v,e[40]=T,e[41]=N,e[42]=P):P=e[42];let V;return e[43]!==s||e[44]!==P?(V=o.jsx(Ck,{claimedSiteUrl:s,children:P}),e[43]=s,e[44]=P,e[45]=V):V=e[45],V}function qle(t){return[Dd.SELF(t),Dd.REGISTRY(t),Dd.COMMUNITY_REGISTRY(t),Dd.DEV_ASSETS(t)]}function Gle(t,e){const s=new Set(qle(e));return t.some(n=>!s.has(n.id))}function Yle(){const t=F.c(78),e=le(),{org:s}=He(),n=Ni();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"mcp-github"},t[0]=i):i=t[0];const r=Ni(i),{projects:l}=Hu(),a=Zf();let c;t[1]!==s.slug?(c={org:s.slug},t[1]=s.slug,t[2]=c):c=t[2];const d=c;let u;t[3]!==e?(u=e("discover.setup.connectTitle"),t[3]=e,t[4]=u):u=t[4];let h;t[5]!==e?(h=e("discover.setup.connectBody"),t[5]=e,t[6]=h):h=t[6];let f;t[7]!==n||t[8]!==s.id?(f=Gle(n,s.id),t[7]=n,t[8]=s.id,t[9]=f):f=t[9];let m;t[10]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(El,{size:18}),t[10]=m):m=t[10];let p;t[11]===Symbol.for("react.memo_cache_sentinel")?(p={tab:"all"},t[11]=p):p=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(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(yl,{to:"/$org/settings/connections",params:d,search:p,children:g})}),t[14]=d,t[15]=g,t[16]=x):x=t[16];let b;t[17]!==u||t[18]!==h||t[19]!==f||t[20]!==x?(b={key:"connect",title:u,body:h,done:f,icon:m,action:x},t[17]=u,t[18]=h,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 _;t[24]!==e?(_=e("discover.setup.githubBody"),t[24]=e,t[25]=_):_=t[25];const y=r.length>0;let L;t[26]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(mn,{className:"size-[18px]"}),t[26]=L):L=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(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(yl,{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]!==_||t[35]!==y||t[36]!==k?(j={key:"github",title:v,body:_,done:y,icon:L,action:k},t[33]=v,t[34]=_,t[35]=y,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 T;t[40]!==e?(T=e("discover.setup.projectBody"),t[40]=e,t[41]=T):T=t[41];const N=l.length>0;let P;t[42]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(Gt,{size:18}),t[42]=P):P=t[42];let V;t[43]!==s.slug?(V={org:s.slug,panel:void 0},t[43]=s.slug,t[44]=V):V=t[44];let E;t[45]===Symbol.for("react.memo_cache_sentinel")?(E={virtualmcpid:void 0},t[45]=E):E=t[45];let R;t[46]!==e?(R=e("discover.setup.projectAction"),t[46]=e,t[47]=R):R=t[47];let I;t[48]!==V||t[49]!==R?(I=o.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(yl,{to:Ll.agents,params:V,search:E,children:R})}),t[48]=V,t[49]=R,t[50]=I):I=t[50];let D;t[51]!==C||t[52]!==T||t[53]!==N||t[54]!==I?(D={key:"project",title:C,body:T,done:N,icon:P,action:I},t[51]=C,t[52]=T,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 $;t[58]!==e?($=e("discover.setup.inviteBody"),t[58]=e,t[59]=$):$=t[59];let M;t[60]!==a.data?.data?.members?(M=a.data?.data?.members??[],t[60]=a.data?.data?.members,t[61]=M):M=t[61];const z=M.length>1;let B;t[62]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(n9,{size:18}),t[62]=B):B=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(fe,{asChild:!0,variant:"outline",size:"sm",children:o.jsx(yl,{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]!==$||t[70]!==z||t[71]!==H?(W={key:"invite",title:O,body:$,done:z,icon:B,action:H},t[68]=O,t[69]=$,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 Jle(){const t=F.c(51),e=le(),{projects:s}=Hu();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={slug:"mcp-github"},t[0]=n):n=t[0];const i=Ni(n),r=e9();let l;t[1]!==s?(l=s.some(Xle),t[1]=s,t[2]=l):l=t[2];const a=l;let c;t[3]!==s?(c=s.some(Qle),t[3]=s,t[4]=c):c=t[4];const d=c;let u;if(t[5]!==r||t[6]!==s){let V;t[8]!==r?(V=E=>zu(r.data?.configs??[],Q2(E)),t[8]=r,t[9]=V):V=t[9],u=s.some(V),t[5]=r,t[6]=s,t[7]=u}else u=t[7];const h=u;let f;t[10]!==e?(f=e("discover.capabilities.previewTitle"),t[10]=e,t[11]=f):f=t[11];let m;t[12]!==e?(m=e("discover.capabilities.previewRequirement"),t[12]=e,t[13]=m):m=t[13];let p;t[14]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Vi,{size:18}),t[14]=p):p=t[14];let g;t[15]!==a||t[16]!==f||t[17]!==m?(g={key:"preview",title:f,requirement:m,satisfied:a,icon:p},t[15]=a,t[16]=f,t[17]=m,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&&a;let _;t[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(mn,{className:"size-[18px]"}),t[23]=_):_=t[23];let y;t[24]!==v||t[25]!==x||t[26]!==b?(y={key:"git",title:x,requirement:b,satisfied:v,icon:_},t[24]=v,t[25]=x,t[26]=b,t[27]=y):y=t[27];let L;t[28]!==e?(L=e("discover.capabilities.contentTitle"),t[28]=e,t[29]=L):L=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(Vi,{size:18}),t[32]=S):S=t[32];let k;t[33]!==d||t[34]!==L||t[35]!==w?(k={key:"content",title:L,requirement:w,satisfied:d,icon:S},t[33]=d,t[34]=L,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 T;t[41]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(ki,{size:18}),t[41]=T):T=t[41];let N;t[42]!==h||t[43]!==j||t[44]!==C?(N={key:"assets",title:j,requirement:C,satisfied:h,icon:T},t[42]=h,t[43]=j,t[44]=C,t[45]=N):N=t[45];let P;return t[46]!==y||t[47]!==k||t[48]!==N||t[49]!==g?(P=[g,y,k,N],t[46]=y,t[47]=k,t[48]=N,t[49]=g,t[50]=P):P=t[50],P}function Qle(t){return!!io(t)&&e0(t.metadata?.ui?.layout)!=="off"}function Xle(t){return io(t)}function F1(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 l;e[2]!==n?(l=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:n}),e[2]=n,e[3]=l):l=e[3];let a;e[4]!==r||e[5]!==l?(a=o.jsxs("div",{className:"flex flex-col gap-1",children:[r,l]}),e[4]=r,e[5]=l,e[6]=a):a=e[6];let c;return e[7]!==i||e[8]!==a?(c=o.jsxs("section",{className:"flex flex-col gap-3",children:[a,i]}),e[7]=i,e[8]=a,e[9]=c):c=e[9],c}function Zle(){const t=F.c(63),e=le(),{org:s}=He(),n=Yle(),i=Jle();let r;t[0]!==n?(r=n.filter(sae),t[0]=n,t[1]=r):r=t[1];const l=r;let a;t[2]!==e?(a=e("discover.title"),t[2]=e,t[3]=a):a=t[3];let c;t[4]!==a?(c=o.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a}),t[4]=a,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 u;t[8]!==d?(u=o.jsx("p",{className:"max-w-prose text-sm text-muted-foreground",children:d}),t[8]=d,t[9]=u):u=t[9];let h;t[10]!==c||t[11]!==u?(h=o.jsxs("header",{className:"flex flex-col gap-2",children:[c,u]}),t[10]=c,t[11]=u,t[12]=h):h=t[12];let f;t[13]!==e?(f=e("discover.setup.title"),t[13]=e,t[14]=f):f=t[14];let m;t[15]!==l.length||t[16]!==e?(m=l.length===0?e("discover.setup.allDone"):e("discover.setup.description"),t[15]=l.length,t[16]=e,t[17]=m):m=t[17];let p;t[18]!==n?(p=n.map(tae),t[18]=n,t[19]=p):p=t[19];let g;t[20]!==p?(g=o.jsx("ul",{className:"flex flex-col gap-2",children:p}),t[20]=p,t[21]=g):g=t[21];let x;t[22]!==f||t[23]!==m||t[24]!==g?(x=o.jsx(F1,{title:f,description:m,children:g}),t[22]=f,t[23]=m,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 _;if(t[30]!==i||t[31]!==e){let E;t[33]!==e?(E=R=>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",R.satisfied?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:R.satisfied?o.jsx($t,{size:18}):R.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:R.title}),o.jsx("span",{className:"text-sm text-muted-foreground",children:R.satisfied?e("discover.capabilities.ready"):R.requirement})]})]},R.key),t[33]=e,t[34]=E):E=t[34],_=i.map(E),t[30]=i,t[31]=e,t[32]=_}else _=t[32];let y;t[35]!==_?(y=o.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:_}),t[35]=_,t[36]=y):y=t[36];let L;t[37]!==b||t[38]!==v||t[39]!==y?(L=o.jsx(F1,{title:b,description:v,children:y}),t[37]=b,t[38]=v,t[39]=y,t[40]=L):L=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 T;t[50]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(gr,{size:18}),t[50]=T):T=t[50];let N;t[51]!==k||t[52]!==C?(N=o.jsx("div",{children:o.jsx(fe,{asChild:!0,size:"lg",children:o.jsxs(yl,{to:"/$org/settings/connections",params:k,search:j,onClick:eae,children:[C,T]})})}),t[51]=k,t[52]=C,t[53]=N):N=t[53];let P;t[54]!==w||t[55]!==S||t[56]!==N?(P=o.jsx(F1,{title:w,description:S,children:N}),t[54]=w,t[55]=S,t[56]=N,t[57]=P):P=t[57];let V;return t[58]!==x||t[59]!==L||t[60]!==P||t[61]!==h?(V=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:[h,x,L,P]})}),t[58]=x,t[59]=L,t[60]=P,t[61]=h,t[62]=V):V=t[62],V}function eae(){return Ge("discover_catalog_opened",{})}function tae(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($t,{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 sae(t){return!t.done}function nae(t){const e=F.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,l=le();let a;e[0]!==s?(a=new URL(s,window.location.origin).toString(),e[0]=s,e[1]=a):a=e[1];const c=a;let d;e[2]!==n||e[3]!==l?(d=n.deckDetected&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList"),onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(Ry,{size:14})})}),o.jsx(We,{side:"bottom",children:n.railOpen?l("deck.deckToolbar.hideSlideList"):l("deck.deckToolbar.showSlideList")})]}),e[2]=n,e[3]=l,e[4]=d):d=e[4];let u;e[5]!==c?(u=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=u):u=e[6];let h;e[7]!==c?(h=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=h):h=e[8];let f;e[9]!==c||e[10]!==u||e[11]!==h?(f=o.jsx("button",{type:"button",onClick:u,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:h}),e[9]=c,e[10]=u,e[11]=h,e[12]=f):f=e[12];let m;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==l?(m=n.agentUpdated&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(On,{size:12}),l("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(We,{side:"bottom",children:l("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=l,e[16]=m):m=e[16];let p;e[17]!==n.saving||e[18]!==l?(p=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:l("deck.deckToolbar.saving")}),e[17]=n.saving,e[18]=l,e[19]=p):p=e[19];let g;e[20]!==n||e[21]!==l?(g=n.deckDetected&&n.writable&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInline"),className:re(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(T6,{size:14})})}),o.jsx(We,{side:"bottom",children:n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInlineTooltip")})]}),e[20]=n,e[21]=l,e[22]=g):g=e[22];let x;e[23]!==c||e[24]!==i||e[25]!==n.deckDetected||e[26]!==l?(x=n.deckDetected?o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),children:o.jsx(bu,{size:14})})}),o.jsxs(Kt,{align:"end",children:[o.jsxs(Je,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(gT,{size:14}),l("deck.deckToolbar.exportAsPdf")]}),o.jsx(Je,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(Wf,{size:14}),l("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx(bu,{size:14})})})}),o.jsx(We,{side:"bottom",children:l("deck.deckToolbar.download")})]}),e[23]=c,e[24]=i,e[25]=n.deckDetected,e[26]=l,e[27]=x):x=e[27];let b;e[28]!==l?(b=l("deck.deckToolbar.openInNewTab"),e[28]=l,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 _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(fn,{size:14}),e[32]=_):_=e[32];let y;e[33]!==b||e[34]!==v?(y=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":b,onClick:v,children:_})}),e[33]=b,e[34]=v,e[35]=y):y=e[35];let L;e[36]!==l?(L=l("deck.deckToolbar.openInNewTab"),e[36]=l,e[37]=L):L=e[37];let w;e[38]!==L?(w=o.jsx(We,{side:"bottom",children:L}),e[38]=L,e[39]=w):w=e[39];let S;e[40]!==y||e[41]!==w?(S=o.jsxs(qe,{children:[y,w]}),e[40]=y,e[41]=w,e[42]=S):S=e[42];let k;return e[43]!==S||e[44]!==d||e[45]!==f||e[46]!==m||e[47]!==p||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,m,p,g,x,S,r]}),e[43]=S,e[44]=d,e[45]=f,e[46]=m,e[47]=p,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const xc=1;function iae(t){if(typeof t!="object"||t===null||t.v!==xc||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 Ao extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function Nk(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function rae(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?Nk(s).length:null}function oae(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new Ao("no <deck-viewer> element in source","no-viewer");const i=Nk(n),r=e.kind==="move"?e.from:e.at,l=i[r];if(!l)throw new Ao(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new Ao("cannot remove the last slide","bad-op");l.remove();break}case"duplicate":{const c=l.cloneNode(!0);c.removeAttribute("id");for(const d of c.querySelectorAll("[id]"))d.removeAttribute("id");l.after(c);break}case"move":{if(e.to<0||e.to>=i.length)throw new Ao(`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(l,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new Ao(`invalid attribute name: ${e.name}`,"bad-op");l.setAttribute(e.name,e.value);break}case"remove-attr":{l.removeAttribute(e.name);break}case"replace":{const d=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!d)throw new Ao("replace html has no root element","bad-op");l.replaceWith(s.importNode(d,!0));break}default:throw new Ao(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
647
647
  `:""}${s.documentElement.outerHTML}
648
648
  `}const ov="home",lae=400,aae=800;function cae(t){const e=t.savePath!==void 0,{org:s}=He(),n=Ns(),i=G6(ov),[r,l]=A.useState(!1),[a,c]=A.useState(!1),[d,u]=A.useState(!1),[h,f]=A.useState(!1),[m,p]=A.useState(!1),[g,x]=A.useState(!1),[b,v]=A.useState(null),[_,y]=A.useState(null),[L,w]=A.useState(0),[S]=A.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),k=r||g||m,j=()=>{t.savePath!==void 0&&(n.invalidateQueries({queryKey:tt.orgFsStat(s.id,ov,t.savePath)}),n.invalidateQueries({queryKey:tt.orgFsRecent(s.id)}))},C=M=>{S.iframe?.contentWindow?.postMessage(M,"*")},T=()=>{S.source=null,f(!1),_&&v(_),w(M=>M+1),j()};t.statMarker!==_&&(y(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}p(!0);try{const z=await i.mutateAsync({path:t.savePath,body:M});S.selfMarkers.add(U2(z)),j()}catch(z){console.error("[deck-editor] save failed",z),ve.error("Couldn't save deck edits — reloading the preview."),I.current.reload()}finally{p(!1),x(!1)}},P=M=>{x(!0),S.saveTimer&&clearTimeout(S.saveTimer),S.saveTimer=setTimeout(()=>{I.current.flushSave()},M)},V=(M,z,B)=>{C({v:xc,type:"ack",opId:M,ok:z,error:B})},E=async M=>{if(!e){V(M.opId,!1,"read-only preview");return}try{if(S.source===null){const B=await fetch(t.readUrl,{credentials:"include"});if(!B.ok)throw new Error(`HTTP ${B.status}`);S.source=await B.text()}const z=rae(S.source);if(z===null||z!==M.witness.childCount)throw new Ao(`slide count drifted (source ${z}, iframe ${M.witness.childCount})`,"stale-index");S.source=oae(S.source,M.op),V(M.opId,!0),P(M.op.kind==="replace"?aae:lae)}catch(z){console.error("[deck-editor] op failed",M.op,z),V(M.opId,!1,z instanceof Error?z.message:String(z)),ve.error("That edit couldn't be saved — reloading the preview."),I.current.reload()}},R=M=>{if(!S.iframe||M.source!==S.iframe.contentWindow)return;const z=iae(M.data);if(z){if(z.type==="ready"){c(!0),I.current.editMode?C({v:xc,type:"set-edit-mode",enabled:!0}):I.current.railOpen&&C({v:xc,type:"set-rail",open:!0});return}z.type==="op"&&(S.queue=S.queue.then(()=>I.current.handleOp(z)).catch(()=>{}))}},I=A.useRef({onMessage:R,handleOp:E,flushSave:N,reload:T,editMode:r,railOpen:d});I.current={onMessage:R,handleOp:E,flushSave:N,reload:T,editMode:r,railOpen:d};const[D]=A.useState(()=>{let M=null;return z=>{if(z){S.iframe=z;const B=U=>I.current.onMessage(U);window.addEventListener("message",B),M=()=>window.removeEventListener("message",B)}else M?.(),M=null,S.iframe=null}}),O=M=>{u(M),C({v:xc,type:"set-rail",open:M})},$=M=>{l(M),C({v:xc,type:"set-edit-mode",enabled:M}),M&&u(!0),!M&&h&&!g&&!m&&T()};return{iframeRef:D,deckDetected:a,writable:e,displayedMarker:b===null?null:`${b}.${L}`,editMode:r,setEditMode:$,railOpen:d,setRailOpen:O,saving:m,agentUpdated:h,reload:T,postToIframe:C}}const dae=300;function Vk({readUrl:t,marker:e,title:s,savePath:n,trailing:i}){const r=cae({readUrl:t,statMarker:e,savePath:n}),[l,a]=A.useState(null);if(r.displayedMarker===null)return null;const c=t.includes("?")?"&":"?",d=`${t}${c}v=${encodeURIComponent(r.displayedMarker)}`,u=l===d;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(nae,{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:()=>a(d),sandbox:"allow-scripts allow-downloads",className:re("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",u?"opacity-100":"opacity-0"),style:{transitionDuration:`${dae}ms`},title:s},d)})]})}const uae=[{mode:"private",labelKey:"library.fileShareButton.modeOrgOnly",Icon:Kc},{mode:"public",labelKey:"library.fileShareButton.modePublic",Icon:zn},{mode:"password",labelKey:"library.fileShareButton.modePassword",Icon:t9}];function Tk(t){const e=F.c(56),{volume:s,path:n,kind:i,shareMode:r,effectivePublic:l,url:a}=t,c=le(),d=dA(s),{data:u}=H2(s,n),h=u?.shareMode??r,m=(u?.effectivePublic??l)&&h==="private",p=i==="dir",g=p?"folder":"file",[x,b]=A.useState(!1),[v,_]=A.useState(""),[y,L]=A.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),_(""),ve.success(M==="private"?c("library.fileShareButton.toastOrgOnly",{subject:g}):M==="public"?c("library.fileShareButton.toastPublic",{subject:g}):c("library.fileShareButton.toastPassword",{subject:g}))},onError:B=>ve.error(B instanceof Error?B.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":h;let T;e[7]!==c||e[8]!==a?(T=async()=>{a&&(await navigator.clipboard.writeText(a),L(!0),ve.success(c("library.fileShareButton.linkCopied")),setTimeout(()=>L(!1),2e3))},e[7]=c,e[8]=a,e[9]=T):T=e[9];const N=T;let P;e[10]!==y||e[11]!==N||e[12]!==c||e[13]!==a?(P=a?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:a}),o.jsx(fe,{variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:N,"aria-label":c("library.fileShareButton.copyLink"),children:y?o.jsx($t,{size:12,className:"text-success"}):o.jsx(hn,{size:12})})]}):null,e[10]=y,e[11]=N,e[12]=c,e[13]=a,e[14]=P):P=e[14];const V=P;if(m){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(zn,{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 B;e[18]!==z?(B=o.jsx("span",{className:"text-sm font-medium text-foreground",children:z}),e[18]=z,e[19]=B):B=e[19];const U=p?"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]!==B?(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:[B,W]})]}),e[25]=W,e[26]=B,e[27]=K):K=e[27];let Q;return e[28]!==V||e[29]!==K?(Q=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[K,V]}),e[28]=V,e[29]=K,e[30]=Q):Q=e[30],Q}let E;e[31]!==C||e[32]!==j||e[33]!==d.isPending||e[34]!==c?(E=uae.map(M=>{const{mode:z,labelKey:B,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(B)]},z)}),e[31]=C,e[32]=j,e[33]=d.isPending,e[34]=c,e[35]=E):E=e[35];let R;e[36]!==E?(R=o.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg bg-muted p-1",children:E}),e[36]=E,e[37]=R):R=e[37];let I;e[38]!==C||e[39]!==p||e[40]!==c?(I=C==="private"?c("library.fileShareButton.privateDescription",{target:p?"these files":"this link"}):C==="public"?c(p?"library.fileShareButton.publicFolderDescription":"library.fileShareButton.publicFileDescription"):c("library.fileShareButton.passwordDescription",{target:p?"files in this folder":"this file"}),e[38]=C,e[39]=p,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]!==h||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=>_(M.target.value),placeholder:c(h==="password"?"library.fileShareButton.newPasswordPlaceholder":"library.fileShareButton.passwordPlaceholder"),autoComplete:"new-password",className:"h-8 text-xs"}),o.jsx(fe,{type:"submit",size:"sm",className:"shrink-0",disabled:!v||d.isPending,children:c(h==="password"?"library.fileShareButton.buttonUpdate":"library.fileShareButton.buttonSet")})]}),e[44]=C,e[45]=S,e[46]=h,e[47]=v,e[48]=d.isPending,e[49]=c,e[50]=O):O=e[50];let $;return e[51]!==V||e[52]!==R||e[53]!==D||e[54]!==O?($=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[R,D,O,V]}),e[51]=V,e[52]=R,e[53]=D,e[54]=O,e[55]=$):$=e[55],$}function pp(t){const e=F.c(21),{volume:s,path:n,shareMode:i,effectivePublic:r,url:l}=t,a=le();let c;e[0]!==a?(c=a("library.fileShareButton.share"),e[0]=a,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(_A,{size:14}),e[2]=d):d=e[2];let u;e[3]!==c?(u=o.jsx(Ke,{asChild:!0,children:o.jsx(os,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":c,children:d})})}),e[3]=c,e[4]=u):u=e[4];let h;e[5]!==a?(h=a("library.fileShareButton.share"),e[5]=a,e[6]=h):h=e[6];let f;e[7]!==h?(f=o.jsx(We,{side:"bottom",children:h}),e[7]=h,e[8]=f):f=e[8];let m;e[9]!==u||e[10]!==f?(m=o.jsxs(qe,{children:[u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11];let p;e[12]!==r||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==s?(p=o.jsx(as,{align:"end",className:"w-80 p-3",children:o.jsx(Tk,{volume:s,path:n,kind:"file",shareMode:i,effectivePublic:r,url:l})}),e[12]=r,e[13]=n,e[14]=i,e[15]=l,e[16]=s,e[17]=p):p=e[17];let g;return e[18]!==m||e[19]!==p?(g=o.jsxs(cs,{children:[m,p]}),e[18]=m,e[19]=p,e[20]=g):g=e[20],g}function hae(t){const e=F.c(14),{target:s,onOpenChange:n}=t,i=le(),r=!!s,l=s?.kind==="dir"?"folder":"file";let a;e[0]!==i||e[1]!==l?(a=i("library.fileShareButton.shareDialogTitle",{type:l}),e[0]=i,e[1]=l,e[2]=a):a=e[2];let c;e[3]!==a?(c=o.jsx(ds,{children:o.jsx(qt,{children:a})}),e[3]=a,e[4]=c):c=e[4];let d;e[5]!==s?(d=s&&o.jsx(Tk,{...s}),e[5]=s,e[6]=d):d=e[6];let u;e[7]!==c||e[8]!==d?(u=o.jsxs(Bt,{className:"sm:max-w-md",children:[c,d]}),e[7]=c,e[8]=d,e[9]=u):u=e[9];let h;return e[10]!==n||e[11]!==r||e[12]!==u?(h=o.jsx(zt,{open:r,onOpenChange:n,children:u}),e[10]=n,e[11]=r,e[12]=u,e[13]=h):h=e[13],h}const U1="home";function fae(t){const e=F.c(5),{label:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(tn,{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 mae(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=H2(U1,s,n),r=F2(U1)(s);if(i.isPending||!i.data){const f=!i.isPending&&!i.data?"Waiting for the deck to sync…":void 0;let m;return e[1]!==f?(m=o.jsx(fae,{label:f}),e[1]=f,e[2]=m):m=e[2],m}let l;e[3]!==i.data?(l=U2(i.data),e[3]=i.data,e[4]=l):l=e[4];const a=i.data.shareMode??"private",c=i.data.effectivePublic??!1,d=window.location.origin+r;let u;e[5]!==s||e[6]!==a||e[7]!==c||e[8]!==d?(u=o.jsx(pp,{volume:U1,path:s,shareMode:a,effectivePublic:c,url:d}),e[5]=s,e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9];let h;return e[10]!==s||e[11]!==r||e[12]!==l||e[13]!==u?(h=o.jsx(Vk,{readUrl:r,marker:l,title:s,savePath:s,trailing:u}),e[10]=s,e[11]=r,e[12]=l,e[13]=u,e[14]=h):h=e[14],h}function pae(t){const e=F.c(13),{previewPath:s}=t,n=le(),i=rn(),r=il({strict:!1}).org??"";let l;e[0]!==s?(l=s.split("/").slice(0,-1).join("/"),e[0]=s,e[1]=l):l=e[1];const a=l;let c;e[2]!==i||e[3]!==r||e[4]!==a||e[5]!==s?(c=()=>{i({to:Ll.library,params:{org:r},search:{path:a||void 0,preview:s}})},e[2]=i,e[3]=r,e[4]=a,e[5]=s,e[6]=c):c=e[6];const d=c;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Go,{size:14}),e[7]=u):u=e[7];let h;e[8]!==n?(h=n("library.seeInLibrary.label"),e[8]=n,e[9]=h):h=e[9];let f;return e[10]!==d||e[11]!==h?(f=o.jsxs(fe,{variant:"ghost",size:"sm",onClick:d,className:"shrink-0 gap-1.5 text-xs text-muted-foreground",children:[u,h]}),e[10]=d,e[11]=h,e[12]=f):f=e[12],f}const gae=t=>/\.html?$/i.test(t);function lv(t){const e=F.c(10),{onClose:s}=t,n=le();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(ji,{size:14}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",onClick:s,children:i})}),e[1]=s,e[2]=r):r=e[2];let l;e[3]!==n?(l=n("library.previewContent.close"),e[3]=n,e[4]=l):l=e[4];let a;e[5]!==l?(a=o.jsx(We,{side:"bottom",children:l}),e[5]=l,e[6]=a):a=e[6];let c;return e[7]!==r||e[8]!==a?(c=o.jsxs(qe,{children:[r,a]}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c}function Ak(t){const e=F.c(67),{previewPath:s,onClose:n,showSeeInLibrary:i,variant:r}=t,l=i===void 0?!1:i,a=le();let c;e[0]!==s?(c=Z2(s),e[0]=s,e[1]=c):c=e[1];const d=c,{volume:u,dirPath:h}=d,{data:f,isPending:m}=H2(u,h),p=F2(u??"");let g,x,b,v,_,y,L,w,S;if(e[2]!==p||e[3]!==f||e[4]!==h||e[5]!==n||e[6]!==s||e[7]!==l||e[8]!==r||e[9]!==u){S=Symbol.for("react.early_return_sentinel");e:{x=cn(h),b=r==="dialog";let V;e[19]!==s||e[20]!==l?(V=l?o.jsx(pae,{previewPath:s}):null,e[19]=s,e[20]=l,e[21]=V):V=e[21];const E=V;if(g=f&&f.kind==="file"?{key:s,filename:x,size:f.size,downloadUrl:p(f.path)}:null,g&&f&&gae(x)){const I=g.downloadUrl;let D;e[22]!==f?(D=U2(f),e[22]=f,e[23]=D):D=e[23];const O=u??"",$=f.shareMode??"private",M=f.effectivePublic??!1,z=window.location.origin+g.downloadUrl;let B;e[24]!==h||e[25]!==O||e[26]!==$||e[27]!==M||e[28]!==z?(B=o.jsx(pp,{volume:O,path:h,shareMode:$,effectivePublic:M,url:z}),e[24]=h,e[25]=O,e[26]=$,e[27]=M,e[28]=z,e[29]=B):B=e[29];let U;e[30]!==b||e[31]!==n?(U=b?o.jsx("div",{className:"w-8 shrink-0"}):o.jsx(lv,{onClose:n}),e[30]=b,e[31]=n,e[32]=U):U=e[32];let H;e[33]!==E||e[34]!==B||e[35]!==U?(H=o.jsxs(o.Fragment,{children:[B,E,U]}),e[33]=E,e[34]=B,e[35]=U,e[36]=H):H=e[36],S=o.jsxs(o.Fragment,{children:[b&&o.jsx(qt,{className:"sr-only",children:x}),o.jsx(Vk,{readUrl:I,marker:D,title:x,savePath:u==="home"?h:void 0,trailing:H},s)]});break e}const R=b?"h-11 py-1 pr-12 pl-2":"h-9 px-2";e[37]!==R?(w=re("flex shrink-0 items-center gap-1 border-b border-border/60",R),e[37]=R,e[38]=w):w=e[38],v="flex min-w-0 flex-1 items-center gap-2 px-2",_=o.jsx(Yo,{filename:x,className:"h-4.5 w-3.5 shrink-0"}),y=b?o.jsx(qt,{className:"truncate text-xs font-medium text-foreground",children:x}):o.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:x}),L=g&&o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:t8(g.size)})}e[2]=p,e[3]=f,e[4]=h,e[5]=n,e[6]=s,e[7]=l,e[8]=r,e[9]=u,e[10]=g,e[11]=x,e[12]=b,e[13]=v,e[14]=_,e[15]=y,e[16]=L,e[17]=w,e[18]=S}else g=e[10],x=e[11],b=e[12],v=e[13],_=e[14],y=e[15],L=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]!==_||e[41]!==y||e[42]!==L?(k=o.jsxs("div",{className:v,children:[_,y,L]}),e[39]=v,e[40]=_,e[41]=y,e[42]=L,e[43]=k):k=e[43];let j;e[44]!==f?.effectivePublic||e[45]!==f?.shareMode||e[46]!==g||e[47]!==h||e[48]!==a||e[49]!==u?(j=g&&o.jsxs(o.Fragment,{children:[o.jsx(pp,{volume:u??"",path:h,shareMode:f?.shareMode??"private",effectivePublic:f?.effectivePublic??!1,url:window.location.origin+g.downloadUrl}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",asChild:!0,children:o.jsx("a",{href:g.downloadUrl,download:g.filename,children:o.jsx(bu,{size:14})})})}),o.jsx(We,{side:"bottom",children:a("library.previewContent.download")})]}),o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>window.open(g.downloadUrl,"_blank","noopener"),children:o.jsx(fn,{size:14})})}),o.jsx(We,{side:"bottom",children:a("library.previewContent.openInNewTab")})]})]}),e[44]=f?.effectivePublic,e[45]=f?.shareMode,e[46]=g,e[47]=h,e[48]=a,e[49]=u,e[50]=j):j=e[50];let C;e[51]!==b||e[52]!==n?(C=!b&&o.jsx(lv,{onClose:n}),e[51]=b,e[52]=n,e[53]=C):C=e[53];let T;e[54]!==j||e[55]!==C||e[56]!==w||e[57]!==k?(T=o.jsxs("div",{className:w,children:[k,j,C]}),e[54]=j,e[55]=C,e[56]=w,e[57]=k,e[58]=T):T=e[58];let N;e[59]!==g||e[60]!==x||e[61]!==m||e[62]!==a?(N=o.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:g?o.jsx(e8,{file:g}):m?o.jsx(Z6,{}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[o.jsx(Yo,{filename:x,className:"h-7.5 w-6"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:a("library.previewContent.fileNotAvailable")})]})}),e[59]=g,e[60]=x,e[61]=m,e[62]=a,e[63]=N):N=e[63];let P;return e[64]!==T||e[65]!==N?(P=o.jsxs(o.Fragment,{children:[T,N]}),e[64]=T,e[65]=N,e[66]=P):P=e[66],P}function xae(t){const e=F.c(4),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;return e[0]!==n||e[1]!==s||e[2]!==r?(l=o.jsx("div",{className:"flex h-full w-full flex-col bg-background",children:o.jsx(Ak,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"panel"})}),e[0]=n,e[1]=s,e[2]=r,e[3]=l):l=e[3],l}function bae(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 l;return e[2]!==r||e[3]!==s?(l=o.jsx(xae,{previewPath:s,onClose:r,showSeeInLibrary:!0}),e[2]=r,e[3]=s,e[4]=l):l=e[4],l}function vae(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"),l=t("library.brandComponentsPreview.ghostButton"),a=t("library.brandComponentsPreview.successBadge"),c=t("library.brandComponentsPreview.warningBadge"),d=t("library.brandComponentsPreview.errorBadge"),u=t("library.brandComponentsPreview.infoBadge"),h=t("library.brandComponentsPreview.allChip"),f=t("library.brandComponentsPreview.incomeChip"),m=t("library.brandComponentsPreview.spendingChip"),p=t("library.brandComponentsPreview.emailPlaceholder");return`
649
649
  <div class="stack">
@@ -805,7 +805,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
805
805
  <p class="cta">slides-create --theme &hellip;</p>
806
806
  </section>`].join(`
807
807
 
808
- `);function kae(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Sae).replaceAll("{{title}}",wae).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function jae(t){const e=F.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=xu(s),l=xu(i??"");if(r.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(tn,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(r.isError||!r.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[1],u}const a=l.data??null;let c;e[2]!==a||e[3]!==r.data?(c=kae(r.data,a),e[2]=a,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 Ud(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 Cae(t){const e=F.c(16),{family:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;let a;e[0]!==s?(a=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let h;e[7]!==i||e[8]!==l||e[9]!==r?(h=f=>{const m=r(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?o.jsx("input",{type:"color","aria-label":f.name,title:p,value:AP(m),onChange:g=>l(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:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=i,e[8]=l,e[9]=r,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,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 u;return e[13]!==a||e[14]!==d?(u=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Nae(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 l;return e[6]!==r?(l=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]=l):l=e[7],l}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 Pk(t){const e=F.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let l;e[0]!==s||e[1]!==n?(l=o.jsx(Nae,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=/^--brand-/,e[5]=h):h=e[5],a=s.name.replace(h,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,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:h=>r(s.name,h.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 u;return e[13]!==l||e[14]!==c||e[15]!==d?(u=o.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],u}function Cd(t){const e=F.c(16),{label:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=o.jsx(Ud,{children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let h;e[7]!==i||e[8]!==l||e[9]!==r?(h=f=>o.jsx(Pk,{token:f,value:r(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=r,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,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 u;return e[13]!==a||e[14]!==d?(u=o.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Vae({brandPath:t,onClose:e,variant:s}){const n=le(),{org:i}=He(),r=Z2(t),l=r.volume??"",a=r.dirPath,c=cn(a),d=r.readOnly,u=Ns(),h=Ku(),f=G6(l),{upload:m,remove:p}=gu(l),g=A.useRef(null),x=Y6(l,a),b=x.data??[],v=G=>b.some(me=>me.kind==="file"&&cn(me.path)===G),_=v("tokens.css"),y=v("brand.md"),L=v("slides-theme.html"),w=CP(b),S=h(l,`${a}/tokens.css`),k=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),C=xu(S,{enabled:_}),T=xu(k,{enabled:y}),[N,P]=A.useState(!1),[V,E]=A.useState({}),[R,I]=A.useState(null),[D,O]=A.useState(!1),[$,M]=A.useState(!1),[z,B]=A.useState("deck"),U=C.data?NP(C.data):[],H=G=>U.find(me=>me.name===G)?.value,W=G=>V[G.name]??G.value,K=VP(U),Q=U.filter(G=>G.kind==="font"),X=U.filter(G=>G.kind==="type"),se=U.filter(G=>G.kind==="space"),ne=U.filter(G=>G.kind==="radius"),te=U.filter(G=>G.kind==="shadow"),ee=U.filter(G=>G.kind==="motion"),Y=U.filter(G=>G.kind==="other"),q=(G,me)=>E(ye=>({...ye,[G]:me})),oe=L&&z==="deck",J=R??T.data??"",ie=Object.entries(V).filter(([G,me])=>H(G)!==me),Z=R!==null&&R!==(T.data??""),he=ie.length>0||Z;function de(){E({}),I(null),P(!1)}async function ae(){O(!0);try{if(ie.length>0){let G=C.data??"";for(const[me,ye]of ie)G=TP(G,me,ye);await f.mutateAsync({path:`${a}/tokens.css`,body:G,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:tt.fileText(S)})}Z&&R!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:R,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:tt.fileText(k)})),u.invalidateQueries({queryKey:tt.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:tt.orgFsRecent(i.id)}),E({}),I(null),P(!1),ve.success(n("library.brandPreview.brandSaved"))}catch(G){ve.error(G instanceof Error?G.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function ce(G){const me=G?.[0];if(!me)return;const we=`logo.${(me.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([me],we,{type:me.type})]}),w&&cn(w)!==we&&await p.mutateAsync(w),ve.success(n("library.brandPreview.logoUpdated"))}catch(Ne){ve.error(Ne instanceof Error?Ne.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ue=!x.isPending&&!_&&!y&&!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(km,{size:18})}),s==="dialog"?o.jsx(qt,{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(fe,{variant:"ghost",size:"sm",onClick:de,disabled:D,children:n("library.brandPreview.cancel")}),o.jsx(fe,{size:"sm",disabled:!he||D,onClick:()=>{ae()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>P(!0),children:[o.jsx(xT,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(lV,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(Ks,{size:16})})}):o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(Ks,{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(tn,{className:"h-40 w-full rounded-xl"}),o.jsx(tn,{className:"h-4 w-1/3"}),o.jsx(tn,{className:"h-4 w-2/3"})]}):ue?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:[(L||_)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n($?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(G=>!G),onKeyDown:G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),M(me=>!me))},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:G=>G.stopPropagation(),children:[L&&o.jsx("button",{type:"button",onClick:()=>{B("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:()=>{B("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")})]}),$?o.jsx(bs,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(l6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!$&&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(jae,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):o.jsx(Lae,{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(Ud,{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:h(l,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(km,{size:28,className:"text-muted-foreground/50"})}),N&&o.jsxs("div",{children:[o.jsxs(fe,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Yn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:G=>{ce(G.target.files)}})]})]})]}),K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ud,{children:n("library.brandPreview.colors")}),K.map(G=>o.jsx(Cae,{family:G.family,tokens:G.tokens,editing:N,valueOf:W,onEdit:q},G.family))]}),(Q.length>0||X.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ud,{children:n("library.brandPreview.typography")}),Q.map(G=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:G.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),N?o.jsx(vt,{value:W(G),onChange:me=>q(G.name,me.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(G)},children:W(G)})]},G.name)),X.map(G=>o.jsx(Pk,{token:G,value:W(G),editing:N,onEdit:q},G.name))]}),o.jsx(Cd,{label:n("library.brandPreview.spacing"),tokens:se,editing:N,valueOf:W,onEdit:q}),o.jsx(Cd,{label:n("library.brandPreview.radius"),tokens:ne,editing:N,valueOf:W,onEdit:q}),o.jsx(Cd,{label:n("library.brandPreview.shadows"),tokens:te,editing:N,valueOf:W,onEdit:q}),o.jsx(Cd,{label:n("library.brandPreview.motion"),tokens:ee,editing:N,valueOf:W,onEdit:q}),o.jsx(Cd,{label:n("library.brandPreview.tokens"),tokens:Y,editing:N,valueOf:W,onEdit:q}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ud,{children:n("library.brandPreview.voiceGuidelines")}),N?o.jsx(Jo,{value:J,onChange:G=>I(G.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):T.isPending&&y?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(tn,{className:"h-3 w-full"}),o.jsx(tn,{className:"h-3 w-5/6"})]}):J.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(Qc,{id:`brand-preview-${t}`,text:J})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Ek(t){const e=F.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let r;e[2]!==s||e[3]!==n?(r=o.jsx(Bt,{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(Vae,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==i||e[6]!==r?(l=o.jsx(zt,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7],l}function Rk(t){const e=F.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;e[0]!==n?(l=d=>{d||n()},e[0]=n,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==s||e[4]!==r?(a=o.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(Ak,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=r,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=o.jsx(zt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function Tae(t){const e=F.c(11),{onOpenDir:s}=t,n=le(),i=PP();let r;e[0]!==i.data?(r=i.data??[],e[0]=i.data,e[1]=r):r=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==r){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(Zu,{name:d.volume,glyph:mn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:v8(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],l=r.map(c),e[2]=s,e[3]=n,e[4]=r,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=o.jsx(o.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function Z3(t){return`${window.location.origin}${t}`}function du(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Aae=[vu,"uploads","outputs"],Dk=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Yn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Kr}],gp=new Set([...Dk.map(t=>t.volume),Dc("public")]),Pae=6;function Ik(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=n8(t),r=i?`public/${i}`:t==="home"?yu(s):t;return n?`${r}/${n}`:r}function ch(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 Do(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 $r(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 O9(t){const e=F.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx($r,{children:Array.from({length:n*3},Eae)}),e[0]=n,e[1]=i):i=e[1],i}function Eae(t,e){return o.jsx(tn,{className:"h-16 rounded-2xl"},e)}function ex(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 Rae(t){const e=F.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,l=le(),a=hA(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(u=o.jsx(Zu,{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]=u):u=e[11],u}function Dae(t){const e=F.c(12),{onOpenDir:s}=t,n=le(),r=J6().data?.length??0;let l;e[0]!==s?(l=Dk.map(u=>o.jsx(Rae,{volume:u.volume,descriptionKey:u.descriptionKey,glyph:u.glyph,onOpen:()=>s(u.volume)},u.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r||e[4]!==n?(a=r>0&&o.jsx(Zu,{name:Dc("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]=a):a=e[5];let c;e[6]!==s?(c=o.jsx(Tae,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Iae(t){const e=F.c(19),{segments:s,onNavigate:n}=t,{org:i}=He();let r;e[0]!==s?(r=s[0]===vu?s.slice(1):s,e[0]=s,e[1]=r):r=e[1];const l=r,a=s.length-l.length,c=l.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:yu(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(vu),children:yu(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let u;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let f;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(Ws,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Dc(m)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Dc(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],u=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=u}else u=e[10];let h;return e[16]!==d||e[17]!==u?(h=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function Mae(t){const e=F.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:l,onDelete:a}=t,c=le(),{org:d}=He(),u=Ku(),h=uA(s,n);let f;e[0]!==u||e[1]!==l?(f=S=>l({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:Z3(u(S.volume,S.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(O9,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,v;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=h.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(ex,{children:k}),e[17]=k,e[18]=j):j=e[18],v=j;break e}const S=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=re("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=Do,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=h.data,e[6]=h.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=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 _;e[21]!==p||e[22]!==x?(_=o.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=_):_=e[23];let y;if(e[24]!==u||e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==u||e[32]!==a||e[33]!==r||e[34]!==d||e[35]!==m?(S=k=>{const j=n8(k.volume)!==null;return o.jsx(y8,{filename:cn(k.path),updatedAt:k.updatedAt,downloadUrl:u(k.volume,k.path),subtitle:Ik(k.volume,k.path,d.slug),publicState:du(k),onOpen:()=>r(i8(k.volume,k.path)),onShare:j?void 0:()=>m(k),onDelete:j?void 0:()=>a({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=u,e[32]=a,e[33]=r,e[34]=d,e[35]=m,e[36]=S):S=e[36],y=g.map(S),e[24]=u,e[25]=a,e[26]=r,e[27]=d,e[28]=g,e[29]=m,e[30]=y}else y=e[30];let L;e[37]!==y?(L=o.jsx($r,{children:y}),e[37]=y,e[38]=L):L=e[38];let w;return e[39]!==b||e[40]!==_||e[41]!==L?(w=o.jsxs("div",{className:b,children:[_,L]}),e[39]=b,e[40]=_,e[41]=L,e[42]=w):w=e[42],w}function Oae(t){const e=F.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=le(),{org:l}=He(),a=q6(),c=Ku();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:Z3(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let v;e[3]!==r?(v=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=v):v=e[4];let _;e[5]!==v?(_=o.jsx(Do,{children:v}),e[5]=v,e[6]=_):_=e[6];let y;e[7]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(O9,{}),e[7]=y):y=e[7];let L;return e[8]!==_?(L=o.jsxs("div",{className:"flex flex-col gap-3",children:[_,y]}),e[8]=_,e[9]=L):L=e[9],L}let h,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==u||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,Pae);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let _;e[22]!==r?(_=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=_):_=e[23],e[24]!==_?(p=o.jsx(Do,{children:_}),e[24]=_,e[25]=p):p=e[25],h=$r;let y;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(y=L=>o.jsx(DP,{filename:cn(L.path),updatedAt:L.updatedAt,size:L.size,downloadUrl:c(L.volume,L.path),subtitle:Ik(L.volume,L.path,l.slug),publicState:du(L),onOpen:()=>s(i8(L.volume,L.path)),onShare:()=>u(L),onDelete:()=>i({volume:L.volume,path:L.path,kind:"file"})},`${L.volume}/${L.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,e[31]=y):y=e[31],f=v.map(y)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=u,e[16]=r,e[17]=h,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else h=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==h||e[33]!==f?(x=o.jsx(h,{children:f}),e[32]=h,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=o.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function $ae(t){const e=F.c(16),{onOpenDir:s}=t,n=le(),i=J6();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(O9,{}),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 l=r;if(l.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let u;return e[5]!==d?(u=o.jsx(ex,{children:d}),e[5]=d,e[6]=u):u=e[6],u}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=u=>o.jsx(Zu,{name:u,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${u}`)},u),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=o.jsx($r,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Bae(t){const e=F.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=le(),{org:m}=He(),p=s.volume??"",g=Y6(p,s.dirPath),x=Ku();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=N=>s.isHomeRoot&&gp.has(N.toLowerCase())?`${yu(m.slug)}/${N}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?o.jsx(Dae,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const y=_;if(g.isPending){let N;e[6]!==y||e[7]!==f?(N=y&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.folders")}),o.jsx($r,{children:y})]}),e[6]=y,e[7]=f,e[8]=N):N=e[8];let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(O9,{rows:2}),e[9]=P):P=e[9];let V;return e[10]!==N?(V=o.jsxs(o.Fragment,{children:[N,P]}),e[10]=N,e[11]=V):V=e[11],V}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 P;return e[15]!==N?(P=o.jsx("p",{className:"text-sm text-destructive",children:N}),e[15]=N,e[16]=P):P=e[16],P}let L,w,S,k,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==h||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==a||e[30]!==y||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const N=g.data??[],P=N.filter(Hae),V=N.filter(Uae),E=N.filter(Fae),R=N.filter(zae);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(ex,{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]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const D=I;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?(O=M=>s.readOnly?void 0:()=>a({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?Z3(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=O):O=e[51];const $=O;L=P.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.skills")}),o.jsx($r,{children:P.map(M=>o.jsx(EP,{dirName:cn(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:du(M),onOpen:()=>r(oc(s,M.path)),onBrowse:()=>n(oc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...ch(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),w=V.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.brands")}),o.jsx($r,{children:V.map(M=>o.jsx(RP,{dirName:cn(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>l(oc(s,M.path)),onBrowse:()=>n(oc(s,M.path)),onDelete:D(M),draggable:!s.readOnly,...ch(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),S=(E.length>0||y)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.folders")}),o.jsxs($r,{children:[y,E.map(M=>o.jsx(Zu,{name:cn(M.path),meta:v8(M.updatedAt),subtitle:v(cn(M.path)),readOnly:s.readOnly,publicState:du(M),onOpen:()=>n(oc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...ch(M.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},M.path))]})]}),k=R.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.files")}),o.jsx($r,{children:R.map(M=>o.jsx(y8,{filename:cn(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:du(M),onOpen:()=>i(oc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...ch(M.path,"file",{onDragStart:d,onContextMenu:u})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=u,e[22]=c,e[23]=d,e[24]=h,e[25]=l,e[26]=n,e[27]=i,e[28]=r,e[29]=a,e[30]=y,e[31]=f,e[32]=p,e[33]=L,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else L=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]!==a?(C=s.isHomeRoot&&o.jsx(Oae,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=C):C=e[56];let T;return e[57]!==L||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==C?(T=o.jsxs(o.Fragment,{children:[L,w,S,k,C]}),e[57]=L,e[58]=w,e[59]=S,e[60]=k,e[61]=C,e[62]=T):T=e[62],T}function zae(t){return t.kind==="file"}function Fae(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Uae(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Hae(t){return t.kind==="dir"&&t.hasSkill}function Kae({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=le(),{org:i}=He(),r=Ns(),l=rn(),a=Yl(),c=nl({strict:!1}),d=c.path||vu,u=Z2(d),h=IP(),f=u.volume!==null&&h.has(u.volume)?{...u,readOnly:!0}:u,m=(G,me)=>l({to:".",search:ye=>({...ye,[G]:me||void 0})}),p=G=>m("path",G),g=(G,me)=>l({to:".",search:ye=>({...ye,preview:void 0,skill:void 0,brand:void 0,[G]:me})}),x=t??(G=>g("preview",G)),b=e??(G=>g("skill",G)),v=s??(G=>g("brand",G)),[_,y]=A.useState(""),L=l9(_.trim(),300),w=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,S=w?n("library.library.searchInPlaceholder",{folder:Dc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?yu(i.slug):Dc(f.segments.at(-1)??""),[j,C]=A.useState(null),[T,N]=A.useState(null),[P,V]=A.useState(!1),[E,R]=A.useState(""),[I,D]=A.useState(!1),[O,$]=A.useState(null),[M,z]=A.useState(""),B=A.useRef(null),[U,H]=A.useState(!1),W=A.useRef(0),K=f.readOnly?null:f.volume,{upload:Q,mkdir:X,move:se}=gu(K??vu),{remove:ne}=gu(j?.volume??"uploads");async function te(G){if(!(!K||!G||G.length===0))try{await Q.mutateAsync({dir:f.dirPath,files:[...G]}),ve.success(G.length===1?n("library.library.uploadedSingle",{filename:G[0]?.name??""}):n("library.library.uploadedMultiple",{count:G.length}))}catch(me){ve.error(me instanceof Error?me.message:n("library.library.uploadFailed"))}finally{B.current&&(B.current.value="")}}const ee=K!==null;function Y(G){return G.dataTransfer.types.includes("Files")}function q(G){!ee||!Y(G)||(G.preventDefault(),W.current+=1,H(!0))}function oe(G){!ee||!Y(G)||G.preventDefault()}function J(){ee&&(W.current=Math.max(0,W.current-1),W.current===0&&H(!1))}function ie(G){ee&&(G.preventDefault(),G.stopPropagation(),W.current=0,H(!1),G.dataTransfer.files.length>0&&te(G.dataTransfer.files))}async function Z(){const G=E.trim();if(!(!K||!G)){if(f.isHomeRoot&&gp.has(G.toLowerCase())){ve.error(n("library.library.folderNameReserved",{name:G}));return}try{const me=f.dirPath;await X.mutateAsync(me?`${me}/${G}`:G),ve.success(n("library.library.folderCreated",{name:G})),V(!1),R("")}catch(me){ve.error(me instanceof Error?me.message:n("library.library.folderCreateFailed"))}}}async function he(){if(!j)return;const G=j;try{await ne.mutateAsync(G.path),ve.success(n("library.library.deleted",{name:cn(G.path)}))}catch(me){ve.error(me instanceof Error?me.message:n("library.library.deleteFailed"))}finally{C(null)}}async function de(){if(!O)return;const G=M.trim();if(!G||G.includes("/")||G.includes("..")||G===cn(O.path)){D(!1),$(null),z("");return}if(O.kind==="dir"&&f.isHomeRoot&&gp.has(G.toLowerCase())){ve.error(n("library.library.folderNameReserved",{name:G}));return}try{const me=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",ye=me?`${me}/${G}`:G;await se.mutateAsync({from:O.path,to:ye});const we=G.replace(/[<>]/g,"");ve.success(n("library.library.renamed",{name:we}))}catch(me){ve.error(me instanceof Error?me.message:n("library.library.renameFailed"))}finally{D(!1),$(null),z("")}}async function ae(G,me){try{const ye=cn(G),we=me?`${me}/${ye}`:ye;await se.mutateAsync({from:G,to:we}),ve.success(n("library.library.moved",{name:ye,destination:me||n("library.library.theLibrary")}))}catch(ye){ve.error(ye instanceof Error?ye.message:n("library.library.moveFailed"))}}function ce(){for(const G of Aae)r.invalidateQueries({queryKey:tt.orgFsVolume(i.id,G)});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 ue(G){G.defaultPrevented||!K||G.target.closest("input, textarea, button, a, [role='button']")||(G.preventDefault(),V(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:q,onDragOver:oe,onDragLeave:J,onDrop:ie,onContextMenu:ue,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(Yn,{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(Iae,{segments:f.segments,onNavigate:p})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(Yu,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(vt,{value:_,onChange:G=>y(G.target.value),onKeyDown:G=>{G.key==="Escape"&&y("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),_&&o.jsx(fe,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>y(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(ji,{size:14})})]}),o.jsx(fe,{variant:"ghost",size:"icon",onClick:ce,"aria-label":n("library.library.refresh"),children:o.jsx(On,{size:14})}),K&&o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[o.jsx(Gt,{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(Qu,{size:12}),n("library.library.readOnly")]}):o.jsxs(fe,{size:"sm",disabled:Q.isPending,onClick:()=>B.current?.click(),children:[o.jsx(Yn,{size:14}),Q.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:B,type:"file",multiple:!0,className:"hidden",onChange:G=>{te(G.target.files)}})]}),L?o.jsx(Mae,{query:L,scope:w,stale:_.trim()!==L,onOpenFile:x,onShare:N,onDelete:C}):f.volume===null?o.jsx($ae,{onOpenDir:p}):o.jsx(Bae,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:N,onDelete:C,onContextMenu:(G,me)=>{$({path:G,kind:me}),z(cn(G)),D(!0)},onMove:ae},f.volume)]})}),a&&(c.preview?o.jsx(Rk,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?o.jsx(s8,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?o.jsx(Ek,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),o.jsx(zt,{open:P,onOpenChange:V,children:o.jsxs(Bt,{children:[o.jsxs(ds,{children:[o.jsx(qt,{children:n("library.library.newFolderTitle")}),o.jsx(Nn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(vt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:G=>R(G.target.value),onKeyDown:G=>{G.key==="Enter"&&Z()}}),o.jsxs(Gn,{children:[o.jsx(fe,{variant:"outline",onClick:()=>V(!1),children:n("library.library.cancel")}),o.jsx(fe,{disabled:!E.trim()||X.isPending,onClick:()=>{Z()},children:n("library.library.create")})]})]})}),o.jsx(zt,{open:I,onOpenChange:G=>{D(G),G||($(null),z(""))},children:o.jsxs(Bt,{children:[o.jsxs(ds,{children:[o.jsx(qt,{children:O&&n("library.library.renameTitle",{name:cn(O.path)})}),o.jsx(Nn,{children:n("library.library.renameDescription")})]}),o.jsx(vt,{autoFocus:!0,value:M,onChange:G=>z(G.target.value),onKeyDown:G=>{G.key==="Enter"&&de()}}),o.jsxs(Gn,{children:[o.jsx(fe,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),o.jsx(fe,{disabled:!M.trim()||se.isPending,onClick:()=>{de()},children:n("library.library.rename")})]})]})}),o.jsx(hae,{target:T,onOpenChange:G=>{G||N(null)}}),o.jsx(qr,{open:j!==null,onOpenChange:G=>{G||C(null)},children:o.jsxs(Gr,{children:[o.jsxs(Yr,{children:[o.jsx(Jr,{children:n("library.library.deleteTitle",{name:j?cn(j.path):""})}),o.jsx(Qr,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(Xr,{children:[o.jsx(Zr,{children:n("library.library.cancel")}),o.jsx(eo,{onClick:()=>{he()},children:n("library.library.delete")})]})]})})]})}function Wae(){const t=F.c(10),{openPanel:e}=Di(),[s,n]=A.useState(null),[i,r]=A.useState(null);let l;t[0]!==e?(l=o.jsx(Kae,{onOpenFile:u=>e(WC(u)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==s?(a=s&&o.jsx(s8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=a):a=t[3];let c;t[4]!==i?(c=i&&o.jsx(Ek,{brandPath:i,onClose:()=>r(null)},i),t[4]=i,t[5]=c):c=t[5];let d;return t[6]!==l||t[7]!==a||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[l,a,c]}),t[6]=l,t[7]=a,t[8]=c,t[9]=d):d=t[9],d}const av=A.lazy(()=>Gs(()=>import("./project-app-view-Ben78Ktd.js"),__vite__mapDeps([177,1,2,80,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,81,82,83,15,11,16,23,84,85,86,87,88,89,90,91,92,93,94,7,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,77,72,110,113,153,122,123,124,125,119,120,121,154,111,112,71,114,115,116,117,73,118,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,70,148,149,78,150,151,152,155,156,75,157,158,159])).then(t=>({default:t.AppViewContent}))),qae=A.lazy(()=>Gs(()=>import("./hosting-tab-BAPE6MlT.js"),__vite__mapDeps([178,1,2,30,28,40,29,31,32,33,34,35,36,37,38,39,8,41,42,43,9,44,10,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,133,72,77,146,7,71,84,179,23,15,11,16,143])).then(t=>({default:t.HostingTab}))),Gae=A.lazy(()=>Gs(()=>import("./e2e-tab-Dr-mwFjd.js"),__vite__mapDeps([180,1,2,36,28,40,29,30,31,32,33,34,35,37,38,39,8,41,42,43,9,44,10,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,133,72,77,146,7,71,84,179,23,15,11,16,143,80,81,82,83,85,86,87,88,89,90,91,92,93,94,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,114])).then(t=>({default:t.E2eTab}))),Yae=A.lazy(()=>Gs(()=>import("./analytics-tab-DkOamiBu.js"),__vite__mapDeps([181,1,2,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,133,136,72,77,84,182,183,184,146,7,179,23,15,11,16,143])).then(t=>({default:t.AnalyticsTab}))),Jae=A.lazy(()=>Gs(()=>import("./cdn-tab-DFZvtAMl.js"),__vite__mapDeps([185,1,2,49,182,183,184,179,73,23,15,11,16,143,186,187])).then(t=>({default:t.CdnTab})));function Qae(){const t=F.c(2),e=iA();let s;return t[0]!==e?(s=e?o.jsx(dF,{}):o.jsx(iF,{}),t[0]=e,t[1]=s):s=t[1],s}function Xae({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:i,automationTabParsed:r}){const l=U6(),a=Sc().monitorEnabled===!0||Sc().auth.localMode===!0;if(t==="overview")return o.jsx(Qae,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(wY,{})});if(qC(t))return o.jsx(B4,{virtualMcpId:e});if(t==="git")return o.jsx(cQ,{virtualMcpId:e});if(t==="automations")return o.jsx(Mle,{virtualMcpId:e});if(t==="site-editor")return o.jsx(Aie,{virtualMcpId:e});const c=hm(t);if(c)return o.jsx(Eie,{openPath:c.path});if(t==="content")return o.jsx(Koe,{virtualMcpId:e});if(t==="assets")return o.jsx(qoe,{virtualMcpId:e});if(t==="hosting"&&l.hosting)return o.jsx(qae,{virtualMcpId:e});if(t==="e2e"&&l.e2e)return o.jsx(Gae,{virtualMcpId:e});if(t==="analytics"&&l.analytics)return o.jsx(Yae,{virtualMcpId:e});if(t==="cdn"&&a&&l.monitor)return o.jsx(Jae,{virtualMcpId:e});if(t==="files")return o.jsx(Wae,{});if(t==="reports")return o.jsx(Hle,{});if(t==="discover")return o.jsx(Zle,{});if(t==="connect-sources")return o.jsx(zle,{});if(r)return o.jsx(Ele,{tabId:t});const d=Py(t);if(d)return o.jsx(mae,{path:d.path},d.path);const u=Ay(t);if(u)return o.jsx($le,{fileKey:u.key,taskId:s});const h=Ey(t);if(h)return o.jsx(bae,{path:h.path},h.path);const f=GC(t);if(f){const p=i.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(wi,{children:o.jsx(av,{connectionId:f.connectionId,toolName:f.toolName,args:p?.args},t)})}const m=n.find(p=>p.id===t);return m?o.jsx(wi,{children:o.jsx(av,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},t)}):o.jsx(B4,{virtualMcpId:e})}function Zae(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:l,expandedTools:a,automationTabParsed:c}=Vg(i);let d;e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==s||e[8]!==n?(d=o.jsx(wi,{children:o.jsx(Xae,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[3]=r,e[4]=c,e[5]=a,e[6]=l,e[7]=s,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==r||e[11]!==d?(u=o.jsx(sn,{children:d},r),e[10]=r,e[11]=d,e[12]=u):u=e[12],u}const ece=new Set(["site-editor","content"]);function tce(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&ece.has(t.mainTab)}const Al="setup";function sce(t){const e=F.c(57),s=le();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let y;e[3]!==t.scriptTabs?(y=L=>!t.scriptTabs.includes(L),e[3]=t.scriptTabs,e[4]=y):y=e[4],n=t.scripts.filter(y),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===Al?t.onToggle():t.onSelectTab(Al)},e[5]=t,e[6]=r):r=e[6];const l=r;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(bs,{className:"size-4"}):o.jsx(l6,{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]!==a||e[15]!==c?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let h;e[20]!==u?(h=o.jsx(We,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=o.jsxs(qe,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===Al;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=o.jsx(nce,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(y=>o.jsx(rce,{active:t.active===y,onClick:()=>{t.active===y?t.onToggle():t.onSelectTab(y)},onClose:()=>t.onCloseScript(y),t:s,children:y},y)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(oce,{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]!==p?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,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(lce,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(ice,{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 _;return e[53]!==b||e[54]!==v||e[55]!==f?(_=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]=_):_=e[56],_}function nce(t){const e=F.c(11),{active:s,open:n,onClick:i,t:r}=t,l=s&&n,a=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 u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(cP,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==r?(h=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=h):h=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==h?(f=o.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[u,h]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f):f=e[10],f}function ice(t){const e=F.c(40),{status:s,onStart:n,onStop:i,onRestart:r,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Rl,{className:"size-3.5"}),e[0]=d):d=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let h;return e[3]!==n||e[4]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:n,children:[d," ",u]}),e[3]=n,e[4]=u,e[5]=h):h=e[5],h}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Rl,{className:"size-3.5"}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let h;return e[9]!==l||e[10]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:l,children:[d," ",u]}),e[9]=l,e[10]=u,e[11]=h):h=e[11],h}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(On,{className:"size-3.5"}),e[12]=d):d=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let h;return e[15]!==a||e[16]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:a,children:[d," ",u]}),e[15]=a,e[16]=u,e[17]=h):h=e[17],h}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=re(u),e[18]=u,e[19]=h):h=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==i||e[23]!==h||e[24]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",onClick:i,className:h,children:f})}),e[22]=i,e[23]=h,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=o.jsx(We,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=o.jsxs(qe,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(bs,{className:"size-3"})})}),o.jsx(Kt,{align:"end",children:o.jsxs(Je,{onClick:r,children:[o.jsx(On,{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 rce(t){const e=F.c(17),{active:s,onClick:n,onClose:i,children:r,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=re("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let h;e[2]!==d||e[3]!==u?(h=re("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==r||e[6]!==n||e[7]!==h?(f=o.jsx("button",{type:"button",onClick:n,className:h,children:r}),e[5]=r,e[6]=n,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==r||e[10]!==i||e[11]!==l?(m=i&&o.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(r)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(Ks,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function oce(t){const e=F.c(27),{scripts:s,onRun:n}=t,i=le(),[r,l]=A.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Gt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(os,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let u;e[5]!==i?(u=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx(We,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=o.jsxs(qe,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=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:()=>{l(!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]!==p||e[21]!==g?(x=o.jsxs(as,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==f?(b=o.jsxs(cs,{open:r,onOpenChange:l,children:[f,x]}),e[23]=r,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function lce(t){const e=F.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:r,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(it,{className:"size-3.5"}),e[0]=f):f=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=o.jsxs(fe,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Rl,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=o.jsx(Ke,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"xs",onClick:i,children:[f," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(We,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==r||e[21]!==a?(c=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",onClick:r,children:a})}),e[20]=r,e[21]=a,e[22]=c):c=e[22];let d;e[23]!==l?(d=l("sandbox.toolbar.stopProcess"),e[23]=l,e[24]=d):d=e[24];let u;e[25]!==d?(u=o.jsx(We,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=o.jsxs(qe,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var Mk=Object.defineProperty,ace=Object.getOwnPropertyDescriptor,cce=(t,e)=>{for(var s in e)Mk(t,s,{get:e[s],enumerable:!0})},Ts=(t,e,s,n)=>{for(var i=n>1?void 0:n?ace(e,s):e,r=t.length-1,l;r>=0;r--)(l=t[r])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&Mk(e,s,i),i},Ye=(t,e)=>(s,n)=>e(s,n,t),cv="Terminal input",xp={get:()=>cv,set:t=>cv=t},dv="Too much output to announce, navigate to rows manually to read",bp={get:()=>dv,set:t=>dv=t};function dce(t){return t.replace(/\r?\n/g,"\r")}function uce(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function hce(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function fce(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");Ok(i,e,s,n)}}function Ok(t,e,s,n){t=dce(t),t=uce(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function $k(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 uv(t,e,s,n,i){$k(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Eo(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function $9(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 mce=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 l=t.charCodeAt(r);if(55296<=l&&l<=56319){if(++r>=s)return this._interim=l,n;let a=t.charCodeAt(r);56320<=a&&a<=57343?e[n++]=(l-55296)*1024+a-56320+65536:(e[n++]=l,e[n++]=a);continue}l!==65279&&(e[n++]=l)}return n}},pce=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,l,a,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let u=s-4,h=d;for(;h<s;){for(;h<u&&!((i=t[h])&128)&&!((r=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=r,e[n++]=l,e[n++]=a,h+=4;if(i=t[h++],i<128)e[n++]=i;else if((i&224)===192){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(c=(i&31)<<6|r&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[h++],(l&192)!==128){h--;continue}if(c=(i&15)<<12|(r&63)<<6|l&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(r&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Bk="",Oo=" ",v0=class zk{constructor(){this.fg=0,this.bg=0,this.extended=new wf}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 zk;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}},wf=class Fk{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 Fk(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},oi=class Uk extends v0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new wf,this.combinedData=""}static fromCharData(e){let s=new Uk;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?Eo(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()]}},hv="di$target",vp="di$dependencies",H1=new Map;function gce(t){return t[vp]||[]}function ln(t){if(H1.has(t))return H1.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");xce(e,s,i)};return e._id=t,H1.set(t,e),e}function xce(t,e,s){e[hv]===e?e[vp].push({id:t,index:s}):(e[vp]=[{id:t,index:s}],e[hv]=e)}var Pn=ln("BufferService"),Hk=ln("CoreMouseService"),ha=ln("CoreService"),bce=ln("CharsetService"),tx=ln("InstantiationService"),Kk=ln("LogService"),En=ln("OptionsService"),Wk=ln("OscLinkService"),vce=ln("UnicodeService"),y0=ln("DecorationService"),yp=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 oi,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let u=0;u<l;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=u,a=r.extended.urlId;continue}else d=r.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&u===l-1){let h=this._oscLinkService.getLinkData(a)?.uri;if(h){let f={start:{x:c+1,y:t},end:{x:u+(!d&&u===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(h);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:h,range:f,activate:(p,g)=>i?i.activate(p,g,f):yce(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=u,a=r.extended.urlId):(c=-1,a=-1)}}e(n)}};yp=Ts([Ye(0,Pn),Ye(1,En),Ye(2,Wk)],yp);function yce(t,e){if(confirm(`Do you want to navigate to ${e}?
808
+ `);function kae(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Sae).replaceAll("{{title}}",wae).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function jae(t){const e=F.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=xu(s),l=xu(i??"");if(r.isPending||i&&l.isPending){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(tn,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=u):u=e[0],u}if(r.isError||!r.data){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=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]=u):u=e[1],u}const a=l.data??null;let c;e[2]!==a||e[3]!==r.data?(c=kae(r.data,a),e[2]=a,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 Ud(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 Cae(t){const e=F.c(16),{family:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;let a;e[0]!==s?(a=o.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let h;e[7]!==i||e[8]!==l||e[9]!==r?(h=f=>{const m=r(f),p=`${f.name.replace(/^--brand-/,"")}: ${m}`;return i&&/^#/.test(m)?o.jsx("input",{type:"color","aria-label":f.name,title:p,value:AP(m),onChange:g=>l(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:p,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:m}},f.name)},e[7]=i,e[8]=l,e[9]=r,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,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 u;return e[13]!==a||e[14]!==d?(u=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Nae(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 l;return e[6]!==r?(l=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]=l):l=e[7],l}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 Pk(t){const e=F.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let l;e[0]!==s||e[1]!==n?(l=o.jsx(Nae,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=/^--brand-/,e[5]=h):h=e[5],a=s.name.replace(h,""),e[3]=s.name,e[4]=a}else a=e[4];let c;e[6]!==a?(c=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:a}),e[6]=a,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:h=>r(s.name,h.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 u;return e[13]!==l||e[14]!==c||e[15]!==d?(u=o.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=u):u=e[16],u}function Cd(t){const e=F.c(16),{label:s,tokens:n,editing:i,valueOf:r,onEdit:l}=t;if(n.length===0)return null;let a;e[0]!==s?(a=o.jsx(Ud,{children:s}),e[0]=s,e[1]=a):a=e[1];let c;if(e[2]!==i||e[3]!==l||e[4]!==n||e[5]!==r){let h;e[7]!==i||e[8]!==l||e[9]!==r?(h=f=>o.jsx(Pk,{token:f,value:r(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=r,e[10]=h):h=e[10],c=n.map(h),e[2]=i,e[3]=l,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 u;return e[13]!==a||e[14]!==d?(u=o.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=u):u=e[15],u}function Vae({brandPath:t,onClose:e,variant:s}){const n=le(),{org:i}=He(),r=Z2(t),l=r.volume??"",a=r.dirPath,c=cn(a),d=r.readOnly,u=Ns(),h=Ku(),f=G6(l),{upload:m,remove:p}=gu(l),g=A.useRef(null),x=Y6(l,a),b=x.data??[],v=G=>b.some(me=>me.kind==="file"&&cn(me.path)===G),_=v("tokens.css"),y=v("brand.md"),L=v("slides-theme.html"),w=CP(b),S=h(l,`${a}/tokens.css`),k=h(l,`${a}/brand.md`),j=h(l,`${a}/slides-theme.html`),C=xu(S,{enabled:_}),T=xu(k,{enabled:y}),[N,P]=A.useState(!1),[V,E]=A.useState({}),[R,I]=A.useState(null),[D,O]=A.useState(!1),[$,M]=A.useState(!1),[z,B]=A.useState("deck"),U=C.data?NP(C.data):[],H=G=>U.find(me=>me.name===G)?.value,W=G=>V[G.name]??G.value,K=VP(U),Q=U.filter(G=>G.kind==="font"),X=U.filter(G=>G.kind==="type"),se=U.filter(G=>G.kind==="space"),ne=U.filter(G=>G.kind==="radius"),te=U.filter(G=>G.kind==="shadow"),ee=U.filter(G=>G.kind==="motion"),Y=U.filter(G=>G.kind==="other"),q=(G,me)=>E(ye=>({...ye,[G]:me})),oe=L&&z==="deck",J=R??T.data??"",ie=Object.entries(V).filter(([G,me])=>H(G)!==me),Z=R!==null&&R!==(T.data??""),he=ie.length>0||Z;function de(){E({}),I(null),P(!1)}async function ae(){O(!0);try{if(ie.length>0){let G=C.data??"";for(const[me,ye]of ie)G=TP(G,me,ye);await f.mutateAsync({path:`${a}/tokens.css`,body:G,contentType:"text/css; charset=utf-8"}),u.invalidateQueries({queryKey:tt.fileText(S)})}Z&&R!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:R,contentType:"text/markdown; charset=utf-8"}),u.invalidateQueries({queryKey:tt.fileText(k)})),u.invalidateQueries({queryKey:tt.orgFsVolume(i.id,l)}),u.invalidateQueries({queryKey:tt.orgFsRecent(i.id)}),E({}),I(null),P(!1),ve.success(n("library.brandPreview.brandSaved"))}catch(G){ve.error(G instanceof Error?G.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function ce(G){const me=G?.[0];if(!me)return;const we=`logo.${(me.name.split(".").pop()??"png").toLowerCase()}`;try{await m.mutateAsync({dir:a,files:[new File([me],we,{type:me.type})]}),w&&cn(w)!==we&&await p.mutateAsync(w),ve.success(n("library.brandPreview.logoUpdated"))}catch(Ne){ve.error(Ne instanceof Error?Ne.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const ue=!x.isPending&&!_&&!y&&!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(km,{size:18})}),s==="dialog"?o.jsx(qt,{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(fe,{variant:"ghost",size:"sm",onClick:de,disabled:D,children:n("library.brandPreview.cancel")}),o.jsx(fe,{size:"sm",disabled:!he||D,onClick:()=>{ae()},children:n(D?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>P(!0),children:[o.jsx(xT,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(lV,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(Ks,{size:16})})}):o.jsx(fe,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(Ks,{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(tn,{className:"h-40 w-full rounded-xl"}),o.jsx(tn,{className:"h-4 w-1/3"}),o.jsx(tn,{className:"h-4 w-2/3"})]}):ue?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:[(L||_)&&o.jsxs("div",{className:"shrink-0 border-b border-border",children:[o.jsxs("div",{role:"button",tabIndex:0,"aria-label":n($?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(G=>!G),onKeyDown:G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),M(me=>!me))},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:G=>G.stopPropagation(),children:[L&&o.jsx("button",{type:"button",onClick:()=>{B("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:()=>{B("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")})]}),$?o.jsx(bs,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(l6,{size:16,className:"shrink-0 text-muted-foreground"})]}),!$&&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(jae,{readUrl:j,title:`${c} deck theme`,tokensUrl:S}):o.jsx(Lae,{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(Ud,{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:h(l,w),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(km,{size:28,className:"text-muted-foreground/50"})}),N&&o.jsxs("div",{children:[o.jsxs(fe,{variant:"outline",size:"sm",disabled:m.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Yn,{size:14}),n(w?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:G=>{ce(G.target.files)}})]})]})]}),K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ud,{children:n("library.brandPreview.colors")}),K.map(G=>o.jsx(Cae,{family:G.family,tokens:G.tokens,editing:N,valueOf:W,onEdit:q},G.family))]}),(Q.length>0||X.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ud,{children:n("library.brandPreview.typography")}),Q.map(G=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:G.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),N?o.jsx(vt,{value:W(G),onChange:me=>q(G.name,me.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(G)},children:W(G)})]},G.name)),X.map(G=>o.jsx(Pk,{token:G,value:W(G),editing:N,onEdit:q},G.name))]}),o.jsx(Cd,{label:n("library.brandPreview.spacing"),tokens:se,editing:N,valueOf:W,onEdit:q}),o.jsx(Cd,{label:n("library.brandPreview.radius"),tokens:ne,editing:N,valueOf:W,onEdit:q}),o.jsx(Cd,{label:n("library.brandPreview.shadows"),tokens:te,editing:N,valueOf:W,onEdit:q}),o.jsx(Cd,{label:n("library.brandPreview.motion"),tokens:ee,editing:N,valueOf:W,onEdit:q}),o.jsx(Cd,{label:n("library.brandPreview.tokens"),tokens:Y,editing:N,valueOf:W,onEdit:q}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Ud,{children:n("library.brandPreview.voiceGuidelines")}),N?o.jsx(Jo,{value:J,onChange:G=>I(G.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):T.isPending&&y?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(tn,{className:"h-3 w-full"}),o.jsx(tn,{className:"h-3 w-5/6"})]}):J.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(Qc,{id:`brand-preview-${t}`,text:J})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function Ek(t){const e=F.c(8),{brandPath:s,onClose:n}=t;let i;e[0]!==n?(i=a=>{a||n()},e[0]=n,e[1]=i):i=e[1];let r;e[2]!==s||e[3]!==n?(r=o.jsx(Bt,{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(Vae,{brandPath:s,onClose:n,variant:"dialog"})}),e[2]=s,e[3]=n,e[4]=r):r=e[4];let l;return e[5]!==i||e[6]!==r?(l=o.jsx(zt,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7],l}function Rk(t){const e=F.c(9),{previewPath:s,onClose:n,showSeeInLibrary:i}=t,r=i===void 0?!1:i;let l;e[0]!==n?(l=d=>{d||n()},e[0]=n,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==s||e[4]!==r?(a=o.jsx(Bt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(Ak,{previewPath:s,onClose:n,showSeeInLibrary:r,variant:"dialog"})}),e[2]=n,e[3]=s,e[4]=r,e[5]=a):a=e[5];let c;return e[6]!==l||e[7]!==a?(c=o.jsx(zt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function Tae(t){const e=F.c(11),{onOpenDir:s}=t,n=le(),i=PP();let r;e[0]!==i.data?(r=i.data??[],e[0]=i.data,e[1]=r):r=e[1];let l;if(e[2]!==s||e[3]!==n||e[4]!==r){let c;e[6]!==s||e[7]!==n?(c=d=>o.jsx(Zu,{name:d.volume,glyph:mn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:v8(d.lastSyncedAt)}):n("library.syncedRepos.waitingFirstSync"),onOpen:()=>s(d.volume)},d.id),e[6]=s,e[7]=n,e[8]=c):c=e[8],l=r.map(c),e[2]=s,e[3]=n,e[4]=r,e[5]=l}else l=e[5];let a;return e[9]!==l?(a=o.jsx(o.Fragment,{children:l}),e[9]=l,e[10]=a):a=e[10],a}function Z3(t){return`${window.location.origin}${t}`}function du(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Aae=[vu,"uploads","outputs"],Dk=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Yn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Kr}],gp=new Set([...Dk.map(t=>t.volume),Dc("public")]),Pae=6;function Ik(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=n8(t),r=i?`public/${i}`:t==="home"?yu(s):t;return n?`${r}/${n}`:r}function ch(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 Do(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 $r(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 O9(t){const e=F.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx($r,{children:Array.from({length:n*3},Eae)}),e[0]=n,e[1]=i):i=e[1],i}function Eae(t,e){return o.jsx(tn,{className:"h-16 rounded-2xl"},e)}function ex(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 Rae(t){const e=F.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,l=le(),a=hA(s);let c;e[0]!==l||e[1]!==a.data?(c=a.data?l("library.libraryViews.filesCount",{count:a.data.files}):void 0,e[0]=l,e[1]=a.data,e[2]=c):c=e[2];let d;e[3]!==n||e[4]!==l?(d=l(n),e[3]=n,e[4]=l,e[5]=d):d=e[5];let u;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(u=o.jsx(Zu,{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]=u):u=e[11],u}function Dae(t){const e=F.c(12),{onOpenDir:s}=t,n=le(),r=J6().data?.length??0;let l;e[0]!==s?(l=Dk.map(u=>o.jsx(Rae,{volume:u.volume,descriptionKey:u.descriptionKey,glyph:u.glyph,onOpen:()=>s(u.volume)},u.volume)),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==s||e[3]!==r||e[4]!==n?(a=r>0&&o.jsx(Zu,{name:Dc("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]=a):a=e[5];let c;e[6]!==s?(c=o.jsx(Tae,{onOpenDir:s}),e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==l||e[9]!==a||e[10]!==c?(d=o.jsxs(o.Fragment,{children:[l,a,c]}),e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function Iae(t){const e=F.c(19),{segments:s,onNavigate:n}=t,{org:i}=He();let r;e[0]!==s?(r=s[0]===vu?s.slice(1):s,e[0]=s,e[1]=r):r=e[1];const l=r,a=s.length-l.length,c=l.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:yu(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(vu),children:yu(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let u;if(e[6]!==a||e[7]!==n||e[8]!==l||e[9]!==s){let f;e[11]!==a||e[12]!==n||e[13]!==l.length||e[14]!==s?(f=(m,p)=>{const g=s.slice(0,a+p+1).join("/"),x=p===l.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(Ws,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Dc(m)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Dc(m)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],u=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=u}else u=e[10];let h;return e[16]!==d||e[17]!==u?(h=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function Mae(t){const e=F.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:l,onDelete:a}=t,c=le(),{org:d}=He(),u=Ku(),h=uA(s,n);let f;e[0]!==u||e[1]!==l?(f=S=>l({volume:S.volume,path:S.path,kind:"file",shareMode:S.shareMode??"private",effectivePublic:S.effectivePublic??!1,url:Z3(u(S.volume,S.path))}),e[0]=u,e[1]=l,e[2]=f):f=e[2];const m=f;if(h.isPending){let S;return e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(O9,{rows:2}),e[3]=S):S=e[3],S}let p,g,x,b,v;if(e[4]!==s||e[5]!==h.data||e[6]!==h.isPlaceholderData||e[7]!==i||e[8]!==c){v=Symbol.for("react.early_return_sentinel");e:{if(g=h.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(ex,{children:k}),e[17]=k,e[18]=j):j=e[18],v=j;break e}const S=(i||h.isPlaceholderData)&&"opacity-50";e[19]!==S?(b=re("flex flex-col gap-3",S),e[19]=S,e[20]=b):b=e[20],p=Do,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=h.data,e[6]=h.isPlaceholderData,e[7]=i,e[8]=c,e[9]=p,e[10]=g,e[11]=x,e[12]=b,e[13]=v}else p=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 _;e[21]!==p||e[22]!==x?(_=o.jsx(p,{children:x}),e[21]=p,e[22]=x,e[23]=_):_=e[23];let y;if(e[24]!==u||e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==m){let S;e[31]!==u||e[32]!==a||e[33]!==r||e[34]!==d||e[35]!==m?(S=k=>{const j=n8(k.volume)!==null;return o.jsx(y8,{filename:cn(k.path),updatedAt:k.updatedAt,downloadUrl:u(k.volume,k.path),subtitle:Ik(k.volume,k.path,d.slug),publicState:du(k),onOpen:()=>r(i8(k.volume,k.path)),onShare:j?void 0:()=>m(k),onDelete:j?void 0:()=>a({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=u,e[32]=a,e[33]=r,e[34]=d,e[35]=m,e[36]=S):S=e[36],y=g.map(S),e[24]=u,e[25]=a,e[26]=r,e[27]=d,e[28]=g,e[29]=m,e[30]=y}else y=e[30];let L;e[37]!==y?(L=o.jsx($r,{children:y}),e[37]=y,e[38]=L):L=e[38];let w;return e[39]!==b||e[40]!==_||e[41]!==L?(w=o.jsxs("div",{className:b,children:[_,L]}),e[39]=b,e[40]=_,e[41]=L,e[42]=w):w=e[42],w}function Oae(t){const e=F.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=le(),{org:l}=He(),a=q6(),c=Ku();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:Z3(c(v.volume,v.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const u=d;if(a.isPending){let v;e[3]!==r?(v=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=v):v=e[4];let _;e[5]!==v?(_=o.jsx(Do,{children:v}),e[5]=v,e[6]=_):_=e[6];let y;e[7]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(O9,{}),e[7]=y):y=e[7];let L;return e[8]!==_?(L=o.jsxs("div",{className:"flex flex-col gap-3",children:[_,y]}),e[8]=_,e[9]=L):L=e[9],L}let h,f,m,p,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==u||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const v=(a.data??[]).slice(0,Pae);if(v.length===0){g=null;break e}m="flex flex-col gap-3";let _;e[22]!==r?(_=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=_):_=e[23],e[24]!==_?(p=o.jsx(Do,{children:_}),e[24]=_,e[25]=p):p=e[25],h=$r;let y;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==u?(y=L=>o.jsx(DP,{filename:cn(L.path),updatedAt:L.updatedAt,size:L.size,downloadUrl:c(L.volume,L.path),subtitle:Ik(L.volume,L.path,l.slug),publicState:du(L),onOpen:()=>s(i8(L.volume,L.path)),onShare:()=>u(L),onDelete:()=>i({volume:L.volume,path:L.path,kind:"file"})},`${L.volume}/${L.path}`),e[26]=c,e[27]=i,e[28]=s,e[29]=l,e[30]=u,e[31]=y):y=e[31],f=v.map(y)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=u,e[16]=r,e[17]=h,e[18]=f,e[19]=m,e[20]=p,e[21]=g}else h=e[17],f=e[18],m=e[19],p=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==h||e[33]!==f?(x=o.jsx(h,{children:f}),e[32]=h,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==m||e[36]!==p||e[37]!==x?(b=o.jsxs("div",{className:m,children:[p,x]}),e[35]=m,e[36]=p,e[37]=x,e[38]=b):b=e[38],b}function $ae(t){const e=F.c(16),{onOpenDir:s}=t,n=le(),i=J6();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(O9,{}),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 l=r;if(l.length===0){let d;e[3]!==n?(d=n("library.libraryViews.noPublicSkillSetsConfigured"),e[3]=n,e[4]=d):d=e[4];let u;return e[5]!==d?(u=o.jsx(ex,{children:d}),e[5]=d,e[6]=u):u=e[6],u}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=u=>o.jsx(Zu,{name:u,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${u}`)},u),e[11]=s,e[12]=n,e[13]=d):d=e[13],a=l.map(d),e[7]=s,e[8]=l,e[9]=n,e[10]=a}else a=e[10];let c;return e[14]!==a?(c=o.jsx($r,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function Bae(t){const e=F.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:u,onMove:h}=t,f=le(),{org:m}=He(),p=s.volume??"",g=Y6(p,s.dirPath),x=Ku();let b;e[0]!==s.isHomeRoot||e[1]!==m?(b=N=>s.isHomeRoot&&gp.has(N.toLowerCase())?`${yu(m.slug)}/${N}`:void 0,e[0]=s.isHomeRoot,e[1]=m,e[2]=b):b=e[2];const v=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?o.jsx(Dae,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const y=_;if(g.isPending){let N;e[6]!==y||e[7]!==f?(N=y&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.folders")}),o.jsx($r,{children:y})]}),e[6]=y,e[7]=f,e[8]=N):N=e[8];let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(O9,{rows:2}),e[9]=P):P=e[9];let V;return e[10]!==N?(V=o.jsxs(o.Fragment,{children:[N,P]}),e[10]=N,e[11]=V):V=e[11],V}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 P;return e[15]!==N?(P=o.jsx("p",{className:"text-sm text-destructive",children:N}),e[15]=N,e[16]=P):P=e[16],P}let L,w,S,k,j;if(e[17]!==v||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==u||e[22]!==c||e[23]!==d||e[24]!==h||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==a||e[30]!==y||e[31]!==f||e[32]!==p){j=Symbol.for("react.early_return_sentinel");e:{const N=g.data??[],P=N.filter(Hae),V=N.filter(Uae),E=N.filter(Fae),R=N.filter(zae);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(ex,{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]!==p?(I=M=>s.readOnly?void 0:()=>c({volume:p,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=p,e[46]=I):I=e[46];const D=I;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==p?(O=M=>s.readOnly?void 0:()=>a({volume:p,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?Z3(x(p,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=p,e[51]=O):O=e[51];const $=O;L=P.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.skills")}),o.jsx($r,{children:P.map(M=>o.jsx(EP,{dirName:cn(M.path),updatedAt:M.updatedAt,skillMdUrl:x(p,`${M.path}/SKILL.md`),publicState:du(M),onOpen:()=>r(oc(s,M.path)),onBrowse:()=>n(oc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...ch(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),w=V.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.brands")}),o.jsx($r,{children:V.map(M=>o.jsx(RP,{dirName:cn(M.path),updatedAt:M.updatedAt,tokensUrl:x(p,`${M.path}/tokens.css`),onOpen:()=>l(oc(s,M.path)),onBrowse:()=>n(oc(s,M.path)),onDelete:D(M),draggable:!s.readOnly,...ch(M.path,"dir",{onDragStart:d,onContextMenu:u})},M.path))})]}),S=(E.length>0||y)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.folders")}),o.jsxs($r,{children:[y,E.map(M=>o.jsx(Zu,{name:cn(M.path),meta:v8(M.updatedAt),subtitle:v(cn(M.path)),readOnly:s.readOnly,publicState:du(M),onOpen:()=>n(oc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...ch(M.path,"dir",{onDragStart:d,onContextMenu:u,onDrop:h})},M.path))]})]}),k=R.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Do,{children:f("library.libraryViews.files")}),o.jsx($r,{children:R.map(M=>o.jsx(y8,{filename:cn(M.path),updatedAt:M.updatedAt,downloadUrl:x(p,M.path),publicState:du(M),onOpen:()=>i(oc(s,M.path)),onShare:$(M),onDelete:D(M),draggable:!s.readOnly,...ch(M.path,"file",{onDragStart:d,onContextMenu:u})},M.path))})]})}e[17]=v,e[18]=x,e[19]=g.data,e[20]=s,e[21]=u,e[22]=c,e[23]=d,e[24]=h,e[25]=l,e[26]=n,e[27]=i,e[28]=r,e[29]=a,e[30]=y,e[31]=f,e[32]=p,e[33]=L,e[34]=w,e[35]=S,e[36]=k,e[37]=j}else L=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]!==a?(C=s.isHomeRoot&&o.jsx(Oae,{onOpenFile:i,onShare:a,onDelete:c}),e[52]=s.isHomeRoot,e[53]=c,e[54]=i,e[55]=a,e[56]=C):C=e[56];let T;return e[57]!==L||e[58]!==w||e[59]!==S||e[60]!==k||e[61]!==C?(T=o.jsxs(o.Fragment,{children:[L,w,S,k,C]}),e[57]=L,e[58]=w,e[59]=S,e[60]=k,e[61]=C,e[62]=T):T=e[62],T}function zae(t){return t.kind==="file"}function Fae(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function Uae(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function Hae(t){return t.kind==="dir"&&t.hasSkill}function Kae({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=le(),{org:i}=He(),r=Ns(),l=rn(),a=Yl(),c=nl({strict:!1}),d=c.path||vu,u=Z2(d),h=IP(),f=u.volume!==null&&h.has(u.volume)?{...u,readOnly:!0}:u,m=(G,me)=>l({to:".",search:ye=>({...ye,[G]:me||void 0})}),p=G=>m("path",G),g=(G,me)=>l({to:".",search:ye=>({...ye,preview:void 0,skill:void 0,brand:void 0,[G]:me})}),x=t??(G=>g("preview",G)),b=e??(G=>g("skill",G)),v=s??(G=>g("brand",G)),[_,y]=A.useState(""),L=l9(_.trim(),300),w=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,S=w?n("library.library.searchInPlaceholder",{folder:Dc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?yu(i.slug):Dc(f.segments.at(-1)??""),[j,C]=A.useState(null),[T,N]=A.useState(null),[P,V]=A.useState(!1),[E,R]=A.useState(""),[I,D]=A.useState(!1),[O,$]=A.useState(null),[M,z]=A.useState(""),B=A.useRef(null),[U,H]=A.useState(!1),W=A.useRef(0),K=f.readOnly?null:f.volume,{upload:Q,mkdir:X,move:se}=gu(K??vu),{remove:ne}=gu(j?.volume??"uploads");async function te(G){if(!(!K||!G||G.length===0))try{await Q.mutateAsync({dir:f.dirPath,files:[...G]}),ve.success(G.length===1?n("library.library.uploadedSingle",{filename:G[0]?.name??""}):n("library.library.uploadedMultiple",{count:G.length}))}catch(me){ve.error(me instanceof Error?me.message:n("library.library.uploadFailed"))}finally{B.current&&(B.current.value="")}}const ee=K!==null;function Y(G){return G.dataTransfer.types.includes("Files")}function q(G){!ee||!Y(G)||(G.preventDefault(),W.current+=1,H(!0))}function oe(G){!ee||!Y(G)||G.preventDefault()}function J(){ee&&(W.current=Math.max(0,W.current-1),W.current===0&&H(!1))}function ie(G){ee&&(G.preventDefault(),G.stopPropagation(),W.current=0,H(!1),G.dataTransfer.files.length>0&&te(G.dataTransfer.files))}async function Z(){const G=E.trim();if(!(!K||!G)){if(f.isHomeRoot&&gp.has(G.toLowerCase())){ve.error(n("library.library.folderNameReserved",{name:G}));return}try{const me=f.dirPath;await X.mutateAsync(me?`${me}/${G}`:G),ve.success(n("library.library.folderCreated",{name:G})),V(!1),R("")}catch(me){ve.error(me instanceof Error?me.message:n("library.library.folderCreateFailed"))}}}async function he(){if(!j)return;const G=j;try{await ne.mutateAsync(G.path),ve.success(n("library.library.deleted",{name:cn(G.path)}))}catch(me){ve.error(me instanceof Error?me.message:n("library.library.deleteFailed"))}finally{C(null)}}async function de(){if(!O)return;const G=M.trim();if(!G||G.includes("/")||G.includes("..")||G===cn(O.path)){D(!1),$(null),z("");return}if(O.kind==="dir"&&f.isHomeRoot&&gp.has(G.toLowerCase())){ve.error(n("library.library.folderNameReserved",{name:G}));return}try{const me=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",ye=me?`${me}/${G}`:G;await se.mutateAsync({from:O.path,to:ye});const we=G.replace(/[<>]/g,"");ve.success(n("library.library.renamed",{name:we}))}catch(me){ve.error(me instanceof Error?me.message:n("library.library.renameFailed"))}finally{D(!1),$(null),z("")}}async function ae(G,me){try{const ye=cn(G),we=me?`${me}/${ye}`:ye;await se.mutateAsync({from:G,to:we}),ve.success(n("library.library.moved",{name:ye,destination:me||n("library.library.theLibrary")}))}catch(ye){ve.error(ye instanceof Error?ye.message:n("library.library.moveFailed"))}}function ce(){for(const G of Aae)r.invalidateQueries({queryKey:tt.orgFsVolume(i.id,G)});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 ue(G){G.defaultPrevented||!K||G.target.closest("input, textarea, button, a, [role='button']")||(G.preventDefault(),V(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:q,onDragOver:oe,onDragLeave:J,onDrop:ie,onContextMenu:ue,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(Yn,{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(Iae,{segments:f.segments,onNavigate:p})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(Yu,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(vt,{value:_,onChange:G=>y(G.target.value),onKeyDown:G=>{G.key==="Escape"&&y("")},placeholder:S,className:"h-9 rounded-xl pr-9 pl-9"}),_&&o.jsx(fe,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>y(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(ji,{size:14})})]}),o.jsx(fe,{variant:"ghost",size:"icon",onClick:ce,"aria-label":n("library.library.refresh"),children:o.jsx(On,{size:14})}),K&&o.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[o.jsx(Gt,{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(Qu,{size:12}),n("library.library.readOnly")]}):o.jsxs(fe,{size:"sm",disabled:Q.isPending,onClick:()=>B.current?.click(),children:[o.jsx(Yn,{size:14}),Q.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:B,type:"file",multiple:!0,className:"hidden",onChange:G=>{te(G.target.files)}})]}),L?o.jsx(Mae,{query:L,scope:w,stale:_.trim()!==L,onOpenFile:x,onShare:N,onDelete:C}):f.volume===null?o.jsx($ae,{onOpenDir:p}):o.jsx(Bae,{location:f,onOpenDir:p,onOpenFile:x,onOpenSkill:b,onOpenBrand:v,onShare:N,onDelete:C,onContextMenu:(G,me)=>{$({path:G,kind:me}),z(cn(G)),D(!0)},onMove:ae},f.volume)]})}),a&&(c.preview?o.jsx(Rk,{previewPath:c.preview,onClose:()=>m("preview",null)}):c.skill?o.jsx(s8,{skillPath:c.skill,onClose:()=>m("skill",null)},c.skill):c.brand?o.jsx(Ek,{brandPath:c.brand,onClose:()=>m("brand",null)},c.brand):null),o.jsx(zt,{open:P,onOpenChange:V,children:o.jsxs(Bt,{children:[o.jsxs(ds,{children:[o.jsx(qt,{children:n("library.library.newFolderTitle")}),o.jsx(Nn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(vt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:G=>R(G.target.value),onKeyDown:G=>{G.key==="Enter"&&Z()}}),o.jsxs(Gn,{children:[o.jsx(fe,{variant:"outline",onClick:()=>V(!1),children:n("library.library.cancel")}),o.jsx(fe,{disabled:!E.trim()||X.isPending,onClick:()=>{Z()},children:n("library.library.create")})]})]})}),o.jsx(zt,{open:I,onOpenChange:G=>{D(G),G||($(null),z(""))},children:o.jsxs(Bt,{children:[o.jsxs(ds,{children:[o.jsx(qt,{children:O&&n("library.library.renameTitle",{name:cn(O.path)})}),o.jsx(Nn,{children:n("library.library.renameDescription")})]}),o.jsx(vt,{autoFocus:!0,value:M,onChange:G=>z(G.target.value),onKeyDown:G=>{G.key==="Enter"&&de()}}),o.jsxs(Gn,{children:[o.jsx(fe,{variant:"outline",onClick:()=>D(!1),children:n("library.library.cancel")}),o.jsx(fe,{disabled:!M.trim()||se.isPending,onClick:()=>{de()},children:n("library.library.rename")})]})]})}),o.jsx(hae,{target:T,onOpenChange:G=>{G||N(null)}}),o.jsx(qr,{open:j!==null,onOpenChange:G=>{G||C(null)},children:o.jsxs(Gr,{children:[o.jsxs(Yr,{children:[o.jsx(Jr,{children:n("library.library.deleteTitle",{name:j?cn(j.path):""})}),o.jsx(Qr,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(Xr,{children:[o.jsx(Zr,{children:n("library.library.cancel")}),o.jsx(eo,{onClick:()=>{he()},children:n("library.library.delete")})]})]})})]})}function Wae(){const t=F.c(10),{openPanel:e}=Di(),[s,n]=A.useState(null),[i,r]=A.useState(null);let l;t[0]!==e?(l=o.jsx(Kae,{onOpenFile:u=>e(WC(u)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==s?(a=s&&o.jsx(s8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=a):a=t[3];let c;t[4]!==i?(c=i&&o.jsx(Ek,{brandPath:i,onClose:()=>r(null)},i),t[4]=i,t[5]=c):c=t[5];let d;return t[6]!==l||t[7]!==a||t[8]!==c?(d=o.jsxs("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[l,a,c]}),t[6]=l,t[7]=a,t[8]=c,t[9]=d):d=t[9],d}const av=A.lazy(()=>Gs(()=>import("./project-app-view-lSJv2DSd.js"),__vite__mapDeps([177,1,2,80,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,81,82,83,15,11,16,23,84,85,86,87,88,89,90,91,92,93,94,7,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,77,72,110,113,153,122,123,124,125,119,120,121,154,111,112,71,114,115,116,117,73,118,126,127,128,129,130,131,132,133,74,134,135,136,137,138,139,140,141,142,143,144,145,146,147,70,148,149,78,150,151,152,155,156,75,157,158,159])).then(t=>({default:t.AppViewContent}))),qae=A.lazy(()=>Gs(()=>import("./hosting-tab-StoCQBLo.js"),__vite__mapDeps([178,1,2,30,28,40,29,31,32,33,34,35,36,37,38,39,8,41,42,43,9,44,10,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,133,72,77,146,7,71,84,179,23,15,11,16,143])).then(t=>({default:t.HostingTab}))),Gae=A.lazy(()=>Gs(()=>import("./e2e-tab-9O9jlog6.js"),__vite__mapDeps([180,1,2,36,28,40,29,30,31,32,33,34,35,37,38,39,8,41,42,43,9,44,10,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,133,72,77,146,7,71,84,179,23,15,11,16,143,80,81,82,83,85,86,87,88,89,90,91,92,93,94,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,114])).then(t=>({default:t.E2eTab}))),Yae=A.lazy(()=>Gs(()=>import("./analytics-tab-BAIQskOJ.js"),__vite__mapDeps([181,1,2,29,30,31,32,33,34,35,36,37,38,39,8,28,40,41,42,43,9,44,10,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,133,136,72,77,84,182,183,184,146,7,179,23,15,11,16,143])).then(t=>({default:t.AnalyticsTab}))),Jae=A.lazy(()=>Gs(()=>import("./cdn-tab-BU_7vQmo.js"),__vite__mapDeps([185,1,2,49,182,183,184,179,73,23,15,11,16,143,186,187])).then(t=>({default:t.CdnTab})));function Qae(){const t=F.c(2),e=iA();let s;return t[0]!==e?(s=e?o.jsx(dF,{}):o.jsx(iF,{}),t[0]=e,t[1]=s):s=t[1],s}function Xae({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:i,automationTabParsed:r}){const l=U6(),a=Sc().monitorEnabled===!0||Sc().auth.localMode===!0;if(t==="overview")return o.jsx(Qae,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(wY,{})});if(qC(t))return o.jsx(B4,{virtualMcpId:e});if(t==="git")return o.jsx(cQ,{virtualMcpId:e});if(t==="automations")return o.jsx(Mle,{virtualMcpId:e});if(t==="site-editor")return o.jsx(Aie,{virtualMcpId:e});const c=hm(t);if(c)return o.jsx(Eie,{openPath:c.path});if(t==="content")return o.jsx(Koe,{virtualMcpId:e});if(t==="assets")return o.jsx(qoe,{virtualMcpId:e});if(t==="hosting"&&l.hosting)return o.jsx(qae,{virtualMcpId:e});if(t==="e2e"&&l.e2e)return o.jsx(Gae,{virtualMcpId:e});if(t==="analytics"&&l.analytics)return o.jsx(Yae,{virtualMcpId:e});if(t==="cdn"&&a&&l.monitor)return o.jsx(Jae,{virtualMcpId:e});if(t==="files")return o.jsx(Wae,{});if(t==="reports")return o.jsx(Hle,{});if(t==="discover")return o.jsx(Zle,{});if(t==="connect-sources")return o.jsx(zle,{});if(r)return o.jsx(Ele,{tabId:t});const d=Py(t);if(d)return o.jsx(mae,{path:d.path},d.path);const u=Ay(t);if(u)return o.jsx($le,{fileKey:u.key,taskId:s});const h=Ey(t);if(h)return o.jsx(bae,{path:h.path},h.path);const f=GC(t);if(f){const p=i.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(wi,{children:o.jsx(av,{connectionId:f.connectionId,toolName:f.toolName,args:p?.args},t)})}const m=n.find(p=>p.id===t);return m?o.jsx(wi,{children:o.jsx(av,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},t)}):o.jsx(B4,{virtualMcpId:e})}function Zae(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:l,expandedTools:a,automationTabParsed:c}=Vg(i);let d;e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==s||e[8]!==n?(d=o.jsx(wi,{children:o.jsx(Xae,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[3]=r,e[4]=c,e[5]=a,e[6]=l,e[7]=s,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==r||e[11]!==d?(u=o.jsx(sn,{children:d},r),e[10]=r,e[11]=d,e[12]=u):u=e[12],u}const ece=new Set(["site-editor","content"]);function tce(t){return t.hasClonableSource&&!t.fastPreviewActive&&t.mainTab!==null&&ece.has(t.mainTab)}const Al="setup";function sce(t){const e=F.c(57),s=le();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let y;e[3]!==t.scriptTabs?(y=L=>!t.scriptTabs.includes(L),e[3]=t.scriptTabs,e[4]=y):y=e[4],n=t.scripts.filter(y),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===Al?t.onToggle():t.onSelectTab(Al)},e[5]=t,e[6]=r):r=e[6];const l=r;let a;e[7]!==t.open||e[8]!==s?(a=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[7]=t.open,e[8]=s,e[9]=a):a=e[9];let c;e[10]!==t.open?(c=t.open?o.jsx(bs,{className:"size-4"}):o.jsx(l6,{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]!==a||e[15]!==c?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon-sm",onClick:t.onToggle,"aria-label":a,"aria-expanded":t.open,className:"size-6 shrink-0",children:c})}),e[12]=t.onToggle,e[13]=t.open,e[14]=a,e[15]=c,e[16]=d):d=e[16];let u;e[17]!==t.open||e[18]!==s?(u=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=u):u=e[19];let h;e[20]!==u?(h=o.jsx(We,{children:u}),e[20]=u,e[21]=h):h=e[21];let f;e[22]!==d||e[23]!==h?(f=o.jsxs(qe,{children:[d,h]}),e[22]=d,e[23]=h,e[24]=f):f=e[24];const m=t.active===Al;let p;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==m?(p=o.jsx(nce,{active:m,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=m,e[29]=p):p=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(y=>o.jsx(rce,{active:t.active===y,onClick:()=>{t.active===y?t.onToggle():t.onSelectTab(y)},onClose:()=>t.onCloseScript(y),t:s,children:y},y)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(oce,{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]!==p?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[p,g,x]}),e[36]=g,e[37]=x,e[38]=p,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(lce,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(ice,{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 _;return e[53]!==b||e[54]!==v||e[55]!==f?(_=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]=_):_=e[56],_}function nce(t){const e=F.c(11),{active:s,open:n,onClick:i,t:r}=t,l=s&&n,a=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 u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(cP,{className:"size-4"}),e[2]=u):u=e[2];let h;e[3]!==r?(h=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=h):h=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==h?(f=o.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[u,h]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=h,e[10]=f):f=e[10],f}function ice(t){const e=F.c(40),{status:s,onStart:n,onStop:i,onRestart:r,onResume:l,onRetry:a,t:c}=t;if(s==="idle"&&n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Rl,{className:"size-3.5"}),e[0]=d):d=e[0];let u;e[1]!==c?(u=c("sandbox.toolbar.start"),e[1]=c,e[2]=u):u=e[2];let h;return e[3]!==n||e[4]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:n,children:[d," ",u]}),e[3]=n,e[4]=u,e[5]=h):h=e[5],h}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Rl,{className:"size-3.5"}),e[6]=d):d=e[6];let u;e[7]!==c?(u=c("sandbox.toolbar.resume"),e[7]=c,e[8]=u):u=e[8];let h;return e[9]!==l||e[10]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:l,children:[d," ",u]}),e[9]=l,e[10]=u,e[11]=h):h=e[11],h}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(On,{className:"size-3.5"}),e[12]=d):d=e[12];let u;e[13]!==c?(u=c("sandbox.toolbar.retry"),e[13]=c,e[14]=u):u=e[14];let h;return e[15]!==a||e[16]!==u?(h=o.jsxs(fe,{variant:"outline",size:"xs",onClick:a,children:[d," ",u]}),e[15]=a,e[16]=u,e[17]=h):h=e[17],h}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,u=d?"rounded-r-none border-r-0":void 0;let h;e[18]!==u?(h=re(u),e[18]=u,e[19]=h):h=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let m;e[22]!==i||e[23]!==h||e[24]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",onClick:i,className:h,children:f})}),e[22]=i,e[23]=h,e[24]=f,e[25]=m):m=e[25];let p;e[26]!==c?(p=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=p):p=e[27];let g;e[28]!==p?(g=o.jsx(We,{children:p}),e[28]=p,e[29]=g):g=e[29];let x;e[30]!==m||e[31]!==g?(x=o.jsxs(qe,{children:[m,g]}),e[30]=m,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs(Ut,{children:[o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(bs,{className:"size-3"})})}),o.jsx(Kt,{align:"end",children:o.jsxs(Je,{onClick:r,children:[o.jsx(On,{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 rce(t){const e=F.c(17),{active:s,onClick:n,onClose:i,children:r,t:l}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let c;e[0]!==a?(c=re("flex h-6 items-center rounded-md border text-xs",a),e[0]=a,e[1]=c):c=e[1];const d=i?"pl-2 pr-1":"px-2",u=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let h;e[2]!==d||e[3]!==u?(h=re("flex h-full items-center",d,u),e[2]=d,e[3]=u,e[4]=h):h=e[4];let f;e[5]!==r||e[6]!==n||e[7]!==h?(f=o.jsx("button",{type:"button",onClick:n,className:h,children:r}),e[5]=r,e[6]=n,e[7]=h,e[8]=f):f=e[8];let m;e[9]!==r||e[10]!==i||e[11]!==l?(m=i&&o.jsx("button",{type:"button","aria-label":l("sandbox.toolbar.closeTab",{tab:String(r)}),onClick:i,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:o.jsx(Ks,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=l,e[12]=m):m=e[12];let p;return e[13]!==c||e[14]!==f||e[15]!==m?(p=o.jsxs("div",{className:c,children:[f,m]}),e[13]=c,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function oce(t){const e=F.c(27),{scripts:s,onRun:n}=t,i=le(),[r,l]=A.useState(!1);let a;e[0]!==i?(a=i("sandbox.toolbar.runScript"),e[0]=i,e[1]=a):a=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(Gt,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(os,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let u;e[5]!==i?(u=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=u):u=e[6];let h;e[7]!==u?(h=o.jsx(We,{children:u}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==d||e[10]!==h?(f=o.jsxs(qe,{children:[d,h]}),e[9]=d,e[10]=h,e[11]=f):f=e[11];let m;e[12]!==i?(m=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=m):m=e[13];let p;e[14]!==m?(p=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:m}),e[14]=m,e[15]=p):p=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:()=>{l(!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]!==p||e[21]!==g?(x=o.jsxs(as,{align:"start",className:"p-1 w-56",children:[p,g]}),e[20]=p,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==f?(b=o.jsxs(cs,{open:r,onOpenChange:l,children:[f,x]}),e[23]=r,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function lce(t){const e=F.c(30),{isRunning:s,isKilling:n,onRun:i,onStop:r,t:l}=t;if(n){let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(it,{className:"size-3.5"}),e[0]=f):f=e[0];let m;e[1]!==l?(m=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=m):m=e[2];let p;return e[3]!==m?(p=o.jsxs(fe,{variant:"outline",size:"xs",disabled:!0,children:[f," ",m]}),e[3]=m,e[4]=p):p=e[4],p}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Rl,{className:"size-3.5"}),e[5]=f):f=e[5];let m;e[6]!==l?(m=l("sandbox.toolbar.run"),e[6]=l,e[7]=m):m=e[7];let p;e[8]!==i||e[9]!==m?(p=o.jsx(Ke,{asChild:!0,children:o.jsxs(fe,{variant:"outline",size:"xs",onClick:i,children:[f," ",m]})}),e[8]=i,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(We,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==p||e[16]!==x?(b=o.jsxs(qe,{children:[p,x]}),e[15]=p,e[16]=x,e[17]=b):b=e[17],b}let a;e[18]!==l?(a=l("sandbox.toolbar.stop"),e[18]=l,e[19]=a):a=e[19];let c;e[20]!==r||e[21]!==a?(c=o.jsx(Ke,{asChild:!0,children:o.jsx(fe,{variant:"outline",size:"xs",onClick:r,children:a})}),e[20]=r,e[21]=a,e[22]=c):c=e[22];let d;e[23]!==l?(d=l("sandbox.toolbar.stopProcess"),e[23]=l,e[24]=d):d=e[24];let u;e[25]!==d?(u=o.jsx(We,{children:d}),e[25]=d,e[26]=u):u=e[26];let h;return e[27]!==c||e[28]!==u?(h=o.jsxs(qe,{children:[c,u]}),e[27]=c,e[28]=u,e[29]=h):h=e[29],h}var Mk=Object.defineProperty,ace=Object.getOwnPropertyDescriptor,cce=(t,e)=>{for(var s in e)Mk(t,s,{get:e[s],enumerable:!0})},Ts=(t,e,s,n)=>{for(var i=n>1?void 0:n?ace(e,s):e,r=t.length-1,l;r>=0;r--)(l=t[r])&&(i=(n?l(e,s,i):l(i))||i);return n&&i&&Mk(e,s,i),i},Ye=(t,e)=>(s,n)=>e(s,n,t),cv="Terminal input",xp={get:()=>cv,set:t=>cv=t},dv="Too much output to announce, navigate to rows manually to read",bp={get:()=>dv,set:t=>dv=t};function dce(t){return t.replace(/\r?\n/g,"\r")}function uce(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function hce(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function fce(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");Ok(i,e,s,n)}}function Ok(t,e,s,n){t=dce(t),t=uce(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function $k(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 uv(t,e,s,n,i){$k(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Eo(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function $9(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 mce=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 l=t.charCodeAt(r);if(55296<=l&&l<=56319){if(++r>=s)return this._interim=l,n;let a=t.charCodeAt(r);56320<=a&&a<=57343?e[n++]=(l-55296)*1024+a-56320+65536:(e[n++]=l,e[n++]=a);continue}l!==65279&&(e[n++]=l)}return n}},pce=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,l,a,c=0,d=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,g;for(;(g=this.interim[++p]&63)&&p<4;)m<<=6,m|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-p;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(x===2?m<128?d--:e[n++]=m:x===3?m<2048||m>=55296&&m<=57343||m===65279||(e[n++]=m):m<65536||m>1114111||(e[n++]=m)),this.interim.fill(0)}let u=s-4,h=d;for(;h<s;){for(;h<u&&!((i=t[h])&128)&&!((r=t[h+1])&128)&&!((l=t[h+2])&128)&&!((a=t[h+3])&128);)e[n++]=i,e[n++]=r,e[n++]=l,e[n++]=a,h+=4;if(i=t[h++],i<128)e[n++]=i;else if((i&224)===192){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(c=(i&31)<<6|r&63,c<128){h--;continue}e[n++]=c}else if((i&240)===224){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[h++],(l&192)!==128){h--;continue}if(c=(i&15)<<12|(r&63)<<6|l&63,c<2048||c>=55296&&c<=57343||c===65279)continue;e[n++]=c}else if((i&248)===240){if(h>=s)return this.interim[0]=i,n;if(r=t[h++],(r&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[h++],(l&192)!==128){h--;continue}if(h>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=l,n;if(a=t[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(r&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},Bk="",Oo=" ",v0=class zk{constructor(){this.fg=0,this.bg=0,this.extended=new wf}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 zk;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}},wf=class Fk{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 Fk(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},oi=class Uk extends v0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new wf,this.combinedData=""}static fromCharData(e){let s=new Uk;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?Eo(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()]}},hv="di$target",vp="di$dependencies",H1=new Map;function gce(t){return t[vp]||[]}function ln(t){if(H1.has(t))return H1.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");xce(e,s,i)};return e._id=t,H1.set(t,e),e}function xce(t,e,s){e[hv]===e?e[vp].push({id:t,index:s}):(e[vp]=[{id:t,index:s}],e[hv]=e)}var Pn=ln("BufferService"),Hk=ln("CoreMouseService"),ha=ln("CoreService"),bce=ln("CharsetService"),tx=ln("InstantiationService"),Kk=ln("LogService"),En=ln("OptionsService"),Wk=ln("OscLinkService"),vce=ln("UnicodeService"),y0=ln("DecorationService"),yp=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 oi,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let u=0;u<l;u++)if(!(c===-1&&!s.hasContent(u))){if(s.loadCell(u,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=u,a=r.extended.urlId;continue}else d=r.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&u===l-1){let h=this._oscLinkService.getLinkData(a)?.uri;if(h){let f={start:{x:c+1,y:t},end:{x:u+(!d&&u===l-1?1:0),y:t}},m=!1;if(!i?.allowNonHttpProtocols)try{let p=new URL(h);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||n.push({text:h,range:f,activate:(p,g)=>i?i.activate(p,g,f):yce(p,g),hover:(p,g)=>i?.hover?.(p,g,f),leave:(p,g)=>i?.leave?.(p,g,f)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=u,a=r.extended.urlId):(c=-1,a=-1)}}e(n)}};yp=Ts([Ye(0,Pn),Ye(1,En),Ye(2,Wk)],yp);function yce(t,e){if(confirm(`Do you want to navigate to ${e}?
809
809
 
810
810
  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 B9=ln("CharSizeService"),oo=ln("CoreBrowserService"),sx=ln("MouseService"),lo=ln("RenderService"),_ce=ln("SelectionService"),qk=ln("CharacterJoinerService"),hd=ln("ThemeService"),Gk=ln("LinkProviderService"),Lce=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?fv.isErrorNoTelemetry(t)?new fv(t.message+`
811
811
 
@@ -824,4 +824,4 @@ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){t
824
824
 
825
825
  `)||n}}function rhe(t,e){const s=t.trim().split(`
826
826
  `);return Bj({title:s[0]??"",body:s.slice(1).join(`
827
- `),fallbackTitle:e})}function px(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function gx(t){return t.fastPreview?{fastPreview:!0}:void 0}async function rm(t,e,s){try{return await s()}catch(n){throw new mx(n instanceof Error?n.message:e,t)}}async function zj(t){const e=t.expectedHeadSha;if(!e)return;const n=(await Nc(px(t),gx(t)).catch(()=>null))?.headSha;if(n&&n!==e)throw new $j(e,n)}function Fj(t,e){return iJ(px(t),e,gx(t))}function Uj(t,e){return tR(t.githubClient,{owner:t.owner,repo:t.repo,branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor,existing:t.existingOpenPr})}async function Hj(t,e,s){await zj(t),await rm("push",s("thread.publishDialog.failedPushChanges"),()=>Fj(t,e.message)),await rm("sync",s("thread.publishDialog.failedRebase"),()=>KL(px(t),t.baseBranch,gx(t)));const n=await rm("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>Uj(t,e));try{await B8(t.githubClient,{owner:t.owner,repo:t.repo,pullNumber:n.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(i){throw new mx(i instanceof Error?i.message:s("thread.publishDialog.failedMergePullRequest"),"merge",n)}return n}async function Kj(t,e){return await zj(t),await Fj(t,e.message),Uj(t,e)}function ohe(t,e){return t instanceof $j?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof mx&&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 i2(t,e){const s=ohe(t,e),n=s.pullRequest;return n&&ve.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 Wj(t,e){ve.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnGithub"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function lhe(t){const{mode:e,target:s,note:n,allPaths:i,destinationHost:r,publishLockRef:l,onOpenChange:a,refresh:c,onPullRequestChanged:d,onPublished:u}=t,h=le(),[f,m]=A.useState(!1),[p,g]=A.useState(!1),[x,b]=A.useState(),v=()=>rhe(n,h("thread.publishDialog.changesFrom",{branch:s.headBranch})),_=async()=>{l.current=!0,m(!0),b(void 0);try{await Hj(s,v(),h),ve.success(r?h("thread.publishPopover.publishedTo",{host:r}):h("thread.publishDialog.publishedTo",{baseBranch:s.baseBranch})),a(!1),await Promise.all([d?.(),u?.()])}catch(w){const S=i2(w,h);b(S.message),S.pullRequestOpened&&await d?.(),S.headMoved&&await c()}finally{l.current=!1,m(!1)}},y=async()=>{l.current=!0,m(!0),b(void 0);try{const w=await Kj(s,v());Wj(w,h),a(!1),await d?.()}catch(w){const S=i2(w,h);b(S.message||h("thread.publishDialog.failedSubmitForReview")),S.headMoved&&await c()}finally{l.current=!1,m(!1)}},L=async(w,S)=>{g(!0);try{await ep({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},w,{fastPreview:!0}),ve.success(S),await c()}catch(k){ve.error(k instanceof Error?k.message:h("thread.publishPopover.failedDiscard"))}finally{g(!1)}};return{isPublishing:f,isDiscarding:p,publishError:x,submit:e==="review"?y:_,discardChange:w=>L(w.filepaths,h("thread.publishPopover.discarded",{name:w.name})),discardAll:async()=>{i.length!==0&&await L(i,h("thread.publishDialog.allChangesDiscarded"))}}}function ahe(t,e,s,n,i){return["cms-publish-bodies",t,e,s,n,i]}const che=6e4;function dhe(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:XC},n[4]=i,n[5]=r):r=n[5];const{data:l}=Mt(r);return l}function uhe(t){const e=F.c(43),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,baseBranch:l}=t;let a,c,d,u;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c={orgSlug:s,virtualMcpId:n,branch:i,threadId:r},a={fastPreview:!0},d=Ef,u=JL(c,a),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=a,e[5]=c,e[6]=d,e[7]=u):(a=e[4],c=e[5],d=e[6],u=e[7]);const h=d(u),f=h.data,m=f.changedFiles??null,p=f.headSha??null,g=m?m.length>0:(f.aheadOfBase??0)>0;let x;e[8]!==l||e[9]!==i||e[10]!==p||e[11]!==s||e[12]!==n?(x=ahe(s,n,i,l,p),e[8]=l,e[9]=i,e[10]=p,e[11]=s,e[12]=n,e[13]=x):x=e[13];let b;e[14]!==l||e[15]!==a||e[16]!==c?(b=()=>tu(c,{base:l},a),e[14]=l,e[15]=a,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:che},e[18]=x,e[19]=b,e[20]=g,e[21]=v):v=e[21];const _=Mt(v),y=dhe(s,n,i),L=_.data??null;let w;e[22]!==y||e[23]!==L||e[24]!==m?(w=m?Mj({files:m,lookup:y,diff:L}):B0e(L),e[22]=y,e[23]=L,e[24]=m,e[25]=w):w=e[25];const S=w;let k;e[26]!==L?.diffs||e[27]!==m?(k=m?m.map(hhe):Object.keys(L?.diffs??{}),e[26]=L?.diffs,e[27]=m,e[28]=k):k=e[28];const j=f.changedFilesTotal??S.count,C=f.changedFilesTruncated??!1,T=g&&_.isPending,N=!m&&g&&_.isPending;let P;e[29]!==h?(P=()=>h.refetch(),e[29]=h,e[30]=P):P=e[30];let V;return e[31]!==_.isError||e[32]!==L||e[33]!==p||e[34]!==f||e[35]!==S||e[36]!==N||e[37]!==P||e[38]!==k||e[39]!==j||e[40]!==C||e[41]!==T?(V={status:f,summary:S,allPaths:k,changedFilesTotal:j,changedFilesTruncated:C,headSha:p,diff:L,bodiesPending:T,bodiesFailed:_.isError,cardsPending:N,refresh:P},e[31]=_.isError,e[32]=L,e[33]=p,e[34]=f,e[35]=S,e[36]=N,e[37]=P,e[38]=k,e[39]=j,e[40]=C,e[41]=T,e[42]=V):V=e[42],V}function hhe(t){return t.path}function fhe(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function mhe(t){const e=F.c(28),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:l,status:a,diff:c,enabled:d}=t,[u]=pr(),{language:h}=u;let f,m,p;if(e[0]!==i||e[1]!==c||e[2]!==d||e[3]!==l||e[4]!==h||e[5]!==s||e[6]!==a||e[7]!==r||e[8]!==n){const L=c?lJ(c):"";f=d&&!!i&&!!a&&!!c&&L!=="",p=Mt,m=fhe({orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:l,signature:L,language:h}),e[0]=i,e[1]=c,e[2]=d,e[3]=l,e[4]=h,e[5]=s,e[6]=a,e[7]=r,e[8]=n,e[9]=f,e[10]=m,e[11]=p}else f=e[9],m=e[10],p=e[11];let g;e[12]!==i||e[13]!==c||e[14]!==l||e[15]!==h||e[16]!==s||e[17]!==a||e[18]!==r||e[19]!==n?(g=()=>aJ({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},{status:a,diff:c,language:h},l?{fastPreview:!0}:void 0),e[12]=i,e[13]=c,e[14]=l,e[15]=h,e[16]=s,e[17]=a,e[18]=r,e[19]=n,e[20]=g):g=e[20];let x;e[21]!==f||e[22]!==m||e[23]!==g?(x={queryKey:m,queryFn:g,enabled:f,staleTime:1/0,gcTime:6e5,retry:phe},e[21]=f,e[22]=m,e[23]=g,e[24]=x):x=e[24];const b=p(x),v=b.data??null,_=f&&b.isFetching&&!b.data;let y;return e[25]!==v||e[26]!==_?(y={verdict:v,loading:_},e[25]=v,e[26]=_,e[27]=y):y=e[27],y}function phe(t,e){return!UL(e)&&t<1}function qj(t){const e=F.c(30),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:l,status:a,diff:c,policy:d,judgeEnabled:u,paths:h}=t,f=u===void 0?!0:u,m=h===void 0?null:h;let p;e[0]!==c||e[1]!==f||e[2]!==d?(p=f&&gJ(c,d),e[0]=c,e[1]=f,e[2]=d,e[3]=p):p=e[3];const g=p;let x;e[4]!==i||e[5]!==c||e[6]!==l||e[7]!==g||e[8]!==s||e[9]!==a||e[10]!==r||e[11]!==n?(x={orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:l,status:a,diff:c,enabled:g},e[4]=i,e[5]=c,e[6]=l,e[7]=g,e[8]=s,e[9]=a,e[10]=r,e[11]=n,e[12]=x):x=e[12];const{verdict:b,loading:v}=mhe(x);if(!c&&m){let w;e[13]!==m||e[14]!==d?(w=pJ(m,d),e[13]=m,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=mJ(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 _;e[24]!==v||e[25]!==b?(_=xJ(b,v),e[24]=v,e[25]=b,e[26]=_):_=e[26];const y=!v;let L;return e[27]!==_||e[28]!==y?(L={gate:_,ready:y},e[27]=_,e[28]=y,e[29]=L):L=e[29],L}const Gj="(max-width: 479px)";function ghe(t){const e=globalThis.matchMedia(Gj);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function xhe(){return A.useSyncExternalStore(ghe,vhe,bhe)}function bhe(){return!1}function vhe(){return globalThis.matchMedia(Gj).matches}function yhe(t){const e=F.c(22),s=xhe(),n=A.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(ry,{...t,publishLockRef:n}):null,e[2]=t,e[3]=d):d=e[3];let u;e[4]!==d?(u=o.jsx(Bt,{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]=u):u=e[5];let h;e[6]!==r||e[7]!==t.open||e[8]!==u?(h=o.jsx(zt,{open:t.open,onOpenChange:r,children:u}),e[6]=r,e[7]=t.open,e[8]=u,e[9]=h):h=e[9];let f;return e[10]!==t.children||e[11]!==h?(f=o.jsxs(o.Fragment,{children:[t.children,h]}),e[10]=t.children,e[11]=h,e[12]=f):f=e[12],f}let l;e[13]!==t.children?(l=o.jsx(ZT,{asChild:!0,children:o.jsx("span",{className:"inline-flex",children:t.children})}),e[13]=t.children,e[14]=l):l=e[14];let a;e[15]!==t?(a=o.jsx(as,{align:"end",sideOffset:8,collisionPadding:12,onFocusOutside:_he,className:"flex max-h-[min(720px,85vh)] w-[420px] flex-col gap-0 overflow-hidden p-0",children:o.jsx(ry,{...t,publishLockRef:n})}),e[15]=t,e[16]=a):a=e[16];let c;return e[17]!==r||e[18]!==t.open||e[19]!==l||e[20]!==a?(c=o.jsxs(cs,{open:t.open,onOpenChange:r,children:[l,a]}),e[17]=r,e[18]=t.open,e[19]=l,e[20]=a,e[21]=c):c=e[21],c}function _he(t){return t.preventDefault()}function xx(t){const e=F.c(11),{mode:s,title:n,subLine:i,trailing:r}=t,l=s==="review"?Hr:zn;let a;e[0]!==l?(a=o.jsx(l,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a||e[3]!==n||e[4]!==r?(c=o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a,n,r]}),e[2]=a,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 u;return e[8]!==c||e[9]!==d?(u=o.jsxs(o.Fragment,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function bx(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 l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Qu,{className:"size-4"}),e[2]=l):l=e[2];let a;e[3]!==n?(a=n("thread.publishPopover.preview"),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==i||e[6]!==r||e[7]!==a?(c=o.jsxs(fe,{type:"button",variant:"outline",onClick:i,disabled:r,children:[l,a]}),e[5]=i,e[6]=r,e[7]=a,e[8]=c):c=e[8],c}function Lhe(t){const e=F.c(20),{mode:s,draftPreviewUrl:n}=t,i=le();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Fr,{className:"h-3.5 w-48"}),e[0]=r):r=e[0];let l;e[1]!==s?(l=o.jsx(xx,{mode:s,title:r}),e[1]=s,e[2]=l):l=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(t2,{children:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(hu,{}),o.jsx(hu,{}),o.jsx(hu,{})]})}),c=o.jsxs(o.Fragment,{children:[o.jsx(Fr,{className:"h-3 w-20"}),o.jsx(Fr,{className:"h-14 w-full rounded-lg"})]}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let d;e[5]!==n||e[6]!==i?(d=o.jsx(bx,{draftPreviewUrl:n,t:i}),e[5]=n,e[6]=i,e[7]=d):d=e[7];const u=s==="review"?"default":"brand";let h;e[8]!==s||e[9]!==i?(h=i(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[8]=s,e[9]=i,e[10]=h):h=e[10];let f;e[11]!==u||e[12]!==h?(f=o.jsx(fe,{type:"button",variant:u,className:"flex-1",disabled:!0,children:h}),e[11]=u,e[12]=h,e[13]=f):f=e[13];let m;e[14]!==d||e[15]!==f?(m=o.jsxs("div",{className:"flex gap-2",children:[d,f]}),e[14]=d,e[15]=f,e[16]=m):m=e[16];let p;return e[17]!==l||e[18]!==m?(p=o.jsx(fx,{state:"loading",header:l,body:a,note:c,footer:m}),e[17]=l,e[18]=m,e[19]=p):p=e[19],p}function whe(t){const e=F.c(25),{mode:s,draftPreviewUrl:n,message:i,onRetry:r}=t,l=le();let a;e[0]!==l?(a=l("thread.publishPopover.loadFailed"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=o.jsx("span",{className:"truncate",children:a}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==s||e[5]!==c?(d=o.jsx(xx,{mode:s,title:c}),e[4]=s,e[5]=c,e[6]=d):d=e[6];let u;e[7]!==i?(u=o.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:i}),e[7]=i,e[8]=u):u=e[8];let h;e[9]!==n||e[10]!==l?(h=o.jsx(bx,{draftPreviewUrl:n,t:l}),e[9]=n,e[10]=l,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(On,{className:"size-4"}),e[12]=f):f=e[12];let m;e[13]!==l?(m=l("thread.publishPopover.retry"),e[13]=l,e[14]=m):m=e[14];let p;e[15]!==r||e[16]!==m?(p=o.jsxs(fe,{type:"button",variant:"outline",className:"flex-1",onClick:r,children:[f,m]}),e[15]=r,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==h||e[19]!==p?(g=o.jsxs("div",{className:"flex gap-2",children:[h,p]}),e[18]=h,e[19]=p,e[20]=g):g=e[20];let x;return e[21]!==d||e[22]!==u||e[23]!==g?(x=o.jsx(fx,{state:"ready",header:d,body:u,footer:g}),e[21]=d,e[22]=u,e[23]=g,e[24]=x):x=e[24],x}function ry(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:u}=c;return o.jsx(whe,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:d?.message??"",onRetry:u})},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(Lhe,{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(She,{...t}),e[6]=t,e[7]=r):r=e[7];let l;e[8]!==i||e[9]!==r?(l=o.jsx(A.Suspense,{fallback:i,children:r}),e[8]=i,e[9]=r,e[10]=l):l=e[10];let a;return e[11]!==n||e[12]!==l?(a=o.jsx(sn,{fallback:n,children:l}),e[11]=n,e[12]=l,e[13]=a):a=e[13],a}function She(t){const e=F.c(168),{publishLockRef:s,onOpenChange:n,mode:i,orgSlug:r,orgId:l,virtualMcpId:a,branch:c,baseBranch:d,githubConnectionId:u,owner:h,repo:f,publishPolicy:m,draftPreviewUrl:p,destinationHost:g,lastPublishedPr:x,onRequestApproval:b,openPullRequest:v,onPullRequestChanged:_,onPublished:y}=t,L=i===void 0?"publish":i,w=x===void 0?null:x,S=v===void 0?null:v,k=le(),j=hs()?.taskId??null;let C;e[0]!==u||e[1]!==l||e[2]!==r?(C={connectionId:u,orgId:l,orgSlug:r},e[0]=u,e[1]=l,e[2]=r,e[3]=C):C=e[3];const T=Cs(C),{data:N}=vn.useSession();let P;e[4]!==d||e[5]!==c||e[6]!==r||e[7]!==j||e[8]!==a?(P={orgSlug:r,virtualMcpId:a,branch:c,threadId:j,baseBranch:d},e[4]=d,e[5]=c,e[6]=r,e[7]=j,e[8]=a,e[9]=P):P=e[9];const{status:V,summary:E,allPaths:R,changedFilesTotal:I,changedFilesTruncated:D,headSha:O,diff:$,bodiesPending:M,bodiesFailed:z,cardsPending:B,refresh:U}=uhe(P),[H,W]=A.useState(null),[K,Q]=A.useState(!1),[X,se]=A.useState(null),[ne,te]=A.useState(null);let ee;e[10]!==H||e[11]!==E?(ee=H0e(H,W0e(E)),e[10]=H,e[11]=E,e[12]=ee):ee=e[12];const Y=ee,q=L==="review",oe=B?"loading":M?"manifest":"ready",J=!q;let ie;e[13]!==R||e[14]!==c||e[15]!==$||e[16]!==V||e[17]!==r||e[18]!==m||e[19]!==J||e[20]!==j||e[21]!==a?(ie={orgSlug:r,virtualMcpId:a,branch:c,threadId:j,fastPreview:!0,status:V,diff:$,paths:R,policy:m,judgeEnabled:J},e[13]=R,e[14]=c,e[15]=$,e[16]=V,e[17]=r,e[18]=m,e[19]=J,e[20]=j,e[21]=a,e[22]=ie):ie=e[22];const{gate:Z}=qj(ie),he=S?.state==="open";let de;e[23]!==c||e[24]!==V?(de=l3(V)??c,e[23]=c,e[24]=V,e[25]=de):de=e[25];const ae=N?.user;let ce;e[26]!==ae?(ce=hx(ae),e[26]=ae,e[27]=ce):ce=e[27];const ue=O??void 0;let G;e[28]!==he||e[29]!==S?(G=he?{number:S.number,htmlUrl:S.htmlUrl}:void 0,e[28]=he,e[29]=S,e[30]=G):G=e[30];let me;e[31]!==d||e[32]!==c||e[33]!==T||e[34]!==r||e[35]!==h||e[36]!==f||e[37]!==ce||e[38]!==ue||e[39]!==G||e[40]!==de||e[41]!==j||e[42]!==a?(me={orgSlug:r,virtualMcpId:a,branch:c,threadId:j,fastPreview:!0,baseBranch:d,githubClient:T,owner:h,repo:f,headBranch:de,coAuthor:ce,expectedHeadSha:ue,existingOpenPr:G},e[31]=d,e[32]=c,e[33]=T,e[34]=r,e[35]=h,e[36]=f,e[37]=ce,e[38]=ue,e[39]=G,e[40]=de,e[41]=j,e[42]=a,e[43]=me):me=e[43];const ye=me;let we;e[44]!==R||e[45]!==g||e[46]!==L||e[47]!==Y||e[48]!==n||e[49]!==y||e[50]!==_||e[51]!==s||e[52]!==U||e[53]!==ye?(we={mode:L,target:ye,note:Y,allPaths:R,destinationHost:g,publishLockRef:s,onOpenChange:n,refresh:U,onPullRequestChanged:_,onPublished:y},e[44]=R,e[45]=g,e[46]=L,e[47]=Y,e[48]=n,e[49]=y,e[50]=_,e[51]=s,e[52]=U,e[53]=ye,e[54]=we):we=e[54];const{isPublishing:Ne,isDiscarding:je,publishError:_e,submit:Ve,discardChange:xe,discardAll:Se}=lhe(we),Ce=!Ne&&E.count>0&&(q||Z.allowed);let Ae;e[55]!==q||e[56]!==E.count||e[57]!==k?(Ae=q?E.count===0?k("thread.publishPopover.submitForReview"):E.count===1?k("thread.publishPopover.submitOneForReview"):k("thread.publishPopover.submitCountForReview",{count:E.count}):E.count===0?k("thread.publishPopover.publish"):E.count===1?k("thread.publishPopover.publishOneInProduction"):k("thread.publishPopover.publishCountInProduction",{count:E.count}),e[55]=q,e[56]=E.count,e[57]=k,e[58]=Ae):Ae=e[58];const st=Ae;let Be;e:{if(q&&he){let at;e[59]!==S.number||e[60]!==k?(at=k("thread.publishPopover.updatesPullRequest",{number:S.number}),e[59]=S.number,e[60]=k,e[61]=at):at=e[61],Be=at;break e}const ht=w;if(!ht?.mergedAt){Be=null;break e}let ft;if(e[62]!==ht||e[63]!==k){const at=ed(new Date(ht.mergedAt)),pt=ihe(ht);ft=pt?k("thread.publishPopover.lastPublishedBy",{when:at,name:pt}):k("thread.publishPopover.lastPublished",{when:at}),e[62]=ht,e[63]=k,e[64]=ft}else ft=e[64];Be=ft}const Ie=Be;let Oe;e[65]!==q||e[66]!==E.count||e[67]!==k?(Oe=q?k("thread.publishPopover.submitForReview"):E.count===1?k("thread.publishPopover.publishOne"):E.count>1?k("thread.publishPopover.publishCount",{count:E.count}):k("thread.publishPopover.publish"),e[65]=q,e[66]=E.count,e[67]=k,e[68]=Oe):Oe=e[68];const mt=Oe;let lt;e[69]!==M||e[70]!==ne||e[71]!==xe||e[72]!==X||e[73]!==$||e[74]!==je||e[75]!==Ne?(lt=(ht,ft)=>ft.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}),ft.map(at=>{const pt=Oj(at);return o.jsx(Z0e,{change:at,diff:$,bodyPending:M,expanded:X===pt,onToggleExpanded:()=>se(X===pt?null:pt),confirming:ne===pt,onConfirmingChange:Lt=>te(Lt?pt:null),onDiscard:()=>{xe(at)},isPublishing:Ne,isDiscarding:je},pt)})]}),e[69]=M,e[70]=ne,e[71]=xe,e[72]=X,e[73]=$,e[74]=je,e[75]=Ne,e[76]=lt):lt=e[76];const Xe=lt;let nt;e:{if(q||E.count===0){nt=null;break e}if(Z.pending){let pt;e[77]===Symbol.for("react.memo_cache_sentinel")?(pt=o.jsx(it,{className:"size-3.5 motion-reduce:animate-none"}),e[77]=pt):pt=e[77];let Lt;e[78]!==k?(Lt=k("thread.publishPopover.reviewing"),e[78]=k,e[79]=Lt):Lt=e[79];let bt;e[80]!==Lt?(bt=o.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[pt,Lt]}),e[80]=Lt,e[81]=bt):bt=e[81],nt=bt;break e}if(Z.allowed){nt=null;break e}let ht;e[82]===Symbol.for("react.memo_cache_sentinel")?(ht=o.jsx(sl,{className:"mt-0.5 size-3.5 shrink-0"}),e[82]=ht):ht=e[82];let ft;e[83]!==Z.reason||e[84]!==k?(ft=Z.reason??k("thread.publishPopover.needsReviewGeneric"),e[83]=Z.reason,e[84]=k,e[85]=ft):ft=e[85];let at;e[86]!==ft?(at=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:ft})]}),e[86]=ft,e[87]=at):at=e[87],nt=at}const Fe=nt;let dt;e:{if(E.count<=1||D){dt=null;break e}if(K){let Lt;e[88]!==k?(Lt=k("thread.publishPopover.discardAllConfirm"),e[88]=k,e[89]=Lt):Lt=e[89];let bt;e[90]!==Lt?(bt=o.jsx("span",{className:"text-destructive",children:Lt}),e[90]=Lt,e[91]=bt):bt=e[91];let Ft;e[92]===Symbol.for("react.memo_cache_sentinel")?(Ft=()=>Q(!1),e[92]=Ft):Ft=e[92];let ge;e[93]!==k?(ge=k("thread.publishDialog.cancel"),e[93]=k,e[94]=ge):ge=e[94];let Ee;e[95]!==ge?(Ee=o.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:Ft,children:ge}),e[95]=ge,e[96]=Ee):Ee=e[96];let Re;e[97]!==Se?(Re=()=>{Q(!1),Se()},e[97]=Se,e[98]=Re):Re=e[98];let ke;e[99]!==k?(ke=k("thread.publishPopover.discard"),e[99]=k,e[100]=ke):ke=e[100];let ot;e[101]!==je||e[102]!==Re||e[103]!==ke?(ot=o.jsx("button",{type:"button",className:"font-medium text-destructive disabled:opacity-50",onClick:Re,disabled:je,children:ke}),e[101]=je,e[102]=Re,e[103]=ke,e[104]=ot):ot=e[104];let Le;e[105]!==bt||e[106]!==Ee||e[107]!==ot?(Le=o.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11px]",children:[bt,Ee,ot]}),e[105]=bt,e[106]=Ee,e[107]=ot,e[108]=Le):Le=e[108],dt=Le;break e}let ht;e[109]===Symbol.for("react.memo_cache_sentinel")?(ht=()=>Q(!0),e[109]=ht):ht=e[109];const ft=Ne||je;let at;e[110]!==k?(at=k("thread.publishPopover.discardAll"),e[110]=k,e[111]=at):at=e[111];let pt;e[112]!==ft||e[113]!==at?(pt=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:ft,children:at}),e[112]=ft,e[113]=at,e[114]=pt):pt=e[114],dt=pt}const et=dt;let rt;e[115]!==z||e[116]!==B||e[117]!==I||e[118]!==D||e[119]!==q||e[120]!==Xe||e[121]!==E.blocks||e[122]!==E.count||e[123]!==E.other||e[124]!==E.pages||e[125]!==k?(rt=B?o.jsx(t2,{children:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(hu,{}),o.jsx(hu,{})]})}):E.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:k(q?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:k(q?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):o.jsxs(t2,{children:[D?o.jsx("p",{className:"text-[11px] text-muted-foreground",children:k("thread.publishPopover.showingFirst",{shown:E.count,total:I})}):null,Xe(k("thread.publishPopover.pagesGroup"),E.pages),Xe(k("thread.publishPopover.blocksGroup"),E.blocks),Xe(k("thread.publishPopover.otherGroup"),E.other),z?o.jsx("p",{className:"text-[11px] text-muted-foreground",children:k("thread.publishPopover.detailsUnavailable")}):null]}),e[115]=z,e[116]=B,e[117]=I,e[118]=D,e[119]=q,e[120]=Xe,e[121]=E.blocks,e[122]=E.count,e[123]=E.other,e[124]=E.pages,e[125]=k,e[126]=rt):rt=e[126];const gt=rt;let pe;e[127]!==st?(pe=o.jsx("span",{className:"truncate",children:st}),e[127]=st,e[128]=pe):pe=e[128];let Me;e[129]!==et||e[130]!==L||e[131]!==Ie||e[132]!==pe?(Me=o.jsx(xx,{mode:L,title:pe,subLine:Ie,trailing:et}),e[129]=et,e[130]=L,e[131]=Ie,e[132]=pe,e[133]=Me):Me=e[133];let Ze;e[134]!==Ne||e[135]!==q||e[136]!==Y||e[137]!==E.count||e[138]!==k?(Ze=E.count===0?null:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-[13px] font-medium",children:k(q?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),o.jsx(Jo,{value:Y,onChange:ht=>W(ht.target.value),placeholder:k(q?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,className:"resize-none text-[13px]",disabled:Ne})]}),e[134]=Ne,e[135]=q,e[136]=Y,e[137]=E.count,e[138]=k,e[139]=Ze):Ze=e[139];let ct;e[140]!==p||e[141]!==k?(ct=o.jsx(bx,{draftPreviewUrl:p,t:k}),e[140]=p,e[141]=k,e[142]=ct):ct=e[142];let _t;e[143]!==Ce||e[144]!==Z||e[145]!==Ne||e[146]!==q||e[147]!==b||e[148]!==mt||e[149]!==Ve||e[150]!==E.count||e[151]!==k?(_t=!q&&E.count>0&&!Z.allowed&&!Z.pending?o.jsx(fe,{type:"button",className:"flex-1",onClick:b,disabled:Ne,children:k("thread.publishPopover.requestApproval")}):o.jsxs(fe,{type:"button",variant:q?"default":"brand",className:"flex-1",onClick:()=>{Ve()},disabled:!Ce,children:[Ne?o.jsx(it,{className:"size-4 motion-reduce:animate-none"}):null,Ne?k(q?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):mt]}),e[143]=Ce,e[144]=Z,e[145]=Ne,e[146]=q,e[147]=b,e[148]=mt,e[149]=Ve,e[150]=E.count,e[151]=k,e[152]=_t):_t=e[152];let wt;e[153]!==ct||e[154]!==_t?(wt=o.jsxs("div",{className:"flex gap-2",children:[ct,_t]}),e[153]=ct,e[154]=_t,e[155]=wt):wt=e[155];let ze;e[156]!==_e?(ze=_e?o.jsx("p",{className:"text-xs text-destructive",children:_e}):null,e[156]=_e,e[157]=ze):ze=e[157];let yt;e[158]!==wt||e[159]!==ze?(yt=o.jsxs(o.Fragment,{children:[wt,ze]}),e[158]=wt,e[159]=ze,e[160]=yt):yt=e[160];let At;return e[161]!==gt||e[162]!==Fe||e[163]!==oe||e[164]!==Me||e[165]!==Ze||e[166]!==yt?(At=o.jsx(fx,{state:oe,header:Me,body:gt,note:Ze,gate:Fe,footer:yt}),e[161]=gt,e[162]=Fe,e[163]=oe,e[164]=Me,e[165]=Ze,e[166]=yt,e[167]=At):At=e[167],At}function khe(){return!1}function Yj(t,e){khe()&&console.log(`[github-header] ${t}`,e??"")}function jhe(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return Kw[t].short}const Che=new Set(["failure","timed_out","cancelled","action_required"]);function Jj(t){return t.status==="completed"&&Che.has(t.conclusion)}function vx(t){return t.status==="queued"||t.status==="in_progress"}function Ph(t){return t.isPending&&t.fetchStatus!=="idle"}function Nhe(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr-page"}}function Er(t,e,s){return e?[...t,Nhe(s)]:t}function bi(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 oy(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function gh(t,e,s){if(e.filter(vx).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 Vhe(t){const{lifecycle:e,branch:s,pr:n,checks:i,reviews:r,loading:l,t:a}=t;if(l)return{label:a("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&jhe(t.claimPhase.kind)||a("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:a("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:a("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||a("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:a("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:a("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:a("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:a("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:a("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:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:bi([],c,a)};if(c.workingTreeDirty||d)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:bi(Er([oy(a)],n,a),c,a)};if(Yj("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:a("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:a("thread.headerActions.openNewPrTooltip"),menu:bi(Er([],n,a),c,a)}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.prMergedTooltip",{prNumber:String(n.number),base:n.base}),menu:bi(Er([],n,a),c,a)};if(c.aheadOfBase>0){if(n&&n.state==="closed"&&!n.merged)return{label:a("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:a("thread.headerActions.reopenPrTooltip",{prNumber:String(n.number)}),menu:bi(Er([],n,a),c,a)};if(!n)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:bi([oy(a)],c,a)};if((r?.mergeableState??"unknown")==="dirty")return{label:a("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:a("thread.cmsActions.resolveOnGithub"),action:"open-pr-page"}]};const h=i.filter(vx).length,f=i.filter(Jj).map(p=>p.name);if(h===0&&f.length>0)return{label:a("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:a("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:bi(Er([{key:"publish-anyway",label:a("thread.headerActions.publishAnyway"),action:"merge",tooltip:a("thread.headerActions.squashMergeTooltip",{prNumber:String(n.number),base:n.base})}],n,a),c,a)};if(r?.draft)return gh({label:a("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:a("thread.headerActions.markDraftReadyTooltip"),menu:bi(Er([],n,a),c,a)},i,a);const m=r?.unresolvedConversations??0;return m>0?gh({label:a("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:a("thread.headerActions.unresolvedConversationsTooltip",{count:String(m)}),menu:bi(Er([],n,a),c,a)},i,a):r?.missingRequiredApprovals?gh({label:a("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:a("thread.headerActions.waitingForApprovalsTooltip"),menu:bi(Er([],n,a),c,a)},i,a):gh({label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:bi(Er([{key:"review",label:a("thread.headerActions.review"),action:"review"}],n,a),c,a)},i,a)}return c.behindBase>0?{label:a("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:[]}}function ly(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr"}}function xh(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 ay(t,e,s,n){const i=e.length;if(i===0)return t;if(e.filter(vx).length>0){const a=e.filter(d=>d.status==="completed").length,c=n("thread.cmsActions.checksRunning",{done:a,total:i});return s==="loading"?{...t,loading:!0,tooltip:c}:{...t,tooltip:c}}const l=e.filter(Jj).length;return l>0?{...t,variant:"warning",tooltip:n("thread.cmsActions.checksFailing",{failed:l,total:i})}:t}function The(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function Ahe(t){return Ph(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:Ph(t.checksQuery)||Ph(t.reviewsQuery)}function Phe(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function Ehe(t){const{branch:e,pr:s,checks:n,reviews:i,publishing:r,saving:l,loading:a,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(a||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(l)return{label:d("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(s&&s.state==="open"&&!s.merged?s:null){const h=i?.mergeableState??"unknown";return h==="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"}]}:h==="blocked"||i?.draft?ay({label:d("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:xh([ly(d)],e,d)},n,"loading",d):ay({label:d("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:xh([ly(d)],e,d)},n,"none",d)}return The(s,e)?{label:d("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:xh([],e,d)}:Phe(e,c)?{label:d("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:xh([{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 Qj(t){const e=F.c(4);let s;e[0]!==t?(s=c9(t),e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n={...s,select:Rhe},e[2]=s,e[3]=n):n=e[3],Mt(n)}function Rhe(t){const e=t.pullRequest;return e?{draft:e.draft,mergeableState:e.mergeableState,unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.missingRequiredApprovals}:null}function cy(t,e){return t==="open-pr"||e==="resolve-on-github"?o.jsx(mn,{size:16}):t==="publish"?o.jsx(P6,{className:"size-4"}):t==="get-latest"||t==="retry-status"?o.jsx(On,{className:"size-4"}):o.jsx(Hr,{className:"size-4"})}function Dhe(t){const e=F.c(91),{virtualMcpId:s}=t,n=le(),{org:i}=He(),r=Ns(),l=vs(s),{data:a}=vn.useSession(),{deleteRelease:c}=d9(s),{currentBranch:d,setCurrentTaskBranch:u,taskId:h,createTask:f}=on();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={open:!1,mode:"publish"},e[0]=m):m=e[0];const[p,g]=A.useState(m);let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=_e=>g({open:!0,mode:_e}),e[1]=x):x=e[1];const b=x,v=u6(l),_=v.status==="attached"||v.status==="public-clone"?v.repo:null,{previewServerUrl:y}=yn(s);let L;if(e[2]!==d||e[3]!==i.slug||e[4]!==s){const _e=d?V3(N3(i.slug,s,d)):null;L=_e?Or(_e.path,_e.params):"/",e[2]=d,e[3]=i.slug,e[4]=s,e[5]=L}else L=e[5];const w=L;let S;e[6]!==d||e[7]!==w||e[8]!==i.slug||e[9]!==y||e[10]!==s?(S=d?{orgSlug:i.slug,virtualMcpId:s,branch:d,previewServerUrl:y,path:w}:null,e[6]=d,e[7]=w,e[8]=i.slug,e[9]=y,e[10]=s,e[11]=S):S=e[11];const k=Ow(S);let j;e[12]!==d||e[13]!==i.slug||e[14]!==h||e[15]!==s?(j=JL({orgSlug:i.slug,virtualMcpId:s,branch:d??"",threadId:h??null},{fastPreview:!0}),e[12]=d,e[13]=i.slug,e[14]=h,e[15]=s,e[16]=j):j=e[16];const C=!!d;let T;e[17]!==j||e[18]!==C?(T={...j,enabled:C},e[17]=j,e[18]=C,e[19]=T):T=e[19];const N=Mt(T),P=N.data??null,V=P?{kind:"ready",branch:l3(P)??d??"",base:P.base??"main",workingTreeDirty:WL(P),unpushed:P.unpushed??0,aheadOfBase:P.aheadOfBase??0,behindBase:P.behindBase??0,headSha:P.headSha??""}:{kind:"unknown"},E=P?.changedFiles?Mj({files:P.changedFiles}).count:null,R=(V.kind==="ready"?V.branch:null)??d??null,I=V.kind==="ready"?V.base:"main",D=i0({orgId:i.id,orgSlug:i.slug,connectionId:_?.connectionId??"",owner:_?.owner??"",repo:_?.name??"",branch:R}),O=D.data??null,$=cR({orgId:i.id,orgSlug:i.slug,connectionId:_?.connectionId??"",owner:_?.owner??"",repo:_?.name??"",base:I}),M=dg({orgId:i.id,orgSlug:i.slug,connectionId:_?.connectionId??"",owner:_?.owner??"",repo:_?.name??"",branch:R}),z=Qj({orgId:i.id,orgSlug:i.slug,connectionId:_?.connectionId??"",owner:_?.owner??"",repo:_?.name??"",branch:R});let B;e[20]!==M||e[21]!==O||e[22]!==D||e[23]!==z?(B=Ahe({pr:O,prQuery:D,checksQuery:M,reviewsQuery:z}),e[20]=M,e[21]=O,e[22]=D,e[23]=z,e[24]=B):B=e[24];const U=B;let H;e[25]!==D?(H=async()=>{await D.refetch()},e[25]=D,e[26]=H):H=e[26];const W=H,K=Es({mutationFn:async()=>{if(!sd(l)){await u(Dl(a9(a?.user)));return}const _e=d;await u(I),_e&&_e!==I&&await c(_e)},onError:Ohe});let Q;e[27]!==i.slug||e[28]!==h||e[29]!==s?(Q=async _e=>(await KL({orgSlug:i.slug,virtualMcpId:s,branch:_e.branch,threadId:h??null},_e.base,{fastPreview:!0}),_e),e[27]=i.slug,e[28]=h,e[29]=s,e[30]=Q):Q=e[30];let X;e[31]!==d||e[32]!==i.slug||e[33]!==r||e[34]!==n||e[35]!==h||e[36]!==s?(X=async _e=>{ve.success(n("thread.headerActions.syncedWithBase",{base:_e.base})),await Promise.all([r.invalidateQueries({queryKey:m0({orgSlug:i.slug,virtualMcpId:s,branch:d??_e.branch,threadId:h??null})}),r.invalidateQueries({queryKey:tt.decofile(`${i.slug}/${s}/${_e.branch}`)})])},e[31]=d,e[32]=i.slug,e[33]=r,e[34]=n,e[35]=h,e[36]=s,e[37]=X):X=e[37];let se;e[38]!==Q||e[39]!==X?(se={mutationFn:Q,onSuccess:X,onError:Mhe},e[38]=Q,e[39]=X,e[40]=se):se=e[40];const ne=Es(se),te=j3(i.slug,s,d??"");if(v.status==="detached"){let _e;e[41]!==n?(_e=n("thread.headerActions.reconnectGithub"),e[41]=n,e[42]=_e):_e=e[42];let Ve;e[43]!==_e?(Ve=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{children:o.jsx(fe,{size:"sm",variant:"outline",disabled:!0,children:_e})})}),e[43]=_e,e[44]=Ve):Ve=e[44];let xe;e[45]!==n?(xe=n("thread.headerActions.githubConnectionRemoved"),e[45]=n,e[46]=xe):xe=e[46];let Se;e[47]!==xe?(Se=o.jsx(We,{children:xe}),e[47]=xe,e[48]=Se):Se=e[48];let Ce;return e[49]!==Ve||e[50]!==Se?(Ce=o.jsx(Ko,{children:o.jsxs(qe,{children:[Ve,Se]})}),e[49]=Ve,e[50]=Se,e[51]=Ce):Ce=e[51],Ce}if(!l)return null;if(!_||!y){const _e=_?"noPreviewServer":"noRepo";let Ve;e[52]!==d||e[53]!==f?(Ve=d?()=>{const Se=f?.({runtime:"sandbox",branch:d});Se&&Ge("coding_session_started",{thread_id:Se})}:void 0,e[52]=d,e[53]=f,e[54]=Ve):Ve=e[54];let xe;return e[55]!==_e||e[56]!==Ve?(xe=o.jsx($he,{reason:_e,onStartCodingSession:Ve}),e[55]=_e,e[56]=Ve,e[57]=xe):xe=e[57],xe}if(!d)return null;const ee=K.isPending,Y=Ehe({branch:V,pr:O,checks:M.data??[],reviews:z.data??null,publishing:ee,saving:te,syncing:ne.isPending,statusRetrying:N.isFetching&&!!N.error,statusError:N.error instanceof Error?N.error.message:N.error?String(N.error):null,loading:!!U,publishableChangeCount:E,t:n}),q=_e=>{switch(_e){case"publish":{b("publish");return}case"request-approval":{b("review");return}case"get-latest":{if(!R||ne.isPending)return;ne.mutate({branch:R,base:I});return}case"retry-status":{N.refetch();return}case"open-pr":{O?.htmlUrl&&window.open(O.htmlUrl,"_blank","noopener,noreferrer");return}}},oe=Y.menu.map(_e=>({key:_e.key,label:_e.label,icon:cy(_e.action,_e.key),..._e.tooltip?{tooltip:_e.tooltip}:{},onSelect:()=>q(_e.action)})),J=Y.action,ie=Tj,Z="sm",he=Y.label,de=Y.variant,ae=!!Y.disabled||!J,ce=!!Y.loading,ue=J&&!Y.loading?{icon:cy(J)}:{};let G;e[58]!==Y.tooltip?(G=Y.tooltip?{tooltip:Y.tooltip}:{},e[58]=Y.tooltip,e[59]=G):G=e[59];let me;e[60]!==n?(me=n("thread.cmsActions.moreActionsAriaLabel"),e[60]=n,e[61]=me):me=e[61];let ye;e[62]!==J||e[63]!==q?(ye=J?()=>q(J):void 0,e[62]=J,e[63]=q,e[64]=ye):ye=e[64];let we;e[65]!==ie||e[66]!==Y.label||e[67]!==Y.variant||e[68]!==oe||e[69]!==ae||e[70]!==ce||e[71]!==ue||e[72]!==G||e[73]!==me||e[74]!==ye?(we=o.jsx(ie,{size:Z,label:he,variant:de,disabled:ae,loading:ce,...ue,...G,items:oe,menuAriaLabel:me,onClick:ye}),e[65]=ie,e[66]=Y.label,e[67]=Y.variant,e[68]=oe,e[69]=ae,e[70]=ce,e[71]=ue,e[72]=G,e[73]=me,e[74]=ye,e[75]=we):we=e[75];const Ne=we;let je;return e[76]!==I||e[77]!==d||e[78]!==k||e[79]!==_||e[80]!==$||e[81]!==i.id||e[82]!==i.slug||e[83]!==O||e[84]!==K||e[85]!==W||e[86]!==Ne||e[87]!==p||e[88]!==s||e[89]!==l?.metadata?.publishPolicy?(je=o.jsx(o.Fragment,{children:d?o.jsx(yhe,{open:p.open,mode:p.mode,onOpenChange:_e=>{_e||g(Ihe)},orgSlug:i.slug,orgId:i.id,virtualMcpId:s,branch:d,baseBranch:I,githubConnectionId:_.connectionId??"",owner:_.owner,repo:_.name,publishPolicy:YL(l?.metadata?.publishPolicy),draftPreviewUrl:k.url,destinationHost:k.host,lastPublishedPr:$.data??null,onRequestApproval:()=>b("review"),openPullRequest:O?.state==="open"?O:null,onPullRequestChanged:W,onPublished:()=>K.mutateAsync(),children:Ne}):Ne}),e[76]=I,e[77]=d,e[78]=k,e[79]=_,e[80]=$,e[81]=i.id,e[82]=i.slug,e[83]=O,e[84]=K,e[85]=W,e[86]=Ne,e[87]=p,e[88]=s,e[89]=l?.metadata?.publishPolicy,e[90]=je):je=e[90],je}function Ihe(t){return{...t,open:!1}}function Mhe(t){ve.error(t instanceof Error?t.message:String(t))}function Ohe(t){ve.error(t instanceof Error?t.message:String(t))}function $he(t){const e=F.c(14),{reason:s,onStartCodingSession:n}=t,i=le(),r=!n;let l;e[0]!==i?(l=i("sandbox.cmsUnavailable.startCodingSession"),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==r||e[4]!==l?(a=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{children:o.jsx(fe,{size:"sm",variant:"outline",disabled:r,onClick:n,children:l})})}),e[2]=n,e[3]=r,e[4]=l,e[5]=a):a=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(We,{children:c}),e[9]=c,e[10]=d):d=e[10];let u;return e[11]!==a||e[12]!==d?(u=o.jsx(Ko,{children:o.jsxs(qe,{children:[a,d]})}),e[11]=a,e[12]=d,e[13]=u):u=e[13],u}const Bhe=new Set(["main","master"]);function zhe(t,e){return Bhe.has(t.trim().toLowerCase())?e("thread.headerActions.publishToProduction"):e("thread.headerActions.publish")}function Fhe(t){const e=F.c(10),[s,n]=A.useState(0);let i;e[0]!==t?(i=c=>{c&&n(Uhe),t.onOpenChange(c)},e[0]=t,e[1]=i):i=e[1];const r=i;let l;e[2]!==r||e[3]!==t||e[4]!==s?(l=t.open?o.jsx(Hhe,{...t,onOpenChange:r},s):null,e[2]=r,e[3]=t,e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==r||e[7]!==t.open||e[8]!==l?(a=o.jsx(zt,{open:t.open,onOpenChange:r,children:l}),e[6]=r,e[7]=t.open,e[8]=l,e[9]=a):a=e[9],a}function Uhe(t){return t+1}function Hhe({onOpenChange:t,orgSlug:e,orgId:s,virtualMcpId:n,branch:i,baseBranch:r,githubConnectionId:l,owner:a,repo:c,previewUrl:d,publishPolicy:u,dialogIntent:h="open-pr",headSha:f=null,openPullRequest:m=null,onPullRequestChanged:p,onPublished:g}){const x=le(),b=Cs({connectionId:l,orgId:s,orgSlug:e}),v=Cs({connectionId:qc,orgId:s,orgSlug:e}),{data:_}=vn.useSession(),y=C7(v),L={orgSlug:e,virtualMcpId:n,branch:i,threadId:hs()?.taskId??null},w=hx(_?.user),S=m?.state==="open",k=m?.state==="open"?{number:m.number,htmlUrl:m.htmlUrl}:void 0,j=h==="open-pr"&&!S,C=h==="publish-only",[T,N]=A.useState(null),[P,V]=A.useState(null),[E,R]=A.useState(!0),[I,D]=A.useState(!1),[O,$]=A.useState(""),[M,z]=A.useState(""),[B,U]=A.useState(),[H,W]=A.useState(!1),[K,Q]=A.useState(),[X,se]=A.useState(!1),[ne,te]=A.useState(!1),[ee,Y]=A.useState(!1),q=A.useRef(!1),oe=A.useRef(!1),J={base:r,...f?{headSha:f}:{}},ie=async Ie=>{const Oe=(Ie.aheadOfBase??0)>0?await tu(L,J):null,mt=a3(Ie)?await tu(L):null;return fJ(Oe,mt)},Z=async()=>{const Ie=await Nc(L),Oe=C?await ie(Ie):await tu(L,hJ(Ie,{openPrFromCommits:j,commitToOpenPr:S})?J:void 0);N(Ie),V(Oe),$(x("thread.publishDialog.changesFrom",{branch:Ie.current??i})),Y(!0),H5(L,{status:Ie,diff:Oe}).then(mt=>{$(mt.title),z(mt.body)}).catch(()=>{}).finally(()=>Y(!1))};q.current||(q.current=!0,(async()=>{R(!0),U(void 0),V(null),$(""),z(""),Q(void 0);try{await Z()}catch(Ie){if(UL(Ie)&&!oe.current){oe.current=!0;try{await y.mutateAsync({virtualMcpId:n,branch:i}),await Z();return}catch(Oe){U(Oe instanceof Error?Oe.message:x("thread.publishDialog.failedLoadAfterReprovision"));return}}U(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedLoad"))}finally{R(!1)}})());const he=l3(T)??i,de=zhe(r,x),ae=()=>{!T||!P||(Y(!0),H5(L,{status:T,diff:P}).then(Ie=>{$(Ie.title),z(Ie.body)}).catch(()=>{}).finally(()=>Y(!1)))},ce=QL(T),ue=P?Object.keys(P.diffs).length:ce,{gate:G}=qj({orgSlug:e,virtualMcpId:n,branch:i,threadId:L.threadId,status:T,diff:P,policy:u,judgeEnabled:C}),me=j?XL(T):uJ(T,P),ye=!E&&(me||j),we=ye&&G.allowed,Ne=!ye||G.allowed?null:G.pending?x("thread.publishDialog.reviewingChanges"):G.reason??x("thread.publishDialog.publishNeedsReview"),je=j||!S&&(T?.aheadOfBase??0)>0,_e=!E&&(je||me)&&(ue>0||me),Ve={orgSlug:e,virtualMcpId:n,branch:i,threadId:L.threadId,baseBranch:r,githubClient:b,owner:a,repo:c,headBranch:he,coAuthor:w,existingOpenPr:k,expectedHeadSha:f??void 0},xe=()=>Bj({title:O,body:M,fallbackTitle:x("thread.publishDialog.changesFrom",{branch:he})}),Se=Ie=>{I||H||t(Ie)},Ce=async()=>{D(!0),U(void 0);try{await Hj(Ve,xe(),x),ve.success(x("thread.publishDialog.publishedTo",{baseBranch:r})),Se(!1),V(null),$(""),z(""),await p?.(),await g?.()}catch(Ie){const Oe=i2(Ie,x);U(Oe.message),Oe.pullRequestOpened&&await p?.()}finally{D(!1)}},Ae=async Ie=>{try{await ep(L,[Ie]),ve.success(x("thread.publishDialog.discardedChanges",{filepath:Ie})),V(mt=>{if(!mt)return mt;const lt={...mt,diffs:{...mt.diffs}};return delete lt.diffs[Ie],lt});const Oe=await Nc(L);N(Oe)}catch(Oe){ve.error(Oe instanceof Error?Oe.message:x("thread.publishDialog.failedDiscardChanges"))}},st=async()=>{if(P){se(!1),te(!0);try{const Ie=Object.keys(P.diffs);if(Ie.length===0)return;await ep(L,Ie),ve.success(x("thread.publishDialog.allChangesDiscarded")),V(null);const Oe=await Nc(L);N(Oe),Se(!1)}catch(Ie){ve.error(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedDiscardChanges"))}finally{te(!1)}}},Be=async()=>{W(!0),Q(void 0);try{const Ie=await Kj(Ve,xe());Wj(Ie,x),Se(!1),await p?.()}catch(Ie){Q(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedSubmitForReview"))}finally{W(!1)}};return o.jsx(Bt,{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(na,{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:j?x("thread.publishDialog.submitForReview"):de}),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(j?"thread.publishDialog.inThisPr":"thread.publishDialog.toPublish")]})]}),X?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(fe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>se(!1),children:x("thread.publishDialog.cancel")}),o.jsxs(fe,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:st,disabled:ne,children:[ne?o.jsx(it,{className:"h-3 w-3"}):null,x("thread.publishDialog.discardAll")]})]})]}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(Jc,{className:"h-8 w-auto",variant:"pill",children:[o.jsx(ii,{value:"description",className:"px-3 text-xs",children:x("thread.publishDialog.description")}),o.jsx(ii,{value:"changes",className:"px-3 text-xs",children:x("thread.publishDialog.changesTab")})]}),ue>0&&!j&&o.jsx("button",{type:"button",className:"text-xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>se(!0),disabled:I||ne,children:x("thread.publishDialog.discardAll")})]})]}),o.jsx("div",{className:"border-t"}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:E?o.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[o.jsx(it,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm",children:x("thread.publishDialog.loadingChanges")})]}):o.jsxs(o.Fragment,{children:[o.jsx(Cl,{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(j?"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:ee||I||H,onClick:ae,children:[ee?o.jsx(it,{className:"h-3 w-3"}):o.jsx(Kr,{className:"h-3 w-3"}),x(ee?"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:O,onChange:Ie=>$(Ie.target.value),placeholder:x(ee?"thread.publishDialog.generating":"thread.publishDialog.commitTitlePlaceholder"),disabled:I||H||ee,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:M,onChange:Ie=>z(Ie.target.value),placeholder:x(ee?"thread.publishDialog.generating":"thread.publishDialog.descriptionPlaceholder"),disabled:I||H||ee,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:C?x("thread.publishDialog.squashMergesInto",{publishLabel:de,baseBranch:r}):x("thread.publishDialog.opensPullRequestInto",{baseBranch:r})})]})]})}),o.jsx(Cl,{value:"changes",className:"mt-0",children:o.jsx(c3,{diff:P,onDiscardFile:Ae})})]})}),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(Qu,{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:C?o.jsxs(o.Fragment,{children:[o.jsx(Khe,{label:de,canPublish:we,disabledReason:Ne,isPublishing:I,onPublish:Ce}),B&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:B}),!we&&!G.pending&&_e&&o.jsxs(o.Fragment,{children:[o.jsxs(fe,{type:"button",variant:"outline",className:"mt-2 w-full",onClick:Be,disabled:H,children:[H?o.jsx(it,{className:"h-4 w-4"}):o.jsx(nr,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),K&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:K})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs(fe,{type:"button",className:"w-full",onClick:Be,disabled:!_e||H,children:[H?o.jsx(it,{className:"h-4 w-4"}):o.jsx(nr,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),K&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:K})]})})]})})}function Khe(t){const e=F.c(14),{label:s,canPublish:n,disabledReason:i,isPublishing:r,onPublish:l}=t,a=!n||r;let c;e[0]!==r?(c=r?o.jsx(it,{className:"h-4 w-4"}):null,e[0]=r,e[1]=c):c=e[1];let d;e[2]!==s||e[3]!==l||e[4]!==a||e[5]!==c?(d=o.jsxs(fe,{type:"button",variant:"brand",className:"w-full",onClick:l,disabled:a,children:[c,s]}),e[2]=s,e[3]=l,e[4]=a,e[5]=c,e[6]=d):d=e[6];const u=d;if(!i)return u;let h;e[7]!==u?(h=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"flex w-full",children:u})}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==i?(f=o.jsx(We,{children:i}),e[9]=i,e[10]=f):f=e[10];let m;return e[11]!==h||e[12]!==f?(m=o.jsx(Ko,{children:o.jsxs(qe,{children:[h,f]})}),e[11]=h,e[12]=f,e[13]=m):m=e[13],m}function dy(t){switch(t){case"publish":return o.jsx(P6,{className:"size-4"});case"create-pr":case"reopen":return o.jsx(Hr,{className:"size-4"});case"rebase":case"sync":return o.jsx(On,{className:"size-4"});case"fix-checks":return o.jsx(sl,{className:"size-4"});case"mark-ready":return o.jsx(xr,{className:"size-4"});case"resolve-comments":return o.jsx(E6,{className:"size-4"});case"merge":return o.jsx(sg,{className:"size-4"});case"review":return o.jsx(Qu,{className:"size-4"});case"open-pr-page":return o.jsx(mn,{size:16})}}const uy=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),hy=new Set(["publish","create-pr"]);function Whe(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function qhe({virtualMcpId:t}){const e=le(),{org:s}=He(),{data:n}=vn.useSession(),i=vs(t),{deleteRelease:r}=d9(t),{currentBranch:l,setCurrentTaskBranch:a,taskId:c}=on(),d=ai(),{openSidePanel:u}=Zl(),[h,f]=A.useState(!1),[m,p]=A.useState("open-pr"),[g,x]=A.useState(null),[b,v]=A.useState(!1),_=A.useRef(""),y=u6(i),L=y.status==="attached"||y.status==="public-clone"?y.repo:null,w=Cs({connectionId:L?.connectionId??"",orgId:s.id,orgSlug:s.slug}),{lifecycle:S,branch:k,phase:j}=hi(),C={orgSlug:s.slug,virtualMcpId:t,branch:l??"",threadId:c??null},N=Mt({queryKey:m0(C),queryFn:()=>Nc(C),enabled:!!l,staleTime:15e3,refetchInterval:J=>N1(J.state.data)?5e3:!1}).data??null,P=k,V=S,E=P.kind==="ready"?P.branch:null,R=l??E??void 0,I=(P.kind==="ready"?P.branch:null)??R??null,D=i0({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:I}),O=D.data??null,$=dg({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:I}),M=Qj({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:I}),z=P,B=YL(i?.metadata?.publishPolicy),U=j3(s.slug,t,l??R??""),{previewUrl:H}=rl();if(y.status==="detached")return o.jsx(Yhe,{label:e("thread.headerActions.githubConnectionRemoved"),children:o.jsx(fe,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!L)return null;const W=I?Vhe({lifecycle:V,branch:z,claimPhase:j,pr:O,checks:$.data??[],reviews:M.data??null,noReviewableDiff:N1(N),loading:Ph(D),t:e}):Whe(e),K=JSON.stringify({label:W.label,branchKind:z.kind,workingTreeDirty:z.kind==="ready"?z.workingTreeDirty:null,unpushed:z.kind==="ready"?z.unpushed:null,aheadOfBase:z.kind==="ready"?z.aheadOfBase:null,lifecycle:V.phase,githubHeadBranch:I,noReviewableDiff:N1(N)});_.current!==K&&(_.current=K,Yj("header button",{label:W.label,tooltip:W.tooltip,action:W.action,chatBranch:l,sandboxBranch:E,sandboxRouteBranch:R,githubHeadBranch:I,branchMeta:P,effectiveBranchMeta:z,lifecyclePhase:V.phase,prNumber:O?.number??null,prState:O?.state??null}));const Q=J=>(u(),d.sendMessage({parts:[{type:"text",text:J}]})),X=d.isStreaming,se=z.kind==="ready"?z.base:"main",ne=async()=>{await D.refetch()},te=async()=>{if(sd(i)){const ie=l;await a(se),ie&&ie!==se&&await r(ie);return}const J=Dl(a9(n?.user));await a(J)},ee=async J=>{if(!(!L?.connectionId||b)){v(!0);try{const ie=hx(n?.user);await B8(w,{owner:L.owner,repo:L.name,pullNumber:J,coAuthor:ie}),ve.success(e("thread.headerActions.publishedPr",{prNumber:String(J)})),await ne(),await te()}catch(ie){ve.error(ie instanceof Error?ie.message:e("thread.headerActions.failedToMergePullRequest"))}finally{v(!1)}}},Y=(J,ie)=>{p(J),x(ie),f(!0)},q=J=>{if(I)switch(J){case"publish":Y("publish-only",W.meta?.publishPolicyOverride??null);return;case"create-pr":Y("open-pr",null);return;case"merge":O&&ee(O.number);return;case"sync":if(X)return;Q(VJ({branch:I,base:se}));return;case"open-pr-page":O?.htmlUrl&&window.open(O.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(X)return;O&&Q(RJ({prNumber:O.number}));return;case"reopen":if(X)return;O&&Q(CJ({prNumber:O.number}));return;case"rebase":if(X)return;Q(NJ({branch:I}));return;case"fix-checks":if(X)return;O&&Q(AJ({prNumber:O.number,failingChecks:W.meta?.failingChecks??[]}));return;case"mark-ready":if(X)return;O&&Q(PJ({prNumber:O.number}));return;case"resolve-comments":if(X)return;O&&Q(EJ({prNumber:O.number}));return}},oe=b||X;return o.jsxs(o.Fragment,{children:[o.jsx(Ghe,{t:e,button:W,actionBusy:oe,githubActionPending:b,savePending:U,onAction:q}),R&&o.jsx(Fhe,{open:h,onOpenChange:f,orgSlug:s.slug,orgId:s.id,virtualMcpId:t,branch:R,baseBranch:se,githubConnectionId:L.connectionId??"",owner:L.owner,repo:L.name,previewUrl:H,publishPolicy:g??B,dialogIntent:m,headSha:z.kind==="ready"?z.headSha:null,openPullRequest:O?.state==="open"?O:null,onPullRequestChanged:ne,onPublished:te})]})}function Ghe(t){const e=F.c(44),{t:s,button:n,actionBusy:i,githubActionPending:r,savePending:l,onAction:a}=t,c=n.action;let d;e[0]!==c||e[1]!==i?(d=i&&c!==void 0&&uy.has(c),e[0]=c,e[1]=i,e[2]=d):d=e[2];const u=d,h=r&&c==="merge";let f;e[3]!==c||e[4]!==l?(f=l&&c!==void 0&&hy.has(c),e[3]=c,e[4]=l,e[5]=f):f=e[5];const m=f,p=!!n.disabled||u||h||m||!c,g=!!n.loading||h;let x;e[6]!==n.tooltip||e[7]!==u||e[8]!==m||e[9]!==s?(x=u?s("thread.headerActions.chatIsRunning"):m?s("thread.headerActions.saving"):n.tooltip,e[6]=n.tooltip,e[7]=u,e[8]=m,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]!==a||e[15]!==l||e[16]!==s){let T;e[18]!==i||e[19]!==r||e[20]!==a||e[21]!==l||e[22]!==s?(T=N=>{const P=i&&uy.has(N.action),V=l&&hy.has(N.action),E=N.action==="merge"&&r,R=V?s("thread.headerActions.saving"):P?s("thread.headerActions.chatIsRunning"):N.tooltip;return{key:N.key,label:N.label,icon:dy(N.action),disabled:!!(P||V||E),...R?{tooltip:R}:{},onSelect:()=>a(N.action)}},e[18]=i,e[19]=r,e[20]=a,e[21]=l,e[22]=s,e[23]=T):T=e[23],v=n.menu.map(T),e[11]=i,e[12]=n.menu,e[13]=r,e[14]=a,e[15]=l,e[16]=s,e[17]=v}else v=e[17];const _=v,y=n.label,L=n.variant;let w;e[24]!==c||e[25]!==g?(w=c&&!g?{icon:dy(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]!==a?(j=c?()=>a(c):void 0,e[31]=c,e[32]=a,e[33]=j):j=e[33];let C;return e[34]!==n.label||e[35]!==n.variant||e[36]!==p||e[37]!==_||e[38]!==g||e[39]!==w||e[40]!==S||e[41]!==k||e[42]!==j?(C=o.jsx(Tj,{size:"sm",label:y,variant:L,disabled:p,loading:g,...w,...S,items:_,menuAriaLabel:k,onClick:j}),e[34]=n.label,e[35]=n.variant,e[36]=p,e[37]=_,e[38]=g,e[39]=w,e[40]=S,e[41]=k,e[42]=j,e[43]=C):C=e[43],C}function Yhe(t){const e=F.c(9),{label:s,children:n}=t;if(!s){let a;return e[0]!==n?(a=o.jsx(o.Fragment,{children:n}),e[0]=n,e[1]=a):a=e[1],a}let i;e[2]!==n?(i=o.jsx(Ke,{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(We,{children:s}),e[4]=s,e[5]=r):r=e[5];let l;return e[6]!==i||e[7]!==r?(l=o.jsx(Ko,{children:o.jsxs(qe,{children:[i,r]})}),e[6]=i,e[7]=r,e[8]=l):l=e[8],l}function Jhe(t){const e=F.c(9),{virtualMcp:s}=t,n=Gc(),{navigateToTask:i}=pN(),{create:r}=$u();let l,a;if(e[0]!==n||e[1]!==r||e[2]!==i||e[3]!==s){a=Symbol.for("react.early_return_sentinel");e:{const c=rA(s,n);if(!c){a=null;break e}const d=c.mode==="dev";let u;e[6]!==r||e[7]!==i?(u=async m=>{const p=crypto.randomUUID();try{await r({id:p,virtual_mcp_id:m})}catch{}i(p,{virtualMcpId:m})},e[6]=r,e[7]=i,e[8]=u):u=e[8];const h=u,f=(m,p,g)=>o.jsxs("button",{type:"button","aria-pressed":p,"aria-label":m,title:m,onClick:()=>{p||h(c.targetId)},className:re("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md transition-colors",p?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(g,{className:"size-3.5 shrink-0"}),o.jsx("span",{className:"@max-3xl/panel-header:hidden",children:m})]});l=o.jsxs("div",{className:"inline-flex items-center rounded-lg border border-border bg-muted p-0.5 text-xs font-medium",children:[f("Develop",d,ta),f("Live",!d,zn)]})}e[0]=n,e[1]=r,e[2]=i,e[3]=s,e[4]=l,e[5]=a}else l=e[4],a=e[5];return a!==Symbol.for("react.early_return_sentinel")?a:l}function Qhe(t){const e=F.c(11),{virtualMcp:s}=t,n=yn(s.id).runtime==="cms",i=qu();let r;e[0]!==i?(r=!!i&&L2(i),e[0]=i,e[1]=r):r=e[1];const l=r;let a;e[2]!==s?(a=o.jsx(Jhe,{virtualMcp:s}),e[2]=s,e[3]=a):a=e[3];let c;e[4]!==n||e[5]!==l||e[6]!==s?(c=l&&oA(s)?n?o.jsx(Dhe,{virtualMcpId:s.id}):o.jsx(qhe,{virtualMcpId:s.id}):null,e[4]=n,e[5]=l,e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==c?(d=o.jsxs("div",{className:"flex items-center gap-2",children:[a,c]}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d}const Xhe=10080*60*1e3;function Zhe({sandboxMap:t,userId:e,rawBranches:s,now:n}){const i=new Map;for(const[h,f]of Object.entries(t??{}))for(const[m,p]of Object.entries(f??{})){let g=i.get(m);g||(g={userIds:new Set,lastActiveAt:0},i.set(m,g)),g.userIds.add(h);for(const x of Object.values(p??{})){const b=x?.createdAt??0;b>g.lastActiveAt&&(g.lastActiveAt=b)}}const r=n-Xhe,l=[...i.entries()].filter(([,h])=>h.lastActiveAt>=r).sort((h,f)=>f[1].lastActiveAt-h[1].lastActiveAt).map(([h,f])=>({name:h,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),a=new Set(l.map(h=>h.name)),c=new Set(Object.keys(t?.[e]??{})),d=[...c].filter(h=>!a.has(h)).sort().map(h=>({name:h,source:"yours"})),u=s.filter(h=>!c.has(h.name)&&!a.has(h.name)).map(h=>({name:h.name,source:"other",author:h.author??null}));return{recent:l,yours:d,others:u}}function efe(t){const e=new Map;for(const s of t??[])for(const n of s.branches)typeof n.name=="string"&&e.set(n.name,n);return[...e.values()].map(s=>({name:s.name,author:typeof s.commit?.author=="string"?s.commit.author:s.commit?.author?.login??null}))}const Xj=100,tfe=50,sfe=300;function Af(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function nfe(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(n=>n.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function Zj(t){const e=F.c(65),{orgId:s,orgSlug:n,userId:i,connectionId:r,sandboxMap:l,owner:a,repo:c,search:d,enabled:u}=t,h=d===void 0?"":d,f=u===void 0?!0:u,m=r??null;let p;e[0]!==s||e[1]!==n||e[2]!==m?(p={connectionId:m,orgId:s,orgSlug:n},e[0]=s,e[1]=n,e[2]=m,e[3]=p):p=e[3];const g=Cs(p);let x;e[4]!==h?(x=h.trim(),e[4]=h,e[5]=x):x=e[5];const b=x,v=l9(b,sfe),_=!!r&&!!a&&!!c,y=b.length>0;let L;e[6]!==r||e[7]!==s||e[8]!==n||e[9]!==a||e[10]!==c?(L=tt.githubBranches(s,n,r,a,c),e[6]=r,e[7]=s,e[8]=n,e[9]=a,e[10]=c,e[11]=L):L=e[11];const w=f&&_&&!y;let S;e[12]!==g||e[13]!==a||e[14]!==c?(S=async q=>{const{pageParam:oe,signal:J}=q,ie=Number(oe),Z=await g.callTool({name:"list_branches",arguments:{owner:a,repo:c,page:ie,perPage:Xj}},void 0,{signal:J}),he=nfe(Z);return{branches:Array.isArray(he)?he:he.branches??[],default_branch:Array.isArray(he)?null:he.default_branch??null,page:ie}},e[12]=g,e[13]=a,e[14]=c,e[15]=S):S=e[15];let k;e[16]!==L||e[17]!==w||e[18]!==S?(k={queryKey:L,enabled:w,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:S,getNextPageParam:ife},e[16]=L,e[17]=w,e[18]=S,e[19]=k):k=e[19];const{data:j,isLoading:C,isError:T,hasNextPage:N,isFetchingNextPage:P,fetchNextPage:V}=b8(k);let E;e[20]!==r||e[21]!==v||e[22]!==s||e[23]!==n||e[24]!==a||e[25]!==c?(E=tt.githubBranchSearch(s,n,r,a,c,v),e[20]=r,e[21]=v,e[22]=s,e[23]=n,e[24]=a,e[25]=c,e[26]=E):E=e[26];const R=f&&_&&v.length>0;let I;e[27]!==r||e[28]!==v||e[29]!==n||e[30]!==a||e[31]!==c?(I=()=>o2(n,"GITHUB_SEARCH_BRANCHES",{connectionId:r,owner:a,repo:c,query:v,limit:tfe}),e[27]=r,e[28]=v,e[29]=n,e[30]=a,e[31]=c,e[32]=I):I=e[32];let D;e[33]!==E||e[34]!==R||e[35]!==I?(D={queryKey:E,enabled:R,staleTime:3e4,retry:!1,queryFn:I},e[33]=E,e[34]=R,e[35]=I,e[36]=D):D=e[36];const{data:O,isLoading:$,isError:M,isFetching:z}=Mt(D),B=y&&(v!==b||z);let U,H,W;if(e[37]!==j?.pages||e[38]!==l||e[39]!==O||e[40]!==b||e[41]!==i){const q=O?O.branches:efe(j?.pages);U=Zhe({sandboxMap:l,userId:i,rawBranches:q,now:Date.now()});let oe;e[45]!==b?(oe=ie=>Af(ie.name,b),e[45]=b,e[46]=oe):oe=e[46],H=U.recent.filter(oe);let J;e[47]!==b?(J=ie=>Af(ie.name,b),e[47]=b,e[48]=J):J=e[48],W=U.yours.filter(J),e[37]=j?.pages,e[38]=l,e[39]=O,e[40]=b,e[41]=i,e[42]=U,e[43]=H,e[44]=W}else U=e[42],H=e[43],W=e[44];const K=W,Q=U.others,X=O&&!B?Math.max(0,O.totalCount-O.branches.length):0,se=y?$:C,ne=y?M:T,te=!y&&(N??!1);let ee;e[49]!==V||e[50]!==N||e[51]!==P||e[52]!==y?(ee=()=>{!y&&N&&!P&&V()},e[49]=V,e[50]=N,e[51]=P,e[52]=y,e[53]=ee):ee=e[53];let Y;return e[54]!==X||e[55]!==P||e[56]!==B||e[57]!==Q||e[58]!==H||e[59]!==se||e[60]!==ne||e[61]!==te||e[62]!==ee||e[63]!==K?(Y={recent:H,yours:K,others:Q,isLoading:se,isError:ne,isSearching:B,hiddenMatchCount:X,hasMore:te,isFetchingMore:P,fetchMore:ee},e[54]=X,e[55]=P,e[56]=B,e[57]=Q,e[58]=H,e[59]=se,e[60]=ne,e[61]=te,e[62]=ee,e[63]=K,e[64]=Y):Y=e[64],Y}function ife(t){if(!(t.branches.length<Xj))return t.page+1}function rfe(t){const e=F.c(174),{virtualMcpId:s,userLabel:n,value:i,baseBranch:r,orgId:l,orgSlug:a,userId:c,connectionId:d,owner:u,repo:h,sandboxMap:f,onChange:m,onCreateBranch:p,disabled:g,spawnsNewChat:x,placement:b}=t,v=g===void 0?!1:g,_=x===void 0?!1:x,y=b===void 0?"chat":b,L=le(),w=y==="header",[S,k]=A.useState(!1),[j,C]=A.useState(!1),[T,N]=A.useState(null),[P,V]=A.useState(""),[E,R]=A.useState(null),{releases:I,createRelease:D,renameRelease:O,deleteRelease:$}=d9(s),M=!!i&&i===r;let z,B,U,H,W,K,Q,X,se,ne,te,ee,Y,q,oe,J,ie,Z,he,de,ae,ce,ue,G,me;if(e[0]!==r||e[1]!==D||e[2]!==$||e[3]!==v||e[4]!==P||e[5]!==M||e[6]!==w||e[7]!==m||e[8]!==p||e[9]!==S||e[10]!==E||e[11]!==I||e[12]!==O||e[13]!==L||e[14]!==n||e[15]!==i){let ze;e[41]!==i?(ze=ke=>ke.branch===i,e[41]=i,e[42]=ze):ze=e[42];const yt=I.find(ze);me=!M&&!yt&&!!i;const At=M?L("thread.branchPicker.live"):yt?.name??L("thread.branchPicker.defaultVersionName");se=i?At:L("thread.branchPicker.selectVersion");const ht=M?"bg-success":Cm(yt?.color??"orange");let ft;e[43]!==m?(ft=ke=>{m(ke),k(!1)},e[43]=m,e[44]=ft):ft=e[44],ne=ft;let at;e[45]!==D||e[46]!==m||e[47]!==I?(at=(ke,ot)=>{I.some(Le=>Le.branch===ke)||D({branch:ke,name:ot.trim()||ke,color:jm(I.length),createdAt:new Date().toISOString()}),m(ke),C(!1),k(!1)},e[45]=D,e[46]=m,e[47]=I,e[48]=at):at=e[48],K=at;let pt;e[49]!==D||e[50]!==m||e[51]!==p||e[52]!==I||e[53]!==L||e[54]!==n?(pt=()=>{const ke=Dl(n);D({branch:ke,name:F8(I,L("thread.branchPicker.defaultVersionName")),color:jm(I.length),createdAt:new Date().toISOString()}),(p??m)(ke),k(!1)},e[49]=D,e[50]=m,e[51]=p,e[52]=I,e[53]=L,e[54]=n,e[55]=pt):pt=e[55],X=pt;let Lt;e[56]===Symbol.for("react.memo_cache_sentinel")?(Lt=()=>{N(null),V(""),C(!1)},e[56]=Lt):Lt=e[56];const bt=Lt;let Ft;e[57]===Symbol.for("react.memo_cache_sentinel")?(Ft=ke=>{N(ke.branch),V(ke.name)},e[57]=Ft):Ft=e[57],ee=Ft;let ge;e[58]!==P||e[59]!==O?(ge=ke=>{const ot=P.trim();ot&&O(ke,ot),N(null),V("")},e[58]=P,e[59]=O,e[60]=ge):ge=e[60],te=ge;let Ee;e[61]!==r||e[62]!==$||e[63]!==E||e[64]!==ne||e[65]!==i?(Ee=()=>{const ke=E;R(null),ke&&(ke.branch===i&&r?ne(r):k(!1),$(ke.branch))},e[61]=r,e[62]=$,e[63]=E,e[64]=ne,e[65]=i,e[66]=Ee):Ee=e[66],Q=Ee,W=cs,ie=S,e[67]!==v?(Z=v?void 0:ke=>{ke||bt(),k(ke)},e[67]=v,e[68]=Z):Z=e[68],H=qe,U=Ke,J=!0,oe="inline-flex min-w-0 shrink",B=os,q=!0,z=fe,de=Xf.branchPicker,ae=w?"outline":"ghost",ce=w?"sm":"default",ue=se,G=v;const Re=w?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[69]!==Re?(Y=re("shrink min-w-0 max-w-[220px] gap-2",Re,ng),e[69]=Re,e[70]=Y):Y=e[70],he=re("h-2 w-2 shrink-0 rounded-full",i?ht:"bg-muted-foreground"),e[0]=r,e[1]=D,e[2]=$,e[3]=v,e[4]=P,e[5]=M,e[6]=w,e[7]=m,e[8]=p,e[9]=S,e[10]=E,e[11]=I,e[12]=O,e[13]=L,e[14]=n,e[15]=i,e[16]=z,e[17]=B,e[18]=U,e[19]=H,e[20]=W,e[21]=K,e[22]=Q,e[23]=X,e[24]=se,e[25]=ne,e[26]=te,e[27]=ee,e[28]=Y,e[29]=q,e[30]=oe,e[31]=J,e[32]=ie,e[33]=Z,e[34]=he,e[35]=de,e[36]=ae,e[37]=ce,e[38]=ue,e[39]=G,e[40]=me}else z=e[16],B=e[17],U=e[18],H=e[19],W=e[20],K=e[21],Q=e[22],X=e[23],se=e[24],ne=e[25],te=e[26],ee=e[27],Y=e[28],q=e[29],oe=e[30],J=e[31],ie=e[32],Z=e[33],he=e[34],de=e[35],ae=e[36],ce=e[37],ue=e[38],G=e[39],me=e[40];let ye;e[71]!==he?(ye=o.jsx("span",{className:he}),e[71]=he,e[72]=ye):ye=e[72];let we;e[73]!==se?(we=o.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:se}),e[73]=se,e[74]=we):we=e[74];let Ne;e[75]!==v?(Ne=!v&&o.jsx(bs,{size:12,className:"opacity-60 shrink-0"}),e[75]=v,e[76]=Ne):Ne=e[76];let je;e[77]!==z||e[78]!==Y||e[79]!==ye||e[80]!==we||e[81]!==Ne||e[82]!==de||e[83]!==ae||e[84]!==ce||e[85]!==ue||e[86]!==G?(je=o.jsxs(z,{"data-tour":de,variant:ae,size:ce,"aria-label":ue,disabled:G,className:Y,children:[ye,we,Ne]}),e[77]=z,e[78]=Y,e[79]=ye,e[80]=we,e[81]=Ne,e[82]=de,e[83]=ae,e[84]=ce,e[85]=ue,e[86]=G,e[87]=je):je=e[87];let _e;e[88]!==B||e[89]!==q||e[90]!==je?(_e=o.jsx(B,{asChild:q,children:je}),e[88]=B,e[89]=q,e[90]=je,e[91]=_e):_e=e[91];let Ve;e[92]!==oe||e[93]!==_e?(Ve=o.jsx("span",{className:oe,children:_e}),e[92]=oe,e[93]=_e,e[94]=Ve):Ve=e[94];let xe;e[95]!==U||e[96]!==J||e[97]!==Ve?(xe=o.jsx(U,{asChild:J,children:Ve}),e[95]=U,e[96]=J,e[97]=Ve,e[98]=xe):xe=e[98];let Se;e[99]!==se?(Se=o.jsx(We,{children:se}),e[99]=se,e[100]=Se):Se=e[100];let Ce;e[101]!==H||e[102]!==xe||e[103]!==Se?(Ce=o.jsxs(H,{children:[xe,Se]}),e[101]=H,e[102]=xe,e[103]=Se,e[104]=Ce):Ce=e[104];let Ae;e[105]!==_||e[106]!==L?(Ae=_&&o.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:L("thread.branchPicker.newChatHint")}),e[105]=_,e[106]=L,e[107]=Ae):Ae=e[107];let st;e[108]!==K||e[109]!==j||e[110]!==r||e[111]!==d||e[112]!==X||e[113]!==P||e[114]!==T||e[115]!==M||e[116]!==S||e[117]!==l||e[118]!==a||e[119]!==u||e[120]!==ne||e[121]!==I||e[122]!==h||e[123]!==f||e[124]!==te||e[125]!==ee||e[126]!==L||e[127]!==me||e[128]!==c||e[129]!==i?(st=j?o.jsx(afe,{orgId:l,orgSlug:a,userId:c,connectionId:d,owner:u,repo:h,sandboxMap:f,enabled:S,onBack:()=>C(!1),onAdopt:K}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx(fy,{dot:"bg-success",label:L("thread.branchPicker.live"),branch:r,selected:M,disabled:!r,onSelect:()=>r&&ne(r)}),(me||I.length>0)&&o.jsx("div",{className:"my-1 border-t"}),me&&o.jsx(fy,{dot:Cm("orange"),label:L("thread.branchPicker.defaultVersionName"),branch:i,selected:!0,onSelect:()=>i&&ne(i)}),I.map(ze=>T===ze.branch?o.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[o.jsx("input",{autoFocus:!0,"aria-label":L("thread.branchPicker.rename"),value:P,onChange:yt=>V(yt.target.value),onKeyDown:yt=>{yt.key==="Enter"&&te(ze.branch),yt.key==="Escape"&&(yt.preventDefault(),yt.stopPropagation(),N(null))},className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),o.jsx(fe,{size:"sm",onClick:()=>{te(ze.branch)},children:L("thread.branchPicker.save")})]},ze.branch):o.jsx(lfe,{release:ze,selected:ze.branch===i,onSelect:()=>ne(ze.branch),onRename:()=>ee(ze),onDelete:()=>R(ze)},ze.branch))]}),o.jsx("div",{className:"my-1 border-t"}),o.jsxs("button",{type:"button",onClick:()=>{X()},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(Gt,{className:"h-4 w-4 shrink-0"}),L("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:[L("thread.branchPicker.advanced"),o.jsx(Ws,{className:"h-4 w-4 shrink-0"})]})]}),e[108]=K,e[109]=j,e[110]=r,e[111]=d,e[112]=X,e[113]=P,e[114]=T,e[115]=M,e[116]=S,e[117]=l,e[118]=a,e[119]=u,e[120]=ne,e[121]=I,e[122]=h,e[123]=f,e[124]=te,e[125]=ee,e[126]=L,e[127]=me,e[128]=c,e[129]=i,e[130]=st):st=e[130];let Be;e[131]!==Ae||e[132]!==st?(Be=o.jsxs(as,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:ofe,children:[Ae,st]}),e[131]=Ae,e[132]=st,e[133]=Be):Be=e[133];let Ie;e[134]!==W||e[135]!==ie||e[136]!==Z||e[137]!==Ce||e[138]!==Be?(Ie=o.jsxs(W,{open:ie,onOpenChange:Z,children:[Ce,Be]}),e[134]=W,e[135]=ie,e[136]=Z,e[137]=Ce,e[138]=Be,e[139]=Ie):Ie=e[139];const Oe=Ie,mt=E!==null;let lt;e[140]===Symbol.for("react.memo_cache_sentinel")?(lt=ze=>{ze||R(null)},e[140]=lt):lt=e[140];let Xe;e[141]!==L?(Xe=L("thread.branchPicker.deleteTitle"),e[141]=L,e[142]=Xe):Xe=e[142];let nt;e[143]!==Xe?(nt=o.jsx(Jr,{children:Xe}),e[143]=Xe,e[144]=nt):nt=e[144];let Fe;e[145]!==E||e[146]!==L?(Fe=E&&L("thread.branchPicker.deleteConfirm",{name:E.name}),e[145]=E,e[146]=L,e[147]=Fe):Fe=e[147];let dt;e[148]!==Fe?(dt=o.jsx(Qr,{children:Fe}),e[148]=Fe,e[149]=dt):dt=e[149];let et;e[150]!==nt||e[151]!==dt?(et=o.jsxs(Yr,{children:[nt,dt]}),e[150]=nt,e[151]=dt,e[152]=et):et=e[152];let rt;e[153]!==L?(rt=L("thread.branchPicker.cancel"),e[153]=L,e[154]=rt):rt=e[154];let gt;e[155]!==rt?(gt=o.jsx(Zr,{children:rt}),e[155]=rt,e[156]=gt):gt=e[156];let pe;e[157]!==L?(pe=L("thread.branchPicker.delete"),e[157]=L,e[158]=pe):pe=e[158];let Me;e[159]!==Q||e[160]!==pe?(Me=o.jsx(eo,{onClick:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:pe}),e[159]=Q,e[160]=pe,e[161]=Me):Me=e[161];let Ze;e[162]!==gt||e[163]!==Me?(Ze=o.jsxs(Xr,{children:[gt,Me]}),e[162]=gt,e[163]=Me,e[164]=Ze):Ze=e[164];let ct;e[165]!==et||e[166]!==Ze?(ct=o.jsxs(Gr,{children:[et,Ze]}),e[165]=et,e[166]=Ze,e[167]=ct):ct=e[167];let _t;e[168]!==mt||e[169]!==ct?(_t=o.jsx(qr,{open:mt,onOpenChange:lt,children:ct}),e[168]=mt,e[169]=ct,e[170]=_t):_t=e[170];let wt;return e[171]!==Oe||e[172]!==_t?(wt=o.jsxs(o.Fragment,{children:[Oe,_t]}),e[171]=Oe,e[172]=_t,e[173]=wt):wt=e[173],wt}function ofe(t){return t.preventDefault()}function fy(t){const e=F.c(22),{dot:s,label:n,branch:i,selected:r,disabled:l,onSelect:a}=t,c=r===void 0?!1:r,d=l===void 0?!1:l,u=c?"bg-accent":"hover:bg-accent/60",h=d&&"cursor-not-allowed opacity-50";let f;e[0]!==u||e[1]!==h?(f=re("flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm transition-colors",u,h),e[0]=u,e[1]=h,e[2]=f):f=e[2];let m;e[3]!==s?(m=re("h-2 w-2 shrink-0 rounded-full",s),e[3]=s,e[4]=m):m=e[4];let p;e[5]!==m?(p=o.jsx("span",{className:m}),e[5]=m,e[6]=p):p=e[6];let g;e[7]!==n?(g=o.jsx("span",{className:"flex-1 truncate",children:n}),e[7]=n,e[8]=g):g=e[8];let x;e[9]!==d||e[10]!==a||e[11]!==f||e[12]!==p||e[13]!==g?(x=o.jsxs("button",{type:"button",disabled:d,onClick:a,className:f,children:[p,g]}),e[9]=d,e[10]=a,e[11]=f,e[12]=p,e[13]=g,e[14]=x):x=e[14];const b=x;if(!i)return b;let v;e[15]!==b?(v=o.jsx(Ke,{asChild:!0,children:b}),e[15]=b,e[16]=v):v=e[16];let _;e[17]!==i?(_=o.jsx(We,{side:"bottom",className:"font-mono text-xs",children:i}),e[17]=i,e[18]=_):_=e[18];let y;return e[19]!==v||e[20]!==_?(y=o.jsxs(qe,{children:[v,_]}),e[19]=v,e[20]=_,e[21]=y):y=e[21],y}function lfe(t){const e=F.c(44),{release:s,selected:n,onSelect:i,onRename:r,onDelete:l}=t,a=le(),c=n?"bg-accent":"hover:bg-accent/60";let d;e[0]!==c?(d=re("group flex items-center rounded-md",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==s.color?(u=re("h-2 w-2 shrink-0 rounded-full",Cm(s.color)),e[2]=s.color,e[3]=u):u=e[3];let h;e[4]!==u?(h=o.jsx("span",{className:u}),e[4]=u,e[5]=h):h=e[5];let f;e[6]!==s.name?(f=o.jsx("span",{className:"flex-1 truncate",children:s.name}),e[6]=s.name,e[7]=f):f=e[7];let m;e[8]!==i||e[9]!==h||e[10]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:i,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[h,f]})}),e[8]=i,e[9]=h,e[10]=f,e[11]=m):m=e[11];let p;e[12]!==s.branch?(p=o.jsx(We,{side:"bottom",className:"font-mono text-xs",children:s.branch}),e[12]=s.branch,e[13]=p):p=e[13];let g;e[14]!==m||e[15]!==p?(g=o.jsxs(qe,{children:[m,p]}),e[14]=m,e[15]=p,e[16]=g):g=e[16];let x;e[17]!==a?(x=a("thread.branchPicker.moreActions"),e[17]=a,e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(o9,{className:"h-4 w-4"}),e[19]=b):b=e[19];let v;e[20]!==x?(v=o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":x,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:b})}),e[20]=x,e[21]=v):v=e[21];let _;e[22]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(r9,{className:"h-4 w-4"}),e[22]=_):_=e[22];let y;e[23]!==a?(y=a("thread.branchPicker.rename"),e[23]=a,e[24]=y):y=e[24];let L;e[25]!==r||e[26]!==y?(L=o.jsxs(Je,{onSelect:r,children:[_,y]}),e[25]=r,e[26]=y,e[27]=L):L=e[27];let w;e[28]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(nn,{className:"h-4 w-4"}),e[28]=w):w=e[28];let S;e[29]!==a?(S=a("thread.branchPicker.delete"),e[29]=a,e[30]=S):S=e[30];let k;e[31]!==l||e[32]!==S?(k=o.jsxs(Je,{onSelect:l,className:"text-destructive focus:text-destructive",children:[w,S]}),e[31]=l,e[32]=S,e[33]=k):k=e[33];let j;e[34]!==L||e[35]!==k?(j=o.jsxs(Kt,{align:"end",children:[L,k]}),e[34]=L,e[35]=k,e[36]=j):j=e[36];let C;e[37]!==v||e[38]!==j?(C=o.jsxs(Ut,{children:[v,j]}),e[37]=v,e[38]=j,e[39]=C):C=e[39];let T;return e[40]!==C||e[41]!==d||e[42]!==g?(T=o.jsxs("div",{className:d,children:[g,C]}),e[40]=C,e[41]=d,e[42]=g,e[43]=T):T=e[43],T}function afe(t){const e=F.c(94),{orgId:s,orgSlug:n,userId:i,connectionId:r,owner:l,repo:a,sandboxMap:c,enabled:d,onBack:u,onAdopt:h}=t,f=le(),[m,p]=A.useState("branches"),[g,x]=A.useState(""),b=m==="branches"?g:"",v=d&&m==="branches";let _;e[0]!==r||e[1]!==s||e[2]!==n||e[3]!==l||e[4]!==a||e[5]!==c||e[6]!==b||e[7]!==v||e[8]!==i?(_={orgId:s,orgSlug:n,userId:i,connectionId:r,sandboxMap:c,owner:l,repo:a,search:b,enabled:v},e[0]=r,e[1]=s,e[2]=n,e[3]=l,e[4]=a,e[5]=c,e[6]=b,e[7]=v,e[8]=i,e[9]=_):_=e[9];const{recent:y,yours:L,others:w,isLoading:S,hasMore:k,isFetchingMore:j,fetchMore:C}=Zj(_),T=r??"",N=d&&m==="prs";let P;e[10]!==s||e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==T||e[15]!==N?(P={orgId:s,orgSlug:n,connectionId:T,owner:l,repo:a,enabled:N},e[10]=s,e[11]=n,e[12]=l,e[13]=a,e[14]=T,e[15]=N,e[16]=P):P=e[16];const{data:V,isLoading:E}=z8(P);let R,I,D,O,$,M,z,B,U;if(e[17]!==C||e[18]!==k||e[19]!==j||e[20]!==S||e[21]!==h||e[22]!==u||e[23]!==w||e[24]!==l||e[25]!==E||e[26]!==y||e[27]!==a||e[28]!==g||e[29]!==f||e[30]!==V||e[31]!==m||e[32]!==L){const Q=V===void 0?[]:V,X=`${l}/${a}`;let se;e[42]!==X?(se=X.toLowerCase(),e[42]=X,e[43]=se):se=e[43];const ne=se;let te;e[44]!==ne?(te=G=>G.headRepoFullName?.toLowerCase()===ne,e[44]=ne,e[45]=te):te=e[45];const ee=Q.filter(te);let Y;if(e[46]!==w||e[47]!==y||e[48]!==L){const G=new Set;Y=[...y,...L,...w].filter(me=>G.has(me.name)?!1:(G.add(me.name),!0)),e[46]=w,e[47]=y,e[48]=L,e[49]=Y}else Y=e[49];const q=Y;M="flex flex-col";let oe;e[50]===Symbol.for("react.memo_cache_sentinel")?(oe=o.jsx($h,{className:"h-4 w-4 shrink-0"}),e[50]=oe):oe=e[50];let J;e[51]!==f?(J=f("thread.branchPicker.advancedBack"),e[51]=f,e[52]=J):J=e[52],e[53]!==u||e[54]!==J?(z=o.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[oe,J]}),e[53]=u,e[54]=J,e[55]=z):z=e[55],I=Ii,D=m==="branches"?cfe:void 0;let ie;e[56]!==f||e[57]!==m?(ie=f(m==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[56]=f,e[57]=m,e[58]=ie):ie=e[58],e[59]!==g||e[60]!==ie?(O=o.jsx(di,{placeholder:ie,value:g,onValueChange:x}),e[59]=g,e[60]=ie,e[61]=O):O=e[61];let Z;e[62]===Symbol.for("react.memo_cache_sentinel")?(Z=G=>{p(G),x("")},e[62]=Z):Z=e[62];let he;e[63]!==f?(he=f("thread.branchPicker.branchesTab"),e[63]=f,e[64]=he):he=e[64];let de;e[65]!==he?(de=o.jsx(ii,{value:"branches",className:"h-6 px-2.5 text-xs",children:he}),e[65]=he,e[66]=de):de=e[66];let ae;e[67]!==f?(ae=f("thread.branchPicker.prsTab"),e[67]=f,e[68]=ae):ae=e[68];let ce;e[69]!==ae?(ce=o.jsx(ii,{value:"prs",className:"h-6 px-2.5 text-xs",children:ae}),e[69]=ae,e[70]=ce):ce=e[70];let ue;e[71]!==de||e[72]!==ce?(ue=o.jsxs(Jc,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[de,ce]}),e[71]=de,e[72]=ce,e[73]=ue):ue=e[73],e[74]!==ue||e[75]!==m?($=o.jsx(na,{className:"px-2 pt-2 pb-1",value:m,onValueChange:Z,children:ue}),e[74]=ue,e[75]=m,e[76]=$):$=e[76],R=ui,e[77]!==C||e[78]!==m?(B=G=>{const me=G.currentTarget;m==="branches"&&me.scrollHeight-me.scrollTop-me.clientHeight<48&&C()},e[77]=C,e[78]=m,e[79]=B):B=e[79],U=m==="branches"?o.jsxs(o.Fragment,{children:[S&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingMore")}),!S&&q.length===0&&o.jsx($n,{children:f("thread.branchPicker.noBranchesFound")}),q.length>0&&o.jsx(Ps,{children:q.map(G=>o.jsxs(ls,{value:G.name,className:"cursor-pointer",onSelect:()=>h(G.name,G.name),children:[o.jsx(nr,{className:"mr-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:G.name})]},G.name))}),k&&o.jsx("div",{className:"p-2",children:o.jsx(fe,{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:[E&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingPullRequests")}),!E&&ee.length===0&&o.jsx($n,{children:f("thread.branchPicker.noOpenPullRequests")}),ee.length>0&&o.jsx(Ps,{children:ee.map(G=>o.jsxs(ls,{value:`#${G.number} ${G.title} ${G.head}`,className:"cursor-pointer",onSelect:()=>h(G.head,Xo(G.title)),children:[o.jsx(Hr,{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:Xo(G.title)}),o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",G.number," · ",G.head]})]})]},G.number))})]}),e[17]=C,e[18]=k,e[19]=j,e[20]=S,e[21]=h,e[22]=u,e[23]=w,e[24]=l,e[25]=E,e[26]=y,e[27]=a,e[28]=g,e[29]=f,e[30]=V,e[31]=m,e[32]=L,e[33]=R,e[34]=I,e[35]=D,e[36]=O,e[37]=$,e[38]=M,e[39]=z,e[40]=B,e[41]=U}else R=e[33],I=e[34],D=e[35],O=e[36],$=e[37],M=e[38],z=e[39],B=e[40],U=e[41];let H;e[80]!==R||e[81]!==B||e[82]!==U?(H=o.jsx(R,{onScroll:B,children:U}),e[80]=R,e[81]=B,e[82]=U,e[83]=H):H=e[83];let W;e[84]!==I||e[85]!==D||e[86]!==O||e[87]!==$||e[88]!==H?(W=o.jsxs(I,{filter:D,children:[O,$,H]}),e[84]=I,e[85]=D,e[86]=O,e[87]=$,e[88]=H,e[89]=W):W=e[89];let K;return e[90]!==M||e[91]!==z||e[92]!==W?(K=o.jsxs("div",{className:M,children:[z,W]}),e[90]=M,e[91]=z,e[92]=W,e[93]=K):K=e[93],K}function cfe(t,e){return Af(t,e)?1:0}const dfe=(t,e)=>Af(t,e)?1:0;function ufe(t){const e=F.c(161),{orgId:s,orgSlug:n,userId:i,userLabel:r,connectionId:l,owner:a,repo:c,sandboxMap:d,value:u,onChange:h,onCreateBranch:f,disabled:m,spawnsNewChat:p,placement:g}=t,x=m===void 0?!1:m,b=p===void 0?!1:p,v=g===void 0?"chat":g,_=le(),y=v==="header",[L,w]=A.useState(!1),[S,k]=A.useState("branches"),[j,C]=A.useState(""),[T,N]=A.useState(u??""),P=S==="branches"?j:"";let V;e[0]!==l||e[1]!==L||e[2]!==s||e[3]!==n||e[4]!==a||e[5]!==c||e[6]!==d||e[7]!==P||e[8]!==i?(V={orgId:s,orgSlug:n,userId:i,connectionId:l,sandboxMap:d,owner:a,repo:c,search:P,enabled:L},e[0]=l,e[1]=L,e[2]=s,e[3]=n,e[4]=a,e[5]=c,e[6]=d,e[7]=P,e[8]=i,e[9]=V):V=e[9];const{recent:E,yours:R,others:I,isLoading:D,isError:O,isSearching:$,hiddenMatchCount:M,hasMore:z,isFetchingMore:B,fetchMore:U}=Zj(V);let H;e[10]!==L?(H={enabled:L},e[10]=L,e[11]=H):H=e[11];const{data:W}=Zf(H);let K;e[12]!==W?.data?.members?(K=new Map((W?.data?.members??[]).map(hfe)),e[12]=W?.data?.members,e[13]=K):K=e[13];const Q=K,X=l??"",se=L&&S==="prs";let ne;e[14]!==s||e[15]!==n||e[16]!==a||e[17]!==c||e[18]!==X||e[19]!==se?(ne={orgId:s,orgSlug:n,connectionId:X,owner:a,repo:c,enabled:se},e[14]=s,e[15]=n,e[16]=a,e[17]=c,e[18]=X,e[19]=se,e[20]=ne):ne=e[20];const{data:te,isLoading:ee,isError:Y}=z8(ne);let q,oe,J,ie,Z,he,de,ae,ce,ue,G,me,ye,we,Ne,je,_e;if(e[21]!==T||e[22]!==x||e[23]!==U||e[24]!==z||e[25]!==M||e[26]!==O||e[27]!==B||e[28]!==y||e[29]!==D||e[30]!==$||e[31]!==Q||e[32]!==h||e[33]!==f||e[34]!==L||e[35]!==I||e[36]!==a||e[37]!==Y||e[38]!==ee||e[39]!==E||e[40]!==c||e[41]!==j||e[42]!==b||e[43]!==_||e[44]!==te||e[45]!==S||e[46]!==r||e[47]!==u||e[48]!==R){const Ae=te===void 0?[]:te,st=`${a}/${c}`;let Be;e[66]!==st?(Be=st.toLowerCase(),e[66]=st,e[67]=Be):Be=e[67];const Ie=Be;let Oe;e[68]!==Ie?(Oe=ke=>ke.headRepoFullName?.toLowerCase()===Ie,e[68]=Ie,e[69]=Oe):Oe=e[69];const mt=Ae.filter(Oe),lt=Ae.length-mt.length;let Xe;e[70]!==h?(Xe=ke=>{h(ke),w(!1)},e[70]=h,e[71]=Xe):Xe=e[71];const nt=Xe;let Fe;e[72]!==h||e[73]!==f?(Fe=ke=>{(f??h)(ke),w(!1)},e[72]=h,e[73]=f,e[74]=Fe):Fe=e[74];const dt=Fe;let et;e[75]!==_||e[76]!==u?(et=u??_("thread.branchPicker.selectBranch"),e[75]=_,e[76]=u,e[77]=et):et=e[77];const rt=et;let gt;e[78]!==U||e[79]!==S?(gt=ke=>{const ot=ke.currentTarget,Le=ot.scrollHeight-ot.scrollTop-ot.clientHeight;S==="branches"&&Le<48&&U()},e[78]=U,e[79]=S,e[80]=gt):gt=e[80];const pe=gt;ie=cs,Ne=L,e[81]!==x||e[82]!==u?(je=x?void 0:ke=>{ke&&(N(u??""),C("")),w(ke)},e[81]=x,e[82]=u,e[83]=je):je=e[83];const Me=y?"outline":"ghost",Ze=y?"sm":"default",ct=y?"text-xs":"text-xs text-muted-foreground hover:text-foreground";let _t;e[84]!==ct?(_t=re("font-mono shrink min-w-0 max-w-[200px] gap-1.5",ct),e[84]=ct,e[85]=_t):_t=e[85];let wt;e[86]===Symbol.for("react.memo_cache_sentinel")?(wt=o.jsx(nr,{className:"h-3.5 w-3.5 shrink-0"}),e[86]=wt):wt=e[86];let ze;e[87]!==rt?(ze=o.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:rt}),e[87]=rt,e[88]=ze):ze=e[88];let yt;e[89]!==x?(yt=!x&&o.jsx(bs,{size:12,className:"opacity-60 shrink-0"}),e[89]=x,e[90]=yt):yt=e[90];let At;e[91]!==x||e[92]!==rt||e[93]!==Me||e[94]!==Ze||e[95]!==_t||e[96]!==ze||e[97]!==yt?(At=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"inline-flex min-w-0 shrink","data-tour":Xf.branchPicker,children:o.jsx(os,{asChild:!0,children:o.jsxs(fe,{variant:Me,size:Ze,"aria-label":rt,disabled:x,className:_t,children:[wt,ze,yt]})})})}),e[91]=x,e[92]=rt,e[93]=Me,e[94]=Ze,e[95]=_t,e[96]=ze,e[97]=yt,e[98]=At):At=e[98];let ht;e[99]!==rt?(ht=o.jsx(We,{children:rt}),e[99]=rt,e[100]=ht):ht=e[100],e[101]!==At||e[102]!==ht?(_e=o.jsxs(qe,{children:[At,ht]}),e[101]=At,e[102]=ht,e[103]=_e):_e=e[103],J=as,ye="w-[min(420px,calc(100vw-2rem))] p-0",we="start",oe=Ii,de=T,ae=N,ce=S==="branches"?dfe:void 0;let ft;e[104]!==_||e[105]!==S?(ft=_(S==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[104]=_,e[105]=S,e[106]=ft):ft=e[106];let at;e[107]!==j||e[108]!==ft?(at=o.jsx(di,{placeholder:ft,value:j,onValueChange:C}),e[107]=j,e[108]=ft,e[109]=at):at=e[109];let pt;e[110]!==dt||e[111]!==j||e[112]!==_||e[113]!==S||e[114]!==r?(pt=S==="branches"&&o.jsx(fe,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>dt(j.trim()||Dl(r)),children:j.trim()?_("thread.branchPicker.createBranch",{name:j.trim()}):_("thread.branchPicker.new")}),e[110]=dt,e[111]=j,e[112]=_,e[113]=S,e[114]=r,e[115]=pt):pt=e[115],e[116]!==at||e[117]!==pt?(ue=o.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[at,pt]}),e[116]=at,e[117]=pt,e[118]=ue):ue=e[118],e[119]!==b||e[120]!==_?(G=b&&o.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:_("thread.branchPicker.newChatHint")}),e[119]=b,e[120]=_,e[121]=G):G=e[121];let Lt;e[122]===Symbol.for("react.memo_cache_sentinel")?(Lt=ke=>{k(ke),C("")},e[122]=Lt):Lt=e[122];let bt;e[123]!==_?(bt=_("thread.branchPicker.branchesTab"),e[123]=_,e[124]=bt):bt=e[124];let Ft;e[125]!==bt?(Ft=o.jsx(ii,{value:"branches",className:"h-6 px-2.5 text-xs",children:bt}),e[125]=bt,e[126]=Ft):Ft=e[126];let ge;e[127]!==_?(ge=_("thread.branchPicker.prsTab"),e[127]=_,e[128]=ge):ge=e[128];let Ee;e[129]!==ge?(Ee=o.jsx(ii,{value:"prs",className:"h-6 px-2.5 text-xs",children:ge}),e[129]=ge,e[130]=Ee):Ee=e[130];let Re;e[131]!==Ft||e[132]!==Ee?(Re=o.jsxs(Jc,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[Ft,Ee]}),e[131]=Ft,e[132]=Ee,e[133]=Re):Re=e[133],e[134]!==Re||e[135]!==S?(me=o.jsx(na,{className:"px-2 pt-2 pb-1",value:S,onValueChange:Lt,children:Re}),e[134]=Re,e[135]=S,e[136]=me):me=e[136],q=ui,Z=pe,he=S==="prs"?o.jsxs(o.Fragment,{children:[Y&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:_("thread.branchPicker.couldntLoadPullRequests")}),ee&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:_("thread.branchPicker.loadingPullRequests")}),!Y&&!ee&&o.jsx($n,{children:j.trim()?_("thread.branchPicker.noPullRequestsFound"):_("thread.branchPicker.noOpenPullRequests")}),mt.length>0&&o.jsx(Ps,{heading:_("thread.branchPicker.openPullRequests"),children:mt.map(ke=>o.jsxs(ls,{value:`#${ke.number} ${ke.title} ${ke.head}`,className:"cursor-pointer",onSelect:()=>nt(ke.head),children:[o.jsx(Hr,{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:Xo(ke.title)}),o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",ke.number," · ",ke.head,ke.author?` · @${ke.author}`:""]})]})]},ke.number))}),lt>0&&o.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:_("thread.branchPicker.hiddenForkPrs",{count:lt})})]}):o.jsxs(o.Fragment,{children:[O&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:_("thread.branchPicker.couldntLoadBranches")}),!O&&($||!D)&&o.jsx($n,{children:_($?"thread.branchPicker.searchingBranches":"thread.branchPicker.noBranchesFound")}),E.length>0&&o.jsx(Ps,{heading:_("thread.branchPicker.last7Days"),children:E.map(ke=>o.jsxs(ls,{value:ke.name,className:"cursor-pointer",onSelect:()=>nt(ke.name),children:[o.jsx(nr,{className:"mr-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:ke.name}),ke.name===u&&o.jsx($t,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"}),o.jsx(ffe,{userIds:ke.contributors??[],memberById:Q})]},ke.name))}),R.length>0&&o.jsxs(o.Fragment,{children:[E.length>0&&o.jsx(Rx,{}),o.jsx(Ps,{heading:_("thread.branchPicker.yourBranches"),children:R.map(ke=>o.jsxs(ls,{value:ke.name,className:"cursor-pointer",onSelect:()=>nt(ke.name),children:[o.jsx(nr,{className:"mr-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:ke.name}),ke.name===u&&o.jsx($t,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"})]},ke.name))})]}),I.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Rx,{}),o.jsx(Ps,{heading:_("thread.branchPicker.otherBranchesInRepo"),children:I.map(ke=>o.jsxs(ls,{value:ke.name,className:"cursor-pointer",onSelect:()=>nt(ke.name),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:ke.name}),ke.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",ke.author]}),ke.name===u&&o.jsx($t,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"})]},ke.name))})]}),z&&o.jsx("div",{className:"border-t p-2",children:o.jsx(fe,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:B,onClick:U,children:_(B?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})}),M>0&&o.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:_("thread.branchPicker.moreMatches",{count:M})}),!j.trim()&&!z&&I.length>0&&o.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:_("thread.branchPicker.allLoaded")})]}),e[21]=T,e[22]=x,e[23]=U,e[24]=z,e[25]=M,e[26]=O,e[27]=B,e[28]=y,e[29]=D,e[30]=$,e[31]=Q,e[32]=h,e[33]=f,e[34]=L,e[35]=I,e[36]=a,e[37]=Y,e[38]=ee,e[39]=E,e[40]=c,e[41]=j,e[42]=b,e[43]=_,e[44]=te,e[45]=S,e[46]=r,e[47]=u,e[48]=R,e[49]=q,e[50]=oe,e[51]=J,e[52]=ie,e[53]=Z,e[54]=he,e[55]=de,e[56]=ae,e[57]=ce,e[58]=ue,e[59]=G,e[60]=me,e[61]=ye,e[62]=we,e[63]=Ne,e[64]=je,e[65]=_e}else q=e[49],oe=e[50],J=e[51],ie=e[52],Z=e[53],he=e[54],de=e[55],ae=e[56],ce=e[57],ue=e[58],G=e[59],me=e[60],ye=e[61],we=e[62],Ne=e[63],je=e[64],_e=e[65];let Ve;e[137]!==q||e[138]!==Z||e[139]!==he?(Ve=o.jsx(q,{onScroll:Z,children:he}),e[137]=q,e[138]=Z,e[139]=he,e[140]=Ve):Ve=e[140];let xe;e[141]!==oe||e[142]!==de||e[143]!==ae||e[144]!==ce||e[145]!==ue||e[146]!==G||e[147]!==me||e[148]!==Ve?(xe=o.jsxs(oe,{value:de,onValueChange:ae,filter:ce,children:[ue,G,me,Ve]}),e[141]=oe,e[142]=de,e[143]=ae,e[144]=ce,e[145]=ue,e[146]=G,e[147]=me,e[148]=Ve,e[149]=xe):xe=e[149];let Se;e[150]!==J||e[151]!==ye||e[152]!==we||e[153]!==xe?(Se=o.jsx(J,{className:ye,align:we,children:xe}),e[150]=J,e[151]=ye,e[152]=we,e[153]=xe,e[154]=Se):Se=e[154];let Ce;return e[155]!==ie||e[156]!==Ne||e[157]!==je||e[158]!==_e||e[159]!==Se?(Ce=o.jsxs(ie,{open:Ne,onOpenChange:je,children:[_e,Se]}),e[155]=ie,e[156]=Ne,e[157]=je,e[158]=_e,e[159]=Se,e[160]=Ce):Ce=e[160],Ce}function hfe(t){return[t.userId,t.user]}function ffe(t){const e=F.c(13),{userIds:s,memberById:n}=t;if(s.length===0)return null;let i,r,l;if(e[0]!==n||e[1]!==s){const d=s.slice(0,3);i=s.length-d.length,r="ml-2 flex shrink-0 items-center -space-x-1.5";let u;e[5]!==n?(u=h=>{const f=n.get(h);return o.jsx(Hs,{url:f?.image??void 0,fallback:Cn(f?.name??void 0),shape:"circle",size:"xs",className:"ring-2 ring-background"},h)},e[5]=n,e[6]=u):u=e[6],l=d.map(u),e[0]=n,e[1]=s,e[2]=i,e[3]=r,e[4]=l}else i=e[2],r=e[3],l=e[4];let a;e[7]!==i?(a=i>0&&o.jsxs("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[9px] font-semibold text-muted-foreground ring-2 ring-background",children:["+",i]}),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==r||e[10]!==l||e[11]!==a?(c=o.jsxs("span",{className:r,children:[l,a]}),e[9]=r,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function mfe(t){const e=F.c(31),{draftsMode:s,locked:n,placement:i,value:r,virtualMcpId:l,userLabel:a,baseBranch:c,onChange:d,onCreateBranch:u,orgId:h,orgSlug:f,userId:m,connectionId:p,owner:g,repo:x,sandboxMap:b}=t;if(s){let _;return e[0]!==c||e[1]!==p||e[2]!==n||e[3]!==d||e[4]!==u||e[5]!==h||e[6]!==f||e[7]!==g||e[8]!==i||e[9]!==x||e[10]!==b||e[11]!==m||e[12]!==a||e[13]!==r||e[14]!==l?(_=o.jsx(rfe,{virtualMcpId:l,userLabel:a,value:r,baseBranch:c,orgId:h,orgSlug:f,userId:m,connectionId:p,owner:g,repo:x,sandboxMap:b,onChange:d,onCreateBranch:u,spawnsNewChat:n,placement:i}),e[0]=c,e[1]=p,e[2]=n,e[3]=d,e[4]=u,e[5]=h,e[6]=f,e[7]=g,e[8]=i,e[9]=x,e[10]=b,e[11]=m,e[12]=a,e[13]=r,e[14]=l,e[15]=_):_=e[15],_}let v;return e[16]!==p||e[17]!==n||e[18]!==d||e[19]!==u||e[20]!==h||e[21]!==f||e[22]!==g||e[23]!==i||e[24]!==x||e[25]!==b||e[26]!==m||e[27]!==a||e[28]!==r||e[29]!==l?(v=o.jsx(ufe,{orgId:h,orgSlug:f,userId:m,userLabel:a,virtualMcpId:l,connectionId:p,owner:g,repo:x,sandboxMap:b,value:r,onChange:d,onCreateBranch:u,spawnsNewChat:n,placement:i}),e[16]=p,e[17]=n,e[18]=d,e[19]=u,e[20]=h,e[21]=f,e[22]=g,e[23]=i,e[24]=x,e[25]=b,e[26]=m,e[27]=a,e[28]=r,e[29]=l,e[30]=v):v=e[30],v}function pfe(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 gfe(t){const e=F.c(37),{virtualMcp:s,currentBranch:n}=t,i=h2(),r=hs();let l;e[0]!==i?.messages||e[1]!==r?.isThreadLocked?(l=(i?.messages??[]).length>0||(r?.isThreadLocked??!1),e[0]=i?.messages,e[1]=r?.isThreadLocked,e[2]=l):l=e[2];const a=l,c=r?.setCurrentTaskBranch,d=r?.createTask;let u;e[3]!==r?.activeTask?.metadata||e[4]!==s?.metadata?(u=S2(s?.metadata)==="cms"&&d6(r?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=r?.activeTask?.metadata,e[4]=s?.metadata,e[5]=u):u=e[5];const h=u;let f;e[6]!==s?(f=io(s),e[6]=s,e[7]=f):f=e[7];const m=f,p=m?.connectionId,{data:g}=vn.useSession(),x=g?.user;let b;e[8]!==x?(b=a9(x),e[8]=x,e[9]=b):b=e[9];const v=b,_=g?.user?.id??"",{org:y}=He(),L=ug(s,n);let w;e[10]!==s?(w=sd(s),e[10]=s,e[11]=w):w=e[11];const S=w;let k;e[12]!==d||e[13]!==a||e[14]!==c?(k=E=>{a&&d?d({branch:E}):c&&c(E)},e[12]=d,e[13]=a,e[14]=c,e[15]=k):k=e[15];const j=k;let C;e[16]!==h||e[17]!==d||e[18]!==a||e[19]!==c?(C=E=>{(a||h)&&d?d({branch:E}):c&&c(E)},e[16]=h,e[17]=d,e[18]=a,e[19]=c,e[20]=C):C=e[20];const T=C;let N;e[21]!==L||e[22]!==p||e[23]!==n||e[24]!==S||e[25]!==m||e[26]!==a||e[27]!==j||e[28]!==T||e[29]!==y||e[30]!==_||e[31]!==v||e[32]!==s?.id||e[33]!==s?.metadata?.sandboxMap?(N=m&&p?o.jsx(mfe,{draftsMode:S,userLabel:v,virtualMcpId:s?.id??"",value:n,baseBranch:L,orgId:y.id,orgSlug:y.slug,userId:_,connectionId:p,owner:m.owner,repo:m.name,sandboxMap:s?.metadata?.sandboxMap,onChange:j,onCreateBranch:T,locked:a,placement:"chat"},`${p}:${m.owner}/${m.name}`):null,e[21]=L,e[22]=p,e[23]=n,e[24]=S,e[25]=m,e[26]=a,e[27]=j,e[28]=T,e[29]=y,e[30]=_,e[31]=v,e[32]=s?.id,e[33]=s?.metadata?.sandboxMap,e[34]=N):N=e[34];const P=N;let V;return e[35]!==P?(V=o.jsx(pfe,{branchPill:P}),e[35]=P,e[36]=V):V=e[36],V}function om(t){const e=F.c(13),{label:s,value:n,onChange:i,options:r}=t;let l;e[0]!==s?(l=o.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==i?(a=h=>h&&i(h),e[2]=i,e[3]=a):a=e[3];let c;e[4]!==r?(c=r.map(xfe),e[4]=r,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==c||e[8]!==n?(d=o.jsx(Gf,{type:"single",size:"sm",value:n,onValueChange:a,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=a,e[7]=c,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==l||e[11]!==d?(u=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l,d]}),e[10]=l,e[11]=d,e[12]=u):u=e[12],u}function xfe(t){return o.jsxs(Rc,{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 bfe(t){const e=F.c(91),{panel:s,className:n}=t,i=n===void 0?"md:size-[34px] rounded-lg":n,r=le();let l;e[0]!==r?(l=r("sidebar.taskGroupsList.filterChats"),e[0]=r,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(M2,{size:16}),e[2]=a):a=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]!==l||e[8]!==c?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(os,{asChild:!0,children:o.jsxs(Mr,{"aria-label":l,active:s.filtersActive,className:i,children:[a,c]})})}),e[5]=i,e[6]=s.filtersActive,e[7]=l,e[8]=c,e[9]=d):d=e[9];let u;e[10]!==r?(u=r("sidebar.taskGroupsList.filterChats"),e[10]=r,e[11]=u):u=e[11];let h;e[12]!==u?(h=o.jsx(We,{side:"bottom",children:u}),e[12]=u,e[13]=h):h=e[13];let f;e[14]!==d||e[15]!==h?(f=o.jsxs(qe,{children:[d,h]}),e[14]=d,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==r?(m=r("sidebar.taskGroupsList.filterView"),e[17]=r,e[18]=m):m=e[18];const p=s.groupBy;let g;e[19]!==s?(g=se=>{Ge("tasks_panel_group_by_changed",{to_value:se}),s.setGroupBy(se)},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(bT,{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 _;e[26]!==r?(_=r("sidebar.taskGroupsList.viewStatus"),e[26]=r,e[27]=_):_=e[27];let y;e[28]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(vT,{size:13}),e[28]=y):y=e[28];let L;e[29]!==_?(L={value:"status",label:_,icon:y},e[29]=_,e[30]=L):L=e[30];let w;e[31]!==v||e[32]!==L?(w=[v,L],e[31]=v,e[32]=L,e[33]=w):w=e[33];let S;e[34]!==s.groupBy||e[35]!==g||e[36]!==w||e[37]!==m?(S=o.jsx(om,{label:m,value:p,onChange:g,options:w}),e[34]=s.groupBy,e[35]=g,e[36]=w,e[37]=m,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=se=>{Ge("tasks_panel_filter_changed",{to_value:se}),s.setTypeFilter(se)},e[41]=s,e[42]=C):C=e[42];let T;e[43]!==r?(T=r("sidebar.taskGroupsList.typeAll"),e[43]=r,e[44]=T):T=e[44];let N;e[45]!==T?(N={value:"all",label:T},e[45]=T,e[46]=N):N=e[46];let P;e[47]!==r?(P=r("sidebar.taskGroupsList.typeChats"),e[47]=r,e[48]=P):P=e[48];let V;e[49]!==P?(V={value:"manual",label:P},e[49]=P,e[50]=V):V=e[50];let E;e[51]!==r?(E=r("sidebar.taskGroupsList.typeAuto"),e[51]=r,e[52]=E):E=e[52];let R;e[53]!==E?(R={value:"automation",label:E},e[53]=E,e[54]=R):R=e[54];let I;e[55]!==N||e[56]!==V||e[57]!==R?(I=[N,V,R],e[55]=N,e[56]=V,e[57]=R,e[58]=I):I=e[58];let D;e[59]!==s.typeFilter||e[60]!==k||e[61]!==C||e[62]!==I?(D=o.jsx(om,{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 $=s.showAll?"team":"mine";let M;e[66]!==s?(M=se=>s.setShowAll(se==="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 B;e[70]!==z?(B={value:"mine",label:z},e[70]=z,e[71]=B):B=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]!==B||e[77]!==H?(W=[B,H],e[76]=B,e[77]=H,e[78]=W):W=e[78];let K;e[79]!==O||e[80]!==$||e[81]!==M||e[82]!==W?(K=o.jsx(om,{label:O,value:$,onChange:M,options:W}),e[79]=O,e[80]=$,e[81]=M,e[82]=W,e[83]=K):K=e[83];let Q;e[84]!==S||e[85]!==D||e[86]!==K?(Q=o.jsxs(as,{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]=Q):Q=e[87];let X;return e[88]!==Q||e[89]!==f?(X=o.jsxs(cs,{children:[f,Q]}),e[88]=Q,e[89]=f,e[90]=X):X=e[90],X}function vfe(t,e){return t.filter(s=>s.id===e||!!s.trigger_id||V7(s))}function yfe(t){const e=F.c(9),{virtualMcpId:s,size:n,showAutomationBadge:i}=t,r=n===void 0?"sm":n,l=le();let a;e[0]!==r||e[1]!==s?(a=s?o.jsx(_fe,{virtualMcpId:s,size:r}):o.jsx(ur,{icon:null,name:"?",size:r}),e[0]=r,e[1]=s,e[2]=a):a=e[2];let c;e[3]!==i||e[4]!==l?(c=i&&o.jsx("span",{"aria-label":l("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]=l,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsxs("div",{className:"relative shrink-0",children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function _fe(t){const e=F.c(6),{virtualMcpId:s,size:n}=t,i=vs(s);if(!i){let a;return e[0]!==n?(a=o.jsx(ur,{icon:null,name:"?",size:n}),e[0]=n,e[1]=a):a=e[1],a}const r=i.icon??null;let l;return e[2]!==i.title||e[3]!==n||e[4]!==r?(l=o.jsx(ur,{icon:r,name:i.title,size:n}),e[2]=i.title,e[3]=n,e[4]=r,e[5]=l):l=e[5],l}const my=["thread"];function Lfe(t){const e=F.c(53),{open:s,onOpenChange:n}=t,[i,r]=A.useState(""),{org:l}=He(),{setTaskId:a}=Zl(),c=Vs(),d=le();let u,h,f,m;e[0]!==l.id||e[1]!==i?(m=i.trim(),u=m?20:10,f=Mt,h=tt.globalSearch(l.id,m,u,my),e[0]=l.id,e[1]=i,e[2]=u,e[3]=h,e[4]=f,e[5]=m):(u=e[2],h=e[3],f=e[4],m=e[5]);let p;e[6]!==u||e[7]!==c||e[8]!==m?(p=async()=>{const O=await c.call("GLOBAL_SEARCH",{query:m,limit:u,types:[...my]});return{...O,items:O.items.filter(wfe)}},e[6]=u,e[7]=c,e[8]=m,e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==h||e[12]!==p?(g={queryKey:h,enabled:s,queryFn:p,staleTime:1e4},e[10]=s,e[11]=h,e[12]=p,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 _=v;let y;e[16]!==n?(y=O=>{O||r(""),n(O)},e[16]=n,e[17]=y):y=e[17];const L=y;let w;e[18]!==L||e[19]!==a?(w=O=>{L(!1),a(O.id,O.virtual_mcp_id??void 0)},e[18]=L,e[19]=a,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(qt,{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 T;e[27]!==C?(T=o.jsx(Nn,{children:C}),e[27]=C,e[28]=T):T=e[28];let N;e[29]!==T||e[30]!==j?(N=o.jsxs(ds,{className:"sr-only",children:[j,T]}),e[29]=T,e[30]=j,e[31]=N):N=e[31];let P;e[32]!==d?(P=d("tasksPanel.globalSearchDialog.placeholder"),e[32]=d,e[33]=P):P=e[33];let V;e[34]!==i||e[35]!==P?(V=o.jsx(di,{value:i,onValueChange:r,placeholder:P}),e[34]=i,e[35]=P,e[36]=V):V=e[36];let E;e[37]!==S||e[38]!==b||e[39]!==_||e[40]!==d||e[41]!==m?(E=o.jsx(ui,{children:b&&_.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:d("tasksPanel.globalSearchDialog.searching")}):_.length===0?o.jsx($n,{children:d("tasksPanel.globalSearchDialog.noResults")}):o.jsx(Ps,{heading:m?void 0:d("tasksPanel.globalSearchDialog.recent"),children:_.map(O=>O.type==="thread"?o.jsxs(ls,{value:`thread:${O.id}:${O.title}`,onSelect:()=>S(O),className:"gap-2.5",children:[o.jsx(yfe,{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]=_,e[40]=d,e[41]=m,e[42]=E):E=e[42];let R;e[43]!==V||e[44]!==E?(R=o.jsxs(Ii,{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:[V,E]}),e[43]=V,e[44]=E,e[45]=R):R=e[45];let I;e[46]!==N||e[47]!==R?(I=o.jsxs(Bt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[N,R]}),e[46]=N,e[47]=R,e[48]=I):I=e[48];let D;return e[49]!==L||e[50]!==s||e[51]!==I?(D=o.jsx(zt,{open:s,onOpenChange:L,children:I}),e[49]=L,e[50]=s,e[51]=I,e[52]=D):D=e[52],D}function wfe(t){return t.type==="thread"}function Sfe(t){const e=F.c(43),{branch:s,onOutcome:n}=t,i=le();let r;e[0]!==n?(r=S=>{S||n("cancel")},e[0]=n,e[1]=r):r=e[1];let l;e[2]!==i?(l=i("sidebar.archiveWorktreeDialog.title"),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==l?(a=o.jsx(Jr,{children:l}),e[4]=l,e[5]=a):a=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 u;e[10]!==i?(u=i("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=i,e[11]=u):u=e[11];let h;e[12]!==c||e[13]!==d||e[14]!==u?(h=o.jsxs(Qr,{children:[c," ",d," ",u]}),e[12]=c,e[13]=d,e[14]=u,e[15]=h):h=e[15];let f;e[16]!==a||e[17]!==h?(f=o.jsxs(Yr,{children:[a,h]}),e[16]=a,e[17]=h,e[18]=f):f=e[18];let m;e[19]!==n?(m=()=>n("cancel"),e[19]=n,e[20]=m):m=e[20];let p;e[21]!==i?(p=i("sidebar.archiveWorktreeDialog.cancel"),e[21]=i,e[22]=p):p=e[22];let g;e[23]!==p||e[24]!==m?(g=o.jsx(Zr,{onClick:m,children:p}),e[23]=p,e[24]=m,e[25]=g):g=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=re(Wy({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 _;e[31]!==b||e[32]!==v?(_=o.jsx(eo,{className:x,onClick:b,children:v}),e[31]=b,e[32]=v,e[33]=_):_=e[33];let y;e[34]!==g||e[35]!==_?(y=o.jsxs(Xr,{children:[g,_]}),e[34]=g,e[35]=_,e[36]=y):y=e[36];let L;e[37]!==y||e[38]!==f?(L=o.jsxs(Gr,{children:[f,y]}),e[37]=y,e[38]=f,e[39]=L):L=e[39];let w;return e[40]!==r||e[41]!==L?(w=o.jsx(qr,{open:!0,onOpenChange:r,children:L}),e[40]=r,e[41]=L,e[42]=w):w=e[42],w}function kfe(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 jfe(t){return t==="ephemeral"||t.startsWith("thread:")}function eC(t){const e=F.c(45),{task:s,isActive:n,onClick:i,onArchive:r,showAutomationBadge:l,showAgentIcon:a,hideStatusIdle:c,indented:d}=t,u=le(),h=iV(s.status),f=h.icon,m=s.metadata?.kind==="tool_call_run",p=vs(m?void 0:s.virtual_mcp_id);let g;e[0]!==p?(g=io(p),e[0]=p,e[1]=g):g=e[1];const x=g;rV(6e4);const b=l||!!s.trigger_id,v=s.id,_="button",y=0;let L;e[2]!==i?(L=M=>{M.target===M.currentTarget&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),i())},e[2]=i,e[3]=L):L=e[3];const w=d?"-ml-4 pl-6":"pl-[7px]",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]!==m||e[8]!==a||e[9]!==p?.icon||e[10]!==p?.title?(j=a&&!m&&o.jsx(ur,{icon:p?.icon??null,name:p?.title??"?",size:"2xs"}),e[7]=m,e[8]=a,e[9]=p?.icon,e[10]=p?.title,e[11]=j):j=e[11];let C;e[12]!==b||e[13]!==u?(C=b&&o.jsx(hr,{size:12,"aria-label":u("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=b,e[13]=u,e[14]=C):C=e[14];let T;e[15]!==u||e[16]!==s.title?(T=s.title||u("tasksPanel.taskRow.untitledTask"),e[15]=u,e[16]=s.title,e[17]=T):T=e[17];let N;e[18]!==T?(N=o.jsx("div",{className:"text-sm text-foreground truncate",children:T}),e[18]=T,e[19]=N):N=e[19];let P;e[20]!==C||e[21]!==N?(P=o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[C,N]}),e[20]=C,e[21]=N,e[22]=P):P=e[22];let V;e[23]!==x||e[24]!==n||e[25]!==s.branch||e[26]!==s.updated_at?(V=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&&!jfe(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:ed(new Date(s.updated_at))})]}),e[23]=x,e[24]=n,e[25]=s.branch,e[26]=s.updated_at,e[27]=V):V=e[27];let E;e[28]!==P||e[29]!==V?(E=o.jsxs("div",{className:"flex-1 min-w-0",children:[P,V]}),e[28]=P,e[29]=V,e[30]=E):E=e[30];const R="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":u("tasksPanel.taskRow.statusLabel",{status:u(h.labelKey)}),children:s.status==="in_progress"?o.jsx(it,{className:re("size-3.5",h.iconClassName)}):o.jsx(f,{size:14,className:h.iconClassName})});let D;e[31]!==r||e[32]!==u?(D=r&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":u("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(Uy,{size:14})})}),o.jsx(We,{side:"right",children:u("tasksPanel.taskRow.archive")})]}),e[31]=r,e[32]=u,e[33]=D):D=e[33];let O;e[34]!==I||e[35]!==D?(O=o.jsxs("div",{className:R,children:[I,D]}),e[34]=I,e[35]=D,e[36]=O):O=e[36];let $;return e[37]!==i||e[38]!==E||e[39]!==O||e[40]!==L||e[41]!==k||e[42]!==j||e[43]!==s.id?($=o.jsxs("div",{"data-task-id":v,role:_,tabIndex:y,onClick:i,onKeyDown:L,className:k,children:[j,E,O]}),e[37]=i,e[38]=E,e[39]=O,e[40]=L,e[41]=k,e[42]=j,e[43]=s.id,e[44]=$):$=e[44],$}const py=["requires_action","in_progress","failed","expired","completed"];function Cfe(t){const e=new Map(py.map(s=>[s,[]]));for(const s of t){const n=s.status??"completed";(e.get(n)??e.get("completed")).push(s)}return py.map(s=>({status:s,threads:e.get(s)}))}const Nfe="sidebar.group.expanded.";function Vfe(t,e){const s=F.c(3),[n,i]=u2(`${Nfe}${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 tC(t){const e=F.c(18),{onClick:s,isFetching:n,indented:i}=t,r=le();let l;e[0]!==r?(l=r("sidebar.showMoreButton.ariaLabel"),e[0]=r,e[1]=l):l=e[1];const a=i?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==a?(c=re("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",a,"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]=a,e[3]=c):c=e[3];let d;e[4]!==n?(d=n&&o.jsx(it,{className:"size-3.5"}),e[4]=n,e[5]=d):d=e[5];let u;e[6]!==n||e[7]!==r?(u=r(n?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=n,e[7]=r,e[8]=u):u=e[8];let h;e[9]!==u?(h=o.jsx("span",{children:u}),e[9]=u,e[10]=h):h=e[10];let f;return e[11]!==n||e[12]!==s||e[13]!==l||e[14]!==c||e[15]!==d||e[16]!==h?(f=o.jsxs("button",{type:"button","aria-label":l,onClick:s,disabled:n,className:c,children:[d,h]}),e[11]=n,e[12]=s,e[13]=l,e[14]=c,e[15]=d,e[16]=h,e[17]=f):f=e[17],f}function Tfe(t,e,s,n){return[t,e,s,n.type,n.member,n.currentUserId??""].join("|")}function Afe(t){return t.member==="mine"&&!t.currentUserId}const sC=4;let Eh=0;const r2=[];function Pfe(){for(;Eh<sC&&r2.length>0;){const t=r2.shift();t&&t()}}function nC(t){return new Promise((e,s)=>{const n=()=>{Eh++,t().then(e,s).finally(()=>{Eh--,Pfe()})};Eh<sC?n():r2.push(n)})}const U9=10;function gy(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 l={where:r,limit:i,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return l.status=e,l}function Efe(t,e,s,n){let i=0;for(const r of t)iC(r,e,s,n)&&i++;return i}function lm(t,e,s,n){return Efe(t,e,s,n)}function Rfe(t,e){return!!(t>=U9||t===0&&e)}function xy(t,e){return t<e}function Dfe(t,e){return e===!1?!1:e===!0?!0:t}function iC(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 Pf=new Map,bh=new Map;function Ife(t,e){return e?t>=U9?!0:null:!1}function by(t){return Pf.get(t)}function Mfe(t,e){Pf.set(t,e)}function Ofe(t,e,s){const n=Pf.get(t);if(n!==void 0){s(n);return}let i=bh.get(t);i||(i=nC(e).then(r=>(Pf.set(t,r),bh.delete(t),r)).catch(()=>(bh.delete(t),Promise.reject(new Error("group probe failed")))),bh.set(t,i)),i.then(s,()=>s(!1))}function vy(t){const e=t,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===U9,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function $fe(t,e,s,n,i){let r=0;for(const l of t)e.has(l.id)||iC(l,s,n,i)&&r++;return r}function Bfe(t,e,s,n){const i=F.c(8),{org:r}=He(),l=Tfe(r.id,t,e,s);let a;i[0]!==s?(a=Afe(s),i[0]=s,i[1]=a):a=i[1];const c=a,[d,u]=A.useState({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==l&&u({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:null,serverHasMore:null});const h=Bf(),{threads:f,hasMore:m}=_2(),p=lm(f,t,e,s),g=Rfe(p,m),x=Ife(p,m),b=Vs();if(d.identity===l&&d.serverHasMore===null){const S=x??by(l);S!==void 0&&u({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:S})}!c&&d.identity===l&&d.serverHasMore===null&&x===null&&by(l)===void 0&&d.probeSubscribedIdentity!==l&&(u(S=>S.identity===l?{...S,isProbing:!0,probeSubscribedIdentity:l}:S),Ofe(l,async()=>{const S=gy(t,e,0,s,1),k=await b.call("COLLECTION_THREADS_LIST",S),{totalCount:j}=vy(k),C=lm(h.threads.get(),t,e,s);return j===void 0?!1:xy(C,j)},S=>{u(k=>k.identity!==l?k:{...k,isProbing:!1,serverHasMore:S})}));const _=async function(){if(d.isFetching||d.isProbing||c)return;const k=l;u(j=>j.identity===k?{...j,isFetching:!0}:j);try{const j=lm(f,t,e,s),C=gy(t,e,j,s,U9),T=await nC(()=>b.call("COLLECTION_THREADS_LIST",C)),{items:N,hasMore:P,totalCount:V}=vy(T),E=new Set(f.map(zfe)),R=$fe(N,E,t,e,s),I=j;h.mergeThreads(N),u(D=>{if(D.identity!==k)return D;let O;return V!==void 0?O=xy(I+R,V):O=N.length===0||R===0?!1:P,Mfe(k,O),{...D,isFetching:!1,serverHasMore:O}})}catch(j){const C=j,T=C instanceof Error?C.message:String(C);ve.error(`Could not load more tasks: ${T}`),u(N=>N.identity===k?{...N,isFetching:!1}:N)}},y=d.isFetching||d.isProbing,L=!c&&!y&&Dfe(g,d.serverHasMore);let w;return i[2]!==y||i[3]!==_||i[4]!==L||i[5]!==d.isProbing||i[6]!==d.serverHasMore?(w={hasMore:L,isFetching:y,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:_},i[2]=y,i[3]=_,i[4]=L,i[5]=d.isProbing,i[6]=d.serverHasMore,i[7]=w):w=i[7],w}function zfe(t){return t.id}function Ffe(t){const e=F.c(20),{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:l,canArchive:a,filters:c}=t,{isFetching:d,isProbing:u,loadMore:h,hasMore:f,serverHasMore:m}=Bfe("status",s,c),[p,g]=A.useState(!1);!p&&n.length===0&&m===!0&&!d&&!u&&(g(!0),queueMicrotask(()=>{h()}));let x;if(e[0]!==i||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==r||e[5]!==n){let _;e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r?(_=y=>o.jsx(eC,{task:y,isActive:i===y.id,onClick:()=>r(y),onArchive:a&&y.created_by===c.currentUserId?()=>l(y):void 0,showAutomationBadge:!!y.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},y.id),e[7]=i,e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=_):_=e[12],x=n.map(_),e[0]=i,e[1]=a,e[2]=c,e[3]=l,e[4]=r,e[5]=n,e[6]=x}else x=e[6];let b;e[13]!==f||e[14]!==d||e[15]!==h?(b=(f||d)&&o.jsx(tC,{onClick:()=>{h()},isFetching:d,indented:!0}),e[13]=f,e[14]=d,e[15]=h,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 Ufe(t){const e=F.c(39),{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:l,canArchive:a,filters:c}=t,d=le(),u=oV[s],h=u.icon,[f,m]=Vfe(`status-${s}`,!1);let p;e[0]!==f||e[1]!==m?(p=function(){m(!f)},e[0]=f,e[1]=m,e[2]=p):p=e[2];const g=p;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]!==h||e[6]!==u.iconClassName?(b=o.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:o.jsx(h,{size:12,className:u.iconClassName})}),e[5]=h,e[6]=u.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(bs,{size:14}):o.jsx(Ws,{size:14})}),e[8]=f,e[9]=v):v=e[9];let _;e[10]!==b||e[11]!==v?(_=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]=_):_=e[12];let y;e[13]!==u.labelKey||e[14]!==d?(y=d(u.labelKey),e[13]=u.labelKey,e[14]=d,e[15]=y):y=e[15];let L;e[16]!==y?(L=o.jsx("span",{className:"flex-1 truncate",children:y}),e[16]=y,e[17]=L):L=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]!==_||e[24]!==L||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,w]}),e[20]=f,e[21]=g,e[22]=x,e[23]=_,e[24]=L,e[25]=w,e[26]=S):S=e[26];let k;e[27]!==i||e[28]!==a||e[29]!==f||e[30]!==c||e[31]!==l||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(Ffe,{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:l,canArchive:a,filters:c})}),e[27]=i,e[28]=a,e[29]=f,e[30]=c,e[31]=l,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 Hfe(t){const e=F.c(38),{threads:s,groupBy:n,activeTaskId:i,onSelectTask:r,onArchiveTask:l,filters:a,hasMore:c,isFetchingMore:d,onLoadMore:u,filtersActive:h}=t;if(s.length===0&&!c&&!d){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(yT,{className:"size-6 opacity-60"}),e[0]=x):x=e[0];const b=h?"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]!==a||e[6]!==l||e[7]!==r||e[8]!==s){let v;e[10]!==i||e[11]!==f||e[12]!==a||e[13]!==l||e[14]!==r?(v=_=>o.jsx(Ufe,{status:_.status,threads:_.threads,activeTaskId:i,onSelectTask:r,onArchiveTask:l,canArchive:f,filters:a},_.status),e[10]=i,e[11]=f,e[12]=a,e[13]=l,e[14]=r,e[15]=v):v=e[15],x=Cfe(s).map(v),e[3]=i,e[4]=f,e[5]=a,e[6]=l,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 m;if(e[18]!==i||e[19]!==f||e[20]!==a||e[21]!==l||e[22]!==r||e[23]!==s){let x;e[25]!==i||e[26]!==f||e[27]!==a||e[28]!==l||e[29]!==r?(x=b=>o.jsx(eC,{task:b,isActive:i===b.id,onClick:()=>r(b),onArchive:f&&b.created_by===a.currentUserId?()=>l(b):void 0,showAutomationBadge:!!b.trigger_id,showAgentIcon:!0},b.id),e[25]=i,e[26]=f,e[27]=a,e[28]=l,e[29]=r,e[30]=x):x=e[30],m=s.map(x),e[18]=i,e[19]=f,e[20]=a,e[21]=l,e[22]=r,e[23]=s,e[24]=m}else m=e[24];let p;e[31]!==c||e[32]!==d||e[33]!==u?(p=(c||d)&&o.jsx(tC,{onClick:u,isFetching:d}),e[31]=c,e[32]=d,e[33]=u,e[34]=p):p=e[34];let g;return e[35]!==m||e[36]!==p?(g=o.jsxs(o.Fragment,{children:[m,p]}),e[35]=m,e[36]=p,e[37]=g):g=e[37],g}function Kfe(t,e){return null}function Wfe(t,e){return t.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const qfe=["archive","reclaim-worktree"],Gfe=[];function Yfe(t){return t==="confirm"?qfe:Gfe}function Jfe(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(Hfe,{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 Qfe(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=le(),{data:r}=vn.useSession(),l=r?.user?.id,{org:a}=He();let c;e[2]!==a.id?(c=Xl(a.id),e[2]=a.id,e[3]=c):c=e[3];const d=c.id,u=KT(),{threads:h,hasMore:f,isFetchingMore:m,fetchNextPage:p}=_2(),g=h.filter(t9e),{hide:x,setScope:b}=$u(),v=rn(),_=Vs(),{setTaskId:y,createNewTask:L}=Zl(),w=jV(),S=zf();let k;e[4]!==S||e[5]!==h||e[6]!==w?(k=CV({routeAgentId:w,threadVirtualMcpId:h.find(xe=>xe.id===S)?.virtual_mcp_id}),e[4]=S,e[5]=h,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 T=C,N=[...g].sort(e9e),[P,V]=A.useState("all"),[E,R]=A.useState("flat"),[I,D]=u2("sidebar-threads-scope-all",!1),[O,$]=A.useState(!1),[M,z]=A.useState(!1);let B;e[10]!==$?(B=()=>{Ge("tasks_panel_search_opened"),z(!0),$(!0)},e[10]=$,e[11]=B):B=e[11];const U=B,[H,W]=A.useState(null),K=l??null;let Q;e[12]!==K||e[13]!==P?(Q={type:P,member:"mine",currentUserId:K},e[12]=K,e[13]=P,e[14]=Q):Q=e[14];const X=Q,se={};I||(se.created_by="me"),b(se);let ne;e[15]!==l?(ne=xe=>l?xe.filter(Se=>Se.created_by===l):[],e[15]=l,e[16]=ne):ne=e[16];const te=ne;let ee;e[17]!==P?(ee=xe=>P==="automation"?xe.filter(Zfe):P==="manual"?xe.filter(Xfe):xe,e[17]=P,e[18]=ee):ee=e[18];const Y=ee,q=vfe(Y(I?N:te(N)),S);let oe;e[19]!==S||e[20]!==T||e[21]!==l||e[22]!==x||e[23]!==v||e[24]!==a.slug||e[25]!==y||e[26]!==q?(oe=xe=>{const Se=xe.id===S,Ce=x(xe.id);if(_V(xe.id),!Se)return Ce;const Ae=kfe(q,xe.id,l);return T(),Ae?y(Ae.id,Ae.virtual_mcp_id):v({to:"/$org",params:{org:a.slug}}),Ce},e[19]=S,e[20]=T,e[21]=l,e[22]=x,e[23]=v,e[24]=a.slug,e[25]=y,e[26]=q,e[27]=oe):oe=e[27];const J=oe;let ie;e[28]!==_||e[29]!==i?(ie=async xe=>{try{await _.call("SANDBOX_DELETE",{virtualMcpId:xe.virtualMcpId,branch:xe.branch,removeWorktree:!0})}catch{ve.error(i("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:xe.branch}))}},e[28]=_,e[29]=i,e[30]=ie):ie=e[30];const Z=ie;let he;e[31]!==h||e[32]!==J||e[33]!==l||e[34]!==W?(he=xe=>{if(l&&xe.created_by&&xe.created_by!==l)return;const Se=Kfe();if(!Se||Wfe(h,Se)){J(xe);return}W({task:xe,target:Se})},e[31]=h,e[32]=J,e[33]=l,e[34]=W,e[35]=he):he=e[35];const de=he;let ae;e[36]!==J||e[37]!==H||e[38]!==Z||e[39]!==W?(ae=xe=>{const Se=H;Se&&(W(null),(async()=>{for(const Ce of Yfe(xe))if(Ce==="archive")try{await J(Se.task)}catch{return}else await Z(Se.target)})())},e[36]=J,e[37]=H,e[38]=Z,e[39]=W,e[40]=ae):ae=e[40];const ce=ae;let ue;e[41]!==T||e[42]!==y?(ue=xe=>{T(),y(xe.id,xe.virtual_mcp_id)},e[41]=T,e[42]=y,e[43]=ue):ue=e[43];const G=ue;let me;e[44]!==j||e[45]!==S||e[46]!==h||e[47]!==T||e[48]!==L||e[49]!==l||e[50]!==d||e[51]!==u||e[52]!==y?(me=()=>{const xe=j??d;Ge("sidebar_new_thread_clicked",{virtual_mcp_id:xe}),T();const Se=gA(h,xe,l,u(xe));if(Se){y(Se.id,Se.virtual_mcp_id);return}const Ce=h.find(Ae=>Ae.id===S)?.branch??null;L(xe,Ce)},e[44]=j,e[45]=S,e[46]=h,e[47]=T,e[48]=L,e[49]=l,e[50]=d,e[51]=u,e[52]=y,e[53]=me):me=e[53];const ye=me;let we;e[54]!==p?(we=()=>{p()},e[54]=p,e[55]=we):we=e[55];const Ne=E!=="flat"||P!=="all"||I;let je;e[56]!==ce||e[57]!==H?(je=H?o.jsx(Sfe,{branch:H.target.branch,onOutcome:ce}):null,e[56]=ce,e[57]=H,e[58]=je):je=e[58];let _e;e[59]!==M||e[60]!==O||e[61]!==$?(_e=M?o.jsx(Lfe,{open:O,onOpenChange:$}):null,e[59]=M,e[60]=O,e[61]=$,e[62]=_e):_e=e[62];let Ve;return e[63]!==S||e[64]!==de||e[65]!==X||e[66]!==E||e[67]!==f||e[68]!==m||e[69]!==ye||e[70]!==U||e[71]!==G||e[72]!==R||e[73]!==D||e[74]!==V||e[75]!==I||e[76]!==we||e[77]!==Ne||e[78]!==je||e[79]!==_e||e[80]!==P||e[81]!==q?(Ve={threads:q,activeTaskId:S,filters:X,hasMore:f,isFetchingMore:m,loadMore:we,groupBy:E,setGroupBy:R,typeFilter:P,setTypeFilter:V,showAll:I,setShowAll:D,filtersActive:Ne,selectTask:G,archiveTask:de,newThread:ye,openSearch:U,reclaimDialog:je,searchDialog:_e},e[63]=S,e[64]=de,e[65]=X,e[66]=E,e[67]=f,e[68]=m,e[69]=ye,e[70]=U,e[71]=G,e[72]=R,e[73]=D,e[74]=V,e[75]=I,e[76]=we,e[77]=Ne,e[78]=je,e[79]=_e,e[80]=P,e[81]=q,e[82]=Ve):Ve=e[82],Ve}function Xfe(t){return!t.trigger_id}function Zfe(t){return!!t.trigger_id}function e9e(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function t9e(t){return!t.hidden}function s9e(){const t=F.c(60),e=le(),[s,n]=A.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={onNavigate:()=>n(!1)},t[0]=i):i=t[0];const r=Qfe(i),l=hs()?.activeTask;let a;t[1]!==l?.title||t[2]!==r.activeTaskId||t[3]!==r.threads||t[4]!==e?(a=l?.title||r.threads.find(D=>D.id===r.activeTaskId)?.title||e("tasksPanel.taskRow.untitledTask"),t[1]=l?.title,t[2]=r.activeTaskId,t[3]=r.threads,t[4]=e,t[5]=a):a=t[5];const c=a;let d;t[6]!==r?(d=()=>{n(!1),r.openSearch()},t[6]=r,t[7]=d):d=t[7];const u=d;let h;t[8]!==e?(h=e("chat.threadsMenu.chats"),t[8]=e,t[9]=h):h=t[9];const f=s&&"bg-sidebar-accent";let m;t[10]!==f?(m=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]=m):m=t[11];let p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(_T,{size:16,className:"shrink-0"}),t[12]=p):p=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(bs,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[15]=x):x=t[15];let b;t[16]!==h||t[17]!==m||t[18]!==g?(b=o.jsx(Ke,{asChild:!0,children:o.jsx(os,{asChild:!0,children:o.jsxs("button",{type:"button","aria-label":h,className:m,children:[p,g,x]})})}),t[16]=h,t[17]=m,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 _;t[22]!==v?(_=o.jsx(We,{side:"bottom",children:v}),t[22]=v,t[23]=_):_=t[23];let y;t[24]!==_||t[25]!==b?(y=o.jsxs(qe,{children:[b,_]}),t[24]=_,t[25]=b,t[26]=y):y=t[26];let L;t[27]!==r?(L=o.jsx(bfe,{panel:r,className:"size-8 rounded-lg"}),t[27]=r,t[28]=L):L=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(P2,{size:16}),t[31]=S):S=t[31];let k;t[32]!==u||t[33]!==w?(k=o.jsx(Mr,{"aria-label":w,onClick:u,className:"size-8 rounded-lg",children:S}),t[32]=u,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(Kf,{size:16}),t[37]=C):C=t[37];let T;t[38]!==r.newThread||t[39]!==j?(T=o.jsx(Mr,{"aria-label":j,onClick:r.newThread,className:"size-8 rounded-lg",children:C}),t[38]=r.newThread,t[39]=j,t[40]=T):T=t[40];let N;t[41]!==k||t[42]!==T?(N=o.jsxs("div",{className:"flex items-center gap-0.5",children:[k,T]}),t[41]=k,t[42]=T,t[43]=N):N=t[43];let P;t[44]!==L||t[45]!==N?(P=o.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[L,N]}),t[44]=L,t[45]=N,t[46]=P):P=t[46];let V;t[47]!==r?(V=o.jsx("div",{className:"flex max-h-[60vh] min-h-0 flex-col gap-0.5 overflow-y-auto overscroll-contain",children:o.jsx(Jfe,{panel:r})}),t[47]=r,t[48]=V):V=t[48];let E;t[49]!==P||t[50]!==V?(E=o.jsxs(as,{align:"start",side:"bottom",onOpenAutoFocus:n9e,className:"flex w-80 flex-col gap-2 p-2",children:[P,V]}),t[49]=P,t[50]=V,t[51]=E):E=t[51];let R;t[52]!==s||t[53]!==y||t[54]!==E?(R=o.jsxs(cs,{open:s,onOpenChange:n,children:[y,E]}),t[52]=s,t[53]=y,t[54]=E,t[55]=R):R=t[55];let I;return t[56]!==r.reclaimDialog||t[57]!==r.searchDialog||t[58]!==R?(I=o.jsxs(o.Fragment,{children:[R,r.searchDialog,r.reclaimDialog]}),t[56]=r.reclaimDialog,t[57]=r.searchDialog,t[58]=R,t[59]=I):I=t[59],I}function n9e(t){return t.preventDefault()}function rC(t){const e=F.c(4),{chatContent:s}=t;let n;e[0]!==s?(n=s??o.jsx(k7,{}),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 am(t){const e=F.c(20),{side:s,open:n,disabled:i,onToggle:r}=t,l=le();let a;e[0]!==n||e[1]!==s||e[2]!==l?(a=l(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]=l,e[3]=a):a=e[3];const c=a,d=s==="right"?LT:n?wT:ST;let u;e[4]!==r||e[5]!==n||e[6]!==s?(u=()=>{Ge("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]=u):u=e[7];let h;e[8]!==d?(h=o.jsx(d,{size:16}),e[8]=d,e[9]=h):h=e[9];let f;e[10]!==i||e[11]!==c||e[12]!==u||e[13]!==h?(f=o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{"aria-label":c,disabled:i,onClick:u,className:"size-7 rounded-md disabled:opacity-40",children:h})}),e[10]=i,e[11]=c,e[12]=u,e[13]=h,e[14]=f):f=e[14];let m;e[15]!==c?(m=o.jsx(We,{side:"bottom",children:c}),e[15]=c,e[16]=m):m=e[16];let p;return e[17]!==f||e[18]!==m?(p=o.jsxs(qe,{children:[f,m]}),e[17]=f,e[18]=m,e[19]=p):p=e[19],p}const cm="workspace-side-panel",yy="workspace-main-panel";function _y(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 l;e[1]!==s?(l=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s}),e[1]=s,e[2]=l):l=e[2];let a;return e[3]!==n||e[4]!==l||e[5]!==i?(a=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,l]})}),e[3]=n,e[4]=l,e[5]=i,e[6]=a):a=e[6],a}function i9e(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(A0e,{virtualMcpId:s,taskId:n,disableActiveMainToggle:i}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3],r}function r9e(t){const e=F.c(81),{virtualMcpId:s,taskId:n,entity:i,sidePanelOpen:r,mainOpen:l,toggleSidePanel:a,toggleMain:c,chatContent:d}=t,[u,h]=y$(),f=A.useRef(null);let m;e[0]!==l||e[1]!==r?(m=RO({sidePanelOpen:r,mainOpen:l}),e[0]=l,e[1]=r,e[2]=m):m=e[2];const p=m,g=r&&l?u:p.side,x=100-g;let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(WT,{}),e[3]=b):b=e[3];const v=b;let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(s9e,{}),e[4]=_):_=e[4];const y=_;let L;e[5]!==i?(L=o.jsx(Qhe,{virtualMcp:i}),e[5]=i,e[6]=L):L=e[6];const w=L,S=hs()?.currentBranch??null,k=qu();let j;e[7]!==k||e[8]!==S||e[9]!==i?(j=k&&L2(k)?o.jsx(gfe,{virtualMcp:i,currentBranch:S}):null,e[7]=k,e[8]=S,e[9]=i,e[10]=j):j=e[10];const C=j;let T,N;e[11]!==x||e[12]!==g?(T=()=>{f.current?.setLayout({[cm]:g,[yy]:x})},N=[g,x],e[11]=x,e[12]=g,e[13]=T,e[14]=N):(T=e[13],N=e[14]),A.useEffect(T,N);let P;e[15]!==l||e[16]!==r||e[17]!==c?(P=!l&&o.jsx(am,{side:"right",open:l,disabled:!r,onToggle:c}),e[15]=l,e[16]=r,e[17]=c,e[18]=P):P=e[18];let V;e[19]!==P?(V=o.jsxs(W5,{children:[y,o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[v,P]})]}),e[19]=P,e[20]=V):V=e[20];const E=V,R=!l;let I;e[21]!==r||e[22]!==R||e[23]!==a?(I=o.jsx(am,{side:"left",open:r,disabled:R,onToggle:a}),e[21]=r,e[22]=R,e[23]=a,e[24]=I):I=e[24];const D=!r;let O;e[25]!==D||e[26]!==n||e[27]!==s?(O=o.jsx(i9e,{virtualMcpId:s,taskId:n,disableActiveMainToggle:D}),e[25]=D,e[26]=n,e[27]=s,e[28]=O):O=e[28];let $;e[29]!==I||e[30]!==O?($=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]=$):$=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(vQ,{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];let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(yQ,{}),e[35]=B):B=e[35];const U=!r;let H;e[36]!==l||e[37]!==U||e[38]!==c?(H=o.jsx(am,{side:"right",open:l,disabled:U,onToggle:c}),e[36]=l,e[37]=U,e[38]=c,e[39]=H):H=e[39];let W;e[40]!==w||e[41]!==H?(W=o.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-1",children:[B,w,H]}),e[40]=w,e[41]=H,e[42]=W):W=e[42];let K;e[43]!==z||e[44]!==W?(K=o.jsxs("div",{className:"flex min-w-0 shrink items-center justify-end gap-1",children:[z,W]}),e[43]=z,e[44]=W,e[45]=K):K=e[45];let Q;e[46]!==$||e[47]!==K?(Q=o.jsxs(W5,{className:"justify-between gap-2",children:[$,M,K]}),e[46]=$,e[47]=K,e[48]=Q):Q=e[48];const X=Q,se=`${s}-${n}`;let ne,te;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=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[49]=ne,e[50]=te):(ne=e[49],te=e[50]);let ee;e[51]!==l||e[52]!==h||e[53]!==r?(ee=(we,Ne)=>{const{isUserInteraction:je}=Ne,_e=we[cm];je&&r&&l&&typeof _e=="number"&&_e>0&&_e<100&&h(_e)},e[51]=l,e[52]=h,e[53]=r,e[54]=ee):ee=e[54];const Y=`${p.side}%`,q=r?"":void 0,oe=r?E:null;let J;e[55]!==d||e[56]!==r?(J=r&&o.jsx(rC,{chatContent:d}),e[55]=d,e[56]=r,e[57]=J):J=e[57];let ie;e[58]!==oe||e[59]!==J?(ie=o.jsx(_y,{testId:"side-panel",header:oe,children:J}),e[58]=oe,e[59]=J,e[60]=ie):ie=e[60];let Z;e[61]!==Y||e[62]!==q||e[63]!==ie?(Z=o.jsx(yc,{id:cm,defaultSize:Y,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":q,className:"min-w-0 overflow-hidden bg-sidebar",children:ie}),e[61]=Y,e[62]=q,e[63]=ie,e[64]=Z):Z=e[64];let he;e[65]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx(Dm,{className:"bg-sidebar"}),e[65]=he):he=e[65];const de=`${p.main}%`,ae=l?"":void 0,ce=l?X:null;let ue;e[66]!==n||e[67]!==s?(ue=o.jsx(Vj,{taskId:n,virtualMcpId:s}),e[66]=n,e[67]=s,e[68]=ue):ue=e[68];let G;e[69]!==ce||e[70]!==ue?(G=o.jsx(_y,{testId:"main-panel",header:ce,children:ue}),e[69]=ce,e[70]=ue,e[71]=G):G=e[71];let me;e[72]!==de||e[73]!==ae||e[74]!==G?(me=o.jsx(yc,{id:yy,defaultSize:de,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":ae,className:"min-w-0 overflow-hidden bg-sidebar",children:G}),e[72]=de,e[73]=ae,e[74]=G,e[75]=me):me=e[75];let ye;return e[76]!==se||e[77]!==ee||e[78]!==Z||e[79]!==me?(ye=o.jsx(bQ,{children:o.jsxs(Rm,{ref:f,orientation:"horizontal",className:ne,style:te,onLayoutChanged:ee,children:[Z,he,me]},se)}),e[76]=se,e[77]=ee,e[78]=Z,e[79]=me,e[80]=ye):ye=e[80],ye}const dm="__mobile-main-panel-tab-select__";function o9e({tabs:t,activeTab:e,mainOpen:s,t:n}){const i=t.find(l=>l.id===e),r=n("mainPanelTabs.mobileMainPanelTabSelect.mainView");return s?i?.title??r:i?.title??t[0]?.title??r}const l9e={kind:"component",Component:E6},a9e={kind:"component",Component:V6},c9e={kind:"component",Component:Go};function d9e(t){const e=F.c(62),{virtualMcpId:s,taskId:n}=t,i=le(),r=rn(),{openPanel:l}=Di();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const c=il(a);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:u,activeTab:h,mainOpen:f}=Vg(d),{org:m}=He(),p=F6();let g;e[4]!==m.id?(g=Oh(m.id),e[4]=m.id,e[5]=g):g=e[5];const x=s===g,b=!!(c.org&&c.taskId);let v;e[6]!==i?(v=i("mainPanelTabs.mobileMainPanelTabSelect.chat"),e[6]=i,e[7]=v):v=e[7];let _;e[8]!==v?(_={value:"chat",title:v,icon:l9e},e[8]=v,e[9]=_):_=e[9];let y;if(e[10]!==b||e[11]!==i||e[12]!==_||e[13]!==u){let B,U;e[15]!==b||e[16]!==i?(B=b?[{value:"board",title:i("mainPanelTabs.mobileMainPanelTabSelect.tasks"),icon:a9e}]:[],U=b?[{value:"files",title:i("mainPanelTabs.mobileMainPanelTabSelect.library"),icon:c9e}]:[],e[15]=b,e[16]=i,e[17]=B,e[18]=U):(B=e[17],U=e[18]),y=[_,...u.map(p9e),...B,...U],e[10]=b,e[11]=i,e[12]=_,e[13]=u,e[14]=y}else y=e[14];const L=y;let w;e[19]!==h||e[20]!==f||e[21]!==L?(w=f?L.find(B=>B.value===h)?.value??h:"chat",e[19]=h,e[20]=f,e[21]=L,e[22]=w):w=e[22];const S=w;let k;e[23]!==S||e[24]!==L?(k=L.find(B=>B.value===S),e[23]=S,e[24]=L,e[25]=k):k=e[25];const j=k;let C;e[26]!==h||e[27]!==f||e[28]!==j?.title||e[29]!==i||e[30]!==u?(C=j?.title??o9e({tabs:u,activeTab:h,mainOpen:f,t:i}),e[26]=h,e[27]=f,e[28]=j?.title,e[29]=i,e[30]=u,e[31]=C):C=e[31];const T=C;let N;e[32]!==r||e[33]!==x||e[34]!==l||e[35]!==m.id||e[36]!==p||e[37]!==s?(N=B=>{if(B!==dm){if(Ge("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:B,source:"mobile_select"}),c6({reportsOnly:p,onReportAgent:x,tabId:B})){l(B,{virtualmcpid:Oh(m.id),search:m9e});return}if(B==="chat"){r({to:".",search:f9e,replace:!0});return}l(B,{search:h9e})}},e[32]=r,e[33]=x,e[34]=l,e[35]=m.id,e[36]=p,e[37]=s,e[38]=N):N=e[38];const P=N;let V;e[39]!==i?(V=i("mainPanelTabs.mobileMainPanelTabSelect.view"),e[39]=i,e[40]=V):V=e[40];let E;e[41]!==j?(E=j&&o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:o.jsx(ux,{icon:j.icon,className:"size-5"})}),e[41]=j,e[42]=E):E=e[42];let R;e[43]!==T?(R=o.jsx("span",{className:"min-w-0 truncate",children:T}),e[43]=T,e[44]=R):R=e[44];let I;e[45]!==E||e[46]!==R?(I=o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[E,R]}),e[45]=E,e[46]=R,e[47]=I):I=e[47];let D;e[48]!==V||e[49]!==I?(D=o.jsx(Ss,{"aria-label":V,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:I}),e[48]=V,e[49]=I,e[50]=D):D=e[50];let O;e[51]!==T?(O=o.jsx(It,{value:dm,disabled:!0,hideCheck:!0,className:"hidden",children:T}),e[51]=T,e[52]=O):O=e[52];let $;e[53]!==L?($=L.map(u9e),e[53]=L,e[54]=$):$=e[54];let M;e[55]!==O||e[56]!==$?(M=o.jsxs(ks,{align:"end",className:"w-56",children:[O,$]}),e[55]=O,e[56]=$,e[57]=M):M=e[57];let z;return e[58]!==P||e[59]!==D||e[60]!==M?(z=o.jsxs(ws,{value:dm,onValueChange:P,children:[D,M]}),e[58]=P,e[59]=D,e[60]=M,e[61]=z):z=e[61],z}function u9e(t){return o.jsx(It,{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(ux,{icon:t.icon})}),o.jsx("span",{className:"min-w-0 truncate",children:t.title})]})},t.value)}function h9e(t){return{...t,sidepanel:!1}}function f9e(t){return{...t,...IO()}}function m9e(t){return{...t,thread:void 0,sidepanel:!1}}function p9e(t){return{value:t.id,title:t.title,icon:t.icon}}function g9e(t,e){const s=F.c(35),n=Bf(),{locator:i}=He(),r=A.useSyncExternalStore(n.threads.subscribe,n.threads.get),l=A.useSyncExternalStore(n.threadsStatus.subscribe,n.threadsStatus.get);let a;s[0]!==t||s[1]!==r?(a=t===null?null:r.find(y=>y.id===t&&!y.partial)??null,s[0]=t,s[1]=r,s[2]=a):a=s[2];const c=a,[d,u]=A.useState(void 0);let h;s[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{u(void 0)},s[3]=h):h=s[3];let f;s[4]!==t?(f=[t],s[4]=t,s[5]=f):f=s[5],A.useEffect(h,f);let m,p;s[6]!==d||s[7]!==t||s[8]!==c||s[9]!==n||s[10]!==l.kind?(m=()=>{t!==null&&(c||l.kind!=="loading"&&d===void 0&&(u("pending"),n.fetchThreadIntoSlot(t).then(y=>{u(y)})))},p=[t,c,l.kind,d,n],s[6]=d,s[7]=t,s[8]=c,s[9]=n,s[10]=l.kind,s[11]=m,s[12]=p):(m=s[11],p=s[12]),A.useEffect(m,p);let g;s[13]!==i||s[14]!==n||s[15]!==e?(g={mutationFn:async y=>n.create({id:y,virtual_mcp_id:e,...PV(sessionStorage,i,y)})},s[13]=i,s[14]=n,s[15]=e,s[16]=g):g=s[16];const x=Es(g);let b,v;if(s[17]!==x||s[18]!==d||s[19]!==t||s[20]!==c||s[21]!==l.kind?(b=()=>{t!==null&&(c||d===null&&l.kind!=="loading"&&(x.isPending||x.variables!==t&&x.mutate(t)))},v=[t,c,d,l.kind,x],s[17]=x,s[18]=d,s[19]=t,s[20]=c,s[21]=l.kind,s[22]=b,s[23]=v):(b=s[22],v=s[23]),A.useEffect(b,v),t===null){let y;return s[24]===Symbol.for("react.memo_cache_sentinel")?(y={status:"ready",task:null},s[24]=y):y=s[24],y}if(c){let y;return s[25]!==c?(y={status:"ready",task:c},s[25]=c,s[26]=y):y=s[26],y}if(d&&typeof d=="object"){let y;return s[27]!==d?(y={status:"ready",task:d},s[27]=d,s[28]=y):y=s[28],y}if(x.data){let y;return s[29]!==x.data?(y={status:"ready",task:x.data},s[29]=x.data,s[30]=y):y=s[30],y}if(x.isError){let y;return s[31]!==x.error?(y={status:"error",error:x.error},s[31]=x.error,s[32]=y):y=s[32],y}if(x.isPending||l.kind!=="loading"){let y;return s[33]===Symbol.for("react.memo_cache_sentinel")?(y={status:"creating"},s[33]=y):y=s[33],y}let _;return s[34]===Symbol.for("react.memo_cache_sentinel")?(_={status:"loading"},s[34]=_):_=s[34],_}function x9e(){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=il(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[1]=n):n=t[1];const i=nl(n),r=s.org;if(!r||s.taskId!==void 0)return null;let l;t[2]!==s.panel||t[3]!==i.main?(l=ZC(i.main,s.panel),t[2]=s.panel,t[3]=i.main,t[4]=l):l=t[4];const a=l;if(!a)return null;if(a.to===null){let h;return t[5]!==a.search?(h=o.jsx(ni,{to:".",search:f=>({...f,...a.search}),replace:!0}),t[5]=a.search,t[6]=h):h=t[6],h}if(a.to==="/$org/agents/{-$panel}"){let h;t[7]!==r||t[8]!==a.panel?(h={org:r,panel:a.panel},t[7]=r,t[8]=a.panel,t[9]=h):h=t[9];let f;t[10]!==a.search?(f=p=>({...p,...a.search}),t[10]=a.search,t[11]=f):f=t[11];let m;return t[12]!==h||t[13]!==f?(m=o.jsx(ni,{to:"/$org/agents/{-$panel}",params:h,search:f,replace:!0}),t[12]=h,t[13]=f,t[14]=m):m=t[14],m}if(a.to==="/$org/tasks/{-$taskKey}"){let h;t[15]!==r||t[16]!==s.taskKey?(h={org:r,taskKey:s.taskKey},t[15]=r,t[16]=s.taskKey,t[17]=h):h=t[17];let f;t[18]!==a.search?(f=p=>({...p,...a.search}),t[18]=a.search,t[19]=f):f=t[19];let m;return t[20]!==h||t[21]!==f?(m=o.jsx(ni,{to:"/$org/tasks/{-$taskKey}",params:h,search:f,replace:!0}),t[20]=h,t[21]=f,t[22]=m):m=t[22],m}let c;t[23]!==r?(c={org:r},t[23]=r,t[24]=c):c=t[24];let d;t[25]!==a.search?(d=h=>({...h,...a.search}),t[25]=a.search,t[26]=d):d=t[26];let u;return t[27]!==c||t[28]!==d||t[29]!==a.to?(u=o.jsx(ni,{to:a.to,params:c,search:d,replace:!0}),t[27]=c,t[28]=d,t[29]=a.to,t[30]=u):u=t[30],u}function b9e(){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=il(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[1]=n):n=t[1];const i=nl(n),{org:r,taskId:l}=s;if(!r||l===void 0)return null;let a;return t[2]!==r||t[3]!==i||t[4]!==l?(a=eN({org:r,taskId:l,search:i}),t[2]=r,t[3]=i,t[4]=l,t[5]=a):a=t[5],a}function v9e(){const t=F.c(29),e=b9e();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 l;return t[6]!==i||t[7]!==r?(l=o.jsx(ni,{to:"/$org/agents/{-$panel}",params:i,search:r,replace:!0}),t[6]=i,t[7]=r,t[8]=l):l=t[8],l}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(ni,{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(ni,{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(ni,{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(ni,{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 y9e(){const t=F.c(6),e=Yl(),s=rn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const{preview:i}=nl(n);if(!e||!i)return null;let r;t[1]!==s?(r=()=>s({to:".",search:_9e}),t[1]=s,t[2]=r):r=t[2];let l;return t[3]!==i||t[4]!==r?(l=o.jsx(Rk,{previewPath:i,onClose:r,showSeeInLibrary:!0}),t[3]=i,t[4]=r,t[5]=l):l=t[5],l}function _9e(t){const{preview:e,...s}=t;return s}const L9e=A.createContext(null);function oC(){return A.useContext(L9e)}const bc=A.createContext(null);function ao(){return A.use(bc)}function lC(t){const e=F.c(13),{children:s}=t,n=le(),i=Wu(),r=oC(),l=zf()!==null;let a;e[0]!==l||e[1]!==i||e[2]!==r?(a=o.jsx(k7,{}),e[0]=l,e[1]=i,e[2]=r,e[3]=a):a=e[3];const c=a;let d;e[4]!==n?(d=n("agentShellLayout.agentShellLayout.chatLoadingError"),e[4]=n,e[5]=d):d=e[5];let u;e[6]!==d?(u=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]=u):u=e[7];const h=s??c;let f;e[8]!==h?(f=o.jsx(wi,{children:h}),e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==u||e[11]!==f?(m=o.jsx(sn,{fallback:u,children:f}),e[10]=u,e[11]=f,e[12]=m):m=e[12],m}function Ly(t){const e=F.c(13),{threadId:s,children:n}=t;if(le(),oC(),s===null){let r;return e[0]!==n?(r=o.jsx(an.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(an.ActiveTaskProvider,{taskId:s,children:n}),e[10]=n,e[11]=s,e[12]=i):i=e[12],i}function aC(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],A.useLayoutEffect(i),null}function wy({virtualMcpId:t,hasActiveGithubRepo:e,sandboxMap:s,children:n}){const i=le(),{currentBranch:r,activeTask:l,setCurrentTaskBranch:a}=on(),c=Wu(),d="agent-sandbox",{data:u}=vn.useSession(),h=u?.user?.id,f=!Gy({isDesktopApp:c,harnessId:l?.harness_id}),m=I$({agentSandboxMap:s,threadSandboxMap:l?.metadata?.sandboxMap,userId:h,ownerId:l?.created_by,branch:r}),p=e||jn(l?.metadata),g=A.useRef(null),x=f&&R$({threadLoaded:!!l,isOwner:!!h&&l?.created_by===h,hasActiveGithubRepo:p,branch:r??null,attempted:g.current===(l?.id??null)});A.useEffect(()=>{!x||!l||(g.current=l.id,a(Dl(u?.user?.name||u?.user?.email?.split("@")[0])))},[x,l,u,a]);const{org:b}=He(),v=Jf("cms_auto_fresh_branch"),_=yn(t),y=A.useRef(null),L=v&&_.resolved&&_.runtime==="cms"&&!!b?.slug&&!!r&&y.current!==(l?.id??null),S=Mt({...XM({orgSlug:b?.slug??"",virtualMcpId:t,branch:r??""}),enabled:L}).data?.lastCommitAt??null;A.useEffect(()=>{!L||!l||JM(S,Date.now())&&(y.current=l.id,a(Dl(u?.user?.name||u?.user?.email?.split("@")[0])))},[L,S,l,u,a]);const k=_.resolved?_.runtime:null,j=VO(t,r??void 0),T=(h&&r?ZP(m?.[h]?.[r]):{})[d]??null,N=T?.previewUrl??null,P=f&&k!=="cms"&&(!!T||j);return f?k==="cms"?o.jsx(cb,{children:n},`${t}:${r??"no-branch"}:${l?.id??""}`):o.jsx(V$,{virtualMcpId:t,branch:r??null,previewUrl:N,enabled:P,children:o.jsx(K$,{executionEnabled:f,virtualMcpId:t,branch:r??null,userId:h??null,hasActiveGithubRepo:p,vmEntry:T,threadId:l?.id??null,children:o.jsx(cb,{children:n},`${t}:${r??"no-branch"}:${l?.id??""}`)})},l?.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(Ci,{image:o.jsx(Vn,{size:48,className:"text-muted-foreground"}),title:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWeb"),description:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWebDescription")})})})}function w9e(t){const e=F.c(15),{entity:s,virtualMcpId:n,layout:i,onNewTaskRef:r}=t;let l;e[0]!==i.createNewTask||e[1]!==r?(l=o.jsx(aC,{onNewTaskRef:r,createNewTask:i.createNewTask}),e[0]=i.createNewTask,e[1]=r,e[2]=l):l=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(lC,{}),e[3]=a):a=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(wi,{children:o.jsx(r9e,{virtualMcpId:n,taskId:i.threadId,entity:s,sidePanelOpen:i.sidePanelOpen,mainOpen:i.mainOpen,toggleSidePanel:i.toggleSidePanel,toggleMain:i.toggleMain,chatContent:a})}),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]!==l||e[13]!==c?(d=o.jsxs(o.Fragment,{children:[l,c]}),e[12]=l,e[13]=c,e[14]=d):d=e[14],d}function S9e(t){const e=F.c(19),{virtualMcpId:s,layout:n,onNewTaskRef:i}=t,r=le();let l;e[0]!==n.mainOpen||e[1]!==n.sidePanelOpen||e[2]!==n.sidePanelParamPresent?(l=DO({visibility:{sidePanelOpen:n.sidePanelOpen,mainOpen:n.mainOpen},sidePanelParamPresent:n.sidePanelParamPresent}),e[0]=n.mainOpen,e[1]=n.sidePanelOpen,e[2]=n.sidePanelParamPresent,e[3]=l):l=e[3];const a=l;let c;e[4]!==n.threadId||e[5]!==s?(c=o.jsx(vA.Tabs,{children:o.jsx(d9e,{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(aC,{onNewTaskRef:i,createNewTask:n.createNewTask}),e[7]=n.createNewTask,e[8]=i,e[9]=d):d=e[9];let u;e[10]!==n.threadId||e[11]!==a||e[12]!==r||e[13]!==s?(u=o.jsx(wi,{children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:a==="main"?o.jsx(sn,{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(wi,{children:o.jsx("div",{"data-testid":"main-panel",className:"h-full",children:o.jsx(Vj,{taskId:n.threadId,virtualMcpId:s})})})}):o.jsx(rC,{chatContent:o.jsx(lC,{})})})}),e[10]=n.threadId,e[11]=a,e[12]=r,e[13]=s,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==d||e[17]!==u?(h=o.jsxs(o.Fragment,{children:[c,d,u]}),e[15]=c,e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function k9e(){const t=F.c(101),e=le(),s=Yl(),n=rn(),{org:i}=He();bA(i.slug);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const a=il(r).org??"",c=zf(),d=NV(),[u]=A.useState(j9e),{data:h}=vn.useSession(),f=Bf(),m=A.useSyncExternalStore(f.threads.subscribe,f.threads.get),p=g9e(c,d);OO(p.status==="ready"?p.task:null);const g=vs(d),x=g?.metadata?.ui?.layout??null;let b;t[1]!==x?(b=x?{defaultMainView:x.defaultMainView??null,chatDefaultOpen:x.chatDefaultOpen??null}:null,t[1]=x,t[2]=b):b=t[2];const v=b;let _;t[3]!==g?(_=g&&io(g),t[3]=g,t[4]=_):_=t[4];const y=!!_;let L;t[5]!==d?(L={virtualMcpId:d,isAgentRoute:!0},t[5]=d,t[6]=L):L=t[6];const w=MO(v,L),S=A.useRef(null);let k,j;if(t[7]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{const $=M=>{a6(M)&&M.shiftKey&&M.code==="KeyS"&&!M.repeat&&(M.preventDefault(),S.current?.())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},j=[],t[7]=k,t[8]=j):(k=t[7],j=t[8]),A.useEffect(k,j),c===null&&y){let $;t[9]!==g.metadata||t[10]!==u||t[11]!==y||t[12]!==h?.user?.id||t[13]!==m||t[14]!==d?($=xA(m,d,h?.user?.id,S2(g.metadata),y)?.id??u,t[9]=g.metadata,t[10]=u,t[11]=y,t[12]=h?.user?.id,t[13]=m,t[14]=d,t[15]=$):$=t[15];const M=$;let z;return t[16]!==M?(z=o.jsx(ni,{to:".",replace:!0,search:B=>({...B,thread:M})}),t[16]=M,t[17]=z):z=t[17],z}const C=d;let T;t[18]!==g||t[19]!==d?(T={virtualMcpId:d,entity:g},t[18]=g,t[19]=d,t[20]=T):T=t[20];const N=T;if(p.status==="creating"||p.status==="loading"){let $;t[21]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(it,{className:"size-4 mr-2"}),t[21]=$):$=t[21];let M;t[22]!==e?(M=e("agentShellLayout.agentShellLayout.creatingTask"),t[22]=e,t[23]=M):M=t[23];let z;t[24]!==M?(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:[$,M]})}),t[24]=M,t[25]=z):z=t[25];let B;return t[26]!==N||t[27]!==z?(B=o.jsx(bc,{value:N,children:z}),t[26]=N,t[27]=z,t[28]=B):B=t[28],B}if(p.status==="error"){let $;t[29]!==e?($=e("agentShellLayout.agentShellLayout.taskUnavailable"),t[29]=e,t[30]=$):$=t[30];let M;t[31]!==$?(M=o.jsx("div",{className:"font-medium",children:$}),t[31]=$,t[32]=M):M=t[32];let z;t[33]!==p.error.message?(z=o.jsx("div",{className:"text-muted-foreground",children:p.error.message}),t[33]=p.error.message,t[34]=z):z=t[34];let B;t[35]!==M||t[36]!==z?(B=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:[M,z]})}),t[35]=M,t[36]=z,t[37]=B):B=t[37];let U;return t[38]!==N||t[39]!==B?(U=o.jsx(bc,{value:N,children:B}),t[38]=N,t[39]=B,t[40]=U):U=t[40],U}if(!g){let $;t[41]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Vn,{size:48,className:"text-muted-foreground"}),t[41]=$):$=t[41];let M;t[42]!==e?(M=e("agentShellLayout.agentShellLayout.agentNotFound"),t[42]=e,t[43]=M):M=t[43];let z;t[44]!==e||t[45]!==d?(z=e("agentShellLayout.agentShellLayout.agentNotFoundDescription",{virtualMcpId:d}),t[44]=e,t[45]=d,t[46]=z):z=t[46];let B;t[47]!==n||t[48]!==a?(B=()=>n({to:"/$org",params:{org:a}}),t[47]=n,t[48]=a,t[49]=B):B=t[49];let U;t[50]!==e?(U=e("agentShellLayout.agentShellLayout.goToOrgHome"),t[50]=e,t[51]=U):U=t[51];let H;t[52]!==B||t[53]!==U?(H=o.jsx(fe,{variant:"outline",onClick:B,children:U}),t[52]=B,t[53]=U,t[54]=H):H=t[54];let W;t[55]!==H||t[56]!==M||t[57]!==z?(W=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(Ci,{image:$,title:M,description:z,actions:H})})}),t[55]=H,t[56]=M,t[57]=z,t[58]=W):W=t[58];let K;return t[59]!==N||t[60]!==W?(K=o.jsx(bc,{value:N,children:W}),t[59]=N,t[60]=W,t[61]=K):K=t[61],K}if(s){const $=p.status==="ready"?p.task:null,M=g?.metadata?.sandboxMap;let z;t[62]!==C||t[63]!==w?(z=o.jsx(wi,{children:o.jsx(S9e,{virtualMcpId:C,layout:w,onNewTaskRef:S})}),t[62]=C,t[63]=w,t[64]=z):z=t[64];let B;t[65]!==w.providerKey||t[66]!==w.threadId||t[67]!==z?(B=o.jsx(Ly,{threadId:w.threadId,children:z},w.providerKey),t[65]=w.providerKey,t[66]=w.threadId,t[67]=z,t[68]=B):B=t[68];let U;t[69]!==y||t[70]!==B||t[71]!==M||t[72]!==d?(U=o.jsx(wy,{virtualMcpId:d,hasActiveGithubRepo:y,sandboxMap:M,children:B}),t[69]=y,t[70]=B,t[71]=M,t[72]=d,t[73]=U):U=t[73];let H;t[74]!==C||t[75]!==U||t[76]!==$?(H=o.jsx("div",{className:"flex flex-col flex-1 min-w-0 bg-background min-h-0",children:o.jsx(an.Provider,{virtualMcpId:C,task:$,children:U},C)}),t[74]=C,t[75]=U,t[76]=$,t[77]=H):H=t[77];let W;return t[78]!==N||t[79]!==H?(W=o.jsx(bc,{value:N,children:H}),t[78]=N,t[79]=H,t[80]=W):W=t[80],W}const P=p.status==="ready"?p.task:null,V=g?.metadata?.sandboxMap;let E;t[81]!==g||t[82]!==w||t[83]!==d?(E=o.jsx(wi,{children:o.jsx(w9e,{entity:g,virtualMcpId:d,layout:w,onNewTaskRef:S})}),t[81]=g,t[82]=w,t[83]=d,t[84]=E):E=t[84];let R;t[85]!==w.providerKey||t[86]!==w.threadId||t[87]!==E?(R=o.jsx(Ly,{threadId:w.threadId,children:E},w.providerKey),t[85]=w.providerKey,t[86]=w.threadId,t[87]=E,t[88]=R):R=t[88];let I;t[89]!==y||t[90]!==R||t[91]!==V||t[92]!==d?(I=o.jsx(wy,{virtualMcpId:d,hasActiveGithubRepo:y,sandboxMap:V,children:R}),t[89]=y,t[90]=R,t[91]=V,t[92]=d,t[93]=I):I=t[93];let D;t[94]!==C||t[95]!==I||t[96]!==P?(D=o.jsx(an.Provider,{virtualMcpId:C,task:P,children:I},C),t[94]=C,t[95]=I,t[96]=P,t[97]=D):D=t[97];let O;return t[98]!==N||t[99]!==D?(O=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsx(bc,{value:N,children:D})}),t[98]=N,t[99]=D,t[100]=O):O=t[100],O}function j9e(){return crypto.randomUUID()}function C9e(){const t=F.c(3);let e,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(v9e,{}),s=o.jsx(x9e,{}),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(wi,{children:[e,s,o.jsxs(EA,{children:[o.jsx(k9e,{}),o.jsx(y9e,{})]})]}),t[2]=n):n=t[2],n}const N9e=Object.freeze(Object.defineProperty({__proto__:null,default:C9e,useInsetContext:ao},Symbol.toStringTag,{value:"Module"}));export{fr as $,i2e as A,r2e as B,xk as C,Wpe as D,nh as E,Kpe as F,g3 as G,Au as H,qpe as I,$se as J,Mw as K,mg as L,hw as M,Rg as N,Mc as O,a0 as P,c0 as Q,vK as R,$i as S,Qt as T,Ug as U,Oc as V,zg as W,O_ as X,Og as Y,v_ as Z,Fg as _,m0 as a,_pe as a$,yre as a0,Lre as a1,Bn as a2,Ype as a3,Bg as a4,bk as a5,Gpe as a6,fpe as a7,mf as a8,Ei as a9,Lne as aA,Pne as aB,Fpe as aC,$w as aD,ff as aE,bte as aF,lpe as aG,bne as aH,Ipe as aI,zw as aJ,gpe as aK,zpe as aL,Hpe as aM,Upe as aN,hne as aO,oX as aP,lX as aQ,Bpe as aR,F3 as aS,DS as aT,Rre as aU,zc as aV,cd as aW,xpe as aX,Spe as aY,FX as aZ,kpe as a_,CS as aa,P9 as ab,$g as ac,yS as ad,js as ae,wpe as af,Rpe as ag,uee as ah,Dpe as ai,dee as aj,rne as ak,K3 as al,rpe as am,QS as an,yne as ao,Hne as ap,j9 as aq,k3 as ar,ao as as,Iie as at,cf as au,ip as av,Fl as aw,$pe as ax,hp as ay,sk as az,so as b,EX as b0,ppe as b1,Lpe as b2,ype as b3,vpe as b4,Ppe as b5,cX as b6,x3 as b7,hpe as b8,mpe as b9,Zpe as bA,Jpe as bB,s2e as bC,_f as bD,Vre as bE,n2e as bF,ipe as bG,YQ as bH,QQ as bI,N9e as bJ,upe as ba,Epe as bb,z3 as bc,Ew as bd,Pw as be,ope as bf,aX as bg,ape as bh,cpe as bi,GZ as bj,Npe as bk,Vpe as bl,bpe as bm,Cpe as bn,jpe as bo,Tpe as bp,wne as bq,W3 as br,Ope as bs,Fne as bt,Mpe as bu,Qpe as bv,Xpe as bw,e2e as bx,Tl as by,t2e as bz,df as c,P3 as d,x0 as e,Nc as f,kn as g,Ape as h,R3 as i,hie as j,spe as k,of as l,npe as m,Qie as n,dpe as o,yn as p,_X as q,Die as r,Yj as s,Ere as t,rl as u,LX as v,Fd as w,pk as x,fc as y,zb as z};
827
+ `),fallbackTitle:e})}function px(t){return{orgSlug:t.orgSlug,virtualMcpId:t.virtualMcpId,branch:t.branch,threadId:t.threadId}}function gx(t){return t.fastPreview?{fastPreview:!0}:void 0}async function rm(t,e,s){try{return await s()}catch(n){throw new mx(n instanceof Error?n.message:e,t)}}async function zj(t){const e=t.expectedHeadSha;if(!e)return;const n=(await Nc(px(t),gx(t)).catch(()=>null))?.headSha;if(n&&n!==e)throw new $j(e,n)}function Fj(t,e){return iJ(px(t),e,gx(t))}function Uj(t,e){return tR(t.githubClient,{owner:t.owner,repo:t.repo,branch:t.headBranch,title:e.title,body:e.body,base:t.baseBranch,coAuthor:t.coAuthor,existing:t.existingOpenPr})}async function Hj(t,e,s){await zj(t),await rm("push",s("thread.publishDialog.failedPushChanges"),()=>Fj(t,e.message)),await rm("sync",s("thread.publishDialog.failedRebase"),()=>KL(px(t),t.baseBranch,gx(t)));const n=await rm("open-pr",s("thread.publishDialog.failedOpenPullRequest"),()=>Uj(t,e));try{await B8(t.githubClient,{owner:t.owner,repo:t.repo,pullNumber:n.number,commitTitle:e.title,commitMessage:e.body,coAuthor:t.coAuthor})}catch(i){throw new mx(i instanceof Error?i.message:s("thread.publishDialog.failedMergePullRequest"),"merge",n)}return n}async function Kj(t,e){return await zj(t),await Fj(t,e.message),Uj(t,e)}function ohe(t,e){return t instanceof $j?{message:e("thread.publishPopover.branchMoved"),pullRequest:null,headMoved:!0}:t instanceof mx&&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 i2(t,e){const s=ohe(t,e),n=s.pullRequest;return n&&ve.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 Wj(t,e){ve.success(e("thread.publishDialog.submittedForReview",{prNumber:t.number}),{action:{label:e("thread.publishDialog.viewOnGithub"),onClick:()=>window.open(t.htmlUrl,"_blank","noopener,noreferrer")}})}function lhe(t){const{mode:e,target:s,note:n,allPaths:i,destinationHost:r,publishLockRef:l,onOpenChange:a,refresh:c,onPullRequestChanged:d,onPublished:u}=t,h=le(),[f,m]=A.useState(!1),[p,g]=A.useState(!1),[x,b]=A.useState(),v=()=>rhe(n,h("thread.publishDialog.changesFrom",{branch:s.headBranch})),_=async()=>{l.current=!0,m(!0),b(void 0);try{await Hj(s,v(),h),ve.success(r?h("thread.publishPopover.publishedTo",{host:r}):h("thread.publishDialog.publishedTo",{baseBranch:s.baseBranch})),a(!1),await Promise.all([d?.(),u?.()])}catch(w){const S=i2(w,h);b(S.message),S.pullRequestOpened&&await d?.(),S.headMoved&&await c()}finally{l.current=!1,m(!1)}},y=async()=>{l.current=!0,m(!0),b(void 0);try{const w=await Kj(s,v());Wj(w,h),a(!1),await d?.()}catch(w){const S=i2(w,h);b(S.message||h("thread.publishDialog.failedSubmitForReview")),S.headMoved&&await c()}finally{l.current=!1,m(!1)}},L=async(w,S)=>{g(!0);try{await ep({orgSlug:s.orgSlug,virtualMcpId:s.virtualMcpId,branch:s.branch,threadId:s.threadId},w,{fastPreview:!0}),ve.success(S),await c()}catch(k){ve.error(k instanceof Error?k.message:h("thread.publishPopover.failedDiscard"))}finally{g(!1)}};return{isPublishing:f,isDiscarding:p,publishError:x,submit:e==="review"?y:_,discardChange:w=>L(w.filepaths,h("thread.publishPopover.discarded",{name:w.name})),discardAll:async()=>{i.length!==0&&await L(i,h("thread.publishDialog.allChangesDiscarded"))}}}function ahe(t,e,s,n,i){return["cms-publish-bodies",t,e,s,n,i]}const che=6e4;function dhe(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:XC},n[4]=i,n[5]=r):r=n[5];const{data:l}=Mt(r);return l}function uhe(t){const e=F.c(43),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,baseBranch:l}=t;let a,c,d,u;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==n?(c={orgSlug:s,virtualMcpId:n,branch:i,threadId:r},a={fastPreview:!0},d=Ef,u=JL(c,a),e[0]=i,e[1]=s,e[2]=r,e[3]=n,e[4]=a,e[5]=c,e[6]=d,e[7]=u):(a=e[4],c=e[5],d=e[6],u=e[7]);const h=d(u),f=h.data,m=f.changedFiles??null,p=f.headSha??null,g=m?m.length>0:(f.aheadOfBase??0)>0;let x;e[8]!==l||e[9]!==i||e[10]!==p||e[11]!==s||e[12]!==n?(x=ahe(s,n,i,l,p),e[8]=l,e[9]=i,e[10]=p,e[11]=s,e[12]=n,e[13]=x):x=e[13];let b;e[14]!==l||e[15]!==a||e[16]!==c?(b=()=>tu(c,{base:l},a),e[14]=l,e[15]=a,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:che},e[18]=x,e[19]=b,e[20]=g,e[21]=v):v=e[21];const _=Mt(v),y=dhe(s,n,i),L=_.data??null;let w;e[22]!==y||e[23]!==L||e[24]!==m?(w=m?Mj({files:m,lookup:y,diff:L}):B0e(L),e[22]=y,e[23]=L,e[24]=m,e[25]=w):w=e[25];const S=w;let k;e[26]!==L?.diffs||e[27]!==m?(k=m?m.map(hhe):Object.keys(L?.diffs??{}),e[26]=L?.diffs,e[27]=m,e[28]=k):k=e[28];const j=f.changedFilesTotal??S.count,C=f.changedFilesTruncated??!1,T=g&&_.isPending,N=!m&&g&&_.isPending;let P;e[29]!==h?(P=()=>h.refetch(),e[29]=h,e[30]=P):P=e[30];let V;return e[31]!==_.isError||e[32]!==L||e[33]!==p||e[34]!==f||e[35]!==S||e[36]!==N||e[37]!==P||e[38]!==k||e[39]!==j||e[40]!==C||e[41]!==T?(V={status:f,summary:S,allPaths:k,changedFilesTotal:j,changedFilesTruncated:C,headSha:p,diff:L,bodiesPending:T,bodiesFailed:_.isError,cardsPending:N,refresh:P},e[31]=_.isError,e[32]=L,e[33]=p,e[34]=f,e[35]=S,e[36]=N,e[37]=P,e[38]=k,e[39]=j,e[40]=C,e[41]=T,e[42]=V):V=e[42],V}function hhe(t){return t.path}function fhe(t){return["smart-review-verdict",t.orgSlug,t.virtualMcpId,t.branch,t.threadId,t.fastPreview?"fast-preview-upstream":"sandbox",t.signature,t.language]}function mhe(t){const e=F.c(28),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:l,status:a,diff:c,enabled:d}=t,[u]=pr(),{language:h}=u;let f,m,p;if(e[0]!==i||e[1]!==c||e[2]!==d||e[3]!==l||e[4]!==h||e[5]!==s||e[6]!==a||e[7]!==r||e[8]!==n){const L=c?lJ(c):"";f=d&&!!i&&!!a&&!!c&&L!=="",p=Mt,m=fhe({orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:l,signature:L,language:h}),e[0]=i,e[1]=c,e[2]=d,e[3]=l,e[4]=h,e[5]=s,e[6]=a,e[7]=r,e[8]=n,e[9]=f,e[10]=m,e[11]=p}else f=e[9],m=e[10],p=e[11];let g;e[12]!==i||e[13]!==c||e[14]!==l||e[15]!==h||e[16]!==s||e[17]!==a||e[18]!==r||e[19]!==n?(g=()=>aJ({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},{status:a,diff:c,language:h},l?{fastPreview:!0}:void 0),e[12]=i,e[13]=c,e[14]=l,e[15]=h,e[16]=s,e[17]=a,e[18]=r,e[19]=n,e[20]=g):g=e[20];let x;e[21]!==f||e[22]!==m||e[23]!==g?(x={queryKey:m,queryFn:g,enabled:f,staleTime:1/0,gcTime:6e5,retry:phe},e[21]=f,e[22]=m,e[23]=g,e[24]=x):x=e[24];const b=p(x),v=b.data??null,_=f&&b.isFetching&&!b.data;let y;return e[25]!==v||e[26]!==_?(y={verdict:v,loading:_},e[25]=v,e[26]=_,e[27]=y):y=e[27],y}function phe(t,e){return!UL(e)&&t<1}function qj(t){const e=F.c(30),{orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:l,status:a,diff:c,policy:d,judgeEnabled:u,paths:h}=t,f=u===void 0?!0:u,m=h===void 0?null:h;let p;e[0]!==c||e[1]!==f||e[2]!==d?(p=f&&gJ(c,d),e[0]=c,e[1]=f,e[2]=d,e[3]=p):p=e[3];const g=p;let x;e[4]!==i||e[5]!==c||e[6]!==l||e[7]!==g||e[8]!==s||e[9]!==a||e[10]!==r||e[11]!==n?(x={orgSlug:s,virtualMcpId:n,branch:i,threadId:r,fastPreview:l,status:a,diff:c,enabled:g},e[4]=i,e[5]=c,e[6]=l,e[7]=g,e[8]=s,e[9]=a,e[10]=r,e[11]=n,e[12]=x):x=e[12];const{verdict:b,loading:v}=mhe(x);if(!c&&m){let w;e[13]!==m||e[14]!==d?(w=pJ(m,d),e[13]=m,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=mJ(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 _;e[24]!==v||e[25]!==b?(_=xJ(b,v),e[24]=v,e[25]=b,e[26]=_):_=e[26];const y=!v;let L;return e[27]!==_||e[28]!==y?(L={gate:_,ready:y},e[27]=_,e[28]=y,e[29]=L):L=e[29],L}const Gj="(max-width: 479px)";function ghe(t){const e=globalThis.matchMedia(Gj);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function xhe(){return A.useSyncExternalStore(ghe,vhe,bhe)}function bhe(){return!1}function vhe(){return globalThis.matchMedia(Gj).matches}function yhe(t){const e=F.c(22),s=xhe(),n=A.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(ry,{...t,publishLockRef:n}):null,e[2]=t,e[3]=d):d=e[3];let u;e[4]!==d?(u=o.jsx(Bt,{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]=u):u=e[5];let h;e[6]!==r||e[7]!==t.open||e[8]!==u?(h=o.jsx(zt,{open:t.open,onOpenChange:r,children:u}),e[6]=r,e[7]=t.open,e[8]=u,e[9]=h):h=e[9];let f;return e[10]!==t.children||e[11]!==h?(f=o.jsxs(o.Fragment,{children:[t.children,h]}),e[10]=t.children,e[11]=h,e[12]=f):f=e[12],f}let l;e[13]!==t.children?(l=o.jsx(ZT,{asChild:!0,children:o.jsx("span",{className:"inline-flex",children:t.children})}),e[13]=t.children,e[14]=l):l=e[14];let a;e[15]!==t?(a=o.jsx(as,{align:"end",sideOffset:8,collisionPadding:12,onFocusOutside:_he,className:"flex max-h-[min(720px,85vh)] w-[420px] flex-col gap-0 overflow-hidden p-0",children:o.jsx(ry,{...t,publishLockRef:n})}),e[15]=t,e[16]=a):a=e[16];let c;return e[17]!==r||e[18]!==t.open||e[19]!==l||e[20]!==a?(c=o.jsxs(cs,{open:t.open,onOpenChange:r,children:[l,a]}),e[17]=r,e[18]=t.open,e[19]=l,e[20]=a,e[21]=c):c=e[21],c}function _he(t){return t.preventDefault()}function xx(t){const e=F.c(11),{mode:s,title:n,subLine:i,trailing:r}=t,l=s==="review"?Hr:zn;let a;e[0]!==l?(a=o.jsx(l,{className:"size-4 shrink-0 text-muted-foreground"}),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a||e[3]!==n||e[4]!==r?(c=o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a,n,r]}),e[2]=a,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 u;return e[8]!==c||e[9]!==d?(u=o.jsxs(o.Fragment,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function bx(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 l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Qu,{className:"size-4"}),e[2]=l):l=e[2];let a;e[3]!==n?(a=n("thread.publishPopover.preview"),e[3]=n,e[4]=a):a=e[4];let c;return e[5]!==i||e[6]!==r||e[7]!==a?(c=o.jsxs(fe,{type:"button",variant:"outline",onClick:i,disabled:r,children:[l,a]}),e[5]=i,e[6]=r,e[7]=a,e[8]=c):c=e[8],c}function Lhe(t){const e=F.c(20),{mode:s,draftPreviewUrl:n}=t,i=le();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Fr,{className:"h-3.5 w-48"}),e[0]=r):r=e[0];let l;e[1]!==s?(l=o.jsx(xx,{mode:s,title:r}),e[1]=s,e[2]=l):l=e[2];let a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(t2,{children:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(hu,{}),o.jsx(hu,{}),o.jsx(hu,{})]})}),c=o.jsxs(o.Fragment,{children:[o.jsx(Fr,{className:"h-3 w-20"}),o.jsx(Fr,{className:"h-14 w-full rounded-lg"})]}),e[3]=a,e[4]=c):(a=e[3],c=e[4]);let d;e[5]!==n||e[6]!==i?(d=o.jsx(bx,{draftPreviewUrl:n,t:i}),e[5]=n,e[6]=i,e[7]=d):d=e[7];const u=s==="review"?"default":"brand";let h;e[8]!==s||e[9]!==i?(h=i(s==="review"?"thread.publishPopover.submitForReview":"thread.publishPopover.publish"),e[8]=s,e[9]=i,e[10]=h):h=e[10];let f;e[11]!==u||e[12]!==h?(f=o.jsx(fe,{type:"button",variant:u,className:"flex-1",disabled:!0,children:h}),e[11]=u,e[12]=h,e[13]=f):f=e[13];let m;e[14]!==d||e[15]!==f?(m=o.jsxs("div",{className:"flex gap-2",children:[d,f]}),e[14]=d,e[15]=f,e[16]=m):m=e[16];let p;return e[17]!==l||e[18]!==m?(p=o.jsx(fx,{state:"loading",header:l,body:a,note:c,footer:m}),e[17]=l,e[18]=m,e[19]=p):p=e[19],p}function whe(t){const e=F.c(25),{mode:s,draftPreviewUrl:n,message:i,onRetry:r}=t,l=le();let a;e[0]!==l?(a=l("thread.publishPopover.loadFailed"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=o.jsx("span",{className:"truncate",children:a}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==s||e[5]!==c?(d=o.jsx(xx,{mode:s,title:c}),e[4]=s,e[5]=c,e[6]=d):d=e[6];let u;e[7]!==i?(u=o.jsx("p",{className:"px-4 py-6 text-xs text-destructive",children:i}),e[7]=i,e[8]=u):u=e[8];let h;e[9]!==n||e[10]!==l?(h=o.jsx(bx,{draftPreviewUrl:n,t:l}),e[9]=n,e[10]=l,e[11]=h):h=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(On,{className:"size-4"}),e[12]=f):f=e[12];let m;e[13]!==l?(m=l("thread.publishPopover.retry"),e[13]=l,e[14]=m):m=e[14];let p;e[15]!==r||e[16]!==m?(p=o.jsxs(fe,{type:"button",variant:"outline",className:"flex-1",onClick:r,children:[f,m]}),e[15]=r,e[16]=m,e[17]=p):p=e[17];let g;e[18]!==h||e[19]!==p?(g=o.jsxs("div",{className:"flex gap-2",children:[h,p]}),e[18]=h,e[19]=p,e[20]=g):g=e[20];let x;return e[21]!==d||e[22]!==u||e[23]!==g?(x=o.jsx(fx,{state:"ready",header:d,body:u,footer:g}),e[21]=d,e[22]=u,e[23]=g,e[24]=x):x=e[24],x}function ry(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:u}=c;return o.jsx(whe,{mode:s,draftPreviewUrl:t.draftPreviewUrl,message:d?.message??"",onRetry:u})},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(Lhe,{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(She,{...t}),e[6]=t,e[7]=r):r=e[7];let l;e[8]!==i||e[9]!==r?(l=o.jsx(A.Suspense,{fallback:i,children:r}),e[8]=i,e[9]=r,e[10]=l):l=e[10];let a;return e[11]!==n||e[12]!==l?(a=o.jsx(sn,{fallback:n,children:l}),e[11]=n,e[12]=l,e[13]=a):a=e[13],a}function She(t){const e=F.c(168),{publishLockRef:s,onOpenChange:n,mode:i,orgSlug:r,orgId:l,virtualMcpId:a,branch:c,baseBranch:d,githubConnectionId:u,owner:h,repo:f,publishPolicy:m,draftPreviewUrl:p,destinationHost:g,lastPublishedPr:x,onRequestApproval:b,openPullRequest:v,onPullRequestChanged:_,onPublished:y}=t,L=i===void 0?"publish":i,w=x===void 0?null:x,S=v===void 0?null:v,k=le(),j=hs()?.taskId??null;let C;e[0]!==u||e[1]!==l||e[2]!==r?(C={connectionId:u,orgId:l,orgSlug:r},e[0]=u,e[1]=l,e[2]=r,e[3]=C):C=e[3];const T=Cs(C),{data:N}=vn.useSession();let P;e[4]!==d||e[5]!==c||e[6]!==r||e[7]!==j||e[8]!==a?(P={orgSlug:r,virtualMcpId:a,branch:c,threadId:j,baseBranch:d},e[4]=d,e[5]=c,e[6]=r,e[7]=j,e[8]=a,e[9]=P):P=e[9];const{status:V,summary:E,allPaths:R,changedFilesTotal:I,changedFilesTruncated:D,headSha:O,diff:$,bodiesPending:M,bodiesFailed:z,cardsPending:B,refresh:U}=uhe(P),[H,W]=A.useState(null),[K,Q]=A.useState(!1),[X,se]=A.useState(null),[ne,te]=A.useState(null);let ee;e[10]!==H||e[11]!==E?(ee=H0e(H,W0e(E)),e[10]=H,e[11]=E,e[12]=ee):ee=e[12];const Y=ee,q=L==="review",oe=B?"loading":M?"manifest":"ready",J=!q;let ie;e[13]!==R||e[14]!==c||e[15]!==$||e[16]!==V||e[17]!==r||e[18]!==m||e[19]!==J||e[20]!==j||e[21]!==a?(ie={orgSlug:r,virtualMcpId:a,branch:c,threadId:j,fastPreview:!0,status:V,diff:$,paths:R,policy:m,judgeEnabled:J},e[13]=R,e[14]=c,e[15]=$,e[16]=V,e[17]=r,e[18]=m,e[19]=J,e[20]=j,e[21]=a,e[22]=ie):ie=e[22];const{gate:Z}=qj(ie),he=S?.state==="open";let de;e[23]!==c||e[24]!==V?(de=l3(V)??c,e[23]=c,e[24]=V,e[25]=de):de=e[25];const ae=N?.user;let ce;e[26]!==ae?(ce=hx(ae),e[26]=ae,e[27]=ce):ce=e[27];const ue=O??void 0;let G;e[28]!==he||e[29]!==S?(G=he?{number:S.number,htmlUrl:S.htmlUrl}:void 0,e[28]=he,e[29]=S,e[30]=G):G=e[30];let me;e[31]!==d||e[32]!==c||e[33]!==T||e[34]!==r||e[35]!==h||e[36]!==f||e[37]!==ce||e[38]!==ue||e[39]!==G||e[40]!==de||e[41]!==j||e[42]!==a?(me={orgSlug:r,virtualMcpId:a,branch:c,threadId:j,fastPreview:!0,baseBranch:d,githubClient:T,owner:h,repo:f,headBranch:de,coAuthor:ce,expectedHeadSha:ue,existingOpenPr:G},e[31]=d,e[32]=c,e[33]=T,e[34]=r,e[35]=h,e[36]=f,e[37]=ce,e[38]=ue,e[39]=G,e[40]=de,e[41]=j,e[42]=a,e[43]=me):me=e[43];const ye=me;let we;e[44]!==R||e[45]!==g||e[46]!==L||e[47]!==Y||e[48]!==n||e[49]!==y||e[50]!==_||e[51]!==s||e[52]!==U||e[53]!==ye?(we={mode:L,target:ye,note:Y,allPaths:R,destinationHost:g,publishLockRef:s,onOpenChange:n,refresh:U,onPullRequestChanged:_,onPublished:y},e[44]=R,e[45]=g,e[46]=L,e[47]=Y,e[48]=n,e[49]=y,e[50]=_,e[51]=s,e[52]=U,e[53]=ye,e[54]=we):we=e[54];const{isPublishing:Ne,isDiscarding:je,publishError:_e,submit:Ve,discardChange:xe,discardAll:Se}=lhe(we),Ce=!Ne&&E.count>0&&(q||Z.allowed);let Ae;e[55]!==q||e[56]!==E.count||e[57]!==k?(Ae=q?E.count===0?k("thread.publishPopover.submitForReview"):E.count===1?k("thread.publishPopover.submitOneForReview"):k("thread.publishPopover.submitCountForReview",{count:E.count}):E.count===0?k("thread.publishPopover.publish"):E.count===1?k("thread.publishPopover.publishOneInProduction"):k("thread.publishPopover.publishCountInProduction",{count:E.count}),e[55]=q,e[56]=E.count,e[57]=k,e[58]=Ae):Ae=e[58];const st=Ae;let Be;e:{if(q&&he){let at;e[59]!==S.number||e[60]!==k?(at=k("thread.publishPopover.updatesPullRequest",{number:S.number}),e[59]=S.number,e[60]=k,e[61]=at):at=e[61],Be=at;break e}const ht=w;if(!ht?.mergedAt){Be=null;break e}let ft;if(e[62]!==ht||e[63]!==k){const at=ed(new Date(ht.mergedAt)),pt=ihe(ht);ft=pt?k("thread.publishPopover.lastPublishedBy",{when:at,name:pt}):k("thread.publishPopover.lastPublished",{when:at}),e[62]=ht,e[63]=k,e[64]=ft}else ft=e[64];Be=ft}const Ie=Be;let Oe;e[65]!==q||e[66]!==E.count||e[67]!==k?(Oe=q?k("thread.publishPopover.submitForReview"):E.count===1?k("thread.publishPopover.publishOne"):E.count>1?k("thread.publishPopover.publishCount",{count:E.count}):k("thread.publishPopover.publish"),e[65]=q,e[66]=E.count,e[67]=k,e[68]=Oe):Oe=e[68];const mt=Oe;let lt;e[69]!==M||e[70]!==ne||e[71]!==xe||e[72]!==X||e[73]!==$||e[74]!==je||e[75]!==Ne?(lt=(ht,ft)=>ft.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}),ft.map(at=>{const pt=Oj(at);return o.jsx(Z0e,{change:at,diff:$,bodyPending:M,expanded:X===pt,onToggleExpanded:()=>se(X===pt?null:pt),confirming:ne===pt,onConfirmingChange:Lt=>te(Lt?pt:null),onDiscard:()=>{xe(at)},isPublishing:Ne,isDiscarding:je},pt)})]}),e[69]=M,e[70]=ne,e[71]=xe,e[72]=X,e[73]=$,e[74]=je,e[75]=Ne,e[76]=lt):lt=e[76];const Xe=lt;let nt;e:{if(q||E.count===0){nt=null;break e}if(Z.pending){let pt;e[77]===Symbol.for("react.memo_cache_sentinel")?(pt=o.jsx(it,{className:"size-3.5 motion-reduce:animate-none"}),e[77]=pt):pt=e[77];let Lt;e[78]!==k?(Lt=k("thread.publishPopover.reviewing"),e[78]=k,e[79]=Lt):Lt=e[79];let bt;e[80]!==Lt?(bt=o.jsxs("div",{className:"flex items-center gap-2 border-t px-4 py-2.5 text-xs text-muted-foreground",children:[pt,Lt]}),e[80]=Lt,e[81]=bt):bt=e[81],nt=bt;break e}if(Z.allowed){nt=null;break e}let ht;e[82]===Symbol.for("react.memo_cache_sentinel")?(ht=o.jsx(sl,{className:"mt-0.5 size-3.5 shrink-0"}),e[82]=ht):ht=e[82];let ft;e[83]!==Z.reason||e[84]!==k?(ft=Z.reason??k("thread.publishPopover.needsReviewGeneric"),e[83]=Z.reason,e[84]=k,e[85]=ft):ft=e[85];let at;e[86]!==ft?(at=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:ft})]}),e[86]=ft,e[87]=at):at=e[87],nt=at}const Fe=nt;let dt;e:{if(E.count<=1||D){dt=null;break e}if(K){let Lt;e[88]!==k?(Lt=k("thread.publishPopover.discardAllConfirm"),e[88]=k,e[89]=Lt):Lt=e[89];let bt;e[90]!==Lt?(bt=o.jsx("span",{className:"text-destructive",children:Lt}),e[90]=Lt,e[91]=bt):bt=e[91];let Ft;e[92]===Symbol.for("react.memo_cache_sentinel")?(Ft=()=>Q(!1),e[92]=Ft):Ft=e[92];let ge;e[93]!==k?(ge=k("thread.publishDialog.cancel"),e[93]=k,e[94]=ge):ge=e[94];let Ee;e[95]!==ge?(Ee=o.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:Ft,children:ge}),e[95]=ge,e[96]=Ee):Ee=e[96];let Re;e[97]!==Se?(Re=()=>{Q(!1),Se()},e[97]=Se,e[98]=Re):Re=e[98];let ke;e[99]!==k?(ke=k("thread.publishPopover.discard"),e[99]=k,e[100]=ke):ke=e[100];let ot;e[101]!==je||e[102]!==Re||e[103]!==ke?(ot=o.jsx("button",{type:"button",className:"font-medium text-destructive disabled:opacity-50",onClick:Re,disabled:je,children:ke}),e[101]=je,e[102]=Re,e[103]=ke,e[104]=ot):ot=e[104];let Le;e[105]!==bt||e[106]!==Ee||e[107]!==ot?(Le=o.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-[11px]",children:[bt,Ee,ot]}),e[105]=bt,e[106]=Ee,e[107]=ot,e[108]=Le):Le=e[108],dt=Le;break e}let ht;e[109]===Symbol.for("react.memo_cache_sentinel")?(ht=()=>Q(!0),e[109]=ht):ht=e[109];const ft=Ne||je;let at;e[110]!==k?(at=k("thread.publishPopover.discardAll"),e[110]=k,e[111]=at):at=e[111];let pt;e[112]!==ft||e[113]!==at?(pt=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:ft,children:at}),e[112]=ft,e[113]=at,e[114]=pt):pt=e[114],dt=pt}const et=dt;let rt;e[115]!==z||e[116]!==B||e[117]!==I||e[118]!==D||e[119]!==q||e[120]!==Xe||e[121]!==E.blocks||e[122]!==E.count||e[123]!==E.other||e[124]!==E.pages||e[125]!==k?(rt=B?o.jsx(t2,{children:o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(hu,{}),o.jsx(hu,{})]})}):E.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:k(q?"thread.publishPopover.nothingToSubmit":"thread.publishPopover.everythingLive")}),o.jsx("p",{className:"text-xs text-muted-foreground",children:k(q?"thread.publishPopover.submitEmptyHint":"thread.publishPopover.emptyHint")})]}):o.jsxs(t2,{children:[D?o.jsx("p",{className:"text-[11px] text-muted-foreground",children:k("thread.publishPopover.showingFirst",{shown:E.count,total:I})}):null,Xe(k("thread.publishPopover.pagesGroup"),E.pages),Xe(k("thread.publishPopover.blocksGroup"),E.blocks),Xe(k("thread.publishPopover.otherGroup"),E.other),z?o.jsx("p",{className:"text-[11px] text-muted-foreground",children:k("thread.publishPopover.detailsUnavailable")}):null]}),e[115]=z,e[116]=B,e[117]=I,e[118]=D,e[119]=q,e[120]=Xe,e[121]=E.blocks,e[122]=E.count,e[123]=E.other,e[124]=E.pages,e[125]=k,e[126]=rt):rt=e[126];const gt=rt;let pe;e[127]!==st?(pe=o.jsx("span",{className:"truncate",children:st}),e[127]=st,e[128]=pe):pe=e[128];let Me;e[129]!==et||e[130]!==L||e[131]!==Ie||e[132]!==pe?(Me=o.jsx(xx,{mode:L,title:pe,subLine:Ie,trailing:et}),e[129]=et,e[130]=L,e[131]=Ie,e[132]=pe,e[133]=Me):Me=e[133];let Ze;e[134]!==Ne||e[135]!==q||e[136]!==Y||e[137]!==E.count||e[138]!==k?(Ze=E.count===0?null:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-[13px] font-medium",children:k(q?"thread.publishPopover.reviewNote":"thread.publishPopover.versionNote")}),o.jsx(Jo,{value:Y,onChange:ht=>W(ht.target.value),placeholder:k(q?"thread.publishPopover.reviewNotePlaceholder":"thread.publishPopover.versionNotePlaceholder"),rows:2,className:"resize-none text-[13px]",disabled:Ne})]}),e[134]=Ne,e[135]=q,e[136]=Y,e[137]=E.count,e[138]=k,e[139]=Ze):Ze=e[139];let ct;e[140]!==p||e[141]!==k?(ct=o.jsx(bx,{draftPreviewUrl:p,t:k}),e[140]=p,e[141]=k,e[142]=ct):ct=e[142];let _t;e[143]!==Ce||e[144]!==Z||e[145]!==Ne||e[146]!==q||e[147]!==b||e[148]!==mt||e[149]!==Ve||e[150]!==E.count||e[151]!==k?(_t=!q&&E.count>0&&!Z.allowed&&!Z.pending?o.jsx(fe,{type:"button",className:"flex-1",onClick:b,disabled:Ne,children:k("thread.publishPopover.requestApproval")}):o.jsxs(fe,{type:"button",variant:q?"default":"brand",className:"flex-1",onClick:()=>{Ve()},disabled:!Ce,children:[Ne?o.jsx(it,{className:"size-4 motion-reduce:animate-none"}):null,Ne?k(q?"thread.publishPopover.submitting":"thread.publishPopover.publishing"):mt]}),e[143]=Ce,e[144]=Z,e[145]=Ne,e[146]=q,e[147]=b,e[148]=mt,e[149]=Ve,e[150]=E.count,e[151]=k,e[152]=_t):_t=e[152];let wt;e[153]!==ct||e[154]!==_t?(wt=o.jsxs("div",{className:"flex gap-2",children:[ct,_t]}),e[153]=ct,e[154]=_t,e[155]=wt):wt=e[155];let ze;e[156]!==_e?(ze=_e?o.jsx("p",{className:"text-xs text-destructive",children:_e}):null,e[156]=_e,e[157]=ze):ze=e[157];let yt;e[158]!==wt||e[159]!==ze?(yt=o.jsxs(o.Fragment,{children:[wt,ze]}),e[158]=wt,e[159]=ze,e[160]=yt):yt=e[160];let At;return e[161]!==gt||e[162]!==Fe||e[163]!==oe||e[164]!==Me||e[165]!==Ze||e[166]!==yt?(At=o.jsx(fx,{state:oe,header:Me,body:gt,note:Ze,gate:Fe,footer:yt}),e[161]=gt,e[162]=Fe,e[163]=oe,e[164]=Me,e[165]=Ze,e[166]=yt,e[167]=At):At=e[167],At}function khe(){return!1}function Yj(t,e){khe()&&console.log(`[github-header] ${t}`,e??"")}function jhe(t){if(!(t==="claiming"||t==="ready"||t==="failed"))return Kw[t].short}const Che=new Set(["failure","timed_out","cancelled","action_required"]);function Jj(t){return t.status==="completed"&&Che.has(t.conclusion)}function vx(t){return t.status==="queued"||t.status==="in_progress"}function Ph(t){return t.isPending&&t.fetchStatus!=="idle"}function Nhe(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr-page"}}function Er(t,e,s){return e?[...t,Nhe(s)]:t}function bi(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 oy(t){return{key:"submit-for-review",label:t("thread.headerActions.submitForReview"),action:"create-pr"}}function gh(t,e,s){if(e.filter(vx).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 Vhe(t){const{lifecycle:e,branch:s,pr:n,checks:i,reviews:r,loading:l,t:a}=t;if(l)return{label:a("thread.headerActions.loading"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.loadingBranchTooltip"),menu:[]};switch(e.phase){case"idle":return{label:t.claimPhase&&jhe(t.claimPhase.kind)||a("thread.headerActions.startingSandbox"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.waitingForDaemonTooltip"),menu:[]};case"cloning":return{label:a("thread.headerActions.cloningRepo"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.cloningRepoTooltip"),menu:[]};case"clone-failed":return{label:a("thread.headerActions.cloneFailed"),disabled:!0,variant:"outline",tooltip:e.error||a("thread.headerActions.cloneFailedDefaultTooltip"),menu:[]};case"checking-out":return{label:a("thread.headerActions.switchingTo",{branch:e.to}),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.checkingOutTooltip",{branch:e.to}),menu:[]};case"installing":return{label:a("thread.headerActions.installingPackages"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.installingPackagesTooltip"),menu:[]};case"starting":{if(!(s.kind==="ready"&&(s.workingTreeDirty||s.aheadOfBase>0||s.unpushed>0))&&!t.noReviewableDiff)return{label:a("thread.headerActions.startingApp"),disabled:!0,loading:!0,variant:"outline",tooltip:a("thread.headerActions.startingAppTooltip"),menu:[]};break}}if(s.kind!=="ready")return{label:a("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:a("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:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:bi([],c,a)};if(c.workingTreeDirty||d)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:bi(Er([oy(a)],n,a),c,a)};if(Yj("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:a("thread.headerActions.continue"),action:"create-pr",variant:"special",tooltip:a("thread.headerActions.openNewPrTooltip"),menu:bi(Er([],n,a),c,a)}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.prMergedTooltip",{prNumber:String(n.number),base:n.base}),menu:bi(Er([],n,a),c,a)};if(c.aheadOfBase>0){if(n&&n.state==="closed"&&!n.merged)return{label:a("thread.headerActions.reopenPr"),action:"reopen",variant:"default",tooltip:a("thread.headerActions.reopenPrTooltip",{prNumber:String(n.number)}),menu:bi(Er([],n,a),c,a)};if(!n)return{label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:bi([oy(a)],c,a)};if((r?.mergeableState??"unknown")==="dirty")return{label:a("thread.cmsActions.getLatest"),action:"rebase",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[{key:"resolve-on-github",label:a("thread.cmsActions.resolveOnGithub"),action:"open-pr-page"}]};const h=i.filter(vx).length,f=i.filter(Jj).map(p=>p.name);if(h===0&&f.length>0)return{label:a("thread.headerActions.fixChecks"),action:"fix-checks",variant:"default",tooltip:a("thread.headerActions.failingChecksTooltip",{checks:f.join(", ")}),meta:{failingChecks:f},menu:bi(Er([{key:"publish-anyway",label:a("thread.headerActions.publishAnyway"),action:"merge",tooltip:a("thread.headerActions.squashMergeTooltip",{prNumber:String(n.number),base:n.base})}],n,a),c,a)};if(r?.draft)return gh({label:a("thread.headerActions.markReady"),action:"mark-ready",variant:"default",tooltip:a("thread.headerActions.markDraftReadyTooltip"),menu:bi(Er([],n,a),c,a)},i,a);const m=r?.unresolvedConversations??0;return m>0?gh({label:a("thread.headerActions.addressFeedback"),action:"resolve-comments",variant:"default",tooltip:a("thread.headerActions.unresolvedConversationsTooltip",{count:String(m)}),menu:bi(Er([],n,a),c,a)},i,a):r?.missingRequiredApprovals?gh({label:a("thread.cmsActions.waitingForReview"),action:"open-pr-page",variant:"outline",tooltip:a("thread.headerActions.waitingForApprovalsTooltip"),menu:bi(Er([],n,a),c,a)},i,a):gh({label:a("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",meta:{publishPolicyOverride:"open"},menu:bi(Er([{key:"review",label:a("thread.headerActions.review"),action:"review"}],n,a),c,a)},i,a)}return c.behindBase>0?{label:a("thread.cmsActions.getLatest"),action:"sync",variant:"default",tooltip:a("thread.cmsActions.getLatestTooltip"),menu:[]}:{label:a("thread.headerActions.upToDate"),disabled:!0,variant:"outline",tooltip:a("thread.headerActions.branchInSyncTooltip",{base:c.base}),menu:[]}}function ly(t){return{key:"view-on-github",label:t("thread.cmsActions.viewOnGithub"),action:"open-pr"}}function xh(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 ay(t,e,s,n){const i=e.length;if(i===0)return t;if(e.filter(vx).length>0){const a=e.filter(d=>d.status==="completed").length,c=n("thread.cmsActions.checksRunning",{done:a,total:i});return s==="loading"?{...t,loading:!0,tooltip:c}:{...t,tooltip:c}}const l=e.filter(Jj).length;return l>0?{...t,variant:"warning",tooltip:n("thread.cmsActions.checksFailing",{failed:l,total:i})}:t}function The(t,e){return!!(t?.merged&&t.headSha&&e.kind==="ready"&&!e.workingTreeDirty&&e.headSha===t.headSha)}function Ahe(t){return Ph(t.prQuery)?!0:t.pr?.state!=="open"||t.pr.merged?!1:Ph(t.checksQuery)||Ph(t.reviewsQuery)}function Phe(t,e){return t.workingTreeDirty?!0:e!==null?e>0:t.aheadOfBase>0}function Ehe(t){const{branch:e,pr:s,checks:n,reviews:i,publishing:r,saving:l,loading:a,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(a||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(l)return{label:d("thread.headerActions.saving"),variant:"outline",disabled:!0,loading:!0,menu:[]};if(s&&s.state==="open"&&!s.merged?s:null){const h=i?.mergeableState??"unknown";return h==="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"}]}:h==="blocked"||i?.draft?ay({label:d("thread.cmsActions.waitingForReview"),action:"open-pr",variant:"outline",menu:xh([ly(d)],e,d)},n,"loading",d):ay({label:d("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:xh([ly(d)],e,d)},n,"none",d)}return The(s,e)?{label:d("thread.headerActions.upToDate"),variant:"outline",disabled:!0,menu:xh([],e,d)}:Phe(e,c)?{label:d("thread.cmsActions.reviewAndPublish"),action:"publish",variant:"brand",menu:xh([{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 Qj(t){const e=F.c(4);let s;e[0]!==t?(s=c9(t),e[0]=t,e[1]=s):s=e[1];let n;return e[2]!==s?(n={...s,select:Rhe},e[2]=s,e[3]=n):n=e[3],Mt(n)}function Rhe(t){const e=t.pullRequest;return e?{draft:e.draft,mergeableState:e.mergeableState,unresolvedConversations:e.unresolvedConversations,missingRequiredApprovals:e.missingRequiredApprovals}:null}function cy(t,e){return t==="open-pr"||e==="resolve-on-github"?o.jsx(mn,{size:16}):t==="publish"?o.jsx(P6,{className:"size-4"}):t==="get-latest"||t==="retry-status"?o.jsx(On,{className:"size-4"}):o.jsx(Hr,{className:"size-4"})}function Dhe(t){const e=F.c(91),{virtualMcpId:s}=t,n=le(),{org:i}=He(),r=Ns(),l=vs(s),{data:a}=vn.useSession(),{deleteRelease:c}=d9(s),{currentBranch:d,setCurrentTaskBranch:u,taskId:h,createTask:f}=on();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={open:!1,mode:"publish"},e[0]=m):m=e[0];const[p,g]=A.useState(m);let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=_e=>g({open:!0,mode:_e}),e[1]=x):x=e[1];const b=x,v=u6(l),_=v.status==="attached"||v.status==="public-clone"?v.repo:null,{previewServerUrl:y}=yn(s);let L;if(e[2]!==d||e[3]!==i.slug||e[4]!==s){const _e=d?V3(N3(i.slug,s,d)):null;L=_e?Or(_e.path,_e.params):"/",e[2]=d,e[3]=i.slug,e[4]=s,e[5]=L}else L=e[5];const w=L;let S;e[6]!==d||e[7]!==w||e[8]!==i.slug||e[9]!==y||e[10]!==s?(S=d?{orgSlug:i.slug,virtualMcpId:s,branch:d,previewServerUrl:y,path:w}:null,e[6]=d,e[7]=w,e[8]=i.slug,e[9]=y,e[10]=s,e[11]=S):S=e[11];const k=Ow(S);let j;e[12]!==d||e[13]!==i.slug||e[14]!==h||e[15]!==s?(j=JL({orgSlug:i.slug,virtualMcpId:s,branch:d??"",threadId:h??null},{fastPreview:!0}),e[12]=d,e[13]=i.slug,e[14]=h,e[15]=s,e[16]=j):j=e[16];const C=!!d;let T;e[17]!==j||e[18]!==C?(T={...j,enabled:C},e[17]=j,e[18]=C,e[19]=T):T=e[19];const N=Mt(T),P=N.data??null,V=P?{kind:"ready",branch:l3(P)??d??"",base:P.base??"main",workingTreeDirty:WL(P),unpushed:P.unpushed??0,aheadOfBase:P.aheadOfBase??0,behindBase:P.behindBase??0,headSha:P.headSha??""}:{kind:"unknown"},E=P?.changedFiles?Mj({files:P.changedFiles}).count:null,R=(V.kind==="ready"?V.branch:null)??d??null,I=V.kind==="ready"?V.base:"main",D=i0({orgId:i.id,orgSlug:i.slug,connectionId:_?.connectionId??"",owner:_?.owner??"",repo:_?.name??"",branch:R}),O=D.data??null,$=cR({orgId:i.id,orgSlug:i.slug,connectionId:_?.connectionId??"",owner:_?.owner??"",repo:_?.name??"",base:I}),M=dg({orgId:i.id,orgSlug:i.slug,connectionId:_?.connectionId??"",owner:_?.owner??"",repo:_?.name??"",branch:R}),z=Qj({orgId:i.id,orgSlug:i.slug,connectionId:_?.connectionId??"",owner:_?.owner??"",repo:_?.name??"",branch:R});let B;e[20]!==M||e[21]!==O||e[22]!==D||e[23]!==z?(B=Ahe({pr:O,prQuery:D,checksQuery:M,reviewsQuery:z}),e[20]=M,e[21]=O,e[22]=D,e[23]=z,e[24]=B):B=e[24];const U=B;let H;e[25]!==D?(H=async()=>{await D.refetch()},e[25]=D,e[26]=H):H=e[26];const W=H,K=Es({mutationFn:async()=>{if(!sd(l)){await u(Dl(a9(a?.user)));return}const _e=d;await u(I),_e&&_e!==I&&await c(_e)},onError:Ohe});let Q;e[27]!==i.slug||e[28]!==h||e[29]!==s?(Q=async _e=>(await KL({orgSlug:i.slug,virtualMcpId:s,branch:_e.branch,threadId:h??null},_e.base,{fastPreview:!0}),_e),e[27]=i.slug,e[28]=h,e[29]=s,e[30]=Q):Q=e[30];let X;e[31]!==d||e[32]!==i.slug||e[33]!==r||e[34]!==n||e[35]!==h||e[36]!==s?(X=async _e=>{ve.success(n("thread.headerActions.syncedWithBase",{base:_e.base})),await Promise.all([r.invalidateQueries({queryKey:m0({orgSlug:i.slug,virtualMcpId:s,branch:d??_e.branch,threadId:h??null})}),r.invalidateQueries({queryKey:tt.decofile(`${i.slug}/${s}/${_e.branch}`)})])},e[31]=d,e[32]=i.slug,e[33]=r,e[34]=n,e[35]=h,e[36]=s,e[37]=X):X=e[37];let se;e[38]!==Q||e[39]!==X?(se={mutationFn:Q,onSuccess:X,onError:Mhe},e[38]=Q,e[39]=X,e[40]=se):se=e[40];const ne=Es(se),te=j3(i.slug,s,d??"");if(v.status==="detached"){let _e;e[41]!==n?(_e=n("thread.headerActions.reconnectGithub"),e[41]=n,e[42]=_e):_e=e[42];let Ve;e[43]!==_e?(Ve=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{children:o.jsx(fe,{size:"sm",variant:"outline",disabled:!0,children:_e})})}),e[43]=_e,e[44]=Ve):Ve=e[44];let xe;e[45]!==n?(xe=n("thread.headerActions.githubConnectionRemoved"),e[45]=n,e[46]=xe):xe=e[46];let Se;e[47]!==xe?(Se=o.jsx(We,{children:xe}),e[47]=xe,e[48]=Se):Se=e[48];let Ce;return e[49]!==Ve||e[50]!==Se?(Ce=o.jsx(Ko,{children:o.jsxs(qe,{children:[Ve,Se]})}),e[49]=Ve,e[50]=Se,e[51]=Ce):Ce=e[51],Ce}if(!l)return null;if(!_||!y){const _e=_?"noPreviewServer":"noRepo";let Ve;e[52]!==d||e[53]!==f?(Ve=d?()=>{const Se=f?.({runtime:"sandbox",branch:d});Se&&Ge("coding_session_started",{thread_id:Se})}:void 0,e[52]=d,e[53]=f,e[54]=Ve):Ve=e[54];let xe;return e[55]!==_e||e[56]!==Ve?(xe=o.jsx($he,{reason:_e,onStartCodingSession:Ve}),e[55]=_e,e[56]=Ve,e[57]=xe):xe=e[57],xe}if(!d)return null;const ee=K.isPending,Y=Ehe({branch:V,pr:O,checks:M.data??[],reviews:z.data??null,publishing:ee,saving:te,syncing:ne.isPending,statusRetrying:N.isFetching&&!!N.error,statusError:N.error instanceof Error?N.error.message:N.error?String(N.error):null,loading:!!U,publishableChangeCount:E,t:n}),q=_e=>{switch(_e){case"publish":{b("publish");return}case"request-approval":{b("review");return}case"get-latest":{if(!R||ne.isPending)return;ne.mutate({branch:R,base:I});return}case"retry-status":{N.refetch();return}case"open-pr":{O?.htmlUrl&&window.open(O.htmlUrl,"_blank","noopener,noreferrer");return}}},oe=Y.menu.map(_e=>({key:_e.key,label:_e.label,icon:cy(_e.action,_e.key),..._e.tooltip?{tooltip:_e.tooltip}:{},onSelect:()=>q(_e.action)})),J=Y.action,ie=Tj,Z="sm",he=Y.label,de=Y.variant,ae=!!Y.disabled||!J,ce=!!Y.loading,ue=J&&!Y.loading?{icon:cy(J)}:{};let G;e[58]!==Y.tooltip?(G=Y.tooltip?{tooltip:Y.tooltip}:{},e[58]=Y.tooltip,e[59]=G):G=e[59];let me;e[60]!==n?(me=n("thread.cmsActions.moreActionsAriaLabel"),e[60]=n,e[61]=me):me=e[61];let ye;e[62]!==J||e[63]!==q?(ye=J?()=>q(J):void 0,e[62]=J,e[63]=q,e[64]=ye):ye=e[64];let we;e[65]!==ie||e[66]!==Y.label||e[67]!==Y.variant||e[68]!==oe||e[69]!==ae||e[70]!==ce||e[71]!==ue||e[72]!==G||e[73]!==me||e[74]!==ye?(we=o.jsx(ie,{size:Z,label:he,variant:de,disabled:ae,loading:ce,...ue,...G,items:oe,menuAriaLabel:me,onClick:ye}),e[65]=ie,e[66]=Y.label,e[67]=Y.variant,e[68]=oe,e[69]=ae,e[70]=ce,e[71]=ue,e[72]=G,e[73]=me,e[74]=ye,e[75]=we):we=e[75];const Ne=we;let je;return e[76]!==I||e[77]!==d||e[78]!==k||e[79]!==_||e[80]!==$||e[81]!==i.id||e[82]!==i.slug||e[83]!==O||e[84]!==K||e[85]!==W||e[86]!==Ne||e[87]!==p||e[88]!==s||e[89]!==l?.metadata?.publishPolicy?(je=o.jsx(o.Fragment,{children:d?o.jsx(yhe,{open:p.open,mode:p.mode,onOpenChange:_e=>{_e||g(Ihe)},orgSlug:i.slug,orgId:i.id,virtualMcpId:s,branch:d,baseBranch:I,githubConnectionId:_.connectionId??"",owner:_.owner,repo:_.name,publishPolicy:YL(l?.metadata?.publishPolicy),draftPreviewUrl:k.url,destinationHost:k.host,lastPublishedPr:$.data??null,onRequestApproval:()=>b("review"),openPullRequest:O?.state==="open"?O:null,onPullRequestChanged:W,onPublished:()=>K.mutateAsync(),children:Ne}):Ne}),e[76]=I,e[77]=d,e[78]=k,e[79]=_,e[80]=$,e[81]=i.id,e[82]=i.slug,e[83]=O,e[84]=K,e[85]=W,e[86]=Ne,e[87]=p,e[88]=s,e[89]=l?.metadata?.publishPolicy,e[90]=je):je=e[90],je}function Ihe(t){return{...t,open:!1}}function Mhe(t){ve.error(t instanceof Error?t.message:String(t))}function Ohe(t){ve.error(t instanceof Error?t.message:String(t))}function $he(t){const e=F.c(14),{reason:s,onStartCodingSession:n}=t,i=le(),r=!n;let l;e[0]!==i?(l=i("sandbox.cmsUnavailable.startCodingSession"),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==n||e[3]!==r||e[4]!==l?(a=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{children:o.jsx(fe,{size:"sm",variant:"outline",disabled:r,onClick:n,children:l})})}),e[2]=n,e[3]=r,e[4]=l,e[5]=a):a=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(We,{children:c}),e[9]=c,e[10]=d):d=e[10];let u;return e[11]!==a||e[12]!==d?(u=o.jsx(Ko,{children:o.jsxs(qe,{children:[a,d]})}),e[11]=a,e[12]=d,e[13]=u):u=e[13],u}const Bhe=new Set(["main","master"]);function zhe(t,e){return Bhe.has(t.trim().toLowerCase())?e("thread.headerActions.publishToProduction"):e("thread.headerActions.publish")}function Fhe(t){const e=F.c(10),[s,n]=A.useState(0);let i;e[0]!==t?(i=c=>{c&&n(Uhe),t.onOpenChange(c)},e[0]=t,e[1]=i):i=e[1];const r=i;let l;e[2]!==r||e[3]!==t||e[4]!==s?(l=t.open?o.jsx(Hhe,{...t,onOpenChange:r},s):null,e[2]=r,e[3]=t,e[4]=s,e[5]=l):l=e[5];let a;return e[6]!==r||e[7]!==t.open||e[8]!==l?(a=o.jsx(zt,{open:t.open,onOpenChange:r,children:l}),e[6]=r,e[7]=t.open,e[8]=l,e[9]=a):a=e[9],a}function Uhe(t){return t+1}function Hhe({onOpenChange:t,orgSlug:e,orgId:s,virtualMcpId:n,branch:i,baseBranch:r,githubConnectionId:l,owner:a,repo:c,previewUrl:d,publishPolicy:u,dialogIntent:h="open-pr",headSha:f=null,openPullRequest:m=null,onPullRequestChanged:p,onPublished:g}){const x=le(),b=Cs({connectionId:l,orgId:s,orgSlug:e}),v=Cs({connectionId:qc,orgId:s,orgSlug:e}),{data:_}=vn.useSession(),y=C7(v),L={orgSlug:e,virtualMcpId:n,branch:i,threadId:hs()?.taskId??null},w=hx(_?.user),S=m?.state==="open",k=m?.state==="open"?{number:m.number,htmlUrl:m.htmlUrl}:void 0,j=h==="open-pr"&&!S,C=h==="publish-only",[T,N]=A.useState(null),[P,V]=A.useState(null),[E,R]=A.useState(!0),[I,D]=A.useState(!1),[O,$]=A.useState(""),[M,z]=A.useState(""),[B,U]=A.useState(),[H,W]=A.useState(!1),[K,Q]=A.useState(),[X,se]=A.useState(!1),[ne,te]=A.useState(!1),[ee,Y]=A.useState(!1),q=A.useRef(!1),oe=A.useRef(!1),J={base:r,...f?{headSha:f}:{}},ie=async Ie=>{const Oe=(Ie.aheadOfBase??0)>0?await tu(L,J):null,mt=a3(Ie)?await tu(L):null;return fJ(Oe,mt)},Z=async()=>{const Ie=await Nc(L),Oe=C?await ie(Ie):await tu(L,hJ(Ie,{openPrFromCommits:j,commitToOpenPr:S})?J:void 0);N(Ie),V(Oe),$(x("thread.publishDialog.changesFrom",{branch:Ie.current??i})),Y(!0),H5(L,{status:Ie,diff:Oe}).then(mt=>{$(mt.title),z(mt.body)}).catch(()=>{}).finally(()=>Y(!1))};q.current||(q.current=!0,(async()=>{R(!0),U(void 0),V(null),$(""),z(""),Q(void 0);try{await Z()}catch(Ie){if(UL(Ie)&&!oe.current){oe.current=!0;try{await y.mutateAsync({virtualMcpId:n,branch:i}),await Z();return}catch(Oe){U(Oe instanceof Error?Oe.message:x("thread.publishDialog.failedLoadAfterReprovision"));return}}U(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedLoad"))}finally{R(!1)}})());const he=l3(T)??i,de=zhe(r,x),ae=()=>{!T||!P||(Y(!0),H5(L,{status:T,diff:P}).then(Ie=>{$(Ie.title),z(Ie.body)}).catch(()=>{}).finally(()=>Y(!1)))},ce=QL(T),ue=P?Object.keys(P.diffs).length:ce,{gate:G}=qj({orgSlug:e,virtualMcpId:n,branch:i,threadId:L.threadId,status:T,diff:P,policy:u,judgeEnabled:C}),me=j?XL(T):uJ(T,P),ye=!E&&(me||j),we=ye&&G.allowed,Ne=!ye||G.allowed?null:G.pending?x("thread.publishDialog.reviewingChanges"):G.reason??x("thread.publishDialog.publishNeedsReview"),je=j||!S&&(T?.aheadOfBase??0)>0,_e=!E&&(je||me)&&(ue>0||me),Ve={orgSlug:e,virtualMcpId:n,branch:i,threadId:L.threadId,baseBranch:r,githubClient:b,owner:a,repo:c,headBranch:he,coAuthor:w,existingOpenPr:k,expectedHeadSha:f??void 0},xe=()=>Bj({title:O,body:M,fallbackTitle:x("thread.publishDialog.changesFrom",{branch:he})}),Se=Ie=>{I||H||t(Ie)},Ce=async()=>{D(!0),U(void 0);try{await Hj(Ve,xe(),x),ve.success(x("thread.publishDialog.publishedTo",{baseBranch:r})),Se(!1),V(null),$(""),z(""),await p?.(),await g?.()}catch(Ie){const Oe=i2(Ie,x);U(Oe.message),Oe.pullRequestOpened&&await p?.()}finally{D(!1)}},Ae=async Ie=>{try{await ep(L,[Ie]),ve.success(x("thread.publishDialog.discardedChanges",{filepath:Ie})),V(mt=>{if(!mt)return mt;const lt={...mt,diffs:{...mt.diffs}};return delete lt.diffs[Ie],lt});const Oe=await Nc(L);N(Oe)}catch(Oe){ve.error(Oe instanceof Error?Oe.message:x("thread.publishDialog.failedDiscardChanges"))}},st=async()=>{if(P){se(!1),te(!0);try{const Ie=Object.keys(P.diffs);if(Ie.length===0)return;await ep(L,Ie),ve.success(x("thread.publishDialog.allChangesDiscarded")),V(null);const Oe=await Nc(L);N(Oe),Se(!1)}catch(Ie){ve.error(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedDiscardChanges"))}finally{te(!1)}}},Be=async()=>{W(!0),Q(void 0);try{const Ie=await Kj(Ve,xe());Wj(Ie,x),Se(!1),await p?.()}catch(Ie){Q(Ie instanceof Error?Ie.message:x("thread.publishDialog.failedSubmitForReview"))}finally{W(!1)}};return o.jsx(Bt,{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(na,{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:j?x("thread.publishDialog.submitForReview"):de}),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(j?"thread.publishDialog.inThisPr":"thread.publishDialog.toPublish")]})]}),X?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(fe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>se(!1),children:x("thread.publishDialog.cancel")}),o.jsxs(fe,{type:"button",size:"sm",className:"h-7 bg-destructive px-2 text-xs text-destructive-foreground hover:bg-destructive/90",onClick:st,disabled:ne,children:[ne?o.jsx(it,{className:"h-3 w-3"}):null,x("thread.publishDialog.discardAll")]})]})]}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(Jc,{className:"h-8 w-auto",variant:"pill",children:[o.jsx(ii,{value:"description",className:"px-3 text-xs",children:x("thread.publishDialog.description")}),o.jsx(ii,{value:"changes",className:"px-3 text-xs",children:x("thread.publishDialog.changesTab")})]}),ue>0&&!j&&o.jsx("button",{type:"button",className:"text-xs text-muted-foreground transition-colors hover:text-destructive disabled:opacity-50",onClick:()=>se(!0),disabled:I||ne,children:x("thread.publishDialog.discardAll")})]})]}),o.jsx("div",{className:"border-t"}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:E?o.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[o.jsx(it,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm",children:x("thread.publishDialog.loadingChanges")})]}):o.jsxs(o.Fragment,{children:[o.jsx(Cl,{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(j?"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:ee||I||H,onClick:ae,children:[ee?o.jsx(it,{className:"h-3 w-3"}):o.jsx(Kr,{className:"h-3 w-3"}),x(ee?"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:O,onChange:Ie=>$(Ie.target.value),placeholder:x(ee?"thread.publishDialog.generating":"thread.publishDialog.commitTitlePlaceholder"),disabled:I||H||ee,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:M,onChange:Ie=>z(Ie.target.value),placeholder:x(ee?"thread.publishDialog.generating":"thread.publishDialog.descriptionPlaceholder"),disabled:I||H||ee,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:C?x("thread.publishDialog.squashMergesInto",{publishLabel:de,baseBranch:r}):x("thread.publishDialog.opensPullRequestInto",{baseBranch:r})})]})]})}),o.jsx(Cl,{value:"changes",className:"mt-0",children:o.jsx(c3,{diff:P,onDiscardFile:Ae})})]})}),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(Qu,{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:C?o.jsxs(o.Fragment,{children:[o.jsx(Khe,{label:de,canPublish:we,disabledReason:Ne,isPublishing:I,onPublish:Ce}),B&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:B}),!we&&!G.pending&&_e&&o.jsxs(o.Fragment,{children:[o.jsxs(fe,{type:"button",variant:"outline",className:"mt-2 w-full",onClick:Be,disabled:H,children:[H?o.jsx(it,{className:"h-4 w-4"}):o.jsx(nr,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),K&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:K})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs(fe,{type:"button",className:"w-full",onClick:Be,disabled:!_e||H,children:[H?o.jsx(it,{className:"h-4 w-4"}):o.jsx(nr,{className:"h-4 w-4"}),x("thread.publishDialog.submitForReviewButton")]}),K&&o.jsx("p",{className:"mt-2 text-xs text-destructive",children:K})]})})]})})}function Khe(t){const e=F.c(14),{label:s,canPublish:n,disabledReason:i,isPublishing:r,onPublish:l}=t,a=!n||r;let c;e[0]!==r?(c=r?o.jsx(it,{className:"h-4 w-4"}):null,e[0]=r,e[1]=c):c=e[1];let d;e[2]!==s||e[3]!==l||e[4]!==a||e[5]!==c?(d=o.jsxs(fe,{type:"button",variant:"brand",className:"w-full",onClick:l,disabled:a,children:[c,s]}),e[2]=s,e[3]=l,e[4]=a,e[5]=c,e[6]=d):d=e[6];const u=d;if(!i)return u;let h;e[7]!==u?(h=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"flex w-full",children:u})}),e[7]=u,e[8]=h):h=e[8];let f;e[9]!==i?(f=o.jsx(We,{children:i}),e[9]=i,e[10]=f):f=e[10];let m;return e[11]!==h||e[12]!==f?(m=o.jsx(Ko,{children:o.jsxs(qe,{children:[h,f]})}),e[11]=h,e[12]=f,e[13]=m):m=e[13],m}function dy(t){switch(t){case"publish":return o.jsx(P6,{className:"size-4"});case"create-pr":case"reopen":return o.jsx(Hr,{className:"size-4"});case"rebase":case"sync":return o.jsx(On,{className:"size-4"});case"fix-checks":return o.jsx(sl,{className:"size-4"});case"mark-ready":return o.jsx(xr,{className:"size-4"});case"resolve-comments":return o.jsx(E6,{className:"size-4"});case"merge":return o.jsx(sg,{className:"size-4"});case"review":return o.jsx(Qu,{className:"size-4"});case"open-pr-page":return o.jsx(mn,{size:16})}}const uy=new Set(["reopen","rebase","fix-checks","mark-ready","resolve-comments","review","sync"]),hy=new Set(["publish","create-pr"]);function Whe(t){return{label:t("thread.headerActions.loadingBranch"),disabled:!0,loading:!0,variant:"outline",tooltip:t("thread.headerActions.waitingForSandboxBranchTooltip"),menu:[]}}function qhe({virtualMcpId:t}){const e=le(),{org:s}=He(),{data:n}=vn.useSession(),i=vs(t),{deleteRelease:r}=d9(t),{currentBranch:l,setCurrentTaskBranch:a,taskId:c}=on(),d=ai(),{openSidePanel:u}=Zl(),[h,f]=A.useState(!1),[m,p]=A.useState("open-pr"),[g,x]=A.useState(null),[b,v]=A.useState(!1),_=A.useRef(""),y=u6(i),L=y.status==="attached"||y.status==="public-clone"?y.repo:null,w=Cs({connectionId:L?.connectionId??"",orgId:s.id,orgSlug:s.slug}),{lifecycle:S,branch:k,phase:j}=hi(),C={orgSlug:s.slug,virtualMcpId:t,branch:l??"",threadId:c??null},N=Mt({queryKey:m0(C),queryFn:()=>Nc(C),enabled:!!l,staleTime:15e3,refetchInterval:J=>N1(J.state.data)?5e3:!1}).data??null,P=k,V=S,E=P.kind==="ready"?P.branch:null,R=l??E??void 0,I=(P.kind==="ready"?P.branch:null)??R??null,D=i0({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:I}),O=D.data??null,$=dg({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:I}),M=Qj({orgId:s.id,orgSlug:s.slug,connectionId:L?.connectionId??"",owner:L?.owner??"",repo:L?.name??"",branch:I}),z=P,B=YL(i?.metadata?.publishPolicy),U=j3(s.slug,t,l??R??""),{previewUrl:H}=rl();if(y.status==="detached")return o.jsx(Yhe,{label:e("thread.headerActions.githubConnectionRemoved"),children:o.jsx(fe,{size:"sm",variant:"outline",disabled:!0,children:e("thread.headerActions.reconnectGithub")})});if(!L)return null;const W=I?Vhe({lifecycle:V,branch:z,claimPhase:j,pr:O,checks:$.data??[],reviews:M.data??null,noReviewableDiff:N1(N),loading:Ph(D),t:e}):Whe(e),K=JSON.stringify({label:W.label,branchKind:z.kind,workingTreeDirty:z.kind==="ready"?z.workingTreeDirty:null,unpushed:z.kind==="ready"?z.unpushed:null,aheadOfBase:z.kind==="ready"?z.aheadOfBase:null,lifecycle:V.phase,githubHeadBranch:I,noReviewableDiff:N1(N)});_.current!==K&&(_.current=K,Yj("header button",{label:W.label,tooltip:W.tooltip,action:W.action,chatBranch:l,sandboxBranch:E,sandboxRouteBranch:R,githubHeadBranch:I,branchMeta:P,effectiveBranchMeta:z,lifecyclePhase:V.phase,prNumber:O?.number??null,prState:O?.state??null}));const Q=J=>(u(),d.sendMessage({parts:[{type:"text",text:J}]})),X=d.isStreaming,se=z.kind==="ready"?z.base:"main",ne=async()=>{await D.refetch()},te=async()=>{if(sd(i)){const ie=l;await a(se),ie&&ie!==se&&await r(ie);return}const J=Dl(a9(n?.user));await a(J)},ee=async J=>{if(!(!L?.connectionId||b)){v(!0);try{const ie=hx(n?.user);await B8(w,{owner:L.owner,repo:L.name,pullNumber:J,coAuthor:ie}),ve.success(e("thread.headerActions.publishedPr",{prNumber:String(J)})),await ne(),await te()}catch(ie){ve.error(ie instanceof Error?ie.message:e("thread.headerActions.failedToMergePullRequest"))}finally{v(!1)}}},Y=(J,ie)=>{p(J),x(ie),f(!0)},q=J=>{if(I)switch(J){case"publish":Y("publish-only",W.meta?.publishPolicyOverride??null);return;case"create-pr":Y("open-pr",null);return;case"merge":O&&ee(O.number);return;case"sync":if(X)return;Q(VJ({branch:I,base:se}));return;case"open-pr-page":O?.htmlUrl&&window.open(O.htmlUrl,"_blank","noopener,noreferrer");return;case"review":if(X)return;O&&Q(RJ({prNumber:O.number}));return;case"reopen":if(X)return;O&&Q(CJ({prNumber:O.number}));return;case"rebase":if(X)return;Q(NJ({branch:I}));return;case"fix-checks":if(X)return;O&&Q(AJ({prNumber:O.number,failingChecks:W.meta?.failingChecks??[]}));return;case"mark-ready":if(X)return;O&&Q(PJ({prNumber:O.number}));return;case"resolve-comments":if(X)return;O&&Q(EJ({prNumber:O.number}));return}},oe=b||X;return o.jsxs(o.Fragment,{children:[o.jsx(Ghe,{t:e,button:W,actionBusy:oe,githubActionPending:b,savePending:U,onAction:q}),R&&o.jsx(Fhe,{open:h,onOpenChange:f,orgSlug:s.slug,orgId:s.id,virtualMcpId:t,branch:R,baseBranch:se,githubConnectionId:L.connectionId??"",owner:L.owner,repo:L.name,previewUrl:H,publishPolicy:g??B,dialogIntent:m,headSha:z.kind==="ready"?z.headSha:null,openPullRequest:O?.state==="open"?O:null,onPullRequestChanged:ne,onPublished:te})]})}function Ghe(t){const e=F.c(44),{t:s,button:n,actionBusy:i,githubActionPending:r,savePending:l,onAction:a}=t,c=n.action;let d;e[0]!==c||e[1]!==i?(d=i&&c!==void 0&&uy.has(c),e[0]=c,e[1]=i,e[2]=d):d=e[2];const u=d,h=r&&c==="merge";let f;e[3]!==c||e[4]!==l?(f=l&&c!==void 0&&hy.has(c),e[3]=c,e[4]=l,e[5]=f):f=e[5];const m=f,p=!!n.disabled||u||h||m||!c,g=!!n.loading||h;let x;e[6]!==n.tooltip||e[7]!==u||e[8]!==m||e[9]!==s?(x=u?s("thread.headerActions.chatIsRunning"):m?s("thread.headerActions.saving"):n.tooltip,e[6]=n.tooltip,e[7]=u,e[8]=m,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]!==a||e[15]!==l||e[16]!==s){let T;e[18]!==i||e[19]!==r||e[20]!==a||e[21]!==l||e[22]!==s?(T=N=>{const P=i&&uy.has(N.action),V=l&&hy.has(N.action),E=N.action==="merge"&&r,R=V?s("thread.headerActions.saving"):P?s("thread.headerActions.chatIsRunning"):N.tooltip;return{key:N.key,label:N.label,icon:dy(N.action),disabled:!!(P||V||E),...R?{tooltip:R}:{},onSelect:()=>a(N.action)}},e[18]=i,e[19]=r,e[20]=a,e[21]=l,e[22]=s,e[23]=T):T=e[23],v=n.menu.map(T),e[11]=i,e[12]=n.menu,e[13]=r,e[14]=a,e[15]=l,e[16]=s,e[17]=v}else v=e[17];const _=v,y=n.label,L=n.variant;let w;e[24]!==c||e[25]!==g?(w=c&&!g?{icon:dy(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]!==a?(j=c?()=>a(c):void 0,e[31]=c,e[32]=a,e[33]=j):j=e[33];let C;return e[34]!==n.label||e[35]!==n.variant||e[36]!==p||e[37]!==_||e[38]!==g||e[39]!==w||e[40]!==S||e[41]!==k||e[42]!==j?(C=o.jsx(Tj,{size:"sm",label:y,variant:L,disabled:p,loading:g,...w,...S,items:_,menuAriaLabel:k,onClick:j}),e[34]=n.label,e[35]=n.variant,e[36]=p,e[37]=_,e[38]=g,e[39]=w,e[40]=S,e[41]=k,e[42]=j,e[43]=C):C=e[43],C}function Yhe(t){const e=F.c(9),{label:s,children:n}=t;if(!s){let a;return e[0]!==n?(a=o.jsx(o.Fragment,{children:n}),e[0]=n,e[1]=a):a=e[1],a}let i;e[2]!==n?(i=o.jsx(Ke,{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(We,{children:s}),e[4]=s,e[5]=r):r=e[5];let l;return e[6]!==i||e[7]!==r?(l=o.jsx(Ko,{children:o.jsxs(qe,{children:[i,r]})}),e[6]=i,e[7]=r,e[8]=l):l=e[8],l}function Jhe(t){const e=F.c(9),{virtualMcp:s}=t,n=Gc(),{navigateToTask:i}=pN(),{create:r}=$u();let l,a;if(e[0]!==n||e[1]!==r||e[2]!==i||e[3]!==s){a=Symbol.for("react.early_return_sentinel");e:{const c=rA(s,n);if(!c){a=null;break e}const d=c.mode==="dev";let u;e[6]!==r||e[7]!==i?(u=async m=>{const p=crypto.randomUUID();try{await r({id:p,virtual_mcp_id:m})}catch{}i(p,{virtualMcpId:m})},e[6]=r,e[7]=i,e[8]=u):u=e[8];const h=u,f=(m,p,g)=>o.jsxs("button",{type:"button","aria-pressed":p,"aria-label":m,title:m,onClick:()=>{p||h(c.targetId)},className:re("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md transition-colors",p?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(g,{className:"size-3.5 shrink-0"}),o.jsx("span",{className:"@max-3xl/panel-header:hidden",children:m})]});l=o.jsxs("div",{className:"inline-flex items-center rounded-lg border border-border bg-muted p-0.5 text-xs font-medium",children:[f("Develop",d,ta),f("Live",!d,zn)]})}e[0]=n,e[1]=r,e[2]=i,e[3]=s,e[4]=l,e[5]=a}else l=e[4],a=e[5];return a!==Symbol.for("react.early_return_sentinel")?a:l}function Qhe(t){const e=F.c(11),{virtualMcp:s}=t,n=yn(s.id).runtime==="cms",i=qu();let r;e[0]!==i?(r=!!i&&L2(i),e[0]=i,e[1]=r):r=e[1];const l=r;let a;e[2]!==s?(a=o.jsx(Jhe,{virtualMcp:s}),e[2]=s,e[3]=a):a=e[3];let c;e[4]!==n||e[5]!==l||e[6]!==s?(c=l&&oA(s)?n?o.jsx(Dhe,{virtualMcpId:s.id}):o.jsx(qhe,{virtualMcpId:s.id}):null,e[4]=n,e[5]=l,e[6]=s,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==c?(d=o.jsxs("div",{className:"flex items-center gap-2",children:[a,c]}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d}const Xhe=10080*60*1e3;function Zhe({sandboxMap:t,userId:e,rawBranches:s,now:n}){const i=new Map;for(const[h,f]of Object.entries(t??{}))for(const[m,p]of Object.entries(f??{})){let g=i.get(m);g||(g={userIds:new Set,lastActiveAt:0},i.set(m,g)),g.userIds.add(h);for(const x of Object.values(p??{})){const b=x?.createdAt??0;b>g.lastActiveAt&&(g.lastActiveAt=b)}}const r=n-Xhe,l=[...i.entries()].filter(([,h])=>h.lastActiveAt>=r).sort((h,f)=>f[1].lastActiveAt-h[1].lastActiveAt).map(([h,f])=>({name:h,source:"recent",contributors:[...f.userIds],lastActiveAt:f.lastActiveAt})),a=new Set(l.map(h=>h.name)),c=new Set(Object.keys(t?.[e]??{})),d=[...c].filter(h=>!a.has(h)).sort().map(h=>({name:h,source:"yours"})),u=s.filter(h=>!c.has(h.name)&&!a.has(h.name)).map(h=>({name:h.name,source:"other",author:h.author??null}));return{recent:l,yours:d,others:u}}function efe(t){const e=new Map;for(const s of t??[])for(const n of s.branches)typeof n.name=="string"&&e.set(n.name,n);return[...e.values()].map(s=>({name:s.name,author:typeof s.commit?.author=="string"?s.commit.author:s.commit?.author?.login??null}))}const Xj=100,tfe=50,sfe=300;function Af(t,e){const s=e.trim().toLowerCase();return s?t.toLowerCase().includes(s):!0}function nfe(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(n=>n.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function Zj(t){const e=F.c(65),{orgId:s,orgSlug:n,userId:i,connectionId:r,sandboxMap:l,owner:a,repo:c,search:d,enabled:u}=t,h=d===void 0?"":d,f=u===void 0?!0:u,m=r??null;let p;e[0]!==s||e[1]!==n||e[2]!==m?(p={connectionId:m,orgId:s,orgSlug:n},e[0]=s,e[1]=n,e[2]=m,e[3]=p):p=e[3];const g=Cs(p);let x;e[4]!==h?(x=h.trim(),e[4]=h,e[5]=x):x=e[5];const b=x,v=l9(b,sfe),_=!!r&&!!a&&!!c,y=b.length>0;let L;e[6]!==r||e[7]!==s||e[8]!==n||e[9]!==a||e[10]!==c?(L=tt.githubBranches(s,n,r,a,c),e[6]=r,e[7]=s,e[8]=n,e[9]=a,e[10]=c,e[11]=L):L=e[11];const w=f&&_&&!y;let S;e[12]!==g||e[13]!==a||e[14]!==c?(S=async q=>{const{pageParam:oe,signal:J}=q,ie=Number(oe),Z=await g.callTool({name:"list_branches",arguments:{owner:a,repo:c,page:ie,perPage:Xj}},void 0,{signal:J}),he=nfe(Z);return{branches:Array.isArray(he)?he:he.branches??[],default_branch:Array.isArray(he)?null:he.default_branch??null,page:ie}},e[12]=g,e[13]=a,e[14]=c,e[15]=S):S=e[15];let k;e[16]!==L||e[17]!==w||e[18]!==S?(k={queryKey:L,enabled:w,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:S,getNextPageParam:ife},e[16]=L,e[17]=w,e[18]=S,e[19]=k):k=e[19];const{data:j,isLoading:C,isError:T,hasNextPage:N,isFetchingNextPage:P,fetchNextPage:V}=b8(k);let E;e[20]!==r||e[21]!==v||e[22]!==s||e[23]!==n||e[24]!==a||e[25]!==c?(E=tt.githubBranchSearch(s,n,r,a,c,v),e[20]=r,e[21]=v,e[22]=s,e[23]=n,e[24]=a,e[25]=c,e[26]=E):E=e[26];const R=f&&_&&v.length>0;let I;e[27]!==r||e[28]!==v||e[29]!==n||e[30]!==a||e[31]!==c?(I=()=>o2(n,"GITHUB_SEARCH_BRANCHES",{connectionId:r,owner:a,repo:c,query:v,limit:tfe}),e[27]=r,e[28]=v,e[29]=n,e[30]=a,e[31]=c,e[32]=I):I=e[32];let D;e[33]!==E||e[34]!==R||e[35]!==I?(D={queryKey:E,enabled:R,staleTime:3e4,retry:!1,queryFn:I},e[33]=E,e[34]=R,e[35]=I,e[36]=D):D=e[36];const{data:O,isLoading:$,isError:M,isFetching:z}=Mt(D),B=y&&(v!==b||z);let U,H,W;if(e[37]!==j?.pages||e[38]!==l||e[39]!==O||e[40]!==b||e[41]!==i){const q=O?O.branches:efe(j?.pages);U=Zhe({sandboxMap:l,userId:i,rawBranches:q,now:Date.now()});let oe;e[45]!==b?(oe=ie=>Af(ie.name,b),e[45]=b,e[46]=oe):oe=e[46],H=U.recent.filter(oe);let J;e[47]!==b?(J=ie=>Af(ie.name,b),e[47]=b,e[48]=J):J=e[48],W=U.yours.filter(J),e[37]=j?.pages,e[38]=l,e[39]=O,e[40]=b,e[41]=i,e[42]=U,e[43]=H,e[44]=W}else U=e[42],H=e[43],W=e[44];const K=W,Q=U.others,X=O&&!B?Math.max(0,O.totalCount-O.branches.length):0,se=y?$:C,ne=y?M:T,te=!y&&(N??!1);let ee;e[49]!==V||e[50]!==N||e[51]!==P||e[52]!==y?(ee=()=>{!y&&N&&!P&&V()},e[49]=V,e[50]=N,e[51]=P,e[52]=y,e[53]=ee):ee=e[53];let Y;return e[54]!==X||e[55]!==P||e[56]!==B||e[57]!==Q||e[58]!==H||e[59]!==se||e[60]!==ne||e[61]!==te||e[62]!==ee||e[63]!==K?(Y={recent:H,yours:K,others:Q,isLoading:se,isError:ne,isSearching:B,hiddenMatchCount:X,hasMore:te,isFetchingMore:P,fetchMore:ee},e[54]=X,e[55]=P,e[56]=B,e[57]=Q,e[58]=H,e[59]=se,e[60]=ne,e[61]=te,e[62]=ee,e[63]=K,e[64]=Y):Y=e[64],Y}function ife(t){if(!(t.branches.length<Xj))return t.page+1}function rfe(t){const e=F.c(174),{virtualMcpId:s,userLabel:n,value:i,baseBranch:r,orgId:l,orgSlug:a,userId:c,connectionId:d,owner:u,repo:h,sandboxMap:f,onChange:m,onCreateBranch:p,disabled:g,spawnsNewChat:x,placement:b}=t,v=g===void 0?!1:g,_=x===void 0?!1:x,y=b===void 0?"chat":b,L=le(),w=y==="header",[S,k]=A.useState(!1),[j,C]=A.useState(!1),[T,N]=A.useState(null),[P,V]=A.useState(""),[E,R]=A.useState(null),{releases:I,createRelease:D,renameRelease:O,deleteRelease:$}=d9(s),M=!!i&&i===r;let z,B,U,H,W,K,Q,X,se,ne,te,ee,Y,q,oe,J,ie,Z,he,de,ae,ce,ue,G,me;if(e[0]!==r||e[1]!==D||e[2]!==$||e[3]!==v||e[4]!==P||e[5]!==M||e[6]!==w||e[7]!==m||e[8]!==p||e[9]!==S||e[10]!==E||e[11]!==I||e[12]!==O||e[13]!==L||e[14]!==n||e[15]!==i){let ze;e[41]!==i?(ze=ke=>ke.branch===i,e[41]=i,e[42]=ze):ze=e[42];const yt=I.find(ze);me=!M&&!yt&&!!i;const At=M?L("thread.branchPicker.live"):yt?.name??L("thread.branchPicker.defaultVersionName");se=i?At:L("thread.branchPicker.selectVersion");const ht=M?"bg-success":Cm(yt?.color??"orange");let ft;e[43]!==m?(ft=ke=>{m(ke),k(!1)},e[43]=m,e[44]=ft):ft=e[44],ne=ft;let at;e[45]!==D||e[46]!==m||e[47]!==I?(at=(ke,ot)=>{I.some(Le=>Le.branch===ke)||D({branch:ke,name:ot.trim()||ke,color:jm(I.length),createdAt:new Date().toISOString()}),m(ke),C(!1),k(!1)},e[45]=D,e[46]=m,e[47]=I,e[48]=at):at=e[48],K=at;let pt;e[49]!==D||e[50]!==m||e[51]!==p||e[52]!==I||e[53]!==L||e[54]!==n?(pt=()=>{const ke=Dl(n);D({branch:ke,name:F8(I,L("thread.branchPicker.defaultVersionName")),color:jm(I.length),createdAt:new Date().toISOString()}),(p??m)(ke),k(!1)},e[49]=D,e[50]=m,e[51]=p,e[52]=I,e[53]=L,e[54]=n,e[55]=pt):pt=e[55],X=pt;let Lt;e[56]===Symbol.for("react.memo_cache_sentinel")?(Lt=()=>{N(null),V(""),C(!1)},e[56]=Lt):Lt=e[56];const bt=Lt;let Ft;e[57]===Symbol.for("react.memo_cache_sentinel")?(Ft=ke=>{N(ke.branch),V(ke.name)},e[57]=Ft):Ft=e[57],ee=Ft;let ge;e[58]!==P||e[59]!==O?(ge=ke=>{const ot=P.trim();ot&&O(ke,ot),N(null),V("")},e[58]=P,e[59]=O,e[60]=ge):ge=e[60],te=ge;let Ee;e[61]!==r||e[62]!==$||e[63]!==E||e[64]!==ne||e[65]!==i?(Ee=()=>{const ke=E;R(null),ke&&(ke.branch===i&&r?ne(r):k(!1),$(ke.branch))},e[61]=r,e[62]=$,e[63]=E,e[64]=ne,e[65]=i,e[66]=Ee):Ee=e[66],Q=Ee,W=cs,ie=S,e[67]!==v?(Z=v?void 0:ke=>{ke||bt(),k(ke)},e[67]=v,e[68]=Z):Z=e[68],H=qe,U=Ke,J=!0,oe="inline-flex min-w-0 shrink",B=os,q=!0,z=fe,de=Xf.branchPicker,ae=w?"outline":"ghost",ce=w?"sm":"default",ue=se,G=v;const Re=w?"text-xs":"text-xs text-muted-foreground hover:text-foreground";e[69]!==Re?(Y=re("shrink min-w-0 max-w-[220px] gap-2",Re,ng),e[69]=Re,e[70]=Y):Y=e[70],he=re("h-2 w-2 shrink-0 rounded-full",i?ht:"bg-muted-foreground"),e[0]=r,e[1]=D,e[2]=$,e[3]=v,e[4]=P,e[5]=M,e[6]=w,e[7]=m,e[8]=p,e[9]=S,e[10]=E,e[11]=I,e[12]=O,e[13]=L,e[14]=n,e[15]=i,e[16]=z,e[17]=B,e[18]=U,e[19]=H,e[20]=W,e[21]=K,e[22]=Q,e[23]=X,e[24]=se,e[25]=ne,e[26]=te,e[27]=ee,e[28]=Y,e[29]=q,e[30]=oe,e[31]=J,e[32]=ie,e[33]=Z,e[34]=he,e[35]=de,e[36]=ae,e[37]=ce,e[38]=ue,e[39]=G,e[40]=me}else z=e[16],B=e[17],U=e[18],H=e[19],W=e[20],K=e[21],Q=e[22],X=e[23],se=e[24],ne=e[25],te=e[26],ee=e[27],Y=e[28],q=e[29],oe=e[30],J=e[31],ie=e[32],Z=e[33],he=e[34],de=e[35],ae=e[36],ce=e[37],ue=e[38],G=e[39],me=e[40];let ye;e[71]!==he?(ye=o.jsx("span",{className:he}),e[71]=he,e[72]=ye):ye=e[72];let we;e[73]!==se?(we=o.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:se}),e[73]=se,e[74]=we):we=e[74];let Ne;e[75]!==v?(Ne=!v&&o.jsx(bs,{size:12,className:"opacity-60 shrink-0"}),e[75]=v,e[76]=Ne):Ne=e[76];let je;e[77]!==z||e[78]!==Y||e[79]!==ye||e[80]!==we||e[81]!==Ne||e[82]!==de||e[83]!==ae||e[84]!==ce||e[85]!==ue||e[86]!==G?(je=o.jsxs(z,{"data-tour":de,variant:ae,size:ce,"aria-label":ue,disabled:G,className:Y,children:[ye,we,Ne]}),e[77]=z,e[78]=Y,e[79]=ye,e[80]=we,e[81]=Ne,e[82]=de,e[83]=ae,e[84]=ce,e[85]=ue,e[86]=G,e[87]=je):je=e[87];let _e;e[88]!==B||e[89]!==q||e[90]!==je?(_e=o.jsx(B,{asChild:q,children:je}),e[88]=B,e[89]=q,e[90]=je,e[91]=_e):_e=e[91];let Ve;e[92]!==oe||e[93]!==_e?(Ve=o.jsx("span",{className:oe,children:_e}),e[92]=oe,e[93]=_e,e[94]=Ve):Ve=e[94];let xe;e[95]!==U||e[96]!==J||e[97]!==Ve?(xe=o.jsx(U,{asChild:J,children:Ve}),e[95]=U,e[96]=J,e[97]=Ve,e[98]=xe):xe=e[98];let Se;e[99]!==se?(Se=o.jsx(We,{children:se}),e[99]=se,e[100]=Se):Se=e[100];let Ce;e[101]!==H||e[102]!==xe||e[103]!==Se?(Ce=o.jsxs(H,{children:[xe,Se]}),e[101]=H,e[102]=xe,e[103]=Se,e[104]=Ce):Ce=e[104];let Ae;e[105]!==_||e[106]!==L?(Ae=_&&o.jsx("p",{className:"px-2 pb-1.5 pt-1 text-xs text-muted-foreground",children:L("thread.branchPicker.newChatHint")}),e[105]=_,e[106]=L,e[107]=Ae):Ae=e[107];let st;e[108]!==K||e[109]!==j||e[110]!==r||e[111]!==d||e[112]!==X||e[113]!==P||e[114]!==T||e[115]!==M||e[116]!==S||e[117]!==l||e[118]!==a||e[119]!==u||e[120]!==ne||e[121]!==I||e[122]!==h||e[123]!==f||e[124]!==te||e[125]!==ee||e[126]!==L||e[127]!==me||e[128]!==c||e[129]!==i?(st=j?o.jsx(afe,{orgId:l,orgSlug:a,userId:c,connectionId:d,owner:u,repo:h,sandboxMap:f,enabled:S,onBack:()=>C(!1),onAdopt:K}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx(fy,{dot:"bg-success",label:L("thread.branchPicker.live"),branch:r,selected:M,disabled:!r,onSelect:()=>r&&ne(r)}),(me||I.length>0)&&o.jsx("div",{className:"my-1 border-t"}),me&&o.jsx(fy,{dot:Cm("orange"),label:L("thread.branchPicker.defaultVersionName"),branch:i,selected:!0,onSelect:()=>i&&ne(i)}),I.map(ze=>T===ze.branch?o.jsxs("div",{className:"flex items-center gap-1.5 p-1",children:[o.jsx("input",{autoFocus:!0,"aria-label":L("thread.branchPicker.rename"),value:P,onChange:yt=>V(yt.target.value),onKeyDown:yt=>{yt.key==="Enter"&&te(ze.branch),yt.key==="Escape"&&(yt.preventDefault(),yt.stopPropagation(),N(null))},className:"h-8 flex-1 rounded-md border bg-transparent px-2 text-sm outline-none focus:ring-1 focus:ring-ring"}),o.jsx(fe,{size:"sm",onClick:()=>{te(ze.branch)},children:L("thread.branchPicker.save")})]},ze.branch):o.jsx(lfe,{release:ze,selected:ze.branch===i,onSelect:()=>ne(ze.branch),onRename:()=>ee(ze),onDelete:()=>R(ze)},ze.branch))]}),o.jsx("div",{className:"my-1 border-t"}),o.jsxs("button",{type:"button",onClick:()=>{X()},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(Gt,{className:"h-4 w-4 shrink-0"}),L("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:[L("thread.branchPicker.advanced"),o.jsx(Ws,{className:"h-4 w-4 shrink-0"})]})]}),e[108]=K,e[109]=j,e[110]=r,e[111]=d,e[112]=X,e[113]=P,e[114]=T,e[115]=M,e[116]=S,e[117]=l,e[118]=a,e[119]=u,e[120]=ne,e[121]=I,e[122]=h,e[123]=f,e[124]=te,e[125]=ee,e[126]=L,e[127]=me,e[128]=c,e[129]=i,e[130]=st):st=e[130];let Be;e[131]!==Ae||e[132]!==st?(Be=o.jsxs(as,{className:"w-[min(300px,calc(100vw-2rem))] p-1.5",align:"start",onOpenAutoFocus:ofe,children:[Ae,st]}),e[131]=Ae,e[132]=st,e[133]=Be):Be=e[133];let Ie;e[134]!==W||e[135]!==ie||e[136]!==Z||e[137]!==Ce||e[138]!==Be?(Ie=o.jsxs(W,{open:ie,onOpenChange:Z,children:[Ce,Be]}),e[134]=W,e[135]=ie,e[136]=Z,e[137]=Ce,e[138]=Be,e[139]=Ie):Ie=e[139];const Oe=Ie,mt=E!==null;let lt;e[140]===Symbol.for("react.memo_cache_sentinel")?(lt=ze=>{ze||R(null)},e[140]=lt):lt=e[140];let Xe;e[141]!==L?(Xe=L("thread.branchPicker.deleteTitle"),e[141]=L,e[142]=Xe):Xe=e[142];let nt;e[143]!==Xe?(nt=o.jsx(Jr,{children:Xe}),e[143]=Xe,e[144]=nt):nt=e[144];let Fe;e[145]!==E||e[146]!==L?(Fe=E&&L("thread.branchPicker.deleteConfirm",{name:E.name}),e[145]=E,e[146]=L,e[147]=Fe):Fe=e[147];let dt;e[148]!==Fe?(dt=o.jsx(Qr,{children:Fe}),e[148]=Fe,e[149]=dt):dt=e[149];let et;e[150]!==nt||e[151]!==dt?(et=o.jsxs(Yr,{children:[nt,dt]}),e[150]=nt,e[151]=dt,e[152]=et):et=e[152];let rt;e[153]!==L?(rt=L("thread.branchPicker.cancel"),e[153]=L,e[154]=rt):rt=e[154];let gt;e[155]!==rt?(gt=o.jsx(Zr,{children:rt}),e[155]=rt,e[156]=gt):gt=e[156];let pe;e[157]!==L?(pe=L("thread.branchPicker.delete"),e[157]=L,e[158]=pe):pe=e[158];let Me;e[159]!==Q||e[160]!==pe?(Me=o.jsx(eo,{onClick:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:pe}),e[159]=Q,e[160]=pe,e[161]=Me):Me=e[161];let Ze;e[162]!==gt||e[163]!==Me?(Ze=o.jsxs(Xr,{children:[gt,Me]}),e[162]=gt,e[163]=Me,e[164]=Ze):Ze=e[164];let ct;e[165]!==et||e[166]!==Ze?(ct=o.jsxs(Gr,{children:[et,Ze]}),e[165]=et,e[166]=Ze,e[167]=ct):ct=e[167];let _t;e[168]!==mt||e[169]!==ct?(_t=o.jsx(qr,{open:mt,onOpenChange:lt,children:ct}),e[168]=mt,e[169]=ct,e[170]=_t):_t=e[170];let wt;return e[171]!==Oe||e[172]!==_t?(wt=o.jsxs(o.Fragment,{children:[Oe,_t]}),e[171]=Oe,e[172]=_t,e[173]=wt):wt=e[173],wt}function ofe(t){return t.preventDefault()}function fy(t){const e=F.c(23),{dot:s,label:n,branch:i,selected:r,disabled:l,onSelect:a}=t,c=r===void 0?!1:r,d=l===void 0?!1:l,u=c?"bg-accent":"hover:bg-accent/60",h=d&&"cursor-not-allowed opacity-50";let f;e[0]!==u||e[1]!==h?(f=re("flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm transition-colors",u,h),e[0]=u,e[1]=h,e[2]=f):f=e[2];let m;e[3]!==s?(m=re("h-2 w-2 shrink-0 rounded-full",s),e[3]=s,e[4]=m):m=e[4];let p;e[5]!==m?(p=o.jsx("span",{className:m}),e[5]=m,e[6]=p):p=e[6];let g;e[7]!==n?(g=o.jsx("span",{className:"flex-1 truncate",children:n}),e[7]=n,e[8]=g):g=e[8];let x;e[9]!==d||e[10]!==a||e[11]!==c||e[12]!==f||e[13]!==p||e[14]!==g?(x=o.jsxs("button",{type:"button",disabled:d,"aria-pressed":c,onClick:a,className:f,children:[p,g]}),e[9]=d,e[10]=a,e[11]=c,e[12]=f,e[13]=p,e[14]=g,e[15]=x):x=e[15];const b=x;if(!i)return b;let v;e[16]!==b?(v=o.jsx(Ke,{asChild:!0,children:b}),e[16]=b,e[17]=v):v=e[17];let _;e[18]!==i?(_=o.jsx(We,{side:"bottom",className:"font-mono text-xs",children:i}),e[18]=i,e[19]=_):_=e[19];let y;return e[20]!==v||e[21]!==_?(y=o.jsxs(qe,{children:[v,_]}),e[20]=v,e[21]=_,e[22]=y):y=e[22],y}function lfe(t){const e=F.c(45),{release:s,selected:n,onSelect:i,onRename:r,onDelete:l}=t,a=le(),c=n?"bg-accent":"hover:bg-accent/60";let d;e[0]!==c?(d=re("group flex items-center rounded-md",c),e[0]=c,e[1]=d):d=e[1];let u;e[2]!==s.color?(u=re("h-2 w-2 shrink-0 rounded-full",Cm(s.color)),e[2]=s.color,e[3]=u):u=e[3];let h;e[4]!==u?(h=o.jsx("span",{className:u}),e[4]=u,e[5]=h):h=e[5];let f;e[6]!==s.name?(f=o.jsx("span",{className:"flex-1 truncate",children:s.name}),e[6]=s.name,e[7]=f):f=e[7];let m;e[8]!==i||e[9]!==n||e[10]!==h||e[11]!==f?(m=o.jsx(Ke,{asChild:!0,children:o.jsxs("button",{type:"button","aria-pressed":n,onClick:i,className:"flex min-w-0 flex-1 items-center gap-2.5 px-2 py-2 text-left text-sm",children:[h,f]})}),e[8]=i,e[9]=n,e[10]=h,e[11]=f,e[12]=m):m=e[12];let p;e[13]!==s.branch?(p=o.jsx(We,{side:"bottom",className:"font-mono text-xs",children:s.branch}),e[13]=s.branch,e[14]=p):p=e[14];let g;e[15]!==m||e[16]!==p?(g=o.jsxs(qe,{children:[m,p]}),e[15]=m,e[16]=p,e[17]=g):g=e[17];let x;e[18]!==a?(x=a("thread.branchPicker.moreActions"),e[18]=a,e[19]=x):x=e[19];let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(o9,{className:"h-4 w-4"}),e[20]=b):b=e[20];let v;e[21]!==x?(v=o.jsx(Ht,{asChild:!0,children:o.jsx(fe,{variant:"ghost",size:"icon","aria-label":x,className:"mr-1 h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",children:b})}),e[21]=x,e[22]=v):v=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(r9,{className:"h-4 w-4"}),e[23]=_):_=e[23];let y;e[24]!==a?(y=a("thread.branchPicker.rename"),e[24]=a,e[25]=y):y=e[25];let L;e[26]!==r||e[27]!==y?(L=o.jsxs(Je,{onSelect:r,children:[_,y]}),e[26]=r,e[27]=y,e[28]=L):L=e[28];let w;e[29]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(nn,{className:"h-4 w-4"}),e[29]=w):w=e[29];let S;e[30]!==a?(S=a("thread.branchPicker.delete"),e[30]=a,e[31]=S):S=e[31];let k;e[32]!==l||e[33]!==S?(k=o.jsxs(Je,{onSelect:l,className:"text-destructive focus:text-destructive",children:[w,S]}),e[32]=l,e[33]=S,e[34]=k):k=e[34];let j;e[35]!==L||e[36]!==k?(j=o.jsxs(Kt,{align:"end",children:[L,k]}),e[35]=L,e[36]=k,e[37]=j):j=e[37];let C;e[38]!==v||e[39]!==j?(C=o.jsxs(Ut,{children:[v,j]}),e[38]=v,e[39]=j,e[40]=C):C=e[40];let T;return e[41]!==C||e[42]!==d||e[43]!==g?(T=o.jsxs("div",{className:d,children:[g,C]}),e[41]=C,e[42]=d,e[43]=g,e[44]=T):T=e[44],T}function afe(t){const e=F.c(94),{orgId:s,orgSlug:n,userId:i,connectionId:r,owner:l,repo:a,sandboxMap:c,enabled:d,onBack:u,onAdopt:h}=t,f=le(),[m,p]=A.useState("branches"),[g,x]=A.useState(""),b=m==="branches"?g:"",v=d&&m==="branches";let _;e[0]!==r||e[1]!==s||e[2]!==n||e[3]!==l||e[4]!==a||e[5]!==c||e[6]!==b||e[7]!==v||e[8]!==i?(_={orgId:s,orgSlug:n,userId:i,connectionId:r,sandboxMap:c,owner:l,repo:a,search:b,enabled:v},e[0]=r,e[1]=s,e[2]=n,e[3]=l,e[4]=a,e[5]=c,e[6]=b,e[7]=v,e[8]=i,e[9]=_):_=e[9];const{recent:y,yours:L,others:w,isLoading:S,hasMore:k,isFetchingMore:j,fetchMore:C}=Zj(_),T=r??"",N=d&&m==="prs";let P;e[10]!==s||e[11]!==n||e[12]!==l||e[13]!==a||e[14]!==T||e[15]!==N?(P={orgId:s,orgSlug:n,connectionId:T,owner:l,repo:a,enabled:N},e[10]=s,e[11]=n,e[12]=l,e[13]=a,e[14]=T,e[15]=N,e[16]=P):P=e[16];const{data:V,isLoading:E}=z8(P);let R,I,D,O,$,M,z,B,U;if(e[17]!==C||e[18]!==k||e[19]!==j||e[20]!==S||e[21]!==h||e[22]!==u||e[23]!==w||e[24]!==l||e[25]!==E||e[26]!==y||e[27]!==a||e[28]!==g||e[29]!==f||e[30]!==V||e[31]!==m||e[32]!==L){const Q=V===void 0?[]:V,X=`${l}/${a}`;let se;e[42]!==X?(se=X.toLowerCase(),e[42]=X,e[43]=se):se=e[43];const ne=se;let te;e[44]!==ne?(te=G=>G.headRepoFullName?.toLowerCase()===ne,e[44]=ne,e[45]=te):te=e[45];const ee=Q.filter(te);let Y;if(e[46]!==w||e[47]!==y||e[48]!==L){const G=new Set;Y=[...y,...L,...w].filter(me=>G.has(me.name)?!1:(G.add(me.name),!0)),e[46]=w,e[47]=y,e[48]=L,e[49]=Y}else Y=e[49];const q=Y;M="flex flex-col";let oe;e[50]===Symbol.for("react.memo_cache_sentinel")?(oe=o.jsx($h,{className:"h-4 w-4 shrink-0"}),e[50]=oe):oe=e[50];let J;e[51]!==f?(J=f("thread.branchPicker.advancedBack"),e[51]=f,e[52]=J):J=e[52],e[53]!==u||e[54]!==J?(z=o.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground",children:[oe,J]}),e[53]=u,e[54]=J,e[55]=z):z=e[55],I=Ii,D=m==="branches"?cfe:void 0;let ie;e[56]!==f||e[57]!==m?(ie=f(m==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[56]=f,e[57]=m,e[58]=ie):ie=e[58],e[59]!==g||e[60]!==ie?(O=o.jsx(di,{placeholder:ie,value:g,onValueChange:x}),e[59]=g,e[60]=ie,e[61]=O):O=e[61];let Z;e[62]===Symbol.for("react.memo_cache_sentinel")?(Z=G=>{p(G),x("")},e[62]=Z):Z=e[62];let he;e[63]!==f?(he=f("thread.branchPicker.branchesTab"),e[63]=f,e[64]=he):he=e[64];let de;e[65]!==he?(de=o.jsx(ii,{value:"branches",className:"h-6 px-2.5 text-xs",children:he}),e[65]=he,e[66]=de):de=e[66];let ae;e[67]!==f?(ae=f("thread.branchPicker.prsTab"),e[67]=f,e[68]=ae):ae=e[68];let ce;e[69]!==ae?(ce=o.jsx(ii,{value:"prs",className:"h-6 px-2.5 text-xs",children:ae}),e[69]=ae,e[70]=ce):ce=e[70];let ue;e[71]!==de||e[72]!==ce?(ue=o.jsxs(Jc,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[de,ce]}),e[71]=de,e[72]=ce,e[73]=ue):ue=e[73],e[74]!==ue||e[75]!==m?($=o.jsx(na,{className:"px-2 pt-2 pb-1",value:m,onValueChange:Z,children:ue}),e[74]=ue,e[75]=m,e[76]=$):$=e[76],R=ui,e[77]!==C||e[78]!==m?(B=G=>{const me=G.currentTarget;m==="branches"&&me.scrollHeight-me.scrollTop-me.clientHeight<48&&C()},e[77]=C,e[78]=m,e[79]=B):B=e[79],U=m==="branches"?o.jsxs(o.Fragment,{children:[S&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingMore")}),!S&&q.length===0&&o.jsx($n,{children:f("thread.branchPicker.noBranchesFound")}),q.length>0&&o.jsx(Ps,{children:q.map(G=>o.jsxs(ls,{value:G.name,className:"cursor-pointer",onSelect:()=>h(G.name,G.name),children:[o.jsx(nr,{className:"mr-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:G.name})]},G.name))}),k&&o.jsx("div",{className:"p-2",children:o.jsx(fe,{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:[E&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:f("thread.branchPicker.loadingPullRequests")}),!E&&ee.length===0&&o.jsx($n,{children:f("thread.branchPicker.noOpenPullRequests")}),ee.length>0&&o.jsx(Ps,{children:ee.map(G=>o.jsxs(ls,{value:`#${G.number} ${G.title} ${G.head}`,className:"cursor-pointer",onSelect:()=>h(G.head,Xo(G.title)),children:[o.jsx(Hr,{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:Xo(G.title)}),o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",G.number," · ",G.head]})]})]},G.number))})]}),e[17]=C,e[18]=k,e[19]=j,e[20]=S,e[21]=h,e[22]=u,e[23]=w,e[24]=l,e[25]=E,e[26]=y,e[27]=a,e[28]=g,e[29]=f,e[30]=V,e[31]=m,e[32]=L,e[33]=R,e[34]=I,e[35]=D,e[36]=O,e[37]=$,e[38]=M,e[39]=z,e[40]=B,e[41]=U}else R=e[33],I=e[34],D=e[35],O=e[36],$=e[37],M=e[38],z=e[39],B=e[40],U=e[41];let H;e[80]!==R||e[81]!==B||e[82]!==U?(H=o.jsx(R,{onScroll:B,children:U}),e[80]=R,e[81]=B,e[82]=U,e[83]=H):H=e[83];let W;e[84]!==I||e[85]!==D||e[86]!==O||e[87]!==$||e[88]!==H?(W=o.jsxs(I,{filter:D,children:[O,$,H]}),e[84]=I,e[85]=D,e[86]=O,e[87]=$,e[88]=H,e[89]=W):W=e[89];let K;return e[90]!==M||e[91]!==z||e[92]!==W?(K=o.jsxs("div",{className:M,children:[z,W]}),e[90]=M,e[91]=z,e[92]=W,e[93]=K):K=e[93],K}function cfe(t,e){return Af(t,e)?1:0}const dfe=(t,e)=>Af(t,e)?1:0;function ufe(t){const e=F.c(161),{orgId:s,orgSlug:n,userId:i,userLabel:r,connectionId:l,owner:a,repo:c,sandboxMap:d,value:u,onChange:h,onCreateBranch:f,disabled:m,spawnsNewChat:p,placement:g}=t,x=m===void 0?!1:m,b=p===void 0?!1:p,v=g===void 0?"chat":g,_=le(),y=v==="header",[L,w]=A.useState(!1),[S,k]=A.useState("branches"),[j,C]=A.useState(""),[T,N]=A.useState(u??""),P=S==="branches"?j:"";let V;e[0]!==l||e[1]!==L||e[2]!==s||e[3]!==n||e[4]!==a||e[5]!==c||e[6]!==d||e[7]!==P||e[8]!==i?(V={orgId:s,orgSlug:n,userId:i,connectionId:l,sandboxMap:d,owner:a,repo:c,search:P,enabled:L},e[0]=l,e[1]=L,e[2]=s,e[3]=n,e[4]=a,e[5]=c,e[6]=d,e[7]=P,e[8]=i,e[9]=V):V=e[9];const{recent:E,yours:R,others:I,isLoading:D,isError:O,isSearching:$,hiddenMatchCount:M,hasMore:z,isFetchingMore:B,fetchMore:U}=Zj(V);let H;e[10]!==L?(H={enabled:L},e[10]=L,e[11]=H):H=e[11];const{data:W}=Zf(H);let K;e[12]!==W?.data?.members?(K=new Map((W?.data?.members??[]).map(hfe)),e[12]=W?.data?.members,e[13]=K):K=e[13];const Q=K,X=l??"",se=L&&S==="prs";let ne;e[14]!==s||e[15]!==n||e[16]!==a||e[17]!==c||e[18]!==X||e[19]!==se?(ne={orgId:s,orgSlug:n,connectionId:X,owner:a,repo:c,enabled:se},e[14]=s,e[15]=n,e[16]=a,e[17]=c,e[18]=X,e[19]=se,e[20]=ne):ne=e[20];const{data:te,isLoading:ee,isError:Y}=z8(ne);let q,oe,J,ie,Z,he,de,ae,ce,ue,G,me,ye,we,Ne,je,_e;if(e[21]!==T||e[22]!==x||e[23]!==U||e[24]!==z||e[25]!==M||e[26]!==O||e[27]!==B||e[28]!==y||e[29]!==D||e[30]!==$||e[31]!==Q||e[32]!==h||e[33]!==f||e[34]!==L||e[35]!==I||e[36]!==a||e[37]!==Y||e[38]!==ee||e[39]!==E||e[40]!==c||e[41]!==j||e[42]!==b||e[43]!==_||e[44]!==te||e[45]!==S||e[46]!==r||e[47]!==u||e[48]!==R){const Ae=te===void 0?[]:te,st=`${a}/${c}`;let Be;e[66]!==st?(Be=st.toLowerCase(),e[66]=st,e[67]=Be):Be=e[67];const Ie=Be;let Oe;e[68]!==Ie?(Oe=ke=>ke.headRepoFullName?.toLowerCase()===Ie,e[68]=Ie,e[69]=Oe):Oe=e[69];const mt=Ae.filter(Oe),lt=Ae.length-mt.length;let Xe;e[70]!==h?(Xe=ke=>{h(ke),w(!1)},e[70]=h,e[71]=Xe):Xe=e[71];const nt=Xe;let Fe;e[72]!==h||e[73]!==f?(Fe=ke=>{(f??h)(ke),w(!1)},e[72]=h,e[73]=f,e[74]=Fe):Fe=e[74];const dt=Fe;let et;e[75]!==_||e[76]!==u?(et=u??_("thread.branchPicker.selectBranch"),e[75]=_,e[76]=u,e[77]=et):et=e[77];const rt=et;let gt;e[78]!==U||e[79]!==S?(gt=ke=>{const ot=ke.currentTarget,Le=ot.scrollHeight-ot.scrollTop-ot.clientHeight;S==="branches"&&Le<48&&U()},e[78]=U,e[79]=S,e[80]=gt):gt=e[80];const pe=gt;ie=cs,Ne=L,e[81]!==x||e[82]!==u?(je=x?void 0:ke=>{ke&&(N(u??""),C("")),w(ke)},e[81]=x,e[82]=u,e[83]=je):je=e[83];const Me=y?"outline":"ghost",Ze=y?"sm":"default",ct=y?"text-xs":"text-xs text-muted-foreground hover:text-foreground";let _t;e[84]!==ct?(_t=re("font-mono shrink min-w-0 max-w-[200px] gap-1.5",ct),e[84]=ct,e[85]=_t):_t=e[85];let wt;e[86]===Symbol.for("react.memo_cache_sentinel")?(wt=o.jsx(nr,{className:"h-3.5 w-3.5 shrink-0"}),e[86]=wt):wt=e[86];let ze;e[87]!==rt?(ze=o.jsx("span",{className:"min-w-0 truncate @max-3xl/panel-header:hidden",children:rt}),e[87]=rt,e[88]=ze):ze=e[88];let yt;e[89]!==x?(yt=!x&&o.jsx(bs,{size:12,className:"opacity-60 shrink-0"}),e[89]=x,e[90]=yt):yt=e[90];let At;e[91]!==x||e[92]!==rt||e[93]!==Me||e[94]!==Ze||e[95]!==_t||e[96]!==ze||e[97]!==yt?(At=o.jsx(Ke,{asChild:!0,children:o.jsx("span",{className:"inline-flex min-w-0 shrink","data-tour":Xf.branchPicker,children:o.jsx(os,{asChild:!0,children:o.jsxs(fe,{variant:Me,size:Ze,"aria-label":rt,disabled:x,className:_t,children:[wt,ze,yt]})})})}),e[91]=x,e[92]=rt,e[93]=Me,e[94]=Ze,e[95]=_t,e[96]=ze,e[97]=yt,e[98]=At):At=e[98];let ht;e[99]!==rt?(ht=o.jsx(We,{children:rt}),e[99]=rt,e[100]=ht):ht=e[100],e[101]!==At||e[102]!==ht?(_e=o.jsxs(qe,{children:[At,ht]}),e[101]=At,e[102]=ht,e[103]=_e):_e=e[103],J=as,ye="w-[min(420px,calc(100vw-2rem))] p-0",we="start",oe=Ii,de=T,ae=N,ce=S==="branches"?dfe:void 0;let ft;e[104]!==_||e[105]!==S?(ft=_(S==="branches"?"thread.branchPicker.searchBranches":"thread.branchPicker.searchPullRequests"),e[104]=_,e[105]=S,e[106]=ft):ft=e[106];let at;e[107]!==j||e[108]!==ft?(at=o.jsx(di,{placeholder:ft,value:j,onValueChange:C}),e[107]=j,e[108]=ft,e[109]=at):at=e[109];let pt;e[110]!==dt||e[111]!==j||e[112]!==_||e[113]!==S||e[114]!==r?(pt=S==="branches"&&o.jsx(fe,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>dt(j.trim()||Dl(r)),children:j.trim()?_("thread.branchPicker.createBranch",{name:j.trim()}):_("thread.branchPicker.new")}),e[110]=dt,e[111]=j,e[112]=_,e[113]=S,e[114]=r,e[115]=pt):pt=e[115],e[116]!==at||e[117]!==pt?(ue=o.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[at,pt]}),e[116]=at,e[117]=pt,e[118]=ue):ue=e[118],e[119]!==b||e[120]!==_?(G=b&&o.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:_("thread.branchPicker.newChatHint")}),e[119]=b,e[120]=_,e[121]=G):G=e[121];let Lt;e[122]===Symbol.for("react.memo_cache_sentinel")?(Lt=ke=>{k(ke),C("")},e[122]=Lt):Lt=e[122];let bt;e[123]!==_?(bt=_("thread.branchPicker.branchesTab"),e[123]=_,e[124]=bt):bt=e[124];let Ft;e[125]!==bt?(Ft=o.jsx(ii,{value:"branches",className:"h-6 px-2.5 text-xs",children:bt}),e[125]=bt,e[126]=Ft):Ft=e[126];let ge;e[127]!==_?(ge=_("thread.branchPicker.prsTab"),e[127]=_,e[128]=ge):ge=e[128];let Ee;e[129]!==ge?(Ee=o.jsx(ii,{value:"prs",className:"h-6 px-2.5 text-xs",children:ge}),e[129]=ge,e[130]=Ee):Ee=e[130];let Re;e[131]!==Ft||e[132]!==Ee?(Re=o.jsxs(Jc,{className:"h-auto w-fit justify-start gap-1 bg-accent p-1",variant:"pill",children:[Ft,Ee]}),e[131]=Ft,e[132]=Ee,e[133]=Re):Re=e[133],e[134]!==Re||e[135]!==S?(me=o.jsx(na,{className:"px-2 pt-2 pb-1",value:S,onValueChange:Lt,children:Re}),e[134]=Re,e[135]=S,e[136]=me):me=e[136],q=ui,Z=pe,he=S==="prs"?o.jsxs(o.Fragment,{children:[Y&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:_("thread.branchPicker.couldntLoadPullRequests")}),ee&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:_("thread.branchPicker.loadingPullRequests")}),!Y&&!ee&&o.jsx($n,{children:j.trim()?_("thread.branchPicker.noPullRequestsFound"):_("thread.branchPicker.noOpenPullRequests")}),mt.length>0&&o.jsx(Ps,{heading:_("thread.branchPicker.openPullRequests"),children:mt.map(ke=>o.jsxs(ls,{value:`#${ke.number} ${ke.title} ${ke.head}`,className:"cursor-pointer",onSelect:()=>nt(ke.head),children:[o.jsx(Hr,{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:Xo(ke.title)}),o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["#",ke.number," · ",ke.head,ke.author?` · @${ke.author}`:""]})]})]},ke.number))}),lt>0&&o.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:_("thread.branchPicker.hiddenForkPrs",{count:lt})})]}):o.jsxs(o.Fragment,{children:[O&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:_("thread.branchPicker.couldntLoadBranches")}),!O&&($||!D)&&o.jsx($n,{children:_($?"thread.branchPicker.searchingBranches":"thread.branchPicker.noBranchesFound")}),E.length>0&&o.jsx(Ps,{heading:_("thread.branchPicker.last7Days"),children:E.map(ke=>o.jsxs(ls,{value:ke.name,className:"cursor-pointer",onSelect:()=>nt(ke.name),children:[o.jsx(nr,{className:"mr-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:ke.name}),ke.name===u&&o.jsx($t,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"}),o.jsx(ffe,{userIds:ke.contributors??[],memberById:Q})]},ke.name))}),R.length>0&&o.jsxs(o.Fragment,{children:[E.length>0&&o.jsx(Rx,{}),o.jsx(Ps,{heading:_("thread.branchPicker.yourBranches"),children:R.map(ke=>o.jsxs(ls,{value:ke.name,className:"cursor-pointer",onSelect:()=>nt(ke.name),children:[o.jsx(nr,{className:"mr-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:ke.name}),ke.name===u&&o.jsx($t,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"})]},ke.name))})]}),I.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Rx,{}),o.jsx(Ps,{heading:_("thread.branchPicker.otherBranchesInRepo"),children:I.map(ke=>o.jsxs(ls,{value:ke.name,className:"cursor-pointer",onSelect:()=>nt(ke.name),children:[o.jsx(nr,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:ke.name}),ke.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",ke.author]}),ke.name===u&&o.jsx($t,{className:"ml-2 h-4 w-4 shrink-0 text-muted-foreground"})]},ke.name))})]}),z&&o.jsx("div",{className:"border-t p-2",children:o.jsx(fe,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:B,onClick:U,children:_(B?"thread.branchPicker.loadingMore":"thread.branchPicker.loadMoreBranches")})}),M>0&&o.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:_("thread.branchPicker.moreMatches",{count:M})}),!j.trim()&&!z&&I.length>0&&o.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:_("thread.branchPicker.allLoaded")})]}),e[21]=T,e[22]=x,e[23]=U,e[24]=z,e[25]=M,e[26]=O,e[27]=B,e[28]=y,e[29]=D,e[30]=$,e[31]=Q,e[32]=h,e[33]=f,e[34]=L,e[35]=I,e[36]=a,e[37]=Y,e[38]=ee,e[39]=E,e[40]=c,e[41]=j,e[42]=b,e[43]=_,e[44]=te,e[45]=S,e[46]=r,e[47]=u,e[48]=R,e[49]=q,e[50]=oe,e[51]=J,e[52]=ie,e[53]=Z,e[54]=he,e[55]=de,e[56]=ae,e[57]=ce,e[58]=ue,e[59]=G,e[60]=me,e[61]=ye,e[62]=we,e[63]=Ne,e[64]=je,e[65]=_e}else q=e[49],oe=e[50],J=e[51],ie=e[52],Z=e[53],he=e[54],de=e[55],ae=e[56],ce=e[57],ue=e[58],G=e[59],me=e[60],ye=e[61],we=e[62],Ne=e[63],je=e[64],_e=e[65];let Ve;e[137]!==q||e[138]!==Z||e[139]!==he?(Ve=o.jsx(q,{onScroll:Z,children:he}),e[137]=q,e[138]=Z,e[139]=he,e[140]=Ve):Ve=e[140];let xe;e[141]!==oe||e[142]!==de||e[143]!==ae||e[144]!==ce||e[145]!==ue||e[146]!==G||e[147]!==me||e[148]!==Ve?(xe=o.jsxs(oe,{value:de,onValueChange:ae,filter:ce,children:[ue,G,me,Ve]}),e[141]=oe,e[142]=de,e[143]=ae,e[144]=ce,e[145]=ue,e[146]=G,e[147]=me,e[148]=Ve,e[149]=xe):xe=e[149];let Se;e[150]!==J||e[151]!==ye||e[152]!==we||e[153]!==xe?(Se=o.jsx(J,{className:ye,align:we,children:xe}),e[150]=J,e[151]=ye,e[152]=we,e[153]=xe,e[154]=Se):Se=e[154];let Ce;return e[155]!==ie||e[156]!==Ne||e[157]!==je||e[158]!==_e||e[159]!==Se?(Ce=o.jsxs(ie,{open:Ne,onOpenChange:je,children:[_e,Se]}),e[155]=ie,e[156]=Ne,e[157]=je,e[158]=_e,e[159]=Se,e[160]=Ce):Ce=e[160],Ce}function hfe(t){return[t.userId,t.user]}function ffe(t){const e=F.c(13),{userIds:s,memberById:n}=t;if(s.length===0)return null;let i,r,l;if(e[0]!==n||e[1]!==s){const d=s.slice(0,3);i=s.length-d.length,r="ml-2 flex shrink-0 items-center -space-x-1.5";let u;e[5]!==n?(u=h=>{const f=n.get(h);return o.jsx(Hs,{url:f?.image??void 0,fallback:Cn(f?.name??void 0),shape:"circle",size:"xs",className:"ring-2 ring-background"},h)},e[5]=n,e[6]=u):u=e[6],l=d.map(u),e[0]=n,e[1]=s,e[2]=i,e[3]=r,e[4]=l}else i=e[2],r=e[3],l=e[4];let a;e[7]!==i?(a=i>0&&o.jsxs("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[9px] font-semibold text-muted-foreground ring-2 ring-background",children:["+",i]}),e[7]=i,e[8]=a):a=e[8];let c;return e[9]!==r||e[10]!==l||e[11]!==a?(c=o.jsxs("span",{className:r,children:[l,a]}),e[9]=r,e[10]=l,e[11]=a,e[12]=c):c=e[12],c}function mfe(t){const e=F.c(31),{draftsMode:s,locked:n,placement:i,value:r,virtualMcpId:l,userLabel:a,baseBranch:c,onChange:d,onCreateBranch:u,orgId:h,orgSlug:f,userId:m,connectionId:p,owner:g,repo:x,sandboxMap:b}=t;if(s){let _;return e[0]!==c||e[1]!==p||e[2]!==n||e[3]!==d||e[4]!==u||e[5]!==h||e[6]!==f||e[7]!==g||e[8]!==i||e[9]!==x||e[10]!==b||e[11]!==m||e[12]!==a||e[13]!==r||e[14]!==l?(_=o.jsx(rfe,{virtualMcpId:l,userLabel:a,value:r,baseBranch:c,orgId:h,orgSlug:f,userId:m,connectionId:p,owner:g,repo:x,sandboxMap:b,onChange:d,onCreateBranch:u,spawnsNewChat:n,placement:i}),e[0]=c,e[1]=p,e[2]=n,e[3]=d,e[4]=u,e[5]=h,e[6]=f,e[7]=g,e[8]=i,e[9]=x,e[10]=b,e[11]=m,e[12]=a,e[13]=r,e[14]=l,e[15]=_):_=e[15],_}let v;return e[16]!==p||e[17]!==n||e[18]!==d||e[19]!==u||e[20]!==h||e[21]!==f||e[22]!==g||e[23]!==i||e[24]!==x||e[25]!==b||e[26]!==m||e[27]!==a||e[28]!==r||e[29]!==l?(v=o.jsx(ufe,{orgId:h,orgSlug:f,userId:m,userLabel:a,virtualMcpId:l,connectionId:p,owner:g,repo:x,sandboxMap:b,value:r,onChange:d,onCreateBranch:u,spawnsNewChat:n,placement:i}),e[16]=p,e[17]=n,e[18]=d,e[19]=u,e[20]=h,e[21]=f,e[22]=g,e[23]=i,e[24]=x,e[25]=b,e[26]=m,e[27]=a,e[28]=r,e[29]=l,e[30]=v):v=e[30],v}function pfe(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 gfe(t){const e=F.c(37),{virtualMcp:s,currentBranch:n}=t,i=h2(),r=hs();let l;e[0]!==i?.messages||e[1]!==r?.isThreadLocked?(l=(i?.messages??[]).length>0||(r?.isThreadLocked??!1),e[0]=i?.messages,e[1]=r?.isThreadLocked,e[2]=l):l=e[2];const a=l,c=r?.setCurrentTaskBranch,d=r?.createTask;let u;e[3]!==r?.activeTask?.metadata||e[4]!==s?.metadata?(u=S2(s?.metadata)==="cms"&&d6(r?.activeTask?.metadata,s?.metadata)==="sandbox",e[3]=r?.activeTask?.metadata,e[4]=s?.metadata,e[5]=u):u=e[5];const h=u;let f;e[6]!==s?(f=io(s),e[6]=s,e[7]=f):f=e[7];const m=f,p=m?.connectionId,{data:g}=vn.useSession(),x=g?.user;let b;e[8]!==x?(b=a9(x),e[8]=x,e[9]=b):b=e[9];const v=b,_=g?.user?.id??"",{org:y}=He(),L=ug(s,n);let w;e[10]!==s?(w=sd(s),e[10]=s,e[11]=w):w=e[11];const S=w;let k;e[12]!==d||e[13]!==a||e[14]!==c?(k=E=>{a&&d?d({branch:E}):c&&c(E)},e[12]=d,e[13]=a,e[14]=c,e[15]=k):k=e[15];const j=k;let C;e[16]!==h||e[17]!==d||e[18]!==a||e[19]!==c?(C=E=>{(a||h)&&d?d({branch:E}):c&&c(E)},e[16]=h,e[17]=d,e[18]=a,e[19]=c,e[20]=C):C=e[20];const T=C;let N;e[21]!==L||e[22]!==p||e[23]!==n||e[24]!==S||e[25]!==m||e[26]!==a||e[27]!==j||e[28]!==T||e[29]!==y||e[30]!==_||e[31]!==v||e[32]!==s?.id||e[33]!==s?.metadata?.sandboxMap?(N=m&&p?o.jsx(mfe,{draftsMode:S,userLabel:v,virtualMcpId:s?.id??"",value:n,baseBranch:L,orgId:y.id,orgSlug:y.slug,userId:_,connectionId:p,owner:m.owner,repo:m.name,sandboxMap:s?.metadata?.sandboxMap,onChange:j,onCreateBranch:T,locked:a,placement:"chat"},`${p}:${m.owner}/${m.name}`):null,e[21]=L,e[22]=p,e[23]=n,e[24]=S,e[25]=m,e[26]=a,e[27]=j,e[28]=T,e[29]=y,e[30]=_,e[31]=v,e[32]=s?.id,e[33]=s?.metadata?.sandboxMap,e[34]=N):N=e[34];const P=N;let V;return e[35]!==P?(V=o.jsx(pfe,{branchPill:P}),e[35]=P,e[36]=V):V=e[36],V}function om(t){const e=F.c(13),{label:s,value:n,onChange:i,options:r}=t;let l;e[0]!==s?(l=o.jsx("span",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=l):l=e[1];let a;e[2]!==i?(a=h=>h&&i(h),e[2]=i,e[3]=a):a=e[3];let c;e[4]!==r?(c=r.map(xfe),e[4]=r,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==c||e[8]!==n?(d=o.jsx(Gf,{type:"single",size:"sm",value:n,onValueChange:a,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=a,e[7]=c,e[8]=n,e[9]=d):d=e[9];let u;return e[10]!==l||e[11]!==d?(u=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l,d]}),e[10]=l,e[11]=d,e[12]=u):u=e[12],u}function xfe(t){return o.jsxs(Rc,{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 bfe(t){const e=F.c(91),{panel:s,className:n}=t,i=n===void 0?"md:size-[34px] rounded-lg":n,r=le();let l;e[0]!==r?(l=r("sidebar.taskGroupsList.filterChats"),e[0]=r,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(M2,{size:16}),e[2]=a):a=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]!==l||e[8]!==c?(d=o.jsx(Ke,{asChild:!0,children:o.jsx(os,{asChild:!0,children:o.jsxs(Mr,{"aria-label":l,active:s.filtersActive,className:i,children:[a,c]})})}),e[5]=i,e[6]=s.filtersActive,e[7]=l,e[8]=c,e[9]=d):d=e[9];let u;e[10]!==r?(u=r("sidebar.taskGroupsList.filterChats"),e[10]=r,e[11]=u):u=e[11];let h;e[12]!==u?(h=o.jsx(We,{side:"bottom",children:u}),e[12]=u,e[13]=h):h=e[13];let f;e[14]!==d||e[15]!==h?(f=o.jsxs(qe,{children:[d,h]}),e[14]=d,e[15]=h,e[16]=f):f=e[16];let m;e[17]!==r?(m=r("sidebar.taskGroupsList.filterView"),e[17]=r,e[18]=m):m=e[18];const p=s.groupBy;let g;e[19]!==s?(g=se=>{Ge("tasks_panel_group_by_changed",{to_value:se}),s.setGroupBy(se)},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(bT,{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 _;e[26]!==r?(_=r("sidebar.taskGroupsList.viewStatus"),e[26]=r,e[27]=_):_=e[27];let y;e[28]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(vT,{size:13}),e[28]=y):y=e[28];let L;e[29]!==_?(L={value:"status",label:_,icon:y},e[29]=_,e[30]=L):L=e[30];let w;e[31]!==v||e[32]!==L?(w=[v,L],e[31]=v,e[32]=L,e[33]=w):w=e[33];let S;e[34]!==s.groupBy||e[35]!==g||e[36]!==w||e[37]!==m?(S=o.jsx(om,{label:m,value:p,onChange:g,options:w}),e[34]=s.groupBy,e[35]=g,e[36]=w,e[37]=m,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=se=>{Ge("tasks_panel_filter_changed",{to_value:se}),s.setTypeFilter(se)},e[41]=s,e[42]=C):C=e[42];let T;e[43]!==r?(T=r("sidebar.taskGroupsList.typeAll"),e[43]=r,e[44]=T):T=e[44];let N;e[45]!==T?(N={value:"all",label:T},e[45]=T,e[46]=N):N=e[46];let P;e[47]!==r?(P=r("sidebar.taskGroupsList.typeChats"),e[47]=r,e[48]=P):P=e[48];let V;e[49]!==P?(V={value:"manual",label:P},e[49]=P,e[50]=V):V=e[50];let E;e[51]!==r?(E=r("sidebar.taskGroupsList.typeAuto"),e[51]=r,e[52]=E):E=e[52];let R;e[53]!==E?(R={value:"automation",label:E},e[53]=E,e[54]=R):R=e[54];let I;e[55]!==N||e[56]!==V||e[57]!==R?(I=[N,V,R],e[55]=N,e[56]=V,e[57]=R,e[58]=I):I=e[58];let D;e[59]!==s.typeFilter||e[60]!==k||e[61]!==C||e[62]!==I?(D=o.jsx(om,{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 $=s.showAll?"team":"mine";let M;e[66]!==s?(M=se=>s.setShowAll(se==="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 B;e[70]!==z?(B={value:"mine",label:z},e[70]=z,e[71]=B):B=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]!==B||e[77]!==H?(W=[B,H],e[76]=B,e[77]=H,e[78]=W):W=e[78];let K;e[79]!==O||e[80]!==$||e[81]!==M||e[82]!==W?(K=o.jsx(om,{label:O,value:$,onChange:M,options:W}),e[79]=O,e[80]=$,e[81]=M,e[82]=W,e[83]=K):K=e[83];let Q;e[84]!==S||e[85]!==D||e[86]!==K?(Q=o.jsxs(as,{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]=Q):Q=e[87];let X;return e[88]!==Q||e[89]!==f?(X=o.jsxs(cs,{children:[f,Q]}),e[88]=Q,e[89]=f,e[90]=X):X=e[90],X}function vfe(t,e){return t.filter(s=>s.id===e||!!s.trigger_id||V7(s))}function yfe(t){const e=F.c(9),{virtualMcpId:s,size:n,showAutomationBadge:i}=t,r=n===void 0?"sm":n,l=le();let a;e[0]!==r||e[1]!==s?(a=s?o.jsx(_fe,{virtualMcpId:s,size:r}):o.jsx(ur,{icon:null,name:"?",size:r}),e[0]=r,e[1]=s,e[2]=a):a=e[2];let c;e[3]!==i||e[4]!==l?(c=i&&o.jsx("span",{"aria-label":l("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]=l,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsxs("div",{className:"relative shrink-0",children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function _fe(t){const e=F.c(6),{virtualMcpId:s,size:n}=t,i=vs(s);if(!i){let a;return e[0]!==n?(a=o.jsx(ur,{icon:null,name:"?",size:n}),e[0]=n,e[1]=a):a=e[1],a}const r=i.icon??null;let l;return e[2]!==i.title||e[3]!==n||e[4]!==r?(l=o.jsx(ur,{icon:r,name:i.title,size:n}),e[2]=i.title,e[3]=n,e[4]=r,e[5]=l):l=e[5],l}const my=["thread"];function Lfe(t){const e=F.c(53),{open:s,onOpenChange:n}=t,[i,r]=A.useState(""),{org:l}=He(),{setTaskId:a}=Zl(),c=Vs(),d=le();let u,h,f,m;e[0]!==l.id||e[1]!==i?(m=i.trim(),u=m?20:10,f=Mt,h=tt.globalSearch(l.id,m,u,my),e[0]=l.id,e[1]=i,e[2]=u,e[3]=h,e[4]=f,e[5]=m):(u=e[2],h=e[3],f=e[4],m=e[5]);let p;e[6]!==u||e[7]!==c||e[8]!==m?(p=async()=>{const O=await c.call("GLOBAL_SEARCH",{query:m,limit:u,types:[...my]});return{...O,items:O.items.filter(wfe)}},e[6]=u,e[7]=c,e[8]=m,e[9]=p):p=e[9];let g;e[10]!==s||e[11]!==h||e[12]!==p?(g={queryKey:h,enabled:s,queryFn:p,staleTime:1e4},e[10]=s,e[11]=h,e[12]=p,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 _=v;let y;e[16]!==n?(y=O=>{O||r(""),n(O)},e[16]=n,e[17]=y):y=e[17];const L=y;let w;e[18]!==L||e[19]!==a?(w=O=>{L(!1),a(O.id,O.virtual_mcp_id??void 0)},e[18]=L,e[19]=a,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(qt,{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 T;e[27]!==C?(T=o.jsx(Nn,{children:C}),e[27]=C,e[28]=T):T=e[28];let N;e[29]!==T||e[30]!==j?(N=o.jsxs(ds,{className:"sr-only",children:[j,T]}),e[29]=T,e[30]=j,e[31]=N):N=e[31];let P;e[32]!==d?(P=d("tasksPanel.globalSearchDialog.placeholder"),e[32]=d,e[33]=P):P=e[33];let V;e[34]!==i||e[35]!==P?(V=o.jsx(di,{value:i,onValueChange:r,placeholder:P}),e[34]=i,e[35]=P,e[36]=V):V=e[36];let E;e[37]!==S||e[38]!==b||e[39]!==_||e[40]!==d||e[41]!==m?(E=o.jsx(ui,{children:b&&_.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:d("tasksPanel.globalSearchDialog.searching")}):_.length===0?o.jsx($n,{children:d("tasksPanel.globalSearchDialog.noResults")}):o.jsx(Ps,{heading:m?void 0:d("tasksPanel.globalSearchDialog.recent"),children:_.map(O=>O.type==="thread"?o.jsxs(ls,{value:`thread:${O.id}:${O.title}`,onSelect:()=>S(O),className:"gap-2.5",children:[o.jsx(yfe,{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]=_,e[40]=d,e[41]=m,e[42]=E):E=e[42];let R;e[43]!==V||e[44]!==E?(R=o.jsxs(Ii,{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:[V,E]}),e[43]=V,e[44]=E,e[45]=R):R=e[45];let I;e[46]!==N||e[47]!==R?(I=o.jsxs(Bt,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[N,R]}),e[46]=N,e[47]=R,e[48]=I):I=e[48];let D;return e[49]!==L||e[50]!==s||e[51]!==I?(D=o.jsx(zt,{open:s,onOpenChange:L,children:I}),e[49]=L,e[50]=s,e[51]=I,e[52]=D):D=e[52],D}function wfe(t){return t.type==="thread"}function Sfe(t){const e=F.c(43),{branch:s,onOutcome:n}=t,i=le();let r;e[0]!==n?(r=S=>{S||n("cancel")},e[0]=n,e[1]=r):r=e[1];let l;e[2]!==i?(l=i("sidebar.archiveWorktreeDialog.title"),e[2]=i,e[3]=l):l=e[3];let a;e[4]!==l?(a=o.jsx(Jr,{children:l}),e[4]=l,e[5]=a):a=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 u;e[10]!==i?(u=i("sidebar.archiveWorktreeDialog.stopsAndDeletesAfter"),e[10]=i,e[11]=u):u=e[11];let h;e[12]!==c||e[13]!==d||e[14]!==u?(h=o.jsxs(Qr,{children:[c," ",d," ",u]}),e[12]=c,e[13]=d,e[14]=u,e[15]=h):h=e[15];let f;e[16]!==a||e[17]!==h?(f=o.jsxs(Yr,{children:[a,h]}),e[16]=a,e[17]=h,e[18]=f):f=e[18];let m;e[19]!==n?(m=()=>n("cancel"),e[19]=n,e[20]=m):m=e[20];let p;e[21]!==i?(p=i("sidebar.archiveWorktreeDialog.cancel"),e[21]=i,e[22]=p):p=e[22];let g;e[23]!==p||e[24]!==m?(g=o.jsx(Zr,{onClick:m,children:p}),e[23]=p,e[24]=m,e[25]=g):g=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=re(Wy({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 _;e[31]!==b||e[32]!==v?(_=o.jsx(eo,{className:x,onClick:b,children:v}),e[31]=b,e[32]=v,e[33]=_):_=e[33];let y;e[34]!==g||e[35]!==_?(y=o.jsxs(Xr,{children:[g,_]}),e[34]=g,e[35]=_,e[36]=y):y=e[36];let L;e[37]!==y||e[38]!==f?(L=o.jsxs(Gr,{children:[f,y]}),e[37]=y,e[38]=f,e[39]=L):L=e[39];let w;return e[40]!==r||e[41]!==L?(w=o.jsx(qr,{open:!0,onOpenChange:r,children:L}),e[40]=r,e[41]=L,e[42]=w):w=e[42],w}function kfe(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 jfe(t){return t==="ephemeral"||t.startsWith("thread:")}function eC(t){const e=F.c(45),{task:s,isActive:n,onClick:i,onArchive:r,showAutomationBadge:l,showAgentIcon:a,hideStatusIdle:c,indented:d}=t,u=le(),h=iV(s.status),f=h.icon,m=s.metadata?.kind==="tool_call_run",p=vs(m?void 0:s.virtual_mcp_id);let g;e[0]!==p?(g=io(p),e[0]=p,e[1]=g):g=e[1];const x=g;rV(6e4);const b=l||!!s.trigger_id,v=s.id,_="button",y=0;let L;e[2]!==i?(L=M=>{M.target===M.currentTarget&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),i())},e[2]=i,e[3]=L):L=e[3];const w=d?"-ml-4 pl-6":"pl-[7px]",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]!==m||e[8]!==a||e[9]!==p?.icon||e[10]!==p?.title?(j=a&&!m&&o.jsx(ur,{icon:p?.icon??null,name:p?.title??"?",size:"2xs"}),e[7]=m,e[8]=a,e[9]=p?.icon,e[10]=p?.title,e[11]=j):j=e[11];let C;e[12]!==b||e[13]!==u?(C=b&&o.jsx(hr,{size:12,"aria-label":u("tasksPanel.taskRow.automationTriggered"),className:"shrink-0 text-blue-500"}),e[12]=b,e[13]=u,e[14]=C):C=e[14];let T;e[15]!==u||e[16]!==s.title?(T=s.title||u("tasksPanel.taskRow.untitledTask"),e[15]=u,e[16]=s.title,e[17]=T):T=e[17];let N;e[18]!==T?(N=o.jsx("div",{className:"text-sm text-foreground truncate",children:T}),e[18]=T,e[19]=N):N=e[19];let P;e[20]!==C||e[21]!==N?(P=o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[C,N]}),e[20]=C,e[21]=N,e[22]=P):P=e[22];let V;e[23]!==x||e[24]!==n||e[25]!==s.branch||e[26]!==s.updated_at?(V=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&&!jfe(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:ed(new Date(s.updated_at))})]}),e[23]=x,e[24]=n,e[25]=s.branch,e[26]=s.updated_at,e[27]=V):V=e[27];let E;e[28]!==P||e[29]!==V?(E=o.jsxs("div",{className:"flex-1 min-w-0",children:[P,V]}),e[28]=P,e[29]=V,e[30]=E):E=e[30];const R="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":u("tasksPanel.taskRow.statusLabel",{status:u(h.labelKey)}),children:s.status==="in_progress"?o.jsx(it,{className:re("size-3.5",h.iconClassName)}):o.jsx(f,{size:14,className:h.iconClassName})});let D;e[31]!==r||e[32]!==u?(D=r&&o.jsxs(qe,{children:[o.jsx(Ke,{asChild:!0,children:o.jsx("button",{type:"button","aria-label":u("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(Uy,{size:14})})}),o.jsx(We,{side:"right",children:u("tasksPanel.taskRow.archive")})]}),e[31]=r,e[32]=u,e[33]=D):D=e[33];let O;e[34]!==I||e[35]!==D?(O=o.jsxs("div",{className:R,children:[I,D]}),e[34]=I,e[35]=D,e[36]=O):O=e[36];let $;return e[37]!==i||e[38]!==E||e[39]!==O||e[40]!==L||e[41]!==k||e[42]!==j||e[43]!==s.id?($=o.jsxs("div",{"data-task-id":v,role:_,tabIndex:y,onClick:i,onKeyDown:L,className:k,children:[j,E,O]}),e[37]=i,e[38]=E,e[39]=O,e[40]=L,e[41]=k,e[42]=j,e[43]=s.id,e[44]=$):$=e[44],$}const py=["requires_action","in_progress","failed","expired","completed"];function Cfe(t){const e=new Map(py.map(s=>[s,[]]));for(const s of t){const n=s.status??"completed";(e.get(n)??e.get("completed")).push(s)}return py.map(s=>({status:s,threads:e.get(s)}))}const Nfe="sidebar.group.expanded.";function Vfe(t,e){const s=F.c(3),[n,i]=u2(`${Nfe}${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 tC(t){const e=F.c(18),{onClick:s,isFetching:n,indented:i}=t,r=le();let l;e[0]!==r?(l=r("sidebar.showMoreButton.ariaLabel"),e[0]=r,e[1]=l):l=e[1];const a=i?"-ml-4 pl-6 pr-2":"px-2";let c;e[2]!==a?(c=re("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",a,"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]=a,e[3]=c):c=e[3];let d;e[4]!==n?(d=n&&o.jsx(it,{className:"size-3.5"}),e[4]=n,e[5]=d):d=e[5];let u;e[6]!==n||e[7]!==r?(u=r(n?"sidebar.showMoreButton.loading":"sidebar.showMoreButton.showMore"),e[6]=n,e[7]=r,e[8]=u):u=e[8];let h;e[9]!==u?(h=o.jsx("span",{children:u}),e[9]=u,e[10]=h):h=e[10];let f;return e[11]!==n||e[12]!==s||e[13]!==l||e[14]!==c||e[15]!==d||e[16]!==h?(f=o.jsxs("button",{type:"button","aria-label":l,onClick:s,disabled:n,className:c,children:[d,h]}),e[11]=n,e[12]=s,e[13]=l,e[14]=c,e[15]=d,e[16]=h,e[17]=f):f=e[17],f}function Tfe(t,e,s,n){return[t,e,s,n.type,n.member,n.currentUserId??""].join("|")}function Afe(t){return t.member==="mine"&&!t.currentUserId}const sC=4;let Eh=0;const r2=[];function Pfe(){for(;Eh<sC&&r2.length>0;){const t=r2.shift();t&&t()}}function nC(t){return new Promise((e,s)=>{const n=()=>{Eh++,t().then(e,s).finally(()=>{Eh--,Pfe()})};Eh<sC?n():r2.push(n)})}const U9=10;function gy(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 l={where:r,limit:i,offset:s,orderBy:[{field:["updated_at"],direction:"desc"}]};return l.status=e,l}function Efe(t,e,s,n){let i=0;for(const r of t)iC(r,e,s,n)&&i++;return i}function lm(t,e,s,n){return Efe(t,e,s,n)}function Rfe(t,e){return!!(t>=U9||t===0&&e)}function xy(t,e){return t<e}function Dfe(t,e){return e===!1?!1:e===!0?!0:t}function iC(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 Pf=new Map,bh=new Map;function Ife(t,e){return e?t>=U9?!0:null:!1}function by(t){return Pf.get(t)}function Mfe(t,e){Pf.set(t,e)}function Ofe(t,e,s){const n=Pf.get(t);if(n!==void 0){s(n);return}let i=bh.get(t);i||(i=nC(e).then(r=>(Pf.set(t,r),bh.delete(t),r)).catch(()=>(bh.delete(t),Promise.reject(new Error("group probe failed")))),bh.set(t,i)),i.then(s,()=>s(!1))}function vy(t){const e=t,s=Array.isArray(e.items)?e.items:[];return{items:s,hasMore:e.hasMore??s.length===U9,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function $fe(t,e,s,n,i){let r=0;for(const l of t)e.has(l.id)||iC(l,s,n,i)&&r++;return r}function Bfe(t,e,s,n){const i=F.c(8),{org:r}=He(),l=Tfe(r.id,t,e,s);let a;i[0]!==s?(a=Afe(s),i[0]=s,i[1]=a):a=i[1];const c=a,[d,u]=A.useState({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==l&&u({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:null,serverHasMore:null});const h=Bf(),{threads:f,hasMore:m}=_2(),p=lm(f,t,e,s),g=Rfe(p,m),x=Ife(p,m),b=Vs();if(d.identity===l&&d.serverHasMore===null){const S=x??by(l);S!==void 0&&u({isFetching:!1,isProbing:!1,identity:l,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:S})}!c&&d.identity===l&&d.serverHasMore===null&&x===null&&by(l)===void 0&&d.probeSubscribedIdentity!==l&&(u(S=>S.identity===l?{...S,isProbing:!0,probeSubscribedIdentity:l}:S),Ofe(l,async()=>{const S=gy(t,e,0,s,1),k=await b.call("COLLECTION_THREADS_LIST",S),{totalCount:j}=vy(k),C=lm(h.threads.get(),t,e,s);return j===void 0?!1:xy(C,j)},S=>{u(k=>k.identity!==l?k:{...k,isProbing:!1,serverHasMore:S})}));const _=async function(){if(d.isFetching||d.isProbing||c)return;const k=l;u(j=>j.identity===k?{...j,isFetching:!0}:j);try{const j=lm(f,t,e,s),C=gy(t,e,j,s,U9),T=await nC(()=>b.call("COLLECTION_THREADS_LIST",C)),{items:N,hasMore:P,totalCount:V}=vy(T),E=new Set(f.map(zfe)),R=$fe(N,E,t,e,s),I=j;h.mergeThreads(N),u(D=>{if(D.identity!==k)return D;let O;return V!==void 0?O=xy(I+R,V):O=N.length===0||R===0?!1:P,Mfe(k,O),{...D,isFetching:!1,serverHasMore:O}})}catch(j){const C=j,T=C instanceof Error?C.message:String(C);ve.error(`Could not load more tasks: ${T}`),u(N=>N.identity===k?{...N,isFetching:!1}:N)}},y=d.isFetching||d.isProbing,L=!c&&!y&&Dfe(g,d.serverHasMore);let w;return i[2]!==y||i[3]!==_||i[4]!==L||i[5]!==d.isProbing||i[6]!==d.serverHasMore?(w={hasMore:L,isFetching:y,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:_},i[2]=y,i[3]=_,i[4]=L,i[5]=d.isProbing,i[6]=d.serverHasMore,i[7]=w):w=i[7],w}function zfe(t){return t.id}function Ffe(t){const e=F.c(20),{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:l,canArchive:a,filters:c}=t,{isFetching:d,isProbing:u,loadMore:h,hasMore:f,serverHasMore:m}=Bfe("status",s,c),[p,g]=A.useState(!1);!p&&n.length===0&&m===!0&&!d&&!u&&(g(!0),queueMicrotask(()=>{h()}));let x;if(e[0]!==i||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==r||e[5]!==n){let _;e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r?(_=y=>o.jsx(eC,{task:y,isActive:i===y.id,onClick:()=>r(y),onArchive:a&&y.created_by===c.currentUserId?()=>l(y):void 0,showAutomationBadge:!!y.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},y.id),e[7]=i,e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=_):_=e[12],x=n.map(_),e[0]=i,e[1]=a,e[2]=c,e[3]=l,e[4]=r,e[5]=n,e[6]=x}else x=e[6];let b;e[13]!==f||e[14]!==d||e[15]!==h?(b=(f||d)&&o.jsx(tC,{onClick:()=>{h()},isFetching:d,indented:!0}),e[13]=f,e[14]=d,e[15]=h,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 Ufe(t){const e=F.c(39),{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:l,canArchive:a,filters:c}=t,d=le(),u=oV[s],h=u.icon,[f,m]=Vfe(`status-${s}`,!1);let p;e[0]!==f||e[1]!==m?(p=function(){m(!f)},e[0]=f,e[1]=m,e[2]=p):p=e[2];const g=p;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]!==h||e[6]!==u.iconClassName?(b=o.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:o.jsx(h,{size:12,className:u.iconClassName})}),e[5]=h,e[6]=u.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(bs,{size:14}):o.jsx(Ws,{size:14})}),e[8]=f,e[9]=v):v=e[9];let _;e[10]!==b||e[11]!==v?(_=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]=_):_=e[12];let y;e[13]!==u.labelKey||e[14]!==d?(y=d(u.labelKey),e[13]=u.labelKey,e[14]=d,e[15]=y):y=e[15];let L;e[16]!==y?(L=o.jsx("span",{className:"flex-1 truncate",children:y}),e[16]=y,e[17]=L):L=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]!==_||e[24]!==L||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,w]}),e[20]=f,e[21]=g,e[22]=x,e[23]=_,e[24]=L,e[25]=w,e[26]=S):S=e[26];let k;e[27]!==i||e[28]!==a||e[29]!==f||e[30]!==c||e[31]!==l||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(Ffe,{status:s,threads:n,activeTaskId:i,onSelectTask:r,onArchiveTask:l,canArchive:a,filters:c})}),e[27]=i,e[28]=a,e[29]=f,e[30]=c,e[31]=l,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 Hfe(t){const e=F.c(38),{threads:s,groupBy:n,activeTaskId:i,onSelectTask:r,onArchiveTask:l,filters:a,hasMore:c,isFetchingMore:d,onLoadMore:u,filtersActive:h}=t;if(s.length===0&&!c&&!d){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(yT,{className:"size-6 opacity-60"}),e[0]=x):x=e[0];const b=h?"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]!==a||e[6]!==l||e[7]!==r||e[8]!==s){let v;e[10]!==i||e[11]!==f||e[12]!==a||e[13]!==l||e[14]!==r?(v=_=>o.jsx(Ufe,{status:_.status,threads:_.threads,activeTaskId:i,onSelectTask:r,onArchiveTask:l,canArchive:f,filters:a},_.status),e[10]=i,e[11]=f,e[12]=a,e[13]=l,e[14]=r,e[15]=v):v=e[15],x=Cfe(s).map(v),e[3]=i,e[4]=f,e[5]=a,e[6]=l,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 m;if(e[18]!==i||e[19]!==f||e[20]!==a||e[21]!==l||e[22]!==r||e[23]!==s){let x;e[25]!==i||e[26]!==f||e[27]!==a||e[28]!==l||e[29]!==r?(x=b=>o.jsx(eC,{task:b,isActive:i===b.id,onClick:()=>r(b),onArchive:f&&b.created_by===a.currentUserId?()=>l(b):void 0,showAutomationBadge:!!b.trigger_id,showAgentIcon:!0},b.id),e[25]=i,e[26]=f,e[27]=a,e[28]=l,e[29]=r,e[30]=x):x=e[30],m=s.map(x),e[18]=i,e[19]=f,e[20]=a,e[21]=l,e[22]=r,e[23]=s,e[24]=m}else m=e[24];let p;e[31]!==c||e[32]!==d||e[33]!==u?(p=(c||d)&&o.jsx(tC,{onClick:u,isFetching:d}),e[31]=c,e[32]=d,e[33]=u,e[34]=p):p=e[34];let g;return e[35]!==m||e[36]!==p?(g=o.jsxs(o.Fragment,{children:[m,p]}),e[35]=m,e[36]=p,e[37]=g):g=e[37],g}function Kfe(t,e){return null}function Wfe(t,e){return t.some(s=>s.id!==e.taskId&&!s.hidden&&s.branch===e.branch&&s.virtual_mcp_id===e.virtualMcpId)}const qfe=["archive","reclaim-worktree"],Gfe=[];function Yfe(t){return t==="confirm"?qfe:Gfe}function Jfe(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(Hfe,{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 Qfe(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=le(),{data:r}=vn.useSession(),l=r?.user?.id,{org:a}=He();let c;e[2]!==a.id?(c=Xl(a.id),e[2]=a.id,e[3]=c):c=e[3];const d=c.id,u=KT(),{threads:h,hasMore:f,isFetchingMore:m,fetchNextPage:p}=_2(),g=h.filter(t9e),{hide:x,setScope:b}=$u(),v=rn(),_=Vs(),{setTaskId:y,createNewTask:L}=Zl(),w=jV(),S=zf();let k;e[4]!==S||e[5]!==h||e[6]!==w?(k=CV({routeAgentId:w,threadVirtualMcpId:h.find(xe=>xe.id===S)?.virtual_mcp_id}),e[4]=S,e[5]=h,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 T=C,N=[...g].sort(e9e),[P,V]=A.useState("all"),[E,R]=A.useState("flat"),[I,D]=u2("sidebar-threads-scope-all",!1),[O,$]=A.useState(!1),[M,z]=A.useState(!1);let B;e[10]!==$?(B=()=>{Ge("tasks_panel_search_opened"),z(!0),$(!0)},e[10]=$,e[11]=B):B=e[11];const U=B,[H,W]=A.useState(null),K=l??null;let Q;e[12]!==K||e[13]!==P?(Q={type:P,member:"mine",currentUserId:K},e[12]=K,e[13]=P,e[14]=Q):Q=e[14];const X=Q,se={};I||(se.created_by="me"),b(se);let ne;e[15]!==l?(ne=xe=>l?xe.filter(Se=>Se.created_by===l):[],e[15]=l,e[16]=ne):ne=e[16];const te=ne;let ee;e[17]!==P?(ee=xe=>P==="automation"?xe.filter(Zfe):P==="manual"?xe.filter(Xfe):xe,e[17]=P,e[18]=ee):ee=e[18];const Y=ee,q=vfe(Y(I?N:te(N)),S);let oe;e[19]!==S||e[20]!==T||e[21]!==l||e[22]!==x||e[23]!==v||e[24]!==a.slug||e[25]!==y||e[26]!==q?(oe=xe=>{const Se=xe.id===S,Ce=x(xe.id);if(_V(xe.id),!Se)return Ce;const Ae=kfe(q,xe.id,l);return T(),Ae?y(Ae.id,Ae.virtual_mcp_id):v({to:"/$org",params:{org:a.slug}}),Ce},e[19]=S,e[20]=T,e[21]=l,e[22]=x,e[23]=v,e[24]=a.slug,e[25]=y,e[26]=q,e[27]=oe):oe=e[27];const J=oe;let ie;e[28]!==_||e[29]!==i?(ie=async xe=>{try{await _.call("SANDBOX_DELETE",{virtualMcpId:xe.virtualMcpId,branch:xe.branch,removeWorktree:!0})}catch{ve.error(i("sidebar.archiveWorktreeDialog.reclaimFailed",{branch:xe.branch}))}},e[28]=_,e[29]=i,e[30]=ie):ie=e[30];const Z=ie;let he;e[31]!==h||e[32]!==J||e[33]!==l||e[34]!==W?(he=xe=>{if(l&&xe.created_by&&xe.created_by!==l)return;const Se=Kfe();if(!Se||Wfe(h,Se)){J(xe);return}W({task:xe,target:Se})},e[31]=h,e[32]=J,e[33]=l,e[34]=W,e[35]=he):he=e[35];const de=he;let ae;e[36]!==J||e[37]!==H||e[38]!==Z||e[39]!==W?(ae=xe=>{const Se=H;Se&&(W(null),(async()=>{for(const Ce of Yfe(xe))if(Ce==="archive")try{await J(Se.task)}catch{return}else await Z(Se.target)})())},e[36]=J,e[37]=H,e[38]=Z,e[39]=W,e[40]=ae):ae=e[40];const ce=ae;let ue;e[41]!==T||e[42]!==y?(ue=xe=>{T(),y(xe.id,xe.virtual_mcp_id)},e[41]=T,e[42]=y,e[43]=ue):ue=e[43];const G=ue;let me;e[44]!==j||e[45]!==S||e[46]!==h||e[47]!==T||e[48]!==L||e[49]!==l||e[50]!==d||e[51]!==u||e[52]!==y?(me=()=>{const xe=j??d;Ge("sidebar_new_thread_clicked",{virtual_mcp_id:xe}),T();const Se=gA(h,xe,l,u(xe));if(Se){y(Se.id,Se.virtual_mcp_id);return}const Ce=h.find(Ae=>Ae.id===S)?.branch??null;L(xe,Ce)},e[44]=j,e[45]=S,e[46]=h,e[47]=T,e[48]=L,e[49]=l,e[50]=d,e[51]=u,e[52]=y,e[53]=me):me=e[53];const ye=me;let we;e[54]!==p?(we=()=>{p()},e[54]=p,e[55]=we):we=e[55];const Ne=E!=="flat"||P!=="all"||I;let je;e[56]!==ce||e[57]!==H?(je=H?o.jsx(Sfe,{branch:H.target.branch,onOutcome:ce}):null,e[56]=ce,e[57]=H,e[58]=je):je=e[58];let _e;e[59]!==M||e[60]!==O||e[61]!==$?(_e=M?o.jsx(Lfe,{open:O,onOpenChange:$}):null,e[59]=M,e[60]=O,e[61]=$,e[62]=_e):_e=e[62];let Ve;return e[63]!==S||e[64]!==de||e[65]!==X||e[66]!==E||e[67]!==f||e[68]!==m||e[69]!==ye||e[70]!==U||e[71]!==G||e[72]!==R||e[73]!==D||e[74]!==V||e[75]!==I||e[76]!==we||e[77]!==Ne||e[78]!==je||e[79]!==_e||e[80]!==P||e[81]!==q?(Ve={threads:q,activeTaskId:S,filters:X,hasMore:f,isFetchingMore:m,loadMore:we,groupBy:E,setGroupBy:R,typeFilter:P,setTypeFilter:V,showAll:I,setShowAll:D,filtersActive:Ne,selectTask:G,archiveTask:de,newThread:ye,openSearch:U,reclaimDialog:je,searchDialog:_e},e[63]=S,e[64]=de,e[65]=X,e[66]=E,e[67]=f,e[68]=m,e[69]=ye,e[70]=U,e[71]=G,e[72]=R,e[73]=D,e[74]=V,e[75]=I,e[76]=we,e[77]=Ne,e[78]=je,e[79]=_e,e[80]=P,e[81]=q,e[82]=Ve):Ve=e[82],Ve}function Xfe(t){return!t.trigger_id}function Zfe(t){return!!t.trigger_id}function e9e(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function t9e(t){return!t.hidden}function s9e(){const t=F.c(60),e=le(),[s,n]=A.useState(!1);let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={onNavigate:()=>n(!1)},t[0]=i):i=t[0];const r=Qfe(i),l=hs()?.activeTask;let a;t[1]!==l?.title||t[2]!==r.activeTaskId||t[3]!==r.threads||t[4]!==e?(a=l?.title||r.threads.find(D=>D.id===r.activeTaskId)?.title||e("tasksPanel.taskRow.untitledTask"),t[1]=l?.title,t[2]=r.activeTaskId,t[3]=r.threads,t[4]=e,t[5]=a):a=t[5];const c=a;let d;t[6]!==r?(d=()=>{n(!1),r.openSearch()},t[6]=r,t[7]=d):d=t[7];const u=d;let h;t[8]!==e?(h=e("chat.threadsMenu.chats"),t[8]=e,t[9]=h):h=t[9];const f=s&&"bg-sidebar-accent";let m;t[10]!==f?(m=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]=m):m=t[11];let p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(_T,{size:16,className:"shrink-0"}),t[12]=p):p=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(bs,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),t[15]=x):x=t[15];let b;t[16]!==h||t[17]!==m||t[18]!==g?(b=o.jsx(Ke,{asChild:!0,children:o.jsx(os,{asChild:!0,children:o.jsxs("button",{type:"button","aria-label":h,className:m,children:[p,g,x]})})}),t[16]=h,t[17]=m,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 _;t[22]!==v?(_=o.jsx(We,{side:"bottom",children:v}),t[22]=v,t[23]=_):_=t[23];let y;t[24]!==_||t[25]!==b?(y=o.jsxs(qe,{children:[b,_]}),t[24]=_,t[25]=b,t[26]=y):y=t[26];let L;t[27]!==r?(L=o.jsx(bfe,{panel:r,className:"size-8 rounded-lg"}),t[27]=r,t[28]=L):L=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(P2,{size:16}),t[31]=S):S=t[31];let k;t[32]!==u||t[33]!==w?(k=o.jsx(Mr,{"aria-label":w,onClick:u,className:"size-8 rounded-lg",children:S}),t[32]=u,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(Kf,{size:16}),t[37]=C):C=t[37];let T;t[38]!==r.newThread||t[39]!==j?(T=o.jsx(Mr,{"aria-label":j,onClick:r.newThread,className:"size-8 rounded-lg",children:C}),t[38]=r.newThread,t[39]=j,t[40]=T):T=t[40];let N;t[41]!==k||t[42]!==T?(N=o.jsxs("div",{className:"flex items-center gap-0.5",children:[k,T]}),t[41]=k,t[42]=T,t[43]=N):N=t[43];let P;t[44]!==L||t[45]!==N?(P=o.jsxs("div",{className:"flex shrink-0 items-center justify-between",children:[L,N]}),t[44]=L,t[45]=N,t[46]=P):P=t[46];let V;t[47]!==r?(V=o.jsx("div",{className:"flex max-h-[60vh] min-h-0 flex-col gap-0.5 overflow-y-auto overscroll-contain",children:o.jsx(Jfe,{panel:r})}),t[47]=r,t[48]=V):V=t[48];let E;t[49]!==P||t[50]!==V?(E=o.jsxs(as,{align:"start",side:"bottom",onOpenAutoFocus:n9e,className:"flex w-80 flex-col gap-2 p-2",children:[P,V]}),t[49]=P,t[50]=V,t[51]=E):E=t[51];let R;t[52]!==s||t[53]!==y||t[54]!==E?(R=o.jsxs(cs,{open:s,onOpenChange:n,children:[y,E]}),t[52]=s,t[53]=y,t[54]=E,t[55]=R):R=t[55];let I;return t[56]!==r.reclaimDialog||t[57]!==r.searchDialog||t[58]!==R?(I=o.jsxs(o.Fragment,{children:[R,r.searchDialog,r.reclaimDialog]}),t[56]=r.reclaimDialog,t[57]=r.searchDialog,t[58]=R,t[59]=I):I=t[59],I}function n9e(t){return t.preventDefault()}function rC(t){const e=F.c(4),{chatContent:s}=t;let n;e[0]!==s?(n=s??o.jsx(k7,{}),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 am(t){const e=F.c(20),{side:s,open:n,disabled:i,onToggle:r}=t,l=le();let a;e[0]!==n||e[1]!==s||e[2]!==l?(a=l(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]=l,e[3]=a):a=e[3];const c=a,d=s==="right"?LT:n?wT:ST;let u;e[4]!==r||e[5]!==n||e[6]!==s?(u=()=>{Ge("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]=u):u=e[7];let h;e[8]!==d?(h=o.jsx(d,{size:16}),e[8]=d,e[9]=h):h=e[9];let f;e[10]!==i||e[11]!==c||e[12]!==u||e[13]!==h?(f=o.jsx(Ke,{asChild:!0,children:o.jsx(Mr,{"aria-label":c,disabled:i,onClick:u,className:"size-7 rounded-md disabled:opacity-40",children:h})}),e[10]=i,e[11]=c,e[12]=u,e[13]=h,e[14]=f):f=e[14];let m;e[15]!==c?(m=o.jsx(We,{side:"bottom",children:c}),e[15]=c,e[16]=m):m=e[16];let p;return e[17]!==f||e[18]!==m?(p=o.jsxs(qe,{children:[f,m]}),e[17]=f,e[18]=m,e[19]=p):p=e[19],p}const cm="workspace-side-panel",yy="workspace-main-panel";function _y(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 l;e[1]!==s?(l=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s}),e[1]=s,e[2]=l):l=e[2];let a;return e[3]!==n||e[4]!==l||e[5]!==i?(a=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,l]})}),e[3]=n,e[4]=l,e[5]=i,e[6]=a):a=e[6],a}function i9e(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(A0e,{virtualMcpId:s,taskId:n,disableActiveMainToggle:i}),e[0]=i,e[1]=n,e[2]=s,e[3]=r):r=e[3],r}function r9e(t){const e=F.c(81),{virtualMcpId:s,taskId:n,entity:i,sidePanelOpen:r,mainOpen:l,toggleSidePanel:a,toggleMain:c,chatContent:d}=t,[u,h]=y$(),f=A.useRef(null);let m;e[0]!==l||e[1]!==r?(m=RO({sidePanelOpen:r,mainOpen:l}),e[0]=l,e[1]=r,e[2]=m):m=e[2];const p=m,g=r&&l?u:p.side,x=100-g;let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(WT,{}),e[3]=b):b=e[3];const v=b;let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(s9e,{}),e[4]=_):_=e[4];const y=_;let L;e[5]!==i?(L=o.jsx(Qhe,{virtualMcp:i}),e[5]=i,e[6]=L):L=e[6];const w=L,S=hs()?.currentBranch??null,k=qu();let j;e[7]!==k||e[8]!==S||e[9]!==i?(j=k&&L2(k)?o.jsx(gfe,{virtualMcp:i,currentBranch:S}):null,e[7]=k,e[8]=S,e[9]=i,e[10]=j):j=e[10];const C=j;let T,N;e[11]!==x||e[12]!==g?(T=()=>{f.current?.setLayout({[cm]:g,[yy]:x})},N=[g,x],e[11]=x,e[12]=g,e[13]=T,e[14]=N):(T=e[13],N=e[14]),A.useEffect(T,N);let P;e[15]!==l||e[16]!==r||e[17]!==c?(P=!l&&o.jsx(am,{side:"right",open:l,disabled:!r,onToggle:c}),e[15]=l,e[16]=r,e[17]=c,e[18]=P):P=e[18];let V;e[19]!==P?(V=o.jsxs(W5,{children:[y,o.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[v,P]})]}),e[19]=P,e[20]=V):V=e[20];const E=V,R=!l;let I;e[21]!==r||e[22]!==R||e[23]!==a?(I=o.jsx(am,{side:"left",open:r,disabled:R,onToggle:a}),e[21]=r,e[22]=R,e[23]=a,e[24]=I):I=e[24];const D=!r;let O;e[25]!==D||e[26]!==n||e[27]!==s?(O=o.jsx(i9e,{virtualMcpId:s,taskId:n,disableActiveMainToggle:D}),e[25]=D,e[26]=n,e[27]=s,e[28]=O):O=e[28];let $;e[29]!==I||e[30]!==O?($=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]=$):$=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(vQ,{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];let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(yQ,{}),e[35]=B):B=e[35];const U=!r;let H;e[36]!==l||e[37]!==U||e[38]!==c?(H=o.jsx(am,{side:"right",open:l,disabled:U,onToggle:c}),e[36]=l,e[37]=U,e[38]=c,e[39]=H):H=e[39];let W;e[40]!==w||e[41]!==H?(W=o.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-1",children:[B,w,H]}),e[40]=w,e[41]=H,e[42]=W):W=e[42];let K;e[43]!==z||e[44]!==W?(K=o.jsxs("div",{className:"flex min-w-0 shrink items-center justify-end gap-1",children:[z,W]}),e[43]=z,e[44]=W,e[45]=K):K=e[45];let Q;e[46]!==$||e[47]!==K?(Q=o.jsxs(W5,{className:"justify-between gap-2",children:[$,M,K]}),e[46]=$,e[47]=K,e[48]=Q):Q=e[48];const X=Q,se=`${s}-${n}`;let ne,te;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=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[49]=ne,e[50]=te):(ne=e[49],te=e[50]);let ee;e[51]!==l||e[52]!==h||e[53]!==r?(ee=(we,Ne)=>{const{isUserInteraction:je}=Ne,_e=we[cm];je&&r&&l&&typeof _e=="number"&&_e>0&&_e<100&&h(_e)},e[51]=l,e[52]=h,e[53]=r,e[54]=ee):ee=e[54];const Y=`${p.side}%`,q=r?"":void 0,oe=r?E:null;let J;e[55]!==d||e[56]!==r?(J=r&&o.jsx(rC,{chatContent:d}),e[55]=d,e[56]=r,e[57]=J):J=e[57];let ie;e[58]!==oe||e[59]!==J?(ie=o.jsx(_y,{testId:"side-panel",header:oe,children:J}),e[58]=oe,e[59]=J,e[60]=ie):ie=e[60];let Z;e[61]!==Y||e[62]!==q||e[63]!==ie?(Z=o.jsx(yc,{id:cm,defaultSize:Y,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":q,className:"min-w-0 overflow-hidden bg-sidebar",children:ie}),e[61]=Y,e[62]=q,e[63]=ie,e[64]=Z):Z=e[64];let he;e[65]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx(Dm,{className:"bg-sidebar"}),e[65]=he):he=e[65];const de=`${p.main}%`,ae=l?"":void 0,ce=l?X:null;let ue;e[66]!==n||e[67]!==s?(ue=o.jsx(Vj,{taskId:n,virtualMcpId:s}),e[66]=n,e[67]=s,e[68]=ue):ue=e[68];let G;e[69]!==ce||e[70]!==ue?(G=o.jsx(_y,{testId:"main-panel",header:ce,children:ue}),e[69]=ce,e[70]=ue,e[71]=G):G=e[71];let me;e[72]!==de||e[73]!==ae||e[74]!==G?(me=o.jsx(yc,{id:yy,defaultSize:de,minSize:"20%",collapsible:!0,collapsedSize:"0%","data-workspace-panel-open":ae,className:"min-w-0 overflow-hidden bg-sidebar",children:G}),e[72]=de,e[73]=ae,e[74]=G,e[75]=me):me=e[75];let ye;return e[76]!==se||e[77]!==ee||e[78]!==Z||e[79]!==me?(ye=o.jsx(bQ,{children:o.jsxs(Rm,{ref:f,orientation:"horizontal",className:ne,style:te,onLayoutChanged:ee,children:[Z,he,me]},se)}),e[76]=se,e[77]=ee,e[78]=Z,e[79]=me,e[80]=ye):ye=e[80],ye}const dm="__mobile-main-panel-tab-select__";function o9e({tabs:t,activeTab:e,mainOpen:s,t:n}){const i=t.find(l=>l.id===e),r=n("mainPanelTabs.mobileMainPanelTabSelect.mainView");return s?i?.title??r:i?.title??t[0]?.title??r}const l9e={kind:"component",Component:E6},a9e={kind:"component",Component:V6},c9e={kind:"component",Component:Go};function d9e(t){const e=F.c(62),{virtualMcpId:s,taskId:n}=t,i=le(),r=rn(),{openPanel:l}=Di();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const c=il(a);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:u,activeTab:h,mainOpen:f}=Vg(d),{org:m}=He(),p=F6();let g;e[4]!==m.id?(g=Oh(m.id),e[4]=m.id,e[5]=g):g=e[5];const x=s===g,b=!!(c.org&&c.taskId);let v;e[6]!==i?(v=i("mainPanelTabs.mobileMainPanelTabSelect.chat"),e[6]=i,e[7]=v):v=e[7];let _;e[8]!==v?(_={value:"chat",title:v,icon:l9e},e[8]=v,e[9]=_):_=e[9];let y;if(e[10]!==b||e[11]!==i||e[12]!==_||e[13]!==u){let B,U;e[15]!==b||e[16]!==i?(B=b?[{value:"board",title:i("mainPanelTabs.mobileMainPanelTabSelect.tasks"),icon:a9e}]:[],U=b?[{value:"files",title:i("mainPanelTabs.mobileMainPanelTabSelect.library"),icon:c9e}]:[],e[15]=b,e[16]=i,e[17]=B,e[18]=U):(B=e[17],U=e[18]),y=[_,...u.map(p9e),...B,...U],e[10]=b,e[11]=i,e[12]=_,e[13]=u,e[14]=y}else y=e[14];const L=y;let w;e[19]!==h||e[20]!==f||e[21]!==L?(w=f?L.find(B=>B.value===h)?.value??h:"chat",e[19]=h,e[20]=f,e[21]=L,e[22]=w):w=e[22];const S=w;let k;e[23]!==S||e[24]!==L?(k=L.find(B=>B.value===S),e[23]=S,e[24]=L,e[25]=k):k=e[25];const j=k;let C;e[26]!==h||e[27]!==f||e[28]!==j?.title||e[29]!==i||e[30]!==u?(C=j?.title??o9e({tabs:u,activeTab:h,mainOpen:f,t:i}),e[26]=h,e[27]=f,e[28]=j?.title,e[29]=i,e[30]=u,e[31]=C):C=e[31];const T=C;let N;e[32]!==r||e[33]!==x||e[34]!==l||e[35]!==m.id||e[36]!==p||e[37]!==s?(N=B=>{if(B!==dm){if(Ge("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:B,source:"mobile_select"}),c6({reportsOnly:p,onReportAgent:x,tabId:B})){l(B,{virtualmcpid:Oh(m.id),search:m9e});return}if(B==="chat"){r({to:".",search:f9e,replace:!0});return}l(B,{search:h9e})}},e[32]=r,e[33]=x,e[34]=l,e[35]=m.id,e[36]=p,e[37]=s,e[38]=N):N=e[38];const P=N;let V;e[39]!==i?(V=i("mainPanelTabs.mobileMainPanelTabSelect.view"),e[39]=i,e[40]=V):V=e[40];let E;e[41]!==j?(E=j&&o.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:o.jsx(ux,{icon:j.icon,className:"size-5"})}),e[41]=j,e[42]=E):E=e[42];let R;e[43]!==T?(R=o.jsx("span",{className:"min-w-0 truncate",children:T}),e[43]=T,e[44]=R):R=e[44];let I;e[45]!==E||e[46]!==R?(I=o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[E,R]}),e[45]=E,e[46]=R,e[47]=I):I=e[47];let D;e[48]!==V||e[49]!==I?(D=o.jsx(Ss,{"aria-label":V,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:I}),e[48]=V,e[49]=I,e[50]=D):D=e[50];let O;e[51]!==T?(O=o.jsx(It,{value:dm,disabled:!0,hideCheck:!0,className:"hidden",children:T}),e[51]=T,e[52]=O):O=e[52];let $;e[53]!==L?($=L.map(u9e),e[53]=L,e[54]=$):$=e[54];let M;e[55]!==O||e[56]!==$?(M=o.jsxs(ks,{align:"end",className:"w-56",children:[O,$]}),e[55]=O,e[56]=$,e[57]=M):M=e[57];let z;return e[58]!==P||e[59]!==D||e[60]!==M?(z=o.jsxs(ws,{value:dm,onValueChange:P,children:[D,M]}),e[58]=P,e[59]=D,e[60]=M,e[61]=z):z=e[61],z}function u9e(t){return o.jsx(It,{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(ux,{icon:t.icon})}),o.jsx("span",{className:"min-w-0 truncate",children:t.title})]})},t.value)}function h9e(t){return{...t,sidepanel:!1}}function f9e(t){return{...t,...IO()}}function m9e(t){return{...t,thread:void 0,sidepanel:!1}}function p9e(t){return{value:t.id,title:t.title,icon:t.icon}}function g9e(t,e){const s=F.c(35),n=Bf(),{locator:i}=He(),r=A.useSyncExternalStore(n.threads.subscribe,n.threads.get),l=A.useSyncExternalStore(n.threadsStatus.subscribe,n.threadsStatus.get);let a;s[0]!==t||s[1]!==r?(a=t===null?null:r.find(y=>y.id===t&&!y.partial)??null,s[0]=t,s[1]=r,s[2]=a):a=s[2];const c=a,[d,u]=A.useState(void 0);let h;s[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{u(void 0)},s[3]=h):h=s[3];let f;s[4]!==t?(f=[t],s[4]=t,s[5]=f):f=s[5],A.useEffect(h,f);let m,p;s[6]!==d||s[7]!==t||s[8]!==c||s[9]!==n||s[10]!==l.kind?(m=()=>{t!==null&&(c||l.kind!=="loading"&&d===void 0&&(u("pending"),n.fetchThreadIntoSlot(t).then(y=>{u(y)})))},p=[t,c,l.kind,d,n],s[6]=d,s[7]=t,s[8]=c,s[9]=n,s[10]=l.kind,s[11]=m,s[12]=p):(m=s[11],p=s[12]),A.useEffect(m,p);let g;s[13]!==i||s[14]!==n||s[15]!==e?(g={mutationFn:async y=>n.create({id:y,virtual_mcp_id:e,...PV(sessionStorage,i,y)})},s[13]=i,s[14]=n,s[15]=e,s[16]=g):g=s[16];const x=Es(g);let b,v;if(s[17]!==x||s[18]!==d||s[19]!==t||s[20]!==c||s[21]!==l.kind?(b=()=>{t!==null&&(c||d===null&&l.kind!=="loading"&&(x.isPending||x.variables!==t&&x.mutate(t)))},v=[t,c,d,l.kind,x],s[17]=x,s[18]=d,s[19]=t,s[20]=c,s[21]=l.kind,s[22]=b,s[23]=v):(b=s[22],v=s[23]),A.useEffect(b,v),t===null){let y;return s[24]===Symbol.for("react.memo_cache_sentinel")?(y={status:"ready",task:null},s[24]=y):y=s[24],y}if(c){let y;return s[25]!==c?(y={status:"ready",task:c},s[25]=c,s[26]=y):y=s[26],y}if(d&&typeof d=="object"){let y;return s[27]!==d?(y={status:"ready",task:d},s[27]=d,s[28]=y):y=s[28],y}if(x.data){let y;return s[29]!==x.data?(y={status:"ready",task:x.data},s[29]=x.data,s[30]=y):y=s[30],y}if(x.isError){let y;return s[31]!==x.error?(y={status:"error",error:x.error},s[31]=x.error,s[32]=y):y=s[32],y}if(x.isPending||l.kind!=="loading"){let y;return s[33]===Symbol.for("react.memo_cache_sentinel")?(y={status:"creating"},s[33]=y):y=s[33],y}let _;return s[34]===Symbol.for("react.memo_cache_sentinel")?(_={status:"loading"},s[34]=_):_=s[34],_}function x9e(){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=il(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[1]=n):n=t[1];const i=nl(n),r=s.org;if(!r||s.taskId!==void 0)return null;let l;t[2]!==s.panel||t[3]!==i.main?(l=ZC(i.main,s.panel),t[2]=s.panel,t[3]=i.main,t[4]=l):l=t[4];const a=l;if(!a)return null;if(a.to===null){let h;return t[5]!==a.search?(h=o.jsx(ni,{to:".",search:f=>({...f,...a.search}),replace:!0}),t[5]=a.search,t[6]=h):h=t[6],h}if(a.to==="/$org/agents/{-$panel}"){let h;t[7]!==r||t[8]!==a.panel?(h={org:r,panel:a.panel},t[7]=r,t[8]=a.panel,t[9]=h):h=t[9];let f;t[10]!==a.search?(f=p=>({...p,...a.search}),t[10]=a.search,t[11]=f):f=t[11];let m;return t[12]!==h||t[13]!==f?(m=o.jsx(ni,{to:"/$org/agents/{-$panel}",params:h,search:f,replace:!0}),t[12]=h,t[13]=f,t[14]=m):m=t[14],m}if(a.to==="/$org/tasks/{-$taskKey}"){let h;t[15]!==r||t[16]!==s.taskKey?(h={org:r,taskKey:s.taskKey},t[15]=r,t[16]=s.taskKey,t[17]=h):h=t[17];let f;t[18]!==a.search?(f=p=>({...p,...a.search}),t[18]=a.search,t[19]=f):f=t[19];let m;return t[20]!==h||t[21]!==f?(m=o.jsx(ni,{to:"/$org/tasks/{-$taskKey}",params:h,search:f,replace:!0}),t[20]=h,t[21]=f,t[22]=m):m=t[22],m}let c;t[23]!==r?(c={org:r},t[23]=r,t[24]=c):c=t[24];let d;t[25]!==a.search?(d=h=>({...h,...a.search}),t[25]=a.search,t[26]=d):d=t[26];let u;return t[27]!==c||t[28]!==d||t[29]!==a.to?(u=o.jsx(ni,{to:a.to,params:c,search:d,replace:!0}),t[27]=c,t[28]=d,t[29]=a.to,t[30]=u):u=t[30],u}function b9e(){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=il(e);let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[1]=n):n=t[1];const i=nl(n),{org:r,taskId:l}=s;if(!r||l===void 0)return null;let a;return t[2]!==r||t[3]!==i||t[4]!==l?(a=eN({org:r,taskId:l,search:i}),t[2]=r,t[3]=i,t[4]=l,t[5]=a):a=t[5],a}function v9e(){const t=F.c(29),e=b9e();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 l;return t[6]!==i||t[7]!==r?(l=o.jsx(ni,{to:"/$org/agents/{-$panel}",params:i,search:r,replace:!0}),t[6]=i,t[7]=r,t[8]=l):l=t[8],l}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(ni,{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(ni,{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(ni,{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(ni,{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 y9e(){const t=F.c(6),e=Yl(),s=rn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const{preview:i}=nl(n);if(!e||!i)return null;let r;t[1]!==s?(r=()=>s({to:".",search:_9e}),t[1]=s,t[2]=r):r=t[2];let l;return t[3]!==i||t[4]!==r?(l=o.jsx(Rk,{previewPath:i,onClose:r,showSeeInLibrary:!0}),t[3]=i,t[4]=r,t[5]=l):l=t[5],l}function _9e(t){const{preview:e,...s}=t;return s}const L9e=A.createContext(null);function oC(){return A.useContext(L9e)}const bc=A.createContext(null);function ao(){return A.use(bc)}function lC(t){const e=F.c(13),{children:s}=t,n=le(),i=Wu(),r=oC(),l=zf()!==null;let a;e[0]!==l||e[1]!==i||e[2]!==r?(a=o.jsx(k7,{}),e[0]=l,e[1]=i,e[2]=r,e[3]=a):a=e[3];const c=a;let d;e[4]!==n?(d=n("agentShellLayout.agentShellLayout.chatLoadingError"),e[4]=n,e[5]=d):d=e[5];let u;e[6]!==d?(u=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]=u):u=e[7];const h=s??c;let f;e[8]!==h?(f=o.jsx(wi,{children:h}),e[8]=h,e[9]=f):f=e[9];let m;return e[10]!==u||e[11]!==f?(m=o.jsx(sn,{fallback:u,children:f}),e[10]=u,e[11]=f,e[12]=m):m=e[12],m}function Ly(t){const e=F.c(13),{threadId:s,children:n}=t;if(le(),oC(),s===null){let r;return e[0]!==n?(r=o.jsx(an.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(an.ActiveTaskProvider,{taskId:s,children:n}),e[10]=n,e[11]=s,e[12]=i):i=e[12],i}function aC(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],A.useLayoutEffect(i),null}function wy({virtualMcpId:t,hasActiveGithubRepo:e,sandboxMap:s,children:n}){const i=le(),{currentBranch:r,activeTask:l,setCurrentTaskBranch:a}=on(),c=Wu(),d="agent-sandbox",{data:u}=vn.useSession(),h=u?.user?.id,f=!Gy({isDesktopApp:c,harnessId:l?.harness_id}),m=I$({agentSandboxMap:s,threadSandboxMap:l?.metadata?.sandboxMap,userId:h,ownerId:l?.created_by,branch:r}),p=e||jn(l?.metadata),g=A.useRef(null),x=f&&R$({threadLoaded:!!l,isOwner:!!h&&l?.created_by===h,hasActiveGithubRepo:p,branch:r??null,attempted:g.current===(l?.id??null)});A.useEffect(()=>{!x||!l||(g.current=l.id,a(Dl(u?.user?.name||u?.user?.email?.split("@")[0])))},[x,l,u,a]);const{org:b}=He(),v=Jf("cms_auto_fresh_branch"),_=yn(t),y=A.useRef(null),L=v&&_.resolved&&_.runtime==="cms"&&!!b?.slug&&!!r&&y.current!==(l?.id??null),S=Mt({...XM({orgSlug:b?.slug??"",virtualMcpId:t,branch:r??""}),enabled:L}).data?.lastCommitAt??null;A.useEffect(()=>{!L||!l||JM(S,Date.now())&&(y.current=l.id,a(Dl(u?.user?.name||u?.user?.email?.split("@")[0])))},[L,S,l,u,a]);const k=_.resolved?_.runtime:null,j=VO(t,r??void 0),T=(h&&r?ZP(m?.[h]?.[r]):{})[d]??null,N=T?.previewUrl??null,P=f&&k!=="cms"&&(!!T||j);return f?k==="cms"?o.jsx(cb,{children:n},`${t}:${r??"no-branch"}:${l?.id??""}`):o.jsx(V$,{virtualMcpId:t,branch:r??null,previewUrl:N,enabled:P,children:o.jsx(K$,{executionEnabled:f,virtualMcpId:t,branch:r??null,userId:h??null,hasActiveGithubRepo:p,vmEntry:T,threadId:l?.id??null,children:o.jsx(cb,{children:n},`${t}:${r??"no-branch"}:${l?.id??""}`)})},l?.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(Ci,{image:o.jsx(Vn,{size:48,className:"text-muted-foreground"}),title:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWeb"),description:i("agentShellLayout.agentShellLayout.runtimeUnavailableOnWebDescription")})})})}function w9e(t){const e=F.c(15),{entity:s,virtualMcpId:n,layout:i,onNewTaskRef:r}=t;let l;e[0]!==i.createNewTask||e[1]!==r?(l=o.jsx(aC,{onNewTaskRef:r,createNewTask:i.createNewTask}),e[0]=i.createNewTask,e[1]=r,e[2]=l):l=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(lC,{}),e[3]=a):a=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(wi,{children:o.jsx(r9e,{virtualMcpId:n,taskId:i.threadId,entity:s,sidePanelOpen:i.sidePanelOpen,mainOpen:i.mainOpen,toggleSidePanel:i.toggleSidePanel,toggleMain:i.toggleMain,chatContent:a})}),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]!==l||e[13]!==c?(d=o.jsxs(o.Fragment,{children:[l,c]}),e[12]=l,e[13]=c,e[14]=d):d=e[14],d}function S9e(t){const e=F.c(19),{virtualMcpId:s,layout:n,onNewTaskRef:i}=t,r=le();let l;e[0]!==n.mainOpen||e[1]!==n.sidePanelOpen||e[2]!==n.sidePanelParamPresent?(l=DO({visibility:{sidePanelOpen:n.sidePanelOpen,mainOpen:n.mainOpen},sidePanelParamPresent:n.sidePanelParamPresent}),e[0]=n.mainOpen,e[1]=n.sidePanelOpen,e[2]=n.sidePanelParamPresent,e[3]=l):l=e[3];const a=l;let c;e[4]!==n.threadId||e[5]!==s?(c=o.jsx(vA.Tabs,{children:o.jsx(d9e,{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(aC,{onNewTaskRef:i,createNewTask:n.createNewTask}),e[7]=n.createNewTask,e[8]=i,e[9]=d):d=e[9];let u;e[10]!==n.threadId||e[11]!==a||e[12]!==r||e[13]!==s?(u=o.jsx(wi,{children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:a==="main"?o.jsx(sn,{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(wi,{children:o.jsx("div",{"data-testid":"main-panel",className:"h-full",children:o.jsx(Vj,{taskId:n.threadId,virtualMcpId:s})})})}):o.jsx(rC,{chatContent:o.jsx(lC,{})})})}),e[10]=n.threadId,e[11]=a,e[12]=r,e[13]=s,e[14]=u):u=e[14];let h;return e[15]!==c||e[16]!==d||e[17]!==u?(h=o.jsxs(o.Fragment,{children:[c,d,u]}),e[15]=c,e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function k9e(){const t=F.c(101),e=le(),s=Yl(),n=rn(),{org:i}=He();bA(i.slug);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[0]=r):r=t[0];const a=il(r).org??"",c=zf(),d=NV(),[u]=A.useState(j9e),{data:h}=vn.useSession(),f=Bf(),m=A.useSyncExternalStore(f.threads.subscribe,f.threads.get),p=g9e(c,d);OO(p.status==="ready"?p.task:null);const g=vs(d),x=g?.metadata?.ui?.layout??null;let b;t[1]!==x?(b=x?{defaultMainView:x.defaultMainView??null,chatDefaultOpen:x.chatDefaultOpen??null}:null,t[1]=x,t[2]=b):b=t[2];const v=b;let _;t[3]!==g?(_=g&&io(g),t[3]=g,t[4]=_):_=t[4];const y=!!_;let L;t[5]!==d?(L={virtualMcpId:d,isAgentRoute:!0},t[5]=d,t[6]=L):L=t[6];const w=MO(v,L),S=A.useRef(null);let k,j;if(t[7]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{const $=M=>{a6(M)&&M.shiftKey&&M.code==="KeyS"&&!M.repeat&&(M.preventDefault(),S.current?.())};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},j=[],t[7]=k,t[8]=j):(k=t[7],j=t[8]),A.useEffect(k,j),c===null&&y){let $;t[9]!==g.metadata||t[10]!==u||t[11]!==y||t[12]!==h?.user?.id||t[13]!==m||t[14]!==d?($=xA(m,d,h?.user?.id,S2(g.metadata),y)?.id??u,t[9]=g.metadata,t[10]=u,t[11]=y,t[12]=h?.user?.id,t[13]=m,t[14]=d,t[15]=$):$=t[15];const M=$;let z;return t[16]!==M?(z=o.jsx(ni,{to:".",replace:!0,search:B=>({...B,thread:M})}),t[16]=M,t[17]=z):z=t[17],z}const C=d;let T;t[18]!==g||t[19]!==d?(T={virtualMcpId:d,entity:g},t[18]=g,t[19]=d,t[20]=T):T=t[20];const N=T;if(p.status==="creating"||p.status==="loading"){let $;t[21]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(it,{className:"size-4 mr-2"}),t[21]=$):$=t[21];let M;t[22]!==e?(M=e("agentShellLayout.agentShellLayout.creatingTask"),t[22]=e,t[23]=M):M=t[23];let z;t[24]!==M?(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:[$,M]})}),t[24]=M,t[25]=z):z=t[25];let B;return t[26]!==N||t[27]!==z?(B=o.jsx(bc,{value:N,children:z}),t[26]=N,t[27]=z,t[28]=B):B=t[28],B}if(p.status==="error"){let $;t[29]!==e?($=e("agentShellLayout.agentShellLayout.taskUnavailable"),t[29]=e,t[30]=$):$=t[30];let M;t[31]!==$?(M=o.jsx("div",{className:"font-medium",children:$}),t[31]=$,t[32]=M):M=t[32];let z;t[33]!==p.error.message?(z=o.jsx("div",{className:"text-muted-foreground",children:p.error.message}),t[33]=p.error.message,t[34]=z):z=t[34];let B;t[35]!==M||t[36]!==z?(B=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:[M,z]})}),t[35]=M,t[36]=z,t[37]=B):B=t[37];let U;return t[38]!==N||t[39]!==B?(U=o.jsx(bc,{value:N,children:B}),t[38]=N,t[39]=B,t[40]=U):U=t[40],U}if(!g){let $;t[41]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Vn,{size:48,className:"text-muted-foreground"}),t[41]=$):$=t[41];let M;t[42]!==e?(M=e("agentShellLayout.agentShellLayout.agentNotFound"),t[42]=e,t[43]=M):M=t[43];let z;t[44]!==e||t[45]!==d?(z=e("agentShellLayout.agentShellLayout.agentNotFoundDescription",{virtualMcpId:d}),t[44]=e,t[45]=d,t[46]=z):z=t[46];let B;t[47]!==n||t[48]!==a?(B=()=>n({to:"/$org",params:{org:a}}),t[47]=n,t[48]=a,t[49]=B):B=t[49];let U;t[50]!==e?(U=e("agentShellLayout.agentShellLayout.goToOrgHome"),t[50]=e,t[51]=U):U=t[51];let H;t[52]!==B||t[53]!==U?(H=o.jsx(fe,{variant:"outline",onClick:B,children:U}),t[52]=B,t[53]=U,t[54]=H):H=t[54];let W;t[55]!==H||t[56]!==M||t[57]!==z?(W=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(Ci,{image:$,title:M,description:z,actions:H})})}),t[55]=H,t[56]=M,t[57]=z,t[58]=W):W=t[58];let K;return t[59]!==N||t[60]!==W?(K=o.jsx(bc,{value:N,children:W}),t[59]=N,t[60]=W,t[61]=K):K=t[61],K}if(s){const $=p.status==="ready"?p.task:null,M=g?.metadata?.sandboxMap;let z;t[62]!==C||t[63]!==w?(z=o.jsx(wi,{children:o.jsx(S9e,{virtualMcpId:C,layout:w,onNewTaskRef:S})}),t[62]=C,t[63]=w,t[64]=z):z=t[64];let B;t[65]!==w.providerKey||t[66]!==w.threadId||t[67]!==z?(B=o.jsx(Ly,{threadId:w.threadId,children:z},w.providerKey),t[65]=w.providerKey,t[66]=w.threadId,t[67]=z,t[68]=B):B=t[68];let U;t[69]!==y||t[70]!==B||t[71]!==M||t[72]!==d?(U=o.jsx(wy,{virtualMcpId:d,hasActiveGithubRepo:y,sandboxMap:M,children:B}),t[69]=y,t[70]=B,t[71]=M,t[72]=d,t[73]=U):U=t[73];let H;t[74]!==C||t[75]!==U||t[76]!==$?(H=o.jsx("div",{className:"flex flex-col flex-1 min-w-0 bg-background min-h-0",children:o.jsx(an.Provider,{virtualMcpId:C,task:$,children:U},C)}),t[74]=C,t[75]=U,t[76]=$,t[77]=H):H=t[77];let W;return t[78]!==N||t[79]!==H?(W=o.jsx(bc,{value:N,children:H}),t[78]=N,t[79]=H,t[80]=W):W=t[80],W}const P=p.status==="ready"?p.task:null,V=g?.metadata?.sandboxMap;let E;t[81]!==g||t[82]!==w||t[83]!==d?(E=o.jsx(wi,{children:o.jsx(w9e,{entity:g,virtualMcpId:d,layout:w,onNewTaskRef:S})}),t[81]=g,t[82]=w,t[83]=d,t[84]=E):E=t[84];let R;t[85]!==w.providerKey||t[86]!==w.threadId||t[87]!==E?(R=o.jsx(Ly,{threadId:w.threadId,children:E},w.providerKey),t[85]=w.providerKey,t[86]=w.threadId,t[87]=E,t[88]=R):R=t[88];let I;t[89]!==y||t[90]!==R||t[91]!==V||t[92]!==d?(I=o.jsx(wy,{virtualMcpId:d,hasActiveGithubRepo:y,sandboxMap:V,children:R}),t[89]=y,t[90]=R,t[91]=V,t[92]=d,t[93]=I):I=t[93];let D;t[94]!==C||t[95]!==I||t[96]!==P?(D=o.jsx(an.Provider,{virtualMcpId:C,task:P,children:I},C),t[94]=C,t[95]=I,t[96]=P,t[97]=D):D=t[97];let O;return t[98]!==N||t[99]!==D?(O=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsx(bc,{value:N,children:D})}),t[98]=N,t[99]=D,t[100]=O):O=t[100],O}function j9e(){return crypto.randomUUID()}function C9e(){const t=F.c(3);let e,s;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(v9e,{}),s=o.jsx(x9e,{}),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(wi,{children:[e,s,o.jsxs(EA,{children:[o.jsx(k9e,{}),o.jsx(y9e,{})]})]}),t[2]=n):n=t[2],n}const N9e=Object.freeze(Object.defineProperty({__proto__:null,default:C9e,useInsetContext:ao},Symbol.toStringTag,{value:"Module"}));export{fr as $,i2e as A,r2e as B,xk as C,Wpe as D,nh as E,Kpe as F,g3 as G,Au as H,qpe as I,$se as J,Mw as K,mg as L,hw as M,Rg as N,Mc as O,a0 as P,c0 as Q,vK as R,$i as S,Qt as T,Ug as U,Oc as V,zg as W,O_ as X,Og as Y,v_ as Z,Fg as _,m0 as a,_pe as a$,yre as a0,Lre as a1,Bn as a2,Ype as a3,Bg as a4,bk as a5,Gpe as a6,fpe as a7,mf as a8,Ei as a9,Lne as aA,Pne as aB,Fpe as aC,$w as aD,ff as aE,bte as aF,lpe as aG,bne as aH,Ipe as aI,zw as aJ,gpe as aK,zpe as aL,Hpe as aM,Upe as aN,hne as aO,oX as aP,lX as aQ,Bpe as aR,F3 as aS,DS as aT,Rre as aU,zc as aV,cd as aW,xpe as aX,Spe as aY,FX as aZ,kpe as a_,CS as aa,P9 as ab,$g as ac,yS as ad,js as ae,wpe as af,Rpe as ag,uee as ah,Dpe as ai,dee as aj,rne as ak,K3 as al,rpe as am,QS as an,yne as ao,Hne as ap,j9 as aq,k3 as ar,ao as as,Iie as at,cf as au,ip as av,Fl as aw,$pe as ax,hp as ay,sk as az,so as b,EX as b0,ppe as b1,Lpe as b2,ype as b3,vpe as b4,Ppe as b5,cX as b6,x3 as b7,hpe as b8,mpe as b9,Zpe as bA,Jpe as bB,s2e as bC,_f as bD,Vre as bE,n2e as bF,ipe as bG,YQ as bH,QQ as bI,N9e as bJ,upe as ba,Epe as bb,z3 as bc,Ew as bd,Pw as be,ope as bf,aX as bg,ape as bh,cpe as bi,GZ as bj,Npe as bk,Vpe as bl,bpe as bm,Cpe as bn,jpe as bo,Tpe as bp,wne as bq,W3 as br,Ope as bs,Fne as bt,Mpe as bu,Qpe as bv,Xpe as bw,e2e as bx,Tl as by,t2e as bz,df as c,P3 as d,x0 as e,Nc as f,kn as g,Ape as h,R3 as i,hie as j,spe as k,of as l,npe as m,Qie as n,dpe as o,yn as p,_X as q,Die as r,Yj as s,Ere as t,rl as u,LX as v,Fd as w,pk as x,fc as y,zb as z};