decocms 4.319.11 → 4.319.12

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 (247) hide show
  1. package/dist/client/assets/{AlertCircle-C8XDzPRu.js → AlertCircle-ClToruK0.js} +1 -1
  2. package/dist/client/assets/{AreaChart-BFuLhEAJ.js → AreaChart-BfrQSNFq.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-CTfYqAeL.js → ArrowLeft-B4E-Sahc.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-Dndx_psT.js → ArrowUp-CNhm6eFH.js} +1 -1
  5. package/dist/client/assets/{Check-Bxq3sAMT.js → Check-PMgjjdTe.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-OPjRGmHJ.js → CheckCircle-RBxlsZl2.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-B78Z7JhJ.js → ChevronDown-oY26mbX7.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-DoxpMYgv.js → ChevronRight-BEHZ6NZL.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-CqkEIUhB.js → ChevronSelectorVertical-JcGnBvEL.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-BLvCCCZc.js → ChevronUp-BZirzRB6.js} +1 -1
  11. package/dist/client/assets/{Copy01-CS_So4Uz.js → Copy01-B_2vcBlF.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-CpyYSvQ3.js → CreditCard01-ChimmSCJ.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-CL1uf5Bu.js → DotsVertical-Cft1i3iA.js} +1 -1
  14. package/dist/client/assets/{Download01-CxWUyG_X.js → Download01-CA2CYlYl.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-BOZ7dcPi.js → ErrorBarContext-Cm9VzL4a.js} +1 -1
  16. package/dist/client/assets/{Eye-CmND_DBa.js → Eye-DVnZY3NV.js} +1 -1
  17. package/dist/client/assets/{FilterLines-CSE_Ogu_.js → FilterLines-DrGmxI0g.js} +1 -1
  18. package/dist/client/assets/{GitBranch01-D_a1MiQQ.js → GitBranch01-DQckacwW.js} +1 -1
  19. package/dist/client/assets/{Globe01-Cm4DSICd.js → Globe01-jbXb6ulu.js} +1 -1
  20. package/dist/client/assets/{Globe04-DbBcV-E2.js → Globe04-xCK3nTmA.js} +1 -1
  21. package/dist/client/assets/{HardDrive-B4mHXAle.js → HardDrive-C9KdcNlI.js} +1 -1
  22. package/dist/client/assets/{Image01-DDlYl6aL.js → Image01-CRujAxHg.js} +1 -1
  23. package/dist/client/assets/{Key01-GYKWVO36.js → Key01-DK8RhZHE.js} +1 -1
  24. package/dist/client/assets/{LinkExternal01-BiUY26Aw.js → LinkExternal01-BtC-p5Va.js} +1 -1
  25. package/dist/client/assets/{LockUnlocked01-DDHVAeu0.js → LockUnlocked01-B2L4GLRl.js} +1 -1
  26. package/dist/client/assets/{LogOut01-L3qCYWBe.js → LogOut01-D5WcJfJs.js} +1 -1
  27. package/dist/client/assets/{Monitor01-DDDZk1T8.js → Monitor01-CQH6tCva.js} +1 -1
  28. package/dist/client/assets/{Package-BQ4aGZ5C.js → Package-CORPPwT-.js} +1 -1
  29. package/dist/client/assets/{Palette-CMzcklHM.js → Palette-dFQD8LKQ.js} +1 -1
  30. package/dist/client/assets/{Play-DjvcK07v.js → Play-CcGw_Uni.js} +1 -1
  31. package/dist/client/assets/{Plus-DD6ql5SQ.js → Plus-bwHRKSue.js} +1 -1
  32. package/dist/client/assets/{SearchLg-DrCbydJX.js → SearchLg-kHGYPtIw.js} +1 -1
  33. package/dist/client/assets/{SearchMd-CYXNgks8.js → SearchMd-CrM8FgeA.js} +1 -1
  34. package/dist/client/assets/{Sector-DxIBB5iA.js → Sector-vmxMniJ8.js} +1 -1
  35. package/dist/client/assets/{Settings02-BkuHKQTT.js → Settings02-gqR-NFC9.js} +1 -1
  36. package/dist/client/assets/{Share07-DFkS5ZA9.js → Share07-BJMsRk6Q.js} +1 -1
  37. package/dist/client/assets/{Shield01-BqNKNsE_.js → Shield01-B3IGGfe8.js} +1 -1
  38. package/dist/client/assets/{Stars01-DLcNnYnQ.js → Stars01-CyIrFIKT.js} +1 -1
  39. package/dist/client/assets/{Stars02-DpgnX4j3.js → Stars02-CgssSvzZ.js} +1 -1
  40. package/dist/client/assets/{Sun-Cfdg0-fN.js → Sun-BFVshSLm.js} +1 -1
  41. package/dist/client/assets/{SwitchHorizontal01-CDfbzUMe.js → SwitchHorizontal01-CmezVjc5.js} +1 -1
  42. package/dist/client/assets/{Tool01-BkIa9J-T.js → Tool01-DP7l3n3Y.js} +1 -1
  43. package/dist/client/assets/{Tool02-LyDsiEcj.js → Tool02-BvJSq7kS.js} +1 -1
  44. package/dist/client/assets/{Trash01-DMEyL-_r.js → Trash01-8aRDtn4y.js} +1 -1
  45. package/dist/client/assets/{TrendUp01-CRVwTA9x.js → TrendUp01-iZTQHtO4.js} +1 -1
  46. package/dist/client/assets/{Upload01-BXETp31V.js → Upload01-zJC35Q7D.js} +1 -1
  47. package/dist/client/assets/{User01--NR0wcxR.js → User01-Cg1rezA0.js} +1 -1
  48. package/dist/client/assets/{UserSquare-BDMyjzaF.js → UserSquare-Bxd4pDXm.js} +1 -1
  49. package/dist/client/assets/{Users01-CYdUUADt.js → Users01-BjZALObG.js} +1 -1
  50. package/dist/client/assets/{Users03-BJfM2ts1.js → Users03-DLm7BQsJ.js} +1 -1
  51. package/dist/client/assets/{XCircle-D1lTnv45.js → XCircle-DQCubZzT.js} +1 -1
  52. package/dist/client/assets/{XClose-7CTyOeCs.js → XClose-DAiJgSzs.js} +1 -1
  53. package/dist/client/assets/{YAxis-BZmDD3lJ.js → YAxis-Dcyix6od.js} +1 -1
  54. package/dist/client/assets/{Zap-Bzfi7ZdU.js → Zap-DnE9jTWD.js} +1 -1
  55. package/dist/client/assets/{ZapSquare-C6EnYa3u.js → ZapSquare-CqhgOeLt.js} +1 -1
  56. package/dist/client/assets/{ZoomOut-BQOaUyto.js → ZoomOut-nXvYYjVw.js} +1 -1
  57. package/dist/client/assets/{access-gate-3UKF-T20.js → access-gate-_zqgY-K4.js} +1 -1
  58. package/dist/client/assets/{agent-icon-CEcN5Ilk.js → agent-icon-CqMkVI2H.js} +1 -1
  59. package/dist/client/assets/{agents-list-DW-wbAoT.js → agents-list-CwEiM3H8.js} +1 -1
  60. package/dist/client/assets/{ai-providers-CgPv--a3.js → ai-providers-DmcZJOxT.js} +1 -1
  61. package/dist/client/assets/{alert-DRkYko5H.js → alert-BR-p4tVC.js} +1 -1
  62. package/dist/client/assets/{alert-dialog-BwmNFu1l.js → alert-dialog-DHosdfGA.js} +1 -1
  63. package/dist/client/assets/{analytics-tab-D9IxcyEr.js → analytics-tab-HW971fV1.js} +1 -1
  64. package/dist/client/assets/{api-keys-BHFa04t3.js → api-keys-B2mOY4WU.js} +1 -1
  65. package/dist/client/assets/{app-editor-DBcySaWI.js → app-editor-CKOBupDJ.js} +1 -1
  66. package/dist/client/assets/{auth-CJkvZW-k.js → auth-Cdu_Esoc.js} +1 -1
  67. package/dist/client/assets/{auth-catchall-D5gdcATu.js → auth-catchall-CiyXXkH8.js} +1 -1
  68. package/dist/client/assets/{auth-entry-Dz_QxirS.js → auth-entry-FfywnvVK.js} +1 -1
  69. package/dist/client/assets/{auth-split-layout-BzJIXr1y.js → auth-split-layout-F9RN8kfA.js} +1 -1
  70. package/dist/client/assets/{authenticate-and-persist-oauth-B-zmVWY9.js → authenticate-and-persist-oauth-CxNMau8p.js} +1 -1
  71. package/dist/client/assets/{automation-list-row-LC7AzU8H.js → automation-list-row-DlhKbcWS.js} +1 -1
  72. package/dist/client/assets/{automation-runs-DhRngbfS.js → automation-runs-BSZspOPk.js} +1 -1
  73. package/dist/client/assets/{automations-Dpuh5mTg.js → automations-Bsy1xegM.js} +1 -1
  74. package/dist/client/assets/{avatar-Be32ceEV.js → avatar-C4y8xmhb.js} +1 -1
  75. package/dist/client/assets/{badge-DeycDEDa.js → badge-bKgqq_hn.js} +1 -1
  76. package/dist/client/assets/{block-document-0VJ4mJz2.js → block-document-Cq9xvEs5.js} +1 -1
  77. package/dist/client/assets/{breadcrumb-BkUUiSOA.js → breadcrumb-BxiaCaRI.js} +1 -1
  78. package/dist/client/assets/{buckets-DjkxmYYc.js → buckets-D2H9tI7C.js} +1 -1
  79. package/dist/client/assets/{bulk-category-panel-DITCXe6Q.js → bulk-category-panel-Bs99v8a6.js} +1 -1
  80. package/dist/client/assets/{capability-load-error-D6ZvKvlf.js → capability-load-error-BMapM_nu.js} +1 -1
  81. package/dist/client/assets/{cards-odjp1n2S.js → cards-AKnEBiwF.js} +1 -1
  82. package/dist/client/assets/{category-editor-T2MgeHT9.js → category-editor-CeGZPq10.js} +1 -1
  83. package/dist/client/assets/{cdn-tab-D-8RFlx4.js → cdn-tab-BkoLgXRq.js} +1 -1
  84. package/dist/client/assets/{chart-jg4AMjQe.js → chart-DsFfwadF.js} +1 -1
  85. package/dist/client/assets/{chat-context-VFkTmrKQ.js → chat-context-Bv0NCGao.js} +1 -1
  86. package/dist/client/assets/{checkbox-5B3Nsb_j.js → checkbox-DC7ImXSU.js} +1 -1
  87. package/dist/client/assets/{choose-editor-KuVvTNHJ.js → choose-editor-CQ2RdklR.js} +1 -1
  88. package/dist/client/assets/{cli-auth-success-yOUjDdHq.js → cli-auth-success-C386HV7Q.js} +1 -1
  89. package/dist/client/assets/{collection-detail-Bn7-81rP.js → collection-detail-BGM1bL7e.js} +1 -1
  90. package/dist/client/assets/{collection-display-button-DuqsXIIA.js → collection-display-button-Y0tL3jai.js} +1 -1
  91. package/dist/client/assets/{collection-search-Czd9Mfxw.js → collection-search-BYP7-ZxX.js} +1 -1
  92. package/dist/client/assets/{collection-table-wrapper-rSXxT4FT.js → collection-table-wrapper-D-Nt7RKb.js} +1 -1
  93. package/dist/client/assets/{collection-tabs-BjHY3CU9.js → collection-tabs-CL2MtumN.js} +1 -1
  94. package/dist/client/assets/{command-DIZ2TwJ6.js → command-D92GDJ41.js} +1 -1
  95. package/dist/client/assets/{commerce-onboarding-CkB2ni0H.js → commerce-onboarding-DH9EqffA.js} +1 -1
  96. package/dist/client/assets/{config-DlgHqtbo.js → config-uvG_j2hY.js} +1 -1
  97. package/dist/client/assets/{connect-BCbNCJEo.js → connect-0_8Pifz1.js} +1 -1
  98. package/dist/client/assets/{connection-iXS4K9V0.js → connection-B4xscr6U.js} +1 -1
  99. package/dist/client/assets/{connection-card-CxFJyjO4.js → connection-card-Dyoy7mvf.js} +1 -1
  100. package/dist/client/assets/{connection-detail-B9Zh-X_H.js → connection-detail-ihgx40IB.js} +1 -1
  101. package/dist/client/assets/{connection-form-helpers-DjjPEqBy.js → connection-form-helpers-B2TmfMw7.js} +1 -1
  102. package/dist/client/assets/{connections-BqxcXL-b.js → connections-Cl1sPtGg.js} +1 -1
  103. package/dist/client/assets/{decopilot-sse-pool-C_kQApdo.js → decopilot-sse-pool-ULdMGH4U.js} +1 -1
  104. package/dist/client/assets/{dialog-DJ6N9l-G.js → dialog-BSQPsnMV.js} +1 -1
  105. package/dist/client/assets/{domain-settings-5FqfMlZM.js → domain-settings-DzbX9zl8.js} +1 -1
  106. package/dist/client/assets/{drawer-BYjZcQUP.js → drawer-s9F4KtK0.js} +1 -1
  107. package/dist/client/assets/{dropdown-menu-BdmGKLTp.js → dropdown-menu-Br5tvBrx.js} +1 -1
  108. package/dist/client/assets/{e2e-tab-Dmto2BvH.js → e2e-tab-CDsd7wp2.js} +1 -1
  109. package/dist/client/assets/{editor-RaHtOP3X.js → editor-99Sk7gK7.js} +1 -1
  110. package/dist/client/assets/{empty-state--CA0lu67.js → empty-state-BzoJWDN3.js} +1 -1
  111. package/dist/client/assets/{empty-state-DGCuDv4_.js → empty-state-FLuorgA8.js} +1 -1
  112. package/dist/client/assets/{extract-connection-data-CpinTMij.js → extract-connection-data-DMuGjDrw.js} +1 -1
  113. package/dist/client/assets/{file-explorer-DC_nRPAI.js → file-explorer-C60EN7cX.js} +1 -1
  114. package/dist/client/assets/{file-type-icon-C9Vyxyzp.js → file-type-icon-7YC5ilNl.js} +1 -1
  115. package/dist/client/assets/{folder-icon-Nahco-AM.js → folder-icon-aYJXq_Sg.js} +1 -1
  116. package/dist/client/assets/{form-TAHU_OLd.js → form-BZ8QASyF.js} +1 -1
  117. package/dist/client/assets/{general-DoAdvreU.js → general-j2-fP1Wb.js} +1 -1
  118. package/dist/client/assets/{github-repo-picker-DcDZAelp.js → github-repo-picker-U8Jxu_k4.js} +1 -1
  119. package/dist/client/assets/{hooks-EhdE0h-7.js → hooks-DwArKZRm.js} +1 -1
  120. package/dist/client/assets/{hosting-tab-DYQ8Rh0p.js → hosting-tab-BjO3qC08.js} +1 -1
  121. package/dist/client/assets/{index-DTpUqPGy.js → index-BPjd7Fa5.js} +1 -1
  122. package/dist/client/assets/{index-BSB_rTjt.js → index-BWlAD4Il.js} +7 -7
  123. package/dist/client/assets/{index-XxU95hLt.js → index-BhbrnC4j.js} +1 -1
  124. package/dist/client/assets/{index-B_PnK48y.js → index-BkCEfktg.js} +1 -1
  125. package/dist/client/assets/{index-DXDhcB-_.js → index-CtR_rkl8.js} +1 -1
  126. package/dist/client/assets/{index-njvL_iv-.js → index-CuEniakk.js} +5 -5
  127. package/dist/client/assets/{index-e1yVTHen.js → index-DHli4OJD.js} +1 -1
  128. package/dist/client/assets/{index-ziMCET_V.js → index-DwFqKD4D.js} +1 -1
  129. package/dist/client/assets/{index-BnaWJdfu.js → index-eUVJhFEB.js} +1 -1
  130. package/dist/client/assets/{index-CiP0VfIv.css → index-kzZCkC89.css} +1 -1
  131. package/dist/client/assets/{index-redirect-DcvvF4me.js → index-redirect-BsHoZbs8.js} +1 -1
  132. package/dist/client/assets/{infra-billing-zFBwV-Bi.js → infra-billing-CIPoZsfw.js} +1 -1
  133. package/dist/client/assets/{input-CCmRphpL.js → input-B2d8pbq0.js} +1 -1
  134. package/dist/client/assets/{integration-icon-CLm79Cz9.js → integration-icon-lEisOJE0.js} +1 -1
  135. package/dist/client/assets/{invite-member-dialog-BWEp7j-t.js → invite-member-dialog-CAqnpZ1B.js} +1 -1
  136. package/dist/client/assets/{label-jr1tiCXK.js → label-Dj9n2KWw.js} +1 -1
  137. package/dist/client/assets/{layout-CuYgYf2e.js → layout-pJ9WPLAN.js} +1 -1
  138. package/dist/client/assets/{login-BGhHR9SE.js → login-BtEGN9kh.js} +1 -1
  139. package/dist/client/assets/{markdown-MMd0qT30.js → markdown-BYs65uiN.js} +1 -1
  140. package/dist/client/assets/{mcp-oauth-B5cJEXYr.js → mcp-oauth-tpftyvwO.js} +1 -1
  141. package/dist/client/assets/{members-CpLGPdSP.js → members-BTLsFLZ0.js} +1 -1
  142. package/dist/client/assets/{monaco-editor-C_3KWawd.js → monaco-editor-BiUVO8An.js} +1 -1
  143. package/dist/client/assets/{monitoring-stats-row-DJlyss5H.js → monitoring-stats-row-DIS2Ng3n.js} +1 -1
  144. package/dist/client/assets/{multi-select-DFfNcFAX.js → multi-select-CzdqhztJ.js} +1 -1
  145. package/dist/client/assets/{oauth-callback-DRLYAO9G.js → oauth-callback-DXe8PVwE.js} +1 -1
  146. package/dist/client/assets/{oauth-callback-ai-provider-Vj5hLNxZ.js → oauth-callback-ai-provider-Bsf8PW_9.js} +1 -1
  147. package/dist/client/assets/{onboarding-INsGyMnf.js → onboarding-CDgoW0pS.js} +1 -1
  148. package/dist/client/assets/{org-layout-C86xmjPw.js → org-layout-lclG8H1X.js} +1 -1
  149. package/dist/client/assets/{organization-choice-BxYiuqxF.js → organization-choice-CCsvXCVj.js} +1 -1
  150. package/dist/client/assets/{orgs-Bogprpnh.js → orgs-BFtrEspw.js} +1 -1
  151. package/dist/client/assets/{page-seo-form-B49U1eCV.js → page-seo-form-k3DvmPXi.js} +1 -1
  152. package/dist/client/assets/{popover-cjpdW0PR.js → popover-BLouf8R5.js} +1 -1
  153. package/dist/client/assets/{post-calendar-Z98btd7F.js → post-calendar-nMyVgAGR.js} +1 -1
  154. package/dist/client/assets/{post-editor-RYd6MZIf.js → post-editor-BPKO1Xmm.js} +1 -1
  155. package/dist/client/assets/{primitives-CYUQQWQi.js → primitives-DIn583iu.js} +1 -1
  156. package/dist/client/assets/{profile-TFt2hVsu.js → profile-8I31Lkkz.js} +1 -1
  157. package/dist/client/assets/{project-app-view-BHLllTKH.js → project-app-view-DLbH_B-S.js} +1 -1
  158. package/dist/client/assets/{prompts-CjUUqHWf.js → prompts-Bexe0hSI.js} +1 -1
  159. package/dist/client/assets/record-editor-CUEBm5uF.js +1 -0
  160. package/dist/client/assets/{redirect-editor-BcD4Ju-C.js → redirect-editor-DEIkb4ZD.js} +1 -1
  161. package/dist/client/assets/registry-C-rbq1xD.js +2 -0
  162. package/dist/client/assets/{registry-layout-CBdcAHJ8.js → registry-layout-DfnpYXYo.js} +1 -1
  163. package/dist/client/assets/{reports-BjRZn6gZ.js → reports-C_Iv8HvU.js} +1 -1
  164. package/dist/client/assets/{require-capability-l2lCTIGp.js → require-capability-DU1QAieO.js} +1 -1
  165. package/dist/client/assets/{required-auth-layout--fQKy98Q.js → required-auth-layout-XmkPJ52B.js} +1 -1
  166. package/dist/client/assets/{reset-password-BRKCCVlU.js → reset-password-CWh5Gdcr.js} +1 -1
  167. package/dist/client/assets/{review-settings-Cyt_g6jL.js → review-settings-B8mMOsOP.js} +1 -1
  168. package/dist/client/assets/{roles-ByxJJBrB.js → roles-Cw96Wn1G.js} +1 -1
  169. package/dist/client/assets/{schema-BsZ1HkQH.js → schema-B5fnKlHk.js} +1 -1
  170. package/dist/client/assets/{scroll-area-jAQrzpp2.js → scroll-area-bf_SAd7o.js} +1 -1
  171. package/dist/client/assets/{search-input-C15FIKPL.js → search-input-DwyuZ_4a.js} +1 -1
  172. package/dist/client/assets/{secrets-DyE8liHV.js → secrets-CaLbVXxE.js} +1 -1
  173. package/dist/client/assets/{sections-editor-Cx_CzMX5.js → sections-editor-DUyabDLF.js} +1 -1
  174. package/dist/client/assets/{select-Bg-S5PZO.js → select-CmM2ytba.js} +1 -1
  175. package/dist/client/assets/{select-model-5Xzal1s4.js → select-model-DsvUVXBH.js} +1 -1
  176. package/dist/client/assets/{self-tool-result-osA4F31H.js → self-tool-result-C0cbe0zd.js} +1 -1
  177. package/dist/client/assets/{seo-editor-CwIeX_yG.js → seo-editor-nln9KG1F.js} +1 -1
  178. package/dist/client/assets/{settings-layout-B4n75gy7.js → settings-layout-BnYfqMlI.js} +1 -1
  179. package/dist/client/assets/{shell-controls-Cn32tr22.js → shell-controls-Bnw3_sbs.js} +1 -1
  180. package/dist/client/assets/{shell-layout-CoDkvfyR.js → shell-layout-Vi7dV7Tx.js} +1 -1
  181. package/dist/client/assets/{skill-preview-BpS1_5XY.js → skill-preview-D2ESeOXu.js} +1 -1
  182. package/dist/client/assets/{skills-8Vq6CVxq.js → skills-Btmp4dlw.js} +1 -1
  183. package/dist/client/assets/{spinner-D9ug9Q1y.js → spinner-DIj1Go6P.js} +1 -1
  184. package/dist/client/assets/{sso-CGEpeY_P.js → sso-qzDzZoOE.js} +1 -1
  185. package/dist/client/assets/{store-6m9JBKBn.js → store-BTrvNs7j.js} +1 -1
  186. package/dist/client/assets/store-registry-AWG9Gyro.js +2 -0
  187. package/dist/client/assets/{super-agent-icon-D-3T1HXs.js → super-agent-icon-C7NH1oj0.js} +1 -1
  188. package/dist/client/assets/{switch-DBban6IE.js → switch-CNDFjuCH.js} +1 -1
  189. package/dist/client/assets/{synced-repos-H3jyZPic.js → synced-repos-DOekzSvu.js} +1 -1
  190. package/dist/client/assets/{table-CAOEHHPQ.js → table-uC7dq7Qx.js} +1 -1
  191. package/dist/client/assets/{tabs-CvrmBfQO.js → tabs-C3hyhgOx.js} +1 -1
  192. package/dist/client/assets/{task-board-CTg_E5Fs.js → task-board--321T69G.js} +1 -1
  193. package/dist/client/assets/{tasks-C9kEnEiV.js → tasks-D3pnNEuI.js} +1 -1
  194. package/dist/client/assets/{textarea-CyDCIDOx.js → textarea-BR3Z3FW5.js} +1 -1
  195. package/dist/client/assets/{thread-route-COH2-gRV.js → thread-route-CI9Oyaed.js} +1 -1
  196. package/dist/client/assets/{toggle-group-1Jrd7Xpn.js → toggle-group-BFZvVfAz.js} +1 -1
  197. package/dist/client/assets/{toolbar-_C8oY14e.js → toolbar-DK9YZczJ.js} +1 -1
  198. package/dist/client/assets/{track-BK5moGgb.js → track-C2sql3Ri.js} +1 -1
  199. package/dist/client/assets/{types-FUTmbzUT.js → types-FOnqs_ep.js} +1 -1
  200. package/dist/client/assets/{use-ai-providers-uMQb3FdW.js → use-ai-providers-Bm-sHcqw.js} +1 -1
  201. package/dist/client/assets/{use-api-keys-C45qY1K8.js → use-api-keys-FRwuUb-z.js} +1 -1
  202. package/dist/client/assets/{use-automations-DY5_FOmk.js → use-automations-BBJJLcRi.js} +1 -1
  203. package/dist/client/assets/{use-autosave-D-GAQv5-.js → use-autosave-D3jq2t0Z.js} +1 -1
  204. package/dist/client/assets/{use-connection-Dh_bIzzB.js → use-connection-DrhFr-BW.js} +1 -1
  205. package/dist/client/assets/{use-copy-CmPdqNRj.js → use-copy-Ccsu-LzF.js} +1 -1
  206. package/dist/client/assets/{use-create-virtual-mcp-Dz8Drv5c.js → use-create-virtual-mcp-C26cIWFm.js} +1 -1
  207. package/dist/client/assets/{use-debounced-autosave-Dj_RFaNt.js → use-debounced-autosave-bJxU4-DP.js} +1 -1
  208. package/dist/client/assets/{use-debounced-value-BcvP9lXD.js → use-debounced-value-C-4MWtE7.js} +1 -1
  209. package/dist/client/assets/{use-decopilot-events-CQuUMu-T.js → use-decopilot-events-AJSxmtjR.js} +1 -1
  210. package/dist/client/assets/{use-delete-connection-CFL69P-u.js → use-delete-connection-CHfcT2G2.js} +1 -1
  211. package/dist/client/assets/{use-deployment-admin-DfO6Vw2T.js → use-deployment-admin-LcZqRkfE.js} +1 -1
  212. package/dist/client/assets/{use-destination-route-B1mohgaf.js → use-destination-route-DDLoaveW.js} +1 -1
  213. package/dist/client/assets/{use-file-configs-ChX0Q-qZ.js → use-file-configs-6uuFnaeT.js} +1 -1
  214. package/dist/client/assets/{use-infinite-scroll-C0bcw_ds.js → use-infinite-scroll-DR2K3ike.js} +1 -1
  215. package/dist/client/assets/{use-join-requests-mjq6Qeh_.js → use-join-requests-BX9Sap62.js} +1 -1
  216. package/dist/client/assets/{use-mcp-auth-status-CyiJec79.js → use-mcp-auth-status-DEiewDKN.js} +1 -1
  217. package/dist/client/assets/{use-mcp-client-BPQGAz1L.js → use-mcp-client-BbnLyE8Y.js} +1 -1
  218. package/dist/client/assets/{use-mcp-tools-B1nBebmG.js → use-mcp-tools-DAOq320g.js} +1 -1
  219. package/dist/client/assets/{use-members-Dc-_EVO5.js → use-members-ymHQ6DPO.js} +1 -1
  220. package/dist/client/assets/{use-navigate-to-agent-CfRCE8Wt.js → use-navigate-to-agent-DIKXG43X.js} +1 -1
  221. package/dist/client/assets/{use-org-auth-client-BG5CQ5ml.js → use-org-auth-client-B2Dtccrj.js} +1 -1
  222. package/dist/client/assets/{use-org-repo-syncs-Dmq6Cu1Y.js → use-org-repo-syncs-BraC28gq.js} +1 -1
  223. package/dist/client/assets/{use-org-sso-Du7xcTXp.js → use-org-sso-DqX_yfsK.js} +1 -1
  224. package/dist/client/assets/{use-organization-roles-GK60Cru6.js → use-organization-roles-BQf6ZfaR.js} +1 -1
  225. package/dist/client/assets/{use-organization-settings-D4VQHySG.js → use-organization-settings-mos5d4Yb.js} +1 -1
  226. package/dist/client/assets/{use-panel-navigate-DWQx8OEi.js → use-panel-navigate-Dzed7hXE.js} +1 -1
  227. package/dist/client/assets/{use-registry-connections-zLS0bbue.js → use-registry-connections-C1MprIyF.js} +1 -1
  228. package/dist/client/assets/{use-secrets-Bpxg79PA.js → use-secrets-MfuKxy-T.js} +1 -1
  229. package/dist/client/assets/{use-section-preview-base-ihTnkgdH.js → use-section-preview-base-CJFnX7tM.js} +1 -1
  230. package/dist/client/assets/{use-status-sounds-CkZXTqrB.js → use-status-sounds-9ZjtdYdG.js} +1 -1
  231. package/dist/client/assets/{use-tags-Bl8RkIGi.js → use-tags-FMu3sWNF.js} +1 -1
  232. package/dist/client/assets/{use-view-mode-goCGZ2jO.js → use-view-mode-CB9pJw4V.js} +1 -1
  233. package/dist/client/assets/{use-virtual-mcp-DOjC0pS0.js → use-virtual-mcp-CUrHAeNi.js} +1 -1
  234. package/dist/client/assets/useInfiniteQuery-UPxaQjph.js +1 -0
  235. package/dist/client/assets/useSuspenseInfiniteQuery-91qpgWTX.js +1 -0
  236. package/dist/client/assets/{users-OV8pJiY0.js → users-mfz705Ex.js} +1 -1
  237. package/dist/client/assets/{variant-calendar-ChVU0zWF.js → variant-calendar-DNADnJDP.js} +1 -1
  238. package/dist/client/assets/{view-mode-toggle-02-6otvj.js → view-mode-toggle-CliygtAG.js} +1 -1
  239. package/dist/client/index.html +1 -1
  240. package/dist/server/cli.js +2 -2
  241. package/dist/server/server.js +2 -2
  242. package/package.json +1 -1
  243. package/dist/client/assets/record-editor-DD-wTaHw.js +0 -1
  244. package/dist/client/assets/registry-BLiW5cT7.js +0 -2
  245. package/dist/client/assets/store-registry-DShejGKc.js +0 -2
  246. package/dist/client/assets/useInfiniteQuery-DlP2r0mK.js +0 -1
  247. package/dist/client/assets/useSuspenseInfiniteQuery-By9ZBJLW.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-Cx_CzMX5.js","assets/index-njvL_iv-.js","assets/index-Blq7G79G.css","assets/chat-context-VFkTmrKQ.js","assets/use-panel-navigate-DWQx8OEi.js","assets/use-destination-route-B1mohgaf.js","assets/thread-route-COH2-gRV.js","assets/dialog-DJ6N9l-G.js","assets/Check-Bxq3sAMT.js","assets/Copy01-CS_So4Uz.js","assets/Download01-CxWUyG_X.js","assets/constants-dLUUoWH7.js","assets/session-runtime-C-KTDVeQ.js","assets/slugify-CEUa2lfQ.js","assets/hooks-EhdE0h-7.js","assets/use-mcp-client-BPQGAz1L.js","assets/auth-CJkvZW-k.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-C_kQApdo.js","assets/task-board-CTg_E5Fs.js","assets/schema-BsZ1HkQH.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-DOjC0pS0.js","assets/use-ai-providers-uMQb3FdW.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-CQuUMu-T.js","assets/use-organization-settings-D4VQHySG.js","assets/ChevronDown-B78Z7JhJ.js","assets/agent-icon-CEcN5Ilk.js","assets/AlertCircle-C8XDzPRu.js","assets/UserSquare-BDMyjzaF.js","assets/Tool01-BkIa9J-T.js","assets/ArrowUp-Dndx_psT.js","assets/ArrowLeft-CTfYqAeL.js","assets/Tool02-LyDsiEcj.js","assets/XCircle-D1lTnv45.js","assets/TrendUp01-CRVwTA9x.js","assets/ZapSquare-C6EnYa3u.js","assets/ZoomOut-BQOaUyto.js","assets/Users03-BJfM2ts1.js","assets/CheckCircle-OPjRGmHJ.js","assets/ChevronRight-DoxpMYgv.js","assets/ChevronSelectorVertical-CqkEIUhB.js","assets/ChevronUp-BLvCCCZc.js","assets/DotsVertical-CL1uf5Bu.js","assets/Stars02-DpgnX4j3.js","assets/CreditCard01-CpyYSvQ3.js","assets/Settings02-BkuHKQTT.js","assets/Eye-CmND_DBa.js","assets/FilterLines-CSE_Ogu_.js","assets/Share07-DFkS5ZA9.js","assets/GitBranch01-D_a1MiQQ.js","assets/Globe01-Cm4DSICd.js","assets/Globe04-DbBcV-E2.js","assets/SwitchHorizontal01-CDfbzUMe.js","assets/HardDrive-B4mHXAle.js","assets/Image01-DDlYl6aL.js","assets/Key01-GYKWVO36.js","assets/LinkExternal01-BiUY26Aw.js","assets/LockUnlocked01-DDHVAeu0.js","assets/LogOut01-L3qCYWBe.js","assets/Monitor01-DDDZk1T8.js","assets/Sun-Cfdg0-fN.js","assets/Package-BQ4aGZ5C.js","assets/Palette-CMzcklHM.js","assets/Play-DjvcK07v.js","assets/Plus-DD6ql5SQ.js","assets/SearchLg-DrCbydJX.js","assets/SearchMd-CYXNgks8.js","assets/Shield01-BqNKNsE_.js","assets/Stars01-DLcNnYnQ.js","assets/Trash01-DMEyL-_r.js","assets/Upload01-BXETp31V.js","assets/User01--NR0wcxR.js","assets/Users01-CYdUUADt.js","assets/XClose-7CTyOeCs.js","assets/Zap-Bzfi7ZdU.js","assets/scroll-area-jAQrzpp2.js","assets/select-Bg-S5PZO.js","assets/input-CCmRphpL.js","assets/dropdown-menu-BdmGKLTp.js","assets/page-seo-form-B49U1eCV.js","assets/label-jr1tiCXK.js","assets/switch-DBban6IE.js","assets/use-section-preview-base-ihTnkgdH.js","assets/automation-runs-DhRngbfS.js","assets/useInfiniteQuery-DlP2r0mK.js","assets/use-infinite-scroll-C0bcw_ds.js","assets/use-connection-Dh_bIzzB.js","assets/table-CAOEHHPQ.js","assets/empty-state-DGCuDv4_.js","assets/use-members-Dc-_EVO5.js","assets/use-org-auth-client-BG5CQ5ml.js","assets/use-automations-DY5_FOmk.js","assets/useSuspenseInfiniteQuery-By9ZBJLW.js","assets/avatar-Be32ceEV.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-CmPdqNRj.js","assets/markdown-MMd0qT30.js","assets/monaco-editor-C_3KWawd.js","assets/spinner-D9ug9Q1y.js","assets/editor-RaHtOP3X.js","assets/types-FUTmbzUT.js","assets/shell-layout-CoDkvfyR.js","assets/required-auth-layout--fQKy98Q.js","assets/use-org-sso-Du7xcTXp.js","assets/integration-icon-CLm79Cz9.js","assets/use-navigate-to-agent-CfRCE8Wt.js","assets/github-repo-BpKUwJal.js","assets/chart-jg4AMjQe.js","assets/index-ziMCET_V.js","assets/AreaChart-BFuLhEAJ.js","assets/form-TAHU_OLd.js","assets/file-type-icon-C9Vyxyzp.js","assets/drawer-BYjZcQUP.js","assets/collection-search-Czd9Mfxw.js","assets/use-mcp-tools-B1nBebmG.js","assets/tabs-CvrmBfQO.js","assets/toggle-group-1Jrd7Xpn.js","assets/super-agent-icon-D-3T1HXs.js","assets/self-tool-result-osA4F31H.js","assets/alert-dialog-BwmNFu1l.js","assets/extract-connection-data-CpinTMij.js","assets/metadata-dUsYcpuu.js","assets/connection-iXS4K9V0.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-BcvP9lXD.js","assets/authenticate-and-persist-oauth-B-zmVWY9.js","assets/mcp-oauth-B5cJEXYr.js","assets/track-BK5moGgb.js","assets/popover-cjpdW0PR.js","assets/toolbar-_C8oY14e.js","assets/github-repo-picker-DcDZAelp.js","assets/agent-capabilities-BxGDQyCw.js","assets/connection-card-CxFJyjO4.js","assets/use-registry-connections-zLS0bbue.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-CyDCIDOx.js","assets/connection-form-helpers-DjjPEqBy.js","assets/collection-tabs-BjHY3CU9.js","assets/badge-DeycDEDa.js","assets/select-model-5Xzal1s4.js","assets/checkbox-5B3Nsb_j.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-Nahco-AM.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-CkZXTqrB.js","assets/skill-preview-BpS1_5XY.js","assets/use-file-configs-ChX0Q-qZ.js","assets/site-slug-uya6Wp4-.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-Dj_RFaNt.js","assets/search-input-C15FIKPL.js","assets/use-mcp-auth-status-CyiJec79.js","assets/use-secrets-Bpxg79PA.js","assets/config-DlgHqtbo.js","assets/command-DIZ2TwJ6.js","assets/index-B_PnK48y.js","assets/get-initials-D-f_fDFw.js","assets/breadcrumb-BkUUiSOA.js","assets/use-tags-Bl8RkIGi.js","assets/automation-list-row-LC7AzU8H.js","assets/site-error--i37Vnuw.js","assets/use-org-repo-syncs-Dmq6Cu1Y.js","assets/cards-odjp1n2S.js","assets/file-explorer-DC_nRPAI.js","assets/app-editor-DBcySaWI.js","assets/post-editor-RYd6MZIf.js","assets/multi-select-DFfNcFAX.js","assets/block-document-0VJ4mJz2.js","assets/primitives-CYUQQWQi.js","assets/use-autosave-D-GAQv5-.js","assets/record-editor-DD-wTaHw.js","assets/category-editor-T2MgeHT9.js","assets/bulk-category-panel-DITCXe6Q.js","assets/index-e1yVTHen.js","assets/seo-editor-CwIeX_yG.js","assets/variant-calendar-ChVU0zWF.js","assets/view-mode-toggle-02-6otvj.js","assets/post-calendar-Z98btd7F.js","assets/alert-DRkYko5H.js","assets/redirect-editor-BcD4Ju-C.js","assets/project-app-view-BHLllTKH.js","assets/hosting-tab-DYQ8Rh0p.js","assets/empty-state--CA0lu67.js","assets/e2e-tab-Dmto2BvH.js","assets/analytics-tab-D9IxcyEr.js","assets/YAxis-BZmDD3lJ.js","assets/cdn-tab-D-8RFlx4.js","assets/ErrorBarContext-BOZ7dcPi.js","assets/Sector-DxIBB5iA.js"])))=>i.map(i=>d[i]);
2
- import{p as cs,r as P,ai as KN,aj as WN,ak as Rt,al as Ws,am as Re,an as pr,ao as _r,ap as Eu,aq as qN,ar as Ni,as as GN,at as Km,au as v6,c as z,H as Be,n as ie,j as o,E as Hs,b as re,t as ve,aa as to,a5 as gl,a8 as Fe,a9 as Ue,ab as He,av as Is,I as W2,o as Tt,aw as q2,K as Ge,a as _n,C as cd,B as me,ax as G2,ay as y6,x as Lr,az as Ss,aA as Il,aB as r4,d as Js,ac as gs,e as Vs,q as Je,aC as YN,D as go,aD as JN,aE as _6,aF as QN,aG as sr,aH as D1,aI as kn,aJ as XN,aK as I1,aL as ZN,aM as eT,aN as tT,aO as sT,aP as Y2,aQ as J2,aR as L6,aS as Q2,z as Zf,aT as nT,aU as iT,aV as rT,aW as w6,aX as pu,k as ct,aY as Ru,m as oT,u as xl,f as xo,R as e9,aZ as Oc,a_ as lT,a$ as o4,b0 as S6,b1 as Wm,b2 as k6,b3 as j6,b4 as C6,b5 as aT,b6 as cT,L as dT,a3 as N6,b7 as uT,b8 as Zh,b9 as Ml,Y as Pt,ba as T6,bb as V6,bc as $n,P as Ti,bd as Nt,s as A6,be as P6,bf as hT,bg as E6,bh as R6,bi as D6,bj as I6,bk as M6,bl as O6,bm as $6,bn as B6,bo as z6,bp as F6,bq as $s,N as ai,br as fT,bs as U6,bt as mT,bu as pT,bv as H6,bw as gT,bx as xT,by as bT,bz as vT,bA as yT,bB as K6,bC as _T,bD as LT,bE as wT,bF as ST,bG as kT,bH as jT,bI as CT,bJ as NT,bK as TT,bL as VT,bM as AT,bN as PT,ah as ET}from"./index-njvL_iv-.js";import{i as t9,n as RT}from"./ArrowUp-Dndx_psT.js";import{u as da,a as gi,b as xs,c as rn,d as W6,s as DT,e as IT,f as MT,g as OT,h as $T,i as BT,j as zT,k as X2,l as q6,T as FT,A as UT,m as HT,n as KT,t as WT,o as qT,p as GT,q as YT}from"./chat-context-VFkTmrKQ.js";import{c as s9,s as dd,g as dr,P as Du,d as Z2,t as Wl,a as JT,M as QT,i as XT,b as Vi,e as ud,f as ZT,D as eV,h as tV,j as sV,k as qc,l as nV,m as iV,u as n9,E as rV,n as i0,o as oV,F as lV,p as i9,q as r9,r as G6,S as aV,v as cV,w as dV,x as uV,y as l4,z as hV,A as Y6,O as fV,B as a4,C as ir,G as mV,T as Wr,H as pV,I as ur,J as Qo,K as qm,L as Gm,N as J6,Q as gV,R as Q6,U as xV,V as xi,W as bV,X as vV,Y as X6,Z as Or,_ as yV,$ as _V,a0 as Z6,a1 as Pl,a2 as c4,a3 as LV,a4 as wV,a5 as d4,a6 as SV,a7 as Iu,a8 as ua,a9 as gr,aa as ef,ab as eg,ac as tg,ad as kV,ae as jV,af as CV,ag as NV,ah as TV,ai as VV,aj as AV,ak as o9,al as e8,am as t8,an as s8,ao as PV,ap as n8,aq as EV,ar as RV,as as DV,at as IV,au as r0,av as MV,aw as OV,ax as $V,ay as BV}from"./automation-runs-DhRngbfS.js";import{S as Gc}from"./spinner-D9ug9Q1y.js";import{c as ms,d as Jt,b as Wt,D as qt,h as Tn,e as Jn,i as zV}from"./dialog-DJ6N9l-G.js";import{c as FV,b as l9,a as a9,D as c9,d as i8,e as UV,f as HV}from"./drawer-BYjZcQUP.js";import{C as KV}from"./collection-search-Czd9Mfxw.js";import{u as Qt,a as WV,m as qV}from"./use-mcp-client-BPQGAz1L.js";import{a as ha,i as tf,S as bl,b as GV,g as sf,c as r8,d as u4,R as YV,e as JV,W as QV,C as XV}from"./constants-dLUUoWH7.js";import{u as o8,g as o0,l as Ym,C as ZV,a as eA,b as tA}from"./chart-jg4AMjQe.js";import{t as Gt}from"./ChevronDown-B78Z7JhJ.js";import{t as sA,z as nA,a as hd,u as sg,b as ng,c as d9}from"./hooks-EhdE0h-7.js";import{K as iA,i as l8,u as vl,a as a8,m as rA,f as oA}from"./shell-layout-CoDkvfyR.js";import{a as bs,b as u9,u as fa,c as lA}from"./use-virtual-mcp-DOjC0pS0.js";import{w as c8,A as aA,c as cA,b as h9,d as dA,r as uA,e as hA}from"./thread-route-COH2-gRV.js";import{r as d8,d as ig,a as rg,p as fA,b as mA,s as pA}from"./session-runtime-C-KTDVeQ.js";import{g as ma,r as og}from"./github-repo-BpKUwJal.js";import{u as u8,a as lg,b as h8}from"./use-mcp-tools-B1nBebmG.js";import{i as bo,b as ag,a as gA}from"./XCircle-D1lTnv45.js";import{f as f8,g as cg,h as pa,j as m8,n as p8,A as mi,k as g8,l as Yc,s as ll,m as x8,o as ga,p as xA,q as bA,c as b8,r as nf,u as fd,e as vA,v as yA,w as _A,x as v8,d as LA,y as f9,z as xa,B as wA,C as dg,D as y8,E as _8,F as Jm,G as M1,H as h4,I as m9,J as SA,K as kA,L as jA,M as CA,N as NA,O as ug,P as L8,Q as Qn,R as hg,S as fg,T as l0,U as hr,V as p9,W as g9,X as w8,Y as S8,Z as k8,_ as TA,$ as mg,a0 as VA,a1 as f4,a2 as AA,a3 as PA,t as j8,a4 as Yr,a5 as a0,a6 as EA,i as x9,a7 as RA,a8 as DA,a9 as IA,aa as MA,ab as OA,ac as $A,ad as sl,ae as m4,af as C8,ag as BA,ah as zA,ai as FA,aj as Jc,ak as pg,al as UA,am as p4,an as HA,ao as KA,ap as WA,aq as N8,ar as qA,as as GA,at as YA,au as JA,av as QA,aw as XA,ax as ZA,ay as eP,az as T8,aA as V8,aB as tP,aC as sP,aD as nP,aE as iP,aF as rP,aG as oP}from"./agent-icon-CEcN5Ilk.js";import{i as Kt}from"./Check-Bxq3sAMT.js";import{a as xr}from"./Image01-DDlYl6aL.js";import{i as Xn}from"./Upload01-BXETp31V.js";import{i as vn}from"./AlertCircle-C8XDzPRu.js";import{a as dn}from"./Copy01-CS_So4Uz.js";import{F as Qm,a as gg,b as xg,c as bg,d as A8}from"./form-TAHU_OLd.js";import{d as Dt,S as ks,a as js,b as As,c as Cs}from"./select-Bg-S5PZO.js";import{t as b9,a as vg,i as v9,b as yg,c as lP,d as aP,e as cP}from"./UserSquare-BDMyjzaF.js";import{i as y9}from"./ArrowLeft-CTfYqAeL.js";import{T as zl,a as ba,b as di,c as md}from"./tabs-CvrmBfQO.js";import{t as Xm}from"./Tool02-LyDsiEcj.js";import{T as _9,a as Qc}from"./toggle-group-1Jrd7Xpn.js";import{I as gt}from"./input-CCmRphpL.js";import{u as _g,b as Lg,f as P8,g as dP,c as uP,p as g4,S as ui,t as wg,C as Sg,a as hP,h as fP,N as mP}from"./super-agent-icon-D-3T1HXs.js";import{s as Ai}from"./XClose-7CTyOeCs.js";import{M as pP,a as gP,m as L9,i as xP,g as E8,b as bP,N as vP,c as yP}from"./select-model-5Xzal1s4.js";import{a as ts,b as ss,P as ns,c as _P}from"./popover-cjpdW0PR.js";import{t as Jr}from"./Stars01-DLcNnYnQ.js";import{b as LP,a as w9,c as R8,d as D8,e as I8,u as S9,f as M8}from"./use-organization-settings-D4VQHySG.js";import{u as k9,a as wP}from"./use-ai-providers-uMQb3FdW.js";import{g as kg,c as O8,a as nn,f as SP,d as kP}from"./agent-capabilities-BxGDQyCw.js";import{f as jP,a as CP,u as Mu,b as c0,c as $8,d as NP,e as jg,g as B8,h as Cg,i as TP,j as Ng,k as Ou,l as z8,m as VP,n as F8,o as AP}from"./folder-icon-Nahco-AM.js";import{c as $t,D as Bt,b as zt,a as Ye,d as rr,e as or,f as lr,g as Xc,h as Yn,i as Qr,j as Md}from"./dropdown-menu-BdmGKLTp.js";import{s as Ut}from"./Plus-DD6ql5SQ.js";import{p as PP,q as EP}from"./question-004-sINsf4GQ.js";import{A as Ps}from"./avatar-Be32ceEV.js";import{u as U8,a as d0}from"./use-members-Dc-_EVO5.js";import{i as qs}from"./ChevronRight-DoxpMYgv.js";import{u as u0}from"./use-is-desktop-app-BNujXJc_.js";import{u as bi,a as Tg}from"./use-panel-navigate-DWQx8OEi.js";import{i as vi}from"./CheckCircle-OPjRGmHJ.js";import{I as Oi}from"./integration-icon-CLm79Cz9.js";import{a as RP,b as DP}from"./use-navigate-to-agent-CfRCE8Wt.js";import{e as h0}from"./backoff-CrEUbyZT.js";import{u as IP}from"./use-status-sounds-CkZXTqrB.js";import{E as al}from"./empty-state-DGCuDv4_.js";import{T as Xo,a as MP}from"./toolbar-_C8oY14e.js";import{b as H8,n as K8}from"./ZapSquare-C6EnYa3u.js";import{i as cl,a as OP}from"./Share07-DFkS5ZA9.js";import{i as zn}from"./Globe01-Cm4DSICd.js";import{i as $P}from"./Monitor01-DDDZk1T8.js";import{u as pi,a as Vg,b as Ag}from"./use-connection-Dh_bIzzB.js";import{g as j9,M as BP}from"./types-FUTmbzUT.js";import{d as Pg,s as zP,g as FP,a as UP,F as W8,b as q8,f as G8,S as Y8,c as HP}from"./skill-preview-BpS1_5XY.js";import{F as dl}from"./file-type-icon-C9Vyxyzp.js";import{e as KP,c as Eg,s as f0,b as WP}from"./TrendUp01-CRVwTA9x.js";import{i as so}from"./ZoomOut-BQOaUyto.js";import{i as ci}from"./GitBranch01-D_a1MiQQ.js";import{a as Rg}from"./Package-BQ4aGZ5C.js";import{u as Dg,a as J8}from"./use-file-configs-ChX0Q-qZ.js";import{r as Q8}from"./site-slug-uya6Wp4-.js";import{n as $u}from"./Download01-CxWUyG_X.js";import{n as un}from"./LinkExternal01-BiUY26Aw.js";import{D as Pc}from"./use-destination-route-B1mohgaf.js";import{i as C9}from"./Key01-GYKWVO36.js";import{p as Ig,b as ln,s as Zc,H as Bu,h as zu,a as vc,c as X8,d as Z8}from"./location-oTTXFrSF.js";import{m as qP,a as GP,M as pd,b as YP,O as JP}from"./markdown-MMd0qT30.js";import{p as QP,f as XP}from"./pt-BR-CLy76QW2.js";import{g as ZP,e as eE}from"./extract-connection-data-CpinTMij.js";import{a as tE,i as x4}from"./mcp-oauth-B5cJEXYr.js";import{A as no,a as io,b as ro,c as oo,d as lo,e as ao,f as co,g as uo}from"./alert-dialog-BwmNFu1l.js";import{T as ho}from"./textarea-CyDCIDOx.js";import{i as ql}from"./Play-DjvcK07v.js";import{s as Gs}from"./Trash01-DMEyL-_r.js";import{u as rf}from"./use-debounced-autosave-Dj_RFaNt.js";import{S as yl}from"./scroll-area-jAQrzpp2.js";import{i as Fu}from"./SearchMd-CYXNgks8.js";import{C as gd}from"./checkbox-5B3Nsb_j.js";import{S as N9}from"./search-input-C15FIKPL.js";import{C as e7}from"./collection-tabs-BjHY3CU9.js";import{T as t7,u as s7}from"./use-mcp-auth-status-CyiJec79.js";import{n as sE}from"./LockUnlocked01-DDHVAeu0.js";import{g as nE}from"./connection-slug-CITJ0kGN.js";import{a as n7,i as iE}from"./Settings02-BkuHKQTT.js";import{L as Ot}from"./label-jr1tiCXK.js";import{S as Pi}from"./switch-DBban6IE.js";import{s as i7}from"./slugify-CEUa2lfQ.js";import{d as xd}from"./delay-CnY5UFtP.js";import{G as Vn,a as Mg,u as rE}from"./github-repo-picker-DcDZAelp.js";import{s as of}from"./User01--NR0wcxR.js";import{t as Og}from"./Users01-CYdUUADt.js";import{u as r7,a as o7}from"./use-secrets-Bpxg79PA.js";import{a as va}from"./format-time-BnbuEtat.js";import{f as l7,g as oE,l as a7,a as lE}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as aE}from"./authenticate-and-persist-oauth-B-zmVWY9.js";import{X as cE,A as dE,a as uE}from"./AreaChart-BFuLhEAJ.js";import{P as cn,a as m0,t as Gl,f as c7,u as d7,b as $g,s as u7,l as lf,c as Uu,m as h7,T as Zo,d as f7,i as hE,e as fE,g as mE,S as pE,h as m7,j as p7,r as g7,k as gE,n as xE,o as bE,p as vE,q as yE,L as Zm,v as b4,w as _E,H as LE,x as wE}from"./config-DlgHqtbo.js";import{C as An,a as hn,b as Ft,c as os,d as Pn,e as Fn,f as SE,g as v4}from"./command-DIZ2TwJ6.js";import{i as T9}from"./FilterLines-CSE_Ogu_.js";import{g as bn}from"./get-initials-D-f_fDFw.js";import{S as as,R as kE,a as jE,D as CE,i as x7,n as NE,b as TE}from"./task-board-CTg_E5Fs.js";import{B as VE,a as AE,b as y4,c as PE,d as EE,e as RE}from"./breadcrumb-BkUUiSOA.js";import{u as O1}from"./use-copy-CmPdqNRj.js";import{i as Bg,c as b7}from"./SwitchHorizontal01-CDfbzUMe.js";import{u as DE}from"./use-org-auth-client-BG5CQ5ml.js";import{u as zg,a as IE,b as ME}from"./use-tags-Bl8RkIGi.js";import{i as V9}from"./ChevronSelectorVertical-CqkEIUhB.js";import{w as _4}from"./editor-RaHtOP3X.js";import{i as A9}from"./SearchLg-DrCbydJX.js";import{u as ep,a as OE,c as $E,p as v7,b as BE,s as tp,n as zE}from"./self-tool-result-osA4F31H.js";import{M as bd}from"./monaco-editor-C_3KWawd.js";import{i as FE,a as P9,b as Fg}from"./Tool01-BkIa9J-T.js";import{a as sp}from"./Palette-CMzcklHM.js";import{s as p0}from"./Eye-CmND_DBa.js";import{i as E9}from"./DotsVertical-CL1uf5Bu.js";import{u as R9}from"./use-debounced-value-BcvP9lXD.js";import{u as y7}from"./useInfiniteQuery-DlP2r0mK.js";import{i as br}from"./Zap-Bzfi7ZdU.js";import{B as UE}from"./badge-DeycDEDa.js";import{u as g0,a as HE,b as KE,c as WE,d as qE}from"./use-automations-DY5_FOmk.js";import{s as gu,n as GE}from"./Stars02-DpgnX4j3.js";import{A as YE}from"./automation-list-row-LC7AzU8H.js";import{t as JE}from"./site-error--i37Vnuw.js";import{u as QE,a as XE}from"./use-org-repo-syncs-Dmq6Cu1Y.js";import{n as _7}from"./ChevronUp-BLvCCCZc.js";import{f as ZE,p as eR,g as tR,u as sR,e as nR,F as x0,t as L7,S as iR,B as rR,a as w7,R as oR}from"./cards-odjp1n2S.js";function S7(t,e){const s=cs(e);return lR({filters:{...t,status:"pending"}},s).length}function L4(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function lR(t={},e){const s=cs(e).getMutationCache(),n=P.useRef(t),i=P.useRef(null);return i.current===null&&(i.current=L4(s,t)),P.useEffect(()=>{n.current=t}),P.useSyncExternalStore(P.useCallback(r=>s.subscribe(()=>{const l=KN(i.current,L4(s,n.current));i.current!==l&&(i.current=l,WN.schedule(r))}),[s]),()=>i.current,()=>i.current)}const su=Rt({connection_id:Re().describe("Connection ID"),selected_tools:Ws(Re()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:Ws(Re()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:Ws(Re()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),k7=su.extend({selected_tools:su.shape.selected_tools.optional(),selected_resources:su.shape.selected_resources.optional(),selected_prompts:su.shape.selected_prompts.optional()}),aR=Rt({connectionId:Re(),toolName:Re(),label:Re(),icon:Re().nullable().optional()}),cR=Rt({id:Re().describe("Stable id; used as React key and ?tab= value"),title:Re().describe("Tab label"),icon:Re().optional().describe("Optional lucide icon name"),view:Rt({type:Km("ext-app"),appId:Re(),args:Eu(Re(),v6()).optional()})}),j7=_r(["off","manual","auto"]),dR=Rt({defaultMainView:Rt({type:Re(),id:Re().optional(),toolName:Re().optional()}).nullable().optional(),chatDefaultOpen:pr().nullable().optional(),cmsDefaultOpen:pr().nullable().optional(),cms:j7.nullable().optional().describe("How this agent offers content editing. Absent falls back to cmsDefaultOpen."),tabs:Ws(cR).optional()});function b0(t){return t?.cms?t.cms:t?.cmsDefaultOpen?"auto":"manual"}function uR(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"preview"}}:{}}}const w4=Rt({tileId:Re().optional(),connectionId:Re().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:Re().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Re().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:Eu(Re(),v6()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Ni().int().positive().optional(),maxHeight:Ni().int().positive().optional()}),hR=Rt({banner:Re().nullable().optional(),bannerColor:Re().nullable().optional(),icon:Re().nullable().optional(),themeColor:Re().nullable().optional(),pinnedViews:Ws(aR).nullable().optional(),layout:dR.nullable().optional(),homeTile:w4.nullable().optional(),homeTiles:Ws(w4).nullable().optional(),homePrompts:Ws(Re()).nullable().optional()});function ed(t){const e=t?.homeTiles;if(Array.isArray(e)&&e.length>0)return e;const s=t?.homeTile;return s?[s]:[]}const v0=/^[A-Za-z_][A-Za-z0-9_]*$/,S4=Re().min(1).regex(v0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),fR=GN("kind",[Rt({key:S4,kind:Km("literal"),value:Re()}),Rt({key:S4,kind:Km("secret"),secretId:Re().min(1)})]),Ug=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,mR=Rt({host:Re().min(1).regex(Ug).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Re().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),pR=Rt({selected:Re().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Re().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Re().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:Ws(fR).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:Ws(mR).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),gR=Rt({url:Re().describe("GitHub repository URL"),owner:Re().describe("Repository owner"),name:Re().describe("Repository name"),installationId:Ni().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Re().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),xR=_r(["agent-sandbox","local-api"]),bR={sandboxHandle:Re().describe("Provider-specific handle"),previewUrl:Re().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:Re().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:Ni().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:Rt({packageManager:Re().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Re().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Re().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.")},C7=Rt(bR);function vR(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]=C7.parse(i)}catch{}return s}const yR=Eu(Re().describe("userId"),Eu(Re().describe("branch"),qN(xR,C7))),_R=Rt({id:Re().describe("Stable identifier for this knowledge file"),name:Re().describe("File name shown in the UI"),kind:_r(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Re().describe("Org filesystem (Library) volume the file lives in"),path:Re().describe("Path within the volume"),url:Re().describe("Same-origin URL to read the file (display/download)"),contentType:Re().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Ni().nullable().optional().describe("File size in bytes"),addedAt:Re().describe("ISO timestamp when the file was attached")}),LR=Ws(_R).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."),wR=_r(["smart","code-review","open"]),SR=wR.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."),kR=pr().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."),jR=pr().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."),CR=Re().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."),NR=Rt({branch:Re().describe("Git branch backing this release"),name:Re().describe('User-facing name, e.g. "Black Friday 2026"'),color:Re().describe("Dot color token shown in the version switcher"),createdBy:Re().optional().describe("User ID who created the release"),createdAt:Re().optional().describe("ISO 8601 creation timestamp")}),TR=Ws(NR).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."),VR=pr().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."),Hg={instructions:Re().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:Ws(Re()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Ws(Re()).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:Re().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:hR.nullable().optional().describe("UI customization settings"),githubRepo:gR.nullable().optional().describe("Linked GitHub repository"),runtime:pR.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:LR,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:SR,previewServerUrl:CR,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:pr().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:kR,releases:TR,draftsMode:VR,fastPreviewInPlace:jR},AR=Rt({id:Re().describe("Unique identifier"),title:Re().describe("Human-readable name"),description:Re().nullable().describe("Description"),icon:Re().nullable().describe("Icon URL"),created_at:Re().describe("Creation timestamp"),updated_at:Re().describe("Last update timestamp"),created_by:Re().describe("User ID who created this item"),updated_by:Re().optional().describe("User ID who last updated this item"),organization_id:Re().describe("Organization ID this item belongs to"),status:_r(["active","inactive"]).describe("Current status"),pinned:pr().describe("Whether this space is pinned to the sidebar"),metadata:Rt(Hg).extend({instructions:Re().nullable().describe("Instructions also used as system prompt"),sandboxMap:yR.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:Ws(su).describe("Connections with their selected tools, resources, and prompts")}),N7=Rt({title:Re().min(1).max(120).describe("Short label shown on the chip"),description:Re().max(280).optional().describe("One-line subtitle shown under the title"),text:Re().min(1).describe("The message sent to the agent when the prompt is clicked")});Rt({title:Re().min(1).max(255).describe("Name for the virtual MCP"),description:Re().nullable().optional().describe("Optional description"),icon:Re().nullish().describe("Optional icon URL"),status:_r(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:pr().optional().default(!1).describe("Pin to sidebar"),metadata:Rt(Hg).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:Ws(k7).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:Ws(N7).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.")});Rt({title:Re().min(1).max(255).optional().describe("New name"),description:Re().nullable().optional().describe("New description (null to clear)"),icon:Re().nullish().describe("New icon URL"),status:_r(["active","inactive"]).optional().describe("New status"),pinned:pr().optional().describe("Pin/unpin from sidebar"),metadata:Rt(Hg).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:Ws(k7).optional().describe("New connections (replaces existing)"),prompts:Ws(N7).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 k4=3,T7="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",PR="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function V7(t){const e=z.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 w=dr(c._meta);d=c.title??Z2(c.name,w),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const h=d,u=c.description||null;if(a==="card"){let w;e[4]!==n||e[5]!==c?(w=()=>n(c),e[4]=n,e[5]=c,e[6]=w):w=e[6];const k=r||i,j=i&&"bg-accent/40",C=(r||i)&&"cursor-not-allowed opacity-50";let N;e[7]!==j||e[8]!==C?(N=ie(PR,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=N):N=e[9];let T;e[10]!==h?(T=o.jsx("span",{className:"font-medium truncate capitalize",children:h}),e[10]=h,e[11]=T):T=e[11];let V;e[12]!==i?(V=i&&o.jsx(Gc,{size:"xs"}),e[12]=i,e[13]=V):V=e[13];let A;e[14]!==T||e[15]!==V?(A=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[T,V]}),e[14]=T,e[15]=V,e[16]=A):A=e[16];let E;e[17]!==u?(E=u&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=E):E=e[18];let R;return e[19]!==A||e[20]!==E||e[21]!==w||e[22]!==k||e[23]!==N?(R=o.jsxs("button",{type:"button",onClick:w,disabled:k,className:N,children:[A,E]}),e[19]=A,e[20]=E,e[21]=w,e[22]=k,e[23]=N,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 p=r||i,m=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==m||e[29]!==g?(x=ie(T7,"hover:bg-muted/70 hover:text-foreground",m,g),e[28]=m,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==h?(b=o.jsx("span",{className:"capitalize",children:h}),e[31]=h,e[32]=b):b=e[32];let y;e[33]!==i?(y=i&&o.jsx(Gc,{size:"xs"}),e[33]=i,e[34]=y):y=e[34];let _;e[35]!==f||e[36]!==p||e[37]!==x||e[38]!==b||e[39]!==y?(_=o.jsx(Fe,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:p,className:x,children:[b,y]})}),e[35]=f,e[36]=p,e[37]=x,e[38]=b,e[39]=y,e[40]=_):_=e[40];const v=u??h;let L;e[41]!==v?(L=o.jsx(Ue,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:v})}),e[41]=v,e[42]=L):L=e[42];let S;return e[43]!==_||e[44]!==L?(S=o.jsxs(He,{delayDuration:400,children:[_,L]}),e[43]=_,e[44]=L,e[45]=S):S=e[45],S}function ER(t){const e=z.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:l}=t,a=re(),[c,d]=P.useState(""),h=!!l;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(T=>{const V=c.toLowerCase();return T.prompt.name.toLowerCase().includes(V)||(T.prompt.title??"").toLowerCase().includes(V)||(T.prompt.description??"").toLowerCase().includes(V)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const f=u,p=gl();let m;e[3]!==f.length||e[4]!==c||e[5]!==a?(m=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]=m):m=e[6];let g;if(e[7]!==f||e[8]!==h||e[9]!==l?.name||e[10]!==i||e[11]!==r){let T;e[13]!==h||e[14]!==l?.name||e[15]!==i||e[16]!==r?(T=V=>o.jsx(V7,{item:V,variant:"card",onSelect:A=>{i(!1),r(A)},isLoading:l?.name===V.prompt.name,isDisabled:h&&l?.name!==V.prompt.name},V.prompt.name),e[13]=h,e[14]=l?.name,e[15]=i,e[16]=r,e[17]=T):T=e[17],g=f.map(T),e[7]=f,e[8]=h,e[9]=l?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==m||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[m,g]})}),e[18]=m,e[19]=g,e[20]=x):x=e[20];const b=x;let y;e[21]!==a?(y=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=y):y=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=T=>{T.key==="Escape"&&d("")},e[23]=_):_=e[23];let v;e[24]!==c||e[25]!==y?(v=o.jsx(KV,{value:c,onChange:d,placeholder:y,onKeyDown:_}),e[24]=c,e[25]=y,e[26]=v):v=e[26];const L=v;if(p){let T;e[27]!==a?(T=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=T):T=e[28];let V;e[29]!==T?(V=o.jsx(FV,{className:"sr-only",children:o.jsx(l9,{children:T})}),e[29]=T,e[30]=V):V=e[30];let A;e[31]!==a?(A=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=A):A=e[32];let E;e[33]!==A?(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:A})}),e[33]=A,e[34]=E):E=e[34];let R;e[35]!==b||e[36]!==L||e[37]!==E||e[38]!==V?(R=o.jsxs(a9,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[V,E,L,b]}),e[35]=b,e[36]=L,e[37]=E,e[38]=V,e[39]=R):R=e[39];let D;return e[40]!==i||e[41]!==n||e[42]!==R?(D=o.jsx(to,{delayDuration:400,children:o.jsx(c9,{open:n,onOpenChange:i,children:R})}),e[40]=i,e[41]=n,e[42]=R,e[43]=D):D=e[43],D}let S;e[44]!==a?(S=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=S):S=e[45];let w;e[46]!==S?(w=o.jsx(ms,{className:"sr-only",children:o.jsx(Jt,{children:S})}),e[46]=S,e[47]=w):w=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]!==w?(C=o.jsxs(Wt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[w,j,L,b]}),e[52]=b,e[53]=L,e[54]=j,e[55]=w,e[56]=C):C=e[56];let N;return e[57]!==i||e[58]!==n||e[59]!==C?(N=o.jsx(to,{delayDuration:400,children:o.jsx(qt,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=N):N=e[60],N}function RR(t){const e=z.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,l=re(),[a,c]=P.useState(!1);if(s.length===0)return null;let d,h,u,f,p;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,k4),y=s.slice(k4),_=!!i;let v;e[10]!==_||e[11]!==i?.name||e[12]!==n?(v=S=>o.jsx(V7,{item:S,onSelect:n,isLoading:i?.name===S.prompt.name,isDisabled:_&&i?.name!==S.prompt.name},S.prompt.name),e[10]=_,e[11]=i?.name,e[12]=n,e[13]=v):v=e[13];const L=b.map(v);d=to,p=400,e[14]!==r?(h=ie("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=h):h=e[15],u=L,f=y.length>0&&o.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:ie(T7,"hover:bg-muted/70 hover:text-foreground",_&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:y.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=h,e[7]=u,e[8]=f,e[9]=p}else d=e[5],h=e[6],u=e[7],f=e[8],p=e[9];let m;e[16]!==h||e[17]!==u||e[18]!==f?(m=o.jsxs("div",{className:h,children:[u,f]}),e[16]=h,e[17]=u,e[18]=f,e[19]=m):m=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=o.jsx(ER,{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]!==p||e[27]!==m||e[28]!==g?(x=o.jsxs(d,{delayDuration:p,children:[m,g]}),e[25]=d,e[26]=p,e[27]=m,e[28]=g,e[29]=x):x=e[29],x}function DR(){return null}function IR(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 MR(t){const e=z.c(31),{connectionId:s}=t,n=re(),{sendMessage:i}=gi(),{org:r}=Be();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=Qt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=o8(c);let h;e[6]!==d?.prompts?(h=d?.prompts??[],e[6]=d?.prompts,e[7]=h):h=e[7];const u=h;let f;e[8]!==u?(f=u.map(OR),e[8]=u,e[9]=f):f=e[9];const p=f;let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m={stage:"idle"},e[10]=m):m=e[10];const[g,x]=P.useReducer(IR,m),[b,y]=P.useState(null);let _;e[11]!==a||e[12]!==i||e[13]!==n?(_=async(A,E)=>{if(!a){ve.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const R=await o0(a,A.name,E);x({type:"RESET"});const D={type:"doc",content:[{type:"paragraph",content:[s9({id:A.name,name:dd(A.name,dr(A._meta)),metadata:R.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(D)}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 v=_;let L;e[15]!==v?(L=async A=>{if(A.arguments&&A.arguments.length>0){x({type:"SELECT_PROMPT",prompt:A}),y(A);return}x({type:"START_LOADING",prompt:A}),await v(A)},e[15]=v,e[16]=L):L=e[16];const S=L;let w;e[17]!==b||e[18]!==v?(w=async A=>{b&&(x({type:"START_LOADING",prompt:b,arguments:A}),y(null),await v(b,A))},e[17]=b,e[18]=v,e[19]=w):w=e[19];const k=w;if(p.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==S||e[21]!==p||e[22]!==j?(C=o.jsx(RR,{items:p,onSelect:S,loadingPrompt:j}),e[20]=S,e[21]=p,e[22]=j,e[23]=C):C=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{y(null),x({type:"RESET"})},e[24]=N):N=e[24];let T;e[25]!==b||e[26]!==k?(T=o.jsx(Du,{prompt:b,setPrompt:N,onSubmit:k}),e[25]=b,e[26]=k,e[27]=T):T=e[27];let V;return e[28]!==C||e[29]!==T?(V=o.jsxs(o.Fragment,{children:[C,T]}),e[28]=C,e[29]=T,e[30]=V):V=e[30],V}function OR(t){return{prompt:t}}function $R(t){const e=z.c(13),{className:s}=t,{selectedVirtualMcp:n}=da(),{org:i}=Be();let r;e[0]!==i.id?(r=ha(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=ie("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(DR,{}),e[4]=h):h=e[4];let u;e[5]!==a?(u=o.jsx(MR,{connectionId:a}),e[5]=a,e[6]=u):u=e[6];let f;e[7]!==d||e[8]!==u?(f=o.jsx(Hs,{fallback:null,children:o.jsx(P.Suspense,{fallback:h,children:u},d)}),e[7]=d,e[8]=u,e[9]=f):f=e[9];let p;return e[10]!==c||e[11]!==f?(p=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=p):p=e[12],p}const $1="cubic-bezier(0.645, 0.045, 0.355, 1)",BR=44,zR={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"},FR={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},UR={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function ul(t){const e=z.c(69),{icon:s,label:n,count:i,title:r,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:h,onClose:u}=t,f=h===void 0?"default":h,p=re(),[m,g]=P.useState(d),[x,b]=P.useState(!1);let y;e[0]!==u?(y=()=>{b(!0),u?.()},e[0]=u,e[1]=y):y=e[1];const _=y;if(x)return null;const v=FR[f],L=zR[f];let S;e[2]!==v||e[3]!==L?(S=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,L),e[2]=v,e[3]=L,e[4]=S):S=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=()=>g(HR),e[5]=w):w=e[5];const k=m&&"rounded-b-none",j=!m&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=ie("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 N=UR[f];let T;e[9]!==N?(T=ie("shrink-0",N),e[9]=N,e[10]=T):T=e[10];let V;e[11]!==s||e[12]!==T?(V=o.jsx("span",{className:T,children:s}),e[11]=s,e[12]=T,e[13]=V):V=e[13];let A;e[14]!==n?(A=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=A):A=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=m?"rotate(180deg)":"rotate(0deg)";let D;e[18]!==R?(D=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(Gt,{size:16,style:{transform:R,transition:`transform 180ms ${$1}`}})}),e[18]=R,e[19]=D):D=e[19];let I;e[20]!==p?(I=p("chat.collapsibleHighlight.closeLabel"),e[20]=p,e[21]=I):I=e[21];let O;e[22]!==p?(O=p("chat.collapsibleHighlight.closeTitle"),e[22]=p,e[23]=O):O=e[23];let F,M;e[24]!==_?(F=J=>{J.stopPropagation(),_()},M=J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),J.stopPropagation(),_())},e[24]=_,e[25]=F,e[26]=M):(F=e[25],M=e[26]);let $;e[27]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Is,{size:16}),e[27]=$):$=e[27];let B;e[28]!==I||e[29]!==O||e[30]!==F||e[31]!==M?(B=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":I,title:O,onClick:F,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:$}),e[28]=I,e[29]=O,e[30]=F,e[31]=M,e[32]=B):B=e[32];let U;e[33]!==m||e[34]!==V||e[35]!==A||e[36]!==E||e[37]!==D||e[38]!==B||e[39]!==C?(U=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":m,onClick:w,className:C,children:[V,A,E,D,B]}),e[33]=m,e[34]=V,e[35]=A,e[36]=E,e[37]=D,e[38]=B,e[39]=C,e[40]=U):U=e[40];const H=m?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${$1}`},e[41]=H,e[42]=W):W=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K={overflow:"hidden",minHeight:0},e[43]=K):K=e[43];const G=m?1:0;let Y;e[44]!==G?(Y={opacity:G,transition:`opacity 120ms ${$1}`,maxHeight:"60vh"},e[44]=G,e[45]=Y):Y=e[45];let X;e[46]!==r?(X=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]=X):X=e[47];let te;e[48]!==c||e[49]!==r?(te=c?o.jsx("div",{className:ie("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=te):te=e[50];let se;e[51]!==X||e[52]!==te?(se=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[X,te]}),e[51]=X,e[52]=te,e[53]=se):se=e[53];let ne;e[54]!==l||e[55]!==a?(ne=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]=ne):ne=e[56];let Q;e[57]!==Y||e[58]!==se||e[59]!==ne?(Q=o.jsx("div",{style:K,children:o.jsxs("div",{className:"flex flex-col",style:Y,children:[se,ne]})}),e[57]=Y,e[58]=se,e[59]=ne,e[60]=Q):Q=e[60];let q;e[61]!==W||e[62]!==Q?(q=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:Q}),e[61]=W,e[62]=Q,e[63]=q):q=e[63];let le;return e[64]!==U||e[65]!==q||e[66]!==S||e[67]!==f?(le=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:S,children:[U,q]}),e[64]=U,e[65]=q,e[66]=S,e[67]=f,e[68]=le):le=e[68],le}function HR(t){return!t}const KR=Rt({content:Re().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:_r(["pending","in_progress","completed"]),activeForm:Re().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),A7=Rt({todos:Ws(KR)}),WR="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.";sA({description:WR,inputSchema:nA(A7),execute:async({todos:t})=>({ok:!0,count:t.length})});const qR="tool-todo_write",GR=new Set(["input-available","output-available"]);function YR(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!==qR||typeof r.state!="string"||!GR.has(r.state))continue;const l=A7.safeParse(r.input);if(l.success)return l.data.todos}}return[]}function P7(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:Wl(JT(n)),input:s.input})}return e}function E7(t){return t.at(-1)}function R7(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 JR(t){return t?t.message.startsWith("[CREDITS]"):!1}const QR="[SUBSCRIPTION_REQUIRED]";function D7(t){return t?.message.startsWith(QR)?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 XR={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function ZR(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&JR(s))return{...XR,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,h=!!c.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,u=R7(a),f=P7(c),p=YR(e),m=i?null:D7(s),g=!i&&!!s&&!m,x=f.length>0||i&&r,b=u.length>0,_=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(h||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:m,hasTodos:p.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:h,todos:p}}function I7(){const t=z.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=gi(),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=ZR({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 eD(){const t=I7();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 M7(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 tD="__home__";function Kg(t,e){return W2.chatDraft(t,e)}function sD(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 O7(t,e,s,n,i){const r=Kg(e,s);if(M7(n)){t.removeItem(r);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(r,a)}catch(c){if(iD(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function j4(t,e,s){const n=Kg(e,s),i=t.getItem(n),r=sD(i);return i!==null&&r===null&&t.removeItem(n),r}function nD(t,e,s){t.removeItem(Kg(e,s))}function iD(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function En(t){const e=z.c(14),s=bs(t),n=xs(),i=s?.metadata,r=n?.activeTask,l=r?.metadata?.runtime;let a;e[0]!==l?(a=fA(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!r&&!r.partial,h=r?.metadata;let u;e[2]!==i||e[3]!==h?(u=d8(h,i),e[2]=i,e[3]=h,e[4]=u):u=e[4];const f=!!c||d&&!!s;let p;e[5]!==i?(p=ig(i),e[5]=i,e[6]=p):p=e[6];let m;e[7]!==i?(m=rg(i),e[7]=i,e[8]=m):m=e[8];let g;return e[9]!==u||e[10]!==f||e[11]!==p||e[12]!==m?(g={runtime:u,resolved:f,projectDefault:p,previewServerUrl:m},e[9]=u,e[10]=f,e[11]=p,e[12]=m,e[13]=g):g=e[13],g}function rD(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function D9(t){return t?.name||t?.email?.split("@")[0]||void 0}function Yl(t){const e=rD(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}function $7(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 Wg(t){const e=$7(t);if(e)throw new Error(e)}function oD(t){try{return JSON.parse(t)}catch{return null}}function lD(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(r=>r.type==="text")?.text,n=s?oD(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function y0(t){const e=lD(t);return e===null?null:e}function B7(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 aD(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=B7(s);return!n||!s?null:{number:n,htmlUrl:s}}function C4(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const N4=/[\r\n<>]/,cD=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function _0(t){const e=t?.userName?.trim();if(!e||N4.test(e))return null;const s=t?.userEmail?.trim();return!s||N4.test(s)?{userName:e}:cD.test(s)?{userName:e,userEmail:s}:{userName:e}}function dD(t){return t.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-DUyabDLF.js","assets/index-CuEniakk.js","assets/index-Blq7G79G.css","assets/chat-context-Bv0NCGao.js","assets/use-panel-navigate-Dzed7hXE.js","assets/use-destination-route-DDLoaveW.js","assets/thread-route-CI9Oyaed.js","assets/dialog-BSQPsnMV.js","assets/Check-PMgjjdTe.js","assets/Copy01-B_2vcBlF.js","assets/Download01-CA2CYlYl.js","assets/constants-dLUUoWH7.js","assets/session-runtime-C-KTDVeQ.js","assets/slugify-CEUa2lfQ.js","assets/hooks-DwArKZRm.js","assets/use-mcp-client-BbnLyE8Y.js","assets/auth-Cdu_Esoc.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/decopilot-sse-pool-ULdMGH4U.js","assets/task-board--321T69G.js","assets/schema-B5fnKlHk.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-virtual-mcp-CUrHAeNi.js","assets/use-ai-providers-Bm-sHcqw.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-AJSxmtjR.js","assets/use-organization-settings-mos5d4Yb.js","assets/ChevronDown-oY26mbX7.js","assets/agent-icon-CqMkVI2H.js","assets/AlertCircle-ClToruK0.js","assets/UserSquare-Bxd4pDXm.js","assets/Tool01-DP7l3n3Y.js","assets/ArrowUp-CNhm6eFH.js","assets/ArrowLeft-B4E-Sahc.js","assets/Tool02-BvJSq7kS.js","assets/XCircle-DQCubZzT.js","assets/TrendUp01-iZTQHtO4.js","assets/ZapSquare-CqhgOeLt.js","assets/ZoomOut-nXvYYjVw.js","assets/Users03-DLm7BQsJ.js","assets/CheckCircle-RBxlsZl2.js","assets/ChevronRight-BEHZ6NZL.js","assets/ChevronSelectorVertical-JcGnBvEL.js","assets/ChevronUp-BZirzRB6.js","assets/DotsVertical-Cft1i3iA.js","assets/Stars02-CgssSvzZ.js","assets/CreditCard01-ChimmSCJ.js","assets/Settings02-gqR-NFC9.js","assets/Eye-DVnZY3NV.js","assets/FilterLines-DrGmxI0g.js","assets/Share07-BJMsRk6Q.js","assets/GitBranch01-DQckacwW.js","assets/Globe01-jbXb6ulu.js","assets/Globe04-xCK3nTmA.js","assets/SwitchHorizontal01-CmezVjc5.js","assets/HardDrive-C9KdcNlI.js","assets/Image01-CRujAxHg.js","assets/Key01-DK8RhZHE.js","assets/LinkExternal01-BtC-p5Va.js","assets/LockUnlocked01-B2L4GLRl.js","assets/LogOut01-D5WcJfJs.js","assets/Monitor01-CQH6tCva.js","assets/Sun-BFVshSLm.js","assets/Package-CORPPwT-.js","assets/Palette-dFQD8LKQ.js","assets/Play-CcGw_Uni.js","assets/Plus-bwHRKSue.js","assets/SearchLg-kHGYPtIw.js","assets/SearchMd-CrM8FgeA.js","assets/Shield01-B3IGGfe8.js","assets/Stars01-CyIrFIKT.js","assets/Trash01-8aRDtn4y.js","assets/Upload01-zJC35Q7D.js","assets/User01-Cg1rezA0.js","assets/Users01-BjZALObG.js","assets/XClose-DAiJgSzs.js","assets/Zap-DnE9jTWD.js","assets/scroll-area-bf_SAd7o.js","assets/select-CmM2ytba.js","assets/input-B2d8pbq0.js","assets/dropdown-menu-Br5tvBrx.js","assets/page-seo-form-k3DvmPXi.js","assets/label-Dj9n2KWw.js","assets/switch-CNDFjuCH.js","assets/use-section-preview-base-CJFnX7tM.js","assets/automation-runs-BSZspOPk.js","assets/useInfiniteQuery-UPxaQjph.js","assets/use-infinite-scroll-DR2K3ike.js","assets/use-connection-DrhFr-BW.js","assets/table-uC7dq7Qx.js","assets/empty-state-FLuorgA8.js","assets/use-members-ymHQ6DPO.js","assets/use-org-auth-client-B2Dtccrj.js","assets/use-automations-BBJJLcRi.js","assets/useSuspenseInfiniteQuery-91qpgWTX.js","assets/avatar-C4y8xmhb.js","assets/format-time-BnbuEtat.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-Ccsu-LzF.js","assets/markdown-BYs65uiN.js","assets/monaco-editor-BiUVO8An.js","assets/spinner-DIj1Go6P.js","assets/editor-99Sk7gK7.js","assets/types-FOnqs_ep.js","assets/shell-layout-Vi7dV7Tx.js","assets/required-auth-layout-XmkPJ52B.js","assets/use-org-sso-DqX_yfsK.js","assets/integration-icon-lEisOJE0.js","assets/use-navigate-to-agent-DIKXG43X.js","assets/github-repo-BpKUwJal.js","assets/chart-DsFfwadF.js","assets/index-DwFqKD4D.js","assets/AreaChart-BfrQSNFq.js","assets/form-BZ8QASyF.js","assets/file-type-icon-7YC5ilNl.js","assets/drawer-s9F4KtK0.js","assets/collection-search-BYP7-ZxX.js","assets/use-mcp-tools-DAOq320g.js","assets/tabs-C3hyhgOx.js","assets/toggle-group-BFZvVfAz.js","assets/super-agent-icon-C7NH1oj0.js","assets/self-tool-result-C0cbe0zd.js","assets/alert-dialog-DHosdfGA.js","assets/extract-connection-data-DMuGjDrw.js","assets/metadata-dUsYcpuu.js","assets/connection-B4xscr6U.js","assets/provision-repo-scoped-github-connection-CMPWtdMv.js","assets/use-debounced-value-C-4MWtE7.js","assets/authenticate-and-persist-oauth-CxNMau8p.js","assets/mcp-oauth-tpftyvwO.js","assets/track-C2sql3Ri.js","assets/popover-BLouf8R5.js","assets/toolbar-DK9YZczJ.js","assets/github-repo-picker-U8Jxu_k4.js","assets/agent-capabilities-BxGDQyCw.js","assets/connection-card-Dyoy7mvf.js","assets/use-registry-connections-C1MprIyF.js","assets/retry-CErkP7V6.js","assets/connection-slug-CITJ0kGN.js","assets/textarea-BR3Z3FW5.js","assets/connection-form-helpers-B2TmfMw7.js","assets/collection-tabs-CL2MtumN.js","assets/badge-bKgqq_hn.js","assets/select-model-DsvUVXBH.js","assets/checkbox-DC7ImXSU.js","assets/ai-providers-logos-DD3qZ33J.js","assets/folder-icon-aYJXq_Sg.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-9ZjtdYdG.js","assets/skill-preview-D2ESeOXu.js","assets/use-file-configs-6uuFnaeT.js","assets/site-slug-uya6Wp4-.js","assets/pt-BR-CLy76QW2.js","assets/use-debounced-autosave-bJxU4-DP.js","assets/search-input-DwyuZ_4a.js","assets/use-mcp-auth-status-DEiewDKN.js","assets/use-secrets-MfuKxy-T.js","assets/config-uvG_j2hY.js","assets/command-D92GDJ41.js","assets/index-BkCEfktg.js","assets/get-initials-D-f_fDFw.js","assets/breadcrumb-BxiaCaRI.js","assets/use-tags-FMu3sWNF.js","assets/automation-list-row-DlhKbcWS.js","assets/site-error--i37Vnuw.js","assets/use-org-repo-syncs-BraC28gq.js","assets/cards-AKnEBiwF.js","assets/file-explorer-C60EN7cX.js","assets/app-editor-CKOBupDJ.js","assets/post-editor-BPKO1Xmm.js","assets/multi-select-CzdqhztJ.js","assets/block-document-Cq9xvEs5.js","assets/primitives-DIn583iu.js","assets/use-autosave-D3jq2t0Z.js","assets/record-editor-CUEBm5uF.js","assets/category-editor-CeGZPq10.js","assets/bulk-category-panel-Bs99v8a6.js","assets/index-DHli4OJD.js","assets/seo-editor-nln9KG1F.js","assets/variant-calendar-DNADnJDP.js","assets/view-mode-toggle-CliygtAG.js","assets/post-calendar-nMyVgAGR.js","assets/alert-BR-p4tVC.js","assets/redirect-editor-DEIkb4ZD.js","assets/project-app-view-DLbH_B-S.js","assets/hosting-tab-BjO3qC08.js","assets/empty-state-BzoJWDN3.js","assets/e2e-tab-CDsd7wp2.js","assets/analytics-tab-HW971fV1.js","assets/YAxis-Dcyix6od.js","assets/cdn-tab-BkoLgXRq.js","assets/ErrorBarContext-Cm9VzL4a.js","assets/Sector-vmxMniJ8.js"])))=>i.map(i=>d[i]);
2
+ import{p as cs,r as P,ai as KN,aj as WN,ak as Rt,al as Ws,am as Re,an as pr,ao as _r,ap as Eu,aq as qN,ar as Ni,as as GN,at as Km,au as v6,c as z,H as Be,n as ie,j as o,E as Hs,b as re,t as ve,aa as to,a5 as gl,a8 as Fe,a9 as Ue,ab as He,av as Is,I as W2,o as Tt,aw as q2,K as Ge,a as _n,C as cd,B as me,ax as G2,ay as y6,x as Lr,az as Ss,aA as Il,aB as r4,d as Js,ac as gs,e as Vs,q as Je,aC as YN,D as go,aD as JN,aE as _6,aF as QN,aG as sr,aH as D1,aI as kn,aJ as XN,aK as I1,aL as ZN,aM as eT,aN as tT,aO as sT,aP as Y2,aQ as J2,aR as L6,aS as Q2,z as Zf,aT as nT,aU as iT,aV as rT,aW as w6,aX as pu,k as ct,aY as Ru,m as oT,u as xl,f as xo,R as e9,aZ as Oc,a_ as lT,a$ as o4,b0 as S6,b1 as Wm,b2 as k6,b3 as j6,b4 as C6,b5 as aT,b6 as cT,L as dT,a3 as N6,b7 as uT,b8 as Zh,b9 as Ml,Y as Pt,ba as T6,bb as V6,bc as $n,P as Ti,bd as Nt,s as A6,be as P6,bf as hT,bg as E6,bh as R6,bi as D6,bj as I6,bk as M6,bl as O6,bm as $6,bn as B6,bo as z6,bp as F6,bq as $s,N as ai,br as fT,bs as U6,bt as mT,bu as pT,bv as H6,bw as gT,bx as xT,by as bT,bz as vT,bA as yT,bB as K6,bC as _T,bD as LT,bE as wT,bF as ST,bG as kT,bH as jT,bI as CT,bJ as NT,bK as TT,bL as VT,bM as AT,bN as PT,ah as ET}from"./index-CuEniakk.js";import{i as t9,n as RT}from"./ArrowUp-CNhm6eFH.js";import{u as da,a as gi,b as xs,c as rn,d as W6,s as DT,e as IT,f as MT,g as OT,h as $T,i as BT,j as zT,k as X2,l as q6,T as FT,A as UT,m as HT,n as KT,t as WT,o as qT,p as GT,q as YT}from"./chat-context-Bv0NCGao.js";import{c as s9,s as dd,g as dr,P as Du,d as Z2,t as Wl,a as JT,M as QT,i as XT,b as Vi,e as ud,f as ZT,D as eV,h as tV,j as sV,k as qc,l as nV,m as iV,u as n9,E as rV,n as i0,o as oV,F as lV,p as i9,q as r9,r as G6,S as aV,v as cV,w as dV,x as uV,y as l4,z as hV,A as Y6,O as fV,B as a4,C as ir,G as mV,T as Wr,H as pV,I as ur,J as Qo,K as qm,L as Gm,N as J6,Q as gV,R as Q6,U as xV,V as xi,W as bV,X as vV,Y as X6,Z as Or,_ as yV,$ as _V,a0 as Z6,a1 as Pl,a2 as c4,a3 as LV,a4 as wV,a5 as d4,a6 as SV,a7 as Iu,a8 as ua,a9 as gr,aa as ef,ab as eg,ac as tg,ad as kV,ae as jV,af as CV,ag as NV,ah as TV,ai as VV,aj as AV,ak as o9,al as e8,am as t8,an as s8,ao as PV,ap as n8,aq as EV,ar as RV,as as DV,at as IV,au as r0,av as MV,aw as OV,ax as $V,ay as BV}from"./automation-runs-BSZspOPk.js";import{S as Gc}from"./spinner-DIj1Go6P.js";import{c as ms,d as Jt,b as Wt,D as qt,h as Tn,e as Jn,i as zV}from"./dialog-BSQPsnMV.js";import{c as FV,b as l9,a as a9,D as c9,d as i8,e as UV,f as HV}from"./drawer-s9F4KtK0.js";import{C as KV}from"./collection-search-BYP7-ZxX.js";import{u as Qt,a as WV,m as qV}from"./use-mcp-client-BbnLyE8Y.js";import{a as ha,i as tf,S as bl,b as GV,g as sf,c as r8,d as u4,R as YV,e as JV,W as QV,C as XV}from"./constants-dLUUoWH7.js";import{u as o8,g as o0,l as Ym,C as ZV,a as eA,b as tA}from"./chart-DsFfwadF.js";import{t as Gt}from"./ChevronDown-oY26mbX7.js";import{t as sA,z as nA,a as hd,u as sg,b as ng,c as d9}from"./hooks-DwArKZRm.js";import{K as iA,i as l8,u as vl,a as a8,m as rA,f as oA}from"./shell-layout-Vi7dV7Tx.js";import{a as bs,b as u9,u as fa,c as lA}from"./use-virtual-mcp-CUrHAeNi.js";import{w as c8,A as aA,c as cA,b as h9,d as dA,r as uA,e as hA}from"./thread-route-CI9Oyaed.js";import{r as d8,d as ig,a as rg,p as fA,b as mA,s as pA}from"./session-runtime-C-KTDVeQ.js";import{g as ma,r as og}from"./github-repo-BpKUwJal.js";import{u as u8,a as lg,b as h8}from"./use-mcp-tools-DAOq320g.js";import{i as bo,b as ag,a as gA}from"./XCircle-DQCubZzT.js";import{f as f8,g as cg,h as pa,j as m8,n as p8,A as mi,k as g8,l as Yc,s as ll,m as x8,o as ga,p as xA,q as bA,c as b8,r as nf,u as fd,e as vA,v as yA,w as _A,x as v8,d as LA,y as f9,z as xa,B as wA,C as dg,D as y8,E as _8,F as Jm,G as M1,H as h4,I as m9,J as SA,K as kA,L as jA,M as CA,N as NA,O as ug,P as L8,Q as Qn,R as hg,S as fg,T as l0,U as hr,V as p9,W as g9,X as w8,Y as S8,Z as k8,_ as TA,$ as mg,a0 as VA,a1 as f4,a2 as AA,a3 as PA,t as j8,a4 as Yr,a5 as a0,a6 as EA,i as x9,a7 as RA,a8 as DA,a9 as IA,aa as MA,ab as OA,ac as $A,ad as sl,ae as m4,af as C8,ag as BA,ah as zA,ai as FA,aj as Jc,ak as pg,al as UA,am as p4,an as HA,ao as KA,ap as WA,aq as N8,ar as qA,as as GA,at as YA,au as JA,av as QA,aw as XA,ax as ZA,ay as eP,az as T8,aA as V8,aB as tP,aC as sP,aD as nP,aE as iP,aF as rP,aG as oP}from"./agent-icon-CqMkVI2H.js";import{i as Kt}from"./Check-PMgjjdTe.js";import{a as xr}from"./Image01-CRujAxHg.js";import{i as Xn}from"./Upload01-zJC35Q7D.js";import{i as vn}from"./AlertCircle-ClToruK0.js";import{a as dn}from"./Copy01-B_2vcBlF.js";import{F as Qm,a as gg,b as xg,c as bg,d as A8}from"./form-BZ8QASyF.js";import{d as Dt,S as ks,a as js,b as As,c as Cs}from"./select-CmM2ytba.js";import{t as b9,a as vg,i as v9,b as yg,c as lP,d as aP,e as cP}from"./UserSquare-Bxd4pDXm.js";import{i as y9}from"./ArrowLeft-B4E-Sahc.js";import{T as zl,a as ba,b as di,c as md}from"./tabs-C3hyhgOx.js";import{t as Xm}from"./Tool02-BvJSq7kS.js";import{T as _9,a as Qc}from"./toggle-group-BFZvVfAz.js";import{I as gt}from"./input-B2d8pbq0.js";import{u as _g,b as Lg,f as P8,g as dP,c as uP,p as g4,S as ui,t as wg,C as Sg,a as hP,h as fP,N as mP}from"./super-agent-icon-C7NH1oj0.js";import{s as Ai}from"./XClose-DAiJgSzs.js";import{M as pP,a as gP,m as L9,i as xP,g as E8,b as bP,N as vP,c as yP}from"./select-model-DsvUVXBH.js";import{a as ts,b as ss,P as ns,c as _P}from"./popover-BLouf8R5.js";import{t as Jr}from"./Stars01-CyIrFIKT.js";import{b as LP,a as w9,c as R8,d as D8,e as I8,u as S9,f as M8}from"./use-organization-settings-mos5d4Yb.js";import{u as k9,a as wP}from"./use-ai-providers-Bm-sHcqw.js";import{g as kg,c as O8,a as nn,f as SP,d as kP}from"./agent-capabilities-BxGDQyCw.js";import{f as jP,a as CP,u as Mu,b as c0,c as $8,d as NP,e as jg,g as B8,h as Cg,i as TP,j as Ng,k as Ou,l as z8,m as VP,n as F8,o as AP}from"./folder-icon-aYJXq_Sg.js";import{c as $t,D as Bt,b as zt,a as Ye,d as rr,e as or,f as lr,g as Xc,h as Yn,i as Qr,j as Md}from"./dropdown-menu-Br5tvBrx.js";import{s as Ut}from"./Plus-bwHRKSue.js";import{p as PP,q as EP}from"./question-004-sINsf4GQ.js";import{A as Ps}from"./avatar-C4y8xmhb.js";import{u as U8,a as d0}from"./use-members-ymHQ6DPO.js";import{i as qs}from"./ChevronRight-BEHZ6NZL.js";import{u as u0}from"./use-is-desktop-app-BNujXJc_.js";import{u as bi,a as Tg}from"./use-panel-navigate-Dzed7hXE.js";import{i as vi}from"./CheckCircle-RBxlsZl2.js";import{I as Oi}from"./integration-icon-lEisOJE0.js";import{a as RP,b as DP}from"./use-navigate-to-agent-DIKXG43X.js";import{e as h0}from"./backoff-CrEUbyZT.js";import{u as IP}from"./use-status-sounds-9ZjtdYdG.js";import{E as al}from"./empty-state-FLuorgA8.js";import{T as Xo,a as MP}from"./toolbar-DK9YZczJ.js";import{b as H8,n as K8}from"./ZapSquare-CqhgOeLt.js";import{i as cl,a as OP}from"./Share07-BJMsRk6Q.js";import{i as zn}from"./Globe01-jbXb6ulu.js";import{i as $P}from"./Monitor01-CQH6tCva.js";import{u as pi,a as Vg,b as Ag}from"./use-connection-DrhFr-BW.js";import{g as j9,M as BP}from"./types-FOnqs_ep.js";import{d as Pg,s as zP,g as FP,a as UP,F as W8,b as q8,f as G8,S as Y8,c as HP}from"./skill-preview-D2ESeOXu.js";import{F as dl}from"./file-type-icon-7YC5ilNl.js";import{e as KP,c as Eg,s as f0,b as WP}from"./TrendUp01-iZTQHtO4.js";import{i as so}from"./ZoomOut-nXvYYjVw.js";import{i as ci}from"./GitBranch01-DQckacwW.js";import{a as Rg}from"./Package-CORPPwT-.js";import{u as Dg,a as J8}from"./use-file-configs-6uuFnaeT.js";import{r as Q8}from"./site-slug-uya6Wp4-.js";import{n as $u}from"./Download01-CA2CYlYl.js";import{n as un}from"./LinkExternal01-BtC-p5Va.js";import{D as Pc}from"./use-destination-route-DDLoaveW.js";import{i as C9}from"./Key01-DK8RhZHE.js";import{p as Ig,b as ln,s as Zc,H as Bu,h as zu,a as vc,c as X8,d as Z8}from"./location-oTTXFrSF.js";import{m as qP,a as GP,M as pd,b as YP,O as JP}from"./markdown-BYs65uiN.js";import{p as QP,f as XP}from"./pt-BR-CLy76QW2.js";import{g as ZP,e as eE}from"./extract-connection-data-DMuGjDrw.js";import{a as tE,i as x4}from"./mcp-oauth-tpftyvwO.js";import{A as no,a as io,b as ro,c as oo,d as lo,e as ao,f as co,g as uo}from"./alert-dialog-DHosdfGA.js";import{T as ho}from"./textarea-BR3Z3FW5.js";import{i as ql}from"./Play-CcGw_Uni.js";import{s as Gs}from"./Trash01-8aRDtn4y.js";import{u as rf}from"./use-debounced-autosave-bJxU4-DP.js";import{S as yl}from"./scroll-area-bf_SAd7o.js";import{i as Fu}from"./SearchMd-CrM8FgeA.js";import{C as gd}from"./checkbox-DC7ImXSU.js";import{S as N9}from"./search-input-DwyuZ_4a.js";import{C as e7}from"./collection-tabs-CL2MtumN.js";import{T as t7,u as s7}from"./use-mcp-auth-status-DEiewDKN.js";import{n as sE}from"./LockUnlocked01-B2L4GLRl.js";import{g as nE}from"./connection-slug-CITJ0kGN.js";import{a as n7,i as iE}from"./Settings02-gqR-NFC9.js";import{L as Ot}from"./label-Dj9n2KWw.js";import{S as Pi}from"./switch-CNDFjuCH.js";import{s as i7}from"./slugify-CEUa2lfQ.js";import{d as xd}from"./delay-CnY5UFtP.js";import{G as Vn,a as Mg,u as rE}from"./github-repo-picker-U8Jxu_k4.js";import{s as of}from"./User01-Cg1rezA0.js";import{t as Og}from"./Users01-BjZALObG.js";import{u as r7,a as o7}from"./use-secrets-MfuKxy-T.js";import{a as va}from"./format-time-BnbuEtat.js";import{f as l7,g as oE,l as a7,a as lE}from"./provision-repo-scoped-github-connection-CMPWtdMv.js";import{a as aE}from"./authenticate-and-persist-oauth-CxNMau8p.js";import{X as cE,A as dE,a as uE}from"./AreaChart-BfrQSNFq.js";import{P as cn,a as m0,t as Gl,f as c7,u as d7,b as $g,s as u7,l as lf,c as Uu,m as h7,T as Zo,d as f7,i as hE,e as fE,g as mE,S as pE,h as m7,j as p7,r as g7,k as gE,n as xE,o as bE,p as vE,q as yE,L as Zm,v as b4,w as _E,H as LE,x as wE}from"./config-uvG_j2hY.js";import{C as An,a as hn,b as Ft,c as os,d as Pn,e as Fn,f as SE,g as v4}from"./command-D92GDJ41.js";import{i as T9}from"./FilterLines-DrGmxI0g.js";import{g as bn}from"./get-initials-D-f_fDFw.js";import{S as as,R as kE,a as jE,D as CE,i as x7,n as NE,b as TE}from"./task-board--321T69G.js";import{B as VE,a as AE,b as y4,c as PE,d as EE,e as RE}from"./breadcrumb-BxiaCaRI.js";import{u as O1}from"./use-copy-Ccsu-LzF.js";import{i as Bg,c as b7}from"./SwitchHorizontal01-CmezVjc5.js";import{u as DE}from"./use-org-auth-client-B2Dtccrj.js";import{u as zg,a as IE,b as ME}from"./use-tags-FMu3sWNF.js";import{i as V9}from"./ChevronSelectorVertical-JcGnBvEL.js";import{w as _4}from"./editor-99Sk7gK7.js";import{i as A9}from"./SearchLg-kHGYPtIw.js";import{u as ep,a as OE,c as $E,p as v7,b as BE,s as tp,n as zE}from"./self-tool-result-C0cbe0zd.js";import{M as bd}from"./monaco-editor-BiUVO8An.js";import{i as FE,a as P9,b as Fg}from"./Tool01-DP7l3n3Y.js";import{a as sp}from"./Palette-dFQD8LKQ.js";import{s as p0}from"./Eye-DVnZY3NV.js";import{i as E9}from"./DotsVertical-Cft1i3iA.js";import{u as R9}from"./use-debounced-value-C-4MWtE7.js";import{u as y7}from"./useInfiniteQuery-UPxaQjph.js";import{i as br}from"./Zap-DnE9jTWD.js";import{B as UE}from"./badge-bKgqq_hn.js";import{u as g0,a as HE,b as KE,c as WE,d as qE}from"./use-automations-BBJJLcRi.js";import{s as gu,n as GE}from"./Stars02-CgssSvzZ.js";import{A as YE}from"./automation-list-row-DlhKbcWS.js";import{t as JE}from"./site-error--i37Vnuw.js";import{u as QE,a as XE}from"./use-org-repo-syncs-BraC28gq.js";import{n as _7}from"./ChevronUp-BZirzRB6.js";import{f as ZE,p as eR,g as tR,u as sR,e as nR,F as x0,t as L7,S as iR,B as rR,a as w7,R as oR}from"./cards-AKnEBiwF.js";function S7(t,e){const s=cs(e);return lR({filters:{...t,status:"pending"}},s).length}function L4(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function lR(t={},e){const s=cs(e).getMutationCache(),n=P.useRef(t),i=P.useRef(null);return i.current===null&&(i.current=L4(s,t)),P.useEffect(()=>{n.current=t}),P.useSyncExternalStore(P.useCallback(r=>s.subscribe(()=>{const l=KN(i.current,L4(s,n.current));i.current!==l&&(i.current=l,WN.schedule(r))}),[s]),()=>i.current,()=>i.current)}const su=Rt({connection_id:Re().describe("Connection ID"),selected_tools:Ws(Re()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:Ws(Re()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:Ws(Re()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),k7=su.extend({selected_tools:su.shape.selected_tools.optional(),selected_resources:su.shape.selected_resources.optional(),selected_prompts:su.shape.selected_prompts.optional()}),aR=Rt({connectionId:Re(),toolName:Re(),label:Re(),icon:Re().nullable().optional()}),cR=Rt({id:Re().describe("Stable id; used as React key and ?tab= value"),title:Re().describe("Tab label"),icon:Re().optional().describe("Optional lucide icon name"),view:Rt({type:Km("ext-app"),appId:Re(),args:Eu(Re(),v6()).optional()})}),j7=_r(["off","manual","auto"]),dR=Rt({defaultMainView:Rt({type:Re(),id:Re().optional(),toolName:Re().optional()}).nullable().optional(),chatDefaultOpen:pr().nullable().optional(),cmsDefaultOpen:pr().nullable().optional(),cms:j7.nullable().optional().describe("How this agent offers content editing. Absent falls back to cmsDefaultOpen."),tabs:Ws(cR).optional()});function b0(t){return t?.cms?t.cms:t?.cmsDefaultOpen?"auto":"manual"}function uR(t,e){const s=e==="off"&&t?.defaultMainView?.type==="content";return{...t,cms:e,cmsDefaultOpen:null,...s?{defaultMainView:{type:"preview"}}:{}}}const w4=Rt({tileId:Re().optional(),connectionId:Re().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:Re().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:Re().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:Eu(Re(),v6()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Ni().int().positive().optional(),maxHeight:Ni().int().positive().optional()}),hR=Rt({banner:Re().nullable().optional(),bannerColor:Re().nullable().optional(),icon:Re().nullable().optional(),themeColor:Re().nullable().optional(),pinnedViews:Ws(aR).nullable().optional(),layout:dR.nullable().optional(),homeTile:w4.nullable().optional(),homeTiles:Ws(w4).nullable().optional(),homePrompts:Ws(Re()).nullable().optional()});function ed(t){const e=t?.homeTiles;if(Array.isArray(e)&&e.length>0)return e;const s=t?.homeTile;return s?[s]:[]}const v0=/^[A-Za-z_][A-Za-z0-9_]*$/,S4=Re().min(1).regex(v0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),fR=GN("kind",[Rt({key:S4,kind:Km("literal"),value:Re()}),Rt({key:S4,kind:Km("secret"),secretId:Re().min(1)})]),Ug=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,mR=Rt({host:Re().min(1).regex(Ug).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:Re().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),pR=Rt({selected:Re().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:Re().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:Re().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:Ws(fR).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:Ws(mR).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),gR=Rt({url:Re().describe("GitHub repository URL"),owner:Re().describe("Repository owner"),name:Re().describe("Repository name"),installationId:Ni().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:Re().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),xR=_r(["agent-sandbox","local-api"]),bR={sandboxHandle:Re().describe("Provider-specific handle"),previewUrl:Re().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:Re().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:Ni().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:Rt({packageManager:Re().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:Re().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:Re().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.")},C7=Rt(bR);function vR(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]=C7.parse(i)}catch{}return s}const yR=Eu(Re().describe("userId"),Eu(Re().describe("branch"),qN(xR,C7))),_R=Rt({id:Re().describe("Stable identifier for this knowledge file"),name:Re().describe("File name shown in the UI"),kind:_r(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:Re().describe("Org filesystem (Library) volume the file lives in"),path:Re().describe("Path within the volume"),url:Re().describe("Same-origin URL to read the file (display/download)"),contentType:Re().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Ni().nullable().optional().describe("File size in bytes"),addedAt:Re().describe("ISO timestamp when the file was attached")}),LR=Ws(_R).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."),wR=_r(["smart","code-review","open"]),SR=wR.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."),kR=pr().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."),jR=pr().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."),CR=Re().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."),NR=Rt({branch:Re().describe("Git branch backing this release"),name:Re().describe('User-facing name, e.g. "Black Friday 2026"'),color:Re().describe("Dot color token shown in the version switcher"),createdBy:Re().optional().describe("User ID who created the release"),createdAt:Re().optional().describe("ISO 8601 creation timestamp")}),TR=Ws(NR).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."),VR=pr().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."),Hg={instructions:Re().nullable().optional().describe("Instructions also used as system prompt"),enabled_plugins:Ws(Re()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:Ws(Re()).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:Re().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:hR.nullable().optional().describe("UI customization settings"),githubRepo:gR.nullable().optional().describe("Linked GitHub repository"),runtime:pR.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:LR,siteSlug:Re().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:SR,previewServerUrl:CR,productionUrl:Re().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:pr().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:kR,releases:TR,draftsMode:VR,fastPreviewInPlace:jR},AR=Rt({id:Re().describe("Unique identifier"),title:Re().describe("Human-readable name"),description:Re().nullable().describe("Description"),icon:Re().nullable().describe("Icon URL"),created_at:Re().describe("Creation timestamp"),updated_at:Re().describe("Last update timestamp"),created_by:Re().describe("User ID who created this item"),updated_by:Re().optional().describe("User ID who last updated this item"),organization_id:Re().describe("Organization ID this item belongs to"),status:_r(["active","inactive"]).describe("Current status"),pinned:pr().describe("Whether this space is pinned to the sidebar"),metadata:Rt(Hg).extend({instructions:Re().nullable().describe("Instructions also used as system prompt"),sandboxMap:yR.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:Ws(su).describe("Connections with their selected tools, resources, and prompts")}),N7=Rt({title:Re().min(1).max(120).describe("Short label shown on the chip"),description:Re().max(280).optional().describe("One-line subtitle shown under the title"),text:Re().min(1).describe("The message sent to the agent when the prompt is clicked")});Rt({title:Re().min(1).max(255).describe("Name for the virtual MCP"),description:Re().nullable().optional().describe("Optional description"),icon:Re().nullish().describe("Optional icon URL"),status:_r(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:pr().optional().default(!1).describe("Pin to sidebar"),metadata:Rt(Hg).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:Ws(k7).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:Ws(N7).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.")});Rt({title:Re().min(1).max(255).optional().describe("New name"),description:Re().nullable().optional().describe("New description (null to clear)"),icon:Re().nullish().describe("New icon URL"),status:_r(["active","inactive"]).optional().describe("New status"),pinned:pr().optional().describe("Pin/unpin from sidebar"),metadata:Rt(Hg).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:Ws(k7).optional().describe("New connections (replaces existing)"),prompts:Ws(N7).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 k4=3,T7="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",PR="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function V7(t){const e=z.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 w=dr(c._meta);d=c.title??Z2(c.name,w),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=d}else d=e[3];const h=d,u=c.description||null;if(a==="card"){let w;e[4]!==n||e[5]!==c?(w=()=>n(c),e[4]=n,e[5]=c,e[6]=w):w=e[6];const k=r||i,j=i&&"bg-accent/40",C=(r||i)&&"cursor-not-allowed opacity-50";let N;e[7]!==j||e[8]!==C?(N=ie(PR,"hover:bg-accent/60 text-foreground",j,C),e[7]=j,e[8]=C,e[9]=N):N=e[9];let T;e[10]!==h?(T=o.jsx("span",{className:"font-medium truncate capitalize",children:h}),e[10]=h,e[11]=T):T=e[11];let V;e[12]!==i?(V=i&&o.jsx(Gc,{size:"xs"}),e[12]=i,e[13]=V):V=e[13];let A;e[14]!==T||e[15]!==V?(A=o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[T,V]}),e[14]=T,e[15]=V,e[16]=A):A=e[16];let E;e[17]!==u?(E=u&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:u}),e[17]=u,e[18]=E):E=e[18];let R;return e[19]!==A||e[20]!==E||e[21]!==w||e[22]!==k||e[23]!==N?(R=o.jsxs("button",{type:"button",onClick:w,disabled:k,className:N,children:[A,E]}),e[19]=A,e[20]=E,e[21]=w,e[22]=k,e[23]=N,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 p=r||i,m=i&&"bg-muted/50",g=(r||i)&&"cursor-not-allowed opacity-50";let x;e[28]!==m||e[29]!==g?(x=ie(T7,"hover:bg-muted/70 hover:text-foreground",m,g),e[28]=m,e[29]=g,e[30]=x):x=e[30];let b;e[31]!==h?(b=o.jsx("span",{className:"capitalize",children:h}),e[31]=h,e[32]=b):b=e[32];let y;e[33]!==i?(y=i&&o.jsx(Gc,{size:"xs"}),e[33]=i,e[34]=y):y=e[34];let _;e[35]!==f||e[36]!==p||e[37]!==x||e[38]!==b||e[39]!==y?(_=o.jsx(Fe,{asChild:!0,children:o.jsxs("button",{type:"button",onClick:f,disabled:p,className:x,children:[b,y]})}),e[35]=f,e[36]=p,e[37]=x,e[38]=b,e[39]=y,e[40]=_):_=e[40];const v=u??h;let L;e[41]!==v?(L=o.jsx(Ue,{side:"top",className:"max-w-xs",children:o.jsx("p",{className:"text-xs",children:v})}),e[41]=v,e[42]=L):L=e[42];let S;return e[43]!==_||e[44]!==L?(S=o.jsxs(He,{delayDuration:400,children:[_,L]}),e[43]=_,e[44]=L,e[45]=S):S=e[45],S}function ER(t){const e=z.c(61),{items:s,open:n,onOpenChange:i,onSelect:r,loadingPrompt:l}=t,a=re(),[c,d]=P.useState(""),h=!!l;let u;e[0]!==s||e[1]!==c?(u=c.trim()?s.filter(T=>{const V=c.toLowerCase();return T.prompt.name.toLowerCase().includes(V)||(T.prompt.title??"").toLowerCase().includes(V)||(T.prompt.description??"").toLowerCase().includes(V)}):s,e[0]=s,e[1]=c,e[2]=u):u=e[2];const f=u,p=gl();let m;e[3]!==f.length||e[4]!==c||e[5]!==a?(m=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]=m):m=e[6];let g;if(e[7]!==f||e[8]!==h||e[9]!==l?.name||e[10]!==i||e[11]!==r){let T;e[13]!==h||e[14]!==l?.name||e[15]!==i||e[16]!==r?(T=V=>o.jsx(V7,{item:V,variant:"card",onSelect:A=>{i(!1),r(A)},isLoading:l?.name===V.prompt.name,isDisabled:h&&l?.name!==V.prompt.name},V.prompt.name),e[13]=h,e[14]=l?.name,e[15]=i,e[16]=r,e[17]=T):T=e[17],g=f.map(T),e[7]=f,e[8]=h,e[9]=l?.name,e[10]=i,e[11]=r,e[12]=g}else g=e[12];let x;e[18]!==m||e[19]!==g?(x=o.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[m,g]})}),e[18]=m,e[19]=g,e[20]=x):x=e[20];const b=x;let y;e[21]!==a?(y=a("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=a,e[22]=y):y=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=T=>{T.key==="Escape"&&d("")},e[23]=_):_=e[23];let v;e[24]!==c||e[25]!==y?(v=o.jsx(KV,{value:c,onChange:d,placeholder:y,onKeyDown:_}),e[24]=c,e[25]=y,e[26]=v):v=e[26];const L=v;if(p){let T;e[27]!==a?(T=a("chat.iceBreakers.allPromptsTitle"),e[27]=a,e[28]=T):T=e[28];let V;e[29]!==T?(V=o.jsx(FV,{className:"sr-only",children:o.jsx(l9,{children:T})}),e[29]=T,e[30]=V):V=e[30];let A;e[31]!==a?(A=a("chat.iceBreakers.promptsLabel"),e[31]=a,e[32]=A):A=e[32];let E;e[33]!==A?(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:A})}),e[33]=A,e[34]=E):E=e[34];let R;e[35]!==b||e[36]!==L||e[37]!==E||e[38]!==V?(R=o.jsxs(a9,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[V,E,L,b]}),e[35]=b,e[36]=L,e[37]=E,e[38]=V,e[39]=R):R=e[39];let D;return e[40]!==i||e[41]!==n||e[42]!==R?(D=o.jsx(to,{delayDuration:400,children:o.jsx(c9,{open:n,onOpenChange:i,children:R})}),e[40]=i,e[41]=n,e[42]=R,e[43]=D):D=e[43],D}let S;e[44]!==a?(S=a("chat.iceBreakers.allPromptsTitle"),e[44]=a,e[45]=S):S=e[45];let w;e[46]!==S?(w=o.jsx(ms,{className:"sr-only",children:o.jsx(Jt,{children:S})}),e[46]=S,e[47]=w):w=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]!==w?(C=o.jsxs(Wt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[w,j,L,b]}),e[52]=b,e[53]=L,e[54]=j,e[55]=w,e[56]=C):C=e[56];let N;return e[57]!==i||e[58]!==n||e[59]!==C?(N=o.jsx(to,{delayDuration:400,children:o.jsx(qt,{open:n,onOpenChange:i,children:C})}),e[57]=i,e[58]=n,e[59]=C,e[60]=N):N=e[60],N}function RR(t){const e=z.c(30),{items:s,onSelect:n,loadingPrompt:i,className:r}=t,l=re(),[a,c]=P.useState(!1);if(s.length===0)return null;let d,h,u,f,p;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==n||e[4]!==l){const b=s.slice(0,k4),y=s.slice(k4),_=!!i;let v;e[10]!==_||e[11]!==i?.name||e[12]!==n?(v=S=>o.jsx(V7,{item:S,onSelect:n,isLoading:i?.name===S.prompt.name,isDisabled:_&&i?.name!==S.prompt.name},S.prompt.name),e[10]=_,e[11]=i?.name,e[12]=n,e[13]=v):v=e[13];const L=b.map(v);d=to,p=400,e[14]!==r?(h=ie("w-full flex flex-wrap gap-2 justify-center",r),e[14]=r,e[15]=h):h=e[15],u=L,f=y.length>0&&o.jsx("button",{type:"button",disabled:_,onClick:()=>c(!0),className:ie(T7,"hover:bg-muted/70 hover:text-foreground",_&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:y.length})}),e[0]=r,e[1]=s,e[2]=i,e[3]=n,e[4]=l,e[5]=d,e[6]=h,e[7]=u,e[8]=f,e[9]=p}else d=e[5],h=e[6],u=e[7],f=e[8],p=e[9];let m;e[16]!==h||e[17]!==u||e[18]!==f?(m=o.jsxs("div",{className:h,children:[u,f]}),e[16]=h,e[17]=u,e[18]=f,e[19]=m):m=e[19];let g;e[20]!==s||e[21]!==i||e[22]!==a||e[23]!==n?(g=o.jsx(ER,{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]!==p||e[27]!==m||e[28]!==g?(x=o.jsxs(d,{delayDuration:p,children:[m,g]}),e[25]=d,e[26]=p,e[27]=m,e[28]=g,e[29]=x):x=e[29],x}function DR(){return null}function IR(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 MR(t){const e=z.c(31),{connectionId:s}=t,n=re(),{sendMessage:i}=gi(),{org:r}=Be();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=Qt(l);let c;e[4]!==a?(c={client:a,staleTime:6e4},e[4]=a,e[5]=c):c=e[5];const{data:d}=o8(c);let h;e[6]!==d?.prompts?(h=d?.prompts??[],e[6]=d?.prompts,e[7]=h):h=e[7];const u=h;let f;e[8]!==u?(f=u.map(OR),e[8]=u,e[9]=f):f=e[9];const p=f;let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m={stage:"idle"},e[10]=m):m=e[10];const[g,x]=P.useReducer(IR,m),[b,y]=P.useState(null);let _;e[11]!==a||e[12]!==i||e[13]!==n?(_=async(A,E)=>{if(!a){ve.error(n("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const R=await o0(a,A.name,E);x({type:"RESET"});const D={type:"doc",content:[{type:"paragraph",content:[s9({id:A.name,name:dd(A.name,dr(A._meta)),metadata:R.messages,char:"/",kind:"prompt",args:E}),{type:"text",text:" "}]}]};await i(D)}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 v=_;let L;e[15]!==v?(L=async A=>{if(A.arguments&&A.arguments.length>0){x({type:"SELECT_PROMPT",prompt:A}),y(A);return}x({type:"START_LOADING",prompt:A}),await v(A)},e[15]=v,e[16]=L):L=e[16];const S=L;let w;e[17]!==b||e[18]!==v?(w=async A=>{b&&(x({type:"START_LOADING",prompt:b,arguments:A}),y(null),await v(b,A))},e[17]=b,e[18]=v,e[19]=w):w=e[19];const k=w;if(p.length===0)return null;const j=g.stage==="loading"?g.prompt:null;let C;e[20]!==S||e[21]!==p||e[22]!==j?(C=o.jsx(RR,{items:p,onSelect:S,loadingPrompt:j}),e[20]=S,e[21]=p,e[22]=j,e[23]=C):C=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{y(null),x({type:"RESET"})},e[24]=N):N=e[24];let T;e[25]!==b||e[26]!==k?(T=o.jsx(Du,{prompt:b,setPrompt:N,onSubmit:k}),e[25]=b,e[26]=k,e[27]=T):T=e[27];let V;return e[28]!==C||e[29]!==T?(V=o.jsxs(o.Fragment,{children:[C,T]}),e[28]=C,e[29]=T,e[30]=V):V=e[30],V}function OR(t){return{prompt:t}}function $R(t){const e=z.c(13),{className:s}=t,{selectedVirtualMcp:n}=da(),{org:i}=Be();let r;e[0]!==i.id?(r=ha(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=ie("w-full @container",s),e[2]=s,e[3]=c):c=e[3];const d=a??"default";let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(DR,{}),e[4]=h):h=e[4];let u;e[5]!==a?(u=o.jsx(MR,{connectionId:a}),e[5]=a,e[6]=u):u=e[6];let f;e[7]!==d||e[8]!==u?(f=o.jsx(Hs,{fallback:null,children:o.jsx(P.Suspense,{fallback:h,children:u},d)}),e[7]=d,e[8]=u,e[9]=f):f=e[9];let p;return e[10]!==c||e[11]!==f?(p=o.jsx("div",{className:c,children:f}),e[10]=c,e[11]=f,e[12]=p):p=e[12],p}const $1="cubic-bezier(0.645, 0.045, 0.355, 1)",BR=44,zR={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"},FR={default:"border-border",error:"border-destructive/30",warning:"border-warning/30"},UR={default:"text-muted-foreground",error:"text-destructive",warning:"text-warning"};function ul(t){const e=z.c(69),{icon:s,label:n,count:i,title:r,footerLeft:l,footerRight:a,children:c,defaultExpanded:d,variant:h,onClose:u}=t,f=h===void 0?"default":h,p=re(),[m,g]=P.useState(d),[x,b]=P.useState(!1);let y;e[0]!==u?(y=()=>{b(!0),u?.()},e[0]=u,e[1]=y):y=e[1];const _=y;if(x)return null;const v=FR[f],L=zR[f];let S;e[2]!==v||e[3]!==L?(S=ie("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,L),e[2]=v,e[3]=L,e[4]=S):S=e[4];let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=()=>g(HR),e[5]=w):w=e[5];const k=m&&"rounded-b-none",j=!m&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=ie("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 N=UR[f];let T;e[9]!==N?(T=ie("shrink-0",N),e[9]=N,e[10]=T):T=e[10];let V;e[11]!==s||e[12]!==T?(V=o.jsx("span",{className:T,children:s}),e[11]=s,e[12]=T,e[13]=V):V=e[13];let A;e[14]!==n?(A=o.jsx("span",{className:"flex-1 min-w-0 truncate",children:n}),e[14]=n,e[15]=A):A=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=m?"rotate(180deg)":"rotate(0deg)";let D;e[18]!==R?(D=o.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:o.jsx(Gt,{size:16,style:{transform:R,transition:`transform 180ms ${$1}`}})}),e[18]=R,e[19]=D):D=e[19];let I;e[20]!==p?(I=p("chat.collapsibleHighlight.closeLabel"),e[20]=p,e[21]=I):I=e[21];let O;e[22]!==p?(O=p("chat.collapsibleHighlight.closeTitle"),e[22]=p,e[23]=O):O=e[23];let F,M;e[24]!==_?(F=J=>{J.stopPropagation(),_()},M=J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),J.stopPropagation(),_())},e[24]=_,e[25]=F,e[26]=M):(F=e[25],M=e[26]);let $;e[27]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Is,{size:16}),e[27]=$):$=e[27];let B;e[28]!==I||e[29]!==O||e[30]!==F||e[31]!==M?(B=o.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":I,title:O,onClick:F,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:$}),e[28]=I,e[29]=O,e[30]=F,e[31]=M,e[32]=B):B=e[32];let U;e[33]!==m||e[34]!==V||e[35]!==A||e[36]!==E||e[37]!==D||e[38]!==B||e[39]!==C?(U=o.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":m,onClick:w,className:C,children:[V,A,E,D,B]}),e[33]=m,e[34]=V,e[35]=A,e[36]=E,e[37]=D,e[38]=B,e[39]=C,e[40]=U):U=e[40];const H=m?"1fr":"0fr";let W;e[41]!==H?(W={display:"grid",gridTemplateRows:H,transition:`grid-template-rows 180ms ${$1}`},e[41]=H,e[42]=W):W=e[42];let K;e[43]===Symbol.for("react.memo_cache_sentinel")?(K={overflow:"hidden",minHeight:0},e[43]=K):K=e[43];const G=m?1:0;let Y;e[44]!==G?(Y={opacity:G,transition:`opacity 120ms ${$1}`,maxHeight:"60vh"},e[44]=G,e[45]=Y):Y=e[45];let X;e[46]!==r?(X=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]=X):X=e[47];let te;e[48]!==c||e[49]!==r?(te=c?o.jsx("div",{className:ie("pb-4",!r&&"pt-4"),children:c}):null,e[48]=c,e[49]=r,e[50]=te):te=e[50];let se;e[51]!==X||e[52]!==te?(se=o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[X,te]}),e[51]=X,e[52]=te,e[53]=se):se=e[53];let ne;e[54]!==l||e[55]!==a?(ne=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]=ne):ne=e[56];let Q;e[57]!==Y||e[58]!==se||e[59]!==ne?(Q=o.jsx("div",{style:K,children:o.jsxs("div",{className:"flex flex-col",style:Y,children:[se,ne]})}),e[57]=Y,e[58]=se,e[59]=ne,e[60]=Q):Q=e[60];let q;e[61]!==W||e[62]!==Q?(q=o.jsx("div",{"data-testid":"collapsible-highlight-body",style:W,children:Q}),e[61]=W,e[62]=Q,e[63]=q):q=e[63];let le;return e[64]!==U||e[65]!==q||e[66]!==S||e[67]!==f?(le=o.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":f,className:S,children:[U,q]}),e[64]=U,e[65]=q,e[66]=S,e[67]=f,e[68]=le):le=e[68],le}function HR(t){return!t}const KR=Rt({content:Re().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:_r(["pending","in_progress","completed"]),activeForm:Re().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),A7=Rt({todos:Ws(KR)}),WR="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.";sA({description:WR,inputSchema:nA(A7),execute:async({todos:t})=>({ok:!0,count:t.length})});const qR="tool-todo_write",GR=new Set(["input-available","output-available"]);function YR(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!==qR||typeof r.state!="string"||!GR.has(r.state))continue;const l=A7.safeParse(r.input);if(l.success)return l.data.todos}}return[]}function P7(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:Wl(JT(n)),input:s.input})}return e}function E7(t){return t.at(-1)}function R7(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 JR(t){return t?t.message.startsWith("[CREDITS]"):!1}const QR="[SUBSCRIPTION_REQUIRED]";function D7(t){return t?.message.startsWith(QR)?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 XR={isCreditExhausted:!1,subscriptionErrorKind:null,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1,todos:[]};function ZR(t){const{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=t;if(!i&&s&&JR(s))return{...XR,isCreditExhausted:!0};const l=e.at(-1),a=l?.role==="assistant"?l.parts:[],c=a,h=!!c.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,u=R7(a),f=P7(c),p=YR(e),m=i?null:D7(s),g=!i&&!!s&&!m,x=f.length>0||i&&r,b=u.length>0,_=!i&&!!n&&n!=="stop"&&!(n==="tool-calls"&&(h||x||b))&&!g;return{isCreditExhausted:!1,subscriptionErrorKind:m,hasTodos:p.length>0,showError:g,showWarning:_,hasApprovals:x,hasPlans:b,isWaitingForUserInput:h,todos:p}}function I7(){const t=z.c(6),{messages:e,error:s,finishReason:n,isStreaming:i,isWaitingForApprovals:r}=gi(),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=ZR({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 eD(){const t=I7();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 M7(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 tD="__home__";function Kg(t,e){return W2.chatDraft(t,e)}function sD(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 O7(t,e,s,n,i){const r=Kg(e,s);if(M7(n)){t.removeItem(r);return}const l={tiptapDoc:n,updatedAt:Date.now()},a=JSON.stringify(l);try{t.setItem(r,a)}catch(c){if(iD(c)){const d=new TextEncoder().encode(a).byteLength;i?.onQuotaExceeded?.({docSizeBytes:d});return}throw c}}function j4(t,e,s){const n=Kg(e,s),i=t.getItem(n),r=sD(i);return i!==null&&r===null&&t.removeItem(n),r}function nD(t,e,s){t.removeItem(Kg(e,s))}function iD(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function En(t){const e=z.c(14),s=bs(t),n=xs(),i=s?.metadata,r=n?.activeTask,l=r?.metadata?.runtime;let a;e[0]!==l?(a=fA(l),e[0]=l,e[1]=a):a=e[1];const c=a,d=!!r&&!r.partial,h=r?.metadata;let u;e[2]!==i||e[3]!==h?(u=d8(h,i),e[2]=i,e[3]=h,e[4]=u):u=e[4];const f=!!c||d&&!!s;let p;e[5]!==i?(p=ig(i),e[5]=i,e[6]=p):p=e[6];let m;e[7]!==i?(m=rg(i),e[7]=i,e[8]=m):m=e[8];let g;return e[9]!==u||e[10]!==f||e[11]!==p||e[12]!==m?(g={runtime:u,resolved:f,projectDefault:p,previewServerUrl:m},e[9]=u,e[10]=f,e[11]=p,e[12]=m,e[13]=g):g=e[13],g}function rD(t){return(t??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"user"}function D9(t){return t?.name||t?.email?.split("@")[0]||void 0}function Yl(t){const e=rD(t),s=Date.now().toString(36).split("").reverse().join("");return`${e}-${s}`}function $7(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 Wg(t){const e=$7(t);if(e)throw new Error(e)}function oD(t){try{return JSON.parse(t)}catch{return null}}function lD(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(r=>r.type==="text")?.text,n=s?oD(s):null,i=e.structuredContent;return i==null?n:typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length===0?n??i:i}function y0(t){const e=lD(t);return e===null?null:e}function B7(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 aD(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=B7(s);return!n||!s?null:{number:n,htmlUrl:s}}function C4(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const N4=/[\r\n<>]/,cD=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function _0(t){const e=t?.userName?.trim();if(!e||N4.test(e))return null;const s=t?.userEmail?.trim();return!s||N4.test(s)?{userName:e}:cD.test(s)?{userName:e,userEmail:s}:{userName:e}}function dD(t){return t.split(`
3
3
  `).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
4
4
  `).trimEnd()}function uD(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function z7(t,e){const s=_0(e);if(!s)return t;const n=dD(t),i=uD(s);if(n.includes(i))return n;const r=n.trimEnd();return r.length>0?`${r}
5
5
 
@@ -14,7 +14,7 @@ ${oe}`:oe;f.setValue("metadata.instructions",ee,{shouldDirty:!0})},se=new Set(p.
14
14
  To pick up a draggable item, press the space bar.
15
15
  While dragging, use the arrow keys to move the item.
16
16
  Press space again to drop the item in its new position, or press escape to cancel.
17
- `},hH={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:s}=t;return s?"Draggable item "+e.id+" was moved over droppable area "+s.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:s}=t;return s?"Draggable item "+e.id+" was dropped over droppable area "+s.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function fH(t){let{announcements:e=hH,container:s,hiddenTextDescribedById:n,screenReaderInstructions:i=uH}=t;const{announce:r,announcement:l}=aH(),a=N0("DndLiveRegion"),[c,d]=P.useState(!1);if(P.useEffect(()=>{d(!0)},[]),cH(P.useMemo(()=>({onDragStart(u){let{active:f}=u;r(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:p}=u;e.onDragMove&&r(e.onDragMove({active:f,over:p}))},onDragOver(u){let{active:f,over:p}=u;r(e.onDragOver({active:f,over:p}))},onDragEnd(u){let{active:f,over:p}=u;r(e.onDragEnd({active:f,over:p}))},onDragCancel(u){let{active:f,over:p}=u;r(e.onDragCancel({active:f,over:p}))}}),[r,e])),!c)return null;const h=Nt.createElement(Nt.Fragment,null,Nt.createElement(oH,{id:n,value:i.draggable}),Nt.createElement(lH,{id:a,announcement:l}));return s?kn.createPortal(h,s):h}var Us;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Us||(Us={}));function yf(){}function vr(t,e){return P.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function T0(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return P.useMemo(()=>[...e].filter(n=>n!=null),[...e])}const Di=Object.freeze({x:0,y:0});function FL(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function mH(t,e){const s=vf(t);if(!s)return"0 0";const n={x:(s.x-e.left)/e.width*100,y:(s.y-e.top)/e.height*100};return n.x+"% "+n.y+"%"}function UL(t,e){let{data:{value:s}}=t,{data:{value:n}}=e;return s-n}function pH(t,e){let{data:{value:s}}=t,{data:{value:n}}=e;return n-s}function R5(t){let{left:e,top:s,height:n,width:i}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e,y:s+n},{x:e+i,y:s+n}]}function HL(t,e){if(!t||t.length===0)return null;const[s]=t;return s[e]}function D5(t,e,s){return e===void 0&&(e=t.left),s===void 0&&(s=t.top),{x:e+t.width*.5,y:s+t.height*.5}}const A3=t=>{let{collisionRect:e,droppableRects:s,droppableContainers:n}=t;const i=D5(e,e.left,e.top),r=[];for(const l of n){const{id:a}=l,c=s.get(a);if(c){const d=FL(D5(c),i);r.push({id:a,data:{droppableContainer:l,value:d}})}}return r.sort(UL)},KL=t=>{let{collisionRect:e,droppableRects:s,droppableContainers:n}=t;const i=R5(e),r=[];for(const l of n){const{id:a}=l,c=s.get(a);if(c){const d=R5(c),h=i.reduce((f,p,m)=>f+FL(d[m],p),0),u=Number((h/4).toFixed(4));r.push({id:a,data:{droppableContainer:l,value:u}})}}return r.sort(UL)};function gH(t,e){const s=Math.max(e.top,t.top),n=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),r=Math.min(e.top+e.height,t.top+t.height),l=i-n,a=r-s;if(n<i&&s<r){const c=e.width*e.height,d=t.width*t.height,h=l*a,u=h/(c+d-h);return Number(u.toFixed(4))}return 0}const xH=t=>{let{collisionRect:e,droppableRects:s,droppableContainers:n}=t;const i=[];for(const r of n){const{id:l}=r,a=s.get(l);if(a){const c=gH(a,e);c>0&&i.push({id:l,data:{droppableContainer:r,value:c}})}}return i.sort(pH)};function bH(t,e,s){return{...t,scaleX:e&&s?e.width/s.width:1,scaleY:e&&s?e.height/s.height:1}}function WL(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Di}function vH(t){return function(s){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return i.reduce((l,a)=>({...l,top:l.top+t*a.y,bottom:l.bottom+t*a.y,left:l.left+t*a.x,right:l.right+t*a.x}),{...s})}}const yH=vH(1);function qL(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function _H(t,e,s){const n=qL(e);if(!n)return t;const{scaleX:i,scaleY:r,x:l,y:a}=n,c=t.left-l-(1-i)*parseFloat(s),d=t.top-a-(1-r)*parseFloat(s.slice(s.indexOf(" ")+1)),h=i?t.width/i:t.width,u=r?t.height/r:t.height;return{width:h,height:u,top:d,right:c+h,bottom:d+u,left:c}}const LH={ignoreTransform:!1};function wd(t,e){e===void 0&&(e=LH);let s=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:h}=Rn(t).getComputedStyle(t);d&&(s=_H(s,d,h))}const{top:n,left:i,width:r,height:l,bottom:a,right:c}=s;return{top:n,left:i,width:r,height:l,bottom:a,right:c}}function I5(t){return wd(t,{ignoreTransform:!0})}function wH(t){const e=t.innerWidth,s=t.innerHeight;return{top:0,left:0,right:e,bottom:s,width:e,height:s}}function SH(t,e){return e===void 0&&(e=Rn(t).getComputedStyle(t)),e.position==="fixed"}function kH(t,e){e===void 0&&(e=Rn(t).getComputedStyle(t));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const r=e[i];return typeof r=="string"?s.test(r):!1})}function G9(t,e){const s=[];function n(i){if(e!=null&&s.length>=e||!i)return s;if(V3(i)&&i.scrollingElement!=null&&!s.includes(i.scrollingElement))return s.push(i.scrollingElement),s;if(!j0(i)||$L(i)||s.includes(i))return s;const r=Rn(t).getComputedStyle(i);return i!==t&&kH(i,r)&&s.push(i),SH(i,r)?s:n(i.parentNode)}return t?n(t):s}function GL(t){const[e]=G9(t,1);return e??null}function Q1(t){return!K9||!t?null:_d(t)?t:T3(t)?V3(t)||t===Ld(t).scrollingElement?window:j0(t)?t:null:null}function YL(t){return _d(t)?t.scrollX:t.scrollLeft}function JL(t){return _d(t)?t.scrollY:t.scrollTop}function _p(t){return{x:YL(t),y:JL(t)}}var Zs;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Zs||(Zs={}));function QL(t){return!K9||!t?!1:t===document.scrollingElement}function XL(t){const e={x:0,y:0},s=QL(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},n={x:t.scrollWidth-s.width,y:t.scrollHeight-s.height},i=t.scrollTop<=e.y,r=t.scrollLeft<=e.x,l=t.scrollTop>=n.y,a=t.scrollLeft>=n.x;return{isTop:i,isLeft:r,isBottom:l,isRight:a,maxScroll:n,minScroll:e}}const jH={x:.2,y:.2};function CH(t,e,s,n,i){let{top:r,left:l,right:a,bottom:c}=s;n===void 0&&(n=10),i===void 0&&(i=jH);const{isTop:d,isBottom:h,isLeft:u,isRight:f}=XL(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*i.y,width:e.width*i.x};return!d&&r<=e.top+g.height?(p.y=Zs.Backward,m.y=n*Math.abs((e.top+g.height-r)/g.height)):!h&&c>=e.bottom-g.height&&(p.y=Zs.Forward,m.y=n*Math.abs((e.bottom-g.height-c)/g.height)),!f&&a>=e.right-g.width?(p.x=Zs.Forward,m.x=n*Math.abs((e.right-g.width-a)/g.width)):!u&&l<=e.left+g.width&&(p.x=Zs.Backward,m.x=n*Math.abs((e.left+g.width-l)/g.width)),{direction:p,speed:m}}function NH(t){if(t===document.scrollingElement){const{innerWidth:r,innerHeight:l}=window;return{top:0,left:0,right:r,bottom:l,width:r,height:l}}const{top:e,left:s,right:n,bottom:i}=t.getBoundingClientRect();return{top:e,left:s,right:n,bottom:i,width:t.clientWidth,height:t.clientHeight}}function ZL(t){return t.reduce((e,s)=>zc(e,_p(s)),Di)}function TH(t){return t.reduce((e,s)=>e+YL(s),0)}function VH(t){return t.reduce((e,s)=>e+JL(s),0)}function ew(t,e){if(e===void 0&&(e=wd),!t)return;const{top:s,left:n,bottom:i,right:r}=e(t);GL(t)&&(i<=0||r<=0||s>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const AH=[["x",["left","right"],TH],["y",["top","bottom"],VH]];class P3{constructor(e,s){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=G9(s),i=ZL(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[r,l,a]of AH)for(const c of l)Object.defineProperty(this,c,{get:()=>{const d=a(n),h=i[r]-d;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vu{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...s)})},this.target=e}add(e,s,n){var i;(i=this.target)==null||i.addEventListener(e,s,n),this.listeners.push([e,s,n])}}function PH(t){const{EventTarget:e}=Rn(t);return t instanceof e?t:Ld(t)}function X1(t,e){const s=Math.abs(t.x),n=Math.abs(t.y);return typeof e=="number"?Math.sqrt(s**2+n**2)>e:"x"in e&&"y"in e?s>e.x&&n>e.y:"x"in e?s>e.x:"y"in e?n>e.y:!1}var ri;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(ri||(ri={}));function M5(t){t.preventDefault()}function EH(t){t.stopPropagation()}var Et;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Et||(Et={}));const tw={start:[Et.Space,Et.Enter],cancel:[Et.Esc],end:[Et.Space,Et.Enter,Et.Tab]},RH=(t,e)=>{let{currentCoordinates:s}=e;switch(t.code){case Et.Right:return{...s,x:s.x+25};case Et.Left:return{...s,x:s.x-25};case Et.Down:return{...s,y:s.y+25};case Et.Up:return{...s,y:s.y-25}}};class La{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:s}}=e;this.props=e,this.listeners=new vu(Ld(s)),this.windowListeners=new vu(Rn(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ri.Resize,this.handleCancel),this.windowListeners.add(ri.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ri.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:s}=this.props,n=e.node.current;n&&ew(n),s(Di)}handleKeyDown(e){if(q9(e)){const{active:s,context:n,options:i}=this.props,{keyboardCodes:r=tw,coordinateGetter:l=RH,scrollBehavior:a="smooth"}=i,{code:c}=e;if(r.end.includes(c)){this.handleEnd(e);return}if(r.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:d}=n.current,h=d?{x:d.left,y:d.top}:Di;this.referenceCoordinates||(this.referenceCoordinates=h);const u=l(e,{active:s,context:n.current,currentCoordinates:h});if(u){const f=Gu(u,h),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(const g of m){const x=e.code,{isTop:b,isRight:y,isLeft:_,isBottom:v,maxScroll:L,minScroll:S}=XL(g),w=NH(g),k={x:Math.min(x===Et.Right?w.right-w.width/2:w.right,Math.max(x===Et.Right?w.left:w.left+w.width/2,u.x)),y:Math.min(x===Et.Down?w.bottom-w.height/2:w.bottom,Math.max(x===Et.Down?w.top:w.top+w.height/2,u.y))},j=x===Et.Right&&!y||x===Et.Left&&!_,C=x===Et.Down&&!v||x===Et.Up&&!b;if(j&&k.x!==u.x){const N=g.scrollLeft+f.x,T=x===Et.Right&&N<=L.x||x===Et.Left&&N>=S.x;if(T&&!f.y){g.scrollTo({left:N,behavior:a});return}T?p.x=g.scrollLeft-N:p.x=x===Et.Right?g.scrollLeft-L.x:g.scrollLeft-S.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(C&&k.y!==u.y){const N=g.scrollTop+f.y,T=x===Et.Down&&N<=L.y||x===Et.Up&&N>=S.y;if(T&&!f.x){g.scrollTo({top:N,behavior:a});return}T?p.y=g.scrollTop-N:p.y=x===Et.Down?g.scrollTop-L.y:g.scrollTop-S.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,zc(Gu(u,this.referenceCoordinates),p))}}}handleMove(e,s){const{onMove:n}=this.props;e.preventDefault(),n(s)}handleEnd(e){const{onEnd:s}=this.props;e.preventDefault(),this.detach(),s()}handleCancel(e){const{onCancel:s}=this.props;e.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}La.activators=[{eventName:"onKeyDown",handler:(t,e,s)=>{let{keyboardCodes:n=tw,onActivation:i}=e,{active:r}=s;const{code:l}=t.nativeEvent;if(n.start.includes(l)){const a=r.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),i?.({event:t.nativeEvent}),!0)}return!1}}];function O5(t){return!!(t&&"distance"in t)}function $5(t){return!!(t&&"delay"in t)}class E3{constructor(e,s,n){var i;n===void 0&&(n=PH(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=s;const{event:r}=e,{target:l}=r;this.props=e,this.events=s,this.document=Ld(l),this.documentListeners=new vu(this.document),this.listeners=new vu(n),this.windowListeners=new vu(Rn(l)),this.initialCoordinates=(i=vf(r))!=null?i:Di,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:s,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(ri.Resize,this.handleCancel),this.windowListeners.add(ri.DragStart,M5),this.windowListeners.add(ri.VisibilityChange,this.handleCancel),this.windowListeners.add(ri.ContextMenu,M5),this.documentListeners.add(ri.Keydown,this.handleKeydown),s){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($5(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(O5(s)){this.handlePending(s);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,s){const{active:n,onPending:i}=this.props;i(n,e,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:e}=this,{onStart:s}=this.props;e&&(this.activated=!0,this.documentListeners.add(ri.Click,EH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ri.SelectionChange,this.removeTextSelection),s(e))}handleMove(e){var s;const{activated:n,initialCoordinates:i,props:r}=this,{onMove:l,options:{activationConstraint:a}}=r;if(!i)return;const c=(s=vf(e))!=null?s:Di,d=Gu(i,c);if(!n&&a){if(O5(a)){if(a.tolerance!=null&&X1(d,a.tolerance))return this.handleCancel();if(X1(d,a.distance))return this.handleStart()}if($5(a)&&X1(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}e.cancelable&&e.preventDefault(),l(c)}handleEnd(){const{onAbort:e,onEnd:s}=this.props;this.detach(),this.activated||e(this.props.active),s()}handleCancel(){const{onAbort:e,onCancel:s}=this.props;this.detach(),this.activated||e(this.props.active),s()}handleKeydown(e){e.code===Et.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const DH={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class wa extends E3{constructor(e){const{event:s}=e,n=Ld(s.target);super(e,DH,n)}}wa.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:n}=e;return!s.isPrimary||s.button!==0?!1:(n?.({event:s}),!0)}}];const IH={move:{name:"mousemove"},end:{name:"mouseup"}};var Lp;(function(t){t[t.RightClick=2]="RightClick"})(Lp||(Lp={}));class MH extends E3{constructor(e){super(e,IH,Ld(e.event.target))}}MH.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:n}=e;return s.button===Lp.RightClick?!1:(n?.({event:s}),!0)}}];const Z1={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class OH extends E3{constructor(e){super(e,Z1)}static setup(){return window.addEventListener(Z1.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Z1.move.name,e)};function e(){}}}OH.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:n}=e;const{touches:i}=s;return i.length>1?!1:(n?.({event:s}),!0)}}];var yu;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(yu||(yu={}));var _f;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(_f||(_f={}));function $H(t){let{acceleration:e,activator:s=yu.Pointer,canScroll:n,draggingRect:i,enabled:r,interval:l=5,order:a=_f.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:h,delta:u,threshold:f}=t;const p=zH({delta:u,disabled:!r}),[m,g]=tH(),x=P.useRef({x:0,y:0}),b=P.useRef({x:0,y:0}),y=P.useMemo(()=>{switch(s){case yu.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case yu.DraggableRect:return i}},[s,i,c]),_=P.useRef(null),v=P.useCallback(()=>{const S=_.current;if(!S)return;const w=x.current.x*b.current.x,k=x.current.y*b.current.y;S.scrollBy(w,k)},[]),L=P.useMemo(()=>a===_f.TreeOrder?[...d].reverse():d,[a,d]);P.useEffect(()=>{if(!r||!d.length||!y){g();return}for(const S of L){if(n?.(S)===!1)continue;const w=d.indexOf(S),k=h[w];if(!k)continue;const{direction:j,speed:C}=CH(S,k,y,e,f);for(const N of["x","y"])p[N][j[N]]||(C[N]=0,j[N]=0);if(C.x>0||C.y>0){g(),_.current=S,m(v,l),x.current=C,b.current=j;return}}x.current={x:0,y:0},b.current={x:0,y:0},g()},[e,v,n,g,r,l,JSON.stringify(y),JSON.stringify(p),m,d,L,h,JSON.stringify(f)])}const BH={x:{[Zs.Backward]:!1,[Zs.Forward]:!1},y:{[Zs.Backward]:!1,[Zs.Forward]:!1}};function zH(t){let{delta:e,disabled:s}=t;const n=bf(e);return C0(i=>{if(s||!n||!i)return BH;const r={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Zs.Backward]:i.x[Zs.Backward]||r.x===-1,[Zs.Forward]:i.x[Zs.Forward]||r.x===1},y:{[Zs.Backward]:i.y[Zs.Backward]||r.y===-1,[Zs.Forward]:i.y[Zs.Forward]||r.y===1}}},[s,e,n])}function FH(t,e){const s=e!=null?t.get(e):void 0,n=s?s.node.current:null;return C0(i=>{var r;return e==null?null:(r=n??i)!=null?r:null},[n,e])}function UH(t,e){return P.useMemo(()=>t.reduce((s,n)=>{const{sensor:i}=n,r=i.activators.map(l=>({eventName:l.eventName,handler:e(l.handler,n)}));return[...s,...r]},[]),[t,e])}var Yu;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Yu||(Yu={}));var wp;(function(t){t.Optimized="optimized"})(wp||(wp={}));const B5=new Map;function HH(t,e){let{dragging:s,dependencies:n,config:i}=e;const[r,l]=P.useState(null),{frequency:a,measure:c,strategy:d}=i,h=P.useRef(t),u=x(),f=qu(u),p=P.useCallback(function(b){b===void 0&&(b=[]),!f.current&&l(y=>y===null?b:y.concat(b.filter(_=>!y.includes(_))))},[f]),m=P.useRef(null),g=C0(b=>{if(u&&!s)return B5;if(!b||b===B5||h.current!==t||r!=null){const y=new Map;for(let _ of t){if(!_)continue;if(r&&r.length>0&&!r.includes(_.id)&&_.rect.current){y.set(_.id,_.rect.current);continue}const v=_.node.current,L=v?new P3(c(v),v):null;_.rect.current=L,L&&y.set(_.id,L)}return y}return b},[t,r,s,u,c]);return P.useEffect(()=>{h.current=t},[t]),P.useEffect(()=>{u||p()},[s,u]),P.useEffect(()=>{r&&r.length>0&&l(null)},[JSON.stringify(r)]),P.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,u,p,...n]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:r!=null};function x(){switch(d){case Yu.Always:return!1;case Yu.BeforeDragging:return s;default:return!s}}}function R3(t,e){return C0(s=>t?s||(typeof e=="function"?e(t):t):null,[e,t])}function KH(t,e){return R3(t,e)}function WH(t){let{callback:e,disabled:s}=t;const n=W9(e),i=P.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:r}=window;return new r(n)},[n,s]);return P.useEffect(()=>()=>i?.disconnect(),[i]),i}function Y9(t){let{callback:e,disabled:s}=t;const n=W9(e),i=P.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:r}=window;return new r(n)},[s]);return P.useEffect(()=>()=>i?.disconnect(),[i]),i}function qH(t){return new P3(wd(t),t)}function z5(t,e,s){e===void 0&&(e=qH);const[n,i]=P.useState(null);function r(){i(c=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=c??s)!=null?d:null}const h=e(t);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const l=WH({callback(c){if(t)for(const d of c){const{type:h,target:u}=d;if(h==="childList"&&u instanceof HTMLElement&&u.contains(t)){r();break}}}}),a=Y9({callback:r});return Ei(()=>{r(),t?(a?.observe(t),l?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),l?.disconnect())},[t]),n}function GH(t){const e=R3(t);return WL(t,e)}const F5=[];function YH(t){const e=P.useRef(t),s=C0(n=>t?n&&n!==F5&&t&&e.current&&t.parentNode===e.current.parentNode?n:G9(t):F5,[t]);return P.useEffect(()=>{e.current=t},[t]),s}function JH(t){const[e,s]=P.useState(null),n=P.useRef(t),i=P.useCallback(r=>{const l=Q1(r.target);l&&s(a=>a?(a.set(l,_p(l)),new Map(a)):null)},[]);return P.useEffect(()=>{const r=n.current;if(t!==r){l(r);const a=t.map(c=>{const d=Q1(c);return d?(d.addEventListener("scroll",i,{passive:!0}),[d,_p(d)]):null}).filter(c=>c!=null);s(a.length?new Map(a):null),n.current=t}return()=>{l(t),l(r)};function l(a){a.forEach(c=>{const d=Q1(c);d?.removeEventListener("scroll",i)})}},[i,t]),P.useMemo(()=>t.length?e?Array.from(e.values()).reduce((r,l)=>zc(r,l),Di):ZL(t):Di,[t,e])}function U5(t,e){e===void 0&&(e=[]);const s=P.useRef(null);return P.useEffect(()=>{s.current=null},e),P.useEffect(()=>{const n=t!==Di;n&&!s.current&&(s.current=t),!n&&s.current&&(s.current=null)},[t]),s.current?Gu(t,s.current):Di}function QH(t){P.useEffect(()=>{if(!K9)return;const e=t.map(s=>{let{sensor:n}=s;return n.setup==null?void 0:n.setup()});return()=>{for(const s of e)s?.()}},t.map(e=>{let{sensor:s}=e;return s}))}function XH(t,e){return P.useMemo(()=>t.reduce((s,n)=>{let{eventName:i,handler:r}=n;return s[i]=l=>{r(l,e)},s},{}),[t,e])}function sw(t){return P.useMemo(()=>t?wH(t):null,[t])}const H5=[];function ZH(t,e){e===void 0&&(e=wd);const[s]=t,n=sw(s?Rn(s):null),[i,r]=P.useState(H5);function l(){r(()=>t.length?t.map(c=>QL(c)?n:new P3(e(c),c)):H5)}const a=Y9({callback:l});return Ei(()=>{a?.disconnect(),l(),t.forEach(c=>a?.observe(c))},[t]),i}function nw(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return j0(e)?e:t}function eK(t){let{measure:e}=t;const[s,n]=P.useState(null),i=P.useCallback(d=>{for(const{target:h}of d)if(j0(h)){n(u=>{const f=e(h);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),r=Y9({callback:i}),l=P.useCallback(d=>{const h=nw(d);r?.disconnect(),h&&r?.observe(h),n(h?e(h):null)},[e,r]),[a,c]=xf(l);return P.useMemo(()=>({nodeRef:a,rect:s,setRef:c}),[s,a,c])}const tK=[{sensor:wa,options:{}},{sensor:La,options:{}}],sK={current:{}},Bh={draggable:{measure:I5},droppable:{measure:I5,strategy:Yu.WhileDragging,frequency:wp.Optimized},dragOverlay:{measure:wd}};class _u extends Map{get(e){var s;return e!=null&&(s=super.get(e))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:s}=e;return!s})}getNodeFor(e){var s,n;return(s=(n=this.get(e))==null?void 0:n.node.current)!=null?s:void 0}}const nK={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _u,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Bh,measureDroppableContainers:yf,windowRect:null,measuringScheduled:!1},iw={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yf,draggableNodes:new Map,over:null,measureDroppableContainers:yf},V0=P.createContext(iw),rw=P.createContext(nK);function iK(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _u}}}function rK(t,e){switch(e.type){case Us.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Us.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Us.DragEnd:case Us.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Us.RegisterDroppable:{const{element:s}=e,{id:n}=s,i=new _u(t.droppable.containers);return i.set(n,s),{...t,droppable:{...t.droppable,containers:i}}}case Us.SetDroppableDisabled:{const{id:s,key:n,disabled:i}=e,r=t.droppable.containers.get(s);if(!r||n!==r.key)return t;const l=new _u(t.droppable.containers);return l.set(s,{...r,disabled:i}),{...t,droppable:{...t.droppable,containers:l}}}case Us.UnregisterDroppable:{const{id:s,key:n}=e,i=t.droppable.containers.get(s);if(!i||n!==i.key)return t;const r=new _u(t.droppable.containers);return r.delete(s),{...t,droppable:{...t.droppable,containers:r}}}default:return t}}function oK(t){let{disabled:e}=t;const{active:s,activatorEvent:n,draggableNodes:i}=P.useContext(V0),r=bf(n),l=bf(s?.id);return P.useEffect(()=>{if(!e&&!n&&r&&l!=null){if(!q9(r)||document.activeElement===r.target)return;const a=i.get(l);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[c.current,d.current]){if(!h)continue;const u=iH(h);if(u){u.focus();break}}})}},[n,e,i,l,r]),null}function ow(t,e){let{transform:s,...n}=e;return t!=null&&t.length?t.reduce((i,r)=>r({transform:i,...n}),s):s}function lK(t){return P.useMemo(()=>({draggable:{...Bh.draggable,...t?.draggable},droppable:{...Bh.droppable,...t?.droppable},dragOverlay:{...Bh.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function aK(t){let{activeNode:e,measure:s,initialRect:n,config:i=!0}=t;const r=P.useRef(!1),{x:l,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Ei(()=>{if(!l&&!a||!e){r.current=!1;return}if(r.current||!n)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const h=s(d),u=WL(h,n);if(l||(u.x=0),a||(u.y=0),r.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=GL(d);f&&f.scrollBy({top:u.y,left:u.x})}},[e,l,a,n,s])}const J9=P.createContext({...Di,scaleX:1,scaleY:1});var qo;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(qo||(qo={}));const A0=P.memo(function(e){var s,n,i,r;let{id:l,accessibility:a,autoScroll:c=!0,children:d,sensors:h=tK,collisionDetection:u=xH,measuring:f,modifiers:p,...m}=e;const g=P.useReducer(rK,void 0,iK),[x,b]=g,[y,_]=dH(),[v,L]=P.useState(qo.Uninitialized),S=v===qo.Initialized,{draggable:{active:w,nodes:k,translate:j},droppable:{containers:C}}=x,N=w!=null?k.get(w):null,T=P.useRef({initial:null,translated:null}),V=P.useMemo(()=>{var st;return w!=null?{id:w,data:(st=N?.data)!=null?st:sK,rect:T}:null},[w,N]),A=P.useRef(null),[E,R]=P.useState(null),[D,I]=P.useState(null),O=qu(m,Object.values(m)),F=N0("DndDescribedBy",l),M=P.useMemo(()=>C.getEnabled(),[C]),$=lK(f),{droppableRects:B,measureDroppableContainers:U,measuringScheduled:H}=HH(M,{dragging:S,dependencies:[j.x,j.y],config:$.droppable}),W=FH(k,w),K=P.useMemo(()=>D?vf(D):null,[D]),G=ot(),Y=KH(W,$.draggable.measure);aK({activeNode:w!=null?k.get(w):null,config:G.layoutShiftCompensation,initialRect:Y,measure:$.draggable.measure});const X=z5(W,$.draggable.measure,Y),te=z5(W?W.parentElement:null),se=P.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:C,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=C.getNodeFor((s=se.current.over)==null?void 0:s.id),Q=eK({measure:$.dragOverlay.measure}),q=(n=Q.nodeRef.current)!=null?n:W,le=S?(i=Q.rect)!=null?i:X:null,J=!!(Q.nodeRef.current&&Q.rect),oe=GH(J?null:X),ee=sw(q?Rn(q):null),he=YH(S?ne??W:null),ae=ZH(he),de=ow(p,{transform:{x:j.x-oe.x,y:j.y-oe.y,scaleX:1,scaleY:1},activatorEvent:D,active:V,activeNodeRect:X,containerNodeRect:te,draggingNodeRect:le,over:se.current.over,overlayNodeRect:Q.rect,scrollableAncestors:he,scrollableAncestorRects:ae,windowRect:ee}),ue=K?zc(K,j):null,pe=JH(he),Z=U5(pe),ge=U5(pe,[X]),be=zc(de,Z),ke=le?yH(le,de):null,we=V&&ke?u({active:V,collisionRect:ke,droppableRects:B,droppableContainers:M,pointerCoordinates:ue}):null,Le=HL(we,"id"),[_e,Ce]=P.useState(null),xe=J?de:zc(de,ge),Ne=bH(xe,(r=_e?.rect)!=null?r:null,X),Te=P.useRef(null),Me=P.useCallback((st,Ze)=>{let{sensor:lt,options:_t}=Ze;if(A.current==null)return;const it=k.get(A.current);if(!it)return;const at=st.nativeEvent,Ie=new lt({active:A.current,activeNode:it,event:at,options:_t,context:se,onAbort(fe){if(!k.get(fe))return;const{onDragAbort:tt}=O.current,ht={id:fe};tt?.(ht),y({type:"onDragAbort",event:ht})},onPending(fe,Oe,tt,ht){if(!k.get(fe))return;const{onDragPending:Vt}=O.current,rt={id:fe,constraint:Oe,initialCoordinates:tt,offset:ht};Vt?.(rt),y({type:"onDragPending",event:rt})},onStart(fe){const Oe=A.current;if(Oe==null)return;const tt=k.get(Oe);if(!tt)return;const{onDragStart:ht}=O.current,dt={activatorEvent:at,active:{id:Oe,data:tt.data,rect:T}};kn.unstable_batchedUpdates(()=>{ht?.(dt),L(qo.Initializing),b({type:Us.DragStart,initialCoordinates:fe,active:Oe}),y({type:"onDragStart",event:dt}),R(Te.current),I(at)})},onMove(fe){b({type:Us.DragMove,coordinates:fe})},onEnd:xt(Us.DragEnd),onCancel:xt(Us.DragCancel)});Te.current=Ie;function xt(fe){return async function(){const{active:tt,collisions:ht,over:dt,scrollAdjustedTranslate:Vt}=se.current;let rt=null;if(tt&&Vt){const{cancelDrop:bt}=O.current;rt={activatorEvent:at,active:tt,collisions:ht,delta:Vt,over:dt},fe===Us.DragEnd&&typeof bt=="function"&&await Promise.resolve(bt(rt))&&(fe=Us.DragCancel)}A.current=null,kn.unstable_batchedUpdates(()=>{b({type:fe}),L(qo.Uninitialized),Ce(null),R(null),I(null),Te.current=null;const bt=fe===Us.DragEnd?"onDragEnd":"onDragCancel";if(rt){const et=O.current[bt];et?.(rt),y({type:bt,event:rt})}})}}},[k]),Qe=P.useCallback((st,Ze)=>(lt,_t)=>{const it=lt.nativeEvent,at=k.get(_t);if(A.current!==null||!at||it.dndKit||it.defaultPrevented)return;const Ie={active:at};st(lt,Ze.options,Ie)===!0&&(it.dndKit={capturedBy:Ze.sensor},A.current=_t,Me(lt,Ze))},[k,Me]),We=UH(h,Qe);QH(h),Ei(()=>{X&&v===qo.Initializing&&L(qo.Initialized)},[X,v]),P.useEffect(()=>{const{onDragMove:st}=O.current,{active:Ze,activatorEvent:lt,collisions:_t,over:it}=se.current;if(!Ze||!lt)return;const at={active:Ze,activatorEvent:lt,collisions:_t,delta:{x:be.x,y:be.y},over:it};kn.unstable_batchedUpdates(()=>{st?.(at),y({type:"onDragMove",event:at})})},[be.x,be.y]),P.useEffect(()=>{const{active:st,activatorEvent:Ze,collisions:lt,droppableContainers:_t,scrollAdjustedTranslate:it}=se.current;if(!st||A.current==null||!Ze||!it)return;const{onDragOver:at}=O.current,Ie=_t.get(Le),xt=Ie&&Ie.rect.current?{id:Ie.id,rect:Ie.rect.current,data:Ie.data,disabled:Ie.disabled}:null,fe={active:st,activatorEvent:Ze,collisions:lt,delta:{x:it.x,y:it.y},over:xt};kn.unstable_batchedUpdates(()=>{Ce(xt),at?.(fe),y({type:"onDragOver",event:fe})})},[Le]),Ei(()=>{se.current={activatorEvent:D,active:V,activeNode:W,collisionRect:ke,collisions:we,droppableRects:B,draggableNodes:k,draggingNode:q,draggingNodeRect:le,droppableContainers:C,over:_e,scrollableAncestors:he,scrollAdjustedTranslate:be},T.current={initial:le,translated:ke}},[V,W,we,ke,k,q,le,B,C,_e,he,be]),$H({...G,delta:j,draggingRect:ke,pointerCoordinates:ue,scrollableAncestors:he,scrollableAncestorRects:ae});const Ve=P.useMemo(()=>({active:V,activeNode:W,activeNodeRect:X,activatorEvent:D,collisions:we,containerNodeRect:te,dragOverlay:Q,draggableNodes:k,droppableContainers:C,droppableRects:B,over:_e,measureDroppableContainers:U,scrollableAncestors:he,scrollableAncestorRects:ae,measuringConfiguration:$,measuringScheduled:H,windowRect:ee}),[V,W,X,D,we,te,Q,k,C,B,_e,U,he,ae,$,H,ee]),De=P.useMemo(()=>({activatorEvent:D,activators:We,active:V,activeNodeRect:X,ariaDescribedById:{draggable:F},dispatch:b,draggableNodes:k,over:_e,measureDroppableContainers:U}),[D,We,V,X,b,F,k,_e,U]);return Nt.createElement(zL.Provider,{value:_},Nt.createElement(V0.Provider,{value:De},Nt.createElement(rw.Provider,{value:Ve},Nt.createElement(J9.Provider,{value:Ne},d)),Nt.createElement(oK,{disabled:a?.restoreFocus===!1})),Nt.createElement(fH,{...a,hiddenTextDescribedById:F}));function ot(){const st=E?.autoScrollEnabled===!1,Ze=typeof c=="object"?c.enabled===!1:c===!1,lt=S&&!st&&!Ze;return typeof c=="object"?{...c,enabled:lt}:{enabled:lt}}}),cK=P.createContext(null),K5="button",dK="Draggable";function lw(t){let{id:e,data:s,disabled:n=!1,attributes:i}=t;const r=N0(dK),{activators:l,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:u,over:f}=P.useContext(V0),{role:p=K5,roleDescription:m="draggable",tabIndex:g=0}=i??{},x=c?.id===e,b=P.useContext(x?J9:cK),[y,_]=xf(),[v,L]=xf(),S=XH(l,e),w=qu(s);Ei(()=>(u.set(e,{id:e,key:r,node:y,activatorNode:v,data:w}),()=>{const j=u.get(e);j&&j.key===r&&u.delete(e)}),[u,e]);const k=P.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":n,"aria-pressed":x&&p===K5?!0:void 0,"aria-roledescription":m,"aria-describedby":h.draggable}),[n,p,g,x,m,h.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:k,isDragging:x,listeners:n?void 0:S,node:y,over:f,setNodeRef:_,setActivatorNodeRef:L,transform:b}}function aw(){return P.useContext(rw)}const uK="Droppable",hK={timeout:25};function cw(t){let{data:e,disabled:s=!1,id:n,resizeObserverConfig:i}=t;const r=N0(uK),{active:l,dispatch:a,over:c,measureDroppableContainers:d}=P.useContext(V0),h=P.useRef({disabled:s}),u=P.useRef(!1),f=P.useRef(null),p=P.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:x}={...hK,...i},b=qu(g??n),y=P.useCallback(()=>{if(!u.current){u.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(b.current)?b.current:[b.current]),p.current=null},x)},[x]),_=Y9({callback:y,disabled:m||!l}),v=P.useCallback((k,j)=>{_&&(j&&(_.unobserve(j),u.current=!1),k&&_.observe(k))},[_]),[L,S]=xf(v),w=qu(e);return P.useEffect(()=>{!_||!L.current||(_.disconnect(),u.current=!1,_.observe(L.current))},[L,_]),P.useEffect(()=>(a({type:Us.RegisterDroppable,element:{id:n,key:r,disabled:s,node:L,rect:f,data:w}}),()=>a({type:Us.UnregisterDroppable,key:r,id:n})),[n]),P.useEffect(()=>{s!==h.current.disabled&&(a({type:Us.SetDroppableDisabled,id:n,key:r,disabled:s}),h.current.disabled=s)},[n,r,s,a]),{active:l,rect:f,isOver:c?.id===n,node:L,over:c,setNodeRef:S}}function fK(t){let{animation:e,children:s}=t;const[n,i]=P.useState(null),[r,l]=P.useState(null),a=bf(s);return!s&&!n&&a&&i(a),Ei(()=>{if(!r)return;const c=n?.key,d=n?.props.id;if(c==null||d==null){i(null);return}Promise.resolve(e(d,r)).then(()=>{i(null)})},[e,n,r]),Nt.createElement(Nt.Fragment,null,s,n?P.cloneElement(n,{ref:l}):null)}const mK={x:0,y:0,scaleX:1,scaleY:1};function pK(t){let{children:e}=t;return Nt.createElement(V0.Provider,{value:iw},Nt.createElement(J9.Provider,{value:mK},e))}const gK={position:"fixed",touchAction:"none"},xK=t=>q9(t)?"transform 250ms ease":void 0,bK=P.forwardRef((t,e)=>{let{as:s,activatorEvent:n,adjustScale:i,children:r,className:l,rect:a,style:c,transform:d,transition:h=xK}=t;if(!a)return null;const u=i?d:{...d,scaleX:1,scaleY:1},f={...gK,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ri.Transform.toString(u),transformOrigin:i&&n?mH(n,a):void 0,transition:typeof h=="function"?h(n):h,...c};return Nt.createElement(s,{className:l,style:f,ref:e},r)}),vK=t=>e=>{let{active:s,dragOverlay:n}=e;const i={},{styles:r,className:l}=t;if(r!=null&&r.active)for(const[a,c]of Object.entries(r.active))c!==void 0&&(i[a]=s.node.style.getPropertyValue(a),s.node.style.setProperty(a,c));if(r!=null&&r.dragOverlay)for(const[a,c]of Object.entries(r.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return l!=null&&l.active&&s.node.classList.add(l.active),l!=null&&l.dragOverlay&&n.node.classList.add(l.dragOverlay),function(){for(const[c,d]of Object.entries(i))s.node.style.setProperty(c,d);l!=null&&l.active&&s.node.classList.remove(l.active)}},yK=t=>{let{transform:{initial:e,final:s}}=t;return[{transform:Ri.Transform.toString(e)},{transform:Ri.Transform.toString(s)}]},_K={duration:250,easing:"ease",keyframes:yK,sideEffects:vK({styles:{active:{opacity:"0"}}})};function LK(t){let{config:e,draggableNodes:s,droppableContainers:n,measuringConfiguration:i}=t;return W9((r,l)=>{if(e===null)return;const a=s.get(r);if(!a)return;const c=a.node.current;if(!c)return;const d=nw(l);if(!d)return;const{transform:h}=Rn(l).getComputedStyle(l),u=qL(h);if(!u)return;const f=typeof e=="function"?e:wK(e);return ew(c,i.draggable.measure),f({active:{id:r,data:a.data,node:c,rect:i.draggable.measure(c)},draggableNodes:s,dragOverlay:{node:l,rect:i.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:i,transform:u})})}function wK(t){const{duration:e,easing:s,sideEffects:n,keyframes:i}={..._K,...t};return r=>{let{active:l,dragOverlay:a,transform:c,...d}=r;if(!e)return;const h={x:a.rect.left-l.rect.left,y:a.rect.top-l.rect.top},u={scaleX:c.scaleX!==1?l.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?l.rect.height*c.scaleY/a.rect.height:1},f={x:c.x-h.x,y:c.y-h.y,...u},p=i({...d,active:l,dragOverlay:a,transform:{initial:c,final:f}}),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const x=n?.({active:l,dragOverlay:a,...d}),b=a.node.animate(p,{duration:e,easing:s,fill:"forwards"});return new Promise(y=>{b.onfinish=()=>{x?.(),y()}})}}let W5=0;function SK(t){return P.useMemo(()=>{if(t!=null)return W5++,W5},[t])}const Q9=Nt.memo(t=>{let{adjustScale:e=!1,children:s,dropAnimation:n,style:i,transition:r,modifiers:l,wrapperElement:a="div",className:c,zIndex:d=999}=t;const{activatorEvent:h,active:u,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:x,over:b,measuringConfiguration:y,scrollableAncestors:_,scrollableAncestorRects:v,windowRect:L}=aw(),S=P.useContext(J9),w=SK(u?.id),k=ow(l,{activatorEvent:h,active:u,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:x.rect,over:b,overlayNodeRect:x.rect,scrollableAncestors:_,scrollableAncestorRects:v,transform:S,windowRect:L}),j=R3(f),C=LK({config:n,draggableNodes:m,droppableContainers:g,measuringConfiguration:y}),N=j?x.setRef:void 0;return Nt.createElement(pK,null,Nt.createElement(fK,{animation:C},u&&w?Nt.createElement(bK,{key:w,id:u.id,ref:N,as:a,activatorEvent:h,adjustScale:e,className:c,transition:r,rect:j,style:{zIndex:d,...i},transform:k},s):null))}),Ii=6,Hr=100,q5=12,kK=5,jK={w:3,h:2};class Sp extends P.Component{state={hasError:!1,t:void 0};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?o.jsx(NK,{message:this.state.message}):o.jsx(CK,{children:this.props.children})}}function CK(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx(o.Fragment,{children:s}),e[0]=s,e[1]=n):n=e[1],n}function NK(t){const e=z.c(13),{message:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:o.jsx(go,{size:16})}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("home.tileErrorBoundary.tileCrashed"),e[1]=n,e[2]=r):r=e[2];let l;e[3]!==r?(l=o.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==s||e[6]!==n?(a=s??n("home.tileErrorBoundary.defaultError"),e[5]=s,e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",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 flex-col items-center justify-center gap-2 p-4 text-center",children:[i,l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function TK(t){const e=z.c(76),{tiles:s,isEditMode:n,renderTile:i,onMove:r,onResize:l,onRemove:a}=t,c=gl(),d=P.useRef(null),[h,u]=P.useState(null),[f,p]=P.useState(null);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={activationConstraint:{distance:4}},e[0]=m):m=e[0];const g=T0(vr(wa,m),vr(La)),x=s.reduce(VK,0),b=n?Math.max(x+2,4):Math.max(x,1);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{const M=d.current?.getBoundingClientRect();return M?{cellWidth:M.width/Ii,cellHeight:Hr}:null},e[1]=y):y=e[1];const _=y;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=M=>{u(String(M.active.id)),p(_())},e[2]=v):v=e[2];const L=v;let S;e[3]!==f||e[4]!==r||e[5]!==s?(S=M=>{const $=String(M.active.id),B=f??_();if(u(null),p(null),!B||B.cellWidth<=0)return;const U=s.find(K=>K.id===$);if(!U)return;const H=Math.round(M.delta.x/B.cellWidth),W=Math.round(M.delta.y/B.cellHeight);H===0&&W===0||r($,{x:U.x+H,y:U.y+W})},e[3]=f,e[4]=r,e[5]=s,e[6]=S):S=e[6];const w=S;if(c){let M;if(e[7]!==i||e[8]!==s){let B;e[10]!==i?(B=U=>o.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:Hr},children:o.jsx(Sp,{children:i(U)})},U.id),e[10]=i,e[11]=B):B=e[11],M=s.map(B),e[7]=i,e[8]=s,e[9]=M}else M=e[9];let $;return e[12]!==M?($=o.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:M}),e[12]=M,e[13]=$):$=e[13],$}let k,j,C,N,T,V,A,E,R,D;if(e[14]!==h||e[15]!==f||e[16]!==n||e[17]!==w||e[18]!==a||e[19]!==l||e[20]!==i||e[21]!==g||e[22]!==s||e[23]!==b){const M=h?s.find(Y=>Y.id===h):null;j=A0,D=g,C=L,N=w;const $=b*Hr,B=n?Hr*4:Hr;let U;e[34]!==$||e[35]!==B?(U={height:$,minHeight:B},e[34]=$,e[35]=B,e[36]=U):U=e[36];let H;e[37]!==n||e[38]!==s||e[39]!==b?(H=n&&o.jsx(AK,{rows:b,tiles:s}),e[37]=n,e[38]=s,e[39]=b,e[40]=H):H=e[40];let W;if(e[41]!==h||e[42]!==n||e[43]!==a||e[44]!==l||e[45]!==i||e[46]!==s){let Y;e[48]!==h||e[49]!==n||e[50]!==a||e[51]!==l||e[52]!==i?(Y=X=>o.jsx(EK,{tile:X,isEditMode:n,isDragging:h===X.id,onResize:l,onRemove:a,children:i(X)},X.id),e[48]=h,e[49]=n,e[50]=a,e[51]=l,e[52]=i,e[53]=Y):Y=e[53],W=s.map(Y),e[41]=h,e[42]=n,e[43]=a,e[44]=l,e[45]=i,e[46]=s,e[47]=W}else W=e[47];e[54]!==U||e[55]!==H||e[56]!==W?(T=o.jsxs("div",{ref:d,className:"relative w-full",style:U,children:[H,W]}),e[54]=U,e[55]=H,e[56]=W,e[57]=T):T=e[57],R=kn.createPortal,k=Q9,V=null;const K=M&&f?M.w*f.cellWidth-q5:void 0,G=M&&f?M.h*f.cellHeight-q5:void 0;e[58]!==K||e[59]!==G?(A={width:K,height:G},e[58]=K,e[59]=G,e[60]=A):A=e[60],E=M&&o.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:o.jsx(Sp,{children:i(M)})}),e[14]=h,e[15]=f,e[16]=n,e[17]=w,e[18]=a,e[19]=l,e[20]=i,e[21]=g,e[22]=s,e[23]=b,e[24]=k,e[25]=j,e[26]=C,e[27]=N,e[28]=T,e[29]=V,e[30]=A,e[31]=E,e[32]=R,e[33]=D}else k=e[24],j=e[25],C=e[26],N=e[27],T=e[28],V=e[29],A=e[30],E=e[31],R=e[32],D=e[33];let I;e[61]!==k||e[62]!==V||e[63]!==A||e[64]!==E?(I=o.jsx(k,{dropAnimation:V,style:A,children:E}),e[61]=k,e[62]=V,e[63]=A,e[64]=E,e[65]=I):I=e[65];let O;e[66]!==I||e[67]!==R?(O=R(I,document.body),e[66]=I,e[67]=R,e[68]=O):O=e[68];let F;return e[69]!==j||e[70]!==C||e[71]!==N||e[72]!==T||e[73]!==O||e[74]!==D?(F=o.jsxs(j,{sensors:D,onDragStart:C,onDragEnd:N,children:[T,O]}),e[69]=j,e[70]=C,e[71]=N,e[72]=T,e[73]=O,e[74]=D,e[75]=F):F=e[75],F}function VK(t,e){return Math.max(t,e.y+e.h)}function AK(t){const e=z.c(7),{rows:s,tiles:n}=t;let i;e[0]!==n?(i=(c,d)=>n.some(h=>c>=h.x&&c<h.x+h.w&&d>=h.y&&d<h.y+h.h),e[0]=n,e[1]=i):i=e[1];const r=i;let l;if(e[2]!==r||e[3]!==s){l=[];for(let c=0;c<s;c++)for(let d=0;d<Ii;d++)r(d,c)||l.push({x:d,y:c});e[2]=r,e[3]=s,e[4]=l}else l=e[4];let a;return e[5]!==l?(a=o.jsx("div",{className:"absolute inset-0 pointer-events-none",children:l.map(PK)}),e[5]=l,e[6]=a):a=e[6],a}function PK(t){return o.jsx("div",{className:"absolute p-1",style:{left:`${t.x/Ii*100}%`,top:t.y*Hr,width:`${1/Ii*100}%`,height:Hr},children:o.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function EK(t){const e=z.c(32),{tile:s,isEditMode:n,isDragging:i,onResize:r,onRemove:l,children:a}=t,c=re(),d=!n;let h;e[0]!==d||e[1]!==s.id?(h={id:s.id,disabled:d},e[0]=d,e[1]=s.id,e[2]=h):h=e[2];const{setNodeRef:u,attributes:f,listeners:p,isDragging:m}=lw(h),g=`${s.x/Ii*100}%`,x=`${s.w/Ii*100}%`,b=s.y*Hr,y=s.h*Hr,_=m||i,v=!_&&"transition-[left,top,width,height,opacity] duration-200 ease-out",L=_&&"opacity-30";let S;e[3]!==v||e[4]!==L?(S=ie("absolute p-1 will-change-[left,top,width,height,opacity]",v,L),e[3]=v,e[4]=L,e[5]=S):S=e[5];let w;e[6]!==y||e[7]!==g||e[8]!==b||e[9]!==x?(w={left:g,top:b,width:x,height:y},e[6]=y,e[7]=g,e[8]=b,e[9]=x,e[10]=w):w=e[10];const k=n&&"outline outline-1 outline-transparent hover:outline-primary/40";let j;e[11]!==k?(j=ie("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",k),e[11]=k,e[12]=j):j=e[12];let C;e[13]!==f||e[14]!==n||e[15]!==p||e[16]!==l||e[17]!==r||e[18]!==c||e[19]!==s?(C=n&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",...f,...p,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":c("home.tileBoard.dragTileAriaLabel"),children:o.jsx(fd,{size:16})}),o.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:o.jsx(RK,{tile:s,onResize:r,onRemove:l})})]}),e[13]=f,e[14]=n,e[15]=p,e[16]=l,e[17]=r,e[18]=c,e[19]=s,e[20]=C):C=e[20];let N;e[21]!==a?(N=o.jsx("div",{className:"h-full overflow-hidden",children:o.jsx(Sp,{children:a})}),e[21]=a,e[22]=N):N=e[22];let T;e[23]!==N||e[24]!==j||e[25]!==C?(T=o.jsxs("div",{className:j,children:[C,N]}),e[23]=N,e[24]=j,e[25]=C,e[26]=T):T=e[26];let V;return e[27]!==u||e[28]!==T||e[29]!==S||e[30]!==w?(V=o.jsx("div",{ref:u,className:S,style:w,children:T}),e[27]=u,e[28]=T,e[29]=S,e[30]=w,e[31]=V):V=e[31],V}function RK(t){const e=z.c(28),{tile:s,onResize:n,onRemove:i}=t,[r,l]=P.useState(!1),a=re();let c;e[0]!==a?(c=a("home.tileBoard.tileOptionsAriaLabel"),e[0]=a,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Qn,{size:16}),e[2]=d):d=e[2];let h;e[3]!==c?(h=o.jsx(Bt,{asChild:!0,children:o.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":c,children:d})}),e[3]=c,e[4]=h):h=e[4];let u;e[5]!==n||e[6]!==s.id?(u=v=>{n(s.id,v),l(!1)},e[5]=n,e[6]=s.id,e[7]=u):u=e[7];let f;e[8]!==u||e[9]!==s?(f=o.jsx(DK,{tile:s,onPick:u}),e[8]=u,e[9]=s,e[10]=f):f=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Qr,{}),e[11]=p):p=e[11];let m;e[12]!==i||e[13]!==s.id?(m=()=>i(s.id),e[12]=i,e[13]=s.id,e[14]=m):m=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Gs,{size:14,className:"mr-2"}),e[15]=g):g=e[15];let x;e[16]!==a?(x=a("home.tileBoard.removeTile"),e[16]=a,e[17]=x):x=e[17];let b;e[18]!==m||e[19]!==x?(b=o.jsxs(Ye,{onSelect:m,className:"text-destructive focus:text-destructive",children:[g,x]}),e[18]=m,e[19]=x,e[20]=b):b=e[20];let y;e[21]!==b||e[22]!==f?(y=o.jsxs(zt,{align:"end",className:"w-auto",children:[f,p,b]}),e[21]=b,e[22]=f,e[23]=y):y=e[23];let _;return e[24]!==r||e[25]!==y||e[26]!==h?(_=o.jsxs($t,{open:r,onOpenChange:l,children:[h,y]}),e[24]=r,e[25]=y,e[26]=h,e[27]=_):_=e[27],_}function DK(t){const e=z.c(26),{tile:s,onPick:n}=t,i=s.minW??1,r=s.minH??1,[l,a]=P.useState(null);let c;e[0]!==l||e[1]!==s.h||e[2]!==s.w?(c=l??{w:s.w,h:s.h},e[0]=l,e[1]=s.h,e[2]=s.w,e[3]=c):c=e[3];const d=c,h=re();let u;e[4]!==h?(u=h("home.tileBoard.sizeLabel"),e[4]=h,e[5]=u):u=e[5];let f;e[6]!==u?(f=o.jsx("span",{className:"text-xs text-muted-foreground",children:u}),e[6]=u,e[7]=f):f=e[7];let p;e[8]!==d.h||e[9]!==d.w?(p=o.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[d.w," × ",d.h]}),e[8]=d.h,e[9]=d.w,e[10]=p):p=e[10];let m;e[11]!==f||e[12]!==p?(m=o.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[f,p]}),e[11]=f,e[12]=p,e[13]=m):m=e[13];let g,x;e[14]===Symbol.for("react.memo_cache_sentinel")?(g={gridTemplateColumns:`repeat(${Ii}, 1.25rem)`},x=()=>a(null),e[14]=g,e[15]=x):(g=e[14],x=e[15]);let b;e[16]!==d.h||e[17]!==d.w||e[18]!==r||e[19]!==i||e[20]!==n||e[21]!==h?(b=o.jsx("div",{className:"grid w-max gap-1",style:g,onPointerLeave:x,children:Array.from({length:kK},(_,v)=>Array.from({length:Ii},(L,S)=>{const w=S+1,k=v+1,j=w<i||k<r,C=w<=d.w&&k<=d.h;return o.jsx("button",{type:"button",disabled:j,"aria-label":h("home.tileBoard.sizeGridCellAriaLabel",{w,h:k}),onPointerEnter:()=>a({w,h:k}),onClick:()=>n({w,h:k}),className:ie("size-5 rounded-sm border transition-colors",C?"border-primary bg-primary/30":"border-border bg-muted",j?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${w}x${k}`)}))}),e[16]=d.h,e[17]=d.w,e[18]=r,e[19]=i,e[20]=n,e[21]=h,e[22]=b):b=e[22];let y;return e[23]!==m||e[24]!==b?(y=o.jsxs("div",{className:"px-2 py-1.5",children:[m,b]}),e[23]=m,e[24]=b,e[25]=y):y=e[25],y}function IK(t,e,s){return t.some(n=>e>=n.x&&e<n.x+n.w&&s>=n.y&&s<n.y+n.h)}function kp(t,e,s){for(let n=0;n<100;n++)for(let i=0;i<=Ii-e;i++){let r=!0;for(let l=0;l<s&&r;l++)for(let a=0;a<e&&r;a++)IK(t,i+a,n+l)&&(r=!1);if(r)return{x:i,y:n}}return{x:0,y:0}}function em(t,e,s={w:1,h:1}){const n=Math.max(s.w,Math.min(Ii,t)),i=Math.max(s.h,Math.min(6,e));return{w:n,h:i}}function tm(t,e,s){const n=Math.max(0,Math.min(Ii-s,t)),i=Math.max(0,e);return{x:n,y:i}}function MK(t,e,s){const n=t.find(c=>c.id===e);if(!n)return t;const i=t.filter(c=>c.id!==e),r=i.find(c=>s.x>=c.x&&s.x<c.x+c.w&&s.y>=c.y&&s.y<c.y+c.h);if(r&&r.w===n.w&&r.h===n.h)return t.map(c=>c.id===e?{...c,x:r.x,y:r.y}:c.id===r.id?{...c,x:n.x,y:n.y}:c);const a=[{...n,x:s.x,y:s.y}];for(const c of i){const d=kp(a,c.w,c.h);a.push({...c,x:d.x,y:d.y})}return a}function OK(t){const e=z.c(42),{layout:s,isLayoutLoading:n,commitLayout:i}=N3();let r;e[0]!==s.hidden?(r=new Set(s.hidden),e[0]=s.hidden,e[1]=r):r=e[1];const l=r;let a;e[2]!==s.shown?(a=s.shown??[],e[2]=s.shown,e[3]=a):a=e[3];let c;e[4]!==a?(c=new Set(a),e[4]=a,e[5]=c):c=e[5];const d=c;let h,u;if(e[6]!==t||e[7]!==l||e[8]!==s.tiles||e[9]!==d){u=[];let L;e[12]!==l||e[13]!==d?(L=w=>w.pinned?!0:w.defaultHidden?d.has(w.id)&&!l.has(w.id):!l.has(w.id),e[12]=l,e[13]=d,e[14]=L):L=e[14];const S=t.filter(L);h=new Map;for(const w of t)w.minSize&&h.set(w.id,w.minSize);for(const w of S){const k=s.tiles[w.id];if(!k)continue;const j=h.get(w.id),{w:C,h:N}=em(k.w,k.h,j),{x:T,y:V}=tm(k.x,k.y,C);u.push({id:w.id,x:T,y:V,w:C,h:N,minW:j?.w,minH:j?.h})}for(const w of S){if(u.some(V=>V.id===w.id))continue;const k=w.defaultSize??jK,j=h.get(w.id),{w:C,h:N}=em(k.w,k.h,j),T=kp(u,C,N);u.push({id:w.id,x:T.x,y:T.y,w:C,h:N,minW:j?.w,minH:j?.h})}e[6]=t,e[7]=l,e[8]=s.tiles,e[9]=d,e[10]=h,e[11]=u}else h=e[10],u=e[11];let f;e[15]!==t?(f=new Set(t.map($K)),e[15]=t,e[16]=f):f=e[16];const p=f;let m;e[17]!==p||e[18]!==i||e[19]!==s?(m=(L,S)=>{const w={};for(const k of L)w[k.id]={x:k.x,y:k.y,w:k.w,h:k.h};i({version:id,tiles:w,hidden:S.filter(k=>p.has(k)),shown:(s.shown??[]).filter(k=>p.has(k))})},e[17]=p,e[18]=i,e[19]=s,e[20]=m):m=e[20];const g=m;let x;e[21]!==u?(x={visible:u},e[21]=u,e[22]=x):x=e[22];let b;e[23]!==g||e[24]!==s||e[25]!==u?(b=(L,S)=>{const w=u.find(C=>C.id===L);if(!w)return;const k=tm(S.x,S.y,w.w);if(k.x===w.x&&k.y===w.y)return;const j=MK(u,L,k);g(j,s.hidden)},e[23]=g,e[24]=s,e[25]=u,e[26]=b):b=e[26];let y;e[27]!==g||e[28]!==s||e[29]!==h||e[30]!==u?(y=(L,S)=>{const w=u.find(A=>A.id===L);if(!w)return;const k=h.get(L),{w:j,h:C}=em(S.w,S.h,k);if(j===w.w&&C===w.h)return;const N={...w,w:j,h:C,x:tm(w.x,w.y,j).x},T=u.filter(A=>A.id!==L),V=[N];for(const A of T){const E=kp(V,A.w,A.h);V.push({...A,x:E.x,y:E.y})}g(V,s.hidden)},e[27]=g,e[28]=s,e[29]=h,e[30]=u,e[31]=y):y=e[31];let _;e[32]!==g||e[33]!==s||e[34]!==u?(_=L=>{const S=u.filter(w=>w.id!==L);g(S,Array.from(new Set([...s.hidden,L])))},e[32]=g,e[33]=s,e[34]=u,e[35]=_):_=e[35];let v;return e[36]!==n||e[37]!==x||e[38]!==b||e[39]!==y||e[40]!==_?(v={snapshot:x,isLoading:n,moveTile:b,resizeTile:y,hideTile:_},e[36]=n,e[37]=x,e[38]=b,e[39]=y,e[40]=_,e[41]=v):v=e[41],v}function $K(t){return t.id}function D3(t){const{org:e}=Be(),{data:s}=_n.useSession(),n=Ag(),i=cs(),r=Qt({connectionId:bl,orgId:e.id,orgSlug:e.slug}),[l,a]=P.useState(!1),c=rE(t,{enabled:!1});return{connect:async()=>{if(!(l||!s?.user?.id||!e)){a(!0);try{const h=c.data??(await c.refetch()).data;if(!h){ve.error("Could not find this integration in the registry");return}const u=eE(h,e.id,s.user.id,{remoteIndex:0});if(!u.connection_url){ve.error("This integration has no connection method available");return}const f=u.app_name?await BK(r,u.app_name):null,p=!f,m=f?.id??(await n.create.mutateAsync(u)).id,g=await aE({connectionId:m,orgId:e.id,orgSlug:e.slug,persistFallback:x=>n.update.mutateAsync({id:m,data:{connection_token:x}}).then(()=>{})});if(g.ran&&!g.ok){if(p)try{await n.delete.mutateAsync(m)}catch{}ve.error(`Authentication failed: ${g.error??"no token"}`);return}Ru(i,e.id),ve.success(p?"Connected successfully":"Already connected")}catch(h){ve.error(`Failed to connect: ${h instanceof Error?h.message:String(h)}`)}finally{a(!1)}}},isConnecting:l}}async function BK(t,e){return(await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_name"],operator:"eq",value:e},limit:1}})).structuredContent?.items?.[0]??null}const zK=3,FK=5;function UK(t){const e=z.c(17),{org:s}=Be();let n;e[0]!==s.id||e[1]!==s.slug?(n={connectionId:bl,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=n):n=e[2];const i=Qt(n);let r;e[3]!==t||e[4]!==s.id||e[5]!==s.slug?(r={connectionId:t,orgId:s.id,orgSlug:s.slug},e[3]=t,e[4]=s.id,e[5]=s.slug,e[6]=r):r=e[6];const l=Qt(r);let a;e[7]!==t||e[8]!==s.id?(a=Ge.homeGithubRecentPrs(s.id,t),e[7]=t,e[8]=s.id,e[9]=a):a=e[9];let c;e[10]!==t||e[11]!==l||e[12]!==i?(c=async()=>{const{installations:h}=await l7(y=>i.callTool(y),t),u=h[0];if(!u)return{repos:[]};const f=u.type==="User"?"user":"org",m=(await l.callTool({name:"search_repositories",arguments:{query:`${f}:${u.login}`,page:1,perPage:30}})).content?.[0]?.text,x=[...m?JSON.parse(m).items??[]:[]].sort(GK).filter(qK).slice(0,zK);return x.length===0?{repos:[]}:{repos:(await Promise.all(x.map(async y=>{const[_,v]=y.full_name.split("/"),L=await l.callTool({name:"list_pull_requests",arguments:{owner:_,repo:v,state:"all",perPage:FK}}),S=H7(L).map(WK).filter(KK);return{repo:y.full_name,prs:S}}))).filter(HK)}},e[10]=t,e[11]=l,e[12]=i,e[13]=c):c=e[13];let d;return e[14]!==a||e[15]!==c?(d={queryKey:a,queryFn:c,staleTime:6e4,retry:!1},e[14]=a,e[15]=c,e[16]=d):d=e[16],Tt(d)}function HK(t){return t.prs.length>0}function KK(t){return t.number>0}function WK(t){return{number:t.number??0,title:t.title??"",merged:t.merged_at!=null,state:t.state==="closed"?"closed":"open",htmlUrl:t.html_url??""}}function qK(t){return t.full_name}function GK(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}const Fc=26,YK=7;function JK(t){const e=z.c(17),{org:s}=Be();let n;e[0]!==s.id||e[1]!==s.slug?(n={connectionId:bl,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=n):n=e[2];const i=Qt(n);let r;e[3]!==t||e[4]!==s.id||e[5]!==s.slug?(r={connectionId:t,orgId:s.id,orgSlug:s.slug},e[3]=t,e[4]=s.id,e[5]=s.slug,e[6]=r):r=e[6];const l=Qt(r);let a;e[7]!==t||e[8]!==s.id?(a=Ge.homeGithubContributions(s.id,t),e[7]=t,e[8]=s.id,e[9]=a):a=e[9];let c;e[10]!==t||e[11]!==l||e[12]!==i?(c=async()=>{const{installations:h}=await l7(j=>i.callTool(j),t),u=h[0];if(!u)return sm();const f=u.type==="User"?"user":"org",m=(await l.callTool({name:"search_repositories",arguments:{query:`${f}:${u.login}`,page:1,perPage:30}})).content?.[0]?.text,x=[...m?JSON.parse(m).items??[]:[]].sort(QK)[0];if(!x?.full_name)return sm();const[b,y]=x.full_name.split("/"),_=new Date(Date.now()-Fc*7*864e5),L=(await l.callTool({name:"list_commits",arguments:{owner:b,repo:y,since:_.toISOString(),perPage:100}})).content?.[0]?.text,S=L?JSON.parse(L):[],w=sm(),k=Date.now();for(const j of S){const C=j.commit?.committer?.date??j.commit?.author?.date??"",N=new Date(C);if(isNaN(N.getTime()))continue;const T=Math.floor((k-N.getTime())/864e5);if(T<0||T>=Fc*7)continue;const V=Fc-1-Math.floor(T/7),A=N.getDay(),E=w[V];E&&(E[A]=(E[A]??0)+1)}return w},e[10]=t,e[11]=l,e[12]=i,e[13]=c):c=e[13];let d;return e[14]!==a||e[15]!==c?(d={queryKey:a,queryFn:c,staleTime:3e5,retry:!1},e[14]=a,e[15]=c,e[16]=d):d=e[16],Tt(d)}function QK(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function sm(){return Array.from({length:Fc},()=>Array.from({length:YK},()=>0))}const dw="pageviews",uw="sessions",hw="orders",fw="coding",mw="revenue",pw="recent-conversations",I3=[{id:dw,titleKey:"home.nativeTiles.pageviews",defaultSize:{w:2,h:3},minSize:{w:1,h:2}},{id:uw,titleKey:"home.nativeTiles.sessions",defaultSize:{w:2,h:3},minSize:{w:1,h:2}},{id:hw,titleKey:"home.nativeTiles.orders",defaultSize:{w:2,h:3},minSize:{w:1,h:2}},{id:mw,titleKey:"home.nativeTiles.revenue",defaultSize:{w:3,h:3},minSize:{w:2,h:2}},{id:fw,titleKey:"home.nativeTiles.coding",defaultSize:{w:3,h:3},minSize:{w:2,h:2}},{id:pw,titleKey:"home.nativeTiles.recentConversations",defaultSize:{w:6,h:4},minSize:{w:2,h:2},defaultHidden:!0}];function gw(t){return`native:${t}`}function xw(t){const e=z.c(21),{points:s,metricLabel:n}=t,i=P.useId();let r;if(e[0]!==i){let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=/:/g,e[2]=y):y=e[2],r=i.replace(y,""),e[0]=i,e[1]=r}else r=e[1];const l=r;let a;e[3]!==n?(a={value:{label:n,color:"var(--success)"}},e[3]=n,e[4]=a):a=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c={top:6,right:0,bottom:0,left:0},e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("line",{x1:0,y1:0,x2:0,y2:8,stroke:"var(--success)",strokeOpacity:.22,strokeWidth:4}),e[6]=d):d=e[6];let h;e[7]!==l?(h=o.jsx("defs",{children:o.jsx("pattern",{id:l,width:6,height:8,patternUnits:"userSpaceOnUse",children:d})}),e[7]=l,e[8]=h):h=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(cE,{dataKey:"label",hide:!0}),e[9]=u):u=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(ZV,{cursor:{stroke:"var(--border)"},content:o.jsx(eA,{indicator:"line"})}),e[10]=f):f=e[10];const p=`url(#${l})`;let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m={r:4,fill:"var(--success)",stroke:"var(--background)",strokeWidth:2},e[11]=m):m=e[11];let g;e[12]!==p?(g=o.jsx(dE,{type:"monotone",dataKey:"value",stroke:"var(--success)",strokeWidth:2,fill:p,fillOpacity:1,animationDuration:350,dot:!1,activeDot:m}),e[12]=p,e[13]=g):g=e[13];let x;e[14]!==s||e[15]!==g||e[16]!==h?(x=o.jsxs(uE,{data:s,margin:c,children:[h,u,f,g]}),e[14]=s,e[15]=g,e[16]=h,e[17]=x):x=e[17];let b;return e[18]!==x||e[19]!==a?(b=o.jsx(tA,{config:a,className:"h-full w-full",children:x}),e[18]=x,e[19]=a,e[20]=b):b=e[20],b}const bw={pageviews:{value:"12.2k",delta:"+1.9%",series:[9800,10100,9950,10600,10400,11e3,11200,11500,11900,12200]},sessions:{value:"3.2k",delta:"+25.6%",series:[2100,2250,2200,2500,2600,2750,2900,3e3,3100,3200]},orders:{value:"142",delta:"+8.4%",series:[96,102,99,110,108,118,124,131,137,142]},revenue:{value:"$8,240",delta:"+12.0%",series:[6100,6400,6250,6800,6700,7100,7400,7700,8e3,8240]}};function vw(t,e){return t.map((s,n)=>{const i=t.length-1-n;return{label:i===0?e("home.nativeTiles.today"):i===1?e("home.nativeTiles.yesterday"):e("home.nativeTiles.daysAgo",{days:i}),value:s}})}function yw(t){const e=z.c(8),{value:s,delta:n}=t;let i;e[0]!==s?(i=o.jsx("span",{className:"text-2xl font-medium tabular-nums text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(A6,{className:"size-4"}),e[2]=r):r=e[2];let l;e[3]!==n?(l=o.jsxs("span",{className:"inline-flex items-center gap-1 text-sm font-medium tabular-nums text-success",children:[r,n]}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==i||e[6]!==l?(a=o.jsxs("div",{className:"mt-3 flex items-center gap-2.5",children:[i,l]}),e[5]=i,e[6]=l,e[7]=a):a=e[7],a}function XK(t,e){const s=(t*31+e*17+7)%100;return s<38?0:s<60?1+s%2:s<80?3+s%3:s<93?6+s%3:9+s%4}function ZK(t){return t===0?"bg-muted-foreground/15":t<=2?"bg-success/25":t<=5?"bg-success/45":t<=8?"bg-success/70":"bg-success"}function _w(t){const e=z.c(4),{grid:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={gridTemplateColumns:`repeat(${Fc}, 1fr)`},e[0]=i):i=e[0];let r;return e[1]!==s||e[2]!==n?(r=o.jsx(to,{delayDuration:0,children:o.jsx("div",{className:"grid w-full gap-1",style:i,children:Array.from({length:Fc},(l,a)=>o.jsx("div",{className:"flex flex-col gap-1",children:Array.from({length:5},(c,d)=>{const h=s?s[a]?.[d]??0:XK(a,d);return o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx("div",{className:ie("aspect-square rounded-[2px]",ZK(h))})}),o.jsx(Ue,{children:h===0?n("home.nativeTiles.noCommits"):n("home.nativeTiles.commits",{count:h})})]},d)})},a))})}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function M3(t){const e=z.c(8),{label:s,icon:n,onConnect:i,pending:r}=t;let l;e[0]!==n||e[1]!==r?(l=r?o.jsx(ct,{className:"size-4 animate-spin"}):n,e[0]=n,e[1]=r,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==i||e[5]!==r||e[6]!==l?(a=o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/30 backdrop-blur-[2px]",children:o.jsxs(me,{size:"sm",onClick:i,disabled:r,className:"gap-2 shadow-sm",children:[l,s]})}),e[3]=s,e[4]=i,e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Lw(t){const e=z.c(6),{label:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(vi,{className:"size-6 text-success/60"}),e[0]=i):i=e[0];let r;e[1]!==s||e[2]!==n?(r=n("home.nativeTiles.connectedSoon",{label:s}),e[1]=s,e[2]=n,e[3]=r):r=e[3];let l;return e[4]!==r?(l=o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-center",children:[i,o.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),e[4]=r,e[5]=l):l=e[5],l}function G5(t){const e=z.c(22),{metricKey:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"google-analytics"},e[0]=i):i=e[0];const r=pi(i).length>0,{connect:l,isConnecting:a}=D3("deco/google-analytics"),c=bw[s];if(r||!c){let x;return e[1]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Lw,{label:"Analytics"}),e[1]=x):x=e[1],x}let d;e[2]!==c.series||e[3]!==n?(d=vw(c.series,n),e[2]=c.series,e[3]=n,e[4]=d):d=e[4];let h;e[5]!==s||e[6]!==d?(h=o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(xw,{points:d,metricLabel:s})}),e[5]=s,e[6]=d,e[7]=h):h=e[7];let u;e[8]!==c.delta||e[9]!==c.value?(u=o.jsx(yw,{value:c.value,delta:c.delta}),e[8]=c.delta,e[9]=c.value,e[10]=u):u=e[10];let f;e[11]!==n?(f=n("home.nativeTiles.connectGoogleAnalytics"),e[11]=n,e[12]=f):f=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(H8,{className:"size-4"}),e[13]=p):p=e[13];let m;e[14]!==l||e[15]!==a||e[16]!==f?(m=o.jsx(M3,{label:f,icon:p,onConnect:l,pending:a}),e[14]=l,e[15]=a,e[16]=f,e[17]=m):m=e[17];let g;return e[18]!==h||e[19]!==u||e[20]!==m?(g=o.jsxs("div",{className:"relative flex h-full flex-col",children:[h,u,m]}),e[18]=h,e[19]=u,e[20]=m,e[21]=g):g=e[21],g}function Y5(t){const e=z.c(27),{metricKey:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"vtex"},e[0]=i):i=e[0];const r=pi(i);let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={slug:"shopify"},e[1]=l):l=e[1];const a=pi(l),c=r.length>0||a.length>0,[d,h]=P.useState(!1),u=bw[s];if(c||!u){let S;return e[2]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Lw,{label:"Commerce"}),e[2]=S):S=e[2],S}let f;e[3]!==u.series||e[4]!==n?(f=vw(u.series,n),e[3]=u.series,e[4]=n,e[5]=f):f=e[5];let p;e[6]!==s||e[7]!==f?(p=o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(xw,{points:f,metricLabel:s})}),e[6]=s,e[7]=f,e[8]=p):p=e[8];let m;e[9]!==u.delta||e[10]!==u.value?(m=o.jsx(yw,{value:u.value,delta:u.delta}),e[9]=u.delta,e[10]=u.value,e[11]=m):m=e[11];let g;e[12]!==n?(g=n("home.nativeTiles.connectCommercePlatform"),e[12]=n,e[13]=g):g=e[13];let x,b;e[14]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Eg,{className:"size-4"}),b=()=>h(!0),e[14]=x,e[15]=b):(x=e[14],b=e[15]);let y;e[16]!==g?(y=o.jsx(M3,{label:g,icon:x,onConnect:b}),e[16]=g,e[17]=y):y=e[17];let _;e[18]!==p||e[19]!==m||e[20]!==y?(_=o.jsxs("div",{className:"relative flex h-full flex-col",children:[p,m,y]}),e[18]=p,e[19]=m,e[20]=y,e[21]=_):_=e[21];let v;e[22]!==d?(v=o.jsx(Lg,{mode:"browse",open:d,onOpenChange:h,defaultTab:"all",initialSearch:"shopify vtex"}),e[22]=d,e[23]=v):v=e[23];let L;return e[24]!==_||e[25]!==v?(L=o.jsxs(o.Fragment,{children:[_,v]}),e[24]=_,e[25]=v,e[26]=L):L=e[26],L}function eW(){const t=z.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={slug:"mcp-github"},t[0]=e):e=t[0];const s=pi(e);let n;t[1]!==s?(n=oE(s),t[1]=s,t[2]=n):n=t[2];const i=n[0];let r;return t[3]!==i?(r=i?o.jsx(sW,{connectionId:i.id}):o.jsx(tW,{}),t[3]=i,t[4]=r):r=t[4],r}function tW(){const t=z.c(8),e=re(),{connect:s,isConnecting:n}=D3("deco/mcp-github");let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o.jsx(_w,{})}),t[0]=i):i=t[0];let r;t[1]!==e?(r=e("home.nativeTiles.connectGithub"),t[1]=e,t[2]=r):r=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Vn,{className:"size-4"}),t[3]=l):l=t[3];let a;return t[4]!==s||t[5]!==n||t[6]!==r?(a=o.jsxs("div",{className:"relative flex h-full flex-col",children:[i,o.jsx(M3,{label:r,icon:l,onConnect:s,pending:n})]}),t[4]=s,t[5]=n,t[6]=r,t[7]=a):a=t[7],a}function sW(t){const e=z.c(9),{connectionId:s}=t,n=re(),{data:i,isLoading:r}=UK(s),{data:l}=JK(s);let a;e[0]!==l?(a=o.jsx(_w,{grid:l}),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==i||e[3]!==r||e[4]!==n?(c=r?o.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:3},iW)}):!i||i.repos.length===0?o.jsx("p",{className:"text-xs text-muted-foreground",children:n("home.nativeTiles.noRecentPullRequests")}):o.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto",children:i.repos.map(nW)}),e[2]=i,e[3]=r,e[4]=n,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsxs("div",{className:"flex h-full flex-col gap-3 overflow-hidden",children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function nW(t){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:t.repo}),t.prs.map(e=>o.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 rounded-md px-1.5 py-1.5 text-sm transition-colors hover:bg-accent/60",children:[o.jsx(ci,{className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate text-foreground",children:e.title}),o.jsxs("span",{className:ie("ml-auto shrink-0 rounded-full px-1.5 py-0.5 text-xs font-medium",e.merged?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:["#",e.number]})]},`${t.repo}#${e.number}`))]},t.repo)}function iW(t,e){return o.jsx("div",{className:"h-5 w-full animate-pulse rounded-md bg-muted/40"},`pr-skeleton-${e}`)}const rW={completed:{labelKey:"home.nativeTiles.statusCompleted",className:"text-success"},in_progress:{labelKey:"home.nativeTiles.statusRunning",className:"text-foreground"},requires_action:{labelKey:"home.nativeTiles.statusNeedsInput",className:"text-foreground"},failed:{labelKey:"home.nativeTiles.statusFailed",className:"text-destructive"},expired:{labelKey:"home.nativeTiles.statusExpired",className:"text-muted-foreground"}};function oW(){const t=z.c(14),e=re(),{org:s,locator:n}=Be(),i=gs(),r=Js(),{data:l}=d0(),a=l?.data?.members??[],c=new Map(a.map(lW));let d;t[0]!==n?(d=Ge.overviewThreads(n),t[0]=n,t[1]=d):d=t[1];let h;t[2]!==i?(h=async()=>(await i.call("COLLECTION_THREADS_LIST",{limit:12})).items??[],t[2]=i,t[3]=h):h=t[3];let u;t[4]!==d||t[5]!==h?(u={queryKey:d,queryFn:h,staleTime:3e4},t[4]=d,t[5]=h,t[6]=u):u=t[6];const{data:f}=Zf(u);if(f.length===0){let x;t[7]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(hg,{className:"size-6 text-muted-foreground/50"}),t[7]=x):x=t[7];let b;t[8]!==e?(b=e("home.nativeTiles.noConversationsYet"),t[8]=e,t[9]=b):b=t[9];let y;return t[10]!==b?(y=o.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[x,o.jsx("p",{className:"text-xs text-muted-foreground",children:b})]}),t[10]=b,t[11]=y):y=t[11],y}const p="flex h-full flex-col gap-0.5 overflow-y-auto",m=f.map(x=>{const b=c.get(x.created_by),y=b?.user?.name??b?.user?.email?.split("@")[0]??"Someone",_=x.status?rW[x.status]:void 0,v=x.updated_at?va(new Date(x.updated_at)):null;return o.jsxs("button",{type:"button",onClick:()=>r({to:"/$org/$taskId",params:{org:s.slug,taskId:x.id},search:x.virtual_mcp_id?{virtualmcpid:x.virtual_mcp_id}:{}}),className:"flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-accent/60",children:[o.jsx(Ps,{shape:"circle",size:"xs",url:b?.user?.image??void 0,fallback:y.slice(0,2).toUpperCase()}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:x.title||e("home.nativeTiles.untitledConversation")}),o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:[y,v?` · ${v}`:""]})]}),_&&o.jsx("span",{className:ie("shrink-0 text-xs",_.className),children:e(_.labelKey)})]},x.id)});let g;return t[12]!==m?(g=o.jsx("div",{className:p,children:m}),t[12]=m,t[13]=g):g=t[13],g}function lW(t){return[t.userId,t]}function aW(t){const e=z.c(6),{nativeId:s}=t;switch(s){case dw:{let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(G5,{metricKey:"pageviews"}),e[0]=n):n=e[0],n}case uw:{let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(G5,{metricKey:"sessions"}),e[1]=n):n=e[1],n}case hw:{let n;return e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Y5,{metricKey:"orders"}),e[2]=n):n=e[2],n}case mw:{let n;return e[3]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Y5,{metricKey:"revenue"}),e[3]=n):n=e[3],n}case fw:{let n;return e[4]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(eW,{}),e[4]=n):n=e[4],n}case pw:{let n;return e[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"h-full animate-pulse bg-muted/30"}),children:o.jsx(oW,{})}),e[5]=n):n=e[5],n}default:return null}}function cW(t){const e=z.c(16),{nativeId:s}=t,n=re();let i,r,l;if(e[0]!==s||e[1]!==n){let h;e[5]!==s?(h=f=>f.id===s,e[5]=s,e[6]=h):h=e[6];const u=I3.find(h);l="flex h-full flex-col overflow-hidden p-4",i="shrink-0 text-xs font-medium text-muted-foreground",r=u?.titleKey?n(u.titleKey):n("home.nativeTiles.tile"),e[0]=s,e[1]=n,e[2]=i,e[3]=r,e[4]=l}else i=e[2],r=e[3],l=e[4];let a;e[7]!==i||e[8]!==r?(a=o.jsx("span",{className:i,children:r}),e[7]=i,e[8]=r,e[9]=a):a=e[9];let c;e[10]!==s?(c=o.jsx("div",{className:"relative mt-2 min-h-0 flex-1",children:o.jsx(aW,{nativeId:s})}),e[10]=s,e[11]=c):c=e[11];let d;return e[12]!==l||e[13]!==a||e[14]!==c?(d=o.jsxs("div",{className:l,children:[a,c]}),e[12]=l,e[13]=a,e[14]=c,e[15]=d):d=e[15],d}const dW={w:3,h:4},uW={w:1,h:2},hW={w:2,h:1};function fW(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function mW(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function pW(t){return t.promptName?t.agentName:t.description}function gW(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function ww(t){const e=z.c(14),{org:s}=Be();let n;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(n=qV({connectionId:t.connectionId,orgId:s.id,orgSlug:s.slug}),e[0]=s.id,e[1]=s.slug,e[2]=t.connectionId,e[3]=n):n=e[3];const{data:i}=Tt(n),r=!!i&&!t.toolName;let l;e[4]!==i||e[5]!==r?(l={client:i,enabled:r},e[4]=i,e[5]=r,e[6]=l):l=e[6];const{data:a}=lg(l);let c;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==a?.tools?(c=t.toolName??a?.tools.find(u=>j9(u._meta)===t.resourceUri)?.name,e[7]=t.resourceUri,e[8]=t.toolName,e[9]=a?.tools,e[10]=c):c=e[10];const d=c;let h;return e[11]!==t.connectionId||e[12]!==d?(h=d?Wm(t.connectionId,d):void 0,e[11]=t.connectionId,e[12]=d,e[13]=h):h=e[13],h}function O3(t){const e=z.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:n,startBlank:i,dialog:r,starting:l}=ZU(s);let a;e[2]!==n||e[3]!==i?(a=h=>{if(!h.promptName){i();return}n(gW(h))},e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;return e[5]!==r||e[6]!==c||e[7]!==i||e[8]!==l?(d={open:c,startBlank:i,dialog:r,starting:l},e[5]=r,e[6]=c,e[7]=i,e[8]=l,e[9]=d):d=e[9],d}function xW(t){const e=z.c(32),{entry:s,isEditMode:n}=t,{open:i,dialog:r,starting:l}=O3(s.agentId);let a;e[0]!==s||e[1]!==i?(a=()=>i(s),e[0]=s,e[1]=i,e[2]=a):a=e[2];const c=l||n,d=!n&&"cursor-pointer transition-colors hover:bg-accent/40",h=n&&"cursor-default pl-12",u=l&&"opacity-60";let f;e[3]!==d||e[4]!==h||e[5]!==u?(f=ie("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",d,h,u),e[3]=d,e[4]=h,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==s.agentIcon||e[8]!==s.agentName?(p=o.jsx(mi,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=p):p=e[9];let m;e[10]!==s.title?(m=o.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=m):m=e[11];let g;e[12]!==s?(g=pW(s),e[12]=s,e[13]=g):g=e[13];let x;e[14]!==g?(x=o.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:g}),e[14]=g,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==m?(b=o.jsxs("div",{className:"min-w-0 flex-1",children:[m,x]}),e[16]=x,e[17]=m,e[18]=b):b=e[18];let y;e[19]!==n?(y=!n&&o.jsx(bo,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=n,e[20]=y):y=e[20];let _;e[21]!==l||e[22]!==a||e[23]!==b||e[24]!==y||e[25]!==c||e[26]!==f||e[27]!==p?(_=o.jsxs("button",{type:"button",onClick:a,disabled:c,"aria-busy":l,className:f,children:[p,b,y]}),e[21]=l,e[22]=a,e[23]=b,e[24]=y,e[25]=c,e[26]=f,e[27]=p,e[28]=_):_=e[28];let v;return e[29]!==r||e[30]!==_?(v=o.jsxs(o.Fragment,{children:[_,r]}),e[29]=r,e[30]=_,e[31]=v):v=e[31],v}function bW(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},vW)}),t[0]=e):e=t[0],e}function vW(t,e){return o.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[o.jsx(Pt,{className:"size-10 rounded-xl"}),o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx(Pt,{className:"h-3 w-2/3"}),o.jsx(Pt,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function yW(t){const e=z.c(18),{tile:s,prompts:n,isEditMode:i,tileWidth:r}=t,{org:l}=Be(),{open:a,startBlank:c,dialog:d,starting:h}=O3(s.agentId),u=n.filter(_W),f=ww(s),p=re(),m="relative flex h-full w-full flex-col p-3";let g;e[0]!==i||e[1]!==f||e[2]!==c||e[3]!==h||e[4]!==p?(g=!i&&o.jsx("button",{type:"button",onClick:()=>{c(f?{panel:f}:void 0)},disabled:h,"aria-busy":h,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:p("home.homeGrid.openChat")}),e[0]=i,e[1]=f,e[2]=c,e[3]=h,e[4]=p,e[5]=g):g=e[5];const x="flex min-h-0 flex-1 gap-3 overflow-hidden";let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(wW,{}),e[6]=b):b=e[6];let y;e[7]!==l.id||e[8]!==l.slug||e[9]!==s?(y=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:o.jsx(P.Suspense,{fallback:b,children:o.jsx(LW,{tile:s,orgId:l.id,orgSlug:l.slug})})}),e[7]=l.id,e[8]=l.slug,e[9]=s,e[10]=y):y=e[10];const _=u.length>0&&!i&&r>=2&&o.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(S=>o.jsx("button",{type:"button",onClick:()=>a(S),disabled:h,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:o.jsx("span",{className:"line-clamp-2",children:S.title})},S.promptName))});let v;e[11]!==y||e[12]!==_?(v=o.jsxs("div",{className:x,children:[y,_]}),e[11]=y,e[12]=_,e[13]=v):v=e[13];let L;return e[14]!==d||e[15]!==g||e[16]!==v?(L=o.jsxs("div",{className:m,children:[g,v,d]}),e[14]=d,e[15]=g,e[16]=v,e[17]=L):L=e[17],L}function _W(t){return!!t.promptName}function LW(t){const e=z.c(13),{tile:s,orgId:n,orgSlug:i}=t;let r;e[0]!==n||e[1]!==i||e[2]!==s.connectionId?(r={connectionId:s.connectionId,orgId:n,orgSlug:i},e[0]=n,e[1]=i,e[2]=s.connectionId,e[3]=r):r=e[3];const l=Qt(r),a=s.minHeight??200,c=s.maxHeight??4e3;let d;return e[4]!==l||e[5]!==n||e[6]!==i||e[7]!==a||e[8]!==c||e[9]!==s.connectionId||e[10]!==s.resourceUri||e[11]!==s.toolInput?(d=o.jsx(BP,{resourceURI:s.resourceUri,orgId:n,orgSlug:i,connectionId:s.connectionId,client:l,toolInput:s.toolInput,displayMode:"fullscreen",minHeight:a,maxHeight:c,className:"h-full"}),e[4]=l,e[5]=n,e[6]=i,e[7]=a,e[8]=c,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=s.toolInput,e[12]=d):d=e[12],d}function wW(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[o.jsx(Pt,{className:"h-3 w-2/3"}),o.jsx(Pt,{className:"h-3 w-1/2"}),o.jsx(Pt,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function SW(t){const e=z.c(18),{icon:s,name:n}=t,i=re();let r;e[0]!==s||e[1]!==n?(r=o.jsx(mi,{icon:s,name:n,size:"sm+"}),e[0]=s,e[1]=n,e[2]=r):r=e[2];let l;e[3]!==n?(l=o.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;e[5]!==i?(a=i("home.homeGrid.loadingTile"),e[5]=i,e[6]=a):a=e[6];let c;e[7]!==a?(c=o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=o.jsxs("div",{className:"min-w-0 flex-1",children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let h;e[12]!==r||e[13]!==d?(h=o.jsxs("div",{className:"flex items-center gap-2.5",children:[r,d]}),e[12]=r,e[13]=d,e[14]=h):h=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[o.jsx(Pt,{className:"h-3 w-3/4"}),o.jsx(Pt,{className:"h-3 w-1/2"}),o.jsx(Pt,{className:"h-3 w-2/3"})]}),e[15]=u):u=e[15];let f;return e[16]!==h?(f=o.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[h,u]}),e[16]=h,e[17]=f):f=e[17],f}function kW(t){const e=z.c(13),{tile:s,prompts:n,isEditMode:i}=t,r=re(),{open:l,startBlank:a,dialog:c,starting:d}=O3(s.agentId),h=n.filter(jW),u=ww(s),f="flex h-full w-full flex-col gap-3 p-4";let p;e[0]!==u||e[1]!==a?(p=()=>{a(u?{panel:u}:void 0)},e[0]=u,e[1]=a,e[2]=p):p=e[2];const m=d||i;let g;e[3]!==r?(g=r("home.homeGrid.openChat"),e[3]=r,e[4]=g):g=e[4];let x;e[5]!==p||e[6]!==m||e[7]!==g?(x=o.jsx("button",{type:"button",onClick:p,disabled:m,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:g}),e[5]=p,e[6]=m,e[7]=g,e[8]=x):x=e[8];const b=h.length>0&&!i&&o.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:h.map(_=>o.jsx("button",{type:"button",onClick:()=>!i&&l(_),disabled:d,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:o.jsx("span",{className:"line-clamp-2",children:_.title})},_.promptName))});let y;return e[9]!==c||e[10]!==x||e[11]!==b?(y=o.jsxs("div",{className:f,children:[x,b,c]}),e[9]=c,e[10]=x,e[11]=b,e[12]=y):y=e[12],y}function jW(t){return!!t.promptName}function CW({isEditMode:t}){const e=re(),{org:s}=Be(),{isLoading:n,prompts:i,tiles:r}=a8(s.slug),l=i.filter(k=>!u4(k.agentId)),a=r.filter(k=>!u4(k.agentId)),c=D8()?.ids??[],d=new Set(c),h=I8(),u=gs(),f=cs(),p=new Set(a.map(k=>k.agentId)),m=new Map;for(const k of l){const j=m.get(k.agentId);j?j.push(k):m.set(k.agentId,[k])}const g=l.filter(k=>!p.has(k.agentId)),x=[...a.map(k=>({kind:"tile",id:mW(k),data:k})),...g.map(k=>({kind:"prompt",id:fW(k),data:k})),...I3.map(k=>({kind:"native",id:gw(k.id),data:k}))],b=new Map(x.map(k=>[k.id,k])),y=OK(x.map(k=>k.kind==="native"?{id:k.id,defaultSize:k.data.defaultSize,minSize:k.data.minSize,defaultHidden:k.data.defaultHidden}:{id:k.id,defaultSize:k.kind==="tile"?dW:hW,minSize:k.kind==="tile"?uW:void 0,pinned:d.has(k.data.agentId)})),_=k=>{h.apply(j=>j.filter(C=>C!==k)).catch(()=>ve.error(e("home.homeGrid.couldntRemoveFromHome")))},v=async k=>{if(a.filter(C=>C.agentId===k.agentId).length<=1){_(k.agentId);return}try{const N=(await u.call("COLLECTION_VIRTUAL_MCP_GET",{id:k.agentId})).item;if(!N)throw new Error("Agent not found");const T=ed(N.metadata?.ui),V=k.tileId?T.filter(A=>A.tileId!==k.tileId):T.filter(A=>A.connectionId!==k.connectionId||A.resourceUri!==k.resourceUri);await u.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:k.agentId,data:{metadata:{ui:{...N.metadata?.ui??{},homeTile:null,homeTiles:V}}}}),f.invalidateQueries({queryKey:Ge.homeNextActions(s.slug)})}catch{ve.error(e("home.homeGrid.couldntRemoveTile"))}},L=k=>{const j=b.get(k);if(j){if(j.kind==="native"){y.hideTile(k);return}if(!d.has(j.data.agentId)){y.hideTile(k);return}j.kind==="tile"?v(j.data):_(j.data.agentId)}},S=k=>{const j=b.get(k.id);if(!j)return null;if(j.kind==="native")return o.jsx(cW,{nativeId:j.data.id});if(j.kind==="tile"){const C=m.get(j.data.agentId)??[];return o.jsx(Hs,{fallback:o.jsx(kW,{tile:j.data,prompts:C,isEditMode:t}),children:o.jsx(P.Suspense,{fallback:o.jsx(SW,{icon:j.data.agentIcon,name:j.data.agentName}),children:o.jsx(yW,{tile:j.data,prompts:C,isEditMode:t,tileWidth:k.w})})})}return o.jsx(xW,{entry:j.data,isEditMode:t})};return n||y.isLoading?o.jsx(bW,{}):y.snapshot.visible.length===0&&!t?null:o.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:o.jsx(TK,{tiles:y.snapshot.visible,isEditMode:t,renderTile:S,onMove:y.moveTile,onResize:y.resizeTile,onRemove:L})})}function ea(t,e,s){const n=t.slice();return n.splice(s<0?n.length+s:s,0,n.splice(e,1)[0]),n}function NW(t,e){return t.reduce((s,n,i)=>{const r=e.get(n);return r&&(s[i]=r),s},Array(t.length))}function oh(t){return t!==null&&t>=0}function TW(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}function VW(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Sw=t=>{let{rects:e,activeIndex:s,overIndex:n,index:i}=t;const r=ea(e,n,s),l=e[i],a=r[i];return!a||!l?null:{x:a.left-l.left,y:a.top-l.top,scaleX:a.width/l.width,scaleY:a.height/l.height}},lh={scaleX:1,scaleY:1},X9=t=>{var e;let{activeIndex:s,activeNodeRect:n,index:i,rects:r,overIndex:l}=t;const a=(e=r[s])!=null?e:n;if(!a)return null;if(i===s){const d=r[l];return d?{x:0,y:s<l?d.top+d.height-(a.top+a.height):d.top-a.top,...lh}:null}const c=AW(r,i,s);return i>s&&i<=l?{x:0,y:-a.height-c,...lh}:i<s&&i>=l?{x:0,y:a.height+c,...lh}:{x:0,y:0,...lh}};function AW(t,e,s){const n=t[e],i=t[e-1],r=t[e+1];return n?s<e?i?n.top-(i.top+i.height):r?r.top-(n.top+n.height):0:r?r.top-(n.top+n.height):i?n.top-(i.top+i.height):0:0}const kw="Sortable",jw=Nt.createContext({activeIndex:-1,containerId:kw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sw,disabled:{draggable:!1,droppable:!1}});function Z9(t){let{children:e,id:s,items:n,strategy:i=Sw,disabled:r=!1}=t;const{active:l,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:h}=aw(),u=N0(kw,s),f=a.rect!==null,p=P.useMemo(()=>n.map(S=>typeof S=="object"&&"id"in S?S.id:S),[n]),m=l!=null,g=l?p.indexOf(l.id):-1,x=d?p.indexOf(d.id):-1,b=P.useRef(p),y=!TW(p,b.current),_=x!==-1&&g===-1||y,v=VW(r);Ei(()=>{y&&m&&h(p)},[y,p,m,h]),P.useEffect(()=>{b.current=p},[p]);const L=P.useMemo(()=>({activeIndex:g,containerId:u,disabled:v,disableTransforms:_,items:p,overIndex:x,useDragOverlay:f,sortedRects:NW(p,c),strategy:i}),[g,u,v.draggable,v.droppable,_,p,x,c,f,i]);return Nt.createElement(jw.Provider,{value:L},e)}const PW=t=>{let{id:e,items:s,activeIndex:n,overIndex:i}=t;return ea(s,n,i).indexOf(e)},EW=t=>{let{containerId:e,isSorting:s,wasDragging:n,index:i,items:r,newIndex:l,previousItems:a,previousContainerId:c,transition:d}=t;return!d||!n||a!==r&&i===l?!1:s?!0:l!==i&&e===c},RW={duration:200,easing:"ease"},Cw="transform",DW=Ri.Transition.toString({property:Cw,duration:0,easing:"linear"}),IW={roleDescription:"sortable"};function MW(t){let{disabled:e,index:s,node:n,rect:i}=t;const[r,l]=P.useState(null),a=P.useRef(s);return Ei(()=>{if(!e&&s!==a.current&&n.current){const c=i.current;if(c){const d=wd(n.current,{ignoreTransform:!0}),h={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(h.x||h.y)&&l(h)}}s!==a.current&&(a.current=s)},[e,s,n,i]),P.useEffect(()=>{r&&l(null)},[r]),r}function e1(t){let{animateLayoutChanges:e=EW,attributes:s,disabled:n,data:i,getNewIndex:r=PW,id:l,strategy:a,resizeObserverConfig:c,transition:d=RW}=t;const{items:h,containerId:u,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:g,overIndex:x,useDragOverlay:b,strategy:y}=P.useContext(jw),_=OW(n,p),v=h.indexOf(l),L=P.useMemo(()=>({sortable:{containerId:u,index:v,items:h},...i}),[u,i,v,h]),S=P.useMemo(()=>h.slice(h.indexOf(l)),[h,l]),{rect:w,node:k,isOver:j,setNodeRef:C}=cw({id:l,data:L,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:N,activatorEvent:T,activeNodeRect:V,attributes:A,setNodeRef:E,listeners:R,isDragging:D,over:I,setActivatorNodeRef:O,transform:F}=lw({id:l,data:L,attributes:{...IW,...s},disabled:_.draggable}),M=eH(C,E),$=!!N,B=$&&!m&&oh(f)&&oh(x),U=!b&&D,H=U&&B?F:null,K=B?H??(a??y)({rects:g,activeNodeRect:V,activeIndex:f,overIndex:x,index:v}):null,G=oh(f)&&oh(x)?r({id:l,items:h,activeIndex:f,overIndex:x}):v,Y=N?.id,X=P.useRef({activeId:Y,items:h,newIndex:G,containerId:u}),te=h!==X.current.items,se=e({active:N,containerId:u,isDragging:D,isSorting:$,id:l,index:v,items:h,newIndex:X.current.newIndex,previousItems:X.current.items,previousContainerId:X.current.containerId,transition:d,wasDragging:X.current.activeId!=null}),ne=MW({disabled:!se,index:v,node:k,rect:w});return P.useEffect(()=>{$&&X.current.newIndex!==G&&(X.current.newIndex=G),u!==X.current.containerId&&(X.current.containerId=u),h!==X.current.items&&(X.current.items=h)},[$,G,u,h]),P.useEffect(()=>{if(Y===X.current.activeId)return;if(Y!=null&&X.current.activeId==null){X.current.activeId=Y;return}const q=setTimeout(()=>{X.current.activeId=Y},50);return()=>clearTimeout(q)},[Y]),{active:N,activeIndex:f,attributes:A,data:L,rect:w,index:v,newIndex:G,items:h,isOver:j,isSorting:$,isDragging:D,listeners:R,node:k,overIndex:x,over:I,setNodeRef:M,setActivatorNodeRef:O,setDroppableNodeRef:C,setDraggableNodeRef:E,transform:ne??K,transition:Q()};function Q(){if(ne||te&&X.current.newIndex===v)return DW;if(!(U&&!q9(T)||!d)&&($||se))return Ri.Transition.toString({...d,property:Cw})}}function OW(t,e){var s,n;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(s=t?.draggable)!=null?s:e.draggable,droppable:(n=t?.droppable)!=null?n:e.droppable}}function Lf(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const $W=[Et.Down,Et.Right,Et.Up,Et.Left],t1=(t,e)=>{let{context:{active:s,collisionRect:n,droppableRects:i,droppableContainers:r,over:l,scrollableAncestors:a}}=e;if($W.includes(t.code)){if(t.preventDefault(),!s||!n)return;const c=[];r.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=i.get(u.id);if(f)switch(t.code){case Et.Down:n.top<f.top&&c.push(u);break;case Et.Up:n.top>f.top&&c.push(u);break;case Et.Left:n.left>f.left&&c.push(u);break;case Et.Right:n.left<f.left&&c.push(u);break}});const d=KL({collisionRect:n,droppableRects:i,droppableContainers:c});let h=HL(d,"id");if(h===l?.id&&d.length>1&&(h=d[1].id),h!=null){const u=r.get(s.id),f=r.get(h),p=f?i.get(f.id):null,m=f?.node.current;if(m&&p&&u&&f){const x=G9(m).some((S,w)=>a[w]!==S),b=Nw(u,f),y=BW(u,f),_=x||!b?{x:0,y:0}:{x:y?n.width-p.width:0,y:y?n.height-p.height:0},v={x:p.left,y:p.top};return _.x&&_.y?v:Gu(v,_)}}}};function Nw(t,e){return!Lf(t)||!Lf(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function BW(t,e){return!Lf(t)||!Lf(e)||!Nw(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function $3(t){const e=z.c(12),{isPinned:s,submitting:n,onClick:i,label:r}=t,l=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let a;e[0]!==l?(a=ie("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==s||e[3]!==n?(c=n?o.jsx(ct,{size:12,className:"animate-spin"}):s?o.jsx(fg,{size:14}):o.jsx(Ut,{size:14}),e[2]=s,e[3]=n,e[4]=c):c=e[4];let d;return e[5]!==s||e[6]!==r||e[7]!==i||e[8]!==n||e[9]!==a||e[10]!==c?(d=o.jsx("button",{type:"button",onClick:i,disabled:n,"aria-label":r,"aria-pressed":s,title:r,className:a,children:c}),e[5]=s,e[6]=r,e[7]=i,e[8]=n,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function zW(t){const e=z.c(32),{agent:s,home:n,curated:i}=t,{org:r}=Be();let l;e[0]!==s.id||e[1]!==r.id||e[2]!==r.slug?(l={connectionId:s.id,orgId:r.id,orgSlug:r.slug},e[0]=s.id,e[1]=r.id,e[2]=r.slug,e[3]=l):l=e[3];const a=Qt(l);let c;e[4]!==s.id||e[5]!==r.id?(c=Ge.agentPrompts(r.id,s.id),e[4]=s.id,e[5]=r.id,e[6]=c):c=e[6];let d;e[7]!==a?(d=async()=>{const{prompts:L}=await a.listPrompts();return L.map(KW)},e[7]=a,e[8]=d):d=e[8];let h;e[9]!==c||e[10]!==d?(h={queryKey:c,queryFn:d,staleTime:3e4,retry:!1},e[9]=c,e[10]=d,e[11]=h):h=e[11];const{data:u,isLoading:f,error:p}=Tt(h),m=a8(r.slug);let g,x;if(e[12]!==s.id||e[13]!==u||e[14]!==m.prompts){let L;e[17]!==s.id?(L=w=>w.agentId===s.id&&w.promptName,e[17]=s.id,e[18]=L):L=e[18],g=m.prompts.filter(L).map(HW);let S;e[19]!==u?(S=u??[],e[19]=u,e[20]=S):S=e[20],x=[...S];for(const w of g)x.some(k=>k.name===w.name)||x.push(w);e[12]=s.id,e[13]=u,e[14]=m.prompts,e[15]=g,e[16]=x}else g=e[15],x=e[16];if(f&&g.length===0){let L;return e[21]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(Pt,{className:"h-7 w-full"}),o.jsx(Pt,{className:"h-7 w-2/3"})]}),e[21]=L):L=e[21],L}if(p&&g.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(x.length===0)return null;let b;e[22]!==i||e[23]!==x?(b=i??x.map(UW),e[22]=i,e[23]=x,e[24]=b):b=e[24];let y;e[25]!==b?(y=new Set(b),e[25]=b,e[26]=y):y=e[26];const _=y;let v;return e[27]!==s||e[28]!==n||e[29]!==x||e[30]!==_?(v=o.jsx("div",{className:"flex flex-col gap-0.5",children:x.map(L=>o.jsx(WW,{agent:s,home:n,prompt:L,allPromptNames:x.map(FW),isPinned:_.has(L.name)},L.name))}),e[27]=s,e[28]=n,e[29]=x,e[30]=_,e[31]=v):v=e[31],v}function FW(t){return t.name}function UW(t){return t.name}function HW(t){return{name:t.promptName,title:t.title,description:t.description}}function KW(t){return{name:t.name,title:t.title,description:t.description}}function WW({agent:t,home:e,prompt:s,allPromptNames:n,isPinned:i}){const r=re(),[l,a]=P.useState(!1),c=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){ve.error(r("home.agentPromptList.homeIsFull",{limit:Sd}));return}a(!0);try{const d=t.metadata?.ui?.homePrompts;let h;Array.isArray(d)?h=i?d.filter(f=>f!==s.name):[...d,s.name]:h=i?n.filter(f=>f!==s.name):n;const u={instructions:t.metadata.instructions,ui:{...t.metadata?.ui??{},homePrompts:h}};await e.saveAgentMetadata(t,u)}catch(d){console.error("[home-tiles] failed to toggle prompt",d),ve.error(r("home.agentPromptList.couldntUpdateHome"))}finally{a(!1)}};return o.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??Wl(s.name)}),o.jsx($3,{isPinned:i,submitting:l,onClick:c,label:r(i?"home.agentPromptList.removeFromHome":"home.agentPromptList.addToHome")})]})}function B3(t){const e=z.c(7),{title:s,hint:n}=t;let i;e[0]!==s?(i=o.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=n&&o.jsx("span",{className:"text-xs text-muted-foreground",children:n}),e[2]=n,e[3]=r):r=e[3];let l;return e[4]!==i||e[5]!==r?(l=o.jsxs("div",{className:"flex items-center justify-between px-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=l):l=e[6],l}const qW={tasks:vi,coding:ci,analytics:H8,sales:Eg,"recent-conversations":hg};function GW(){const t=z.c(19),e=re(),{layout:s,commitLayout:n}=N3();let i;t[0]!==s.hidden?(i=new Set(s.hidden),t[0]=s.hidden,t[1]=i):i=t[1];const r=i;let l;t[2]!==s.shown?(l=s.shown??[],t[2]=s.shown,t[3]=l):l=t[3];let a;t[4]!==l?(a=new Set(l),t[4]=l,t[5]=a):a=t[5];const c=a;let d;t[6]!==e?(d=e("home.nativeTilesSection.builtInTiles"),t[6]=e,t[7]=d):d=t[7];let h;t[8]!==d?(h=o.jsx(B3,{title:d}),t[8]=d,t[9]=h):h=t[9];let u;t[10]!==n||t[11]!==r||t[12]!==s||t[13]!==c||t[14]!==e?(u=I3.map(p=>{const m=gw(p.id),g=p.defaultHidden?c.has(m)&&!r.has(m):!r.has(m),x=qW[p.id]??hg,b=()=>{if(p.defaultHidden){n({...s,hidden:s.hidden.filter(y=>y!==m),shown:g?(s.shown??[]).filter(y=>y!==m):[...s.shown??[],m]});return}n({...s,hidden:g?[...s.hidden,m]:s.hidden.filter(y=>y!==m)})};return o.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 px-3 py-2.5",children:[o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:o.jsx(x,{size:16})}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:e(p.titleKey)}),o.jsxs(me,{type:"button",size:"sm",variant:g?"outline":"special",className:"h-8 gap-1.5",onClick:b,children:[g?o.jsx(fg,{size:14}):o.jsx(Ut,{size:14}),e(g?"home.nativeTilesSection.remove":"home.nativeTilesSection.add")]})]},p.id)}),t[10]=n,t[11]=r,t[12]=s,t[13]=c,t[14]=e,t[15]=u):u=t[15];let f;return t[16]!==h||t[17]!==u?(f=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[h,u]}),t[16]=h,t[17]=u,t[18]=f):f=t[18],f}function YW(t,e,s){const n={};for(const[i,r]of Object.entries(t)){const l=e[i]?.type;if((l==="object"||l==="array")&&typeof r=="string"){if(!r.trim())continue;try{n[i]=JSON.parse(r)}catch{return null}}else if((l==="number"||l==="integer")&&(typeof r=="string"||typeof r=="number")){if(typeof r=="string"&&!r.trim())continue;const a=typeof r=="string"?Number(r):r;if(!Number.isFinite(a)||l==="integer"&&!Number.isInteger(a))return null;n[i]=a}else if(typeof r=="string"){if(!r.trim())continue;n[i]=r}else r!=null&&(n[i]=r)}return s?.some(i=>!(i in n))?null:n}function JW(t,e){if(!t||!e)return{};const s={};for(const[n,i]of Object.entries(t)){const r=e[n]?.type;(r==="object"||r==="array")&&i!=null&&typeof i!="string"?s[n]=JSON.stringify(i,null,2):s[n]=i}return s}function QW(t){if(!t)return"";const e=Object.entries(t).filter(([,s])=>s!=null&&s!=="");return e.length===0?"":e.slice(0,3).map(([s,n])=>{const i=typeof n=="object"?JSON.stringify(n):String(n);return`${s}=${i.length>20?`${i.slice(0,20)}…`:i}`}).join(", ")}function XW(t){const e=z.c(11),{properties:s,required:n,values:i,onChange:r}=t;let l;e[0]!==n?(l=n??[],e[0]=n,e[1]=l):l=e[1];let a;e[2]!==l?(a=new Set(l),e[2]=l,e[3]=a):a=e[3];const c=a;let d;e[4]!==s?(d=Object.entries(s),e[4]=s,e[5]=d):d=e[5];let h;return e[6]!==r||e[7]!==c||e[8]!==d||e[9]!==i?(h=o.jsx("div",{className:"flex flex-col gap-2",children:d.map(u=>{const[f,p]=u;return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-xs font-medium leading-none flex items-center gap-1",children:[f,c.has(f)&&o.jsx("span",{className:"text-destructive text-[10px]",children:"*"})]}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:p.type})]}),p.description&&o.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:p.description}),o.jsx(ZW,{type:p.type,fieldKey:f,value:i[f],onChange:m=>r(f,m)})]},f)})}),e[6]=r,e[7]=c,e[8]=d,e[9]=i,e[10]=h):h=e[10],h}function ZW(t){const e=z.c(40),{type:s,fieldKey:n,value:i,onChange:r}=t,l=re();if(s==="object"||s==="array"){const u=i??"";let f;e[0]!==r?(f=g=>r(g.target.value),e[0]=r,e[1]=f):f=e[1];let p;e[2]!==n||e[3]!==l?(p=l("common.toolInputForm.jsonPlaceholder",{fieldKey:n}),e[2]=n,e[3]=l,e[4]=p):p=e[4];let m;return e[5]!==u||e[6]!==f||e[7]!==p?(m=o.jsx(ho,{className:"font-mono text-xs h-16",value:u,onChange:f,placeholder:p,rows:2}),e[5]=u,e[6]=f,e[7]=p,e[8]=m):m=e[8],m}if(s==="boolean"){const u=i!=null?String(i):"";let f;e[9]!==r?(f=L=>r(L==="true"),e[9]=r,e[10]=f):f=e[10];let p;e[11]!==l?(p=l("common.toolInputForm.selectPlaceholder"),e[11]=l,e[12]=p):p=e[12];let m;e[13]!==p?(m=o.jsx(js,{className:"h-7 text-xs",children:o.jsx(As,{placeholder:p})}),e[13]=p,e[14]=m):m=e[14];let g;e[15]!==l?(g=l("common.toolInputForm.true"),e[15]=l,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(Dt,{value:"true",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==l?(b=l("common.toolInputForm.false"),e[19]=l,e[20]=b):b=e[20];let y;e[21]!==b?(y=o.jsx(Dt,{value:"false",children:b}),e[21]=b,e[22]=y):y=e[22];let _;e[23]!==x||e[24]!==y?(_=o.jsxs(Cs,{children:[x,y]}),e[23]=x,e[24]=y,e[25]=_):_=e[25];let v;return e[26]!==u||e[27]!==f||e[28]!==m||e[29]!==_?(v=o.jsxs(ks,{value:u,onValueChange:f,children:[m,_]}),e[26]=u,e[27]=f,e[28]=m,e[29]=_,e[30]=v):v=e[30],v}const a=i??"";let c;e[31]!==r?(c=u=>r(u.target.value),e[31]=r,e[32]=c):c=e[32];let d;e[33]!==n||e[34]!==l?(d=l("common.toolInputForm.enterPlaceholder",{fieldKey:n}),e[33]=n,e[34]=l,e[35]=d):d=e[35];let h;return e[36]!==a||e[37]!==c||e[38]!==d?(h=o.jsx(gt,{className:"h-7 text-xs",value:a,onChange:c,placeholder:d}),e[36]=a,e[37]=c,e[38]=d,e[39]=h):h=e[39],h}const Sd=8;function J5(t,e,s){return t.includes(e)||(s?t.filter(i=>s.has(i)).length:t.length)>=Sd?null:[...t,e]}function eq(t){const e=z.c(29),{open:s,onOpenChange:n}=t,[i,r]=P.useState(""),l=re();let a;e[0]!==l?(a=l("home.addTileDrawer.title"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=o.jsx(P6,{children:a}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("home.addTileDrawer.description"),e[4]=l,e[5]=d):d=e[5];let h;e[6]!==d?(h=o.jsx(hT,{children:d}),e[6]=d,e[7]=h):h=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(l0,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=v=>r(v.target.value),e[9]=f):f=e[9];let p;e[10]!==l?(p=l("home.addTileDrawer.searchPlaceholder"),e[10]=l,e[11]=p):p=e[11];let m;e[12]!==i||e[13]!==p?(m=o.jsxs("div",{className:"relative mt-3",children:[u,o.jsx(gt,{value:i,onChange:f,placeholder:p,className:"pl-8 h-8 text-sm"})]}),e[12]=i,e[13]=p,e[14]=m):m=e[14];let g;e[15]!==c||e[16]!==h||e[17]!==m?(g=o.jsxs(E6,{className:"px-5 py-4 border-b border-border",children:[c,h,m]}),e[15]=c,e[16]=h,e[17]=m,e[18]=g):g=e[18];let x;e[19]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Lq,{}),e[19]=x):x=e[19];let b;e[20]!==i?(b=o.jsx(yl,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"p-3 flex flex-col gap-4",children:o.jsx(P.Suspense,{fallback:x,children:o.jsx(sq,{search:i})})})}),e[20]=i,e[21]=b):b=e[21];let y;e[22]!==b||e[23]!==g?(y=o.jsxs(R6,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[g,b]}),e[22]=b,e[23]=g,e[24]=y):y=e[24];let _;return e[25]!==n||e[26]!==s||e[27]!==y?(_=o.jsx(D6,{open:s,onOpenChange:n,children:y}),e[25]=n,e[26]=s,e[27]=y,e[28]=_):_=e[28],_}function tq(t){const e=z.c(31),{org:s}=Be(),n=D8();let i;e[0]!==n?.ids?(i=n?.ids??[],e[0]=n?.ids,e[1]=i):i=e[1];const r=i,l=I8(),a=u9(),c=cs();let d;e[2]!==s||e[3]!==c?(d=()=>c.refetchQueries({queryKey:Ge.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=c,e[4]=d):d=e[4];const h=d;let u;e[5]!==r?(u=j=>r.includes(j),e[5]=r,e[6]=u):u=e[6];const f=u;let p;e[7]!==r||e[8]!==t?(p=t?r.filter(j=>t.has(j)).length:r.length,e[7]=r,e[8]=t,e[9]=p):p=e[9];const m=p,g=m>=Sd;let x;e[10]!==t||e[11]!==l?(x=j=>l.apply(C=>J5(C,j,t)),e[10]=t,e[11]=l,e[12]=x):x=e[12];const b=x;let y;e[13]!==l?(y=j=>l.apply(C=>C.filter(N=>N!==j)),e[13]=l,e[14]=y):y=e[14];const _=y;let v;e[15]!==l?(v=j=>l.apply(()=>j),e[15]=l,e[16]=v):v=e[16];const L=v;let S;e[17]!==a||e[18]!==h||e[19]!==t||e[20]!==l?(S=async(j,C)=>{await a.update.mutateAsync({id:j.id,data:{metadata:C}}),await l.apply(N=>J5(N,j.id,t)),await h()},e[17]=a,e[18]=h,e[19]=t,e[20]=l,e[21]=S):S=e[21];const w=S;let k;return e[22]!==b||e[23]!==g||e[24]!==r||e[25]!==f||e[26]!==m||e[27]!==_||e[28]!==L||e[29]!==w?(k={homeIds:r,liveCount:m,isOnHome:f,atLimit:g,addAgent:b,removeAgent:_,reorder:L,saveAgentMetadata:w},e[22]=b,e[23]=g,e[24]=r,e[25]=f,e[26]=m,e[27]=_,e[28]=L,e[29]=w,e[30]=k):k=e[30],k}function sq(t){const e=z.c(24),{search:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={pageSize:1e3},e[0]=n):n=e[0];const i=fa(n);let r;e[1]!==i?(r=new Set(i.map(lq)),e[1]=i,e[2]=r):r=e[2];const l=tq(r);let a,c,d;if(e[3]!==i||e[4]!==l||e[5]!==s){const x=new Map(i.map(oq));a=s.trim().toLowerCase();const b=v=>!a||v.title?.toLowerCase().includes(a);c=l.homeIds.map(v=>x.get(v)).filter(rq).filter(b);const y=kg(i);let _;e[9]!==l?(_=v=>!l.isOnHome(v.id),e[9]=l,e[10]=_):_=e[10],d=i.filter(iq).filter(v=>!y.has(v.id)).filter(_).filter(b).sort(nq),e[3]=i,e[4]=l,e[5]=s,e[6]=a,e[7]=c,e[8]=d}else a=e[6],c=e[7],d=e[8];const h=d;let u;e[11]!==l||e[12]!==c?(u=o.jsx(aq,{home:l,agents:c}),e[11]=l,e[12]=c,e[13]=u):u=e[13];let f;e[14]!==a?(f=!a&&o.jsx(GW,{}),e[14]=a,e[15]=f):f=e[15];const p=!!a;let m;e[16]!==h||e[17]!==l||e[18]!==p?(m=o.jsx(dq,{home:l,agents:h,hasSearch:p}),e[16]=h,e[17]=l,e[18]=p,e[19]=m):m=e[19];let g;return e[20]!==u||e[21]!==f||e[22]!==m?(g=o.jsxs(o.Fragment,{children:[u,f,m]}),e[20]=u,e[21]=f,e[22]=m,e[23]=g):g=e[23],g}function nq(t,e){return(t.title??"").localeCompare(e.title??"")}function iq(t){return t.id&&!tf(t.id)}function rq(t){return!!t}function oq(t){return[t.id,t]}function lq(t){return t.id}function aq(t){const e=z.c(19),{home:s,agents:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={activationConstraint:{distance:5}},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={coordinateGetter:t1},e[1]=r):r=e[1];const l=T0(vr(wa,i),vr(La,r)),a=re();let c;e[2]!==s||e[3]!==a?(c=g=>{const{active:x,over:b}=g;if(!b||x.id===b.id)return;const y=s.homeIds,_=y.indexOf(x.id),v=y.indexOf(b.id);_===-1||v===-1||s.reorder(ea([...y],_,v)).catch(()=>ve.error(a("home.addTileDrawer.reorderError")))},e[2]=s,e[3]=a,e[4]=c):c=e[4];const d=c;let h;e[5]!==a?(h=a("home.addTileDrawer.onHomeTitle"),e[5]=a,e[6]=h):h=e[6];const u=`${s.liveCount}/${Sd}`;let f;e[7]!==h||e[8]!==u?(f=o.jsx(B3,{title:h,hint:u}),e[7]=h,e[8]=u,e[9]=f):f=e[9];let p;e[10]!==n||e[11]!==d||e[12]!==s||e[13]!==l||e[14]!==a?(p=n.length===0?o.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:a("home.addTileDrawer.noAgentsOnHome")}):o.jsx(A0,{sensors:l,collisionDetection:A3,onDragEnd:d,children:o.jsx(Z9,{items:n.map(cq),strategy:X9,children:o.jsx("div",{className:"flex flex-col gap-1",children:n.map(g=>o.jsx(fq,{agent:g,home:s},g.id))})})}),e[10]=n,e[11]=d,e[12]=s,e[13]=l,e[14]=a,e[15]=p):p=e[15];let m;return e[16]!==f||e[17]!==p?(m=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[f,p]}),e[16]=f,e[17]=p,e[18]=m):m=e[18],m}function cq(t){return t.id}function dq(t){const e=z.c(7),{home:s,agents:n,hasSearch:i}=t,[r,l]=P.useState(20),a=n.slice(0,r),c=re(),d="flex flex-col gap-1.5";let h;e[0]!==c?(h=c("home.addTileDrawer.addToHomeTitle"),e[0]=c,e[1]=h):h=e[1];let u;e[2]!==h?(u=o.jsx(B3,{title:h}),e[2]=h,e[3]=u):u=e[3];const f=n.length===0?o.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:c(i?"home.addTileDrawer.noAgentsMatch":"home.addTileDrawer.allAgentsOnHome")}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex flex-col gap-1",children:a.map(m=>o.jsx(pq,{agent:m,home:s},m.id))}),n.length>r&&o.jsx("button",{type:"button",onClick:()=>l(uq),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:c("home.addTileDrawer.loadMore",{count:n.length-r})})]});let p;return e[4]!==u||e[5]!==f?(p=o.jsxs("div",{className:d,children:[u,f]}),e[4]=u,e[5]=f,e[6]=p):p=e[6],p}function uq(t){return t+20}function Tw(t){const e=z.c(14),s=re();let n;e[0]!==t.metadata?.ui?(n=ed(t.metadata?.ui).filter(hq),e[0]=t.metadata?.ui,e[1]=n):n=e[1];const i=n.length,r=t.metadata?.ui?.homePrompts,l=Array.isArray(r)?r.length:null;let a;if(e[2]!==l||e[3]!==s||e[4]!==i){if(a=[],i>0){let c;e[6]!==s||e[7]!==i?(c=s("home.addTileDrawer.tileCountLabel",{count:i}),e[6]=s,e[7]=i,e[8]=c):c=e[8],a.push(c)}if(l!==null&&l>0){let c;e[9]!==l||e[10]!==s?(c=s("home.addTileDrawer.promptCountLabel",{count:l}),e[9]=l,e[10]=s,e[11]=c):c=e[11],a.push(c)}if(l===0){let c;e[12]!==s?(c=s("home.addTileDrawer.promptsOffLabel"),e[12]=s,e[13]=c):c=e[13],a.push(c)}e[2]=l,e[3]=s,e[4]=i,e[5]=a}else a=e[5];return a.join(" · ")}function hq(t){return!!t.resourceUri}function fq(t){const e=z.c(70),{agent:s,home:n}=t,[i,r]=P.useState(!1),l=re();let a;e[0]!==s.id?(a={id:s.id},e[0]=s.id,e[1]=a):a=e[1];const{attributes:c,listeners:d,setNodeRef:h,transform:u,transition:f,isDragging:p}=e1(a),m=Tw(s)||l("home.addTileDrawer.quickAccess"),g=`home-agent-expansion-${s.id}`;let x;e[2]!==u?(x=Ri.Transform.toString(u),e[2]=u,e[3]=x):x=e[3];const b=p?.5:void 0,y=p?100:void 0;let _;e[4]!==x||e[5]!==b||e[6]!==y||e[7]!==f?(_={transform:x,transition:f,opacity:b,zIndex:y},e[4]=x,e[5]=b,e[6]=y,e[7]=f,e[8]=_):_=e[8];const v=_,L=p&&"shadow-lg";let S;e[9]!==L?(S=ie("rounded-lg border border-border bg-card",L),e[9]=L,e[10]=S):S=e[10];const w=s.title??s.id;let k;e[11]!==l||e[12]!==w?(k=l("home.addTileDrawer.dragToReorder",{name:w}),e[11]=l,e[12]=w,e[13]=k):k=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(fd,{size:14}),e[14]=j):j=e[14];let C;e[15]!==c||e[16]!==d||e[17]!==k?(C=o.jsx("button",{type:"button",...c,...d,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":k,children:j}),e[15]=c,e[16]=d,e[17]=k,e[18]=C):C=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=()=>r(mq),e[19]=N):N=e[19];const T=s.title??s.id;let V;e[20]!==s.icon||e[21]!==T?(V=o.jsx(mi,{icon:s.icon,name:T,size:"sm"}),e[20]=s.icon,e[21]=T,e[22]=V):V=e[22];const A=s.title??s.id;let E;e[23]!==A?(E=o.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:A}),e[23]=A,e[24]=E):E=e[24];let R;e[25]!==m?(R=o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:m}),e[25]=m,e[26]=R):R=e[26];let D;e[27]!==E||e[28]!==R?(D=o.jsxs("div",{className:"min-w-0 flex-1",children:[E,R]}),e[27]=E,e[28]=R,e[29]=D):D=e[29];const I=i&&"rotate-180";let O;e[30]!==I?(O=ie("shrink-0 text-muted-foreground transition-transform",I),e[30]=I,e[31]=O):O=e[31];let F;e[32]!==O?(F=o.jsx(Gt,{size:16,className:O}),e[32]=O,e[33]=F):F=e[33];let M;e[34]!==i||e[35]!==g||e[36]!==V||e[37]!==D||e[38]!==F?(M=o.jsxs("button",{type:"button",onClick:N,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,"aria-controls":g,children:[V,D,F]}),e[34]=i,e[35]=g,e[36]=V,e[37]=D,e[38]=F,e[39]=M):M=e[39];let $;e[40]!==s.id||e[41]!==n||e[42]!==l?($=()=>n.removeAgent(s.id).catch(()=>ve.error(l("home.addTileDrawer.removeError"))),e[40]=s.id,e[41]=n,e[42]=l,e[43]=$):$=e[43];const B=s.title??s.id;let U;e[44]!==l||e[45]!==B?(U=l("home.addTileDrawer.removeAgentFromHome",{name:B}),e[44]=l,e[45]=B,e[46]=U):U=e[46];const H=s.title??s.id;let W;e[47]!==l||e[48]!==H?(W=l("home.addTileDrawer.removeAgentFromHome",{name:H}),e[47]=l,e[48]=H,e[49]=W):W=e[49];let K;e[50]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(Is,{size:14}),e[50]=K):K=e[50];let G;e[51]!==$||e[52]!==U||e[53]!==W?(G=o.jsx("button",{type:"button",onClick:$,"aria-label":U,title:W,className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:K}),e[51]=$,e[52]=U,e[53]=W,e[54]=G):G=e[54];let Y;e[55]!==C||e[56]!==M||e[57]!==G?(Y=o.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[C,M,G]}),e[55]=C,e[56]=M,e[57]=G,e[58]=Y):Y=e[58];let X;e[59]!==s||e[60]!==i||e[61]!==g||e[62]!==n?(X=i&&o.jsx(Vw,{id:g,agent:s,home:n}),e[59]=s,e[60]=i,e[61]=g,e[62]=n,e[63]=X):X=e[63];let te;return e[64]!==h||e[65]!==v||e[66]!==Y||e[67]!==X||e[68]!==S?(te=o.jsxs("div",{ref:h,style:v,className:S,children:[Y,X]}),e[64]=h,e[65]=v,e[66]=Y,e[67]=X,e[68]=S,e[69]=te):te=e[69],te}function mq(t){return!t}function pq({agent:t,home:e}){const[s,n]=P.useState(!1),[i,r]=P.useState(!1),l=Tw(t),a=re(),c=`available-agent-expansion-${t.id}`,d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{ve.error(a("home.addTileDrawer.addError"))}finally{r(!1)}}};return o.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[o.jsxs("button",{type:"button",onClick:()=>n(h=>!h),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,"aria-controls":c,children:[o.jsx(mi,{icon:t.icon,name:t.title??t.id,size:"sm"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),l&&o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:l})]}),o.jsx(Gt,{size:16,className:ie("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),o.jsx("button",{type:"button",onClick:d,disabled:i||e.atLimit,"aria-label":a("home.addTileDrawer.addToHomeTitle"),title:e.atLimit?a("home.addTileDrawer.homeFullMessage",{limit:Sd}):a("home.addTileDrawer.addToHomeTitle"),className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:i?o.jsx(ct,{size:12,className:"animate-spin"}):o.jsx(Ut,{size:14})})]}),s&&o.jsx(Vw,{id:c,agent:t,home:e})]})}function Vw(t){const e=z.c(18),{id:s,agent:n,home:i}=t,r=n.metadata?.ui;let l;e[0]!==r?(l=ed(r),e[0]=r,e[1]=l):l=e[1];const a=l;let c;e[2]!==n.connections?(c=(n.connections??[]).map(gq).sort(),e[2]=n.connections,e[3]=c):c=e[3];const d=c,h=n.metadata?.ui?.homePrompts;let u;e[4]!==n||e[5]!==d||e[6]!==i||e[7]!==a?(u=o.jsx(bq,{agent:n,home:i,connectionIds:d,pinnedTiles:a}),e[4]=n,e[5]=d,e[6]=i,e[7]=a,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(xq,{}),e[9]=f):f=e[9];const p=h??null;let m;e[10]!==n||e[11]!==i||e[12]!==p?(m=o.jsx(P.Suspense,{fallback:f,children:o.jsx(zW,{agent:n,home:i,curated:p})}),e[10]=n,e[11]=i,e[12]=p,e[13]=m):m=e[13];let g;return e[14]!==s||e[15]!==u||e[16]!==m?(g=o.jsxs("div",{id:s,className:"border-t border-border px-3 py-2 flex flex-col gap-3",children:[u,m]}),e[14]=s,e[15]=u,e[16]=m,e[17]=g):g=e[17],g}function gq(t){return t.connection_id}function xq(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[o.jsx(Pt,{className:"h-8 w-full"}),o.jsx(Pt,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function bq({agent:t,home:e,connectionIds:s,pinnedTiles:n}){const i=re(),r=gs(),{data:l,isLoading:a}=Tt({queryKey:Ge.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async f=>{try{const{item:p}=await r.call("COLLECTION_CONNECTIONS_GET",{id:f}),m=(p?.tools??[]).flatMap(g=>{const x=j9(g._meta);return x?[{name:g.name,description:g.description,resourceUri:x,inputSchema:g.inputSchema}]:[]});return{id:f,title:p?.title??f,icon:p?.icon??null,uiTools:m}}catch{return{id:f,title:f,icon:null,uiTools:[]}}}))).filter(f=>f.uiTools.length>0)});if(s.length===0)return null;if(a)return o.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[o.jsx(Pt,{className:"h-7 w-full"}),o.jsx(Pt,{className:"h-7 w-2/3"})]});if(!l||l.length===0)return null;const c=new Map;for(const u of l)for(const f of u.uiTools)c.set(`${u.id}:${f.name}`,{conn:u,tool:f});const d=u=>{if(u.toolName&&u.connectionId)return c.get(`${u.connectionId}:${u.toolName}`);for(const[,f]of c)if(f.conn.id===u.connectionId&&f.tool.resourceUri===u.resourceUri)return f},h=n.some(u=>!!d(u));return o.jsxs("div",{className:"flex flex-col gap-2",children:[h&&o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:i("home.addTileDrawer.pinnedTiles")}),n.map(u=>{const f=d(u);return f?o.jsx(vq,{agent:t,home:e,connection:f.conn,tool:f.tool,tile:u},u.tileId??`${u.connectionId}:${u.resourceUri}:${u.toolName}`):null})]}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:i("home.addTileDrawer.addTileLabel")}),l.map(u=>u.uiTools.map(f=>o.jsx(_q,{agent:t,home:e,connection:u,tool:f},`add:${u.id}:${f.name}`)))]})]})}function jp(t,e){return{instructions:t.metadata.instructions,ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:e}}}async function Cp(t,e,s){try{await e()}catch(n){console.error(`[home-tiles] failed to ${t} tile`,n),ve.error(s("home.addTileDrawer.updateError"))}}function Aw(t,e,s,n){if(!e||Object.keys(e).length===0)return{};const i=YW(t,e,s);if(!i){ve.error(n("home.addTileDrawer.invalidFieldError"));return}return Object.keys(i).length>0?{toolInput:i}:{}}function Pw(t){const e=z.c(23),{properties:s,required:n,values:i,onChange:r,onCancel:l,onSubmit:a,submitting:c,submitLabel:d}=t,h=re();let u;e[0]!==r||e[1]!==s||e[2]!==n||e[3]!==i?(u=o.jsx(XW,{properties:s,required:n,values:i,onChange:r}),e[0]=r,e[1]=s,e[2]=n,e[3]=i,e[4]=u):u=e[4];let f;e[5]!==h?(f=h("home.addTileDrawer.cancel"),e[5]=h,e[6]=f):f=e[6];let p;e[7]!==l||e[8]!==f?(p=o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:l,children:f}),e[7]=l,e[8]=f,e[9]=p):p=e[9];let m;e[10]!==d||e[11]!==c?(m=c?o.jsx(ct,{size:12,className:"animate-spin"}):d,e[10]=d,e[11]=c,e[12]=m):m=e[12];let g;e[13]!==a||e[14]!==c||e[15]!==m?(g=o.jsx(me,{size:"sm",className:"h-7 text-xs",disabled:c,onClick:a,children:m}),e[13]=a,e[14]=c,e[15]=m,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=o.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[p,g]}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;return e[20]!==u||e[21]!==x?(b=o.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[u,x]}),e[20]=u,e[21]=x,e[22]=b):b=e[22],b}function vq(t){const e=z.c(57),{agent:s,home:n,connection:i,tool:r,tile:l}=t,[a,c]=P.useState(!1),[d,h]=P.useState(!1),u=re();let f;e[0]!==r.inputSchema?(f=r.inputSchema?.properties&&Object.keys(r.inputSchema.properties).length>0,e[0]=r.inputSchema,e[1]=f):f=e[1];const p=f;let m;e[2]!==l.toolInput||e[3]!==r.inputSchema?.properties?(m=()=>JW(l.toolInput,r.inputSchema?.properties),e[2]=l.toolInput,e[3]=r.inputSchema?.properties,e[4]=m):m=e[4];const[g,x]=P.useState(m);let b;e[5]!==s||e[6]!==n||e[7]!==u||e[8]!==l?(b=async()=>{c(!0),await Cp("remove",async()=>{const I=ed(s.metadata?.ui),O=l.tileId?I.filter(F=>F.tileId!==l.tileId):I.filter(F=>F!==l);await n.saveAgentMetadata(s,jp(s,O)),h(!1)},u),c(!1)},e[5]=s,e[6]=n,e[7]=u,e[8]=l,e[9]=b):b=e[9];const y=b;let _;e[10]!==s||e[11]!==g||e[12]!==n||e[13]!==u||e[14]!==l||e[15]!==r.inputSchema?.properties||e[16]!==r.inputSchema?.required?(_=async()=>{const I=Aw(g,r.inputSchema?.properties,r.inputSchema?.required,u);if(!I)return;const{toolInput:O}=I;c(!0),await Cp("save",async()=>{const M=ed(s.metadata?.ui).map($=>(l.tileId?$.tileId===l.tileId:$===l)?{...$,toolInput:O}:$);await n.saveAgentMetadata(s,jp(s,M)),h(!1)},u),c(!1)},e[10]=s,e[11]=g,e[12]=n,e[13]=u,e[14]=l,e[15]=r.inputSchema?.properties,e[16]=r.inputSchema?.required,e[17]=_):_=e[17];const v=_;let L;e[18]!==l.toolInput?(L=QW(l.toolInput),e[18]=l.toolInput,e[19]=L):L=e[19];const S=L;let w;e[20]!==i.icon||e[21]!==i.title?(w=o.jsx(Oi,{icon:i.icon,name:i.title,size:"xs"}),e[20]=i.icon,e[21]=i.title,e[22]=w):w=e[22];let k;e[23]!==r.name?(k=Wl(r.name),e[23]=r.name,e[24]=k):k=e[24];let j;e[25]!==k?(j=o.jsx("div",{className:"truncate text-sm text-foreground",children:k}),e[25]=k,e[26]=j):j=e[26];let C;e[27]!==S?(C=S&&o.jsx("div",{className:"truncate text-[10px] text-muted-foreground font-mono",children:S}),e[27]=S,e[28]=C):C=e[28];let N;e[29]!==j||e[30]!==C?(N=o.jsxs("div",{className:"min-w-0 flex-1",children:[j,C]}),e[29]=j,e[30]=C,e[31]=N):N=e[31];let T;e[32]!==p||e[33]!==u?(T=p&&o.jsx("button",{type:"button",onClick:()=>h(yq),"aria-label":u("home.addTileDrawer.configureTile"),title:u("home.addTileDrawer.configureTile"),className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60",children:o.jsx(vg,{size:14})}),e[32]=p,e[33]=u,e[34]=T):T=e[34];let V;e[35]!==u?(V=u("home.addTileDrawer.removeFromHome"),e[35]=u,e[36]=V):V=e[36];let A;e[37]!==y||e[38]!==a||e[39]!==V?(A=o.jsx($3,{isPinned:!0,submitting:a,onClick:y,label:V}),e[37]=y,e[38]=a,e[39]=V,e[40]=A):A=e[40];let E;e[41]!==N||e[42]!==T||e[43]!==A||e[44]!==w?(E=o.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[w,N,T,A]}),e[41]=N,e[42]=T,e[43]=A,e[44]=w,e[45]=E):E=e[45];let R;e[46]!==g||e[47]!==v||e[48]!==p||e[49]!==d||e[50]!==a||e[51]!==u||e[52]!==r.inputSchema?(R=d&&p&&r.inputSchema?.properties&&o.jsx(Pw,{properties:r.inputSchema.properties,required:r.inputSchema.required,values:g,onChange:(I,O)=>x(F=>({...F,[I]:O})),onCancel:()=>h(!1),onSubmit:v,submitting:a,submitLabel:u("home.addTileDrawer.save")}),e[46]=g,e[47]=v,e[48]=p,e[49]=d,e[50]=a,e[51]=u,e[52]=r.inputSchema,e[53]=R):R=e[53];let D;return e[54]!==E||e[55]!==R?(D=o.jsxs("div",{className:"flex flex-col rounded-md bg-accent/20",children:[E,R]}),e[54]=E,e[55]=R,e[56]=D):D=e[56],D}function yq(t){return!t}function _q(t){const e=z.c(44),{agent:s,home:n,connection:i,tool:r}=t,[l,a]=P.useState(!1),[c,d]=P.useState(!1),h=re();let u;e[0]!==r.inputSchema?(u=r.inputSchema?.properties&&Object.keys(r.inputSchema.properties).length>0,e[0]=r.inputSchema,e[1]=u):u=e[1];const f=u;let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p={},e[2]=p):p=e[2];const[m,g]=P.useState(p);let x,b;e[3]!==s||e[4]!==i.id||e[5]!==m||e[6]!==f||e[7]!==n||e[8]!==c||e[9]!==h||e[10]!==r.inputSchema?.properties||e[11]!==r.inputSchema?.required||e[12]!==r.name||e[13]!==r.resourceUri?(x=async()=>{if(f&&!c){d(!0);return}if(!n.isOnHome(s.id)&&n.atLimit){ve.error(h("home.addTileDrawer.homeFullMessage",{limit:Sd}));return}await b()},b=async()=>{const C=Aw(m,r.inputSchema?.properties,r.inputSchema?.required,h);if(!C)return;const{toolInput:N}=C;a(!0),await Cp("add",async()=>{const V=[...ed(s.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:i.id,resourceUri:r.resourceUri,toolName:r.name,...N?{toolInput:N}:{}}];await n.saveAgentMetadata(s,jp(s,V)),d(!1),g({})},h),a(!1)},e[3]=s,e[4]=i.id,e[5]=m,e[6]=f,e[7]=n,e[8]=c,e[9]=h,e[10]=r.inputSchema?.properties,e[11]=r.inputSchema?.required,e[12]=r.name,e[13]=r.resourceUri,e[14]=x,e[15]=b):(x=e[14],b=e[15]);let y;e[16]!==i.icon||e[17]!==i.title?(y=o.jsx(Oi,{icon:i.icon,name:i.title,size:"xs"}),e[16]=i.icon,e[17]=i.title,e[18]=y):y=e[18];let _;e[19]!==r.name?(_=Wl(r.name),e[19]=r.name,e[20]=_):_=e[20];let v;e[21]!==_?(v=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:_}),e[21]=_,e[22]=v):v=e[22];let L;e[23]!==h?(L=h("home.addTileDrawer.addToHomeTitle"),e[23]=h,e[24]=L):L=e[24];let S;e[25]!==x||e[26]!==l||e[27]!==L?(S=o.jsx($3,{isPinned:!1,submitting:l,onClick:x,label:L}),e[25]=x,e[26]=l,e[27]=L,e[28]=S):S=e[28];let w;e[29]!==y||e[30]!==v||e[31]!==S?(w=o.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[y,v,S]}),e[29]=y,e[30]=v,e[31]=S,e[32]=w):w=e[32];let k;e[33]!==m||e[34]!==f||e[35]!==b||e[36]!==c||e[37]!==l||e[38]!==h||e[39]!==r.inputSchema?(k=c&&f&&r.inputSchema?.properties&&o.jsx(Pw,{properties:r.inputSchema.properties,required:r.inputSchema.required,values:m,onChange:(C,N)=>g(T=>({...T,[C]:N})),onCancel:()=>{d(!1),g({})},onSubmit:b,submitting:l,submitLabel:h("home.addTileDrawer.pin")}),e[33]=m,e[34]=f,e[35]=b,e[36]=c,e[37]=l,e[38]=h,e[39]=r.inputSchema,e[40]=k):k=e[40];let j;return e[41]!==w||e[42]!==k?(j=o.jsxs("div",{className:"flex flex-col rounded-md hover:bg-accent/40",children:[w,k]}),e[41]=w,e[42]=k,e[43]=j):j=e[43],j}function Lq(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},wq)}),t[0]=e):e=t[0],e}function wq(t,e){return o.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[o.jsx(Pt,{className:"size-8 rounded-md"}),o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx(Pt,{className:"h-3 w-1/2"}),o.jsx(Pt,{className:"h-2.5 w-1/3"})]})]},e)}const Q5={active:0,future:1,closed:2};function X5(t){if(!t.startsAt)return null;const e=Date.parse(t.startsAt);return Number.isNaN(e)?null:e}function Sq(t,e){const s=Q5[t.state]-Q5[e.state];if(s!==0)return s;const n=X5(t),i=X5(e);if(n===null||i===null){if(n!==i)return n===null?1:-1}else if(n!==i)return t.state==="closed"?i-n:n-i;return t.name.localeCompare(e.name)||t.id.localeCompare(e.id)}function z3(t){return t.filter(s=>s.state==="active").sort(Sq)[0]?.id??null}const Np="__unassigned__",Tp="__no_repo__",wf="backlog",Ew="all",Xr="__any__",F3={assignee:null,priority:null,due:null,tags:[],repo:null,sprint:null,search:""};function kq(t,e){return t===Ew?null:t===wf||t!==null&&e.some(s=>s.id===t)?t:z3(e)}function Rw(t,e){return t.sprint!==null&&t.sprint!==e}function jq(t,e){return t.assignee!==null||t.priority!==null||t.due!==null||t.tags.length>0||t.repo!==null||Rw(t,e)||t.search.trim()!==""}function Cq(t,e){return(t.assignee!==null?1:0)+(t.priority!==null?1:0)+(t.due!==null?1:0)+(t.tags.length>0?1:0)+(t.repo!==null?1:0)+(Rw(t,e)?1:0)+(t.search.trim()!==""?1:0)}const Nq=864e5;function Tq(t,e){const s=new Date(t),n=new Date(e);return s.getFullYear()===n.getFullYear()&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate()}const Vq=/^0*(\d+)$/;function Dw(t,e,s){const n=t.trim();if(n==="")return!1;const i=s?.trim();if(i){if(n.toLowerCase()===i.toLowerCase())return!0;const r=Vq.exec(n)?.[1];return r!==void 0&&Number(r)===g4(i)}return e!=null&&g4(n)===e}function Aq(t,e){return t.assigneeId===e?!0:t.assigneeId===as&&t.assignedBy===e}function Pq(t,e){const s=e.search.trim().toLowerCase();if(s!==""&&!`${t.title} ${t.description??""}`.toLowerCase().includes(s)&&!Dw(s,t.keySeq,t.jiraIssueKey))return!1;if(e.assignee!==null){if(e.assignee===Np){if(t.assigneeId!==null)return!1}else if(!Aq(t,e.assignee))return!1}if(e.priority!==null&&t.priority!==e.priority)return!1;if(e.due!==null)if(e.due==="none"){if(t.dueDate)return!1}else{if(!t.dueDate)return!1;const n=new Date(t.dueDate).getTime(),i=Date.now();if(e.due==="overdue"&&n>=i||e.due==="today"&&!Tq(n,i)||e.due==="week"&&(n<i||n>i+7*Nq))return!1}if(e.tags.length>0){const n=t.tags.map(i=>i.id);if(!e.tags.some(i=>n.includes(i)))return!1}if(e.repo!==null){if(e.repo===Tp){if(t.repo!=null)return!1}else if(t.repo?.toLowerCase()!==e.repo.toLowerCase())return!1}if(e.sprint!==null){if(e.sprint===wf){if(t.sprintId!=null)return!1}else if(t.sprintId!==e.sprint)return!1}return!0}const Z5={overdue:"taskBoard.taskFilters.dueDateFilterOverdue",today:"taskBoard.taskFilters.dueDateFilterDueToday",week:"taskBoard.taskFilters.dueDateFilterDueThisWeek",none:"taskBoard.taskFilters.dueDateFilterNoDueDate"};function wl(t,e=!1){return ie("inline-flex h-8 items-center gap-1.5 rounded-lg border px-2.5 text-xs font-medium outline-none transition-colors focus-visible:border-ring focus-visible:ring-[2px] focus-visible:ring-ring/20",e&&"h-10 w-full justify-start px-3 text-sm",t?"border-transparent bg-accent text-foreground":"border-border text-muted-foreground hover:bg-muted/60 hover:text-foreground")}function Eq(t){const e=z.c(107),{value:s,members:n,onChange:i,block:r}=t,l=re(),[a,c]=P.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(of,{size:14,className:"shrink-0"}),e[0]=d):d=e[0];let h=d,u;e[1]!==l?(u=l("taskBoard.taskFilters.assigneeLabel"),e[1]=l,e[2]=u):u=e[2];let f=u;if(s===Np){let Q;e[3]!==l?(Q=l("taskBoard.taskFilters.assigneeUnassigned"),e[3]=l,e[4]=Q):Q=e[4],f=Q}else if(s===as){let Q;e[5]===Symbol.for("react.memo_cache_sentinel")?(Q=o.jsx(ui,{size:14}),e[5]=Q):Q=e[5],h=Q;let q;e[6]!==l?(q=l("taskBoard.taskFilters.assigneeSuperAgent"),e[6]=l,e[7]=q):q=e[7],f=q}else if(s){let Q,q,le,J;if(e[8]!==n||e[9]!==s){let he;e[14]!==s?(he=ae=>ae.userId===s,e[14]=s,e[15]=he):he=e[15],q=n.find(he),Q=Ps,le=q?.user?.image??void 0,J=bn(q?.user?.name),e[8]=n,e[9]=s,e[10]=Q,e[11]=q,e[12]=le,e[13]=J}else Q=e[10],q=e[11],le=e[12],J=e[13];let oe;e[16]!==Q||e[17]!==le||e[18]!==J?(oe=o.jsx(Q,{url:le,fallback:J,shape:"circle",size:"2xs"}),e[16]=Q,e[17]=le,e[18]=J,e[19]=oe):oe=e[19],h=oe;let ee;e[20]!==q?.user?.name||e[21]!==l?(ee=q?.user?.name??l("taskBoard.taskFilters.assigneeMember"),e[20]=q?.user?.name,e[21]=l,e[22]=ee):ee=e[22],f=ee}let p;e[23]!==i?(p=Q=>{i(Q),c(!1)},e[23]=i,e[24]=p):p=e[24];const m=p,g=s!==null;let x;e[25]!==r||e[26]!==g?(x=wl(g,r),e[25]=r,e[26]=g,e[27]=x):x=e[27];const b=x,y=r&&"ml-auto";let _;e[28]!==y?(_=ie("shrink-0 opacity-60",y),e[28]=y,e[29]=_):_=e[29];const v=_;let L;e[30]!==f?(L=o.jsx("span",{className:"max-w-[10rem] truncate",children:f}),e[30]=f,e[31]=L):L=e[31];let S;e[32]!==v?(S=o.jsx(Gt,{size:12,className:v}),e[32]=v,e[33]=S):S=e[33];let w;e[34]!==h||e[35]!==L||e[36]!==S||e[37]!==b?(w=o.jsx(ts,{asChild:!0,children:o.jsxs("button",{type:"button",className:b,children:[h,L,S]})}),e[34]=h,e[35]=L,e[36]=S,e[37]=b,e[38]=w):w=e[38];let k;e[39]!==l?(k=l("taskBoard.taskFilters.assigneeFilterPlaceholder"),e[39]=l,e[40]=k):k=e[40];let j;e[41]!==l?(j=l("taskBoard.taskFilters.assigneeFilterPlaceholder"),e[41]=l,e[42]=j):j=e[42];let C;e[43]!==k||e[44]!==j?(C=o.jsx(An,{placeholder:k,"aria-label":j,className:"h-9"}),e[43]=k,e[44]=j,e[45]=C):C=e[45];let N;e[46]!==l?(N=l("taskBoard.taskFilters.assigneeNoMembersFound"),e[46]=l,e[47]=N):N=e[47];let T;e[48]!==N?(T=o.jsx(hn,{children:N}),e[48]=N,e[49]=T):T=e[49];let V;e[50]!==l?(V=l("taskBoard.taskFilters.assigneeAnyone"),e[50]=l,e[51]=V):V=e[51];let A;e[52]!==m?(A=()=>m(null),e[52]=m,e[53]=A):A=e[53];let E;e[54]!==l?(E=l("taskBoard.taskFilters.assigneeAnyone"),e[54]=l,e[55]=E):E=e[55];let R;e[56]!==V||e[57]!==A||e[58]!==E?(R=o.jsx(Ft,{value:V,onSelect:A,children:E}),e[56]=V,e[57]=A,e[58]=E,e[59]=R):R=e[59];let D;e[60]!==l?(D=l("taskBoard.taskFilters.assigneeUnassigned"),e[60]=l,e[61]=D):D=e[61];let I;e[62]!==m?(I=()=>m(Np),e[62]=m,e[63]=I):I=e[63];let O;e[64]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(of,{size:16,className:"text-muted-foreground"}),e[64]=O):O=e[64];let F;e[65]!==l?(F=l("taskBoard.taskFilters.assigneeUnassigned"),e[65]=l,e[66]=F):F=e[66];let M;e[67]!==D||e[68]!==I||e[69]!==F?(M=o.jsxs(Ft,{value:D,onSelect:I,className:"gap-2",children:[O,F]}),e[67]=D,e[68]=I,e[69]=F,e[70]=M):M=e[70];let $;e[71]!==l?($=l("taskBoard.taskFilters.assigneeSuperAgent"),e[71]=l,e[72]=$):$=e[72];let B;e[73]!==m?(B=()=>m(as),e[73]=m,e[74]=B):B=e[74];let U;e[75]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(ui,{size:16}),e[75]=U):U=e[75];let H;e[76]!==l?(H=l("taskBoard.taskFilters.assigneeSuperAgent"),e[76]=l,e[77]=H):H=e[77];let W;e[78]!==$||e[79]!==B||e[80]!==H?(W=o.jsxs(Ft,{value:$,onSelect:B,className:"gap-2",children:[U,H]}),e[78]=$,e[79]=B,e[80]=H,e[81]=W):W=e[81];let K;e[82]!==R||e[83]!==M||e[84]!==W?(K=o.jsxs(os,{children:[R,M,W]}),e[82]=R,e[83]=M,e[84]=W,e[85]=K):K=e[85];let G;e[86]!==l?(G=l("taskBoard.taskFilters.assigneeGroupMembers"),e[86]=l,e[87]=G):G=e[87];let Y;if(e[88]!==n||e[89]!==m){let Q;e[91]!==m?(Q=q=>o.jsxs(Ft,{value:q.user?.name??q.userId,onSelect:()=>m(q.userId),className:"gap-2",children:[o.jsx(Ps,{url:q.user?.image??void 0,fallback:bn(q.user?.name),shape:"circle",size:"2xs"}),o.jsx("span",{className:"truncate",children:q.user?.name??q.userId})]},q.userId),e[91]=m,e[92]=Q):Q=e[92],Y=n.map(Q),e[88]=n,e[89]=m,e[90]=Y}else Y=e[90];let X;e[93]!==G||e[94]!==Y?(X=o.jsx(os,{heading:G,children:Y}),e[93]=G,e[94]=Y,e[95]=X):X=e[95];let te;e[96]!==T||e[97]!==K||e[98]!==X?(te=o.jsxs(Pn,{children:[T,K,X]}),e[96]=T,e[97]=K,e[98]=X,e[99]=te):te=e[99];let se;e[100]!==C||e[101]!==te?(se=o.jsx(ss,{align:"start",className:"w-56 p-0",children:o.jsxs(Fn,{children:[C,te]})}),e[100]=C,e[101]=te,e[102]=se):se=e[102];let ne;return e[103]!==a||e[104]!==w||e[105]!==se?(ne=o.jsxs(ns,{open:a,onOpenChange:c,children:[w,se]}),e[103]=a,e[104]=w,e[105]=se,e[106]=ne):ne=e[106],ne}function Rq(t){const e=z.c(33),{value:s,onChange:n,block:i}=t,r=re(),l=s!==null;let a;e[0]!==i||e[1]!==l?(a=wl(l,i),e[0]=i,e[1]=l,e[2]=a):a=e[2];const c=a,d=i&&"ml-auto";let h;e[3]!==d?(h=ie("shrink-0 opacity-60",d),e[3]=d,e[4]=h):h=e[4];const u=h;let f;e[5]!==s?(f=s?o.jsx("span",{className:ie("size-2 shrink-0 rounded-full",cn[s].dotClassName)}):o.jsx(f0,{size:14,className:"shrink-0"}),e[5]=s,e[6]=f):f=e[6];let p;e[7]!==r||e[8]!==s?(p=r(s?cn[s].labelKey:"taskBoard.taskFilters.priorityLabel"),e[7]=r,e[8]=s,e[9]=p):p=e[9];let m;e[10]!==u?(m=o.jsx(Gt,{size:12,className:u}),e[10]=u,e[11]=m):m=e[11];let g;e[12]!==f||e[13]!==p||e[14]!==m||e[15]!==c?(g=o.jsx(Bt,{asChild:!0,children:o.jsxs("button",{type:"button",className:c,children:[f,p,m]})}),e[12]=f,e[13]=p,e[14]=m,e[15]=c,e[16]=g):g=e[16];const x=s??Xr;let b;e[17]!==n?(b=w=>n(w===Xr?null:w),e[17]=n,e[18]=b):b=e[18];let y;e[19]!==r?(y=r("taskBoard.taskFilters.priorityAnyPriority"),e[19]=r,e[20]=y):y=e[20];let _;e[21]!==y?(_=o.jsx(Yn,{value:Xr,children:y}),e[21]=y,e[22]=_):_=e[22];let v;e[23]!==r?(v=m0.map(w=>o.jsxs(Yn,{value:w,className:"gap-2",children:[o.jsx("span",{className:ie("size-2 rounded-full",cn[w].dotClassName)}),r(cn[w].labelKey)]},w)),e[23]=r,e[24]=v):v=e[24];let L;e[25]!==b||e[26]!==_||e[27]!==v||e[28]!==x?(L=o.jsx(zt,{align:"start",className:"w-40",children:o.jsxs(Xc,{value:x,onValueChange:b,children:[_,v]})}),e[25]=b,e[26]=_,e[27]=v,e[28]=x,e[29]=L):L=e[29];let S;return e[30]!==L||e[31]!==g?(S=o.jsxs($t,{children:[g,L]}),e[30]=L,e[31]=g,e[32]=S):S=e[32],S}function Dq(t){const e=z.c(35),{value:s,onChange:n,block:i}=t,r=re();let l;e[0]!==r||e[1]!==s?(l=s?r(Z5[s]):void 0,e[0]=r,e[1]=s,e[2]=l):l=e[2];const a=l,c=s!==null;let d;e[3]!==i||e[4]!==c?(d=wl(c,i),e[3]=i,e[4]=c,e[5]=d):d=e[5];const h=d,u=i&&"ml-auto";let f;e[6]!==u?(f=ie("shrink-0 opacity-60",u),e[6]=u,e[7]=f):f=e[7];const p=f;let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(hr,{size:14,className:"shrink-0"}),e[8]=m):m=e[8];let g;e[9]!==a||e[10]!==r?(g=a??r("taskBoard.taskFilters.dueDateLabel"),e[9]=a,e[10]=r,e[11]=g):g=e[11];let x;e[12]!==p?(x=o.jsx(Gt,{size:12,className:p}),e[12]=p,e[13]=x):x=e[13];let b;e[14]!==g||e[15]!==x||e[16]!==h?(b=o.jsx(Bt,{asChild:!0,children:o.jsxs("button",{type:"button",className:h,children:[m,g,x]})}),e[14]=g,e[15]=x,e[16]=h,e[17]=b):b=e[17];const y=s??Xr;let _;e[18]!==n?(_=C=>n(C===Xr?null:C),e[18]=n,e[19]=_):_=e[19];let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(hr,{size:16,className:"text-muted-foreground"}),e[20]=v):v=e[20];let L;e[21]!==r?(L=r("taskBoard.taskFilters.dueDateAnyTime"),e[21]=r,e[22]=L):L=e[22];let S;e[23]!==L?(S=o.jsxs(Yn,{value:Xr,className:"gap-2",children:[v,L]}),e[23]=L,e[24]=S):S=e[24];let w;e[25]!==r?(w=Object.entries(Z5).map(C=>{const[N,T]=C,V=N==="overdue";return o.jsxs(Yn,{value:N,className:ie("gap-2",V&&"text-destructive"),children:[o.jsx(hr,{size:16,className:ie("shrink-0",V?"text-destructive":"text-muted-foreground")}),r(T)]},N)}),e[25]=r,e[26]=w):w=e[26];let k;e[27]!==y||e[28]!==_||e[29]!==S||e[30]!==w?(k=o.jsx(zt,{align:"start",className:"w-44",children:o.jsxs(Xc,{value:y,onValueChange:_,children:[S,w]})}),e[27]=y,e[28]=_,e[29]=S,e[30]=w,e[31]=k):k=e[31];let j;return e[32]!==k||e[33]!==b?(j=o.jsxs($t,{children:[b,k]}),e[32]=k,e[33]=b,e[34]=j):j=e[34],j}function Iq(t){const e=z.c(56),{value:s,tags:n,onChange:i,block:r}=t,l=re(),[a,c]=P.useState(!1);let d;e[0]!==i||e[1]!==s?(d=D=>i(s.includes(D)?s.filter(I=>I!==D):[...s,D]),e[0]=i,e[1]=s,e[2]=d):d=e[2];const h=d;let u;e[3]!==l||e[4]!==n||e[5]!==s[0]||e[6]!==s.length?(u=s.length===0?l("taskBoard.taskFilters.tagsLabel"):s.length===1?n.find(D=>D.id===s[0])?.name??l("taskBoard.taskFilters.tagsLabel"):l("taskBoard.taskFilters.tagsSelectedCount",{count:s.length}),e[3]=l,e[4]=n,e[5]=s[0],e[6]=s.length,e[7]=u):u=e[7];const f=u,p=s.length>0;let m;e[8]!==r||e[9]!==p?(m=wl(p,r),e[8]=r,e[9]=p,e[10]=m):m=e[10];const g=m,x=r&&"ml-auto";let b;e[11]!==x?(b=ie("shrink-0 opacity-60",x),e[11]=x,e[12]=b):b=e[12];const y=b;let _;e[13]!==n||e[14]!==s[0]||e[15]!==s.length?(_=s.length===1?o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Gl(n.find(D=>D.id===s[0])?.color)}}):o.jsx(p9,{size:14,className:"shrink-0"}),e[13]=n,e[14]=s[0],e[15]=s.length,e[16]=_):_=e[16];let v;e[17]!==f?(v=o.jsx("span",{className:"max-w-[10rem] truncate",children:f}),e[17]=f,e[18]=v):v=e[18];let L;e[19]!==y?(L=o.jsx(Gt,{size:12,className:y}),e[19]=y,e[20]=L):L=e[20];let S;e[21]!==_||e[22]!==v||e[23]!==L||e[24]!==g?(S=o.jsx(ts,{asChild:!0,children:o.jsxs("button",{type:"button",className:g,children:[_,v,L]})}),e[21]=_,e[22]=v,e[23]=L,e[24]=g,e[25]=S):S=e[25];let w;e[26]!==l?(w=l("taskBoard.taskFilters.tagsFilterPlaceholder"),e[26]=l,e[27]=w):w=e[27];let k;e[28]!==l?(k=l("taskBoard.taskFilters.tagsFilterPlaceholder"),e[28]=l,e[29]=k):k=e[29];let j;e[30]!==w||e[31]!==k?(j=o.jsx(An,{placeholder:w,"aria-label":k,className:"h-9"}),e[30]=w,e[31]=k,e[32]=j):j=e[32];let C;e[33]!==l?(C=l("taskBoard.taskFilters.tagsNoTagsFound"),e[33]=l,e[34]=C):C=e[34];let N;e[35]!==C?(N=o.jsx(hn,{children:C}),e[35]=C,e[36]=N):N=e[36];let T;if(e[37]!==n||e[38]!==h||e[39]!==s){let D;e[41]!==h||e[42]!==s?(D=I=>o.jsxs(Ft,{value:I.name,onSelect:()=>h(I.id),className:"gap-2",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Gl(I.color)}}),o.jsx("span",{className:"flex-1 truncate",children:I.name}),s.includes(I.id)&&o.jsx(Kt,{size:14,className:"shrink-0 text-foreground"})]},I.id),e[41]=h,e[42]=s,e[43]=D):D=e[43],T=n.map(D),e[37]=n,e[38]=h,e[39]=s,e[40]=T}else T=e[40];let V;e[44]!==T?(V=o.jsx(os,{children:T}),e[44]=T,e[45]=V):V=e[45];let A;e[46]!==N||e[47]!==V?(A=o.jsxs(Pn,{children:[N,V]}),e[46]=N,e[47]=V,e[48]=A):A=e[48];let E;e[49]!==j||e[50]!==A?(E=o.jsx(ss,{align:"start",className:"w-56 p-0",children:o.jsxs(Fn,{children:[j,A]})}),e[49]=j,e[50]=A,e[51]=E):E=e[51];let R;return e[52]!==a||e[53]!==S||e[54]!==E?(R=o.jsxs(ns,{open:a,onOpenChange:c,children:[S,E]}),e[52]=a,e[53]=S,e[54]=E,e[55]=R):R=e[55],R}function Mq(t){const e=z.c(73),{value:s,repos:n,onChange:i,block:r}=t,l=re(),[a,c]=P.useState(!1);let d;e[0]!==l||e[1]!==s?(d=s===null?l("taskBoard.taskFilters.repoLabel"):s===Tp?l("taskBoard.taskFilters.repoNoRepo"):s,e[0]=l,e[1]=s,e[2]=d):d=e[2];const h=d;let u;e[3]!==i?(u=W=>{i(W),c(!1)},e[3]=i,e[4]=u):u=e[4];const f=u,p=s!==null;let m;e[5]!==r||e[6]!==p?(m=wl(p,r),e[5]=r,e[6]=p,e[7]=m):m=e[7];const g=m,x=r&&"ml-auto";let b;e[8]!==x?(b=ie("shrink-0 opacity-60",x),e[8]=x,e[9]=b):b=e[9];const y=b;let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Vn,{className:"size-3.5 shrink-0"}),e[10]=_):_=e[10];let v;e[11]!==h?(v=o.jsx("span",{className:"max-w-[12rem] truncate",children:h}),e[11]=h,e[12]=v):v=e[12];let L;e[13]!==y?(L=o.jsx(Gt,{size:12,className:y}),e[13]=y,e[14]=L):L=e[14];let S;e[15]!==v||e[16]!==L||e[17]!==g?(S=o.jsx(ts,{asChild:!0,children:o.jsxs("button",{type:"button",className:g,children:[_,v,L]})}),e[15]=v,e[16]=L,e[17]=g,e[18]=S):S=e[18];let w;e[19]!==l?(w=l("taskBoard.taskFilters.repoFilterPlaceholder"),e[19]=l,e[20]=w):w=e[20];let k;e[21]!==l?(k=l("taskBoard.taskFilters.repoFilterPlaceholder"),e[21]=l,e[22]=k):k=e[22];let j;e[23]!==w||e[24]!==k?(j=o.jsx(An,{placeholder:w,"aria-label":k,className:"h-9"}),e[23]=w,e[24]=k,e[25]=j):j=e[25];let C;e[26]!==l?(C=l("taskBoard.taskFilters.repoNoReposFound"),e[26]=l,e[27]=C):C=e[27];let N;e[28]!==C?(N=o.jsx(hn,{children:C}),e[28]=C,e[29]=N):N=e[29];let T;e[30]!==l?(T=l("taskBoard.taskFilters.repoAnyRepo"),e[30]=l,e[31]=T):T=e[31];let V;e[32]!==f?(V=()=>f(null),e[32]=f,e[33]=V):V=e[33];let A;e[34]!==l?(A=l("taskBoard.taskFilters.repoAnyRepo"),e[34]=l,e[35]=A):A=e[35];let E;e[36]!==T||e[37]!==V||e[38]!==A?(E=o.jsx(Ft,{value:T,onSelect:V,children:A}),e[36]=T,e[37]=V,e[38]=A,e[39]=E):E=e[39];let R;e[40]!==l?(R=l("taskBoard.taskFilters.repoNoRepo"),e[40]=l,e[41]=R):R=e[41];let D;e[42]!==f?(D=()=>f(Tp),e[42]=f,e[43]=D):D=e[43];let I;e[44]!==l?(I=l("taskBoard.taskFilters.repoNoRepo"),e[44]=l,e[45]=I):I=e[45];let O;e[46]!==R||e[47]!==D||e[48]!==I?(O=o.jsx(Ft,{value:R,onSelect:D,children:I}),e[46]=R,e[47]=D,e[48]=I,e[49]=O):O=e[49];let F;e[50]!==E||e[51]!==O?(F=o.jsxs(os,{children:[E,O]}),e[50]=E,e[51]=O,e[52]=F):F=e[52];let M;if(e[53]!==n||e[54]!==f||e[55]!==s){let W;e[57]!==f||e[58]!==s?(W=K=>o.jsxs(Ft,{value:K,onSelect:()=>f(K),className:"gap-2",children:[o.jsx(Vn,{className:"size-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:K}),s===K&&o.jsx(Kt,{size:14,className:"shrink-0 text-foreground"})]},K),e[57]=f,e[58]=s,e[59]=W):W=e[59],M=n.map(W),e[53]=n,e[54]=f,e[55]=s,e[56]=M}else M=e[56];let $;e[60]!==M?($=o.jsx(os,{children:M}),e[60]=M,e[61]=$):$=e[61];let B;e[62]!==N||e[63]!==F||e[64]!==$?(B=o.jsxs(Pn,{children:[N,F,$]}),e[62]=N,e[63]=F,e[64]=$,e[65]=B):B=e[65];let U;e[66]!==j||e[67]!==B?(U=o.jsx(ss,{align:"start",className:"w-64 p-0",children:o.jsxs(Fn,{children:[j,B]})}),e[66]=j,e[67]=B,e[68]=U):U=e[68];let H;return e[69]!==a||e[70]!==S||e[71]!==U?(H=o.jsxs(ns,{open:a,onOpenChange:c,children:[S,U]}),e[69]=a,e[70]=S,e[71]=U,e[72]=H):H=e[72],H}function Oq(t){const e=z.c(45),{value:s,sprints:n,onChange:i,block:r}=t,l=re();let a;if(e[0]!==n||e[1]!==s){let V;e[3]!==s?(V=A=>A.id===s,e[3]=s,e[4]=V):V=e[4],a=n.find(V),e[0]=n,e[1]=s,e[2]=a}else a=e[2];const c=a;let d;e[5]!==c?.name||e[6]!==l||e[7]!==s?(d=s===null?l("taskBoard.taskFilters.sprintLabel"):s===wf?l("taskBoard.taskFilters.sprintBacklog"):c?.name??l("taskBoard.taskFilters.sprintLabel"),e[5]=c?.name,e[6]=l,e[7]=s,e[8]=d):d=e[8];const h=d,u=s!==null;let f;e[9]!==r||e[10]!==u?(f=wl(u,r),e[9]=r,e[10]=u,e[11]=f):f=e[11];const p=f,m=r&&"ml-auto";let g;e[12]!==m?(g=ie("shrink-0 opacity-60",m),e[12]=m,e[13]=g):g=e[13];const x=g;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(g9,{size:14,className:"shrink-0"}),e[14]=b):b=e[14];let y;e[15]!==x?(y=o.jsx(Gt,{size:12,className:x}),e[15]=x,e[16]=y):y=e[16];let _;e[17]!==h||e[18]!==y||e[19]!==p?(_=o.jsx(Bt,{asChild:!0,children:o.jsxs("button",{type:"button",className:p,children:[b,h,y]})}),e[17]=h,e[18]=y,e[19]=p,e[20]=_):_=e[20];const v=s===null?Xr:s;let L;e[21]!==i?(L=V=>i(V===Xr?Ew:V),e[21]=i,e[22]=L):L=e[22];let S;e[23]!==l?(S=l("taskBoard.taskFilters.sprintAnySprint"),e[23]=l,e[24]=S):S=e[24];let w;e[25]!==S?(w=o.jsx(Yn,{value:Xr,children:S}),e[25]=S,e[26]=w):w=e[26];let k;e[27]!==l?(k=l("taskBoard.taskFilters.sprintBacklog"),e[27]=l,e[28]=k):k=e[28];let j;e[29]!==k?(j=o.jsx(Yn,{value:wf,children:k}),e[29]=k,e[30]=j):j=e[30];let C;if(e[31]!==n||e[32]!==l){let V;e[34]!==l?(V=A=>o.jsxs(Yn,{value:A.id,children:[o.jsx("span",{className:"truncate",children:A.name}),o.jsx("span",{className:"ml-auto shrink-0 text-muted-foreground",children:A.state==="active"?l("taskBoard.taskFilters.sprintCurrent"):c7(A)})]},A.id),e[34]=l,e[35]=V):V=e[35],C=n.map(V),e[31]=n,e[32]=l,e[33]=C}else C=e[33];let N;e[36]!==v||e[37]!==L||e[38]!==w||e[39]!==j||e[40]!==C?(N=o.jsx(zt,{align:"start",className:"max-h-80 w-72 overflow-y-auto",children:o.jsxs(Xc,{value:v,onValueChange:L,children:[w,j,C]})}),e[36]=v,e[37]=L,e[38]=w,e[39]=j,e[40]=C,e[41]=N):N=e[41];let T;return e[42]!==N||e[43]!==_?(T=o.jsxs($t,{children:[_,N]}),e[42]=N,e[43]=_,e[44]=T):T=e[44],T}function $q(t){const e=z.c(25),{value:s,onChange:n,block:i}=t,r=re(),[l,a]=P.useState(s!==""),[c,d]=P.useState(!1),[h,u]=P.useState(s);s!==h&&(u(s),s===""&&!c&&a(!1));const f=l||i,p=f?"w-32 sm:w-44":"w-8 px-0 justify-center",m=i&&"h-10 w-full px-3 text-sm sm:w-full";let g;e[0]!==p||e[1]!==m?(g=ie("inline-flex h-8 shrink-0 items-center gap-1.5 overflow-hidden rounded-lg border border-border px-2.5 text-xs text-foreground transition-all duration-200 ease-out",p,m),e[0]=p,e[1]=m,e[2]=g):g=e[2];let x;e[3]!==r?(x=r("taskBoard.taskFilters.searchLabel"),e[3]=r,e[4]=x):x=e[4];let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=()=>a(!0),e[5]=b):b=e[5];let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(l0,{size:14}),e[6]=y):y=e[6];let _;e[7]!==x?(_=o.jsx("button",{type:"button","aria-label":x,onClick:b,className:"shrink-0 text-muted-foreground transition-colors hover:text-foreground",children:y}),e[7]=x,e[8]=_):_=e[8];let v;e[9]!==i||e[10]!==f||e[11]!==n||e[12]!==r||e[13]!==s?(v=f&&o.jsx("input",{autoFocus:!i,value:s,onChange:w=>n(w.target.value),onFocus:()=>d(!0),onBlur:()=>{d(!1),s===""&&a(!1)},placeholder:r("taskBoard.taskFilters.searchPlaceholder"),"aria-label":r("taskBoard.taskFilters.searchPlaceholder"),className:"w-full min-w-0 bg-transparent text-xs outline-none placeholder:text-muted-foreground"}),e[9]=i,e[10]=f,e[11]=n,e[12]=r,e[13]=s,e[14]=v):v=e[14];let L;e[15]!==i||e[16]!==n||e[17]!==r||e[18]!==s?(L=s!==""&&o.jsx("button",{type:"button","aria-label":r("taskBoard.taskFilters.searchClearLabel"),onMouseDown:Bq,onClick:()=>{n(""),i||a(!1)},className:"shrink-0 text-muted-foreground hover:text-foreground",children:o.jsx(Is,{size:14})}),e[15]=i,e[16]=n,e[17]=r,e[18]=s,e[19]=L):L=e[19];let S;return e[20]!==g||e[21]!==_||e[22]!==v||e[23]!==L?(S=o.jsxs("div",{className:g,children:[_,v,L]}),e[20]=g,e[21]=_,e[22]=v,e[23]=L,e[24]=S):S=e[24],S}function Bq(t){return t.preventDefault()}function zq(t){const e=z.c(20),{block:s,onClick:n}=t,i=re();let r;e[0]!==i?(r=i("taskBoard.taskFilters.boardSettingsLabel"),e[0]=i,e[1]=r):r=e[1];const l=r;let a;e[2]!==s?(a=ie(wl(!1,s),s?"h-10 w-full":"w-8 justify-center px-0"),e[2]=s,e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(n7,{size:14,className:"shrink-0"}),e[4]=c):c=e[4];let d;e[5]!==s||e[6]!==l?(d=s&&o.jsx("span",{children:l}),e[5]=s,e[6]=l,e[7]=d):d=e[7];let h;e[8]!==l||e[9]!==n||e[10]!==a||e[11]!==d?(h=o.jsxs("button",{type:"button",onClick:n,"aria-label":l,className:a,children:[c,d]}),e[8]=l,e[9]=n,e[10]=a,e[11]=d,e[12]=h):h=e[12];const u=h;if(s)return u;let f;e[13]!==u?(f=o.jsx(Fe,{asChild:!0,children:u}),e[13]=u,e[14]=f):f=e[14];let p;e[15]!==l?(p=o.jsx(Ue,{side:"top",children:l}),e[15]=l,e[16]=p):p=e[16];let m;return e[17]!==f||e[18]!==p?(m=o.jsxs(He,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=m):m=e[19],m}function Iw(t){const e=z.c(59),{filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c,block:d}=t;let h;e[0]!==s||e[1]!==a?(h=k=>a({...s,search:k}),e[0]=s,e[1]=a,e[2]=h):h=e[2];let u;e[3]!==d||e[4]!==s.search||e[5]!==h?(u=o.jsx($q,{block:d,value:s.search,onChange:h}),e[3]=d,e[4]=s.search,e[5]=h,e[6]=u):u=e[6];let f;e[7]!==s||e[8]!==a?(f=k=>a({...s,assignee:k}),e[7]=s,e[8]=a,e[9]=f):f=e[9];let p;e[10]!==d||e[11]!==s.assignee||e[12]!==n||e[13]!==f?(p=o.jsx(Eq,{block:d,value:s.assignee,members:n,onChange:f}),e[10]=d,e[11]=s.assignee,e[12]=n,e[13]=f,e[14]=p):p=e[14];let m;e[15]!==s||e[16]!==a?(m=k=>a({...s,priority:k}),e[15]=s,e[16]=a,e[17]=m):m=e[17];let g;e[18]!==d||e[19]!==s.priority||e[20]!==m?(g=o.jsx(Rq,{block:d,value:s.priority,onChange:m}),e[18]=d,e[19]=s.priority,e[20]=m,e[21]=g):g=e[21];let x;e[22]!==s||e[23]!==a?(x=k=>a({...s,due:k}),e[22]=s,e[23]=a,e[24]=x):x=e[24];let b;e[25]!==d||e[26]!==s.due||e[27]!==x?(b=o.jsx(Dq,{block:d,value:s.due,onChange:x}),e[25]=d,e[26]=s.due,e[27]=x,e[28]=b):b=e[28];let y;e[29]!==s||e[30]!==a?(y=k=>a({...s,tags:k}),e[29]=s,e[30]=a,e[31]=y):y=e[31];let _;e[32]!==d||e[33]!==s.tags||e[34]!==y||e[35]!==i?(_=o.jsx(Iq,{block:d,value:s.tags,tags:i,onChange:y}),e[32]=d,e[33]=s.tags,e[34]=y,e[35]=i,e[36]=_):_=e[36];let v;e[37]!==d||e[38]!==s||e[39]!==a||e[40]!==r?(v=(r.length>0||s.repo!==null)&&o.jsx(Mq,{block:d,value:s.repo,repos:r,onChange:k=>a({...s,repo:k})}),e[37]=d,e[38]=s,e[39]=a,e[40]=r,e[41]=v):v=e[41];let L;e[42]!==d||e[43]!==s||e[44]!==a||e[45]!==l?(L=(l.length>0||s.sprint!==null)&&o.jsx(Oq,{block:d,value:s.sprint,sprints:l,onChange:k=>a({...s,sprint:k})}),e[42]=d,e[43]=s,e[44]=a,e[45]=l,e[46]=L):L=e[46];let S;e[47]!==d||e[48]!==c?(S=o.jsx(zq,{block:d,onClick:c}),e[47]=d,e[48]=c,e[49]=S):S=e[49];let w;return e[50]!==_||e[51]!==v||e[52]!==L||e[53]!==S||e[54]!==u||e[55]!==p||e[56]!==g||e[57]!==b?(w=o.jsxs(o.Fragment,{children:[u,p,g,b,_,v,L,S]}),e[50]=_,e[51]=v,e[52]=L,e[53]=S,e[54]=u,e[55]=p,e[56]=g,e[57]=b,e[58]=w):w=e[58],w}function Fq(t){const e=z.c(17),{filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c}=t,d=re();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(T9,{size:16,className:"mr-0.5 shrink-0 text-muted-foreground"}),e[0]=h):h=e[0];let u;e[1]!==s||e[2]!==n||e[3]!==a||e[4]!==c||e[5]!==r||e[6]!==l||e[7]!==i?(u=o.jsx(Iw,{filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c}),e[1]=s,e[2]=n,e[3]=a,e[4]=c,e[5]=r,e[6]=l,e[7]=i,e[8]=u):u=e[8];let f;e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==d?(f=jq(s,z3(l))&&o.jsx("button",{type:"button",onClick:()=>a(F3),className:"ml-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:d("taskBoard.taskFilters.clearButton")}),e[9]=s,e[10]=a,e[11]=l,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h,u,f]}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function Uq(t){const e=z.c(45),{filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c}=t,d=re(),[h,u]=P.useState(!1);let f;e[0]!==s||e[1]!==l?(f=Cq(s,z3(l)),e[0]=s,e[1]=l,e[2]=f):f=e[2];const p=f,m=p>0;let g;e[3]!==m?(g=wl(m),e[3]=m,e[4]=g):g=e[4];const x=g;let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(T9,{size:14,className:"shrink-0"}),e[5]=b):b=e[5];let y;e[6]!==d?(y=d("taskBoard.taskFilters.filterDrawerButtonLabel"),e[6]=d,e[7]=y):y=e[7];let _;e[8]!==p?(_=p>0&&o.jsx("span",{className:"ml-0.5 flex size-4 items-center justify-center rounded-full bg-foreground text-[10px] font-semibold text-background",children:p}),e[8]=p,e[9]=_):_=e[9];let v;e[10]!==y||e[11]!==_||e[12]!==x?(v=o.jsx(i8,{asChild:!0,children:o.jsxs("button",{type:"button",className:x,children:[b,y,_]})}),e[10]=y,e[11]=_,e[12]=x,e[13]=v):v=e[13];let L;e[14]!==d?(L=d("taskBoard.taskFilters.filterDrawerTitle"),e[14]=d,e[15]=L):L=e[15];let S;e[16]!==L?(S=o.jsx(l9,{className:"px-4 pt-4 text-base font-medium text-foreground",children:L}),e[16]=L,e[17]=S):S=e[17];let w;e[18]!==s||e[19]!==n||e[20]!==a||e[21]!==c||e[22]!==r||e[23]!==l||e[24]!==i?(w=o.jsx("div",{className:"flex flex-col gap-2 p-4",children:o.jsx(Iw,{block:!0,filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c})}),e[18]=s,e[19]=n,e[20]=a,e[21]=c,e[22]=r,e[23]=l,e[24]=i,e[25]=w):w=e[25];let k;e[26]!==p||e[27]!==a||e[28]!==d?(k=p>0&&o.jsx(me,{variant:"outline",className:"flex-1",onClick:()=>a(F3),children:d("taskBoard.taskFilters.clearAllButton")}),e[26]=p,e[27]=a,e[28]=d,e[29]=k):k=e[29];let j;e[30]!==d?(j=d("taskBoard.taskFilters.doneButton"),e[30]=d,e[31]=j):j=e[31];let C;e[32]!==j?(C=o.jsx(UV,{asChild:!0,children:o.jsx(me,{className:"flex-1",children:j})}),e[32]=j,e[33]=C):C=e[33];let N;e[34]!==k||e[35]!==C?(N=o.jsxs(HV,{className:"flex-row gap-2",children:[k,C]}),e[34]=k,e[35]=C,e[36]=N):N=e[36];let T;e[37]!==w||e[38]!==N||e[39]!==S?(T=o.jsxs(a9,{className:"p-0",children:[S,w,N]}),e[37]=w,e[38]=N,e[39]=S,e[40]=T):T=e[40];let V;return e[41]!==h||e[42]!==T||e[43]!==v?(V=o.jsxs(c9,{open:h,onOpenChange:u,direction:"bottom",children:[v,T]}),e[41]=h,e[42]=T,e[43]=v,e[44]=V):V=e[44],V}function Vp(t,e){return wg(t,e.keySeq,e.jiraIssueKey)??e.id}function Hq(t,e){const s=e?.trim();if(!s)return;const n=s.toLowerCase();return t.find(i=>i.jiraIssueKey?.trim().toLowerCase()===n)??t.find(i=>Dw(s,i.keySeq,i.jiraIssueKey))??t.find(i=>i.id===s)}function U3(t){const e=z.c(11),{size:s,className:n}=t,i=s===void 0?16:s;let r;e[0]!==n?(r=ie("inline-flex shrink-0 items-center justify-center rounded-full",n),e[0]=n,e[1]=r):r=e[1];let l;e[2]!==i?(l={width:i,height:i,backgroundColor:`${YV}26`},e[2]=i,e[3]=l):l=e[3];const a=i*.6,c=i*.6;let d;e[4]!==a||e[5]!==c?(d=o.jsx("img",{src:JV,alt:"Reviewer",style:{width:a,height:c}}),e[4]=a,e[5]=c,e[6]=d):d=e[6];let h;return e[7]!==r||e[8]!==l||e[9]!==d?(h=o.jsx("span",{className:r,style:l,children:d}),e[7]=r,e[8]=l,e[9]=d,e[10]=h):h=e[10],h}let Ap,Pp;if(typeof WeakMap<"u"){let t=new WeakMap;Ap=e=>t.get(e),Pp=(e,s)=>(t.set(e,s),s)}else{const t=[];let s=0;Ap=n=>{for(let i=0;i<t.length;i+=2)if(t[i]==n)return t[i+1]},Pp=(n,i)=>(s==10&&(s=0),t[s++]=n,t[s++]=i)}var Ts=class{constructor(t,e,s,n){this.width=t,this.height=e,this.map=s,this.problems=n}findCell(t){for(let e=0;e<this.map.length;e++){const s=this.map[e];if(s!=t)continue;const n=e%this.width,i=e/this.width|0;let r=n+1,l=i+1;for(let a=1;r<this.width&&this.map[e+a]==s;a++)r++;for(let a=1;l<this.height&&this.map[e+this.width*a]==s;a++)l++;return{left:n,top:i,right:r,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,s){const{left:n,right:i,top:r,bottom:l}=this.findCell(t);return e=="horiz"?(s<0?n==0:i==this.width)?null:this.map[r*this.width+(s<0?n-1:i)]:(s<0?r==0:l==this.height)?null:this.map[n+this.width*(s<0?r-1:l)]}rectBetween(t,e){const{left:s,right:n,top:i,bottom:r}=this.findCell(t),{left:l,right:a,top:c,bottom:d}=this.findCell(e);return{left:Math.min(s,l),top:Math.min(i,c),right:Math.max(n,a),bottom:Math.max(r,d)}}cellsInRect(t){const e=[],s={};for(let n=t.top;n<t.bottom;n++)for(let i=t.left;i<t.right;i++){const r=n*this.width+i,l=this.map[r];s[l]||(s[l]=!0,!(i==t.left&&i&&this.map[r-1]==l||n==t.top&&n&&this.map[r-this.width]==l)&&e.push(l))}return e}positionAt(t,e,s){for(let n=0,i=0;;n++){const r=i+s.child(n).nodeSize;if(n==t){let l=e+t*this.width;const a=(t+1)*this.width;for(;l<a&&this.map[l]<i;)l++;return l==a?r-1:this.map[l]}i=r}}static get(t){return Ap(t)||Pp(t,Kq(t))}};function Kq(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Wq(t),s=t.childCount,n=[];let i=0,r=null;const l=[];for(let d=0,h=e*s;d<h;d++)n[d]=0;for(let d=0,h=0;d<s;d++){const u=t.child(d);h++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==u.childCount)break;const g=u.child(m),{colspan:x,rowspan:b,colwidth:y}=g.attrs;for(let _=0;_<b;_++){if(_+d>=s){(r||(r=[])).push({type:"overlong_rowspan",pos:h,n:b-_});break}const v=i+_*e;for(let L=0;L<x;L++){n[v+L]==0?n[v+L]=h:(r||(r=[])).push({type:"collision",row:d,pos:h,n:x-L});const S=y&&y[L];if(S){const w=(v+L)%e*2,k=l[w];k==null||k!=S&&l[w+1]==1?(l[w]=S,l[w+1]=1):k==S&&l[w+1]++}}}i+=x,h+=g.nodeSize}const f=(d+1)*e;let p=0;for(;i<f;)n[i++]==0&&p++;p&&(r||(r=[])).push({type:"missing",row:d,n:p}),h++}(e===0||s===0)&&(r||(r=[])).push({type:"zero_sized"});const a=new Ts(e,s,n,r);let c=!1;for(let d=0;!c&&d<l.length;d+=2)l[d]!=null&&l[d+1]<s&&(c=!0);return c&&qq(a,l,t),a}function Wq(t){let e=-1,s=!1;for(let n=0;n<t.childCount;n++){const i=t.child(n);let r=0;if(s)for(let l=0;l<n;l++){const a=t.child(l);for(let c=0;c<a.childCount;c++){const d=a.child(c);l+d.attrs.rowspan>n&&(r+=d.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const a=i.child(l);r+=a.attrs.colspan,a.attrs.rowspan>1&&(s=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function qq(t,e,s){t.problems||(t.problems=[]);const n={};for(let i=0;i<t.map.length;i++){const r=t.map[i];if(n[r])continue;n[r]=!0;const l=s.nodeAt(r);if(!l)throw new RangeError(`No cell with offset ${r} found`);let a=null;const c=l.attrs;for(let d=0;d<c.colspan;d++){const h=e[(i+d)%t.width*2];h!=null&&(!c.colwidth||c.colwidth[d]!=h)&&((a||(a=Gq(c)))[d]=h)}a&&t.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:a})}}function Gq(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let s=0;s<t.colspan;s++)e.push(0);return e}function yn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const s in t.nodes){const n=t.nodes[s],i=n.spec.tableRole;i&&(e[i]=n)}}return e}const Yo=new Vi("selectingCells");function ta(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Yq(t){for(let e=t.depth;e>0;e--){const s=t.node(e).type.spec.tableRole;if(s==="cell"||s==="header_cell")return t.node(e)}return null}function $i(t){const e=t.selection.$head;for(let s=e.depth;s>0;s--)if(e.node(s).type.spec.tableRole=="row")return!0;return!1}function s1(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const s=ta(e.$head)||Jq(e.$head);if(s)return s;throw new RangeError(`No cell found around position ${e.head}`)}function Jq(t){for(let e=t.nodeAfter,s=t.pos;e;e=e.firstChild,s++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(s)}for(let e=t.nodeBefore,s=t.pos;e;e=e.lastChild,s--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(s-e.nodeSize)}}function Ep(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Qq(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function H3(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Mw(t,e,s){const n=t.node(-1),i=Ts.get(n),r=t.start(-1),l=i.nextCell(t.pos-r,e,s);return l==null?null:t.node(0).resolve(r+l)}function sa(t,e,s=1){const n={...t,colspan:t.colspan-s};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,s),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}function Ow(t,e,s=1){const n={...t,colspan:t.colspan+s};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let i=0;i<s;i++)n.colwidth.splice(e,0,0)}return n}function Xq(t,e,s){const n=yn(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[s+i*t.width]).type!=n)return!1;return!0}var is=class zr extends ir{constructor(e,s=e){const n=e.node(-1),i=Ts.get(n),r=e.start(-1),l=i.rectBetween(e.pos-r,s.pos-r),a=e.node(0),c=i.cellsInRect(l).filter(h=>h!=s.pos-r);c.unshift(s.pos-r);const d=c.map(h=>{const u=n.nodeAt(h);if(!u)throw new RangeError(`No cell with offset ${h} found`);const f=r+h+1;return new pV(a.resolve(f),a.resolve(f+u.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=s}map(e,s){const n=e.resolve(s.map(this.$anchorCell.pos)),i=e.resolve(s.map(this.$headCell.pos));if(Ep(n)&&Ep(i)&&H3(n,i)){const r=this.$anchorCell.node(-1)!=n.node(-1);return r&&this.isRowSelection()?zr.rowSelection(n,i):r&&this.isColSelection()?zr.colSelection(n,i):new zr(n,i)}return Wr.between(n,i)}content(){const e=this.$anchorCell.node(-1),s=Ts.get(e),n=this.$anchorCell.start(-1),i=s.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),r={},l=[];for(let c=i.top;c<i.bottom;c++){const d=[];for(let h=c*s.width+i.left,u=i.left;u<i.right;u++,h++){const f=s.map[h];if(r[f])continue;r[f]=!0;const p=s.findCell(f);let m=e.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i.left-p.left,x=p.right-i.right;if(g>0||x>0){let b=m.attrs;if(g>0&&(b=sa(b,0,g)),x>0&&(b=sa(b,b.colspan-x,x)),p.left<i.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(p.top<i.top||p.bottom>i.bottom){const b={...m.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}l.push(e.child(c).copy(ur.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new Qo(ur.from(a),1,1)}replace(e,s=Qo.empty){const n=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:a,$to:c}=i[l],d=e.mapping.slice(n);e.replace(d.map(a.pos),d.map(c.pos),l?Qo.empty:s)}const r=ir.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,s){this.replace(e,new Qo(ur.from(s),0,0))}forEachCell(e){const s=this.$anchorCell.node(-1),n=Ts.get(s),i=this.$anchorCell.start(-1),r=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<r.length;l++)e(s.nodeAt(r[l]),i+r[l])}isColSelection(){const e=this.$anchorCell.index(-1),s=this.$headCell.index(-1);if(Math.min(e,s)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=s+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(e,s=e){const n=e.node(-1),i=Ts.get(n),r=e.start(-1),l=i.findCell(e.pos-r),a=i.findCell(s.pos-r),c=e.node(0);return l.top<=a.top?(l.top>0&&(e=c.resolve(r+i.map[l.left])),a.bottom<i.height&&(s=c.resolve(r+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(s=c.resolve(r+i.map[a.left])),l.bottom<i.height&&(e=c.resolve(r+i.map[i.width*(i.height-1)+l.right-1]))),new zr(e,s)}isRowSelection(){const e=this.$anchorCell.node(-1),s=Ts.get(e),n=this.$anchorCell.start(-1),i=s.colCount(this.$anchorCell.pos-n),r=s.colCount(this.$headCell.pos-n);if(Math.min(i,r)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,a=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,a)==s.width}eq(e){return e instanceof zr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,s=e){const n=e.node(-1),i=Ts.get(n),r=e.start(-1),l=i.findCell(e.pos-r),a=i.findCell(s.pos-r),c=e.node(0);return l.left<=a.left?(l.left>0&&(e=c.resolve(r+i.map[l.top*i.width])),a.right<i.width&&(s=c.resolve(r+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(s=c.resolve(r+i.map[a.top*i.width])),l.right<i.width&&(e=c.resolve(r+i.map[i.width*(l.top+1)-1]))),new zr(e,s)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,s){return new zr(e.resolve(s.anchor),e.resolve(s.head))}static create(e,s,n=s){return new zr(e.resolve(s),e.resolve(n))}getBookmark(){return new Zq(this.$anchorCell.pos,this.$headCell.pos)}};is.prototype.visible=!1;ir.jsonID("cell",is);var Zq=class $w{constructor(e,s){this.anchor=e,this.head=s}map(e){return new $w(e.map(this.anchor),e.map(this.head))}resolve(e){const s=e.resolve(this.anchor),n=e.resolve(this.head);return s.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&s.index()<s.parent.childCount&&n.index()<n.parent.childCount&&H3(s,n)?new is(s,n):ir.near(n,1)}};function eG(t){if(!(t.selection instanceof is))return null;const e=[];return t.selection.forEachCell((s,n)=>{e.push(Gm.node(n,n+s.nodeSize,{class:"selectedCell"}))}),qm.create(t.doc,e)}function tG({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let s=t.pos,n=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,s++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,n--);return s==n&&/row|table/.test(t.node(i).type.spec.tableRole)}function sG({$from:t,$to:e}){let s,n;for(let i=t.depth;i>0;i--){const r=t.node(i);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){s=r;break}}for(let i=e.depth;i>0;i--){const r=e.node(i);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){n=r;break}}return s!==n&&e.parentOffset===0}function nG(t,e,s){const n=(e||t).selection,i=(e||t).doc;let r,l;if(n instanceof J6&&(l=n.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")r=is.create(i,n.from);else if(l=="row"){const a=i.resolve(n.from+1);r=is.rowSelection(a,a)}else if(!s){const a=Ts.get(n.node),c=n.from+1,d=c+a.map[a.width*a.height-1];r=is.create(i,c+1,d)}}else n instanceof Wr&&tG(n)?r=Wr.create(i,n.from):n instanceof Wr&&sG(n)&&(r=Wr.create(i,n.$from.start(),n.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}const iG=new Vi("fix-tables");function Bw(t,e,s,n){const i=t.childCount,r=e.childCount;e:for(let l=0,a=0;l<r;l++){const c=e.child(l);for(let d=a,h=Math.min(i,l+3);d<h;d++)if(t.child(d)==c){a=d+1,s+=c.nodeSize;continue e}n(c,s),a<i&&t.child(a).sameMarkup(c)?Bw(t.child(a),c,s+1,n):c.nodesBetween(0,c.content.size,n,s+1),s+=c.nodeSize}}function zw(t,e){let s;const n=(i,r)=>{i.type.spec.tableRole=="table"&&(s=rG(t,i,r,s))};return e?e.doc!=t.doc&&Bw(e.doc,t.doc,0,n):t.doc.descendants(n),s}function rG(t,e,s,n){const i=Ts.get(e);if(!i.problems)return n;n||(n=t.tr);const r=[];for(let c=0;c<i.height;c++)r.push(0);for(let c=0;c<i.problems.length;c++){const d=i.problems[c];if(d.type=="collision"){const h=e.nodeAt(d.pos);if(!h)continue;const u=h.attrs;for(let f=0;f<u.rowspan;f++)r[d.row+f]+=d.n;n.setNodeMarkup(n.mapping.map(s+1+d.pos),null,sa(u,u.colspan-d.n,d.n))}else if(d.type=="missing")r[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const h=e.nodeAt(d.pos);if(!h)continue;n.setNodeMarkup(n.mapping.map(s+1+d.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const h=e.nodeAt(d.pos);if(!h)continue;n.setNodeMarkup(n.mapping.map(s+1+d.pos),null,{...h.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const h=n.mapping.map(s);n.delete(h,h+e.nodeSize)}}let l,a;for(let c=0;c<r.length;c++)r[c]&&(l==null&&(l=c),a=c);for(let c=0,d=s+1;c<i.height;c++){const h=e.child(c),u=d+h.nodeSize,f=r[c];if(f>0){let p="cell";h.firstChild&&(p=h.firstChild.type.spec.tableRole);const m=[];for(let x=0;x<f;x++){const b=yn(t.schema)[p].createAndFill();b&&m.push(b)}const g=(c==0||l==c-1)&&a==c?d+1:u-1;n.insert(n.mapping.map(g),m)}d=u}return n.setMeta(iG,{fixTables:!0})}function wr(t){const e=t.selection,s=s1(t),n=s.node(-1),i=s.start(-1),r=Ts.get(n);return{...e instanceof is?r.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):r.findCell(s.pos-i),tableStart:i,map:r,table:n}}function Fw(t,{map:e,tableStart:s,table:n},i){let r=i>0?-1:0;Xq(e,n,i+r)&&(r=i==0||i==e.width?null:0);for(let l=0;l<e.height;l++){const a=l*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const c=e.map[a],d=n.nodeAt(c);t.setNodeMarkup(t.mapping.map(s+c),null,Ow(d.attrs,i-e.colCount(c))),l+=d.attrs.rowspan-1}else{const c=r==null?yn(n.type.schema).cell:n.nodeAt(e.map[a+r]).type,d=e.positionAt(l,i,n);t.insert(t.mapping.map(s+d),c.createAndFill())}}return t}function oG(t,e){if(!$i(t))return!1;if(e){const s=wr(t);e(Fw(t.tr,s,s.left))}return!0}function lG(t,e){if(!$i(t))return!1;if(e){const s=wr(t);e(Fw(t.tr,s,s.right))}return!0}function aG(t,{map:e,table:s,tableStart:n},i){const r=t.mapping.maps.length;for(let l=0;l<e.height;){const a=l*e.width+i,c=e.map[a],d=s.nodeAt(c),h=d.attrs;if(i>0&&e.map[a-1]==c||i<e.width-1&&e.map[a+1]==c)t.setNodeMarkup(t.mapping.slice(r).map(n+c),null,sa(h,i-e.colCount(c)));else{const u=t.mapping.slice(r).map(n+c);t.delete(u,u+d.nodeSize)}l+=h.rowspan}}function cG(t,e){if(!$i(t))return!1;if(e){const s=wr(t),n=t.tr;if(s.left==0&&s.right==s.map.width)return!1;for(let i=s.right-1;aG(n,s,i),i!=s.left;i--){const r=s.tableStart?n.doc.nodeAt(s.tableStart-1):n.doc;if(!r)throw new RangeError("No table found");s.table=r,s.map=Ts.get(r)}e(n)}return!0}function dG(t,e,s){var n;const i=yn(e.type.schema).header_cell;for(let r=0;r<t.width;r++)if(((n=e.nodeAt(t.map[r+s*t.width]))===null||n===void 0?void 0:n.type)!=i)return!1;return!0}function Uw(t,{map:e,tableStart:s,table:n},i){let r=s;for(let d=0;d<i;d++)r+=n.child(d).nodeSize;const l=[];let a=i>0?-1:0;dG(e,n,i+a)&&(a=i==0||i==e.height?null:0);for(let d=0,h=e.width*i;d<e.width;d++,h++)if(i>0&&i<e.height&&e.map[h]==e.map[h-e.width]){const u=e.map[h],f=n.nodeAt(u).attrs;t.setNodeMarkup(s+u,null,{...f,rowspan:f.rowspan+1}),d+=f.colspan-1}else{var c;const u=a==null?yn(n.type.schema).cell:(c=n.nodeAt(e.map[h+a*e.width]))===null||c===void 0?void 0:c.type,f=u?.createAndFill();f&&l.push(f)}return t.insert(r,yn(n.type.schema).row.create(null,l)),t}function uG(t,e){if(!$i(t))return!1;if(e){const s=wr(t);e(Uw(t.tr,s,s.top))}return!0}function hG(t,e){if(!$i(t))return!1;if(e){const s=wr(t);e(Uw(t.tr,s,s.bottom))}return!0}function fG(t,{map:e,table:s,tableStart:n},i){let r=0;for(let d=0;d<i;d++)r+=s.child(d).nodeSize;const l=r+s.child(i).nodeSize,a=t.mapping.maps.length;t.delete(r+n,l+n);const c=new Set;for(let d=0,h=i*e.width;d<e.width;d++,h++){const u=e.map[h];if(!c.has(u)){if(c.add(u),i>0&&u==e.map[h-e.width]){const f=s.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(a).map(u+n),null,{...f,rowspan:f.rowspan-1}),d+=f.colspan-1}else if(i<e.height&&u==e.map[h+e.width]){const f=s.nodeAt(u),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(i+1,d,s);t.insert(t.mapping.slice(a).map(n+g),m),d+=p.colspan-1}}}}function mG(t,e){if(!$i(t))return!1;if(e){const s=wr(t),n=t.tr;if(s.top==0&&s.bottom==s.map.height)return!1;for(let i=s.bottom-1;fG(n,s,i),i!=s.top;i--){const r=s.tableStart?n.doc.nodeAt(s.tableStart-1):n.doc;if(!r)throw new RangeError("No table found");s.table=r,s.map=Ts.get(s.table)}e(n)}return!0}function eb(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function pG({width:t,height:e,map:s},n){let i=n.top*t+n.left,r=i,l=(n.bottom-1)*t+n.left,a=i+(n.right-n.left-1);for(let c=n.top;c<n.bottom;c++){if(n.left>0&&s[r]==s[r-1]||n.right<t&&s[a]==s[a+1])return!0;r+=t,a+=t}for(let c=n.left;c<n.right;c++){if(n.top>0&&s[i]==s[i-t]||n.bottom<e&&s[l]==s[l+t])return!0;i++,l++}return!1}function tb(t,e){const s=t.selection;if(!(s instanceof is)||s.$anchorCell.pos==s.$headCell.pos)return!1;const n=wr(t),{map:i}=n;if(pG(i,n))return!1;if(e){const r=t.tr,l={};let a=ur.empty,c,d;for(let h=n.top;h<n.bottom;h++)for(let u=n.left;u<n.right;u++){const f=i.map[h*i.width+u],p=n.table.nodeAt(f);if(!(l[f]||!p))if(l[f]=!0,c==null)c=f,d=p;else{eb(p)||(a=a.append(p.content));const m=r.mapping.map(f+n.tableStart);r.delete(m,m+p.nodeSize)}}if(c==null||d==null)return!0;if(r.setNodeMarkup(c+n.tableStart,null,{...Ow(d.attrs,d.attrs.colspan,n.right-n.left-d.attrs.colspan),rowspan:n.bottom-n.top}),a.size>0){const h=c+1+d.content.size,u=eb(d)?c+1:h;r.replaceWith(u+n.tableStart,h+n.tableStart,a)}r.setSelection(new is(r.doc.resolve(c+n.tableStart))),e(r)}return!0}function sb(t,e){const s=yn(t.schema);return gG(({node:n})=>s[n.type.spec.tableRole])(t,e)}function gG(t){return(e,s)=>{const n=e.selection;let i,r;if(n instanceof is){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;i=n.$anchorCell.nodeAfter,r=n.$anchorCell.pos}else{var l;if(i=Yq(n.$from),!i)return!1;r=(l=ta(n.$from))===null||l===void 0?void 0:l.pos}if(i==null||r==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(s){let a=i.attrs;const c=[],d=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const h=wr(e),u=e.tr;for(let p=0;p<h.right-h.left;p++)c.push(d?{...a,colwidth:d&&d[p]?[d[p]]:null}:a);let f;for(let p=h.top;p<h.bottom;p++){let m=h.map.positionAt(p,h.left,h.table);p==h.top&&(m+=i.nodeSize);for(let g=h.left,x=0;g<h.right;g++,x++)g==h.left&&p==h.top||u.insert(f=u.mapping.map(m+h.tableStart,1),t({node:i,row:p,col:g}).createAndFill(c[x]))}u.setNodeMarkup(r,t({node:i,row:h.top,col:h.left}),c[0]),n instanceof is&&u.setSelection(new is(u.doc.resolve(n.$anchorCell.pos),f?u.doc.resolve(f):void 0)),s(u)}return!0}}function xG(t,e){return function(s,n){if(!$i(s))return!1;const i=s1(s);if(i.nodeAfter.attrs[t]===e)return!1;if(n){const r=s.tr;s.selection instanceof is?s.selection.forEachCell((l,a)=>{l.attrs[t]!==e&&r.setNodeMarkup(a,null,{...l.attrs,[t]:e})}):r.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),n(r)}return!0}}function bG(t){return function(e,s){if(!$i(e))return!1;if(s){const n=yn(e.schema),i=wr(e),r=e.tr,l=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=l.map(c=>i.table.nodeAt(c));for(let c=0;c<l.length;c++)a[c].type==n.header_cell&&r.setNodeMarkup(i.tableStart+l[c],n.cell,a[c].attrs);if(r.steps.length===0)for(let c=0;c<l.length;c++)r.setNodeMarkup(i.tableStart+l[c],n.header_cell,a[c].attrs);s(r)}return!0}}function nb(t,e,s){const n=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<n.length;i++){const r=e.table.nodeAt(n[i]);if(r&&r.type!==s.header_cell)return!1}return!0}function Ju(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?bG(t):function(s,n){if(!$i(s))return!1;if(n){const i=yn(s.schema),r=wr(s),l=s.tr,a=nb("row",r,i),c=nb("column",r,i),d=(t==="column"?a:t==="row"&&c)?1:0,h=t=="column"?{left:0,top:d,right:1,bottom:r.map.height}:t=="row"?{left:d,top:0,right:r.map.width,bottom:1}:r,u=t=="column"?c?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;r.map.cellsInRect(h).forEach(f=>{const p=f+r.tableStart,m=l.doc.nodeAt(p);m&&l.setNodeMarkup(p,u,m.attrs)}),n(l)}return!0}}Ju("row",{useDeprecatedLogic:!0});Ju("column",{useDeprecatedLogic:!0});const vG=Ju("cell",{useDeprecatedLogic:!0});function yG(t,e){if(e<0){const s=t.nodeBefore;if(s)return t.pos-s.nodeSize;for(let n=t.index(-1)-1,i=t.before();n>=0;n--){const r=t.node(-1).child(n),l=r.lastChild;if(l)return i-1-l.nodeSize;i-=r.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const s=t.node(-1);for(let n=t.indexAfter(-1),i=t.after();n<s.childCount;n++){const r=s.child(n);if(r.childCount)return i+1;i+=r.nodeSize}}return null}function ib(t){return function(e,s){if(!$i(e))return!1;const n=yG(s1(e),t);if(n==null)return!1;if(s){const i=e.doc.resolve(n);s(e.tr.setSelection(Wr.between(i,Qq(i))).scrollIntoView())}return!0}}function _G(t,e){const s=t.selection.$anchor;for(let n=s.depth;n>0;n--)if(s.node(n).type.spec.tableRole=="table")return e&&e(t.tr.delete(s.before(n),s.after(n)).scrollIntoView()),!0;return!1}function ah(t,e){const s=t.selection;if(!(s instanceof is))return!1;if(e){const n=t.tr,i=yn(t.schema).cell.createAndFill().content;s.forEachCell((r,l)=>{r.content.eq(i)||n.replace(n.mapping.map(l+1),n.mapping.map(l+r.nodeSize-1),new Qo(i,0,0))}),n.docChanged&&e(n)}return!0}function LG(t){if(t.size===0)return null;let{content:e,openStart:s,openEnd:n}=t;for(;e.childCount==1&&(s>0&&n>0||e.child(0).type.spec.tableRole=="table");)s--,n--,e=e.child(0).content;const i=e.child(0),r=i.type.spec.tableRole,l=i.type.schema,a=[];if(r=="row")for(let c=0;c<e.childCount;c++){let d=e.child(c).content;const h=c?0:Math.max(0,s-1),u=c<e.childCount-1?0:Math.max(0,n-1);(h||u)&&(d=Rp(yn(l).row,new Qo(d,h,u)).content),a.push(d)}else if(r=="cell"||r=="header_cell")a.push(s||n?Rp(yn(l).row,new Qo(e,s,n)).content:e);else return null;return wG(l,a)}function wG(t,e){const s=[];for(let i=0;i<e.length;i++){const r=e[i];for(let l=r.childCount-1;l>=0;l--){const{rowspan:a,colspan:c}=r.child(l).attrs;for(let d=i;d<i+a;d++)s[d]=(s[d]||0)+c}}let n=0;for(let i=0;i<s.length;i++)n=Math.max(n,s[i]);for(let i=0;i<s.length;i++)if(i>=e.length&&e.push(ur.empty),s[i]<n){const r=yn(t).cell.createAndFill(),l=[];for(let a=s[i];a<n;a++)l.push(r);e[i]=e[i].append(ur.from(l))}return{height:e.length,width:n,rows:e}}function Rp(t,e){const s=t.createAndFill();return new gV(s).replace(0,s.content.size,e).doc}function SG({width:t,height:e,rows:s},n,i){if(t!=n){const r=[],l=[];for(let a=0;a<s.length;a++){const c=s[a],d=[];for(let h=r[a]||0,u=0;h<n;u++){let f=c.child(u%c.childCount);h+f.attrs.colspan>n&&(f=f.type.createChecked(sa(f.attrs,f.attrs.colspan,h+f.attrs.colspan-n),f.content)),d.push(f),h+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)r[a+p]=(r[a+p]||0)+f.attrs.colspan}l.push(ur.from(d))}s=l,t=n}if(e!=i){const r=[];for(let l=0,a=0;l<i;l++,a++){const c=[],d=s[a%e];for(let h=0;h<d.childCount;h++){let u=d.child(h);l+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),c.push(u)}r.push(ur.from(c))}s=r,e=i}return{width:t,height:e,rows:s}}function kG(t,e,s,n,i,r,l){const a=t.doc.type.schema,c=yn(a);let d,h;if(i>e.width)for(let u=0,f=0;u<e.height;u++){const p=s.child(u);f+=p.nodeSize;const m=[];let g;p.lastChild==null||p.lastChild.type==c.cell?g=d||(d=c.cell.createAndFill()):g=h||(h=c.header_cell.createAndFill());for(let x=e.width;x<i;x++)m.push(g);t.insert(t.mapping.slice(l).map(f-1+n),m)}if(r>e.height){const u=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,i);m++){const x=m>=e.width?!1:s.nodeAt(e.map[g+m]).type==c.header_cell;u.push(x?h||(h=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}const f=c.row.create(null,ur.from(u)),p=[];for(let m=e.height;m<r;m++)p.push(f);t.insert(t.mapping.slice(l).map(n+s.nodeSize-2),p)}return!!(d||h)}function rb(t,e,s,n,i,r,l,a){if(l==0||l==e.height)return!1;let c=!1;for(let d=i;d<r;d++){const h=l*e.width+d,u=e.map[h];if(e.map[h-e.width]==u){c=!0;const f=s.nodeAt(u),{top:p,left:m}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(a).map(u+n),null,{...f.attrs,rowspan:l-p}),t.insert(t.mapping.slice(a).map(e.positionAt(l,m,s)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-l})),d+=f.attrs.colspan-1}}return c}function ob(t,e,s,n,i,r,l,a){if(l==0||l==e.width)return!1;let c=!1;for(let d=i;d<r;d++){const h=d*e.width+l,u=e.map[h];if(e.map[h-1]==u){c=!0;const f=s.nodeAt(u),p=e.colCount(u),m=t.mapping.slice(a).map(u+n);t.setNodeMarkup(m,null,sa(f.attrs,l-p,f.attrs.colspan-(l-p))),t.insert(m+f.nodeSize,f.type.createAndFill(sa(f.attrs,0,l-p))),d+=f.attrs.rowspan-1}}return c}function lb(t,e,s,n,i){let r=s?t.doc.nodeAt(s-1):t.doc;if(!r)throw new Error("No table found");let l=Ts.get(r);const{top:a,left:c}=n,d=c+i.width,h=a+i.height,u=t.tr;let f=0;function p(){if(r=s?u.doc.nodeAt(s-1):u.doc,!r)throw new Error("No table found");l=Ts.get(r),f=u.mapping.maps.length}kG(u,l,r,s,d,h,f)&&p(),rb(u,l,r,s,c,d,a,f)&&p(),rb(u,l,r,s,c,d,h,f)&&p(),ob(u,l,r,s,a,h,c,f)&&p(),ob(u,l,r,s,a,h,d,f)&&p();for(let m=a;m<h;m++){const g=l.positionAt(m,c,r),x=l.positionAt(m,d,r);u.replace(u.mapping.slice(f).map(g+s),u.mapping.slice(f).map(x+s),new Qo(i.rows[m-a],0,0))}p(),u.setSelection(new is(u.doc.resolve(s+l.positionAt(a,c,r)),u.doc.resolve(s+l.positionAt(h-1,d-1,r)))),e(u)}const jG=mV({ArrowLeft:ch("horiz",-1),ArrowRight:ch("horiz",1),ArrowUp:ch("vert",-1),ArrowDown:ch("vert",1),"Shift-ArrowLeft":dh("horiz",-1),"Shift-ArrowRight":dh("horiz",1),"Shift-ArrowUp":dh("vert",-1),"Shift-ArrowDown":dh("vert",1),Backspace:ah,"Mod-Backspace":ah,Delete:ah,"Mod-Delete":ah});function zh(t,e,s){return s.eq(t.selection)?!1:(e&&e(t.tr.setSelection(s).scrollIntoView()),!0)}function ch(t,e){return(s,n,i)=>{if(!i)return!1;const r=s.selection;if(r instanceof is)return zh(s,n,ir.near(r.$headCell,e));if(t!="horiz"&&!r.empty)return!1;const l=Hw(i,t,e);if(l==null)return!1;if(t=="horiz")return zh(s,n,ir.near(s.doc.resolve(r.head+e),e));{const a=s.doc.resolve(l),c=Mw(a,t,e);let d;return c?d=ir.near(c,1):e<0?d=ir.near(s.doc.resolve(a.before(-1)),-1):d=ir.near(s.doc.resolve(a.after(-1)),1),zh(s,n,d)}}}function dh(t,e){return(s,n,i)=>{if(!i)return!1;const r=s.selection;let l;if(r instanceof is)l=r;else{const c=Hw(i,t,e);if(c==null)return!1;l=new is(s.doc.resolve(c))}const a=Mw(l.$headCell,t,e);return a?zh(s,n,new is(l.$anchorCell,a)):!1}}function CG(t,e){const s=t.state.doc,n=ta(s.resolve(e));return n?(t.dispatch(t.state.tr.setSelection(new is(n))),!0):!1}function NG(t,e,s){if(!$i(t.state))return!1;let n=LG(s);const i=t.state.selection;if(i instanceof is){n||(n={width:1,height:1,rows:[ur.from(Rp(yn(t.state.schema).cell,s))]});const r=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),a=Ts.get(r).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return n=SG(n,a.right-a.left,a.bottom-a.top),lb(t.state,t.dispatch,l,a,n),!0}else if(n){const r=s1(t.state),l=r.start(-1);return lb(t.state,t.dispatch,l,Ts.get(r.node(-1)).findCell(r.pos-l),n),!0}else return!1}function TG(t,e){var s;if(e.button!=0||e.ctrlKey||e.metaKey)return;const n=ab(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof is)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(i=ta(t.state.selection.$anchor))!=null&&((s=nm(t,e))===null||s===void 0?void 0:s.pos)!=i.pos)r(i,e),e.preventDefault();else if(!n)return;function r(c,d){let h=nm(t,d);const u=Yo.getState(t.state)==null;if(!h||!H3(c,h))if(u)h=c;else return;const f=new is(c,h);if(u||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);u&&p.setMeta(Yo,c.pos),t.dispatch(p)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",a),Yo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Yo,-1))}function a(c){const d=c,h=Yo.getState(t.state);let u;if(h!=null)u=t.state.doc.resolve(h);else if(ab(t,d.target)!=n&&(u=nm(t,e),!u))return l();u&&r(u,d)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",a)}function Hw(t,e,s){if(!(t.state.selection instanceof Wr))return null;const{$head:n}=t.state.selection;for(let i=n.depth-1;i>=0;i--){const r=n.node(i);if((s<0?n.index(i):n.indexAfter(i))!=(s<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const l=n.before(i),a=e=="vert"?s>0?"down":"up":s>0?"right":"left";return t.endOfTextblock(a)?l:null}}return null}function ab(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function nm(t,e){const s=t.posAtCoords({left:e.clientX,top:e.clientY});if(!s)return null;let{inside:n,pos:i}=s;return n>=0&&ta(t.state.doc.resolve(n))||ta(t.state.doc.resolve(i))}var VG=class{constructor(e,s){this.node=e,this.defaultCellMinWidth=s,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${s}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Dp(e,this.colgroup,this.table,s),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Dp(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Dp(t,e,s,n,i,r){let l=0,a=!0,c=e.firstChild;const d=t.firstChild;if(d){for(let u=0,f=0;u<d.childCount;u++){const{colspan:p,colwidth:m}=d.child(u).attrs;for(let g=0;g<p;g++,f++){const x=i==f?r:m&&m[g],b=x?x+"px":"";if(l+=x||n,x||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const y=document.createElement("col");y.style.width=b,e.appendChild(y)}}}for(;c;){var h;const u=c.nextSibling;(h=c.parentNode)===null||h===void 0||h.removeChild(c),c=u}a?(s.style.width=l+"px",s.style.minWidth=""):(s.style.width="",s.style.minWidth=l+"px")}}const Gn=new Vi("tableColumnResizing");function AG({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:s=100,View:n=VG,lastColumnResizable:i=!0}={}){const r=new ud({key:Gn,state:{init(l,a){var c;const d=(c=r.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,h=yn(a.schema).table.name;return n&&d&&(d[h]=(u,f)=>new n(u,s,f)),new PG(-1,!1)},apply(l,a){return a.apply(l)}},props:{attributes:l=>{const a=Gn.getState(l);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,a)=>{EG(l,a,t,i)},mouseleave:l=>{RG(l)},mousedown:(l,a)=>{DG(l,a,e,s)}},decorations:l=>{const a=Gn.getState(l);if(a&&a.activeHandle>-1)return BG(l,a.activeHandle)},nodeViews:{}}});return r}var PG=class Fh{constructor(e,s){this.activeHandle=e,this.dragging=s}apply(e){const s=this,n=e.getMeta(Gn);if(n&&n.setHandle!=null)return new Fh(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new Fh(s.activeHandle,n.setDragging);if(s.activeHandle>-1&&e.docChanged){let i=e.mapping.map(s.activeHandle,-1);return Ep(e.doc.resolve(i))||(i=-1),new Fh(i,s.dragging)}return s}};function EG(t,e,s,n){if(!t.editable)return;const i=Gn.getState(t.state);if(i&&!i.dragging){const r=MG(e.target);let l=-1;if(r){const{left:a,right:c}=r.getBoundingClientRect();e.clientX-a<=s?l=cb(t,e,"left",s):c-e.clientX<=s&&(l=cb(t,e,"right",s))}if(l!=i.activeHandle){if(!n&&l!==-1){const a=t.state.doc.resolve(l),c=a.node(-1),d=Ts.get(c),h=a.start(-1);if(d.colCount(a.pos-h)+a.nodeAfter.attrs.colspan-1==d.width-1)return}Kw(t,l)}}}function RG(t){if(!t.editable)return;const e=Gn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Kw(t,-1)}function DG(t,e,s,n){var i;if(!t.editable)return!1;const r=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=Gn.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const a=t.state.doc.nodeAt(l.activeHandle),c=IG(t,l.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Gn,{setDragging:{startX:e.clientX,startWidth:c}}));function d(u){r.removeEventListener("mouseup",d),r.removeEventListener("mousemove",h);const f=Gn.getState(t.state);f?.dragging&&(OG(t,f.activeHandle,db(f.dragging,u,s)),t.dispatch(t.state.tr.setMeta(Gn,{setDragging:null})))}function h(u){if(!u.which)return d(u);const f=Gn.getState(t.state);if(f&&f.dragging){const p=db(f.dragging,u,s);ub(t,f.activeHandle,p,n)}}return ub(t,l.activeHandle,c,n),r.addEventListener("mouseup",d),r.addEventListener("mousemove",h),e.preventDefault(),!0}function IG(t,e,{colspan:s,colwidth:n}){const i=n&&n[n.length-1];if(i)return i;const r=t.domAtPos(e);let l=r.node.childNodes[r.offset].offsetWidth,a=s;if(n)for(let c=0;c<s;c++)n[c]&&(l-=n[c],a--);return l/a}function MG(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function cb(t,e,s,n){const i=s=="right"?-n:n,r=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!r)return-1;const{pos:l}=r,a=ta(t.state.doc.resolve(l));if(!a)return-1;if(s=="right")return a.pos;const c=Ts.get(a.node(-1)),d=a.start(-1),h=c.map.indexOf(a.pos-d);return h%c.width==0?-1:d+c.map[h-1]}function db(t,e,s){const n=e.clientX-t.startX;return Math.max(s,t.startWidth+n)}function Kw(t,e){t.dispatch(t.state.tr.setMeta(Gn,{setHandle:e}))}function OG(t,e,s){const n=t.state.doc.resolve(e),i=n.node(-1),r=Ts.get(i),l=n.start(-1),a=r.colCount(n.pos-l)+n.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let d=0;d<r.height;d++){const h=d*r.width+a;if(d&&r.map[h]==r.map[h-r.width])continue;const u=r.map[h],f=i.nodeAt(u).attrs,p=f.colspan==1?0:a-r.colCount(u);if(f.colwidth&&f.colwidth[p]==s)continue;const m=f.colwidth?f.colwidth.slice():$G(f.colspan);m[p]=s,c.setNodeMarkup(l+u,null,{...f,colwidth:m})}c.docChanged&&t.dispatch(c)}function ub(t,e,s,n){const i=t.state.doc.resolve(e),r=i.node(-1),l=i.start(-1),a=Ts.get(r).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let c=t.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&Dp(r,c.firstChild,c,n,a,s)}function $G(t){return Array(t).fill(0)}function BG(t,e){const s=[],n=t.doc.resolve(e),i=n.node(-1);if(!i)return qm.empty;const r=Ts.get(i),l=n.start(-1),a=r.colCount(n.pos-l)+n.nodeAfter.attrs.colspan-1;for(let d=0;d<r.height;d++){const h=a+d*r.width;if((a==r.width-1||r.map[h]!=r.map[h+1])&&(d==0||r.map[h]!=r.map[h-r.width])){var c;const u=r.map[h],f=l+u+i.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((c=Gn.getState(t))===null||c===void 0)&&c.dragging&&s.push(Gm.node(l+u,l+u+i.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),s.push(Gm.widget(f,p))}}return qm.create(t.doc,s)}function zG({allowTableNodeSelection:t=!1}={}){return new ud({key:Yo,state:{init(){return null},apply(e,s){const n=e.getMeta(Yo);if(n!=null)return n==-1?null:n;if(s==null||!e.docChanged)return s;const{deleted:i,pos:r}=e.mapping.mapResult(s);return i?null:r}},props:{decorations:eG,handleDOMEvents:{mousedown:TG},createSelectionBetween(e){return Yo.getState(e.state)!=null?e.state.selection:null},handleTripleClick:CG,handleKeyDown:jG,handlePaste:NG},appendTransaction(e,s,n){return nG(n,zw(n,s),t)}})}function FG(t,e){const s=Math.min(t.top,e.top),n=Math.max(t.bottom,e.bottom),i=Math.min(t.left,e.left),r=Math.max(t.right,e.right)-i,l=n-s;return new DOMRect(i,s,r,l)}var UG=class{get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(J2(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(I6(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(Y2(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(M6(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(O6(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push($6(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(B6(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(z6(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t,e;const{selection:s}=this.editor.state,n=(t=this.getReferencedVirtualElement)===null||t===void 0?void 0:t.call(this);if(n)return n;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const i=Q6(this.view,s.from,s.to);let r={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(s instanceof J6){let l=this.view.nodeDOM(s.from);const a=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");a&&(l=a),l&&(r={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(s instanceof is){const{$anchorCell:l,$headCell:a}=s,c=l?l.pos:a.pos,d=a?a.pos:l.pos,h=this.view.nodeDOM(c),u=this.view.nodeDOM(d);if(!h||!u)return;const f=h===u?h.getBoundingClientRect():FG(h.getBoundingClientRect(),u.getBoundingClientRect());r={getBoundingClientRect:()=>f,getClientRects:()=>[f]}}return r}constructor({editor:t,element:e,view:s,pluginKey:n="bubbleMenu",updateDelay:i=250,resizeDelay:r=60,shouldShow:l,appendTo:a,getReferencedVirtualElement:c,options:d}){var h;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:f,from:p,to:m})=>{const{doc:g,selection:x}=f,{empty:b}=x,y=!g.textBetween(p,m).length&&xV(f.selection),_=this.element.contains(document.activeElement);return!(!(u.hasFocus()||_)||b||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var f;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((f=this.element.parentNode)===null||f===void 0)&&f.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,f)=>{const p=!f?.selection.eq(u.state.selection),m=!f?.doc.eq(u.state.doc);!p&&!m||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,p,m,f)},this.updateDelay))},this.updateHandler=(u,f,p,m)=>{const{composing:g}=u;if(!(g||!f&&!p)){if(!this.getShouldShow(m)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:u})=>{const f=u.getMeta(this.pluginKey);f==="updatePosition"?this.updatePosition():f&&typeof f=="object"&&f.type==="updateOptions"?this.updateOptions(f.options):f==="hide"?this.hide():f==="show"&&(this.updatePosition(),this.show())},this.editor=t,this.element=e,this.view=s,this.pluginKey=n,this.updateDelay=i,this.resizeDelay=r,this.appendTo=a,this.scrollTarget=(h=d?.scrollTarget)!==null&&h!==void 0?h:window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...d},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(s,s.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const t=this.virtualElement;t&&Q2(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:s,strategy:n,middlewareData:i})=>{var r,l;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((r=i.hide)===null||r===void 0)&&r.referenceHidden||!((l=i.hide)===null||l===void 0)&&l.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${s}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(t,e){const{state:s}=t,n=s.selection.from!==s.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(t,e);return}const i=!e?.selection.eq(t.state.selection),r=!e?.doc.eq(t.state.doc);this.updateHandler(t,i,r,e)}getShouldShow(t){var e;const{state:s}=this.view,{selection:n}=s,{ranges:i}=n,r=Math.min(...i.map(a=>a.$from.pos)),l=Math.max(...i.map(a=>a.$to.pos));return((e=this.shouldShow)===null||e===void 0?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:s,oldState:t,from:r,to:l}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)===null||t===void 0||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(t){if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=t.getReferencedVirtualElement),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){var e;const s=(e=t.options.scrollTarget)!==null&&e!==void 0?e:window;s!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=s,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Ww=t=>new ud({key:typeof t.pluginKey=="string"?new Vi(t.pluginKey):t.pluginKey,view:e=>new UG({view:e,...t})});xi.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Ww({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var HG=class{getTextContent(t){return bV(t,{textSerializers:vV(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(J2(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(I6(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(Y2(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(M6(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(O6(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push($6(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(B6(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(z6(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}constructor({editor:t,element:e,view:s,pluginKey:n="floatingMenu",updateDelay:i=250,resizeDelay:r=60,options:l,appendTo:a,shouldShow:c}){var d;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:h,state:u})=>{const{selection:f}=u,{$anchor:p,empty:m}=f,g=p.depth===1,x=p.parent.isTextblock&&!p.parent.type.spec.code&&!p.parent.textContent&&p.parent.childCount===0&&!this.getTextContent(p.parent);return!(!h.hasFocus()||!m||!g||!x||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(h,u,f,p)=>{const{composing:m}=h;if(!(m||!u&&!f)){if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var u;if(this.preventHide){this.preventHide=!1;return}h?.relatedTarget&&(!((u=this.element.parentNode)===null||u===void 0)&&u.contains(h.relatedTarget))||h?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:h})=>{const u=h.getMeta(this.pluginKey);u==="updatePosition"?this.updatePosition():u&&typeof u=="object"&&u.type==="updateOptions"?this.updateOptions(u.options):u==="hide"?this.hide():u==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=t,this.element=e,this.view=s,this.pluginKey=n,this.updateDelay=i,this.resizeDelay=r,this.appendTo=a,this.scrollTarget=(d=l?.scrollTarget)!==null&&d!==void 0?d:window,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(s,s.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(t){var e;const{state:s}=this.view,{selection:n}=s,{ranges:i}=n,r=Math.min(...i.map(a=>a.$from.pos)),l=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)===null||e===void 0?void 0:e.call(this,{editor:this.editor,view:this.view,state:s,oldState:t,from:r,to:l})}updateOptions(t){if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){var e;const s=(e=t.options.scrollTarget)!==null&&e!==void 0?e:window;s!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=s,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}updatePosition(){var t;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const{selection:e}=this.editor.state,s=Q6(this.view,e.from,e.to);Q2({getBoundingClientRect:()=>s,getClientRects:()=>[s]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:r,middlewareData:l})=>{var a,c;if(!((a=l.hide)===null||a===void 0)&&a.referenceHidden||!((c=l.hide)===null||c===void 0)&&c.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const s=!e?.selection.eq(t.state.selection),n=!e?.doc.eq(t.state.doc);this.updateHandler(t,s,n,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)===null||t===void 0||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const qw=t=>new ud({key:typeof t.pluginKey=="string"?new Vi(t.pluginKey):t.pluginKey,view:e=>new HG({view:e,...t})});xi.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:t,dispatch:e})=>(e&&t.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[qw({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Gw(t,e){return t??new Vi(e)}const KG=typeof window<"u"?P.useLayoutEffect:P.useEffect,Yw=new Set(["left","opacity","position","top","visibility","width"]),WG=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),qG=new Set(["children","className","style"]),GG=new Set(["tabIndex"]),YG=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),JG={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function Ip(t,e){return/^on[A-Z]/.test(t)&&typeof e=="function"}function QG(t){return t.startsWith("aria-")||t.startsWith("data-"),t}function XG(t){return t.startsWith("aria-")||t.startsWith("data-")||YG.has(t)}function Jw(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function ZG(t){var e;const s=t.endsWith("Capture"),n=(s?t.slice(0,-7):t).slice(2);return{eventName:(e=JG[n])!==null&&e!==void 0?e:n.toLowerCase(),options:s?{capture:!0}:void 0}}function eY(t,e){let s=e.defaultPrevented,n=!1;const i=Object.create(e);return Object.defineProperties(i,{nativeEvent:{value:e},currentTarget:{value:t},target:{value:e.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>s},isPropagationStopped:{value:()=>n},preventDefault:{value:()=>{s=!0,e.preventDefault()}},stopPropagation:{value:()=>{n=!0,e.stopPropagation()}}}),i}function im(t){return GG.has(t)}function hb(t,e,s){if(e==="tabIndex"){t.tabIndex=Number(s);return}t[e]=s}function tY(t,e){if(e==="tabIndex"){t.removeAttribute("tabindex");return}const s=t[e];if(typeof s=="boolean"){t[e]=!1;return}if(typeof s=="number"){t[e]=0;return}t[e]=""}function sY(t,e){return typeof e!="number"||e===0||t.startsWith("--")||WG.has(t)?String(e):`${e}px`}function nY(t,e){Yw.has(e)||t.style.removeProperty(Jw(e))}function iY(t,e,s){Yw.has(e)||t.style.setProperty(Jw(e),sY(e,s))}function rY(t,e,s){new Set([...Object.keys(e),...Object.keys(s)]).forEach(n=>{if(qG.has(n)||!XG(n)||Ip(n,e[n])||Ip(n,s[n]))return;const i=e[n],r=s[n];if(i===r)return;const l=QG(n);if(r==null||r===!1){im(n)&&tY(t,n),t.removeAttribute(l);return}if(r===!0){im(n)&&hb(t,n,!0),t.setAttribute(l,"");return}if(im(n)){hb(t,n,r);return}t.setAttribute(l,String(r))})}function oY(t,e,s){if(e!==s){if(s){t.className=s;return}t.removeAttribute("class")}}function lY(t,e,s){const n=e??{},i=s??{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(r=>{const l=n[r],a=i[r];if(l!==a){if(a==null){nY(t,r);return}iY(t,r,a)}})}function aY(t,e,s){e.forEach(({eventName:i,listener:r,options:l})=>{t.removeEventListener(i,r,l)});const n=[];return Object.entries(s).forEach(([i,r])=>{if(!Ip(i,r))return;const{eventName:l,options:a}=ZG(i),c=d=>{r(eY(t,d))};t.addEventListener(l,c,a),n.push({eventName:l,listener:c,options:a})}),n}function Qw(t,e){const s=P.useRef({}),n=P.useRef([]);KG(()=>{const i=s.current;return oY(t,i.className,e.className),lY(t,i.style,e.style),rY(t,i,e),n.current=aY(t,n.current,e),s.current=e,()=>{n.current.forEach(({eventName:r,listener:l,options:a})=>{t.removeEventListener(r,l,a)}),n.current=[]}},[t,e])}const cY=Nt.forwardRef(({pluginKey:t,editor:e,updateDelay:s,resizeDelay:n,appendTo:i,shouldShow:r=null,getReferencedVirtualElement:l,options:a,children:c,...d},h)=>{const u=P.useRef(document.createElement("div")),f=P.useRef(Gw(t,"bubbleMenu")).current;Qw(u.current,d),typeof h=="function"?h(u.current):h&&(h.current=u.current);const{editor:p}=i0(),m=e||p,g={updateDelay:s,resizeDelay:n,appendTo:i,pluginKey:f,shouldShow:r,getReferencedVirtualElement:l,options:a},x=P.useRef(g);x.current=g;const[b,y]=P.useState(!1),_=P.useRef(!0);return P.useEffect(()=>{if(m?.isDestroyed)return;if(!m){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=u.current;v.style.visibility="hidden",v.style.position="absolute";const L=Ww({...x.current,editor:m,element:v});m.registerPlugin(L);const S=x.current.pluginKey;return _.current=!0,y(!0),()=>{y(!1),m.unregisterPlugin(S),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[m]),P.useEffect(()=>{if(!(!b||!m||m.isDestroyed)){if(_.current){_.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:"updateOptions",options:x.current}))}},[b,m,s,n,r,a,i,l,f]),kn.createPortal(c,u.current)});Nt.forwardRef(({pluginKey:t,editor:e,updateDelay:s,resizeDelay:n,appendTo:i,shouldShow:r=null,options:l,children:a,...c},d)=>{const h=P.useRef(document.createElement("div")),u=P.useRef(Gw(t,"floatingMenu")).current;Qw(h.current,c),typeof d=="function"?d(h.current):d&&(d.current=h.current);const{editor:f}=i0(),p=e||f,m={updateDelay:s,resizeDelay:n,appendTo:i,pluginKey:u,shouldShow:r,options:l},g=P.useRef(m);g.current=m;const[x,b]=P.useState(!1),y=P.useRef(!0);return P.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const _=h.current;_.style.visibility="hidden",_.style.position="absolute";const v=qw({...g.current,editor:p,element:_});p.registerPlugin(v);const L=g.current.pluginKey;return y.current=!0,b(!0),()=>{b(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{_.parentNode&&_.parentNode.removeChild(_)})}},[p]),P.useEffect(()=>{if(!(!x||!p||p.isDestroyed)){if(y.current){y.current=!1;return}p.view.dispatch(p.state.tr.setMeta(u,{type:"updateOptions",options:g.current}))}},[x,p,s,n,r,l,i,u]),kn.createPortal(a,h.current)});const dY=new Set(["http:","https:","mailto:","tel:","ftp:"]);function Xw(t){if(t.startsWith("/")||t.startsWith(".")||t.startsWith("#"))return!0;try{const e=new URL(t,"https://placeholder.invalid");return dY.has(e.protocol)}catch{return!1}}function Zw(t){const e=t.trim();return e?e.startsWith("/")||e.startsWith(".")||e.startsWith("#")||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)?e:`https://${e}`:""}const uY="noopener noreferrer nofollow";function es(t){const e=z.c(8),{active:s,label:n,onClick:i,children:r}=t,l=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let a;e[0]!==l?(a=ie("flex h-7 w-7 items-center justify-center rounded transition-colors cursor-pointer",l),e[0]=l,e[1]=a):a=e[1];let c;return e[2]!==s||e[3]!==r||e[4]!==n||e[5]!==i||e[6]!==a?(c=o.jsx("button",{type:"button","aria-label":n,"aria-pressed":s,onMouseDown:hY,onClick:i,className:a,children:r}),e[2]=s,e[3]=r,e[4]=n,e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function hY(t){return t.preventDefault()}function fb(t){const e=z.c(7),{active:s,label:n,onSelect:i}=t,r=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let l;e[0]!==r?(l=ie("flex-1 rounded px-2 py-1 text-xs transition-colors cursor-pointer",r),e[0]=r,e[1]=l):l=e[1];let a;return e[2]!==s||e[3]!==n||e[4]!==i||e[5]!==l?(a=o.jsx("button",{type:"button","aria-pressed":s,onMouseDown:fY,onClick:i,className:l,children:n}),e[2]=s,e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function fY(t){return t.preventDefault()}function mY(t){const e=z.c(36),{editor:s,active:n,open:i,onOpenChange:r}=t,l=re(),[a,c]=P.useState(""),[d,h]=P.useState(!0),[u,f]=P.useState(!1);let p;e[0]!==n||e[1]!==s||e[2]!==r?(p=()=>{const N=s.getAttributes("link");c(typeof N.href=="string"?N.href:""),h(n?N.target==="_blank":!0),f(!1),r(!0)},e[0]=n,e[1]=s,e[2]=r,e[3]=p):p=e[3];const m=p;let g;e[4]!==s||e[5]!==r?(g=()=>{r(!1),s.chain().focus().run()},e[4]=s,e[5]=r,e[6]=g):g=e[6];const x=g;let b;e[7]!==a||e[8]!==s||e[9]!==d||e[10]!==r?(b=()=>{const N=Zw(a);if(N===""){s.chain().focus().extendMarkRange("link").unsetLink().run(),r(!1);return}if(!Xw(N)){f(!0);return}s.chain().focus().extendMarkRange("link").setLink({href:N,target:d?"_blank":null,rel:d?uY:null}).run(),r(!1)},e[7]=a,e[8]=s,e[9]=d,e[10]=r,e[11]=b):b=e[11];const y=b;let _;e[12]!==s||e[13]!==r?(_=()=>{s.chain().focus().extendMarkRange("link").unsetLink().run(),r(!1)},e[12]=s,e[13]=r,e[14]=_):_=e[14];const v=_;let L;e[15]!==l?(L=l("sectionsEditor.richTextLinkControl.linkButtonLabel"),e[15]=l,e[16]=L):L=e[16];const S=i?x:m;let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(ag,{size:14}),e[17]=w):w=e[17];let k;e[18]!==n||e[19]!==L||e[20]!==S?(k=o.jsx(es,{active:n,label:L,onClick:S,children:w}),e[18]=n,e[19]=L,e[20]=S,e[21]=k):k=e[21];let j;e[22]!==n||e[23]!==y||e[24]!==x||e[25]!==a||e[26]!==u||e[27]!==d||e[28]!==r||e[29]!==i||e[30]!==v||e[31]!==l?(j=i&&o.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 flex-col gap-1 rounded-md border bg-popover p-1 shadow-md",onBlur:N=>{N.currentTarget.contains(N.relatedTarget)||r(!1)},children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("input",{autoFocus:!0,type:"text","aria-label":l("sectionsEditor.richTextLinkControl.urlInputAriaLabel"),"aria-invalid":u,placeholder:l("sectionsEditor.richTextLinkControl.urlInputPlaceholder"),value:a,onChange:N=>{c(N.target.value),f(!1)},onKeyDown:N=>{N.key==="Enter"?(N.preventDefault(),y()):N.key==="Escape"&&(N.preventDefault(),x())},className:ie("h-7 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",u&&"text-destructive")}),o.jsx(es,{active:!1,label:l("sectionsEditor.richTextLinkControl.applyLinkLabel"),onClick:y,children:o.jsx(Kt,{size:14})}),n&&o.jsx(es,{active:!1,label:l("sectionsEditor.richTextLinkControl.removeLinkLabel"),onClick:v,children:o.jsx(Gs,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-0.5 rounded bg-muted/40 p-0.5",children:[o.jsx(fb,{active:!d,label:l("sectionsEditor.richTextLinkControl.sameTabLabel"),onSelect:()=>h(!1)}),o.jsx(fb,{active:d,label:l("sectionsEditor.richTextLinkControl.newTabLabel"),onSelect:()=>h(!0)})]})]}),e[22]=n,e[23]=y,e[24]=x,e[25]=a,e[26]=u,e[27]=d,e[28]=r,e[29]=i,e[30]=v,e[31]=l,e[32]=j):j=e[32];let C;return e[33]!==k||e[34]!==j?(C=o.jsxs("div",{className:"relative",children:[k,j]}),e[33]=k,e[34]=j,e[35]=C):C=e[35],C}function pY(t){const e=z.c(30),{editor:s}=t,n=re(),[i,r]=P.useState(!1),[l,a]=P.useState(""),[c,d]=P.useState(!1);let h;e[0]!==s?(h=s.isActive("link"),e[0]=s,e[1]=h):h=e[1];const u=h;let f;e[2]!==s||e[3]!==i?(f=()=>{if(i){r(!1);return}const w=s.getAttributes("link").href;a(typeof w=="string"?w:""),d(!1),r(!0)},e[2]=s,e[3]=i,e[4]=f):f=e[4];const p=f;let m;e[5]!==s?(m=()=>{s.chain().focus().extendMarkRange("link").unsetLink().run(),r(!1)},e[5]=s,e[6]=m):m=e[6];const g=m;let x;e[7]!==l||e[8]!==s||e[9]!==g?(x=()=>{const w=Zw(l);if(w===""){g();return}if(!Xw(w)){d(!0);return}s.chain().focus().extendMarkRange("link").setLink({href:w}).run(),r(!1)},e[7]=l,e[8]=s,e[9]=g,e[10]=x):x=e[10];const b=x;let y;e[11]!==n?(y=n("markdownEditor.link"),e[11]=n,e[12]=y):y=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ag,{size:14}),e[13]=_):_=e[13];let v;e[14]!==u||e[15]!==y||e[16]!==p?(v=o.jsx(es,{active:u,label:y,onClick:p,children:_}),e[14]=u,e[15]=y,e[16]=p,e[17]=v):v=e[17];let L;e[18]!==u||e[19]!==b||e[20]!==l||e[21]!==s||e[22]!==c||e[23]!==i||e[24]!==g||e[25]!==n?(L=i&&o.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md border bg-popover p-1 shadow-md",onBlur:w=>{w.currentTarget.contains(w.relatedTarget)||r(!1)},children:[o.jsx("input",{autoFocus:!0,type:"text","aria-label":n("markdownEditor.linkInputAriaLabel"),"aria-invalid":c,placeholder:n("markdownEditor.linkPlaceholder"),value:l,onChange:w=>{a(w.target.value),d(!1)},onKeyDown:w=>{w.key==="Enter"?(w.preventDefault(),b()):w.key==="Escape"&&(w.preventDefault(),r(!1),s.chain().focus().run())},className:ie("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",c&&"text-destructive")}),o.jsx(es,{active:!1,label:n("markdownEditor.linkApply"),onClick:b,children:o.jsx(Kt,{size:14})}),u&&o.jsx(es,{active:!1,label:n("markdownEditor.linkRemove"),onClick:g,children:o.jsx(Gs,{size:14})})]}),e[18]=u,e[19]=b,e[20]=l,e[21]=s,e[22]=c,e[23]=i,e[24]=g,e[25]=n,e[26]=L):L=e[26];let S;return e[27]!==v||e[28]!==L?(S=o.jsxs("div",{className:"relative",children:[v,L]}),e[27]=v,e[28]=L,e[29]=S):S=e[29],S}const rm=()=>{const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},mb=t=>{const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"text-[11px] font-semibold leading-none",children:s}),e[0]=s,e[1]=n):n=e[1],n},eS=[1,2,3],gY=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function xY(t){const e=z.c(20),{editor:s}=t,n=re(),[i,r]=P.useState(null);let l;e[0]!==s?(l={editor:s,selector:bY},e[0]=s,e[1]=l):l=e[1];const a=X6(l);let c;e[2]!==n?(c=n("markdownEditor.heading1"),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==n?(d=n("markdownEditor.heading2"),e[4]=n,e[5]=d):d=e[5];let h;e[6]!==n?(h=n("markdownEditor.heading3"),e[6]=n,e[7]=h):h=e[7];let u;e[8]!==c||e[9]!==d||e[10]!==h?(u={1:c,2:d,3:h},e[8]=c,e[9]=d,e[10]=h,e[11]=u):u=e[11];const f=u;let p;e[12]!==s||e[13]!==f||e[14]!==i||e[15]!==a||e[16]!==n?(p=i&&o.jsxs(cY,{editor:s,shouldShow:gY,appendTo:i,className:"flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-md","aria-label":n("markdownEditor.toolbarAriaLabel"),children:[o.jsx(es,{active:a.bold,label:n("markdownEditor.bold"),onClick:()=>s.chain().focus().toggleBold().run(),children:o.jsx(w8,{size:14})}),o.jsx(es,{active:a.italic,label:n("markdownEditor.italic"),onClick:()=>s.chain().focus().toggleItalic().run(),children:o.jsx(S8,{size:14})}),o.jsx(es,{active:a.strike,label:n("markdownEditor.strikethrough"),onClick:()=>s.chain().focus().toggleStrike().run(),children:o.jsx(k8,{size:14})}),o.jsx(es,{active:a.code,label:n("markdownEditor.code"),onClick:()=>s.chain().focus().toggleCode().run(),children:o.jsx(ga,{size:14})}),o.jsx(rm,{}),eS.map((g,x)=>o.jsx(es,{active:a.headings[x]??!1,label:f[g],onClick:()=>s.chain().focus().toggleHeading({level:g}).run(),children:o.jsx(mb,{children:`H${g}`})},g)),o.jsx(rm,{}),o.jsx(es,{active:a.bulletList,label:n("markdownEditor.bulletList"),onClick:()=>s.chain().focus().toggleBulletList().run(),children:o.jsx(Bg,{size:14})}),o.jsx(es,{active:a.orderedList,label:n("markdownEditor.orderedList"),onClick:()=>s.chain().focus().toggleOrderedList().run(),children:o.jsx(mb,{children:"1."})}),o.jsx(es,{active:a.blockquote,label:n("markdownEditor.quote"),onClick:()=>s.chain().focus().toggleBlockquote().run(),children:o.jsx(TA,{size:14})}),o.jsx(rm,{}),o.jsx(pY,{editor:s})]}),e[12]=s,e[13]=f,e[14]=i,e[15]=a,e[16]=n,e[17]=p):p=e[17];let m;return e[18]!==p?(m=o.jsx("div",{ref:r,className:"relative z-20",children:p}),e[18]=p,e[19]=m):m=e[19],m}function bY(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:eS.map(s=>e.isActive("heading",{level:s})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}function K3(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Sa=K3();function tS(t){Sa=t}var Dl={exec:()=>null};function It(t,e=""){let s=typeof t=="string"?t:t.source,n={replace:(i,r)=>{let l=typeof r=="string"?r:r.source;return l=l.replace(Cn.caret,"$1"),s=s.replace(i,l),n},getRegex:()=>new RegExp(s,e)};return n}var vY=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Cn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},yY=/^(?:[ \t]*(?:\n|$))+/,_Y=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,LY=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,P0=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,wY=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,W3=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,sS=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nS=It(sS).replace(/bull/g,W3).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),SY=It(sS).replace(/bull/g,W3).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),q3=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,kY=/^[^\n]+/,G3=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,jY=It(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",G3).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),CY=It(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,W3).getRegex(),n1="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Y3=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,NY=It("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Y3).replace("tag",n1).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),iS=It(q3).replace("hr",P0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",n1).getRegex(),TY=It(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",iS).getRegex(),J3={blockquote:TY,code:_Y,def:jY,fences:LY,heading:wY,hr:P0,html:NY,lheading:nS,list:CY,newline:yY,paragraph:iS,table:Dl,text:kY},pb=It("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",P0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",n1).getRegex(),VY={...J3,lheading:SY,table:pb,paragraph:It(q3).replace("hr",P0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",n1).getRegex()},AY={...J3,html:It(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Y3).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Dl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:It(q3).replace("hr",P0).replace("heading",` *#{1,6} *[^
17
+ `},hH={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:s}=t;return s?"Draggable item "+e.id+" was moved over droppable area "+s.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:s}=t;return s?"Draggable item "+e.id+" was dropped over droppable area "+s.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function fH(t){let{announcements:e=hH,container:s,hiddenTextDescribedById:n,screenReaderInstructions:i=uH}=t;const{announce:r,announcement:l}=aH(),a=N0("DndLiveRegion"),[c,d]=P.useState(!1);if(P.useEffect(()=>{d(!0)},[]),cH(P.useMemo(()=>({onDragStart(u){let{active:f}=u;r(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:p}=u;e.onDragMove&&r(e.onDragMove({active:f,over:p}))},onDragOver(u){let{active:f,over:p}=u;r(e.onDragOver({active:f,over:p}))},onDragEnd(u){let{active:f,over:p}=u;r(e.onDragEnd({active:f,over:p}))},onDragCancel(u){let{active:f,over:p}=u;r(e.onDragCancel({active:f,over:p}))}}),[r,e])),!c)return null;const h=Nt.createElement(Nt.Fragment,null,Nt.createElement(oH,{id:n,value:i.draggable}),Nt.createElement(lH,{id:a,announcement:l}));return s?kn.createPortal(h,s):h}var Us;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Us||(Us={}));function yf(){}function vr(t,e){return P.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function T0(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return P.useMemo(()=>[...e].filter(n=>n!=null),[...e])}const Di=Object.freeze({x:0,y:0});function FL(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function mH(t,e){const s=vf(t);if(!s)return"0 0";const n={x:(s.x-e.left)/e.width*100,y:(s.y-e.top)/e.height*100};return n.x+"% "+n.y+"%"}function UL(t,e){let{data:{value:s}}=t,{data:{value:n}}=e;return s-n}function pH(t,e){let{data:{value:s}}=t,{data:{value:n}}=e;return n-s}function R5(t){let{left:e,top:s,height:n,width:i}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e,y:s+n},{x:e+i,y:s+n}]}function HL(t,e){if(!t||t.length===0)return null;const[s]=t;return s[e]}function D5(t,e,s){return e===void 0&&(e=t.left),s===void 0&&(s=t.top),{x:e+t.width*.5,y:s+t.height*.5}}const A3=t=>{let{collisionRect:e,droppableRects:s,droppableContainers:n}=t;const i=D5(e,e.left,e.top),r=[];for(const l of n){const{id:a}=l,c=s.get(a);if(c){const d=FL(D5(c),i);r.push({id:a,data:{droppableContainer:l,value:d}})}}return r.sort(UL)},KL=t=>{let{collisionRect:e,droppableRects:s,droppableContainers:n}=t;const i=R5(e),r=[];for(const l of n){const{id:a}=l,c=s.get(a);if(c){const d=R5(c),h=i.reduce((f,p,m)=>f+FL(d[m],p),0),u=Number((h/4).toFixed(4));r.push({id:a,data:{droppableContainer:l,value:u}})}}return r.sort(UL)};function gH(t,e){const s=Math.max(e.top,t.top),n=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),r=Math.min(e.top+e.height,t.top+t.height),l=i-n,a=r-s;if(n<i&&s<r){const c=e.width*e.height,d=t.width*t.height,h=l*a,u=h/(c+d-h);return Number(u.toFixed(4))}return 0}const xH=t=>{let{collisionRect:e,droppableRects:s,droppableContainers:n}=t;const i=[];for(const r of n){const{id:l}=r,a=s.get(l);if(a){const c=gH(a,e);c>0&&i.push({id:l,data:{droppableContainer:r,value:c}})}}return i.sort(pH)};function bH(t,e,s){return{...t,scaleX:e&&s?e.width/s.width:1,scaleY:e&&s?e.height/s.height:1}}function WL(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Di}function vH(t){return function(s){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return i.reduce((l,a)=>({...l,top:l.top+t*a.y,bottom:l.bottom+t*a.y,left:l.left+t*a.x,right:l.right+t*a.x}),{...s})}}const yH=vH(1);function qL(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function _H(t,e,s){const n=qL(e);if(!n)return t;const{scaleX:i,scaleY:r,x:l,y:a}=n,c=t.left-l-(1-i)*parseFloat(s),d=t.top-a-(1-r)*parseFloat(s.slice(s.indexOf(" ")+1)),h=i?t.width/i:t.width,u=r?t.height/r:t.height;return{width:h,height:u,top:d,right:c+h,bottom:d+u,left:c}}const LH={ignoreTransform:!1};function wd(t,e){e===void 0&&(e=LH);let s=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:h}=Rn(t).getComputedStyle(t);d&&(s=_H(s,d,h))}const{top:n,left:i,width:r,height:l,bottom:a,right:c}=s;return{top:n,left:i,width:r,height:l,bottom:a,right:c}}function I5(t){return wd(t,{ignoreTransform:!0})}function wH(t){const e=t.innerWidth,s=t.innerHeight;return{top:0,left:0,right:e,bottom:s,width:e,height:s}}function SH(t,e){return e===void 0&&(e=Rn(t).getComputedStyle(t)),e.position==="fixed"}function kH(t,e){e===void 0&&(e=Rn(t).getComputedStyle(t));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const r=e[i];return typeof r=="string"?s.test(r):!1})}function G9(t,e){const s=[];function n(i){if(e!=null&&s.length>=e||!i)return s;if(V3(i)&&i.scrollingElement!=null&&!s.includes(i.scrollingElement))return s.push(i.scrollingElement),s;if(!j0(i)||$L(i)||s.includes(i))return s;const r=Rn(t).getComputedStyle(i);return i!==t&&kH(i,r)&&s.push(i),SH(i,r)?s:n(i.parentNode)}return t?n(t):s}function GL(t){const[e]=G9(t,1);return e??null}function Q1(t){return!K9||!t?null:_d(t)?t:T3(t)?V3(t)||t===Ld(t).scrollingElement?window:j0(t)?t:null:null}function YL(t){return _d(t)?t.scrollX:t.scrollLeft}function JL(t){return _d(t)?t.scrollY:t.scrollTop}function _p(t){return{x:YL(t),y:JL(t)}}var Zs;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Zs||(Zs={}));function QL(t){return!K9||!t?!1:t===document.scrollingElement}function XL(t){const e={x:0,y:0},s=QL(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},n={x:t.scrollWidth-s.width,y:t.scrollHeight-s.height},i=t.scrollTop<=e.y,r=t.scrollLeft<=e.x,l=t.scrollTop>=n.y,a=t.scrollLeft>=n.x;return{isTop:i,isLeft:r,isBottom:l,isRight:a,maxScroll:n,minScroll:e}}const jH={x:.2,y:.2};function CH(t,e,s,n,i){let{top:r,left:l,right:a,bottom:c}=s;n===void 0&&(n=10),i===void 0&&(i=jH);const{isTop:d,isBottom:h,isLeft:u,isRight:f}=XL(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*i.y,width:e.width*i.x};return!d&&r<=e.top+g.height?(p.y=Zs.Backward,m.y=n*Math.abs((e.top+g.height-r)/g.height)):!h&&c>=e.bottom-g.height&&(p.y=Zs.Forward,m.y=n*Math.abs((e.bottom-g.height-c)/g.height)),!f&&a>=e.right-g.width?(p.x=Zs.Forward,m.x=n*Math.abs((e.right-g.width-a)/g.width)):!u&&l<=e.left+g.width&&(p.x=Zs.Backward,m.x=n*Math.abs((e.left+g.width-l)/g.width)),{direction:p,speed:m}}function NH(t){if(t===document.scrollingElement){const{innerWidth:r,innerHeight:l}=window;return{top:0,left:0,right:r,bottom:l,width:r,height:l}}const{top:e,left:s,right:n,bottom:i}=t.getBoundingClientRect();return{top:e,left:s,right:n,bottom:i,width:t.clientWidth,height:t.clientHeight}}function ZL(t){return t.reduce((e,s)=>zc(e,_p(s)),Di)}function TH(t){return t.reduce((e,s)=>e+YL(s),0)}function VH(t){return t.reduce((e,s)=>e+JL(s),0)}function ew(t,e){if(e===void 0&&(e=wd),!t)return;const{top:s,left:n,bottom:i,right:r}=e(t);GL(t)&&(i<=0||r<=0||s>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const AH=[["x",["left","right"],TH],["y",["top","bottom"],VH]];class P3{constructor(e,s){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=G9(s),i=ZL(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[r,l,a]of AH)for(const c of l)Object.defineProperty(this,c,{get:()=>{const d=a(n),h=i[r]-d;return this.rect[c]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vu{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...s)})},this.target=e}add(e,s,n){var i;(i=this.target)==null||i.addEventListener(e,s,n),this.listeners.push([e,s,n])}}function PH(t){const{EventTarget:e}=Rn(t);return t instanceof e?t:Ld(t)}function X1(t,e){const s=Math.abs(t.x),n=Math.abs(t.y);return typeof e=="number"?Math.sqrt(s**2+n**2)>e:"x"in e&&"y"in e?s>e.x&&n>e.y:"x"in e?s>e.x:"y"in e?n>e.y:!1}var ri;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(ri||(ri={}));function M5(t){t.preventDefault()}function EH(t){t.stopPropagation()}var Et;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Et||(Et={}));const tw={start:[Et.Space,Et.Enter],cancel:[Et.Esc],end:[Et.Space,Et.Enter,Et.Tab]},RH=(t,e)=>{let{currentCoordinates:s}=e;switch(t.code){case Et.Right:return{...s,x:s.x+25};case Et.Left:return{...s,x:s.x-25};case Et.Down:return{...s,y:s.y+25};case Et.Up:return{...s,y:s.y-25}}};class La{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:s}}=e;this.props=e,this.listeners=new vu(Ld(s)),this.windowListeners=new vu(Rn(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ri.Resize,this.handleCancel),this.windowListeners.add(ri.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ri.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:s}=this.props,n=e.node.current;n&&ew(n),s(Di)}handleKeyDown(e){if(q9(e)){const{active:s,context:n,options:i}=this.props,{keyboardCodes:r=tw,coordinateGetter:l=RH,scrollBehavior:a="smooth"}=i,{code:c}=e;if(r.end.includes(c)){this.handleEnd(e);return}if(r.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:d}=n.current,h=d?{x:d.left,y:d.top}:Di;this.referenceCoordinates||(this.referenceCoordinates=h);const u=l(e,{active:s,context:n.current,currentCoordinates:h});if(u){const f=Gu(u,h),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(const g of m){const x=e.code,{isTop:b,isRight:y,isLeft:_,isBottom:v,maxScroll:L,minScroll:S}=XL(g),w=NH(g),k={x:Math.min(x===Et.Right?w.right-w.width/2:w.right,Math.max(x===Et.Right?w.left:w.left+w.width/2,u.x)),y:Math.min(x===Et.Down?w.bottom-w.height/2:w.bottom,Math.max(x===Et.Down?w.top:w.top+w.height/2,u.y))},j=x===Et.Right&&!y||x===Et.Left&&!_,C=x===Et.Down&&!v||x===Et.Up&&!b;if(j&&k.x!==u.x){const N=g.scrollLeft+f.x,T=x===Et.Right&&N<=L.x||x===Et.Left&&N>=S.x;if(T&&!f.y){g.scrollTo({left:N,behavior:a});return}T?p.x=g.scrollLeft-N:p.x=x===Et.Right?g.scrollLeft-L.x:g.scrollLeft-S.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(C&&k.y!==u.y){const N=g.scrollTop+f.y,T=x===Et.Down&&N<=L.y||x===Et.Up&&N>=S.y;if(T&&!f.x){g.scrollTo({top:N,behavior:a});return}T?p.y=g.scrollTop-N:p.y=x===Et.Down?g.scrollTop-L.y:g.scrollTop-S.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,zc(Gu(u,this.referenceCoordinates),p))}}}handleMove(e,s){const{onMove:n}=this.props;e.preventDefault(),n(s)}handleEnd(e){const{onEnd:s}=this.props;e.preventDefault(),this.detach(),s()}handleCancel(e){const{onCancel:s}=this.props;e.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}La.activators=[{eventName:"onKeyDown",handler:(t,e,s)=>{let{keyboardCodes:n=tw,onActivation:i}=e,{active:r}=s;const{code:l}=t.nativeEvent;if(n.start.includes(l)){const a=r.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),i?.({event:t.nativeEvent}),!0)}return!1}}];function O5(t){return!!(t&&"distance"in t)}function $5(t){return!!(t&&"delay"in t)}class E3{constructor(e,s,n){var i;n===void 0&&(n=PH(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=s;const{event:r}=e,{target:l}=r;this.props=e,this.events=s,this.document=Ld(l),this.documentListeners=new vu(this.document),this.listeners=new vu(n),this.windowListeners=new vu(Rn(l)),this.initialCoordinates=(i=vf(r))!=null?i:Di,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:s,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(ri.Resize,this.handleCancel),this.windowListeners.add(ri.DragStart,M5),this.windowListeners.add(ri.VisibilityChange,this.handleCancel),this.windowListeners.add(ri.ContextMenu,M5),this.documentListeners.add(ri.Keydown,this.handleKeydown),s){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($5(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(O5(s)){this.handlePending(s);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,s){const{active:n,onPending:i}=this.props;i(n,e,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:e}=this,{onStart:s}=this.props;e&&(this.activated=!0,this.documentListeners.add(ri.Click,EH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ri.SelectionChange,this.removeTextSelection),s(e))}handleMove(e){var s;const{activated:n,initialCoordinates:i,props:r}=this,{onMove:l,options:{activationConstraint:a}}=r;if(!i)return;const c=(s=vf(e))!=null?s:Di,d=Gu(i,c);if(!n&&a){if(O5(a)){if(a.tolerance!=null&&X1(d,a.tolerance))return this.handleCancel();if(X1(d,a.distance))return this.handleStart()}if($5(a)&&X1(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}e.cancelable&&e.preventDefault(),l(c)}handleEnd(){const{onAbort:e,onEnd:s}=this.props;this.detach(),this.activated||e(this.props.active),s()}handleCancel(){const{onAbort:e,onCancel:s}=this.props;this.detach(),this.activated||e(this.props.active),s()}handleKeydown(e){e.code===Et.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const DH={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class wa extends E3{constructor(e){const{event:s}=e,n=Ld(s.target);super(e,DH,n)}}wa.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:n}=e;return!s.isPrimary||s.button!==0?!1:(n?.({event:s}),!0)}}];const IH={move:{name:"mousemove"},end:{name:"mouseup"}};var Lp;(function(t){t[t.RightClick=2]="RightClick"})(Lp||(Lp={}));class MH extends E3{constructor(e){super(e,IH,Ld(e.event.target))}}MH.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:n}=e;return s.button===Lp.RightClick?!1:(n?.({event:s}),!0)}}];const Z1={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class OH extends E3{constructor(e){super(e,Z1)}static setup(){return window.addEventListener(Z1.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Z1.move.name,e)};function e(){}}}OH.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:n}=e;const{touches:i}=s;return i.length>1?!1:(n?.({event:s}),!0)}}];var yu;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(yu||(yu={}));var _f;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(_f||(_f={}));function $H(t){let{acceleration:e,activator:s=yu.Pointer,canScroll:n,draggingRect:i,enabled:r,interval:l=5,order:a=_f.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:h,delta:u,threshold:f}=t;const p=zH({delta:u,disabled:!r}),[m,g]=tH(),x=P.useRef({x:0,y:0}),b=P.useRef({x:0,y:0}),y=P.useMemo(()=>{switch(s){case yu.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case yu.DraggableRect:return i}},[s,i,c]),_=P.useRef(null),v=P.useCallback(()=>{const S=_.current;if(!S)return;const w=x.current.x*b.current.x,k=x.current.y*b.current.y;S.scrollBy(w,k)},[]),L=P.useMemo(()=>a===_f.TreeOrder?[...d].reverse():d,[a,d]);P.useEffect(()=>{if(!r||!d.length||!y){g();return}for(const S of L){if(n?.(S)===!1)continue;const w=d.indexOf(S),k=h[w];if(!k)continue;const{direction:j,speed:C}=CH(S,k,y,e,f);for(const N of["x","y"])p[N][j[N]]||(C[N]=0,j[N]=0);if(C.x>0||C.y>0){g(),_.current=S,m(v,l),x.current=C,b.current=j;return}}x.current={x:0,y:0},b.current={x:0,y:0},g()},[e,v,n,g,r,l,JSON.stringify(y),JSON.stringify(p),m,d,L,h,JSON.stringify(f)])}const BH={x:{[Zs.Backward]:!1,[Zs.Forward]:!1},y:{[Zs.Backward]:!1,[Zs.Forward]:!1}};function zH(t){let{delta:e,disabled:s}=t;const n=bf(e);return C0(i=>{if(s||!n||!i)return BH;const r={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Zs.Backward]:i.x[Zs.Backward]||r.x===-1,[Zs.Forward]:i.x[Zs.Forward]||r.x===1},y:{[Zs.Backward]:i.y[Zs.Backward]||r.y===-1,[Zs.Forward]:i.y[Zs.Forward]||r.y===1}}},[s,e,n])}function FH(t,e){const s=e!=null?t.get(e):void 0,n=s?s.node.current:null;return C0(i=>{var r;return e==null?null:(r=n??i)!=null?r:null},[n,e])}function UH(t,e){return P.useMemo(()=>t.reduce((s,n)=>{const{sensor:i}=n,r=i.activators.map(l=>({eventName:l.eventName,handler:e(l.handler,n)}));return[...s,...r]},[]),[t,e])}var Yu;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Yu||(Yu={}));var wp;(function(t){t.Optimized="optimized"})(wp||(wp={}));const B5=new Map;function HH(t,e){let{dragging:s,dependencies:n,config:i}=e;const[r,l]=P.useState(null),{frequency:a,measure:c,strategy:d}=i,h=P.useRef(t),u=x(),f=qu(u),p=P.useCallback(function(b){b===void 0&&(b=[]),!f.current&&l(y=>y===null?b:y.concat(b.filter(_=>!y.includes(_))))},[f]),m=P.useRef(null),g=C0(b=>{if(u&&!s)return B5;if(!b||b===B5||h.current!==t||r!=null){const y=new Map;for(let _ of t){if(!_)continue;if(r&&r.length>0&&!r.includes(_.id)&&_.rect.current){y.set(_.id,_.rect.current);continue}const v=_.node.current,L=v?new P3(c(v),v):null;_.rect.current=L,L&&y.set(_.id,L)}return y}return b},[t,r,s,u,c]);return P.useEffect(()=>{h.current=t},[t]),P.useEffect(()=>{u||p()},[s,u]),P.useEffect(()=>{r&&r.length>0&&l(null)},[JSON.stringify(r)]),P.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,u,p,...n]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:r!=null};function x(){switch(d){case Yu.Always:return!1;case Yu.BeforeDragging:return s;default:return!s}}}function R3(t,e){return C0(s=>t?s||(typeof e=="function"?e(t):t):null,[e,t])}function KH(t,e){return R3(t,e)}function WH(t){let{callback:e,disabled:s}=t;const n=W9(e),i=P.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:r}=window;return new r(n)},[n,s]);return P.useEffect(()=>()=>i?.disconnect(),[i]),i}function Y9(t){let{callback:e,disabled:s}=t;const n=W9(e),i=P.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:r}=window;return new r(n)},[s]);return P.useEffect(()=>()=>i?.disconnect(),[i]),i}function qH(t){return new P3(wd(t),t)}function z5(t,e,s){e===void 0&&(e=qH);const[n,i]=P.useState(null);function r(){i(c=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=c??s)!=null?d:null}const h=e(t);return JSON.stringify(c)===JSON.stringify(h)?c:h})}const l=WH({callback(c){if(t)for(const d of c){const{type:h,target:u}=d;if(h==="childList"&&u instanceof HTMLElement&&u.contains(t)){r();break}}}}),a=Y9({callback:r});return Ei(()=>{r(),t?(a?.observe(t),l?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),l?.disconnect())},[t]),n}function GH(t){const e=R3(t);return WL(t,e)}const F5=[];function YH(t){const e=P.useRef(t),s=C0(n=>t?n&&n!==F5&&t&&e.current&&t.parentNode===e.current.parentNode?n:G9(t):F5,[t]);return P.useEffect(()=>{e.current=t},[t]),s}function JH(t){const[e,s]=P.useState(null),n=P.useRef(t),i=P.useCallback(r=>{const l=Q1(r.target);l&&s(a=>a?(a.set(l,_p(l)),new Map(a)):null)},[]);return P.useEffect(()=>{const r=n.current;if(t!==r){l(r);const a=t.map(c=>{const d=Q1(c);return d?(d.addEventListener("scroll",i,{passive:!0}),[d,_p(d)]):null}).filter(c=>c!=null);s(a.length?new Map(a):null),n.current=t}return()=>{l(t),l(r)};function l(a){a.forEach(c=>{const d=Q1(c);d?.removeEventListener("scroll",i)})}},[i,t]),P.useMemo(()=>t.length?e?Array.from(e.values()).reduce((r,l)=>zc(r,l),Di):ZL(t):Di,[t,e])}function U5(t,e){e===void 0&&(e=[]);const s=P.useRef(null);return P.useEffect(()=>{s.current=null},e),P.useEffect(()=>{const n=t!==Di;n&&!s.current&&(s.current=t),!n&&s.current&&(s.current=null)},[t]),s.current?Gu(t,s.current):Di}function QH(t){P.useEffect(()=>{if(!K9)return;const e=t.map(s=>{let{sensor:n}=s;return n.setup==null?void 0:n.setup()});return()=>{for(const s of e)s?.()}},t.map(e=>{let{sensor:s}=e;return s}))}function XH(t,e){return P.useMemo(()=>t.reduce((s,n)=>{let{eventName:i,handler:r}=n;return s[i]=l=>{r(l,e)},s},{}),[t,e])}function sw(t){return P.useMemo(()=>t?wH(t):null,[t])}const H5=[];function ZH(t,e){e===void 0&&(e=wd);const[s]=t,n=sw(s?Rn(s):null),[i,r]=P.useState(H5);function l(){r(()=>t.length?t.map(c=>QL(c)?n:new P3(e(c),c)):H5)}const a=Y9({callback:l});return Ei(()=>{a?.disconnect(),l(),t.forEach(c=>a?.observe(c))},[t]),i}function nw(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return j0(e)?e:t}function eK(t){let{measure:e}=t;const[s,n]=P.useState(null),i=P.useCallback(d=>{for(const{target:h}of d)if(j0(h)){n(u=>{const f=e(h);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),r=Y9({callback:i}),l=P.useCallback(d=>{const h=nw(d);r?.disconnect(),h&&r?.observe(h),n(h?e(h):null)},[e,r]),[a,c]=xf(l);return P.useMemo(()=>({nodeRef:a,rect:s,setRef:c}),[s,a,c])}const tK=[{sensor:wa,options:{}},{sensor:La,options:{}}],sK={current:{}},Bh={draggable:{measure:I5},droppable:{measure:I5,strategy:Yu.WhileDragging,frequency:wp.Optimized},dragOverlay:{measure:wd}};class _u extends Map{get(e){var s;return e!=null&&(s=super.get(e))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:s}=e;return!s})}getNodeFor(e){var s,n;return(s=(n=this.get(e))==null?void 0:n.node.current)!=null?s:void 0}}const nK={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _u,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Bh,measureDroppableContainers:yf,windowRect:null,measuringScheduled:!1},iw={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yf,draggableNodes:new Map,over:null,measureDroppableContainers:yf},V0=P.createContext(iw),rw=P.createContext(nK);function iK(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _u}}}function rK(t,e){switch(e.type){case Us.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Us.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Us.DragEnd:case Us.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Us.RegisterDroppable:{const{element:s}=e,{id:n}=s,i=new _u(t.droppable.containers);return i.set(n,s),{...t,droppable:{...t.droppable,containers:i}}}case Us.SetDroppableDisabled:{const{id:s,key:n,disabled:i}=e,r=t.droppable.containers.get(s);if(!r||n!==r.key)return t;const l=new _u(t.droppable.containers);return l.set(s,{...r,disabled:i}),{...t,droppable:{...t.droppable,containers:l}}}case Us.UnregisterDroppable:{const{id:s,key:n}=e,i=t.droppable.containers.get(s);if(!i||n!==i.key)return t;const r=new _u(t.droppable.containers);return r.delete(s),{...t,droppable:{...t.droppable,containers:r}}}default:return t}}function oK(t){let{disabled:e}=t;const{active:s,activatorEvent:n,draggableNodes:i}=P.useContext(V0),r=bf(n),l=bf(s?.id);return P.useEffect(()=>{if(!e&&!n&&r&&l!=null){if(!q9(r)||document.activeElement===r.target)return;const a=i.get(l);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[c.current,d.current]){if(!h)continue;const u=iH(h);if(u){u.focus();break}}})}},[n,e,i,l,r]),null}function ow(t,e){let{transform:s,...n}=e;return t!=null&&t.length?t.reduce((i,r)=>r({transform:i,...n}),s):s}function lK(t){return P.useMemo(()=>({draggable:{...Bh.draggable,...t?.draggable},droppable:{...Bh.droppable,...t?.droppable},dragOverlay:{...Bh.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function aK(t){let{activeNode:e,measure:s,initialRect:n,config:i=!0}=t;const r=P.useRef(!1),{x:l,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Ei(()=>{if(!l&&!a||!e){r.current=!1;return}if(r.current||!n)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const h=s(d),u=WL(h,n);if(l||(u.x=0),a||(u.y=0),r.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=GL(d);f&&f.scrollBy({top:u.y,left:u.x})}},[e,l,a,n,s])}const J9=P.createContext({...Di,scaleX:1,scaleY:1});var qo;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(qo||(qo={}));const A0=P.memo(function(e){var s,n,i,r;let{id:l,accessibility:a,autoScroll:c=!0,children:d,sensors:h=tK,collisionDetection:u=xH,measuring:f,modifiers:p,...m}=e;const g=P.useReducer(rK,void 0,iK),[x,b]=g,[y,_]=dH(),[v,L]=P.useState(qo.Uninitialized),S=v===qo.Initialized,{draggable:{active:w,nodes:k,translate:j},droppable:{containers:C}}=x,N=w!=null?k.get(w):null,T=P.useRef({initial:null,translated:null}),V=P.useMemo(()=>{var st;return w!=null?{id:w,data:(st=N?.data)!=null?st:sK,rect:T}:null},[w,N]),A=P.useRef(null),[E,R]=P.useState(null),[D,I]=P.useState(null),O=qu(m,Object.values(m)),F=N0("DndDescribedBy",l),M=P.useMemo(()=>C.getEnabled(),[C]),$=lK(f),{droppableRects:B,measureDroppableContainers:U,measuringScheduled:H}=HH(M,{dragging:S,dependencies:[j.x,j.y],config:$.droppable}),W=FH(k,w),K=P.useMemo(()=>D?vf(D):null,[D]),G=ot(),Y=KH(W,$.draggable.measure);aK({activeNode:w!=null?k.get(w):null,config:G.layoutShiftCompensation,initialRect:Y,measure:$.draggable.measure});const X=z5(W,$.draggable.measure,Y),te=z5(W?W.parentElement:null),se=P.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:C,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=C.getNodeFor((s=se.current.over)==null?void 0:s.id),Q=eK({measure:$.dragOverlay.measure}),q=(n=Q.nodeRef.current)!=null?n:W,le=S?(i=Q.rect)!=null?i:X:null,J=!!(Q.nodeRef.current&&Q.rect),oe=GH(J?null:X),ee=sw(q?Rn(q):null),he=YH(S?ne??W:null),ae=ZH(he),de=ow(p,{transform:{x:j.x-oe.x,y:j.y-oe.y,scaleX:1,scaleY:1},activatorEvent:D,active:V,activeNodeRect:X,containerNodeRect:te,draggingNodeRect:le,over:se.current.over,overlayNodeRect:Q.rect,scrollableAncestors:he,scrollableAncestorRects:ae,windowRect:ee}),ue=K?zc(K,j):null,pe=JH(he),Z=U5(pe),ge=U5(pe,[X]),be=zc(de,Z),ke=le?yH(le,de):null,we=V&&ke?u({active:V,collisionRect:ke,droppableRects:B,droppableContainers:M,pointerCoordinates:ue}):null,Le=HL(we,"id"),[_e,Ce]=P.useState(null),xe=J?de:zc(de,ge),Ne=bH(xe,(r=_e?.rect)!=null?r:null,X),Te=P.useRef(null),Me=P.useCallback((st,Ze)=>{let{sensor:lt,options:_t}=Ze;if(A.current==null)return;const it=k.get(A.current);if(!it)return;const at=st.nativeEvent,Ie=new lt({active:A.current,activeNode:it,event:at,options:_t,context:se,onAbort(fe){if(!k.get(fe))return;const{onDragAbort:tt}=O.current,ht={id:fe};tt?.(ht),y({type:"onDragAbort",event:ht})},onPending(fe,Oe,tt,ht){if(!k.get(fe))return;const{onDragPending:Vt}=O.current,rt={id:fe,constraint:Oe,initialCoordinates:tt,offset:ht};Vt?.(rt),y({type:"onDragPending",event:rt})},onStart(fe){const Oe=A.current;if(Oe==null)return;const tt=k.get(Oe);if(!tt)return;const{onDragStart:ht}=O.current,dt={activatorEvent:at,active:{id:Oe,data:tt.data,rect:T}};kn.unstable_batchedUpdates(()=>{ht?.(dt),L(qo.Initializing),b({type:Us.DragStart,initialCoordinates:fe,active:Oe}),y({type:"onDragStart",event:dt}),R(Te.current),I(at)})},onMove(fe){b({type:Us.DragMove,coordinates:fe})},onEnd:xt(Us.DragEnd),onCancel:xt(Us.DragCancel)});Te.current=Ie;function xt(fe){return async function(){const{active:tt,collisions:ht,over:dt,scrollAdjustedTranslate:Vt}=se.current;let rt=null;if(tt&&Vt){const{cancelDrop:bt}=O.current;rt={activatorEvent:at,active:tt,collisions:ht,delta:Vt,over:dt},fe===Us.DragEnd&&typeof bt=="function"&&await Promise.resolve(bt(rt))&&(fe=Us.DragCancel)}A.current=null,kn.unstable_batchedUpdates(()=>{b({type:fe}),L(qo.Uninitialized),Ce(null),R(null),I(null),Te.current=null;const bt=fe===Us.DragEnd?"onDragEnd":"onDragCancel";if(rt){const et=O.current[bt];et?.(rt),y({type:bt,event:rt})}})}}},[k]),Qe=P.useCallback((st,Ze)=>(lt,_t)=>{const it=lt.nativeEvent,at=k.get(_t);if(A.current!==null||!at||it.dndKit||it.defaultPrevented)return;const Ie={active:at};st(lt,Ze.options,Ie)===!0&&(it.dndKit={capturedBy:Ze.sensor},A.current=_t,Me(lt,Ze))},[k,Me]),We=UH(h,Qe);QH(h),Ei(()=>{X&&v===qo.Initializing&&L(qo.Initialized)},[X,v]),P.useEffect(()=>{const{onDragMove:st}=O.current,{active:Ze,activatorEvent:lt,collisions:_t,over:it}=se.current;if(!Ze||!lt)return;const at={active:Ze,activatorEvent:lt,collisions:_t,delta:{x:be.x,y:be.y},over:it};kn.unstable_batchedUpdates(()=>{st?.(at),y({type:"onDragMove",event:at})})},[be.x,be.y]),P.useEffect(()=>{const{active:st,activatorEvent:Ze,collisions:lt,droppableContainers:_t,scrollAdjustedTranslate:it}=se.current;if(!st||A.current==null||!Ze||!it)return;const{onDragOver:at}=O.current,Ie=_t.get(Le),xt=Ie&&Ie.rect.current?{id:Ie.id,rect:Ie.rect.current,data:Ie.data,disabled:Ie.disabled}:null,fe={active:st,activatorEvent:Ze,collisions:lt,delta:{x:it.x,y:it.y},over:xt};kn.unstable_batchedUpdates(()=>{Ce(xt),at?.(fe),y({type:"onDragOver",event:fe})})},[Le]),Ei(()=>{se.current={activatorEvent:D,active:V,activeNode:W,collisionRect:ke,collisions:we,droppableRects:B,draggableNodes:k,draggingNode:q,draggingNodeRect:le,droppableContainers:C,over:_e,scrollableAncestors:he,scrollAdjustedTranslate:be},T.current={initial:le,translated:ke}},[V,W,we,ke,k,q,le,B,C,_e,he,be]),$H({...G,delta:j,draggingRect:ke,pointerCoordinates:ue,scrollableAncestors:he,scrollableAncestorRects:ae});const Ve=P.useMemo(()=>({active:V,activeNode:W,activeNodeRect:X,activatorEvent:D,collisions:we,containerNodeRect:te,dragOverlay:Q,draggableNodes:k,droppableContainers:C,droppableRects:B,over:_e,measureDroppableContainers:U,scrollableAncestors:he,scrollableAncestorRects:ae,measuringConfiguration:$,measuringScheduled:H,windowRect:ee}),[V,W,X,D,we,te,Q,k,C,B,_e,U,he,ae,$,H,ee]),De=P.useMemo(()=>({activatorEvent:D,activators:We,active:V,activeNodeRect:X,ariaDescribedById:{draggable:F},dispatch:b,draggableNodes:k,over:_e,measureDroppableContainers:U}),[D,We,V,X,b,F,k,_e,U]);return Nt.createElement(zL.Provider,{value:_},Nt.createElement(V0.Provider,{value:De},Nt.createElement(rw.Provider,{value:Ve},Nt.createElement(J9.Provider,{value:Ne},d)),Nt.createElement(oK,{disabled:a?.restoreFocus===!1})),Nt.createElement(fH,{...a,hiddenTextDescribedById:F}));function ot(){const st=E?.autoScrollEnabled===!1,Ze=typeof c=="object"?c.enabled===!1:c===!1,lt=S&&!st&&!Ze;return typeof c=="object"?{...c,enabled:lt}:{enabled:lt}}}),cK=P.createContext(null),K5="button",dK="Draggable";function lw(t){let{id:e,data:s,disabled:n=!1,attributes:i}=t;const r=N0(dK),{activators:l,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:h,draggableNodes:u,over:f}=P.useContext(V0),{role:p=K5,roleDescription:m="draggable",tabIndex:g=0}=i??{},x=c?.id===e,b=P.useContext(x?J9:cK),[y,_]=xf(),[v,L]=xf(),S=XH(l,e),w=qu(s);Ei(()=>(u.set(e,{id:e,key:r,node:y,activatorNode:v,data:w}),()=>{const j=u.get(e);j&&j.key===r&&u.delete(e)}),[u,e]);const k=P.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":n,"aria-pressed":x&&p===K5?!0:void 0,"aria-roledescription":m,"aria-describedby":h.draggable}),[n,p,g,x,m,h.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:k,isDragging:x,listeners:n?void 0:S,node:y,over:f,setNodeRef:_,setActivatorNodeRef:L,transform:b}}function aw(){return P.useContext(rw)}const uK="Droppable",hK={timeout:25};function cw(t){let{data:e,disabled:s=!1,id:n,resizeObserverConfig:i}=t;const r=N0(uK),{active:l,dispatch:a,over:c,measureDroppableContainers:d}=P.useContext(V0),h=P.useRef({disabled:s}),u=P.useRef(!1),f=P.useRef(null),p=P.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:x}={...hK,...i},b=qu(g??n),y=P.useCallback(()=>{if(!u.current){u.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(b.current)?b.current:[b.current]),p.current=null},x)},[x]),_=Y9({callback:y,disabled:m||!l}),v=P.useCallback((k,j)=>{_&&(j&&(_.unobserve(j),u.current=!1),k&&_.observe(k))},[_]),[L,S]=xf(v),w=qu(e);return P.useEffect(()=>{!_||!L.current||(_.disconnect(),u.current=!1,_.observe(L.current))},[L,_]),P.useEffect(()=>(a({type:Us.RegisterDroppable,element:{id:n,key:r,disabled:s,node:L,rect:f,data:w}}),()=>a({type:Us.UnregisterDroppable,key:r,id:n})),[n]),P.useEffect(()=>{s!==h.current.disabled&&(a({type:Us.SetDroppableDisabled,id:n,key:r,disabled:s}),h.current.disabled=s)},[n,r,s,a]),{active:l,rect:f,isOver:c?.id===n,node:L,over:c,setNodeRef:S}}function fK(t){let{animation:e,children:s}=t;const[n,i]=P.useState(null),[r,l]=P.useState(null),a=bf(s);return!s&&!n&&a&&i(a),Ei(()=>{if(!r)return;const c=n?.key,d=n?.props.id;if(c==null||d==null){i(null);return}Promise.resolve(e(d,r)).then(()=>{i(null)})},[e,n,r]),Nt.createElement(Nt.Fragment,null,s,n?P.cloneElement(n,{ref:l}):null)}const mK={x:0,y:0,scaleX:1,scaleY:1};function pK(t){let{children:e}=t;return Nt.createElement(V0.Provider,{value:iw},Nt.createElement(J9.Provider,{value:mK},e))}const gK={position:"fixed",touchAction:"none"},xK=t=>q9(t)?"transform 250ms ease":void 0,bK=P.forwardRef((t,e)=>{let{as:s,activatorEvent:n,adjustScale:i,children:r,className:l,rect:a,style:c,transform:d,transition:h=xK}=t;if(!a)return null;const u=i?d:{...d,scaleX:1,scaleY:1},f={...gK,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ri.Transform.toString(u),transformOrigin:i&&n?mH(n,a):void 0,transition:typeof h=="function"?h(n):h,...c};return Nt.createElement(s,{className:l,style:f,ref:e},r)}),vK=t=>e=>{let{active:s,dragOverlay:n}=e;const i={},{styles:r,className:l}=t;if(r!=null&&r.active)for(const[a,c]of Object.entries(r.active))c!==void 0&&(i[a]=s.node.style.getPropertyValue(a),s.node.style.setProperty(a,c));if(r!=null&&r.dragOverlay)for(const[a,c]of Object.entries(r.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return l!=null&&l.active&&s.node.classList.add(l.active),l!=null&&l.dragOverlay&&n.node.classList.add(l.dragOverlay),function(){for(const[c,d]of Object.entries(i))s.node.style.setProperty(c,d);l!=null&&l.active&&s.node.classList.remove(l.active)}},yK=t=>{let{transform:{initial:e,final:s}}=t;return[{transform:Ri.Transform.toString(e)},{transform:Ri.Transform.toString(s)}]},_K={duration:250,easing:"ease",keyframes:yK,sideEffects:vK({styles:{active:{opacity:"0"}}})};function LK(t){let{config:e,draggableNodes:s,droppableContainers:n,measuringConfiguration:i}=t;return W9((r,l)=>{if(e===null)return;const a=s.get(r);if(!a)return;const c=a.node.current;if(!c)return;const d=nw(l);if(!d)return;const{transform:h}=Rn(l).getComputedStyle(l),u=qL(h);if(!u)return;const f=typeof e=="function"?e:wK(e);return ew(c,i.draggable.measure),f({active:{id:r,data:a.data,node:c,rect:i.draggable.measure(c)},draggableNodes:s,dragOverlay:{node:l,rect:i.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:i,transform:u})})}function wK(t){const{duration:e,easing:s,sideEffects:n,keyframes:i}={..._K,...t};return r=>{let{active:l,dragOverlay:a,transform:c,...d}=r;if(!e)return;const h={x:a.rect.left-l.rect.left,y:a.rect.top-l.rect.top},u={scaleX:c.scaleX!==1?l.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?l.rect.height*c.scaleY/a.rect.height:1},f={x:c.x-h.x,y:c.y-h.y,...u},p=i({...d,active:l,dragOverlay:a,transform:{initial:c,final:f}}),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const x=n?.({active:l,dragOverlay:a,...d}),b=a.node.animate(p,{duration:e,easing:s,fill:"forwards"});return new Promise(y=>{b.onfinish=()=>{x?.(),y()}})}}let W5=0;function SK(t){return P.useMemo(()=>{if(t!=null)return W5++,W5},[t])}const Q9=Nt.memo(t=>{let{adjustScale:e=!1,children:s,dropAnimation:n,style:i,transition:r,modifiers:l,wrapperElement:a="div",className:c,zIndex:d=999}=t;const{activatorEvent:h,active:u,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:x,over:b,measuringConfiguration:y,scrollableAncestors:_,scrollableAncestorRects:v,windowRect:L}=aw(),S=P.useContext(J9),w=SK(u?.id),k=ow(l,{activatorEvent:h,active:u,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:x.rect,over:b,overlayNodeRect:x.rect,scrollableAncestors:_,scrollableAncestorRects:v,transform:S,windowRect:L}),j=R3(f),C=LK({config:n,draggableNodes:m,droppableContainers:g,measuringConfiguration:y}),N=j?x.setRef:void 0;return Nt.createElement(pK,null,Nt.createElement(fK,{animation:C},u&&w?Nt.createElement(bK,{key:w,id:u.id,ref:N,as:a,activatorEvent:h,adjustScale:e,className:c,transition:r,rect:j,style:{zIndex:d,...i},transform:k},s):null))}),Ii=6,Hr=100,q5=12,kK=5,jK={w:3,h:2};class Sp extends P.Component{state={hasError:!1,t:void 0};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?o.jsx(NK,{message:this.state.message}):o.jsx(CK,{children:this.props.children})}}function CK(t){const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx(o.Fragment,{children:s}),e[0]=s,e[1]=n):n=e[1],n}function NK(t){const e=z.c(13),{message:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:o.jsx(go,{size:16})}),e[0]=i):i=e[0];let r;e[1]!==n?(r=n("home.tileErrorBoundary.tileCrashed"),e[1]=n,e[2]=r):r=e[2];let l;e[3]!==r?(l=o.jsx("p",{className:"text-sm font-medium text-foreground",children:r}),e[3]=r,e[4]=l):l=e[4];let a;e[5]!==s||e[6]!==n?(a=s??n("home.tileErrorBoundary.defaultError"),e[5]=s,e[6]=n,e[7]=a):a=e[7];let c;e[8]!==a?(c=o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",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 flex-col items-center justify-center gap-2 p-4 text-center",children:[i,l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function TK(t){const e=z.c(76),{tiles:s,isEditMode:n,renderTile:i,onMove:r,onResize:l,onRemove:a}=t,c=gl(),d=P.useRef(null),[h,u]=P.useState(null),[f,p]=P.useState(null);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={activationConstraint:{distance:4}},e[0]=m):m=e[0];const g=T0(vr(wa,m),vr(La)),x=s.reduce(VK,0),b=n?Math.max(x+2,4):Math.max(x,1);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{const M=d.current?.getBoundingClientRect();return M?{cellWidth:M.width/Ii,cellHeight:Hr}:null},e[1]=y):y=e[1];const _=y;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=M=>{u(String(M.active.id)),p(_())},e[2]=v):v=e[2];const L=v;let S;e[3]!==f||e[4]!==r||e[5]!==s?(S=M=>{const $=String(M.active.id),B=f??_();if(u(null),p(null),!B||B.cellWidth<=0)return;const U=s.find(K=>K.id===$);if(!U)return;const H=Math.round(M.delta.x/B.cellWidth),W=Math.round(M.delta.y/B.cellHeight);H===0&&W===0||r($,{x:U.x+H,y:U.y+W})},e[3]=f,e[4]=r,e[5]=s,e[6]=S):S=e[6];const w=S;if(c){let M;if(e[7]!==i||e[8]!==s){let B;e[10]!==i?(B=U=>o.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:Hr},children:o.jsx(Sp,{children:i(U)})},U.id),e[10]=i,e[11]=B):B=e[11],M=s.map(B),e[7]=i,e[8]=s,e[9]=M}else M=e[9];let $;return e[12]!==M?($=o.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:M}),e[12]=M,e[13]=$):$=e[13],$}let k,j,C,N,T,V,A,E,R,D;if(e[14]!==h||e[15]!==f||e[16]!==n||e[17]!==w||e[18]!==a||e[19]!==l||e[20]!==i||e[21]!==g||e[22]!==s||e[23]!==b){const M=h?s.find(Y=>Y.id===h):null;j=A0,D=g,C=L,N=w;const $=b*Hr,B=n?Hr*4:Hr;let U;e[34]!==$||e[35]!==B?(U={height:$,minHeight:B},e[34]=$,e[35]=B,e[36]=U):U=e[36];let H;e[37]!==n||e[38]!==s||e[39]!==b?(H=n&&o.jsx(AK,{rows:b,tiles:s}),e[37]=n,e[38]=s,e[39]=b,e[40]=H):H=e[40];let W;if(e[41]!==h||e[42]!==n||e[43]!==a||e[44]!==l||e[45]!==i||e[46]!==s){let Y;e[48]!==h||e[49]!==n||e[50]!==a||e[51]!==l||e[52]!==i?(Y=X=>o.jsx(EK,{tile:X,isEditMode:n,isDragging:h===X.id,onResize:l,onRemove:a,children:i(X)},X.id),e[48]=h,e[49]=n,e[50]=a,e[51]=l,e[52]=i,e[53]=Y):Y=e[53],W=s.map(Y),e[41]=h,e[42]=n,e[43]=a,e[44]=l,e[45]=i,e[46]=s,e[47]=W}else W=e[47];e[54]!==U||e[55]!==H||e[56]!==W?(T=o.jsxs("div",{ref:d,className:"relative w-full",style:U,children:[H,W]}),e[54]=U,e[55]=H,e[56]=W,e[57]=T):T=e[57],R=kn.createPortal,k=Q9,V=null;const K=M&&f?M.w*f.cellWidth-q5:void 0,G=M&&f?M.h*f.cellHeight-q5:void 0;e[58]!==K||e[59]!==G?(A={width:K,height:G},e[58]=K,e[59]=G,e[60]=A):A=e[60],E=M&&o.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:o.jsx(Sp,{children:i(M)})}),e[14]=h,e[15]=f,e[16]=n,e[17]=w,e[18]=a,e[19]=l,e[20]=i,e[21]=g,e[22]=s,e[23]=b,e[24]=k,e[25]=j,e[26]=C,e[27]=N,e[28]=T,e[29]=V,e[30]=A,e[31]=E,e[32]=R,e[33]=D}else k=e[24],j=e[25],C=e[26],N=e[27],T=e[28],V=e[29],A=e[30],E=e[31],R=e[32],D=e[33];let I;e[61]!==k||e[62]!==V||e[63]!==A||e[64]!==E?(I=o.jsx(k,{dropAnimation:V,style:A,children:E}),e[61]=k,e[62]=V,e[63]=A,e[64]=E,e[65]=I):I=e[65];let O;e[66]!==I||e[67]!==R?(O=R(I,document.body),e[66]=I,e[67]=R,e[68]=O):O=e[68];let F;return e[69]!==j||e[70]!==C||e[71]!==N||e[72]!==T||e[73]!==O||e[74]!==D?(F=o.jsxs(j,{sensors:D,onDragStart:C,onDragEnd:N,children:[T,O]}),e[69]=j,e[70]=C,e[71]=N,e[72]=T,e[73]=O,e[74]=D,e[75]=F):F=e[75],F}function VK(t,e){return Math.max(t,e.y+e.h)}function AK(t){const e=z.c(7),{rows:s,tiles:n}=t;let i;e[0]!==n?(i=(c,d)=>n.some(h=>c>=h.x&&c<h.x+h.w&&d>=h.y&&d<h.y+h.h),e[0]=n,e[1]=i):i=e[1];const r=i;let l;if(e[2]!==r||e[3]!==s){l=[];for(let c=0;c<s;c++)for(let d=0;d<Ii;d++)r(d,c)||l.push({x:d,y:c});e[2]=r,e[3]=s,e[4]=l}else l=e[4];let a;return e[5]!==l?(a=o.jsx("div",{className:"absolute inset-0 pointer-events-none",children:l.map(PK)}),e[5]=l,e[6]=a):a=e[6],a}function PK(t){return o.jsx("div",{className:"absolute p-1",style:{left:`${t.x/Ii*100}%`,top:t.y*Hr,width:`${1/Ii*100}%`,height:Hr},children:o.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function EK(t){const e=z.c(32),{tile:s,isEditMode:n,isDragging:i,onResize:r,onRemove:l,children:a}=t,c=re(),d=!n;let h;e[0]!==d||e[1]!==s.id?(h={id:s.id,disabled:d},e[0]=d,e[1]=s.id,e[2]=h):h=e[2];const{setNodeRef:u,attributes:f,listeners:p,isDragging:m}=lw(h),g=`${s.x/Ii*100}%`,x=`${s.w/Ii*100}%`,b=s.y*Hr,y=s.h*Hr,_=m||i,v=!_&&"transition-[left,top,width,height,opacity] duration-200 ease-out",L=_&&"opacity-30";let S;e[3]!==v||e[4]!==L?(S=ie("absolute p-1 will-change-[left,top,width,height,opacity]",v,L),e[3]=v,e[4]=L,e[5]=S):S=e[5];let w;e[6]!==y||e[7]!==g||e[8]!==b||e[9]!==x?(w={left:g,top:b,width:x,height:y},e[6]=y,e[7]=g,e[8]=b,e[9]=x,e[10]=w):w=e[10];const k=n&&"outline outline-1 outline-transparent hover:outline-primary/40";let j;e[11]!==k?(j=ie("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",k),e[11]=k,e[12]=j):j=e[12];let C;e[13]!==f||e[14]!==n||e[15]!==p||e[16]!==l||e[17]!==r||e[18]!==c||e[19]!==s?(C=n&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",...f,...p,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":c("home.tileBoard.dragTileAriaLabel"),children:o.jsx(fd,{size:16})}),o.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:o.jsx(RK,{tile:s,onResize:r,onRemove:l})})]}),e[13]=f,e[14]=n,e[15]=p,e[16]=l,e[17]=r,e[18]=c,e[19]=s,e[20]=C):C=e[20];let N;e[21]!==a?(N=o.jsx("div",{className:"h-full overflow-hidden",children:o.jsx(Sp,{children:a})}),e[21]=a,e[22]=N):N=e[22];let T;e[23]!==N||e[24]!==j||e[25]!==C?(T=o.jsxs("div",{className:j,children:[C,N]}),e[23]=N,e[24]=j,e[25]=C,e[26]=T):T=e[26];let V;return e[27]!==u||e[28]!==T||e[29]!==S||e[30]!==w?(V=o.jsx("div",{ref:u,className:S,style:w,children:T}),e[27]=u,e[28]=T,e[29]=S,e[30]=w,e[31]=V):V=e[31],V}function RK(t){const e=z.c(28),{tile:s,onResize:n,onRemove:i}=t,[r,l]=P.useState(!1),a=re();let c;e[0]!==a?(c=a("home.tileBoard.tileOptionsAriaLabel"),e[0]=a,e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Qn,{size:16}),e[2]=d):d=e[2];let h;e[3]!==c?(h=o.jsx(Bt,{asChild:!0,children:o.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":c,children:d})}),e[3]=c,e[4]=h):h=e[4];let u;e[5]!==n||e[6]!==s.id?(u=v=>{n(s.id,v),l(!1)},e[5]=n,e[6]=s.id,e[7]=u):u=e[7];let f;e[8]!==u||e[9]!==s?(f=o.jsx(DK,{tile:s,onPick:u}),e[8]=u,e[9]=s,e[10]=f):f=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Qr,{}),e[11]=p):p=e[11];let m;e[12]!==i||e[13]!==s.id?(m=()=>i(s.id),e[12]=i,e[13]=s.id,e[14]=m):m=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Gs,{size:14,className:"mr-2"}),e[15]=g):g=e[15];let x;e[16]!==a?(x=a("home.tileBoard.removeTile"),e[16]=a,e[17]=x):x=e[17];let b;e[18]!==m||e[19]!==x?(b=o.jsxs(Ye,{onSelect:m,className:"text-destructive focus:text-destructive",children:[g,x]}),e[18]=m,e[19]=x,e[20]=b):b=e[20];let y;e[21]!==b||e[22]!==f?(y=o.jsxs(zt,{align:"end",className:"w-auto",children:[f,p,b]}),e[21]=b,e[22]=f,e[23]=y):y=e[23];let _;return e[24]!==r||e[25]!==y||e[26]!==h?(_=o.jsxs($t,{open:r,onOpenChange:l,children:[h,y]}),e[24]=r,e[25]=y,e[26]=h,e[27]=_):_=e[27],_}function DK(t){const e=z.c(26),{tile:s,onPick:n}=t,i=s.minW??1,r=s.minH??1,[l,a]=P.useState(null);let c;e[0]!==l||e[1]!==s.h||e[2]!==s.w?(c=l??{w:s.w,h:s.h},e[0]=l,e[1]=s.h,e[2]=s.w,e[3]=c):c=e[3];const d=c,h=re();let u;e[4]!==h?(u=h("home.tileBoard.sizeLabel"),e[4]=h,e[5]=u):u=e[5];let f;e[6]!==u?(f=o.jsx("span",{className:"text-xs text-muted-foreground",children:u}),e[6]=u,e[7]=f):f=e[7];let p;e[8]!==d.h||e[9]!==d.w?(p=o.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[d.w," × ",d.h]}),e[8]=d.h,e[9]=d.w,e[10]=p):p=e[10];let m;e[11]!==f||e[12]!==p?(m=o.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[f,p]}),e[11]=f,e[12]=p,e[13]=m):m=e[13];let g,x;e[14]===Symbol.for("react.memo_cache_sentinel")?(g={gridTemplateColumns:`repeat(${Ii}, 1.25rem)`},x=()=>a(null),e[14]=g,e[15]=x):(g=e[14],x=e[15]);let b;e[16]!==d.h||e[17]!==d.w||e[18]!==r||e[19]!==i||e[20]!==n||e[21]!==h?(b=o.jsx("div",{className:"grid w-max gap-1",style:g,onPointerLeave:x,children:Array.from({length:kK},(_,v)=>Array.from({length:Ii},(L,S)=>{const w=S+1,k=v+1,j=w<i||k<r,C=w<=d.w&&k<=d.h;return o.jsx("button",{type:"button",disabled:j,"aria-label":h("home.tileBoard.sizeGridCellAriaLabel",{w,h:k}),onPointerEnter:()=>a({w,h:k}),onClick:()=>n({w,h:k}),className:ie("size-5 rounded-sm border transition-colors",C?"border-primary bg-primary/30":"border-border bg-muted",j?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${w}x${k}`)}))}),e[16]=d.h,e[17]=d.w,e[18]=r,e[19]=i,e[20]=n,e[21]=h,e[22]=b):b=e[22];let y;return e[23]!==m||e[24]!==b?(y=o.jsxs("div",{className:"px-2 py-1.5",children:[m,b]}),e[23]=m,e[24]=b,e[25]=y):y=e[25],y}function IK(t,e,s){return t.some(n=>e>=n.x&&e<n.x+n.w&&s>=n.y&&s<n.y+n.h)}function kp(t,e,s){for(let n=0;n<100;n++)for(let i=0;i<=Ii-e;i++){let r=!0;for(let l=0;l<s&&r;l++)for(let a=0;a<e&&r;a++)IK(t,i+a,n+l)&&(r=!1);if(r)return{x:i,y:n}}return{x:0,y:0}}function em(t,e,s={w:1,h:1}){const n=Math.max(s.w,Math.min(Ii,t)),i=Math.max(s.h,Math.min(6,e));return{w:n,h:i}}function tm(t,e,s){const n=Math.max(0,Math.min(Ii-s,t)),i=Math.max(0,e);return{x:n,y:i}}function MK(t,e,s){const n=t.find(c=>c.id===e);if(!n)return t;const i=t.filter(c=>c.id!==e),r=i.find(c=>s.x>=c.x&&s.x<c.x+c.w&&s.y>=c.y&&s.y<c.y+c.h);if(r&&r.w===n.w&&r.h===n.h)return t.map(c=>c.id===e?{...c,x:r.x,y:r.y}:c.id===r.id?{...c,x:n.x,y:n.y}:c);const a=[{...n,x:s.x,y:s.y}];for(const c of i){const d=kp(a,c.w,c.h);a.push({...c,x:d.x,y:d.y})}return a}function OK(t){const e=z.c(42),{layout:s,isLayoutLoading:n,commitLayout:i}=N3();let r;e[0]!==s.hidden?(r=new Set(s.hidden),e[0]=s.hidden,e[1]=r):r=e[1];const l=r;let a;e[2]!==s.shown?(a=s.shown??[],e[2]=s.shown,e[3]=a):a=e[3];let c;e[4]!==a?(c=new Set(a),e[4]=a,e[5]=c):c=e[5];const d=c;let h,u;if(e[6]!==t||e[7]!==l||e[8]!==s.tiles||e[9]!==d){u=[];let L;e[12]!==l||e[13]!==d?(L=w=>w.pinned?!0:w.defaultHidden?d.has(w.id)&&!l.has(w.id):!l.has(w.id),e[12]=l,e[13]=d,e[14]=L):L=e[14];const S=t.filter(L);h=new Map;for(const w of t)w.minSize&&h.set(w.id,w.minSize);for(const w of S){const k=s.tiles[w.id];if(!k)continue;const j=h.get(w.id),{w:C,h:N}=em(k.w,k.h,j),{x:T,y:V}=tm(k.x,k.y,C);u.push({id:w.id,x:T,y:V,w:C,h:N,minW:j?.w,minH:j?.h})}for(const w of S){if(u.some(V=>V.id===w.id))continue;const k=w.defaultSize??jK,j=h.get(w.id),{w:C,h:N}=em(k.w,k.h,j),T=kp(u,C,N);u.push({id:w.id,x:T.x,y:T.y,w:C,h:N,minW:j?.w,minH:j?.h})}e[6]=t,e[7]=l,e[8]=s.tiles,e[9]=d,e[10]=h,e[11]=u}else h=e[10],u=e[11];let f;e[15]!==t?(f=new Set(t.map($K)),e[15]=t,e[16]=f):f=e[16];const p=f;let m;e[17]!==p||e[18]!==i||e[19]!==s?(m=(L,S)=>{const w={};for(const k of L)w[k.id]={x:k.x,y:k.y,w:k.w,h:k.h};i({version:id,tiles:w,hidden:S.filter(k=>p.has(k)),shown:(s.shown??[]).filter(k=>p.has(k))})},e[17]=p,e[18]=i,e[19]=s,e[20]=m):m=e[20];const g=m;let x;e[21]!==u?(x={visible:u},e[21]=u,e[22]=x):x=e[22];let b;e[23]!==g||e[24]!==s||e[25]!==u?(b=(L,S)=>{const w=u.find(C=>C.id===L);if(!w)return;const k=tm(S.x,S.y,w.w);if(k.x===w.x&&k.y===w.y)return;const j=MK(u,L,k);g(j,s.hidden)},e[23]=g,e[24]=s,e[25]=u,e[26]=b):b=e[26];let y;e[27]!==g||e[28]!==s||e[29]!==h||e[30]!==u?(y=(L,S)=>{const w=u.find(A=>A.id===L);if(!w)return;const k=h.get(L),{w:j,h:C}=em(S.w,S.h,k);if(j===w.w&&C===w.h)return;const N={...w,w:j,h:C,x:tm(w.x,w.y,j).x},T=u.filter(A=>A.id!==L),V=[N];for(const A of T){const E=kp(V,A.w,A.h);V.push({...A,x:E.x,y:E.y})}g(V,s.hidden)},e[27]=g,e[28]=s,e[29]=h,e[30]=u,e[31]=y):y=e[31];let _;e[32]!==g||e[33]!==s||e[34]!==u?(_=L=>{const S=u.filter(w=>w.id!==L);g(S,Array.from(new Set([...s.hidden,L])))},e[32]=g,e[33]=s,e[34]=u,e[35]=_):_=e[35];let v;return e[36]!==n||e[37]!==x||e[38]!==b||e[39]!==y||e[40]!==_?(v={snapshot:x,isLoading:n,moveTile:b,resizeTile:y,hideTile:_},e[36]=n,e[37]=x,e[38]=b,e[39]=y,e[40]=_,e[41]=v):v=e[41],v}function $K(t){return t.id}function D3(t){const{org:e}=Be(),{data:s}=_n.useSession(),n=Ag(),i=cs(),r=Qt({connectionId:bl,orgId:e.id,orgSlug:e.slug}),[l,a]=P.useState(!1),c=rE(t,{enabled:!1});return{connect:async()=>{if(!(l||!s?.user?.id||!e)){a(!0);try{const h=c.data??(await c.refetch()).data;if(!h){ve.error("Could not find this integration in the registry");return}const u=eE(h,e.id,s.user.id,{remoteIndex:0});if(!u.connection_url){ve.error("This integration has no connection method available");return}const f=u.app_name?await BK(r,u.app_name):null,p=!f,m=f?.id??(await n.create.mutateAsync(u)).id,g=await aE({connectionId:m,orgId:e.id,orgSlug:e.slug,persistFallback:x=>n.update.mutateAsync({id:m,data:{connection_token:x}}).then(()=>{})});if(g.ran&&!g.ok){if(p)try{await n.delete.mutateAsync(m)}catch{}ve.error(`Authentication failed: ${g.error??"no token"}`);return}Ru(i,e.id),ve.success(p?"Connected successfully":"Already connected")}catch(h){ve.error(`Failed to connect: ${h instanceof Error?h.message:String(h)}`)}finally{a(!1)}}},isConnecting:l}}async function BK(t,e){return(await t.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_name"],operator:"eq",value:e},limit:1}})).structuredContent?.items?.[0]??null}const zK=3,FK=5;function UK(t){const e=z.c(17),{org:s}=Be();let n;e[0]!==s.id||e[1]!==s.slug?(n={connectionId:bl,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=n):n=e[2];const i=Qt(n);let r;e[3]!==t||e[4]!==s.id||e[5]!==s.slug?(r={connectionId:t,orgId:s.id,orgSlug:s.slug},e[3]=t,e[4]=s.id,e[5]=s.slug,e[6]=r):r=e[6];const l=Qt(r);let a;e[7]!==t||e[8]!==s.id?(a=Ge.homeGithubRecentPrs(s.id,t),e[7]=t,e[8]=s.id,e[9]=a):a=e[9];let c;e[10]!==t||e[11]!==l||e[12]!==i?(c=async()=>{const{installations:h}=await l7(y=>i.callTool(y),t),u=h[0];if(!u)return{repos:[]};const f=u.type==="User"?"user":"org",m=(await l.callTool({name:"search_repositories",arguments:{query:`${f}:${u.login}`,page:1,perPage:30}})).content?.[0]?.text,x=[...m?JSON.parse(m).items??[]:[]].sort(GK).filter(qK).slice(0,zK);return x.length===0?{repos:[]}:{repos:(await Promise.all(x.map(async y=>{const[_,v]=y.full_name.split("/"),L=await l.callTool({name:"list_pull_requests",arguments:{owner:_,repo:v,state:"all",perPage:FK}}),S=H7(L).map(WK).filter(KK);return{repo:y.full_name,prs:S}}))).filter(HK)}},e[10]=t,e[11]=l,e[12]=i,e[13]=c):c=e[13];let d;return e[14]!==a||e[15]!==c?(d={queryKey:a,queryFn:c,staleTime:6e4,retry:!1},e[14]=a,e[15]=c,e[16]=d):d=e[16],Tt(d)}function HK(t){return t.prs.length>0}function KK(t){return t.number>0}function WK(t){return{number:t.number??0,title:t.title??"",merged:t.merged_at!=null,state:t.state==="closed"?"closed":"open",htmlUrl:t.html_url??""}}function qK(t){return t.full_name}function GK(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}const Fc=26,YK=7;function JK(t){const e=z.c(17),{org:s}=Be();let n;e[0]!==s.id||e[1]!==s.slug?(n={connectionId:bl,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=n):n=e[2];const i=Qt(n);let r;e[3]!==t||e[4]!==s.id||e[5]!==s.slug?(r={connectionId:t,orgId:s.id,orgSlug:s.slug},e[3]=t,e[4]=s.id,e[5]=s.slug,e[6]=r):r=e[6];const l=Qt(r);let a;e[7]!==t||e[8]!==s.id?(a=Ge.homeGithubContributions(s.id,t),e[7]=t,e[8]=s.id,e[9]=a):a=e[9];let c;e[10]!==t||e[11]!==l||e[12]!==i?(c=async()=>{const{installations:h}=await l7(j=>i.callTool(j),t),u=h[0];if(!u)return sm();const f=u.type==="User"?"user":"org",m=(await l.callTool({name:"search_repositories",arguments:{query:`${f}:${u.login}`,page:1,perPage:30}})).content?.[0]?.text,x=[...m?JSON.parse(m).items??[]:[]].sort(QK)[0];if(!x?.full_name)return sm();const[b,y]=x.full_name.split("/"),_=new Date(Date.now()-Fc*7*864e5),L=(await l.callTool({name:"list_commits",arguments:{owner:b,repo:y,since:_.toISOString(),perPage:100}})).content?.[0]?.text,S=L?JSON.parse(L):[],w=sm(),k=Date.now();for(const j of S){const C=j.commit?.committer?.date??j.commit?.author?.date??"",N=new Date(C);if(isNaN(N.getTime()))continue;const T=Math.floor((k-N.getTime())/864e5);if(T<0||T>=Fc*7)continue;const V=Fc-1-Math.floor(T/7),A=N.getDay(),E=w[V];E&&(E[A]=(E[A]??0)+1)}return w},e[10]=t,e[11]=l,e[12]=i,e[13]=c):c=e[13];let d;return e[14]!==a||e[15]!==c?(d={queryKey:a,queryFn:c,staleTime:3e5,retry:!1},e[14]=a,e[15]=c,e[16]=d):d=e[16],Tt(d)}function QK(t,e){return(e.updated_at??"").localeCompare(t.updated_at??"")}function sm(){return Array.from({length:Fc},()=>Array.from({length:YK},()=>0))}const dw="pageviews",uw="sessions",hw="orders",fw="coding",mw="revenue",pw="recent-conversations",I3=[{id:dw,titleKey:"home.nativeTiles.pageviews",defaultSize:{w:2,h:3},minSize:{w:1,h:2}},{id:uw,titleKey:"home.nativeTiles.sessions",defaultSize:{w:2,h:3},minSize:{w:1,h:2}},{id:hw,titleKey:"home.nativeTiles.orders",defaultSize:{w:2,h:3},minSize:{w:1,h:2}},{id:mw,titleKey:"home.nativeTiles.revenue",defaultSize:{w:3,h:3},minSize:{w:2,h:2}},{id:fw,titleKey:"home.nativeTiles.coding",defaultSize:{w:3,h:3},minSize:{w:2,h:2}},{id:pw,titleKey:"home.nativeTiles.recentConversations",defaultSize:{w:6,h:4},minSize:{w:2,h:2},defaultHidden:!0}];function gw(t){return`native:${t}`}function xw(t){const e=z.c(21),{points:s,metricLabel:n}=t,i=P.useId();let r;if(e[0]!==i){let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=/:/g,e[2]=y):y=e[2],r=i.replace(y,""),e[0]=i,e[1]=r}else r=e[1];const l=r;let a;e[3]!==n?(a={value:{label:n,color:"var(--success)"}},e[3]=n,e[4]=a):a=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c={top:6,right:0,bottom:0,left:0},e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("line",{x1:0,y1:0,x2:0,y2:8,stroke:"var(--success)",strokeOpacity:.22,strokeWidth:4}),e[6]=d):d=e[6];let h;e[7]!==l?(h=o.jsx("defs",{children:o.jsx("pattern",{id:l,width:6,height:8,patternUnits:"userSpaceOnUse",children:d})}),e[7]=l,e[8]=h):h=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(cE,{dataKey:"label",hide:!0}),e[9]=u):u=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(ZV,{cursor:{stroke:"var(--border)"},content:o.jsx(eA,{indicator:"line"})}),e[10]=f):f=e[10];const p=`url(#${l})`;let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m={r:4,fill:"var(--success)",stroke:"var(--background)",strokeWidth:2},e[11]=m):m=e[11];let g;e[12]!==p?(g=o.jsx(dE,{type:"monotone",dataKey:"value",stroke:"var(--success)",strokeWidth:2,fill:p,fillOpacity:1,animationDuration:350,dot:!1,activeDot:m}),e[12]=p,e[13]=g):g=e[13];let x;e[14]!==s||e[15]!==g||e[16]!==h?(x=o.jsxs(uE,{data:s,margin:c,children:[h,u,f,g]}),e[14]=s,e[15]=g,e[16]=h,e[17]=x):x=e[17];let b;return e[18]!==x||e[19]!==a?(b=o.jsx(tA,{config:a,className:"h-full w-full",children:x}),e[18]=x,e[19]=a,e[20]=b):b=e[20],b}const bw={pageviews:{value:"12.2k",delta:"+1.9%",series:[9800,10100,9950,10600,10400,11e3,11200,11500,11900,12200]},sessions:{value:"3.2k",delta:"+25.6%",series:[2100,2250,2200,2500,2600,2750,2900,3e3,3100,3200]},orders:{value:"142",delta:"+8.4%",series:[96,102,99,110,108,118,124,131,137,142]},revenue:{value:"$8,240",delta:"+12.0%",series:[6100,6400,6250,6800,6700,7100,7400,7700,8e3,8240]}};function vw(t,e){return t.map((s,n)=>{const i=t.length-1-n;return{label:i===0?e("home.nativeTiles.today"):i===1?e("home.nativeTiles.yesterday"):e("home.nativeTiles.daysAgo",{days:i}),value:s}})}function yw(t){const e=z.c(8),{value:s,delta:n}=t;let i;e[0]!==s?(i=o.jsx("span",{className:"text-2xl font-medium tabular-nums text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(A6,{className:"size-4"}),e[2]=r):r=e[2];let l;e[3]!==n?(l=o.jsxs("span",{className:"inline-flex items-center gap-1 text-sm font-medium tabular-nums text-success",children:[r,n]}),e[3]=n,e[4]=l):l=e[4];let a;return e[5]!==i||e[6]!==l?(a=o.jsxs("div",{className:"mt-3 flex items-center gap-2.5",children:[i,l]}),e[5]=i,e[6]=l,e[7]=a):a=e[7],a}function XK(t,e){const s=(t*31+e*17+7)%100;return s<38?0:s<60?1+s%2:s<80?3+s%3:s<93?6+s%3:9+s%4}function ZK(t){return t===0?"bg-muted-foreground/15":t<=2?"bg-success/25":t<=5?"bg-success/45":t<=8?"bg-success/70":"bg-success"}function _w(t){const e=z.c(4),{grid:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={gridTemplateColumns:`repeat(${Fc}, 1fr)`},e[0]=i):i=e[0];let r;return e[1]!==s||e[2]!==n?(r=o.jsx(to,{delayDuration:0,children:o.jsx("div",{className:"grid w-full gap-1",style:i,children:Array.from({length:Fc},(l,a)=>o.jsx("div",{className:"flex flex-col gap-1",children:Array.from({length:5},(c,d)=>{const h=s?s[a]?.[d]??0:XK(a,d);return o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx("div",{className:ie("aspect-square rounded-[2px]",ZK(h))})}),o.jsx(Ue,{children:h===0?n("home.nativeTiles.noCommits"):n("home.nativeTiles.commits",{count:h})})]},d)})},a))})}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}function M3(t){const e=z.c(8),{label:s,icon:n,onConnect:i,pending:r}=t;let l;e[0]!==n||e[1]!==r?(l=r?o.jsx(ct,{className:"size-4 animate-spin"}):n,e[0]=n,e[1]=r,e[2]=l):l=e[2];let a;return e[3]!==s||e[4]!==i||e[5]!==r||e[6]!==l?(a=o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/30 backdrop-blur-[2px]",children:o.jsxs(me,{size:"sm",onClick:i,disabled:r,className:"gap-2 shadow-sm",children:[l,s]})}),e[3]=s,e[4]=i,e[5]=r,e[6]=l,e[7]=a):a=e[7],a}function Lw(t){const e=z.c(6),{label:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(vi,{className:"size-6 text-success/60"}),e[0]=i):i=e[0];let r;e[1]!==s||e[2]!==n?(r=n("home.nativeTiles.connectedSoon",{label:s}),e[1]=s,e[2]=n,e[3]=r):r=e[3];let l;return e[4]!==r?(l=o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-center",children:[i,o.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),e[4]=r,e[5]=l):l=e[5],l}function G5(t){const e=z.c(25),{metricKey:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"google-analytics"},e[0]=i):i=e[0];const r=pi(i).length>0,{connect:l,isConnecting:a}=D3("deco/google-analytics"),c=bw[s];if(r||!c){let x;e[1]!==n?(x=n("home.nativeTiles.analyticsLabel"),e[1]=n,e[2]=x):x=e[2];let b;return e[3]!==x?(b=o.jsx(Lw,{label:x}),e[3]=x,e[4]=b):b=e[4],b}let d;e[5]!==c.series||e[6]!==n?(d=vw(c.series,n),e[5]=c.series,e[6]=n,e[7]=d):d=e[7];let h;e[8]!==s||e[9]!==d?(h=o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(xw,{points:d,metricLabel:s})}),e[8]=s,e[9]=d,e[10]=h):h=e[10];let u;e[11]!==c.delta||e[12]!==c.value?(u=o.jsx(yw,{value:c.value,delta:c.delta}),e[11]=c.delta,e[12]=c.value,e[13]=u):u=e[13];let f;e[14]!==n?(f=n("home.nativeTiles.connectGoogleAnalytics"),e[14]=n,e[15]=f):f=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(H8,{className:"size-4"}),e[16]=p):p=e[16];let m;e[17]!==l||e[18]!==a||e[19]!==f?(m=o.jsx(M3,{label:f,icon:p,onConnect:l,pending:a}),e[17]=l,e[18]=a,e[19]=f,e[20]=m):m=e[20];let g;return e[21]!==h||e[22]!==u||e[23]!==m?(g=o.jsxs("div",{className:"relative flex h-full flex-col",children:[h,u,m]}),e[21]=h,e[22]=u,e[23]=m,e[24]=g):g=e[24],g}function Y5(t){const e=z.c(30),{metricKey:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={slug:"vtex"},e[0]=i):i=e[0];const r=pi(i);let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={slug:"shopify"},e[1]=l):l=e[1];const a=pi(l),c=r.length>0||a.length>0,[d,h]=P.useState(!1),u=bw[s];if(c||!u){let S;e[2]!==n?(S=n("home.nativeTiles.commerceLabel"),e[2]=n,e[3]=S):S=e[3];let w;return e[4]!==S?(w=o.jsx(Lw,{label:S}),e[4]=S,e[5]=w):w=e[5],w}let f;e[6]!==u.series||e[7]!==n?(f=vw(u.series,n),e[6]=u.series,e[7]=n,e[8]=f):f=e[8];let p;e[9]!==s||e[10]!==f?(p=o.jsx("div",{className:"min-h-0 flex-1",children:o.jsx(xw,{points:f,metricLabel:s})}),e[9]=s,e[10]=f,e[11]=p):p=e[11];let m;e[12]!==u.delta||e[13]!==u.value?(m=o.jsx(yw,{value:u.value,delta:u.delta}),e[12]=u.delta,e[13]=u.value,e[14]=m):m=e[14];let g;e[15]!==n?(g=n("home.nativeTiles.connectCommercePlatform"),e[15]=n,e[16]=g):g=e[16];let x,b;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Eg,{className:"size-4"}),b=()=>h(!0),e[17]=x,e[18]=b):(x=e[17],b=e[18]);let y;e[19]!==g?(y=o.jsx(M3,{label:g,icon:x,onConnect:b}),e[19]=g,e[20]=y):y=e[20];let _;e[21]!==p||e[22]!==m||e[23]!==y?(_=o.jsxs("div",{className:"relative flex h-full flex-col",children:[p,m,y]}),e[21]=p,e[22]=m,e[23]=y,e[24]=_):_=e[24];let v;e[25]!==d?(v=o.jsx(Lg,{mode:"browse",open:d,onOpenChange:h,defaultTab:"all",initialSearch:"shopify vtex"}),e[25]=d,e[26]=v):v=e[26];let L;return e[27]!==_||e[28]!==v?(L=o.jsxs(o.Fragment,{children:[_,v]}),e[27]=_,e[28]=v,e[29]=L):L=e[29],L}function eW(){const t=z.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={slug:"mcp-github"},t[0]=e):e=t[0];const s=pi(e);let n;t[1]!==s?(n=oE(s),t[1]=s,t[2]=n):n=t[2];const i=n[0];let r;return t[3]!==i?(r=i?o.jsx(sW,{connectionId:i.id}):o.jsx(tW,{}),t[3]=i,t[4]=r):r=t[4],r}function tW(){const t=z.c(8),e=re(),{connect:s,isConnecting:n}=D3("deco/mcp-github");let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:o.jsx(_w,{})}),t[0]=i):i=t[0];let r;t[1]!==e?(r=e("home.nativeTiles.connectGithub"),t[1]=e,t[2]=r):r=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Vn,{className:"size-4"}),t[3]=l):l=t[3];let a;return t[4]!==s||t[5]!==n||t[6]!==r?(a=o.jsxs("div",{className:"relative flex h-full flex-col",children:[i,o.jsx(M3,{label:r,icon:l,onConnect:s,pending:n})]}),t[4]=s,t[5]=n,t[6]=r,t[7]=a):a=t[7],a}function sW(t){const e=z.c(9),{connectionId:s}=t,n=re(),{data:i,isLoading:r}=UK(s),{data:l}=JK(s);let a;e[0]!==l?(a=o.jsx(_w,{grid:l}),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==i||e[3]!==r||e[4]!==n?(c=r?o.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:3},iW)}):!i||i.repos.length===0?o.jsx("p",{className:"text-xs text-muted-foreground",children:n("home.nativeTiles.noRecentPullRequests")}):o.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto",children:i.repos.map(nW)}),e[2]=i,e[3]=r,e[4]=n,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==c?(d=o.jsxs("div",{className:"flex h-full flex-col gap-3 overflow-hidden",children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function nW(t){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:t.repo}),t.prs.map(e=>o.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 rounded-md px-1.5 py-1.5 text-sm transition-colors hover:bg-accent/60",children:[o.jsx(ci,{className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate text-foreground",children:e.title}),o.jsxs("span",{className:ie("ml-auto shrink-0 rounded-full px-1.5 py-0.5 text-xs font-medium",e.merged?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:["#",e.number]})]},`${t.repo}#${e.number}`))]},t.repo)}function iW(t,e){return o.jsx("div",{className:"h-5 w-full animate-pulse rounded-md bg-muted/40"},`pr-skeleton-${e}`)}const rW={completed:{labelKey:"home.nativeTiles.statusCompleted",className:"text-success"},in_progress:{labelKey:"home.nativeTiles.statusRunning",className:"text-foreground"},requires_action:{labelKey:"home.nativeTiles.statusNeedsInput",className:"text-foreground"},failed:{labelKey:"home.nativeTiles.statusFailed",className:"text-destructive"},expired:{labelKey:"home.nativeTiles.statusExpired",className:"text-muted-foreground"}};function oW(){const t=z.c(14),e=re(),{org:s,locator:n}=Be(),i=gs(),r=Js(),{data:l}=d0(),a=l?.data?.members??[],c=new Map(a.map(lW));let d;t[0]!==n?(d=Ge.overviewThreads(n),t[0]=n,t[1]=d):d=t[1];let h;t[2]!==i?(h=async()=>(await i.call("COLLECTION_THREADS_LIST",{limit:12})).items??[],t[2]=i,t[3]=h):h=t[3];let u;t[4]!==d||t[5]!==h?(u={queryKey:d,queryFn:h,staleTime:3e4},t[4]=d,t[5]=h,t[6]=u):u=t[6];const{data:f}=Zf(u);if(f.length===0){let x;t[7]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(hg,{className:"size-6 text-muted-foreground/50"}),t[7]=x):x=t[7];let b;t[8]!==e?(b=e("home.nativeTiles.noConversationsYet"),t[8]=e,t[9]=b):b=t[9];let y;return t[10]!==b?(y=o.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[x,o.jsx("p",{className:"text-xs text-muted-foreground",children:b})]}),t[10]=b,t[11]=y):y=t[11],y}const p="flex h-full flex-col gap-0.5 overflow-y-auto",m=f.map(x=>{const b=c.get(x.created_by),y=b?.user?.name??b?.user?.email?.split("@")[0]??"Someone",_=x.status?rW[x.status]:void 0,v=x.updated_at?va(new Date(x.updated_at)):null;return o.jsxs("button",{type:"button",onClick:()=>r({to:"/$org/$taskId",params:{org:s.slug,taskId:x.id},search:x.virtual_mcp_id?{virtualmcpid:x.virtual_mcp_id}:{}}),className:"flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-accent/60",children:[o.jsx(Ps,{shape:"circle",size:"xs",url:b?.user?.image??void 0,fallback:y.slice(0,2).toUpperCase()}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:x.title||e("home.nativeTiles.untitledConversation")}),o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:[y,v?` · ${v}`:""]})]}),_&&o.jsx("span",{className:ie("shrink-0 text-xs",_.className),children:e(_.labelKey)})]},x.id)});let g;return t[12]!==m?(g=o.jsx("div",{className:p,children:m}),t[12]=m,t[13]=g):g=t[13],g}function lW(t){return[t.userId,t]}function aW(t){const e=z.c(6),{nativeId:s}=t;switch(s){case dw:{let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(G5,{metricKey:"pageviews"}),e[0]=n):n=e[0],n}case uw:{let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(G5,{metricKey:"sessions"}),e[1]=n):n=e[1],n}case hw:{let n;return e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Y5,{metricKey:"orders"}),e[2]=n):n=e[2],n}case mw:{let n;return e[3]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Y5,{metricKey:"revenue"}),e[3]=n):n=e[3],n}case fw:{let n;return e[4]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(eW,{}),e[4]=n):n=e[4],n}case pw:{let n;return e[5]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"h-full animate-pulse bg-muted/30"}),children:o.jsx(oW,{})}),e[5]=n):n=e[5],n}default:return null}}function cW(t){const e=z.c(16),{nativeId:s}=t,n=re();let i,r,l;if(e[0]!==s||e[1]!==n){let h;e[5]!==s?(h=f=>f.id===s,e[5]=s,e[6]=h):h=e[6];const u=I3.find(h);l="flex h-full flex-col overflow-hidden p-4",i="shrink-0 text-xs font-medium text-muted-foreground",r=u?.titleKey?n(u.titleKey):n("home.nativeTiles.tile"),e[0]=s,e[1]=n,e[2]=i,e[3]=r,e[4]=l}else i=e[2],r=e[3],l=e[4];let a;e[7]!==i||e[8]!==r?(a=o.jsx("span",{className:i,children:r}),e[7]=i,e[8]=r,e[9]=a):a=e[9];let c;e[10]!==s?(c=o.jsx("div",{className:"relative mt-2 min-h-0 flex-1",children:o.jsx(aW,{nativeId:s})}),e[10]=s,e[11]=c):c=e[11];let d;return e[12]!==l||e[13]!==a||e[14]!==c?(d=o.jsxs("div",{className:l,children:[a,c]}),e[12]=l,e[13]=a,e[14]=c,e[15]=d):d=e[15],d}const dW={w:3,h:4},uW={w:1,h:2},hW={w:2,h:1};function fW(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function mW(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function pW(t){return t.promptName?t.agentName:t.description}function gW(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function ww(t){const e=z.c(14),{org:s}=Be();let n;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(n=qV({connectionId:t.connectionId,orgId:s.id,orgSlug:s.slug}),e[0]=s.id,e[1]=s.slug,e[2]=t.connectionId,e[3]=n):n=e[3];const{data:i}=Tt(n),r=!!i&&!t.toolName;let l;e[4]!==i||e[5]!==r?(l={client:i,enabled:r},e[4]=i,e[5]=r,e[6]=l):l=e[6];const{data:a}=lg(l);let c;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==a?.tools?(c=t.toolName??a?.tools.find(u=>j9(u._meta)===t.resourceUri)?.name,e[7]=t.resourceUri,e[8]=t.toolName,e[9]=a?.tools,e[10]=c):c=e[10];const d=c;let h;return e[11]!==t.connectionId||e[12]!==d?(h=d?Wm(t.connectionId,d):void 0,e[11]=t.connectionId,e[12]=d,e[13]=h):h=e[13],h}function O3(t){const e=z.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:n,startBlank:i,dialog:r,starting:l}=ZU(s);let a;e[2]!==n||e[3]!==i?(a=h=>{if(!h.promptName){i();return}n(gW(h))},e[2]=n,e[3]=i,e[4]=a):a=e[4];const c=a;let d;return e[5]!==r||e[6]!==c||e[7]!==i||e[8]!==l?(d={open:c,startBlank:i,dialog:r,starting:l},e[5]=r,e[6]=c,e[7]=i,e[8]=l,e[9]=d):d=e[9],d}function xW(t){const e=z.c(32),{entry:s,isEditMode:n}=t,{open:i,dialog:r,starting:l}=O3(s.agentId);let a;e[0]!==s||e[1]!==i?(a=()=>i(s),e[0]=s,e[1]=i,e[2]=a):a=e[2];const c=l||n,d=!n&&"cursor-pointer transition-colors hover:bg-accent/40",h=n&&"cursor-default pl-12",u=l&&"opacity-60";let f;e[3]!==d||e[4]!==h||e[5]!==u?(f=ie("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",d,h,u),e[3]=d,e[4]=h,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==s.agentIcon||e[8]!==s.agentName?(p=o.jsx(mi,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=p):p=e[9];let m;e[10]!==s.title?(m=o.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=m):m=e[11];let g;e[12]!==s?(g=pW(s),e[12]=s,e[13]=g):g=e[13];let x;e[14]!==g?(x=o.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:g}),e[14]=g,e[15]=x):x=e[15];let b;e[16]!==x||e[17]!==m?(b=o.jsxs("div",{className:"min-w-0 flex-1",children:[m,x]}),e[16]=x,e[17]=m,e[18]=b):b=e[18];let y;e[19]!==n?(y=!n&&o.jsx(bo,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=n,e[20]=y):y=e[20];let _;e[21]!==l||e[22]!==a||e[23]!==b||e[24]!==y||e[25]!==c||e[26]!==f||e[27]!==p?(_=o.jsxs("button",{type:"button",onClick:a,disabled:c,"aria-busy":l,className:f,children:[p,b,y]}),e[21]=l,e[22]=a,e[23]=b,e[24]=y,e[25]=c,e[26]=f,e[27]=p,e[28]=_):_=e[28];let v;return e[29]!==r||e[30]!==_?(v=o.jsxs(o.Fragment,{children:[_,r]}),e[29]=r,e[30]=_,e[31]=v):v=e[31],v}function bW(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},vW)}),t[0]=e):e=t[0],e}function vW(t,e){return o.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[o.jsx(Pt,{className:"size-10 rounded-xl"}),o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx(Pt,{className:"h-3 w-2/3"}),o.jsx(Pt,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function yW(t){const e=z.c(18),{tile:s,prompts:n,isEditMode:i,tileWidth:r}=t,{org:l}=Be(),{open:a,startBlank:c,dialog:d,starting:h}=O3(s.agentId),u=n.filter(_W),f=ww(s),p=re(),m="relative flex h-full w-full flex-col p-3";let g;e[0]!==i||e[1]!==f||e[2]!==c||e[3]!==h||e[4]!==p?(g=!i&&o.jsx("button",{type:"button",onClick:()=>{c(f?{panel:f}:void 0)},disabled:h,"aria-busy":h,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:p("home.homeGrid.openChat")}),e[0]=i,e[1]=f,e[2]=c,e[3]=h,e[4]=p,e[5]=g):g=e[5];const x="flex min-h-0 flex-1 gap-3 overflow-hidden";let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(wW,{}),e[6]=b):b=e[6];let y;e[7]!==l.id||e[8]!==l.slug||e[9]!==s?(y=o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:o.jsx(P.Suspense,{fallback:b,children:o.jsx(LW,{tile:s,orgId:l.id,orgSlug:l.slug})})}),e[7]=l.id,e[8]=l.slug,e[9]=s,e[10]=y):y=e[10];const _=u.length>0&&!i&&r>=2&&o.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(S=>o.jsx("button",{type:"button",onClick:()=>a(S),disabled:h,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:o.jsx("span",{className:"line-clamp-2",children:S.title})},S.promptName))});let v;e[11]!==y||e[12]!==_?(v=o.jsxs("div",{className:x,children:[y,_]}),e[11]=y,e[12]=_,e[13]=v):v=e[13];let L;return e[14]!==d||e[15]!==g||e[16]!==v?(L=o.jsxs("div",{className:m,children:[g,v,d]}),e[14]=d,e[15]=g,e[16]=v,e[17]=L):L=e[17],L}function _W(t){return!!t.promptName}function LW(t){const e=z.c(13),{tile:s,orgId:n,orgSlug:i}=t;let r;e[0]!==n||e[1]!==i||e[2]!==s.connectionId?(r={connectionId:s.connectionId,orgId:n,orgSlug:i},e[0]=n,e[1]=i,e[2]=s.connectionId,e[3]=r):r=e[3];const l=Qt(r),a=s.minHeight??200,c=s.maxHeight??4e3;let d;return e[4]!==l||e[5]!==n||e[6]!==i||e[7]!==a||e[8]!==c||e[9]!==s.connectionId||e[10]!==s.resourceUri||e[11]!==s.toolInput?(d=o.jsx(BP,{resourceURI:s.resourceUri,orgId:n,orgSlug:i,connectionId:s.connectionId,client:l,toolInput:s.toolInput,displayMode:"fullscreen",minHeight:a,maxHeight:c,className:"h-full"}),e[4]=l,e[5]=n,e[6]=i,e[7]=a,e[8]=c,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=s.toolInput,e[12]=d):d=e[12],d}function wW(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[o.jsx(Pt,{className:"h-3 w-2/3"}),o.jsx(Pt,{className:"h-3 w-1/2"}),o.jsx(Pt,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function SW(t){const e=z.c(18),{icon:s,name:n}=t,i=re();let r;e[0]!==s||e[1]!==n?(r=o.jsx(mi,{icon:s,name:n,size:"sm+"}),e[0]=s,e[1]=n,e[2]=r):r=e[2];let l;e[3]!==n?(l=o.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:n}),e[3]=n,e[4]=l):l=e[4];let a;e[5]!==i?(a=i("home.homeGrid.loadingTile"),e[5]=i,e[6]=a):a=e[6];let c;e[7]!==a?(c=o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=o.jsxs("div",{className:"min-w-0 flex-1",children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let h;e[12]!==r||e[13]!==d?(h=o.jsxs("div",{className:"flex items-center gap-2.5",children:[r,d]}),e[12]=r,e[13]=d,e[14]=h):h=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[o.jsx(Pt,{className:"h-3 w-3/4"}),o.jsx(Pt,{className:"h-3 w-1/2"}),o.jsx(Pt,{className:"h-3 w-2/3"})]}),e[15]=u):u=e[15];let f;return e[16]!==h?(f=o.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[h,u]}),e[16]=h,e[17]=f):f=e[17],f}function kW(t){const e=z.c(13),{tile:s,prompts:n,isEditMode:i}=t,r=re(),{open:l,startBlank:a,dialog:c,starting:d}=O3(s.agentId),h=n.filter(jW),u=ww(s),f="flex h-full w-full flex-col gap-3 p-4";let p;e[0]!==u||e[1]!==a?(p=()=>{a(u?{panel:u}:void 0)},e[0]=u,e[1]=a,e[2]=p):p=e[2];const m=d||i;let g;e[3]!==r?(g=r("home.homeGrid.openChat"),e[3]=r,e[4]=g):g=e[4];let x;e[5]!==p||e[6]!==m||e[7]!==g?(x=o.jsx("button",{type:"button",onClick:p,disabled:m,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:g}),e[5]=p,e[6]=m,e[7]=g,e[8]=x):x=e[8];const b=h.length>0&&!i&&o.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:h.map(_=>o.jsx("button",{type:"button",onClick:()=>!i&&l(_),disabled:d,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:o.jsx("span",{className:"line-clamp-2",children:_.title})},_.promptName))});let y;return e[9]!==c||e[10]!==x||e[11]!==b?(y=o.jsxs("div",{className:f,children:[x,b,c]}),e[9]=c,e[10]=x,e[11]=b,e[12]=y):y=e[12],y}function jW(t){return!!t.promptName}function CW({isEditMode:t}){const e=re(),{org:s}=Be(),{isLoading:n,prompts:i,tiles:r}=a8(s.slug),l=i.filter(k=>!u4(k.agentId)),a=r.filter(k=>!u4(k.agentId)),c=D8()?.ids??[],d=new Set(c),h=I8(),u=gs(),f=cs(),p=new Set(a.map(k=>k.agentId)),m=new Map;for(const k of l){const j=m.get(k.agentId);j?j.push(k):m.set(k.agentId,[k])}const g=l.filter(k=>!p.has(k.agentId)),x=[...a.map(k=>({kind:"tile",id:mW(k),data:k})),...g.map(k=>({kind:"prompt",id:fW(k),data:k})),...I3.map(k=>({kind:"native",id:gw(k.id),data:k}))],b=new Map(x.map(k=>[k.id,k])),y=OK(x.map(k=>k.kind==="native"?{id:k.id,defaultSize:k.data.defaultSize,minSize:k.data.minSize,defaultHidden:k.data.defaultHidden}:{id:k.id,defaultSize:k.kind==="tile"?dW:hW,minSize:k.kind==="tile"?uW:void 0,pinned:d.has(k.data.agentId)})),_=k=>{h.apply(j=>j.filter(C=>C!==k)).catch(()=>ve.error(e("home.homeGrid.couldntRemoveFromHome")))},v=async k=>{if(a.filter(C=>C.agentId===k.agentId).length<=1){_(k.agentId);return}try{const N=(await u.call("COLLECTION_VIRTUAL_MCP_GET",{id:k.agentId})).item;if(!N)throw new Error("Agent not found");const T=ed(N.metadata?.ui),V=k.tileId?T.filter(A=>A.tileId!==k.tileId):T.filter(A=>A.connectionId!==k.connectionId||A.resourceUri!==k.resourceUri);await u.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:k.agentId,data:{metadata:{ui:{...N.metadata?.ui??{},homeTile:null,homeTiles:V}}}}),f.invalidateQueries({queryKey:Ge.homeNextActions(s.slug)})}catch{ve.error(e("home.homeGrid.couldntRemoveTile"))}},L=k=>{const j=b.get(k);if(j){if(j.kind==="native"){y.hideTile(k);return}if(!d.has(j.data.agentId)){y.hideTile(k);return}j.kind==="tile"?v(j.data):_(j.data.agentId)}},S=k=>{const j=b.get(k.id);if(!j)return null;if(j.kind==="native")return o.jsx(cW,{nativeId:j.data.id});if(j.kind==="tile"){const C=m.get(j.data.agentId)??[];return o.jsx(Hs,{fallback:o.jsx(kW,{tile:j.data,prompts:C,isEditMode:t}),children:o.jsx(P.Suspense,{fallback:o.jsx(SW,{icon:j.data.agentIcon,name:j.data.agentName}),children:o.jsx(yW,{tile:j.data,prompts:C,isEditMode:t,tileWidth:k.w})})})}return o.jsx(xW,{entry:j.data,isEditMode:t})};return n||y.isLoading?o.jsx(bW,{}):y.snapshot.visible.length===0&&!t?null:o.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:o.jsx(TK,{tiles:y.snapshot.visible,isEditMode:t,renderTile:S,onMove:y.moveTile,onResize:y.resizeTile,onRemove:L})})}function ea(t,e,s){const n=t.slice();return n.splice(s<0?n.length+s:s,0,n.splice(e,1)[0]),n}function NW(t,e){return t.reduce((s,n,i)=>{const r=e.get(n);return r&&(s[i]=r),s},Array(t.length))}function oh(t){return t!==null&&t>=0}function TW(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;return!0}function VW(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Sw=t=>{let{rects:e,activeIndex:s,overIndex:n,index:i}=t;const r=ea(e,n,s),l=e[i],a=r[i];return!a||!l?null:{x:a.left-l.left,y:a.top-l.top,scaleX:a.width/l.width,scaleY:a.height/l.height}},lh={scaleX:1,scaleY:1},X9=t=>{var e;let{activeIndex:s,activeNodeRect:n,index:i,rects:r,overIndex:l}=t;const a=(e=r[s])!=null?e:n;if(!a)return null;if(i===s){const d=r[l];return d?{x:0,y:s<l?d.top+d.height-(a.top+a.height):d.top-a.top,...lh}:null}const c=AW(r,i,s);return i>s&&i<=l?{x:0,y:-a.height-c,...lh}:i<s&&i>=l?{x:0,y:a.height+c,...lh}:{x:0,y:0,...lh}};function AW(t,e,s){const n=t[e],i=t[e-1],r=t[e+1];return n?s<e?i?n.top-(i.top+i.height):r?r.top-(n.top+n.height):0:r?r.top-(n.top+n.height):i?n.top-(i.top+i.height):0:0}const kw="Sortable",jw=Nt.createContext({activeIndex:-1,containerId:kw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sw,disabled:{draggable:!1,droppable:!1}});function Z9(t){let{children:e,id:s,items:n,strategy:i=Sw,disabled:r=!1}=t;const{active:l,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:h}=aw(),u=N0(kw,s),f=a.rect!==null,p=P.useMemo(()=>n.map(S=>typeof S=="object"&&"id"in S?S.id:S),[n]),m=l!=null,g=l?p.indexOf(l.id):-1,x=d?p.indexOf(d.id):-1,b=P.useRef(p),y=!TW(p,b.current),_=x!==-1&&g===-1||y,v=VW(r);Ei(()=>{y&&m&&h(p)},[y,p,m,h]),P.useEffect(()=>{b.current=p},[p]);const L=P.useMemo(()=>({activeIndex:g,containerId:u,disabled:v,disableTransforms:_,items:p,overIndex:x,useDragOverlay:f,sortedRects:NW(p,c),strategy:i}),[g,u,v.draggable,v.droppable,_,p,x,c,f,i]);return Nt.createElement(jw.Provider,{value:L},e)}const PW=t=>{let{id:e,items:s,activeIndex:n,overIndex:i}=t;return ea(s,n,i).indexOf(e)},EW=t=>{let{containerId:e,isSorting:s,wasDragging:n,index:i,items:r,newIndex:l,previousItems:a,previousContainerId:c,transition:d}=t;return!d||!n||a!==r&&i===l?!1:s?!0:l!==i&&e===c},RW={duration:200,easing:"ease"},Cw="transform",DW=Ri.Transition.toString({property:Cw,duration:0,easing:"linear"}),IW={roleDescription:"sortable"};function MW(t){let{disabled:e,index:s,node:n,rect:i}=t;const[r,l]=P.useState(null),a=P.useRef(s);return Ei(()=>{if(!e&&s!==a.current&&n.current){const c=i.current;if(c){const d=wd(n.current,{ignoreTransform:!0}),h={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(h.x||h.y)&&l(h)}}s!==a.current&&(a.current=s)},[e,s,n,i]),P.useEffect(()=>{r&&l(null)},[r]),r}function e1(t){let{animateLayoutChanges:e=EW,attributes:s,disabled:n,data:i,getNewIndex:r=PW,id:l,strategy:a,resizeObserverConfig:c,transition:d=RW}=t;const{items:h,containerId:u,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:g,overIndex:x,useDragOverlay:b,strategy:y}=P.useContext(jw),_=OW(n,p),v=h.indexOf(l),L=P.useMemo(()=>({sortable:{containerId:u,index:v,items:h},...i}),[u,i,v,h]),S=P.useMemo(()=>h.slice(h.indexOf(l)),[h,l]),{rect:w,node:k,isOver:j,setNodeRef:C}=cw({id:l,data:L,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:N,activatorEvent:T,activeNodeRect:V,attributes:A,setNodeRef:E,listeners:R,isDragging:D,over:I,setActivatorNodeRef:O,transform:F}=lw({id:l,data:L,attributes:{...IW,...s},disabled:_.draggable}),M=eH(C,E),$=!!N,B=$&&!m&&oh(f)&&oh(x),U=!b&&D,H=U&&B?F:null,K=B?H??(a??y)({rects:g,activeNodeRect:V,activeIndex:f,overIndex:x,index:v}):null,G=oh(f)&&oh(x)?r({id:l,items:h,activeIndex:f,overIndex:x}):v,Y=N?.id,X=P.useRef({activeId:Y,items:h,newIndex:G,containerId:u}),te=h!==X.current.items,se=e({active:N,containerId:u,isDragging:D,isSorting:$,id:l,index:v,items:h,newIndex:X.current.newIndex,previousItems:X.current.items,previousContainerId:X.current.containerId,transition:d,wasDragging:X.current.activeId!=null}),ne=MW({disabled:!se,index:v,node:k,rect:w});return P.useEffect(()=>{$&&X.current.newIndex!==G&&(X.current.newIndex=G),u!==X.current.containerId&&(X.current.containerId=u),h!==X.current.items&&(X.current.items=h)},[$,G,u,h]),P.useEffect(()=>{if(Y===X.current.activeId)return;if(Y!=null&&X.current.activeId==null){X.current.activeId=Y;return}const q=setTimeout(()=>{X.current.activeId=Y},50);return()=>clearTimeout(q)},[Y]),{active:N,activeIndex:f,attributes:A,data:L,rect:w,index:v,newIndex:G,items:h,isOver:j,isSorting:$,isDragging:D,listeners:R,node:k,overIndex:x,over:I,setNodeRef:M,setActivatorNodeRef:O,setDroppableNodeRef:C,setDraggableNodeRef:E,transform:ne??K,transition:Q()};function Q(){if(ne||te&&X.current.newIndex===v)return DW;if(!(U&&!q9(T)||!d)&&($||se))return Ri.Transition.toString({...d,property:Cw})}}function OW(t,e){var s,n;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(s=t?.draggable)!=null?s:e.draggable,droppable:(n=t?.droppable)!=null?n:e.droppable}}function Lf(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const $W=[Et.Down,Et.Right,Et.Up,Et.Left],t1=(t,e)=>{let{context:{active:s,collisionRect:n,droppableRects:i,droppableContainers:r,over:l,scrollableAncestors:a}}=e;if($W.includes(t.code)){if(t.preventDefault(),!s||!n)return;const c=[];r.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=i.get(u.id);if(f)switch(t.code){case Et.Down:n.top<f.top&&c.push(u);break;case Et.Up:n.top>f.top&&c.push(u);break;case Et.Left:n.left>f.left&&c.push(u);break;case Et.Right:n.left<f.left&&c.push(u);break}});const d=KL({collisionRect:n,droppableRects:i,droppableContainers:c});let h=HL(d,"id");if(h===l?.id&&d.length>1&&(h=d[1].id),h!=null){const u=r.get(s.id),f=r.get(h),p=f?i.get(f.id):null,m=f?.node.current;if(m&&p&&u&&f){const x=G9(m).some((S,w)=>a[w]!==S),b=Nw(u,f),y=BW(u,f),_=x||!b?{x:0,y:0}:{x:y?n.width-p.width:0,y:y?n.height-p.height:0},v={x:p.left,y:p.top};return _.x&&_.y?v:Gu(v,_)}}}};function Nw(t,e){return!Lf(t)||!Lf(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function BW(t,e){return!Lf(t)||!Lf(e)||!Nw(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function $3(t){const e=z.c(12),{isPinned:s,submitting:n,onClick:i,label:r}=t,l=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let a;e[0]!==l?(a=ie("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",l),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==s||e[3]!==n?(c=n?o.jsx(ct,{size:12,className:"animate-spin"}):s?o.jsx(fg,{size:14}):o.jsx(Ut,{size:14}),e[2]=s,e[3]=n,e[4]=c):c=e[4];let d;return e[5]!==s||e[6]!==r||e[7]!==i||e[8]!==n||e[9]!==a||e[10]!==c?(d=o.jsx("button",{type:"button",onClick:i,disabled:n,"aria-label":r,"aria-pressed":s,title:r,className:a,children:c}),e[5]=s,e[6]=r,e[7]=i,e[8]=n,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}function zW(t){const e=z.c(32),{agent:s,home:n,curated:i}=t,{org:r}=Be();let l;e[0]!==s.id||e[1]!==r.id||e[2]!==r.slug?(l={connectionId:s.id,orgId:r.id,orgSlug:r.slug},e[0]=s.id,e[1]=r.id,e[2]=r.slug,e[3]=l):l=e[3];const a=Qt(l);let c;e[4]!==s.id||e[5]!==r.id?(c=Ge.agentPrompts(r.id,s.id),e[4]=s.id,e[5]=r.id,e[6]=c):c=e[6];let d;e[7]!==a?(d=async()=>{const{prompts:L}=await a.listPrompts();return L.map(KW)},e[7]=a,e[8]=d):d=e[8];let h;e[9]!==c||e[10]!==d?(h={queryKey:c,queryFn:d,staleTime:3e4,retry:!1},e[9]=c,e[10]=d,e[11]=h):h=e[11];const{data:u,isLoading:f,error:p}=Tt(h),m=a8(r.slug);let g,x;if(e[12]!==s.id||e[13]!==u||e[14]!==m.prompts){let L;e[17]!==s.id?(L=w=>w.agentId===s.id&&w.promptName,e[17]=s.id,e[18]=L):L=e[18],g=m.prompts.filter(L).map(HW);let S;e[19]!==u?(S=u??[],e[19]=u,e[20]=S):S=e[20],x=[...S];for(const w of g)x.some(k=>k.name===w.name)||x.push(w);e[12]=s.id,e[13]=u,e[14]=m.prompts,e[15]=g,e[16]=x}else g=e[15],x=e[16];if(f&&g.length===0){let L;return e[21]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(Pt,{className:"h-7 w-full"}),o.jsx(Pt,{className:"h-7 w-2/3"})]}),e[21]=L):L=e[21],L}if(p&&g.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(x.length===0)return null;let b;e[22]!==i||e[23]!==x?(b=i??x.map(UW),e[22]=i,e[23]=x,e[24]=b):b=e[24];let y;e[25]!==b?(y=new Set(b),e[25]=b,e[26]=y):y=e[26];const _=y;let v;return e[27]!==s||e[28]!==n||e[29]!==x||e[30]!==_?(v=o.jsx("div",{className:"flex flex-col gap-0.5",children:x.map(L=>o.jsx(WW,{agent:s,home:n,prompt:L,allPromptNames:x.map(FW),isPinned:_.has(L.name)},L.name))}),e[27]=s,e[28]=n,e[29]=x,e[30]=_,e[31]=v):v=e[31],v}function FW(t){return t.name}function UW(t){return t.name}function HW(t){return{name:t.promptName,title:t.title,description:t.description}}function KW(t){return{name:t.name,title:t.title,description:t.description}}function WW({agent:t,home:e,prompt:s,allPromptNames:n,isPinned:i}){const r=re(),[l,a]=P.useState(!1),c=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){ve.error(r("home.agentPromptList.homeIsFull",{limit:Sd}));return}a(!0);try{const d=t.metadata?.ui?.homePrompts;let h;Array.isArray(d)?h=i?d.filter(f=>f!==s.name):[...d,s.name]:h=i?n.filter(f=>f!==s.name):n;const u={instructions:t.metadata.instructions,ui:{...t.metadata?.ui??{},homePrompts:h}};await e.saveAgentMetadata(t,u)}catch(d){console.error("[home-tiles] failed to toggle prompt",d),ve.error(r("home.agentPromptList.couldntUpdateHome"))}finally{a(!1)}};return o.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??Wl(s.name)}),o.jsx($3,{isPinned:i,submitting:l,onClick:c,label:r(i?"home.agentPromptList.removeFromHome":"home.agentPromptList.addToHome")})]})}function B3(t){const e=z.c(7),{title:s,hint:n}=t;let i;e[0]!==s?(i=o.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==n?(r=n&&o.jsx("span",{className:"text-xs text-muted-foreground",children:n}),e[2]=n,e[3]=r):r=e[3];let l;return e[4]!==i||e[5]!==r?(l=o.jsxs("div",{className:"flex items-center justify-between px-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=l):l=e[6],l}const qW={tasks:vi,coding:ci,analytics:H8,sales:Eg,"recent-conversations":hg};function GW(){const t=z.c(19),e=re(),{layout:s,commitLayout:n}=N3();let i;t[0]!==s.hidden?(i=new Set(s.hidden),t[0]=s.hidden,t[1]=i):i=t[1];const r=i;let l;t[2]!==s.shown?(l=s.shown??[],t[2]=s.shown,t[3]=l):l=t[3];let a;t[4]!==l?(a=new Set(l),t[4]=l,t[5]=a):a=t[5];const c=a;let d;t[6]!==e?(d=e("home.nativeTilesSection.builtInTiles"),t[6]=e,t[7]=d):d=t[7];let h;t[8]!==d?(h=o.jsx(B3,{title:d}),t[8]=d,t[9]=h):h=t[9];let u;t[10]!==n||t[11]!==r||t[12]!==s||t[13]!==c||t[14]!==e?(u=I3.map(p=>{const m=gw(p.id),g=p.defaultHidden?c.has(m)&&!r.has(m):!r.has(m),x=qW[p.id]??hg,b=()=>{if(p.defaultHidden){n({...s,hidden:s.hidden.filter(y=>y!==m),shown:g?(s.shown??[]).filter(y=>y!==m):[...s.shown??[],m]});return}n({...s,hidden:g?[...s.hidden,m]:s.hidden.filter(y=>y!==m)})};return o.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 px-3 py-2.5",children:[o.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:o.jsx(x,{size:16})}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:e(p.titleKey)}),o.jsxs(me,{type:"button",size:"sm",variant:g?"outline":"special",className:"h-8 gap-1.5",onClick:b,children:[g?o.jsx(fg,{size:14}):o.jsx(Ut,{size:14}),e(g?"home.nativeTilesSection.remove":"home.nativeTilesSection.add")]})]},p.id)}),t[10]=n,t[11]=r,t[12]=s,t[13]=c,t[14]=e,t[15]=u):u=t[15];let f;return t[16]!==h||t[17]!==u?(f=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[h,u]}),t[16]=h,t[17]=u,t[18]=f):f=t[18],f}function YW(t,e,s){const n={};for(const[i,r]of Object.entries(t)){const l=e[i]?.type;if((l==="object"||l==="array")&&typeof r=="string"){if(!r.trim())continue;try{n[i]=JSON.parse(r)}catch{return null}}else if((l==="number"||l==="integer")&&(typeof r=="string"||typeof r=="number")){if(typeof r=="string"&&!r.trim())continue;const a=typeof r=="string"?Number(r):r;if(!Number.isFinite(a)||l==="integer"&&!Number.isInteger(a))return null;n[i]=a}else if(typeof r=="string"){if(!r.trim())continue;n[i]=r}else r!=null&&(n[i]=r)}return s?.some(i=>!(i in n))?null:n}function JW(t,e){if(!t||!e)return{};const s={};for(const[n,i]of Object.entries(t)){const r=e[n]?.type;(r==="object"||r==="array")&&i!=null&&typeof i!="string"?s[n]=JSON.stringify(i,null,2):s[n]=i}return s}function QW(t){if(!t)return"";const e=Object.entries(t).filter(([,s])=>s!=null&&s!=="");return e.length===0?"":e.slice(0,3).map(([s,n])=>{const i=typeof n=="object"?JSON.stringify(n):String(n);return`${s}=${i.length>20?`${i.slice(0,20)}…`:i}`}).join(", ")}function XW(t){const e=z.c(11),{properties:s,required:n,values:i,onChange:r}=t;let l;e[0]!==n?(l=n??[],e[0]=n,e[1]=l):l=e[1];let a;e[2]!==l?(a=new Set(l),e[2]=l,e[3]=a):a=e[3];const c=a;let d;e[4]!==s?(d=Object.entries(s),e[4]=s,e[5]=d):d=e[5];let h;return e[6]!==r||e[7]!==c||e[8]!==d||e[9]!==i?(h=o.jsx("div",{className:"flex flex-col gap-2",children:d.map(u=>{const[f,p]=u;return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-xs font-medium leading-none flex items-center gap-1",children:[f,c.has(f)&&o.jsx("span",{className:"text-destructive text-[10px]",children:"*"})]}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:p.type})]}),p.description&&o.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:p.description}),o.jsx(ZW,{type:p.type,fieldKey:f,value:i[f],onChange:m=>r(f,m)})]},f)})}),e[6]=r,e[7]=c,e[8]=d,e[9]=i,e[10]=h):h=e[10],h}function ZW(t){const e=z.c(40),{type:s,fieldKey:n,value:i,onChange:r}=t,l=re();if(s==="object"||s==="array"){const u=i??"";let f;e[0]!==r?(f=g=>r(g.target.value),e[0]=r,e[1]=f):f=e[1];let p;e[2]!==n||e[3]!==l?(p=l("common.toolInputForm.jsonPlaceholder",{fieldKey:n}),e[2]=n,e[3]=l,e[4]=p):p=e[4];let m;return e[5]!==u||e[6]!==f||e[7]!==p?(m=o.jsx(ho,{className:"font-mono text-xs h-16",value:u,onChange:f,placeholder:p,rows:2}),e[5]=u,e[6]=f,e[7]=p,e[8]=m):m=e[8],m}if(s==="boolean"){const u=i!=null?String(i):"";let f;e[9]!==r?(f=L=>r(L==="true"),e[9]=r,e[10]=f):f=e[10];let p;e[11]!==l?(p=l("common.toolInputForm.selectPlaceholder"),e[11]=l,e[12]=p):p=e[12];let m;e[13]!==p?(m=o.jsx(js,{className:"h-7 text-xs",children:o.jsx(As,{placeholder:p})}),e[13]=p,e[14]=m):m=e[14];let g;e[15]!==l?(g=l("common.toolInputForm.true"),e[15]=l,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(Dt,{value:"true",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==l?(b=l("common.toolInputForm.false"),e[19]=l,e[20]=b):b=e[20];let y;e[21]!==b?(y=o.jsx(Dt,{value:"false",children:b}),e[21]=b,e[22]=y):y=e[22];let _;e[23]!==x||e[24]!==y?(_=o.jsxs(Cs,{children:[x,y]}),e[23]=x,e[24]=y,e[25]=_):_=e[25];let v;return e[26]!==u||e[27]!==f||e[28]!==m||e[29]!==_?(v=o.jsxs(ks,{value:u,onValueChange:f,children:[m,_]}),e[26]=u,e[27]=f,e[28]=m,e[29]=_,e[30]=v):v=e[30],v}const a=i??"";let c;e[31]!==r?(c=u=>r(u.target.value),e[31]=r,e[32]=c):c=e[32];let d;e[33]!==n||e[34]!==l?(d=l("common.toolInputForm.enterPlaceholder",{fieldKey:n}),e[33]=n,e[34]=l,e[35]=d):d=e[35];let h;return e[36]!==a||e[37]!==c||e[38]!==d?(h=o.jsx(gt,{className:"h-7 text-xs",value:a,onChange:c,placeholder:d}),e[36]=a,e[37]=c,e[38]=d,e[39]=h):h=e[39],h}const Sd=8;function J5(t,e,s){return t.includes(e)||(s?t.filter(i=>s.has(i)).length:t.length)>=Sd?null:[...t,e]}function eq(t){const e=z.c(29),{open:s,onOpenChange:n}=t,[i,r]=P.useState(""),l=re();let a;e[0]!==l?(a=l("home.addTileDrawer.title"),e[0]=l,e[1]=a):a=e[1];let c;e[2]!==a?(c=o.jsx(P6,{children:a}),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==l?(d=l("home.addTileDrawer.description"),e[4]=l,e[5]=d):d=e[5];let h;e[6]!==d?(h=o.jsx(hT,{children:d}),e[6]=d,e[7]=h):h=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(l0,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=v=>r(v.target.value),e[9]=f):f=e[9];let p;e[10]!==l?(p=l("home.addTileDrawer.searchPlaceholder"),e[10]=l,e[11]=p):p=e[11];let m;e[12]!==i||e[13]!==p?(m=o.jsxs("div",{className:"relative mt-3",children:[u,o.jsx(gt,{value:i,onChange:f,placeholder:p,className:"pl-8 h-8 text-sm"})]}),e[12]=i,e[13]=p,e[14]=m):m=e[14];let g;e[15]!==c||e[16]!==h||e[17]!==m?(g=o.jsxs(E6,{className:"px-5 py-4 border-b border-border",children:[c,h,m]}),e[15]=c,e[16]=h,e[17]=m,e[18]=g):g=e[18];let x;e[19]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Lq,{}),e[19]=x):x=e[19];let b;e[20]!==i?(b=o.jsx(yl,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"p-3 flex flex-col gap-4",children:o.jsx(P.Suspense,{fallback:x,children:o.jsx(sq,{search:i})})})}),e[20]=i,e[21]=b):b=e[21];let y;e[22]!==b||e[23]!==g?(y=o.jsxs(R6,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[g,b]}),e[22]=b,e[23]=g,e[24]=y):y=e[24];let _;return e[25]!==n||e[26]!==s||e[27]!==y?(_=o.jsx(D6,{open:s,onOpenChange:n,children:y}),e[25]=n,e[26]=s,e[27]=y,e[28]=_):_=e[28],_}function tq(t){const e=z.c(31),{org:s}=Be(),n=D8();let i;e[0]!==n?.ids?(i=n?.ids??[],e[0]=n?.ids,e[1]=i):i=e[1];const r=i,l=I8(),a=u9(),c=cs();let d;e[2]!==s||e[3]!==c?(d=()=>c.refetchQueries({queryKey:Ge.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=c,e[4]=d):d=e[4];const h=d;let u;e[5]!==r?(u=j=>r.includes(j),e[5]=r,e[6]=u):u=e[6];const f=u;let p;e[7]!==r||e[8]!==t?(p=t?r.filter(j=>t.has(j)).length:r.length,e[7]=r,e[8]=t,e[9]=p):p=e[9];const m=p,g=m>=Sd;let x;e[10]!==t||e[11]!==l?(x=j=>l.apply(C=>J5(C,j,t)),e[10]=t,e[11]=l,e[12]=x):x=e[12];const b=x;let y;e[13]!==l?(y=j=>l.apply(C=>C.filter(N=>N!==j)),e[13]=l,e[14]=y):y=e[14];const _=y;let v;e[15]!==l?(v=j=>l.apply(()=>j),e[15]=l,e[16]=v):v=e[16];const L=v;let S;e[17]!==a||e[18]!==h||e[19]!==t||e[20]!==l?(S=async(j,C)=>{await a.update.mutateAsync({id:j.id,data:{metadata:C}}),await l.apply(N=>J5(N,j.id,t)),await h()},e[17]=a,e[18]=h,e[19]=t,e[20]=l,e[21]=S):S=e[21];const w=S;let k;return e[22]!==b||e[23]!==g||e[24]!==r||e[25]!==f||e[26]!==m||e[27]!==_||e[28]!==L||e[29]!==w?(k={homeIds:r,liveCount:m,isOnHome:f,atLimit:g,addAgent:b,removeAgent:_,reorder:L,saveAgentMetadata:w},e[22]=b,e[23]=g,e[24]=r,e[25]=f,e[26]=m,e[27]=_,e[28]=L,e[29]=w,e[30]=k):k=e[30],k}function sq(t){const e=z.c(24),{search:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={pageSize:1e3},e[0]=n):n=e[0];const i=fa(n);let r;e[1]!==i?(r=new Set(i.map(lq)),e[1]=i,e[2]=r):r=e[2];const l=tq(r);let a,c,d;if(e[3]!==i||e[4]!==l||e[5]!==s){const x=new Map(i.map(oq));a=s.trim().toLowerCase();const b=v=>!a||v.title?.toLowerCase().includes(a);c=l.homeIds.map(v=>x.get(v)).filter(rq).filter(b);const y=kg(i);let _;e[9]!==l?(_=v=>!l.isOnHome(v.id),e[9]=l,e[10]=_):_=e[10],d=i.filter(iq).filter(v=>!y.has(v.id)).filter(_).filter(b).sort(nq),e[3]=i,e[4]=l,e[5]=s,e[6]=a,e[7]=c,e[8]=d}else a=e[6],c=e[7],d=e[8];const h=d;let u;e[11]!==l||e[12]!==c?(u=o.jsx(aq,{home:l,agents:c}),e[11]=l,e[12]=c,e[13]=u):u=e[13];let f;e[14]!==a?(f=!a&&o.jsx(GW,{}),e[14]=a,e[15]=f):f=e[15];const p=!!a;let m;e[16]!==h||e[17]!==l||e[18]!==p?(m=o.jsx(dq,{home:l,agents:h,hasSearch:p}),e[16]=h,e[17]=l,e[18]=p,e[19]=m):m=e[19];let g;return e[20]!==u||e[21]!==f||e[22]!==m?(g=o.jsxs(o.Fragment,{children:[u,f,m]}),e[20]=u,e[21]=f,e[22]=m,e[23]=g):g=e[23],g}function nq(t,e){return(t.title??"").localeCompare(e.title??"")}function iq(t){return t.id&&!tf(t.id)}function rq(t){return!!t}function oq(t){return[t.id,t]}function lq(t){return t.id}function aq(t){const e=z.c(19),{home:s,agents:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={activationConstraint:{distance:5}},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={coordinateGetter:t1},e[1]=r):r=e[1];const l=T0(vr(wa,i),vr(La,r)),a=re();let c;e[2]!==s||e[3]!==a?(c=g=>{const{active:x,over:b}=g;if(!b||x.id===b.id)return;const y=s.homeIds,_=y.indexOf(x.id),v=y.indexOf(b.id);_===-1||v===-1||s.reorder(ea([...y],_,v)).catch(()=>ve.error(a("home.addTileDrawer.reorderError")))},e[2]=s,e[3]=a,e[4]=c):c=e[4];const d=c;let h;e[5]!==a?(h=a("home.addTileDrawer.onHomeTitle"),e[5]=a,e[6]=h):h=e[6];const u=`${s.liveCount}/${Sd}`;let f;e[7]!==h||e[8]!==u?(f=o.jsx(B3,{title:h,hint:u}),e[7]=h,e[8]=u,e[9]=f):f=e[9];let p;e[10]!==n||e[11]!==d||e[12]!==s||e[13]!==l||e[14]!==a?(p=n.length===0?o.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:a("home.addTileDrawer.noAgentsOnHome")}):o.jsx(A0,{sensors:l,collisionDetection:A3,onDragEnd:d,children:o.jsx(Z9,{items:n.map(cq),strategy:X9,children:o.jsx("div",{className:"flex flex-col gap-1",children:n.map(g=>o.jsx(fq,{agent:g,home:s},g.id))})})}),e[10]=n,e[11]=d,e[12]=s,e[13]=l,e[14]=a,e[15]=p):p=e[15];let m;return e[16]!==f||e[17]!==p?(m=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[f,p]}),e[16]=f,e[17]=p,e[18]=m):m=e[18],m}function cq(t){return t.id}function dq(t){const e=z.c(7),{home:s,agents:n,hasSearch:i}=t,[r,l]=P.useState(20),a=n.slice(0,r),c=re(),d="flex flex-col gap-1.5";let h;e[0]!==c?(h=c("home.addTileDrawer.addToHomeTitle"),e[0]=c,e[1]=h):h=e[1];let u;e[2]!==h?(u=o.jsx(B3,{title:h}),e[2]=h,e[3]=u):u=e[3];const f=n.length===0?o.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:c(i?"home.addTileDrawer.noAgentsMatch":"home.addTileDrawer.allAgentsOnHome")}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex flex-col gap-1",children:a.map(m=>o.jsx(pq,{agent:m,home:s},m.id))}),n.length>r&&o.jsx("button",{type:"button",onClick:()=>l(uq),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:c("home.addTileDrawer.loadMore",{count:n.length-r})})]});let p;return e[4]!==u||e[5]!==f?(p=o.jsxs("div",{className:d,children:[u,f]}),e[4]=u,e[5]=f,e[6]=p):p=e[6],p}function uq(t){return t+20}function Tw(t){const e=z.c(14),s=re();let n;e[0]!==t.metadata?.ui?(n=ed(t.metadata?.ui).filter(hq),e[0]=t.metadata?.ui,e[1]=n):n=e[1];const i=n.length,r=t.metadata?.ui?.homePrompts,l=Array.isArray(r)?r.length:null;let a;if(e[2]!==l||e[3]!==s||e[4]!==i){if(a=[],i>0){let c;e[6]!==s||e[7]!==i?(c=s("home.addTileDrawer.tileCountLabel",{count:i}),e[6]=s,e[7]=i,e[8]=c):c=e[8],a.push(c)}if(l!==null&&l>0){let c;e[9]!==l||e[10]!==s?(c=s("home.addTileDrawer.promptCountLabel",{count:l}),e[9]=l,e[10]=s,e[11]=c):c=e[11],a.push(c)}if(l===0){let c;e[12]!==s?(c=s("home.addTileDrawer.promptsOffLabel"),e[12]=s,e[13]=c):c=e[13],a.push(c)}e[2]=l,e[3]=s,e[4]=i,e[5]=a}else a=e[5];return a.join(" · ")}function hq(t){return!!t.resourceUri}function fq(t){const e=z.c(70),{agent:s,home:n}=t,[i,r]=P.useState(!1),l=re();let a;e[0]!==s.id?(a={id:s.id},e[0]=s.id,e[1]=a):a=e[1];const{attributes:c,listeners:d,setNodeRef:h,transform:u,transition:f,isDragging:p}=e1(a),m=Tw(s)||l("home.addTileDrawer.quickAccess"),g=`home-agent-expansion-${s.id}`;let x;e[2]!==u?(x=Ri.Transform.toString(u),e[2]=u,e[3]=x):x=e[3];const b=p?.5:void 0,y=p?100:void 0;let _;e[4]!==x||e[5]!==b||e[6]!==y||e[7]!==f?(_={transform:x,transition:f,opacity:b,zIndex:y},e[4]=x,e[5]=b,e[6]=y,e[7]=f,e[8]=_):_=e[8];const v=_,L=p&&"shadow-lg";let S;e[9]!==L?(S=ie("rounded-lg border border-border bg-card",L),e[9]=L,e[10]=S):S=e[10];const w=s.title??s.id;let k;e[11]!==l||e[12]!==w?(k=l("home.addTileDrawer.dragToReorder",{name:w}),e[11]=l,e[12]=w,e[13]=k):k=e[13];let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(fd,{size:14}),e[14]=j):j=e[14];let C;e[15]!==c||e[16]!==d||e[17]!==k?(C=o.jsx("button",{type:"button",...c,...d,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":k,children:j}),e[15]=c,e[16]=d,e[17]=k,e[18]=C):C=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=()=>r(mq),e[19]=N):N=e[19];const T=s.title??s.id;let V;e[20]!==s.icon||e[21]!==T?(V=o.jsx(mi,{icon:s.icon,name:T,size:"sm"}),e[20]=s.icon,e[21]=T,e[22]=V):V=e[22];const A=s.title??s.id;let E;e[23]!==A?(E=o.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:A}),e[23]=A,e[24]=E):E=e[24];let R;e[25]!==m?(R=o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:m}),e[25]=m,e[26]=R):R=e[26];let D;e[27]!==E||e[28]!==R?(D=o.jsxs("div",{className:"min-w-0 flex-1",children:[E,R]}),e[27]=E,e[28]=R,e[29]=D):D=e[29];const I=i&&"rotate-180";let O;e[30]!==I?(O=ie("shrink-0 text-muted-foreground transition-transform",I),e[30]=I,e[31]=O):O=e[31];let F;e[32]!==O?(F=o.jsx(Gt,{size:16,className:O}),e[32]=O,e[33]=F):F=e[33];let M;e[34]!==i||e[35]!==g||e[36]!==V||e[37]!==D||e[38]!==F?(M=o.jsxs("button",{type:"button",onClick:N,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,"aria-controls":g,children:[V,D,F]}),e[34]=i,e[35]=g,e[36]=V,e[37]=D,e[38]=F,e[39]=M):M=e[39];let $;e[40]!==s.id||e[41]!==n||e[42]!==l?($=()=>n.removeAgent(s.id).catch(()=>ve.error(l("home.addTileDrawer.removeError"))),e[40]=s.id,e[41]=n,e[42]=l,e[43]=$):$=e[43];const B=s.title??s.id;let U;e[44]!==l||e[45]!==B?(U=l("home.addTileDrawer.removeAgentFromHome",{name:B}),e[44]=l,e[45]=B,e[46]=U):U=e[46];const H=s.title??s.id;let W;e[47]!==l||e[48]!==H?(W=l("home.addTileDrawer.removeAgentFromHome",{name:H}),e[47]=l,e[48]=H,e[49]=W):W=e[49];let K;e[50]===Symbol.for("react.memo_cache_sentinel")?(K=o.jsx(Is,{size:14}),e[50]=K):K=e[50];let G;e[51]!==$||e[52]!==U||e[53]!==W?(G=o.jsx("button",{type:"button",onClick:$,"aria-label":U,title:W,className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:K}),e[51]=$,e[52]=U,e[53]=W,e[54]=G):G=e[54];let Y;e[55]!==C||e[56]!==M||e[57]!==G?(Y=o.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[C,M,G]}),e[55]=C,e[56]=M,e[57]=G,e[58]=Y):Y=e[58];let X;e[59]!==s||e[60]!==i||e[61]!==g||e[62]!==n?(X=i&&o.jsx(Vw,{id:g,agent:s,home:n}),e[59]=s,e[60]=i,e[61]=g,e[62]=n,e[63]=X):X=e[63];let te;return e[64]!==h||e[65]!==v||e[66]!==Y||e[67]!==X||e[68]!==S?(te=o.jsxs("div",{ref:h,style:v,className:S,children:[Y,X]}),e[64]=h,e[65]=v,e[66]=Y,e[67]=X,e[68]=S,e[69]=te):te=e[69],te}function mq(t){return!t}function pq({agent:t,home:e}){const[s,n]=P.useState(!1),[i,r]=P.useState(!1),l=Tw(t),a=re(),c=`available-agent-expansion-${t.id}`,d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{ve.error(a("home.addTileDrawer.addError"))}finally{r(!1)}}};return o.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[o.jsxs("button",{type:"button",onClick:()=>n(h=>!h),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,"aria-controls":c,children:[o.jsx(mi,{icon:t.icon,name:t.title??t.id,size:"sm"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),l&&o.jsx("div",{className:"truncate text-xs text-muted-foreground",children:l})]}),o.jsx(Gt,{size:16,className:ie("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),o.jsx("button",{type:"button",onClick:d,disabled:i||e.atLimit,"aria-label":a("home.addTileDrawer.addToHomeTitle"),title:e.atLimit?a("home.addTileDrawer.homeFullMessage",{limit:Sd}):a("home.addTileDrawer.addToHomeTitle"),className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:i?o.jsx(ct,{size:12,className:"animate-spin"}):o.jsx(Ut,{size:14})})]}),s&&o.jsx(Vw,{id:c,agent:t,home:e})]})}function Vw(t){const e=z.c(18),{id:s,agent:n,home:i}=t,r=n.metadata?.ui;let l;e[0]!==r?(l=ed(r),e[0]=r,e[1]=l):l=e[1];const a=l;let c;e[2]!==n.connections?(c=(n.connections??[]).map(gq).sort(),e[2]=n.connections,e[3]=c):c=e[3];const d=c,h=n.metadata?.ui?.homePrompts;let u;e[4]!==n||e[5]!==d||e[6]!==i||e[7]!==a?(u=o.jsx(bq,{agent:n,home:i,connectionIds:d,pinnedTiles:a}),e[4]=n,e[5]=d,e[6]=i,e[7]=a,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(xq,{}),e[9]=f):f=e[9];const p=h??null;let m;e[10]!==n||e[11]!==i||e[12]!==p?(m=o.jsx(P.Suspense,{fallback:f,children:o.jsx(zW,{agent:n,home:i,curated:p})}),e[10]=n,e[11]=i,e[12]=p,e[13]=m):m=e[13];let g;return e[14]!==s||e[15]!==u||e[16]!==m?(g=o.jsxs("div",{id:s,className:"border-t border-border px-3 py-2 flex flex-col gap-3",children:[u,m]}),e[14]=s,e[15]=u,e[16]=m,e[17]=g):g=e[17],g}function gq(t){return t.connection_id}function xq(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[o.jsx(Pt,{className:"h-8 w-full"}),o.jsx(Pt,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function bq({agent:t,home:e,connectionIds:s,pinnedTiles:n}){const i=re(),r=gs(),{data:l,isLoading:a}=Tt({queryKey:Ge.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async f=>{try{const{item:p}=await r.call("COLLECTION_CONNECTIONS_GET",{id:f}),m=(p?.tools??[]).flatMap(g=>{const x=j9(g._meta);return x?[{name:g.name,description:g.description,resourceUri:x,inputSchema:g.inputSchema}]:[]});return{id:f,title:p?.title??f,icon:p?.icon??null,uiTools:m}}catch{return{id:f,title:f,icon:null,uiTools:[]}}}))).filter(f=>f.uiTools.length>0)});if(s.length===0)return null;if(a)return o.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[o.jsx(Pt,{className:"h-7 w-full"}),o.jsx(Pt,{className:"h-7 w-2/3"})]});if(!l||l.length===0)return null;const c=new Map;for(const u of l)for(const f of u.uiTools)c.set(`${u.id}:${f.name}`,{conn:u,tool:f});const d=u=>{if(u.toolName&&u.connectionId)return c.get(`${u.connectionId}:${u.toolName}`);for(const[,f]of c)if(f.conn.id===u.connectionId&&f.tool.resourceUri===u.resourceUri)return f},h=n.some(u=>!!d(u));return o.jsxs("div",{className:"flex flex-col gap-2",children:[h&&o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:i("home.addTileDrawer.pinnedTiles")}),n.map(u=>{const f=d(u);return f?o.jsx(vq,{agent:t,home:e,connection:f.conn,tool:f.tool,tile:u},u.tileId??`${u.connectionId}:${u.resourceUri}:${u.toolName}`):null})]}),o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:i("home.addTileDrawer.addTileLabel")}),l.map(u=>u.uiTools.map(f=>o.jsx(_q,{agent:t,home:e,connection:u,tool:f},`add:${u.id}:${f.name}`)))]})]})}function jp(t,e){return{instructions:t.metadata.instructions,ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:e}}}async function Cp(t,e,s){try{await e()}catch(n){console.error(`[home-tiles] failed to ${t} tile`,n),ve.error(s("home.addTileDrawer.updateError"))}}function Aw(t,e,s,n){if(!e||Object.keys(e).length===0)return{};const i=YW(t,e,s);if(!i){ve.error(n("home.addTileDrawer.invalidFieldError"));return}return Object.keys(i).length>0?{toolInput:i}:{}}function Pw(t){const e=z.c(23),{properties:s,required:n,values:i,onChange:r,onCancel:l,onSubmit:a,submitting:c,submitLabel:d}=t,h=re();let u;e[0]!==r||e[1]!==s||e[2]!==n||e[3]!==i?(u=o.jsx(XW,{properties:s,required:n,values:i,onChange:r}),e[0]=r,e[1]=s,e[2]=n,e[3]=i,e[4]=u):u=e[4];let f;e[5]!==h?(f=h("home.addTileDrawer.cancel"),e[5]=h,e[6]=f):f=e[6];let p;e[7]!==l||e[8]!==f?(p=o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:l,children:f}),e[7]=l,e[8]=f,e[9]=p):p=e[9];let m;e[10]!==d||e[11]!==c?(m=c?o.jsx(ct,{size:12,className:"animate-spin"}):d,e[10]=d,e[11]=c,e[12]=m):m=e[12];let g;e[13]!==a||e[14]!==c||e[15]!==m?(g=o.jsx(me,{size:"sm",className:"h-7 text-xs",disabled:c,onClick:a,children:m}),e[13]=a,e[14]=c,e[15]=m,e[16]=g):g=e[16];let x;e[17]!==p||e[18]!==g?(x=o.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[p,g]}),e[17]=p,e[18]=g,e[19]=x):x=e[19];let b;return e[20]!==u||e[21]!==x?(b=o.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[u,x]}),e[20]=u,e[21]=x,e[22]=b):b=e[22],b}function vq(t){const e=z.c(57),{agent:s,home:n,connection:i,tool:r,tile:l}=t,[a,c]=P.useState(!1),[d,h]=P.useState(!1),u=re();let f;e[0]!==r.inputSchema?(f=r.inputSchema?.properties&&Object.keys(r.inputSchema.properties).length>0,e[0]=r.inputSchema,e[1]=f):f=e[1];const p=f;let m;e[2]!==l.toolInput||e[3]!==r.inputSchema?.properties?(m=()=>JW(l.toolInput,r.inputSchema?.properties),e[2]=l.toolInput,e[3]=r.inputSchema?.properties,e[4]=m):m=e[4];const[g,x]=P.useState(m);let b;e[5]!==s||e[6]!==n||e[7]!==u||e[8]!==l?(b=async()=>{c(!0),await Cp("remove",async()=>{const I=ed(s.metadata?.ui),O=l.tileId?I.filter(F=>F.tileId!==l.tileId):I.filter(F=>F!==l);await n.saveAgentMetadata(s,jp(s,O)),h(!1)},u),c(!1)},e[5]=s,e[6]=n,e[7]=u,e[8]=l,e[9]=b):b=e[9];const y=b;let _;e[10]!==s||e[11]!==g||e[12]!==n||e[13]!==u||e[14]!==l||e[15]!==r.inputSchema?.properties||e[16]!==r.inputSchema?.required?(_=async()=>{const I=Aw(g,r.inputSchema?.properties,r.inputSchema?.required,u);if(!I)return;const{toolInput:O}=I;c(!0),await Cp("save",async()=>{const M=ed(s.metadata?.ui).map($=>(l.tileId?$.tileId===l.tileId:$===l)?{...$,toolInput:O}:$);await n.saveAgentMetadata(s,jp(s,M)),h(!1)},u),c(!1)},e[10]=s,e[11]=g,e[12]=n,e[13]=u,e[14]=l,e[15]=r.inputSchema?.properties,e[16]=r.inputSchema?.required,e[17]=_):_=e[17];const v=_;let L;e[18]!==l.toolInput?(L=QW(l.toolInput),e[18]=l.toolInput,e[19]=L):L=e[19];const S=L;let w;e[20]!==i.icon||e[21]!==i.title?(w=o.jsx(Oi,{icon:i.icon,name:i.title,size:"xs"}),e[20]=i.icon,e[21]=i.title,e[22]=w):w=e[22];let k;e[23]!==r.name?(k=Wl(r.name),e[23]=r.name,e[24]=k):k=e[24];let j;e[25]!==k?(j=o.jsx("div",{className:"truncate text-sm text-foreground",children:k}),e[25]=k,e[26]=j):j=e[26];let C;e[27]!==S?(C=S&&o.jsx("div",{className:"truncate text-[10px] text-muted-foreground font-mono",children:S}),e[27]=S,e[28]=C):C=e[28];let N;e[29]!==j||e[30]!==C?(N=o.jsxs("div",{className:"min-w-0 flex-1",children:[j,C]}),e[29]=j,e[30]=C,e[31]=N):N=e[31];let T;e[32]!==p||e[33]!==u?(T=p&&o.jsx("button",{type:"button",onClick:()=>h(yq),"aria-label":u("home.addTileDrawer.configureTile"),title:u("home.addTileDrawer.configureTile"),className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60",children:o.jsx(vg,{size:14})}),e[32]=p,e[33]=u,e[34]=T):T=e[34];let V;e[35]!==u?(V=u("home.addTileDrawer.removeFromHome"),e[35]=u,e[36]=V):V=e[36];let A;e[37]!==y||e[38]!==a||e[39]!==V?(A=o.jsx($3,{isPinned:!0,submitting:a,onClick:y,label:V}),e[37]=y,e[38]=a,e[39]=V,e[40]=A):A=e[40];let E;e[41]!==N||e[42]!==T||e[43]!==A||e[44]!==w?(E=o.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[w,N,T,A]}),e[41]=N,e[42]=T,e[43]=A,e[44]=w,e[45]=E):E=e[45];let R;e[46]!==g||e[47]!==v||e[48]!==p||e[49]!==d||e[50]!==a||e[51]!==u||e[52]!==r.inputSchema?(R=d&&p&&r.inputSchema?.properties&&o.jsx(Pw,{properties:r.inputSchema.properties,required:r.inputSchema.required,values:g,onChange:(I,O)=>x(F=>({...F,[I]:O})),onCancel:()=>h(!1),onSubmit:v,submitting:a,submitLabel:u("home.addTileDrawer.save")}),e[46]=g,e[47]=v,e[48]=p,e[49]=d,e[50]=a,e[51]=u,e[52]=r.inputSchema,e[53]=R):R=e[53];let D;return e[54]!==E||e[55]!==R?(D=o.jsxs("div",{className:"flex flex-col rounded-md bg-accent/20",children:[E,R]}),e[54]=E,e[55]=R,e[56]=D):D=e[56],D}function yq(t){return!t}function _q(t){const e=z.c(44),{agent:s,home:n,connection:i,tool:r}=t,[l,a]=P.useState(!1),[c,d]=P.useState(!1),h=re();let u;e[0]!==r.inputSchema?(u=r.inputSchema?.properties&&Object.keys(r.inputSchema.properties).length>0,e[0]=r.inputSchema,e[1]=u):u=e[1];const f=u;let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p={},e[2]=p):p=e[2];const[m,g]=P.useState(p);let x,b;e[3]!==s||e[4]!==i.id||e[5]!==m||e[6]!==f||e[7]!==n||e[8]!==c||e[9]!==h||e[10]!==r.inputSchema?.properties||e[11]!==r.inputSchema?.required||e[12]!==r.name||e[13]!==r.resourceUri?(x=async()=>{if(f&&!c){d(!0);return}if(!n.isOnHome(s.id)&&n.atLimit){ve.error(h("home.addTileDrawer.homeFullMessage",{limit:Sd}));return}await b()},b=async()=>{const C=Aw(m,r.inputSchema?.properties,r.inputSchema?.required,h);if(!C)return;const{toolInput:N}=C;a(!0),await Cp("add",async()=>{const V=[...ed(s.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:i.id,resourceUri:r.resourceUri,toolName:r.name,...N?{toolInput:N}:{}}];await n.saveAgentMetadata(s,jp(s,V)),d(!1),g({})},h),a(!1)},e[3]=s,e[4]=i.id,e[5]=m,e[6]=f,e[7]=n,e[8]=c,e[9]=h,e[10]=r.inputSchema?.properties,e[11]=r.inputSchema?.required,e[12]=r.name,e[13]=r.resourceUri,e[14]=x,e[15]=b):(x=e[14],b=e[15]);let y;e[16]!==i.icon||e[17]!==i.title?(y=o.jsx(Oi,{icon:i.icon,name:i.title,size:"xs"}),e[16]=i.icon,e[17]=i.title,e[18]=y):y=e[18];let _;e[19]!==r.name?(_=Wl(r.name),e[19]=r.name,e[20]=_):_=e[20];let v;e[21]!==_?(v=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:_}),e[21]=_,e[22]=v):v=e[22];let L;e[23]!==h?(L=h("home.addTileDrawer.addToHomeTitle"),e[23]=h,e[24]=L):L=e[24];let S;e[25]!==x||e[26]!==l||e[27]!==L?(S=o.jsx($3,{isPinned:!1,submitting:l,onClick:x,label:L}),e[25]=x,e[26]=l,e[27]=L,e[28]=S):S=e[28];let w;e[29]!==y||e[30]!==v||e[31]!==S?(w=o.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[y,v,S]}),e[29]=y,e[30]=v,e[31]=S,e[32]=w):w=e[32];let k;e[33]!==m||e[34]!==f||e[35]!==b||e[36]!==c||e[37]!==l||e[38]!==h||e[39]!==r.inputSchema?(k=c&&f&&r.inputSchema?.properties&&o.jsx(Pw,{properties:r.inputSchema.properties,required:r.inputSchema.required,values:m,onChange:(C,N)=>g(T=>({...T,[C]:N})),onCancel:()=>{d(!1),g({})},onSubmit:b,submitting:l,submitLabel:h("home.addTileDrawer.pin")}),e[33]=m,e[34]=f,e[35]=b,e[36]=c,e[37]=l,e[38]=h,e[39]=r.inputSchema,e[40]=k):k=e[40];let j;return e[41]!==w||e[42]!==k?(j=o.jsxs("div",{className:"flex flex-col rounded-md hover:bg-accent/40",children:[w,k]}),e[41]=w,e[42]=k,e[43]=j):j=e[43],j}function Lq(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},wq)}),t[0]=e):e=t[0],e}function wq(t,e){return o.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[o.jsx(Pt,{className:"size-8 rounded-md"}),o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx(Pt,{className:"h-3 w-1/2"}),o.jsx(Pt,{className:"h-2.5 w-1/3"})]})]},e)}const Q5={active:0,future:1,closed:2};function X5(t){if(!t.startsAt)return null;const e=Date.parse(t.startsAt);return Number.isNaN(e)?null:e}function Sq(t,e){const s=Q5[t.state]-Q5[e.state];if(s!==0)return s;const n=X5(t),i=X5(e);if(n===null||i===null){if(n!==i)return n===null?1:-1}else if(n!==i)return t.state==="closed"?i-n:n-i;return t.name.localeCompare(e.name)||t.id.localeCompare(e.id)}function z3(t){return t.filter(s=>s.state==="active").sort(Sq)[0]?.id??null}const Np="__unassigned__",Tp="__no_repo__",wf="backlog",Ew="all",Xr="__any__",F3={assignee:null,priority:null,due:null,tags:[],repo:null,sprint:null,search:""};function kq(t,e){return t===Ew?null:t===wf||t!==null&&e.some(s=>s.id===t)?t:z3(e)}function Rw(t,e){return t.sprint!==null&&t.sprint!==e}function jq(t,e){return t.assignee!==null||t.priority!==null||t.due!==null||t.tags.length>0||t.repo!==null||Rw(t,e)||t.search.trim()!==""}function Cq(t,e){return(t.assignee!==null?1:0)+(t.priority!==null?1:0)+(t.due!==null?1:0)+(t.tags.length>0?1:0)+(t.repo!==null?1:0)+(Rw(t,e)?1:0)+(t.search.trim()!==""?1:0)}const Nq=864e5;function Tq(t,e){const s=new Date(t),n=new Date(e);return s.getFullYear()===n.getFullYear()&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate()}const Vq=/^0*(\d+)$/;function Dw(t,e,s){const n=t.trim();if(n==="")return!1;const i=s?.trim();if(i){if(n.toLowerCase()===i.toLowerCase())return!0;const r=Vq.exec(n)?.[1];return r!==void 0&&Number(r)===g4(i)}return e!=null&&g4(n)===e}function Aq(t,e){return t.assigneeId===e?!0:t.assigneeId===as&&t.assignedBy===e}function Pq(t,e){const s=e.search.trim().toLowerCase();if(s!==""&&!`${t.title} ${t.description??""}`.toLowerCase().includes(s)&&!Dw(s,t.keySeq,t.jiraIssueKey))return!1;if(e.assignee!==null){if(e.assignee===Np){if(t.assigneeId!==null)return!1}else if(!Aq(t,e.assignee))return!1}if(e.priority!==null&&t.priority!==e.priority)return!1;if(e.due!==null)if(e.due==="none"){if(t.dueDate)return!1}else{if(!t.dueDate)return!1;const n=new Date(t.dueDate).getTime(),i=Date.now();if(e.due==="overdue"&&n>=i||e.due==="today"&&!Tq(n,i)||e.due==="week"&&(n<i||n>i+7*Nq))return!1}if(e.tags.length>0){const n=t.tags.map(i=>i.id);if(!e.tags.some(i=>n.includes(i)))return!1}if(e.repo!==null){if(e.repo===Tp){if(t.repo!=null)return!1}else if(t.repo?.toLowerCase()!==e.repo.toLowerCase())return!1}if(e.sprint!==null){if(e.sprint===wf){if(t.sprintId!=null)return!1}else if(t.sprintId!==e.sprint)return!1}return!0}const Z5={overdue:"taskBoard.taskFilters.dueDateFilterOverdue",today:"taskBoard.taskFilters.dueDateFilterDueToday",week:"taskBoard.taskFilters.dueDateFilterDueThisWeek",none:"taskBoard.taskFilters.dueDateFilterNoDueDate"};function wl(t,e=!1){return ie("inline-flex h-8 items-center gap-1.5 rounded-lg border px-2.5 text-xs font-medium outline-none transition-colors focus-visible:border-ring focus-visible:ring-[2px] focus-visible:ring-ring/20",e&&"h-10 w-full justify-start px-3 text-sm",t?"border-transparent bg-accent text-foreground":"border-border text-muted-foreground hover:bg-muted/60 hover:text-foreground")}function Eq(t){const e=z.c(107),{value:s,members:n,onChange:i,block:r}=t,l=re(),[a,c]=P.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(of,{size:14,className:"shrink-0"}),e[0]=d):d=e[0];let h=d,u;e[1]!==l?(u=l("taskBoard.taskFilters.assigneeLabel"),e[1]=l,e[2]=u):u=e[2];let f=u;if(s===Np){let Q;e[3]!==l?(Q=l("taskBoard.taskFilters.assigneeUnassigned"),e[3]=l,e[4]=Q):Q=e[4],f=Q}else if(s===as){let Q;e[5]===Symbol.for("react.memo_cache_sentinel")?(Q=o.jsx(ui,{size:14}),e[5]=Q):Q=e[5],h=Q;let q;e[6]!==l?(q=l("taskBoard.taskFilters.assigneeSuperAgent"),e[6]=l,e[7]=q):q=e[7],f=q}else if(s){let Q,q,le,J;if(e[8]!==n||e[9]!==s){let he;e[14]!==s?(he=ae=>ae.userId===s,e[14]=s,e[15]=he):he=e[15],q=n.find(he),Q=Ps,le=q?.user?.image??void 0,J=bn(q?.user?.name),e[8]=n,e[9]=s,e[10]=Q,e[11]=q,e[12]=le,e[13]=J}else Q=e[10],q=e[11],le=e[12],J=e[13];let oe;e[16]!==Q||e[17]!==le||e[18]!==J?(oe=o.jsx(Q,{url:le,fallback:J,shape:"circle",size:"2xs"}),e[16]=Q,e[17]=le,e[18]=J,e[19]=oe):oe=e[19],h=oe;let ee;e[20]!==q?.user?.name||e[21]!==l?(ee=q?.user?.name??l("taskBoard.taskFilters.assigneeMember"),e[20]=q?.user?.name,e[21]=l,e[22]=ee):ee=e[22],f=ee}let p;e[23]!==i?(p=Q=>{i(Q),c(!1)},e[23]=i,e[24]=p):p=e[24];const m=p,g=s!==null;let x;e[25]!==r||e[26]!==g?(x=wl(g,r),e[25]=r,e[26]=g,e[27]=x):x=e[27];const b=x,y=r&&"ml-auto";let _;e[28]!==y?(_=ie("shrink-0 opacity-60",y),e[28]=y,e[29]=_):_=e[29];const v=_;let L;e[30]!==f?(L=o.jsx("span",{className:"max-w-[10rem] truncate",children:f}),e[30]=f,e[31]=L):L=e[31];let S;e[32]!==v?(S=o.jsx(Gt,{size:12,className:v}),e[32]=v,e[33]=S):S=e[33];let w;e[34]!==h||e[35]!==L||e[36]!==S||e[37]!==b?(w=o.jsx(ts,{asChild:!0,children:o.jsxs("button",{type:"button",className:b,children:[h,L,S]})}),e[34]=h,e[35]=L,e[36]=S,e[37]=b,e[38]=w):w=e[38];let k;e[39]!==l?(k=l("taskBoard.taskFilters.assigneeFilterPlaceholder"),e[39]=l,e[40]=k):k=e[40];let j;e[41]!==l?(j=l("taskBoard.taskFilters.assigneeFilterPlaceholder"),e[41]=l,e[42]=j):j=e[42];let C;e[43]!==k||e[44]!==j?(C=o.jsx(An,{placeholder:k,"aria-label":j,className:"h-9"}),e[43]=k,e[44]=j,e[45]=C):C=e[45];let N;e[46]!==l?(N=l("taskBoard.taskFilters.assigneeNoMembersFound"),e[46]=l,e[47]=N):N=e[47];let T;e[48]!==N?(T=o.jsx(hn,{children:N}),e[48]=N,e[49]=T):T=e[49];let V;e[50]!==l?(V=l("taskBoard.taskFilters.assigneeAnyone"),e[50]=l,e[51]=V):V=e[51];let A;e[52]!==m?(A=()=>m(null),e[52]=m,e[53]=A):A=e[53];let E;e[54]!==l?(E=l("taskBoard.taskFilters.assigneeAnyone"),e[54]=l,e[55]=E):E=e[55];let R;e[56]!==V||e[57]!==A||e[58]!==E?(R=o.jsx(Ft,{value:V,onSelect:A,children:E}),e[56]=V,e[57]=A,e[58]=E,e[59]=R):R=e[59];let D;e[60]!==l?(D=l("taskBoard.taskFilters.assigneeUnassigned"),e[60]=l,e[61]=D):D=e[61];let I;e[62]!==m?(I=()=>m(Np),e[62]=m,e[63]=I):I=e[63];let O;e[64]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(of,{size:16,className:"text-muted-foreground"}),e[64]=O):O=e[64];let F;e[65]!==l?(F=l("taskBoard.taskFilters.assigneeUnassigned"),e[65]=l,e[66]=F):F=e[66];let M;e[67]!==D||e[68]!==I||e[69]!==F?(M=o.jsxs(Ft,{value:D,onSelect:I,className:"gap-2",children:[O,F]}),e[67]=D,e[68]=I,e[69]=F,e[70]=M):M=e[70];let $;e[71]!==l?($=l("taskBoard.taskFilters.assigneeSuperAgent"),e[71]=l,e[72]=$):$=e[72];let B;e[73]!==m?(B=()=>m(as),e[73]=m,e[74]=B):B=e[74];let U;e[75]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(ui,{size:16}),e[75]=U):U=e[75];let H;e[76]!==l?(H=l("taskBoard.taskFilters.assigneeSuperAgent"),e[76]=l,e[77]=H):H=e[77];let W;e[78]!==$||e[79]!==B||e[80]!==H?(W=o.jsxs(Ft,{value:$,onSelect:B,className:"gap-2",children:[U,H]}),e[78]=$,e[79]=B,e[80]=H,e[81]=W):W=e[81];let K;e[82]!==R||e[83]!==M||e[84]!==W?(K=o.jsxs(os,{children:[R,M,W]}),e[82]=R,e[83]=M,e[84]=W,e[85]=K):K=e[85];let G;e[86]!==l?(G=l("taskBoard.taskFilters.assigneeGroupMembers"),e[86]=l,e[87]=G):G=e[87];let Y;if(e[88]!==n||e[89]!==m){let Q;e[91]!==m?(Q=q=>o.jsxs(Ft,{value:q.user?.name??q.userId,onSelect:()=>m(q.userId),className:"gap-2",children:[o.jsx(Ps,{url:q.user?.image??void 0,fallback:bn(q.user?.name),shape:"circle",size:"2xs"}),o.jsx("span",{className:"truncate",children:q.user?.name??q.userId})]},q.userId),e[91]=m,e[92]=Q):Q=e[92],Y=n.map(Q),e[88]=n,e[89]=m,e[90]=Y}else Y=e[90];let X;e[93]!==G||e[94]!==Y?(X=o.jsx(os,{heading:G,children:Y}),e[93]=G,e[94]=Y,e[95]=X):X=e[95];let te;e[96]!==T||e[97]!==K||e[98]!==X?(te=o.jsxs(Pn,{children:[T,K,X]}),e[96]=T,e[97]=K,e[98]=X,e[99]=te):te=e[99];let se;e[100]!==C||e[101]!==te?(se=o.jsx(ss,{align:"start",className:"w-56 p-0",children:o.jsxs(Fn,{children:[C,te]})}),e[100]=C,e[101]=te,e[102]=se):se=e[102];let ne;return e[103]!==a||e[104]!==w||e[105]!==se?(ne=o.jsxs(ns,{open:a,onOpenChange:c,children:[w,se]}),e[103]=a,e[104]=w,e[105]=se,e[106]=ne):ne=e[106],ne}function Rq(t){const e=z.c(33),{value:s,onChange:n,block:i}=t,r=re(),l=s!==null;let a;e[0]!==i||e[1]!==l?(a=wl(l,i),e[0]=i,e[1]=l,e[2]=a):a=e[2];const c=a,d=i&&"ml-auto";let h;e[3]!==d?(h=ie("shrink-0 opacity-60",d),e[3]=d,e[4]=h):h=e[4];const u=h;let f;e[5]!==s?(f=s?o.jsx("span",{className:ie("size-2 shrink-0 rounded-full",cn[s].dotClassName)}):o.jsx(f0,{size:14,className:"shrink-0"}),e[5]=s,e[6]=f):f=e[6];let p;e[7]!==r||e[8]!==s?(p=r(s?cn[s].labelKey:"taskBoard.taskFilters.priorityLabel"),e[7]=r,e[8]=s,e[9]=p):p=e[9];let m;e[10]!==u?(m=o.jsx(Gt,{size:12,className:u}),e[10]=u,e[11]=m):m=e[11];let g;e[12]!==f||e[13]!==p||e[14]!==m||e[15]!==c?(g=o.jsx(Bt,{asChild:!0,children:o.jsxs("button",{type:"button",className:c,children:[f,p,m]})}),e[12]=f,e[13]=p,e[14]=m,e[15]=c,e[16]=g):g=e[16];const x=s??Xr;let b;e[17]!==n?(b=w=>n(w===Xr?null:w),e[17]=n,e[18]=b):b=e[18];let y;e[19]!==r?(y=r("taskBoard.taskFilters.priorityAnyPriority"),e[19]=r,e[20]=y):y=e[20];let _;e[21]!==y?(_=o.jsx(Yn,{value:Xr,children:y}),e[21]=y,e[22]=_):_=e[22];let v;e[23]!==r?(v=m0.map(w=>o.jsxs(Yn,{value:w,className:"gap-2",children:[o.jsx("span",{className:ie("size-2 rounded-full",cn[w].dotClassName)}),r(cn[w].labelKey)]},w)),e[23]=r,e[24]=v):v=e[24];let L;e[25]!==b||e[26]!==_||e[27]!==v||e[28]!==x?(L=o.jsx(zt,{align:"start",className:"w-40",children:o.jsxs(Xc,{value:x,onValueChange:b,children:[_,v]})}),e[25]=b,e[26]=_,e[27]=v,e[28]=x,e[29]=L):L=e[29];let S;return e[30]!==L||e[31]!==g?(S=o.jsxs($t,{children:[g,L]}),e[30]=L,e[31]=g,e[32]=S):S=e[32],S}function Dq(t){const e=z.c(35),{value:s,onChange:n,block:i}=t,r=re();let l;e[0]!==r||e[1]!==s?(l=s?r(Z5[s]):void 0,e[0]=r,e[1]=s,e[2]=l):l=e[2];const a=l,c=s!==null;let d;e[3]!==i||e[4]!==c?(d=wl(c,i),e[3]=i,e[4]=c,e[5]=d):d=e[5];const h=d,u=i&&"ml-auto";let f;e[6]!==u?(f=ie("shrink-0 opacity-60",u),e[6]=u,e[7]=f):f=e[7];const p=f;let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(hr,{size:14,className:"shrink-0"}),e[8]=m):m=e[8];let g;e[9]!==a||e[10]!==r?(g=a??r("taskBoard.taskFilters.dueDateLabel"),e[9]=a,e[10]=r,e[11]=g):g=e[11];let x;e[12]!==p?(x=o.jsx(Gt,{size:12,className:p}),e[12]=p,e[13]=x):x=e[13];let b;e[14]!==g||e[15]!==x||e[16]!==h?(b=o.jsx(Bt,{asChild:!0,children:o.jsxs("button",{type:"button",className:h,children:[m,g,x]})}),e[14]=g,e[15]=x,e[16]=h,e[17]=b):b=e[17];const y=s??Xr;let _;e[18]!==n?(_=C=>n(C===Xr?null:C),e[18]=n,e[19]=_):_=e[19];let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(hr,{size:16,className:"text-muted-foreground"}),e[20]=v):v=e[20];let L;e[21]!==r?(L=r("taskBoard.taskFilters.dueDateAnyTime"),e[21]=r,e[22]=L):L=e[22];let S;e[23]!==L?(S=o.jsxs(Yn,{value:Xr,className:"gap-2",children:[v,L]}),e[23]=L,e[24]=S):S=e[24];let w;e[25]!==r?(w=Object.entries(Z5).map(C=>{const[N,T]=C,V=N==="overdue";return o.jsxs(Yn,{value:N,className:ie("gap-2",V&&"text-destructive"),children:[o.jsx(hr,{size:16,className:ie("shrink-0",V?"text-destructive":"text-muted-foreground")}),r(T)]},N)}),e[25]=r,e[26]=w):w=e[26];let k;e[27]!==y||e[28]!==_||e[29]!==S||e[30]!==w?(k=o.jsx(zt,{align:"start",className:"w-44",children:o.jsxs(Xc,{value:y,onValueChange:_,children:[S,w]})}),e[27]=y,e[28]=_,e[29]=S,e[30]=w,e[31]=k):k=e[31];let j;return e[32]!==k||e[33]!==b?(j=o.jsxs($t,{children:[b,k]}),e[32]=k,e[33]=b,e[34]=j):j=e[34],j}function Iq(t){const e=z.c(56),{value:s,tags:n,onChange:i,block:r}=t,l=re(),[a,c]=P.useState(!1);let d;e[0]!==i||e[1]!==s?(d=D=>i(s.includes(D)?s.filter(I=>I!==D):[...s,D]),e[0]=i,e[1]=s,e[2]=d):d=e[2];const h=d;let u;e[3]!==l||e[4]!==n||e[5]!==s[0]||e[6]!==s.length?(u=s.length===0?l("taskBoard.taskFilters.tagsLabel"):s.length===1?n.find(D=>D.id===s[0])?.name??l("taskBoard.taskFilters.tagsLabel"):l("taskBoard.taskFilters.tagsSelectedCount",{count:s.length}),e[3]=l,e[4]=n,e[5]=s[0],e[6]=s.length,e[7]=u):u=e[7];const f=u,p=s.length>0;let m;e[8]!==r||e[9]!==p?(m=wl(p,r),e[8]=r,e[9]=p,e[10]=m):m=e[10];const g=m,x=r&&"ml-auto";let b;e[11]!==x?(b=ie("shrink-0 opacity-60",x),e[11]=x,e[12]=b):b=e[12];const y=b;let _;e[13]!==n||e[14]!==s[0]||e[15]!==s.length?(_=s.length===1?o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Gl(n.find(D=>D.id===s[0])?.color)}}):o.jsx(p9,{size:14,className:"shrink-0"}),e[13]=n,e[14]=s[0],e[15]=s.length,e[16]=_):_=e[16];let v;e[17]!==f?(v=o.jsx("span",{className:"max-w-[10rem] truncate",children:f}),e[17]=f,e[18]=v):v=e[18];let L;e[19]!==y?(L=o.jsx(Gt,{size:12,className:y}),e[19]=y,e[20]=L):L=e[20];let S;e[21]!==_||e[22]!==v||e[23]!==L||e[24]!==g?(S=o.jsx(ts,{asChild:!0,children:o.jsxs("button",{type:"button",className:g,children:[_,v,L]})}),e[21]=_,e[22]=v,e[23]=L,e[24]=g,e[25]=S):S=e[25];let w;e[26]!==l?(w=l("taskBoard.taskFilters.tagsFilterPlaceholder"),e[26]=l,e[27]=w):w=e[27];let k;e[28]!==l?(k=l("taskBoard.taskFilters.tagsFilterPlaceholder"),e[28]=l,e[29]=k):k=e[29];let j;e[30]!==w||e[31]!==k?(j=o.jsx(An,{placeholder:w,"aria-label":k,className:"h-9"}),e[30]=w,e[31]=k,e[32]=j):j=e[32];let C;e[33]!==l?(C=l("taskBoard.taskFilters.tagsNoTagsFound"),e[33]=l,e[34]=C):C=e[34];let N;e[35]!==C?(N=o.jsx(hn,{children:C}),e[35]=C,e[36]=N):N=e[36];let T;if(e[37]!==n||e[38]!==h||e[39]!==s){let D;e[41]!==h||e[42]!==s?(D=I=>o.jsxs(Ft,{value:I.name,onSelect:()=>h(I.id),className:"gap-2",children:[o.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Gl(I.color)}}),o.jsx("span",{className:"flex-1 truncate",children:I.name}),s.includes(I.id)&&o.jsx(Kt,{size:14,className:"shrink-0 text-foreground"})]},I.id),e[41]=h,e[42]=s,e[43]=D):D=e[43],T=n.map(D),e[37]=n,e[38]=h,e[39]=s,e[40]=T}else T=e[40];let V;e[44]!==T?(V=o.jsx(os,{children:T}),e[44]=T,e[45]=V):V=e[45];let A;e[46]!==N||e[47]!==V?(A=o.jsxs(Pn,{children:[N,V]}),e[46]=N,e[47]=V,e[48]=A):A=e[48];let E;e[49]!==j||e[50]!==A?(E=o.jsx(ss,{align:"start",className:"w-56 p-0",children:o.jsxs(Fn,{children:[j,A]})}),e[49]=j,e[50]=A,e[51]=E):E=e[51];let R;return e[52]!==a||e[53]!==S||e[54]!==E?(R=o.jsxs(ns,{open:a,onOpenChange:c,children:[S,E]}),e[52]=a,e[53]=S,e[54]=E,e[55]=R):R=e[55],R}function Mq(t){const e=z.c(73),{value:s,repos:n,onChange:i,block:r}=t,l=re(),[a,c]=P.useState(!1);let d;e[0]!==l||e[1]!==s?(d=s===null?l("taskBoard.taskFilters.repoLabel"):s===Tp?l("taskBoard.taskFilters.repoNoRepo"):s,e[0]=l,e[1]=s,e[2]=d):d=e[2];const h=d;let u;e[3]!==i?(u=W=>{i(W),c(!1)},e[3]=i,e[4]=u):u=e[4];const f=u,p=s!==null;let m;e[5]!==r||e[6]!==p?(m=wl(p,r),e[5]=r,e[6]=p,e[7]=m):m=e[7];const g=m,x=r&&"ml-auto";let b;e[8]!==x?(b=ie("shrink-0 opacity-60",x),e[8]=x,e[9]=b):b=e[9];const y=b;let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Vn,{className:"size-3.5 shrink-0"}),e[10]=_):_=e[10];let v;e[11]!==h?(v=o.jsx("span",{className:"max-w-[12rem] truncate",children:h}),e[11]=h,e[12]=v):v=e[12];let L;e[13]!==y?(L=o.jsx(Gt,{size:12,className:y}),e[13]=y,e[14]=L):L=e[14];let S;e[15]!==v||e[16]!==L||e[17]!==g?(S=o.jsx(ts,{asChild:!0,children:o.jsxs("button",{type:"button",className:g,children:[_,v,L]})}),e[15]=v,e[16]=L,e[17]=g,e[18]=S):S=e[18];let w;e[19]!==l?(w=l("taskBoard.taskFilters.repoFilterPlaceholder"),e[19]=l,e[20]=w):w=e[20];let k;e[21]!==l?(k=l("taskBoard.taskFilters.repoFilterPlaceholder"),e[21]=l,e[22]=k):k=e[22];let j;e[23]!==w||e[24]!==k?(j=o.jsx(An,{placeholder:w,"aria-label":k,className:"h-9"}),e[23]=w,e[24]=k,e[25]=j):j=e[25];let C;e[26]!==l?(C=l("taskBoard.taskFilters.repoNoReposFound"),e[26]=l,e[27]=C):C=e[27];let N;e[28]!==C?(N=o.jsx(hn,{children:C}),e[28]=C,e[29]=N):N=e[29];let T;e[30]!==l?(T=l("taskBoard.taskFilters.repoAnyRepo"),e[30]=l,e[31]=T):T=e[31];let V;e[32]!==f?(V=()=>f(null),e[32]=f,e[33]=V):V=e[33];let A;e[34]!==l?(A=l("taskBoard.taskFilters.repoAnyRepo"),e[34]=l,e[35]=A):A=e[35];let E;e[36]!==T||e[37]!==V||e[38]!==A?(E=o.jsx(Ft,{value:T,onSelect:V,children:A}),e[36]=T,e[37]=V,e[38]=A,e[39]=E):E=e[39];let R;e[40]!==l?(R=l("taskBoard.taskFilters.repoNoRepo"),e[40]=l,e[41]=R):R=e[41];let D;e[42]!==f?(D=()=>f(Tp),e[42]=f,e[43]=D):D=e[43];let I;e[44]!==l?(I=l("taskBoard.taskFilters.repoNoRepo"),e[44]=l,e[45]=I):I=e[45];let O;e[46]!==R||e[47]!==D||e[48]!==I?(O=o.jsx(Ft,{value:R,onSelect:D,children:I}),e[46]=R,e[47]=D,e[48]=I,e[49]=O):O=e[49];let F;e[50]!==E||e[51]!==O?(F=o.jsxs(os,{children:[E,O]}),e[50]=E,e[51]=O,e[52]=F):F=e[52];let M;if(e[53]!==n||e[54]!==f||e[55]!==s){let W;e[57]!==f||e[58]!==s?(W=K=>o.jsxs(Ft,{value:K,onSelect:()=>f(K),className:"gap-2",children:[o.jsx(Vn,{className:"size-4 shrink-0"}),o.jsx("span",{className:"flex-1 truncate",children:K}),s===K&&o.jsx(Kt,{size:14,className:"shrink-0 text-foreground"})]},K),e[57]=f,e[58]=s,e[59]=W):W=e[59],M=n.map(W),e[53]=n,e[54]=f,e[55]=s,e[56]=M}else M=e[56];let $;e[60]!==M?($=o.jsx(os,{children:M}),e[60]=M,e[61]=$):$=e[61];let B;e[62]!==N||e[63]!==F||e[64]!==$?(B=o.jsxs(Pn,{children:[N,F,$]}),e[62]=N,e[63]=F,e[64]=$,e[65]=B):B=e[65];let U;e[66]!==j||e[67]!==B?(U=o.jsx(ss,{align:"start",className:"w-64 p-0",children:o.jsxs(Fn,{children:[j,B]})}),e[66]=j,e[67]=B,e[68]=U):U=e[68];let H;return e[69]!==a||e[70]!==S||e[71]!==U?(H=o.jsxs(ns,{open:a,onOpenChange:c,children:[S,U]}),e[69]=a,e[70]=S,e[71]=U,e[72]=H):H=e[72],H}function Oq(t){const e=z.c(45),{value:s,sprints:n,onChange:i,block:r}=t,l=re();let a;if(e[0]!==n||e[1]!==s){let V;e[3]!==s?(V=A=>A.id===s,e[3]=s,e[4]=V):V=e[4],a=n.find(V),e[0]=n,e[1]=s,e[2]=a}else a=e[2];const c=a;let d;e[5]!==c?.name||e[6]!==l||e[7]!==s?(d=s===null?l("taskBoard.taskFilters.sprintLabel"):s===wf?l("taskBoard.taskFilters.sprintBacklog"):c?.name??l("taskBoard.taskFilters.sprintLabel"),e[5]=c?.name,e[6]=l,e[7]=s,e[8]=d):d=e[8];const h=d,u=s!==null;let f;e[9]!==r||e[10]!==u?(f=wl(u,r),e[9]=r,e[10]=u,e[11]=f):f=e[11];const p=f,m=r&&"ml-auto";let g;e[12]!==m?(g=ie("shrink-0 opacity-60",m),e[12]=m,e[13]=g):g=e[13];const x=g;let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(g9,{size:14,className:"shrink-0"}),e[14]=b):b=e[14];let y;e[15]!==x?(y=o.jsx(Gt,{size:12,className:x}),e[15]=x,e[16]=y):y=e[16];let _;e[17]!==h||e[18]!==y||e[19]!==p?(_=o.jsx(Bt,{asChild:!0,children:o.jsxs("button",{type:"button",className:p,children:[b,h,y]})}),e[17]=h,e[18]=y,e[19]=p,e[20]=_):_=e[20];const v=s===null?Xr:s;let L;e[21]!==i?(L=V=>i(V===Xr?Ew:V),e[21]=i,e[22]=L):L=e[22];let S;e[23]!==l?(S=l("taskBoard.taskFilters.sprintAnySprint"),e[23]=l,e[24]=S):S=e[24];let w;e[25]!==S?(w=o.jsx(Yn,{value:Xr,children:S}),e[25]=S,e[26]=w):w=e[26];let k;e[27]!==l?(k=l("taskBoard.taskFilters.sprintBacklog"),e[27]=l,e[28]=k):k=e[28];let j;e[29]!==k?(j=o.jsx(Yn,{value:wf,children:k}),e[29]=k,e[30]=j):j=e[30];let C;if(e[31]!==n||e[32]!==l){let V;e[34]!==l?(V=A=>o.jsxs(Yn,{value:A.id,children:[o.jsx("span",{className:"truncate",children:A.name}),o.jsx("span",{className:"ml-auto shrink-0 text-muted-foreground",children:A.state==="active"?l("taskBoard.taskFilters.sprintCurrent"):c7(A)})]},A.id),e[34]=l,e[35]=V):V=e[35],C=n.map(V),e[31]=n,e[32]=l,e[33]=C}else C=e[33];let N;e[36]!==v||e[37]!==L||e[38]!==w||e[39]!==j||e[40]!==C?(N=o.jsx(zt,{align:"start",className:"max-h-80 w-72 overflow-y-auto",children:o.jsxs(Xc,{value:v,onValueChange:L,children:[w,j,C]})}),e[36]=v,e[37]=L,e[38]=w,e[39]=j,e[40]=C,e[41]=N):N=e[41];let T;return e[42]!==N||e[43]!==_?(T=o.jsxs($t,{children:[_,N]}),e[42]=N,e[43]=_,e[44]=T):T=e[44],T}function $q(t){const e=z.c(25),{value:s,onChange:n,block:i}=t,r=re(),[l,a]=P.useState(s!==""),[c,d]=P.useState(!1),[h,u]=P.useState(s);s!==h&&(u(s),s===""&&!c&&a(!1));const f=l||i,p=f?"w-32 sm:w-44":"w-8 px-0 justify-center",m=i&&"h-10 w-full px-3 text-sm sm:w-full";let g;e[0]!==p||e[1]!==m?(g=ie("inline-flex h-8 shrink-0 items-center gap-1.5 overflow-hidden rounded-lg border border-border px-2.5 text-xs text-foreground transition-all duration-200 ease-out",p,m),e[0]=p,e[1]=m,e[2]=g):g=e[2];let x;e[3]!==r?(x=r("taskBoard.taskFilters.searchLabel"),e[3]=r,e[4]=x):x=e[4];let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=()=>a(!0),e[5]=b):b=e[5];let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(l0,{size:14}),e[6]=y):y=e[6];let _;e[7]!==x?(_=o.jsx("button",{type:"button","aria-label":x,onClick:b,className:"shrink-0 text-muted-foreground transition-colors hover:text-foreground",children:y}),e[7]=x,e[8]=_):_=e[8];let v;e[9]!==i||e[10]!==f||e[11]!==n||e[12]!==r||e[13]!==s?(v=f&&o.jsx("input",{autoFocus:!i,value:s,onChange:w=>n(w.target.value),onFocus:()=>d(!0),onBlur:()=>{d(!1),s===""&&a(!1)},placeholder:r("taskBoard.taskFilters.searchPlaceholder"),"aria-label":r("taskBoard.taskFilters.searchPlaceholder"),className:"w-full min-w-0 bg-transparent text-xs outline-none placeholder:text-muted-foreground"}),e[9]=i,e[10]=f,e[11]=n,e[12]=r,e[13]=s,e[14]=v):v=e[14];let L;e[15]!==i||e[16]!==n||e[17]!==r||e[18]!==s?(L=s!==""&&o.jsx("button",{type:"button","aria-label":r("taskBoard.taskFilters.searchClearLabel"),onMouseDown:Bq,onClick:()=>{n(""),i||a(!1)},className:"shrink-0 text-muted-foreground hover:text-foreground",children:o.jsx(Is,{size:14})}),e[15]=i,e[16]=n,e[17]=r,e[18]=s,e[19]=L):L=e[19];let S;return e[20]!==g||e[21]!==_||e[22]!==v||e[23]!==L?(S=o.jsxs("div",{className:g,children:[_,v,L]}),e[20]=g,e[21]=_,e[22]=v,e[23]=L,e[24]=S):S=e[24],S}function Bq(t){return t.preventDefault()}function zq(t){const e=z.c(20),{block:s,onClick:n}=t,i=re();let r;e[0]!==i?(r=i("taskBoard.taskFilters.boardSettingsLabel"),e[0]=i,e[1]=r):r=e[1];const l=r;let a;e[2]!==s?(a=ie(wl(!1,s),s?"h-10 w-full":"w-8 justify-center px-0"),e[2]=s,e[3]=a):a=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(n7,{size:14,className:"shrink-0"}),e[4]=c):c=e[4];let d;e[5]!==s||e[6]!==l?(d=s&&o.jsx("span",{children:l}),e[5]=s,e[6]=l,e[7]=d):d=e[7];let h;e[8]!==l||e[9]!==n||e[10]!==a||e[11]!==d?(h=o.jsxs("button",{type:"button",onClick:n,"aria-label":l,className:a,children:[c,d]}),e[8]=l,e[9]=n,e[10]=a,e[11]=d,e[12]=h):h=e[12];const u=h;if(s)return u;let f;e[13]!==u?(f=o.jsx(Fe,{asChild:!0,children:u}),e[13]=u,e[14]=f):f=e[14];let p;e[15]!==l?(p=o.jsx(Ue,{side:"top",children:l}),e[15]=l,e[16]=p):p=e[16];let m;return e[17]!==f||e[18]!==p?(m=o.jsxs(He,{children:[f,p]}),e[17]=f,e[18]=p,e[19]=m):m=e[19],m}function Iw(t){const e=z.c(59),{filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c,block:d}=t;let h;e[0]!==s||e[1]!==a?(h=k=>a({...s,search:k}),e[0]=s,e[1]=a,e[2]=h):h=e[2];let u;e[3]!==d||e[4]!==s.search||e[5]!==h?(u=o.jsx($q,{block:d,value:s.search,onChange:h}),e[3]=d,e[4]=s.search,e[5]=h,e[6]=u):u=e[6];let f;e[7]!==s||e[8]!==a?(f=k=>a({...s,assignee:k}),e[7]=s,e[8]=a,e[9]=f):f=e[9];let p;e[10]!==d||e[11]!==s.assignee||e[12]!==n||e[13]!==f?(p=o.jsx(Eq,{block:d,value:s.assignee,members:n,onChange:f}),e[10]=d,e[11]=s.assignee,e[12]=n,e[13]=f,e[14]=p):p=e[14];let m;e[15]!==s||e[16]!==a?(m=k=>a({...s,priority:k}),e[15]=s,e[16]=a,e[17]=m):m=e[17];let g;e[18]!==d||e[19]!==s.priority||e[20]!==m?(g=o.jsx(Rq,{block:d,value:s.priority,onChange:m}),e[18]=d,e[19]=s.priority,e[20]=m,e[21]=g):g=e[21];let x;e[22]!==s||e[23]!==a?(x=k=>a({...s,due:k}),e[22]=s,e[23]=a,e[24]=x):x=e[24];let b;e[25]!==d||e[26]!==s.due||e[27]!==x?(b=o.jsx(Dq,{block:d,value:s.due,onChange:x}),e[25]=d,e[26]=s.due,e[27]=x,e[28]=b):b=e[28];let y;e[29]!==s||e[30]!==a?(y=k=>a({...s,tags:k}),e[29]=s,e[30]=a,e[31]=y):y=e[31];let _;e[32]!==d||e[33]!==s.tags||e[34]!==y||e[35]!==i?(_=o.jsx(Iq,{block:d,value:s.tags,tags:i,onChange:y}),e[32]=d,e[33]=s.tags,e[34]=y,e[35]=i,e[36]=_):_=e[36];let v;e[37]!==d||e[38]!==s||e[39]!==a||e[40]!==r?(v=(r.length>0||s.repo!==null)&&o.jsx(Mq,{block:d,value:s.repo,repos:r,onChange:k=>a({...s,repo:k})}),e[37]=d,e[38]=s,e[39]=a,e[40]=r,e[41]=v):v=e[41];let L;e[42]!==d||e[43]!==s||e[44]!==a||e[45]!==l?(L=(l.length>0||s.sprint!==null)&&o.jsx(Oq,{block:d,value:s.sprint,sprints:l,onChange:k=>a({...s,sprint:k})}),e[42]=d,e[43]=s,e[44]=a,e[45]=l,e[46]=L):L=e[46];let S;e[47]!==d||e[48]!==c?(S=o.jsx(zq,{block:d,onClick:c}),e[47]=d,e[48]=c,e[49]=S):S=e[49];let w;return e[50]!==_||e[51]!==v||e[52]!==L||e[53]!==S||e[54]!==u||e[55]!==p||e[56]!==g||e[57]!==b?(w=o.jsxs(o.Fragment,{children:[u,p,g,b,_,v,L,S]}),e[50]=_,e[51]=v,e[52]=L,e[53]=S,e[54]=u,e[55]=p,e[56]=g,e[57]=b,e[58]=w):w=e[58],w}function Fq(t){const e=z.c(17),{filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c}=t,d=re();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(T9,{size:16,className:"mr-0.5 shrink-0 text-muted-foreground"}),e[0]=h):h=e[0];let u;e[1]!==s||e[2]!==n||e[3]!==a||e[4]!==c||e[5]!==r||e[6]!==l||e[7]!==i?(u=o.jsx(Iw,{filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c}),e[1]=s,e[2]=n,e[3]=a,e[4]=c,e[5]=r,e[6]=l,e[7]=i,e[8]=u):u=e[8];let f;e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==d?(f=jq(s,z3(l))&&o.jsx("button",{type:"button",onClick:()=>a(F3),className:"ml-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:d("taskBoard.taskFilters.clearButton")}),e[9]=s,e[10]=a,e[11]=l,e[12]=d,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f?(p=o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h,u,f]}),e[14]=u,e[15]=f,e[16]=p):p=e[16],p}function Uq(t){const e=z.c(45),{filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c}=t,d=re(),[h,u]=P.useState(!1);let f;e[0]!==s||e[1]!==l?(f=Cq(s,z3(l)),e[0]=s,e[1]=l,e[2]=f):f=e[2];const p=f,m=p>0;let g;e[3]!==m?(g=wl(m),e[3]=m,e[4]=g):g=e[4];const x=g;let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(T9,{size:14,className:"shrink-0"}),e[5]=b):b=e[5];let y;e[6]!==d?(y=d("taskBoard.taskFilters.filterDrawerButtonLabel"),e[6]=d,e[7]=y):y=e[7];let _;e[8]!==p?(_=p>0&&o.jsx("span",{className:"ml-0.5 flex size-4 items-center justify-center rounded-full bg-foreground text-[10px] font-semibold text-background",children:p}),e[8]=p,e[9]=_):_=e[9];let v;e[10]!==y||e[11]!==_||e[12]!==x?(v=o.jsx(i8,{asChild:!0,children:o.jsxs("button",{type:"button",className:x,children:[b,y,_]})}),e[10]=y,e[11]=_,e[12]=x,e[13]=v):v=e[13];let L;e[14]!==d?(L=d("taskBoard.taskFilters.filterDrawerTitle"),e[14]=d,e[15]=L):L=e[15];let S;e[16]!==L?(S=o.jsx(l9,{className:"px-4 pt-4 text-base font-medium text-foreground",children:L}),e[16]=L,e[17]=S):S=e[17];let w;e[18]!==s||e[19]!==n||e[20]!==a||e[21]!==c||e[22]!==r||e[23]!==l||e[24]!==i?(w=o.jsx("div",{className:"flex flex-col gap-2 p-4",children:o.jsx(Iw,{block:!0,filters:s,members:n,tags:i,repos:r,sprints:l,onChange:a,onOpenBoardSettings:c})}),e[18]=s,e[19]=n,e[20]=a,e[21]=c,e[22]=r,e[23]=l,e[24]=i,e[25]=w):w=e[25];let k;e[26]!==p||e[27]!==a||e[28]!==d?(k=p>0&&o.jsx(me,{variant:"outline",className:"flex-1",onClick:()=>a(F3),children:d("taskBoard.taskFilters.clearAllButton")}),e[26]=p,e[27]=a,e[28]=d,e[29]=k):k=e[29];let j;e[30]!==d?(j=d("taskBoard.taskFilters.doneButton"),e[30]=d,e[31]=j):j=e[31];let C;e[32]!==j?(C=o.jsx(UV,{asChild:!0,children:o.jsx(me,{className:"flex-1",children:j})}),e[32]=j,e[33]=C):C=e[33];let N;e[34]!==k||e[35]!==C?(N=o.jsxs(HV,{className:"flex-row gap-2",children:[k,C]}),e[34]=k,e[35]=C,e[36]=N):N=e[36];let T;e[37]!==w||e[38]!==N||e[39]!==S?(T=o.jsxs(a9,{className:"p-0",children:[S,w,N]}),e[37]=w,e[38]=N,e[39]=S,e[40]=T):T=e[40];let V;return e[41]!==h||e[42]!==T||e[43]!==v?(V=o.jsxs(c9,{open:h,onOpenChange:u,direction:"bottom",children:[v,T]}),e[41]=h,e[42]=T,e[43]=v,e[44]=V):V=e[44],V}function Vp(t,e){return wg(t,e.keySeq,e.jiraIssueKey)??e.id}function Hq(t,e){const s=e?.trim();if(!s)return;const n=s.toLowerCase();return t.find(i=>i.jiraIssueKey?.trim().toLowerCase()===n)??t.find(i=>Dw(s,i.keySeq,i.jiraIssueKey))??t.find(i=>i.id===s)}function U3(t){const e=z.c(11),{size:s,className:n}=t,i=s===void 0?16:s;let r;e[0]!==n?(r=ie("inline-flex shrink-0 items-center justify-center rounded-full",n),e[0]=n,e[1]=r):r=e[1];let l;e[2]!==i?(l={width:i,height:i,backgroundColor:`${YV}26`},e[2]=i,e[3]=l):l=e[3];const a=i*.6,c=i*.6;let d;e[4]!==a||e[5]!==c?(d=o.jsx("img",{src:JV,alt:"Reviewer",style:{width:a,height:c}}),e[4]=a,e[5]=c,e[6]=d):d=e[6];let h;return e[7]!==r||e[8]!==l||e[9]!==d?(h=o.jsx("span",{className:r,style:l,children:d}),e[7]=r,e[8]=l,e[9]=d,e[10]=h):h=e[10],h}let Ap,Pp;if(typeof WeakMap<"u"){let t=new WeakMap;Ap=e=>t.get(e),Pp=(e,s)=>(t.set(e,s),s)}else{const t=[];let s=0;Ap=n=>{for(let i=0;i<t.length;i+=2)if(t[i]==n)return t[i+1]},Pp=(n,i)=>(s==10&&(s=0),t[s++]=n,t[s++]=i)}var Ts=class{constructor(t,e,s,n){this.width=t,this.height=e,this.map=s,this.problems=n}findCell(t){for(let e=0;e<this.map.length;e++){const s=this.map[e];if(s!=t)continue;const n=e%this.width,i=e/this.width|0;let r=n+1,l=i+1;for(let a=1;r<this.width&&this.map[e+a]==s;a++)r++;for(let a=1;l<this.height&&this.map[e+this.width*a]==s;a++)l++;return{left:n,top:i,right:r,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,s){const{left:n,right:i,top:r,bottom:l}=this.findCell(t);return e=="horiz"?(s<0?n==0:i==this.width)?null:this.map[r*this.width+(s<0?n-1:i)]:(s<0?r==0:l==this.height)?null:this.map[n+this.width*(s<0?r-1:l)]}rectBetween(t,e){const{left:s,right:n,top:i,bottom:r}=this.findCell(t),{left:l,right:a,top:c,bottom:d}=this.findCell(e);return{left:Math.min(s,l),top:Math.min(i,c),right:Math.max(n,a),bottom:Math.max(r,d)}}cellsInRect(t){const e=[],s={};for(let n=t.top;n<t.bottom;n++)for(let i=t.left;i<t.right;i++){const r=n*this.width+i,l=this.map[r];s[l]||(s[l]=!0,!(i==t.left&&i&&this.map[r-1]==l||n==t.top&&n&&this.map[r-this.width]==l)&&e.push(l))}return e}positionAt(t,e,s){for(let n=0,i=0;;n++){const r=i+s.child(n).nodeSize;if(n==t){let l=e+t*this.width;const a=(t+1)*this.width;for(;l<a&&this.map[l]<i;)l++;return l==a?r-1:this.map[l]}i=r}}static get(t){return Ap(t)||Pp(t,Kq(t))}};function Kq(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Wq(t),s=t.childCount,n=[];let i=0,r=null;const l=[];for(let d=0,h=e*s;d<h;d++)n[d]=0;for(let d=0,h=0;d<s;d++){const u=t.child(d);h++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==u.childCount)break;const g=u.child(m),{colspan:x,rowspan:b,colwidth:y}=g.attrs;for(let _=0;_<b;_++){if(_+d>=s){(r||(r=[])).push({type:"overlong_rowspan",pos:h,n:b-_});break}const v=i+_*e;for(let L=0;L<x;L++){n[v+L]==0?n[v+L]=h:(r||(r=[])).push({type:"collision",row:d,pos:h,n:x-L});const S=y&&y[L];if(S){const w=(v+L)%e*2,k=l[w];k==null||k!=S&&l[w+1]==1?(l[w]=S,l[w+1]=1):k==S&&l[w+1]++}}}i+=x,h+=g.nodeSize}const f=(d+1)*e;let p=0;for(;i<f;)n[i++]==0&&p++;p&&(r||(r=[])).push({type:"missing",row:d,n:p}),h++}(e===0||s===0)&&(r||(r=[])).push({type:"zero_sized"});const a=new Ts(e,s,n,r);let c=!1;for(let d=0;!c&&d<l.length;d+=2)l[d]!=null&&l[d+1]<s&&(c=!0);return c&&qq(a,l,t),a}function Wq(t){let e=-1,s=!1;for(let n=0;n<t.childCount;n++){const i=t.child(n);let r=0;if(s)for(let l=0;l<n;l++){const a=t.child(l);for(let c=0;c<a.childCount;c++){const d=a.child(c);l+d.attrs.rowspan>n&&(r+=d.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const a=i.child(l);r+=a.attrs.colspan,a.attrs.rowspan>1&&(s=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function qq(t,e,s){t.problems||(t.problems=[]);const n={};for(let i=0;i<t.map.length;i++){const r=t.map[i];if(n[r])continue;n[r]=!0;const l=s.nodeAt(r);if(!l)throw new RangeError(`No cell with offset ${r} found`);let a=null;const c=l.attrs;for(let d=0;d<c.colspan;d++){const h=e[(i+d)%t.width*2];h!=null&&(!c.colwidth||c.colwidth[d]!=h)&&((a||(a=Gq(c)))[d]=h)}a&&t.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:a})}}function Gq(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let s=0;s<t.colspan;s++)e.push(0);return e}function yn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const s in t.nodes){const n=t.nodes[s],i=n.spec.tableRole;i&&(e[i]=n)}}return e}const Yo=new Vi("selectingCells");function ta(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Yq(t){for(let e=t.depth;e>0;e--){const s=t.node(e).type.spec.tableRole;if(s==="cell"||s==="header_cell")return t.node(e)}return null}function $i(t){const e=t.selection.$head;for(let s=e.depth;s>0;s--)if(e.node(s).type.spec.tableRole=="row")return!0;return!1}function s1(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const s=ta(e.$head)||Jq(e.$head);if(s)return s;throw new RangeError(`No cell found around position ${e.head}`)}function Jq(t){for(let e=t.nodeAfter,s=t.pos;e;e=e.firstChild,s++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(s)}for(let e=t.nodeBefore,s=t.pos;e;e=e.lastChild,s--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(s-e.nodeSize)}}function Ep(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Qq(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function H3(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Mw(t,e,s){const n=t.node(-1),i=Ts.get(n),r=t.start(-1),l=i.nextCell(t.pos-r,e,s);return l==null?null:t.node(0).resolve(r+l)}function sa(t,e,s=1){const n={...t,colspan:t.colspan-s};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,s),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}function Ow(t,e,s=1){const n={...t,colspan:t.colspan+s};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let i=0;i<s;i++)n.colwidth.splice(e,0,0)}return n}function Xq(t,e,s){const n=yn(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[s+i*t.width]).type!=n)return!1;return!0}var is=class zr extends ir{constructor(e,s=e){const n=e.node(-1),i=Ts.get(n),r=e.start(-1),l=i.rectBetween(e.pos-r,s.pos-r),a=e.node(0),c=i.cellsInRect(l).filter(h=>h!=s.pos-r);c.unshift(s.pos-r);const d=c.map(h=>{const u=n.nodeAt(h);if(!u)throw new RangeError(`No cell with offset ${h} found`);const f=r+h+1;return new pV(a.resolve(f),a.resolve(f+u.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=s}map(e,s){const n=e.resolve(s.map(this.$anchorCell.pos)),i=e.resolve(s.map(this.$headCell.pos));if(Ep(n)&&Ep(i)&&H3(n,i)){const r=this.$anchorCell.node(-1)!=n.node(-1);return r&&this.isRowSelection()?zr.rowSelection(n,i):r&&this.isColSelection()?zr.colSelection(n,i):new zr(n,i)}return Wr.between(n,i)}content(){const e=this.$anchorCell.node(-1),s=Ts.get(e),n=this.$anchorCell.start(-1),i=s.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),r={},l=[];for(let c=i.top;c<i.bottom;c++){const d=[];for(let h=c*s.width+i.left,u=i.left;u<i.right;u++,h++){const f=s.map[h];if(r[f])continue;r[f]=!0;const p=s.findCell(f);let m=e.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i.left-p.left,x=p.right-i.right;if(g>0||x>0){let b=m.attrs;if(g>0&&(b=sa(b,0,g)),x>0&&(b=sa(b,b.colspan-x,x)),p.left<i.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(p.top<i.top||p.bottom>i.bottom){const b={...m.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}l.push(e.child(c).copy(ur.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new Qo(ur.from(a),1,1)}replace(e,s=Qo.empty){const n=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:a,$to:c}=i[l],d=e.mapping.slice(n);e.replace(d.map(a.pos),d.map(c.pos),l?Qo.empty:s)}const r=ir.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,s){this.replace(e,new Qo(ur.from(s),0,0))}forEachCell(e){const s=this.$anchorCell.node(-1),n=Ts.get(s),i=this.$anchorCell.start(-1),r=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<r.length;l++)e(s.nodeAt(r[l]),i+r[l])}isColSelection(){const e=this.$anchorCell.index(-1),s=this.$headCell.index(-1);if(Math.min(e,s)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=s+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(e,s=e){const n=e.node(-1),i=Ts.get(n),r=e.start(-1),l=i.findCell(e.pos-r),a=i.findCell(s.pos-r),c=e.node(0);return l.top<=a.top?(l.top>0&&(e=c.resolve(r+i.map[l.left])),a.bottom<i.height&&(s=c.resolve(r+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(s=c.resolve(r+i.map[a.left])),l.bottom<i.height&&(e=c.resolve(r+i.map[i.width*(i.height-1)+l.right-1]))),new zr(e,s)}isRowSelection(){const e=this.$anchorCell.node(-1),s=Ts.get(e),n=this.$anchorCell.start(-1),i=s.colCount(this.$anchorCell.pos-n),r=s.colCount(this.$headCell.pos-n);if(Math.min(i,r)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,a=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,a)==s.width}eq(e){return e instanceof zr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,s=e){const n=e.node(-1),i=Ts.get(n),r=e.start(-1),l=i.findCell(e.pos-r),a=i.findCell(s.pos-r),c=e.node(0);return l.left<=a.left?(l.left>0&&(e=c.resolve(r+i.map[l.top*i.width])),a.right<i.width&&(s=c.resolve(r+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(s=c.resolve(r+i.map[a.top*i.width])),l.right<i.width&&(e=c.resolve(r+i.map[i.width*(l.top+1)-1]))),new zr(e,s)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,s){return new zr(e.resolve(s.anchor),e.resolve(s.head))}static create(e,s,n=s){return new zr(e.resolve(s),e.resolve(n))}getBookmark(){return new Zq(this.$anchorCell.pos,this.$headCell.pos)}};is.prototype.visible=!1;ir.jsonID("cell",is);var Zq=class $w{constructor(e,s){this.anchor=e,this.head=s}map(e){return new $w(e.map(this.anchor),e.map(this.head))}resolve(e){const s=e.resolve(this.anchor),n=e.resolve(this.head);return s.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&s.index()<s.parent.childCount&&n.index()<n.parent.childCount&&H3(s,n)?new is(s,n):ir.near(n,1)}};function eG(t){if(!(t.selection instanceof is))return null;const e=[];return t.selection.forEachCell((s,n)=>{e.push(Gm.node(n,n+s.nodeSize,{class:"selectedCell"}))}),qm.create(t.doc,e)}function tG({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let s=t.pos,n=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,s++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,n--);return s==n&&/row|table/.test(t.node(i).type.spec.tableRole)}function sG({$from:t,$to:e}){let s,n;for(let i=t.depth;i>0;i--){const r=t.node(i);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){s=r;break}}for(let i=e.depth;i>0;i--){const r=e.node(i);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){n=r;break}}return s!==n&&e.parentOffset===0}function nG(t,e,s){const n=(e||t).selection,i=(e||t).doc;let r,l;if(n instanceof J6&&(l=n.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")r=is.create(i,n.from);else if(l=="row"){const a=i.resolve(n.from+1);r=is.rowSelection(a,a)}else if(!s){const a=Ts.get(n.node),c=n.from+1,d=c+a.map[a.width*a.height-1];r=is.create(i,c+1,d)}}else n instanceof Wr&&tG(n)?r=Wr.create(i,n.from):n instanceof Wr&&sG(n)&&(r=Wr.create(i,n.$from.start(),n.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}const iG=new Vi("fix-tables");function Bw(t,e,s,n){const i=t.childCount,r=e.childCount;e:for(let l=0,a=0;l<r;l++){const c=e.child(l);for(let d=a,h=Math.min(i,l+3);d<h;d++)if(t.child(d)==c){a=d+1,s+=c.nodeSize;continue e}n(c,s),a<i&&t.child(a).sameMarkup(c)?Bw(t.child(a),c,s+1,n):c.nodesBetween(0,c.content.size,n,s+1),s+=c.nodeSize}}function zw(t,e){let s;const n=(i,r)=>{i.type.spec.tableRole=="table"&&(s=rG(t,i,r,s))};return e?e.doc!=t.doc&&Bw(e.doc,t.doc,0,n):t.doc.descendants(n),s}function rG(t,e,s,n){const i=Ts.get(e);if(!i.problems)return n;n||(n=t.tr);const r=[];for(let c=0;c<i.height;c++)r.push(0);for(let c=0;c<i.problems.length;c++){const d=i.problems[c];if(d.type=="collision"){const h=e.nodeAt(d.pos);if(!h)continue;const u=h.attrs;for(let f=0;f<u.rowspan;f++)r[d.row+f]+=d.n;n.setNodeMarkup(n.mapping.map(s+1+d.pos),null,sa(u,u.colspan-d.n,d.n))}else if(d.type=="missing")r[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const h=e.nodeAt(d.pos);if(!h)continue;n.setNodeMarkup(n.mapping.map(s+1+d.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const h=e.nodeAt(d.pos);if(!h)continue;n.setNodeMarkup(n.mapping.map(s+1+d.pos),null,{...h.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const h=n.mapping.map(s);n.delete(h,h+e.nodeSize)}}let l,a;for(let c=0;c<r.length;c++)r[c]&&(l==null&&(l=c),a=c);for(let c=0,d=s+1;c<i.height;c++){const h=e.child(c),u=d+h.nodeSize,f=r[c];if(f>0){let p="cell";h.firstChild&&(p=h.firstChild.type.spec.tableRole);const m=[];for(let x=0;x<f;x++){const b=yn(t.schema)[p].createAndFill();b&&m.push(b)}const g=(c==0||l==c-1)&&a==c?d+1:u-1;n.insert(n.mapping.map(g),m)}d=u}return n.setMeta(iG,{fixTables:!0})}function wr(t){const e=t.selection,s=s1(t),n=s.node(-1),i=s.start(-1),r=Ts.get(n);return{...e instanceof is?r.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):r.findCell(s.pos-i),tableStart:i,map:r,table:n}}function Fw(t,{map:e,tableStart:s,table:n},i){let r=i>0?-1:0;Xq(e,n,i+r)&&(r=i==0||i==e.width?null:0);for(let l=0;l<e.height;l++){const a=l*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const c=e.map[a],d=n.nodeAt(c);t.setNodeMarkup(t.mapping.map(s+c),null,Ow(d.attrs,i-e.colCount(c))),l+=d.attrs.rowspan-1}else{const c=r==null?yn(n.type.schema).cell:n.nodeAt(e.map[a+r]).type,d=e.positionAt(l,i,n);t.insert(t.mapping.map(s+d),c.createAndFill())}}return t}function oG(t,e){if(!$i(t))return!1;if(e){const s=wr(t);e(Fw(t.tr,s,s.left))}return!0}function lG(t,e){if(!$i(t))return!1;if(e){const s=wr(t);e(Fw(t.tr,s,s.right))}return!0}function aG(t,{map:e,table:s,tableStart:n},i){const r=t.mapping.maps.length;for(let l=0;l<e.height;){const a=l*e.width+i,c=e.map[a],d=s.nodeAt(c),h=d.attrs;if(i>0&&e.map[a-1]==c||i<e.width-1&&e.map[a+1]==c)t.setNodeMarkup(t.mapping.slice(r).map(n+c),null,sa(h,i-e.colCount(c)));else{const u=t.mapping.slice(r).map(n+c);t.delete(u,u+d.nodeSize)}l+=h.rowspan}}function cG(t,e){if(!$i(t))return!1;if(e){const s=wr(t),n=t.tr;if(s.left==0&&s.right==s.map.width)return!1;for(let i=s.right-1;aG(n,s,i),i!=s.left;i--){const r=s.tableStart?n.doc.nodeAt(s.tableStart-1):n.doc;if(!r)throw new RangeError("No table found");s.table=r,s.map=Ts.get(r)}e(n)}return!0}function dG(t,e,s){var n;const i=yn(e.type.schema).header_cell;for(let r=0;r<t.width;r++)if(((n=e.nodeAt(t.map[r+s*t.width]))===null||n===void 0?void 0:n.type)!=i)return!1;return!0}function Uw(t,{map:e,tableStart:s,table:n},i){let r=s;for(let d=0;d<i;d++)r+=n.child(d).nodeSize;const l=[];let a=i>0?-1:0;dG(e,n,i+a)&&(a=i==0||i==e.height?null:0);for(let d=0,h=e.width*i;d<e.width;d++,h++)if(i>0&&i<e.height&&e.map[h]==e.map[h-e.width]){const u=e.map[h],f=n.nodeAt(u).attrs;t.setNodeMarkup(s+u,null,{...f,rowspan:f.rowspan+1}),d+=f.colspan-1}else{var c;const u=a==null?yn(n.type.schema).cell:(c=n.nodeAt(e.map[h+a*e.width]))===null||c===void 0?void 0:c.type,f=u?.createAndFill();f&&l.push(f)}return t.insert(r,yn(n.type.schema).row.create(null,l)),t}function uG(t,e){if(!$i(t))return!1;if(e){const s=wr(t);e(Uw(t.tr,s,s.top))}return!0}function hG(t,e){if(!$i(t))return!1;if(e){const s=wr(t);e(Uw(t.tr,s,s.bottom))}return!0}function fG(t,{map:e,table:s,tableStart:n},i){let r=0;for(let d=0;d<i;d++)r+=s.child(d).nodeSize;const l=r+s.child(i).nodeSize,a=t.mapping.maps.length;t.delete(r+n,l+n);const c=new Set;for(let d=0,h=i*e.width;d<e.width;d++,h++){const u=e.map[h];if(!c.has(u)){if(c.add(u),i>0&&u==e.map[h-e.width]){const f=s.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(a).map(u+n),null,{...f,rowspan:f.rowspan-1}),d+=f.colspan-1}else if(i<e.height&&u==e.map[h+e.width]){const f=s.nodeAt(u),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(i+1,d,s);t.insert(t.mapping.slice(a).map(n+g),m),d+=p.colspan-1}}}}function mG(t,e){if(!$i(t))return!1;if(e){const s=wr(t),n=t.tr;if(s.top==0&&s.bottom==s.map.height)return!1;for(let i=s.bottom-1;fG(n,s,i),i!=s.top;i--){const r=s.tableStart?n.doc.nodeAt(s.tableStart-1):n.doc;if(!r)throw new RangeError("No table found");s.table=r,s.map=Ts.get(s.table)}e(n)}return!0}function eb(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function pG({width:t,height:e,map:s},n){let i=n.top*t+n.left,r=i,l=(n.bottom-1)*t+n.left,a=i+(n.right-n.left-1);for(let c=n.top;c<n.bottom;c++){if(n.left>0&&s[r]==s[r-1]||n.right<t&&s[a]==s[a+1])return!0;r+=t,a+=t}for(let c=n.left;c<n.right;c++){if(n.top>0&&s[i]==s[i-t]||n.bottom<e&&s[l]==s[l+t])return!0;i++,l++}return!1}function tb(t,e){const s=t.selection;if(!(s instanceof is)||s.$anchorCell.pos==s.$headCell.pos)return!1;const n=wr(t),{map:i}=n;if(pG(i,n))return!1;if(e){const r=t.tr,l={};let a=ur.empty,c,d;for(let h=n.top;h<n.bottom;h++)for(let u=n.left;u<n.right;u++){const f=i.map[h*i.width+u],p=n.table.nodeAt(f);if(!(l[f]||!p))if(l[f]=!0,c==null)c=f,d=p;else{eb(p)||(a=a.append(p.content));const m=r.mapping.map(f+n.tableStart);r.delete(m,m+p.nodeSize)}}if(c==null||d==null)return!0;if(r.setNodeMarkup(c+n.tableStart,null,{...Ow(d.attrs,d.attrs.colspan,n.right-n.left-d.attrs.colspan),rowspan:n.bottom-n.top}),a.size>0){const h=c+1+d.content.size,u=eb(d)?c+1:h;r.replaceWith(u+n.tableStart,h+n.tableStart,a)}r.setSelection(new is(r.doc.resolve(c+n.tableStart))),e(r)}return!0}function sb(t,e){const s=yn(t.schema);return gG(({node:n})=>s[n.type.spec.tableRole])(t,e)}function gG(t){return(e,s)=>{const n=e.selection;let i,r;if(n instanceof is){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;i=n.$anchorCell.nodeAfter,r=n.$anchorCell.pos}else{var l;if(i=Yq(n.$from),!i)return!1;r=(l=ta(n.$from))===null||l===void 0?void 0:l.pos}if(i==null||r==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(s){let a=i.attrs;const c=[],d=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const h=wr(e),u=e.tr;for(let p=0;p<h.right-h.left;p++)c.push(d?{...a,colwidth:d&&d[p]?[d[p]]:null}:a);let f;for(let p=h.top;p<h.bottom;p++){let m=h.map.positionAt(p,h.left,h.table);p==h.top&&(m+=i.nodeSize);for(let g=h.left,x=0;g<h.right;g++,x++)g==h.left&&p==h.top||u.insert(f=u.mapping.map(m+h.tableStart,1),t({node:i,row:p,col:g}).createAndFill(c[x]))}u.setNodeMarkup(r,t({node:i,row:h.top,col:h.left}),c[0]),n instanceof is&&u.setSelection(new is(u.doc.resolve(n.$anchorCell.pos),f?u.doc.resolve(f):void 0)),s(u)}return!0}}function xG(t,e){return function(s,n){if(!$i(s))return!1;const i=s1(s);if(i.nodeAfter.attrs[t]===e)return!1;if(n){const r=s.tr;s.selection instanceof is?s.selection.forEachCell((l,a)=>{l.attrs[t]!==e&&r.setNodeMarkup(a,null,{...l.attrs,[t]:e})}):r.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),n(r)}return!0}}function bG(t){return function(e,s){if(!$i(e))return!1;if(s){const n=yn(e.schema),i=wr(e),r=e.tr,l=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=l.map(c=>i.table.nodeAt(c));for(let c=0;c<l.length;c++)a[c].type==n.header_cell&&r.setNodeMarkup(i.tableStart+l[c],n.cell,a[c].attrs);if(r.steps.length===0)for(let c=0;c<l.length;c++)r.setNodeMarkup(i.tableStart+l[c],n.header_cell,a[c].attrs);s(r)}return!0}}function nb(t,e,s){const n=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<n.length;i++){const r=e.table.nodeAt(n[i]);if(r&&r.type!==s.header_cell)return!1}return!0}function Ju(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?bG(t):function(s,n){if(!$i(s))return!1;if(n){const i=yn(s.schema),r=wr(s),l=s.tr,a=nb("row",r,i),c=nb("column",r,i),d=(t==="column"?a:t==="row"&&c)?1:0,h=t=="column"?{left:0,top:d,right:1,bottom:r.map.height}:t=="row"?{left:d,top:0,right:r.map.width,bottom:1}:r,u=t=="column"?c?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;r.map.cellsInRect(h).forEach(f=>{const p=f+r.tableStart,m=l.doc.nodeAt(p);m&&l.setNodeMarkup(p,u,m.attrs)}),n(l)}return!0}}Ju("row",{useDeprecatedLogic:!0});Ju("column",{useDeprecatedLogic:!0});const vG=Ju("cell",{useDeprecatedLogic:!0});function yG(t,e){if(e<0){const s=t.nodeBefore;if(s)return t.pos-s.nodeSize;for(let n=t.index(-1)-1,i=t.before();n>=0;n--){const r=t.node(-1).child(n),l=r.lastChild;if(l)return i-1-l.nodeSize;i-=r.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const s=t.node(-1);for(let n=t.indexAfter(-1),i=t.after();n<s.childCount;n++){const r=s.child(n);if(r.childCount)return i+1;i+=r.nodeSize}}return null}function ib(t){return function(e,s){if(!$i(e))return!1;const n=yG(s1(e),t);if(n==null)return!1;if(s){const i=e.doc.resolve(n);s(e.tr.setSelection(Wr.between(i,Qq(i))).scrollIntoView())}return!0}}function _G(t,e){const s=t.selection.$anchor;for(let n=s.depth;n>0;n--)if(s.node(n).type.spec.tableRole=="table")return e&&e(t.tr.delete(s.before(n),s.after(n)).scrollIntoView()),!0;return!1}function ah(t,e){const s=t.selection;if(!(s instanceof is))return!1;if(e){const n=t.tr,i=yn(t.schema).cell.createAndFill().content;s.forEachCell((r,l)=>{r.content.eq(i)||n.replace(n.mapping.map(l+1),n.mapping.map(l+r.nodeSize-1),new Qo(i,0,0))}),n.docChanged&&e(n)}return!0}function LG(t){if(t.size===0)return null;let{content:e,openStart:s,openEnd:n}=t;for(;e.childCount==1&&(s>0&&n>0||e.child(0).type.spec.tableRole=="table");)s--,n--,e=e.child(0).content;const i=e.child(0),r=i.type.spec.tableRole,l=i.type.schema,a=[];if(r=="row")for(let c=0;c<e.childCount;c++){let d=e.child(c).content;const h=c?0:Math.max(0,s-1),u=c<e.childCount-1?0:Math.max(0,n-1);(h||u)&&(d=Rp(yn(l).row,new Qo(d,h,u)).content),a.push(d)}else if(r=="cell"||r=="header_cell")a.push(s||n?Rp(yn(l).row,new Qo(e,s,n)).content:e);else return null;return wG(l,a)}function wG(t,e){const s=[];for(let i=0;i<e.length;i++){const r=e[i];for(let l=r.childCount-1;l>=0;l--){const{rowspan:a,colspan:c}=r.child(l).attrs;for(let d=i;d<i+a;d++)s[d]=(s[d]||0)+c}}let n=0;for(let i=0;i<s.length;i++)n=Math.max(n,s[i]);for(let i=0;i<s.length;i++)if(i>=e.length&&e.push(ur.empty),s[i]<n){const r=yn(t).cell.createAndFill(),l=[];for(let a=s[i];a<n;a++)l.push(r);e[i]=e[i].append(ur.from(l))}return{height:e.length,width:n,rows:e}}function Rp(t,e){const s=t.createAndFill();return new gV(s).replace(0,s.content.size,e).doc}function SG({width:t,height:e,rows:s},n,i){if(t!=n){const r=[],l=[];for(let a=0;a<s.length;a++){const c=s[a],d=[];for(let h=r[a]||0,u=0;h<n;u++){let f=c.child(u%c.childCount);h+f.attrs.colspan>n&&(f=f.type.createChecked(sa(f.attrs,f.attrs.colspan,h+f.attrs.colspan-n),f.content)),d.push(f),h+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)r[a+p]=(r[a+p]||0)+f.attrs.colspan}l.push(ur.from(d))}s=l,t=n}if(e!=i){const r=[];for(let l=0,a=0;l<i;l++,a++){const c=[],d=s[a%e];for(let h=0;h<d.childCount;h++){let u=d.child(h);l+u.attrs.rowspan>i&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,i-u.attrs.rowspan)},u.content)),c.push(u)}r.push(ur.from(c))}s=r,e=i}return{width:t,height:e,rows:s}}function kG(t,e,s,n,i,r,l){const a=t.doc.type.schema,c=yn(a);let d,h;if(i>e.width)for(let u=0,f=0;u<e.height;u++){const p=s.child(u);f+=p.nodeSize;const m=[];let g;p.lastChild==null||p.lastChild.type==c.cell?g=d||(d=c.cell.createAndFill()):g=h||(h=c.header_cell.createAndFill());for(let x=e.width;x<i;x++)m.push(g);t.insert(t.mapping.slice(l).map(f-1+n),m)}if(r>e.height){const u=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,i);m++){const x=m>=e.width?!1:s.nodeAt(e.map[g+m]).type==c.header_cell;u.push(x?h||(h=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}const f=c.row.create(null,ur.from(u)),p=[];for(let m=e.height;m<r;m++)p.push(f);t.insert(t.mapping.slice(l).map(n+s.nodeSize-2),p)}return!!(d||h)}function rb(t,e,s,n,i,r,l,a){if(l==0||l==e.height)return!1;let c=!1;for(let d=i;d<r;d++){const h=l*e.width+d,u=e.map[h];if(e.map[h-e.width]==u){c=!0;const f=s.nodeAt(u),{top:p,left:m}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(a).map(u+n),null,{...f.attrs,rowspan:l-p}),t.insert(t.mapping.slice(a).map(e.positionAt(l,m,s)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-l})),d+=f.attrs.colspan-1}}return c}function ob(t,e,s,n,i,r,l,a){if(l==0||l==e.width)return!1;let c=!1;for(let d=i;d<r;d++){const h=d*e.width+l,u=e.map[h];if(e.map[h-1]==u){c=!0;const f=s.nodeAt(u),p=e.colCount(u),m=t.mapping.slice(a).map(u+n);t.setNodeMarkup(m,null,sa(f.attrs,l-p,f.attrs.colspan-(l-p))),t.insert(m+f.nodeSize,f.type.createAndFill(sa(f.attrs,0,l-p))),d+=f.attrs.rowspan-1}}return c}function lb(t,e,s,n,i){let r=s?t.doc.nodeAt(s-1):t.doc;if(!r)throw new Error("No table found");let l=Ts.get(r);const{top:a,left:c}=n,d=c+i.width,h=a+i.height,u=t.tr;let f=0;function p(){if(r=s?u.doc.nodeAt(s-1):u.doc,!r)throw new Error("No table found");l=Ts.get(r),f=u.mapping.maps.length}kG(u,l,r,s,d,h,f)&&p(),rb(u,l,r,s,c,d,a,f)&&p(),rb(u,l,r,s,c,d,h,f)&&p(),ob(u,l,r,s,a,h,c,f)&&p(),ob(u,l,r,s,a,h,d,f)&&p();for(let m=a;m<h;m++){const g=l.positionAt(m,c,r),x=l.positionAt(m,d,r);u.replace(u.mapping.slice(f).map(g+s),u.mapping.slice(f).map(x+s),new Qo(i.rows[m-a],0,0))}p(),u.setSelection(new is(u.doc.resolve(s+l.positionAt(a,c,r)),u.doc.resolve(s+l.positionAt(h-1,d-1,r)))),e(u)}const jG=mV({ArrowLeft:ch("horiz",-1),ArrowRight:ch("horiz",1),ArrowUp:ch("vert",-1),ArrowDown:ch("vert",1),"Shift-ArrowLeft":dh("horiz",-1),"Shift-ArrowRight":dh("horiz",1),"Shift-ArrowUp":dh("vert",-1),"Shift-ArrowDown":dh("vert",1),Backspace:ah,"Mod-Backspace":ah,Delete:ah,"Mod-Delete":ah});function zh(t,e,s){return s.eq(t.selection)?!1:(e&&e(t.tr.setSelection(s).scrollIntoView()),!0)}function ch(t,e){return(s,n,i)=>{if(!i)return!1;const r=s.selection;if(r instanceof is)return zh(s,n,ir.near(r.$headCell,e));if(t!="horiz"&&!r.empty)return!1;const l=Hw(i,t,e);if(l==null)return!1;if(t=="horiz")return zh(s,n,ir.near(s.doc.resolve(r.head+e),e));{const a=s.doc.resolve(l),c=Mw(a,t,e);let d;return c?d=ir.near(c,1):e<0?d=ir.near(s.doc.resolve(a.before(-1)),-1):d=ir.near(s.doc.resolve(a.after(-1)),1),zh(s,n,d)}}}function dh(t,e){return(s,n,i)=>{if(!i)return!1;const r=s.selection;let l;if(r instanceof is)l=r;else{const c=Hw(i,t,e);if(c==null)return!1;l=new is(s.doc.resolve(c))}const a=Mw(l.$headCell,t,e);return a?zh(s,n,new is(l.$anchorCell,a)):!1}}function CG(t,e){const s=t.state.doc,n=ta(s.resolve(e));return n?(t.dispatch(t.state.tr.setSelection(new is(n))),!0):!1}function NG(t,e,s){if(!$i(t.state))return!1;let n=LG(s);const i=t.state.selection;if(i instanceof is){n||(n={width:1,height:1,rows:[ur.from(Rp(yn(t.state.schema).cell,s))]});const r=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),a=Ts.get(r).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return n=SG(n,a.right-a.left,a.bottom-a.top),lb(t.state,t.dispatch,l,a,n),!0}else if(n){const r=s1(t.state),l=r.start(-1);return lb(t.state,t.dispatch,l,Ts.get(r.node(-1)).findCell(r.pos-l),n),!0}else return!1}function TG(t,e){var s;if(e.button!=0||e.ctrlKey||e.metaKey)return;const n=ab(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof is)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(i=ta(t.state.selection.$anchor))!=null&&((s=nm(t,e))===null||s===void 0?void 0:s.pos)!=i.pos)r(i,e),e.preventDefault();else if(!n)return;function r(c,d){let h=nm(t,d);const u=Yo.getState(t.state)==null;if(!h||!H3(c,h))if(u)h=c;else return;const f=new is(c,h);if(u||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);u&&p.setMeta(Yo,c.pos),t.dispatch(p)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",a),Yo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Yo,-1))}function a(c){const d=c,h=Yo.getState(t.state);let u;if(h!=null)u=t.state.doc.resolve(h);else if(ab(t,d.target)!=n&&(u=nm(t,e),!u))return l();u&&r(u,d)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",a)}function Hw(t,e,s){if(!(t.state.selection instanceof Wr))return null;const{$head:n}=t.state.selection;for(let i=n.depth-1;i>=0;i--){const r=n.node(i);if((s<0?n.index(i):n.indexAfter(i))!=(s<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const l=n.before(i),a=e=="vert"?s>0?"down":"up":s>0?"right":"left";return t.endOfTextblock(a)?l:null}}return null}function ab(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function nm(t,e){const s=t.posAtCoords({left:e.clientX,top:e.clientY});if(!s)return null;let{inside:n,pos:i}=s;return n>=0&&ta(t.state.doc.resolve(n))||ta(t.state.doc.resolve(i))}var VG=class{constructor(e,s){this.node=e,this.defaultCellMinWidth=s,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${s}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Dp(e,this.colgroup,this.table,s),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Dp(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Dp(t,e,s,n,i,r){let l=0,a=!0,c=e.firstChild;const d=t.firstChild;if(d){for(let u=0,f=0;u<d.childCount;u++){const{colspan:p,colwidth:m}=d.child(u).attrs;for(let g=0;g<p;g++,f++){const x=i==f?r:m&&m[g],b=x?x+"px":"";if(l+=x||n,x||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const y=document.createElement("col");y.style.width=b,e.appendChild(y)}}}for(;c;){var h;const u=c.nextSibling;(h=c.parentNode)===null||h===void 0||h.removeChild(c),c=u}a?(s.style.width=l+"px",s.style.minWidth=""):(s.style.width="",s.style.minWidth=l+"px")}}const Gn=new Vi("tableColumnResizing");function AG({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:s=100,View:n=VG,lastColumnResizable:i=!0}={}){const r=new ud({key:Gn,state:{init(l,a){var c;const d=(c=r.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,h=yn(a.schema).table.name;return n&&d&&(d[h]=(u,f)=>new n(u,s,f)),new PG(-1,!1)},apply(l,a){return a.apply(l)}},props:{attributes:l=>{const a=Gn.getState(l);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,a)=>{EG(l,a,t,i)},mouseleave:l=>{RG(l)},mousedown:(l,a)=>{DG(l,a,e,s)}},decorations:l=>{const a=Gn.getState(l);if(a&&a.activeHandle>-1)return BG(l,a.activeHandle)},nodeViews:{}}});return r}var PG=class Fh{constructor(e,s){this.activeHandle=e,this.dragging=s}apply(e){const s=this,n=e.getMeta(Gn);if(n&&n.setHandle!=null)return new Fh(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new Fh(s.activeHandle,n.setDragging);if(s.activeHandle>-1&&e.docChanged){let i=e.mapping.map(s.activeHandle,-1);return Ep(e.doc.resolve(i))||(i=-1),new Fh(i,s.dragging)}return s}};function EG(t,e,s,n){if(!t.editable)return;const i=Gn.getState(t.state);if(i&&!i.dragging){const r=MG(e.target);let l=-1;if(r){const{left:a,right:c}=r.getBoundingClientRect();e.clientX-a<=s?l=cb(t,e,"left",s):c-e.clientX<=s&&(l=cb(t,e,"right",s))}if(l!=i.activeHandle){if(!n&&l!==-1){const a=t.state.doc.resolve(l),c=a.node(-1),d=Ts.get(c),h=a.start(-1);if(d.colCount(a.pos-h)+a.nodeAfter.attrs.colspan-1==d.width-1)return}Kw(t,l)}}}function RG(t){if(!t.editable)return;const e=Gn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Kw(t,-1)}function DG(t,e,s,n){var i;if(!t.editable)return!1;const r=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=Gn.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const a=t.state.doc.nodeAt(l.activeHandle),c=IG(t,l.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Gn,{setDragging:{startX:e.clientX,startWidth:c}}));function d(u){r.removeEventListener("mouseup",d),r.removeEventListener("mousemove",h);const f=Gn.getState(t.state);f?.dragging&&(OG(t,f.activeHandle,db(f.dragging,u,s)),t.dispatch(t.state.tr.setMeta(Gn,{setDragging:null})))}function h(u){if(!u.which)return d(u);const f=Gn.getState(t.state);if(f&&f.dragging){const p=db(f.dragging,u,s);ub(t,f.activeHandle,p,n)}}return ub(t,l.activeHandle,c,n),r.addEventListener("mouseup",d),r.addEventListener("mousemove",h),e.preventDefault(),!0}function IG(t,e,{colspan:s,colwidth:n}){const i=n&&n[n.length-1];if(i)return i;const r=t.domAtPos(e);let l=r.node.childNodes[r.offset].offsetWidth,a=s;if(n)for(let c=0;c<s;c++)n[c]&&(l-=n[c],a--);return l/a}function MG(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function cb(t,e,s,n){const i=s=="right"?-n:n,r=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!r)return-1;const{pos:l}=r,a=ta(t.state.doc.resolve(l));if(!a)return-1;if(s=="right")return a.pos;const c=Ts.get(a.node(-1)),d=a.start(-1),h=c.map.indexOf(a.pos-d);return h%c.width==0?-1:d+c.map[h-1]}function db(t,e,s){const n=e.clientX-t.startX;return Math.max(s,t.startWidth+n)}function Kw(t,e){t.dispatch(t.state.tr.setMeta(Gn,{setHandle:e}))}function OG(t,e,s){const n=t.state.doc.resolve(e),i=n.node(-1),r=Ts.get(i),l=n.start(-1),a=r.colCount(n.pos-l)+n.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let d=0;d<r.height;d++){const h=d*r.width+a;if(d&&r.map[h]==r.map[h-r.width])continue;const u=r.map[h],f=i.nodeAt(u).attrs,p=f.colspan==1?0:a-r.colCount(u);if(f.colwidth&&f.colwidth[p]==s)continue;const m=f.colwidth?f.colwidth.slice():$G(f.colspan);m[p]=s,c.setNodeMarkup(l+u,null,{...f,colwidth:m})}c.docChanged&&t.dispatch(c)}function ub(t,e,s,n){const i=t.state.doc.resolve(e),r=i.node(-1),l=i.start(-1),a=Ts.get(r).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let c=t.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&Dp(r,c.firstChild,c,n,a,s)}function $G(t){return Array(t).fill(0)}function BG(t,e){const s=[],n=t.doc.resolve(e),i=n.node(-1);if(!i)return qm.empty;const r=Ts.get(i),l=n.start(-1),a=r.colCount(n.pos-l)+n.nodeAfter.attrs.colspan-1;for(let d=0;d<r.height;d++){const h=a+d*r.width;if((a==r.width-1||r.map[h]!=r.map[h+1])&&(d==0||r.map[h]!=r.map[h-r.width])){var c;const u=r.map[h],f=l+u+i.nodeAt(u).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((c=Gn.getState(t))===null||c===void 0)&&c.dragging&&s.push(Gm.node(l+u,l+u+i.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),s.push(Gm.widget(f,p))}}return qm.create(t.doc,s)}function zG({allowTableNodeSelection:t=!1}={}){return new ud({key:Yo,state:{init(){return null},apply(e,s){const n=e.getMeta(Yo);if(n!=null)return n==-1?null:n;if(s==null||!e.docChanged)return s;const{deleted:i,pos:r}=e.mapping.mapResult(s);return i?null:r}},props:{decorations:eG,handleDOMEvents:{mousedown:TG},createSelectionBetween(e){return Yo.getState(e.state)!=null?e.state.selection:null},handleTripleClick:CG,handleKeyDown:jG,handlePaste:NG},appendTransaction(e,s,n){return nG(n,zw(n,s),t)}})}function FG(t,e){const s=Math.min(t.top,e.top),n=Math.max(t.bottom,e.bottom),i=Math.min(t.left,e.left),r=Math.max(t.right,e.right)-i,l=n-s;return new DOMRect(i,s,r,l)}var UG=class{get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(J2(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(I6(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(Y2(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(M6(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(O6(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push($6(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(B6(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(z6(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t,e;const{selection:s}=this.editor.state,n=(t=this.getReferencedVirtualElement)===null||t===void 0?void 0:t.call(this);if(n)return n;if(!(!((e=this.view)===null||e===void 0||(e=e.dom)===null||e===void 0)&&e.parentNode))return;const i=Q6(this.view,s.from,s.to);let r={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(s instanceof J6){let l=this.view.nodeDOM(s.from);const a=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");a&&(l=a),l&&(r={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(s instanceof is){const{$anchorCell:l,$headCell:a}=s,c=l?l.pos:a.pos,d=a?a.pos:l.pos,h=this.view.nodeDOM(c),u=this.view.nodeDOM(d);if(!h||!u)return;const f=h===u?h.getBoundingClientRect():FG(h.getBoundingClientRect(),u.getBoundingClientRect());r={getBoundingClientRect:()=>f,getClientRects:()=>[f]}}return r}constructor({editor:t,element:e,view:s,pluginKey:n="bubbleMenu",updateDelay:i=250,resizeDelay:r=60,shouldShow:l,appendTo:a,getReferencedVirtualElement:c,options:d}){var h;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:f,from:p,to:m})=>{const{doc:g,selection:x}=f,{empty:b}=x,y=!g.textBetween(p,m).length&&xV(f.selection),_=this.element.contains(document.activeElement);return!(!(u.hasFocus()||_)||b||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var f;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u?.relatedTarget&&(!((f=this.element.parentNode)===null||f===void 0)&&f.contains(u.relatedTarget))||u?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,f)=>{const p=!f?.selection.eq(u.state.selection),m=!f?.doc.eq(u.state.doc);!p&&!m||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,p,m,f)},this.updateDelay))},this.updateHandler=(u,f,p,m)=>{const{composing:g}=u;if(!(g||!f&&!p)){if(!this.getShouldShow(m)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:u})=>{const f=u.getMeta(this.pluginKey);f==="updatePosition"?this.updatePosition():f&&typeof f=="object"&&f.type==="updateOptions"?this.updateOptions(f.options):f==="hide"?this.hide():f==="show"&&(this.updatePosition(),this.show())},this.editor=t,this.element=e,this.view=s,this.pluginKey=n,this.updateDelay=i,this.resizeDelay=r,this.appendTo=a,this.scrollTarget=(h=d?.scrollTarget)!==null&&h!==void 0?h:window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...d},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(s,s.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;const t=this.virtualElement;t&&Q2(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:s,strategy:n,middlewareData:i})=>{var r,l;if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(!((r=i.hide)===null||r===void 0)&&r.referenceHidden||!((l=i.hide)===null||l===void 0)&&l.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${s}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(t,e){const{state:s}=t,n=s.selection.from!==s.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(t,e);return}const i=!e?.selection.eq(t.state.selection),r=!e?.doc.eq(t.state.doc);this.updateHandler(t,i,r,e)}getShouldShow(t){var e;const{state:s}=this.view,{selection:n}=s,{ranges:i}=n,r=Math.min(...i.map(a=>a.$from.pos)),l=Math.max(...i.map(a=>a.$to.pos));return((e=this.shouldShow)===null||e===void 0?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:s,oldState:t,from:r,to:l}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)===null||t===void 0||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(t){if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=t.getReferencedVirtualElement),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){var e;const s=(e=t.options.scrollTarget)!==null&&e!==void 0?e:window;s!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=s,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const Ww=t=>new ud({key:typeof t.pluginKey=="string"?new Vi(t.pluginKey):t.pluginKey,view:e=>new UG({view:e,...t})});xi.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Ww({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var HG=class{getTextContent(t){return bV(t,{textSerializers:vV(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(J2(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(I6(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(Y2(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(M6(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(O6(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push($6(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(B6(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(z6(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}constructor({editor:t,element:e,view:s,pluginKey:n="floatingMenu",updateDelay:i=250,resizeDelay:r=60,options:l,appendTo:a,shouldShow:c}){var d;this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:h,state:u})=>{const{selection:f}=u,{$anchor:p,empty:m}=f,g=p.depth===1,x=p.parent.isTextblock&&!p.parent.type.spec.code&&!p.parent.textContent&&p.parent.childCount===0&&!this.getTextContent(p.parent);return!(!h.hasFocus()||!m||!g||!x||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(h,u,f,p)=>{const{composing:m}=h;if(!(m||!u&&!f)){if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var u;if(this.preventHide){this.preventHide=!1;return}h?.relatedTarget&&(!((u=this.element.parentNode)===null||u===void 0)&&u.contains(h.relatedTarget))||h?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:h})=>{const u=h.getMeta(this.pluginKey);u==="updatePosition"?this.updatePosition():u&&typeof u=="object"&&u.type==="updateOptions"?this.updateOptions(u.options):u==="hide"?this.hide():u==="show"&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=t,this.element=e,this.view=s,this.pluginKey=n,this.updateDelay=i,this.resizeDelay=r,this.appendTo=a,this.scrollTarget=(d=l?.scrollTarget)!==null&&d!==void 0?d:window,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(s,s.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(t){var e;const{state:s}=this.view,{selection:n}=s,{ranges:i}=n,r=Math.min(...i.map(a=>a.$from.pos)),l=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)===null||e===void 0?void 0:e.call(this,{editor:this.editor,view:this.view,state:s,oldState:t,from:r,to:l})}updateOptions(t){if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){var e;const s=(e=t.options.scrollTarget)!==null&&e!==void 0?e:window;s!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=s,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}updatePosition(){var t;if(!(!((t=this.view)===null||t===void 0||(t=t.dom)===null||t===void 0)&&t.parentNode))return;const{selection:e}=this.editor.state,s=Q6(this.view,e.from,e.to);Q2({getBoundingClientRect:()=>s,getClientRects:()=>[s]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:r,middlewareData:l})=>{var a,c;if(!((a=l.hide)===null||a===void 0)&&a.referenceHidden||!((c=l.hide)===null||c===void 0)&&c.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const s=!e?.selection.eq(t.state.selection),n=!e?.doc.eq(t.state.doc);this.updateHandler(t,s,n,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)===null||t===void 0||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}};const qw=t=>new ud({key:typeof t.pluginKey=="string"?new Vi(t.pluginKey):t.pluginKey,view:e=>new HG({view:e,...t})});xi.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:t,dispatch:e})=>(e&&t.setMeta(this.options.pluginKey,"updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[qw({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Gw(t,e){return t??new Vi(e)}const KG=typeof window<"u"?P.useLayoutEffect:P.useEffect,Yw=new Set(["left","opacity","position","top","visibility","width"]),WG=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","columns","fillOpacity","flex","flexGrow","flexShrink","fontWeight","gridArea","gridColumn","gridColumnEnd","gridColumnStart","gridRow","gridRowEnd","gridRowStart","lineClamp","lineHeight","opacity","order","orphans","scale","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","zIndex","zoom"]),qG=new Set(["children","className","style"]),GG=new Set(["tabIndex"]),YG=new Set(["accessKey","autoCapitalize","contentEditable","contextMenu","dir","draggable","enterKeyHint","hidden","id","lang","nonce","role","slot","spellCheck","tabIndex","title","translate"]),JG={Blur:"focusout",DoubleClick:"dblclick",Focus:"focusin",MouseEnter:"mouseenter",MouseLeave:"mouseleave"};function Ip(t,e){return/^on[A-Z]/.test(t)&&typeof e=="function"}function QG(t){return t.startsWith("aria-")||t.startsWith("data-"),t}function XG(t){return t.startsWith("aria-")||t.startsWith("data-")||YG.has(t)}function Jw(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function ZG(t){var e;const s=t.endsWith("Capture"),n=(s?t.slice(0,-7):t).slice(2);return{eventName:(e=JG[n])!==null&&e!==void 0?e:n.toLowerCase(),options:s?{capture:!0}:void 0}}function eY(t,e){let s=e.defaultPrevented,n=!1;const i=Object.create(e);return Object.defineProperties(i,{nativeEvent:{value:e},currentTarget:{value:t},target:{value:e.target},persist:{value:()=>{}},isDefaultPrevented:{value:()=>s},isPropagationStopped:{value:()=>n},preventDefault:{value:()=>{s=!0,e.preventDefault()}},stopPropagation:{value:()=>{n=!0,e.stopPropagation()}}}),i}function im(t){return GG.has(t)}function hb(t,e,s){if(e==="tabIndex"){t.tabIndex=Number(s);return}t[e]=s}function tY(t,e){if(e==="tabIndex"){t.removeAttribute("tabindex");return}const s=t[e];if(typeof s=="boolean"){t[e]=!1;return}if(typeof s=="number"){t[e]=0;return}t[e]=""}function sY(t,e){return typeof e!="number"||e===0||t.startsWith("--")||WG.has(t)?String(e):`${e}px`}function nY(t,e){Yw.has(e)||t.style.removeProperty(Jw(e))}function iY(t,e,s){Yw.has(e)||t.style.setProperty(Jw(e),sY(e,s))}function rY(t,e,s){new Set([...Object.keys(e),...Object.keys(s)]).forEach(n=>{if(qG.has(n)||!XG(n)||Ip(n,e[n])||Ip(n,s[n]))return;const i=e[n],r=s[n];if(i===r)return;const l=QG(n);if(r==null||r===!1){im(n)&&tY(t,n),t.removeAttribute(l);return}if(r===!0){im(n)&&hb(t,n,!0),t.setAttribute(l,"");return}if(im(n)){hb(t,n,r);return}t.setAttribute(l,String(r))})}function oY(t,e,s){if(e!==s){if(s){t.className=s;return}t.removeAttribute("class")}}function lY(t,e,s){const n=e??{},i=s??{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(r=>{const l=n[r],a=i[r];if(l!==a){if(a==null){nY(t,r);return}iY(t,r,a)}})}function aY(t,e,s){e.forEach(({eventName:i,listener:r,options:l})=>{t.removeEventListener(i,r,l)});const n=[];return Object.entries(s).forEach(([i,r])=>{if(!Ip(i,r))return;const{eventName:l,options:a}=ZG(i),c=d=>{r(eY(t,d))};t.addEventListener(l,c,a),n.push({eventName:l,listener:c,options:a})}),n}function Qw(t,e){const s=P.useRef({}),n=P.useRef([]);KG(()=>{const i=s.current;return oY(t,i.className,e.className),lY(t,i.style,e.style),rY(t,i,e),n.current=aY(t,n.current,e),s.current=e,()=>{n.current.forEach(({eventName:r,listener:l,options:a})=>{t.removeEventListener(r,l,a)}),n.current=[]}},[t,e])}const cY=Nt.forwardRef(({pluginKey:t,editor:e,updateDelay:s,resizeDelay:n,appendTo:i,shouldShow:r=null,getReferencedVirtualElement:l,options:a,children:c,...d},h)=>{const u=P.useRef(document.createElement("div")),f=P.useRef(Gw(t,"bubbleMenu")).current;Qw(u.current,d),typeof h=="function"?h(u.current):h&&(h.current=u.current);const{editor:p}=i0(),m=e||p,g={updateDelay:s,resizeDelay:n,appendTo:i,pluginKey:f,shouldShow:r,getReferencedVirtualElement:l,options:a},x=P.useRef(g);x.current=g;const[b,y]=P.useState(!1),_=P.useRef(!0);return P.useEffect(()=>{if(m?.isDestroyed)return;if(!m){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=u.current;v.style.visibility="hidden",v.style.position="absolute";const L=Ww({...x.current,editor:m,element:v});m.registerPlugin(L);const S=x.current.pluginKey;return _.current=!0,y(!0),()=>{y(!1),m.unregisterPlugin(S),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[m]),P.useEffect(()=>{if(!(!b||!m||m.isDestroyed)){if(_.current){_.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:"updateOptions",options:x.current}))}},[b,m,s,n,r,a,i,l,f]),kn.createPortal(c,u.current)});Nt.forwardRef(({pluginKey:t,editor:e,updateDelay:s,resizeDelay:n,appendTo:i,shouldShow:r=null,options:l,children:a,...c},d)=>{const h=P.useRef(document.createElement("div")),u=P.useRef(Gw(t,"floatingMenu")).current;Qw(h.current,c),typeof d=="function"?d(h.current):d&&(d.current=h.current);const{editor:f}=i0(),p=e||f,m={updateDelay:s,resizeDelay:n,appendTo:i,pluginKey:u,shouldShow:r,options:l},g=P.useRef(m);g.current=m;const[x,b]=P.useState(!1),y=P.useRef(!0);return P.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const _=h.current;_.style.visibility="hidden",_.style.position="absolute";const v=qw({...g.current,editor:p,element:_});p.registerPlugin(v);const L=g.current.pluginKey;return y.current=!0,b(!0),()=>{b(!1),p.unregisterPlugin(L),window.requestAnimationFrame(()=>{_.parentNode&&_.parentNode.removeChild(_)})}},[p]),P.useEffect(()=>{if(!(!x||!p||p.isDestroyed)){if(y.current){y.current=!1;return}p.view.dispatch(p.state.tr.setMeta(u,{type:"updateOptions",options:g.current}))}},[x,p,s,n,r,l,i,u]),kn.createPortal(a,h.current)});const dY=new Set(["http:","https:","mailto:","tel:","ftp:"]);function Xw(t){if(t.startsWith("/")||t.startsWith(".")||t.startsWith("#"))return!0;try{const e=new URL(t,"https://placeholder.invalid");return dY.has(e.protocol)}catch{return!1}}function Zw(t){const e=t.trim();return e?e.startsWith("/")||e.startsWith(".")||e.startsWith("#")||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)?e:`https://${e}`:""}const uY="noopener noreferrer nofollow";function es(t){const e=z.c(8),{active:s,label:n,onClick:i,children:r}=t,l=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let a;e[0]!==l?(a=ie("flex h-7 w-7 items-center justify-center rounded transition-colors cursor-pointer",l),e[0]=l,e[1]=a):a=e[1];let c;return e[2]!==s||e[3]!==r||e[4]!==n||e[5]!==i||e[6]!==a?(c=o.jsx("button",{type:"button","aria-label":n,"aria-pressed":s,onMouseDown:hY,onClick:i,className:a,children:r}),e[2]=s,e[3]=r,e[4]=n,e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function hY(t){return t.preventDefault()}function fb(t){const e=z.c(7),{active:s,label:n,onSelect:i}=t,r=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let l;e[0]!==r?(l=ie("flex-1 rounded px-2 py-1 text-xs transition-colors cursor-pointer",r),e[0]=r,e[1]=l):l=e[1];let a;return e[2]!==s||e[3]!==n||e[4]!==i||e[5]!==l?(a=o.jsx("button",{type:"button","aria-pressed":s,onMouseDown:fY,onClick:i,className:l,children:n}),e[2]=s,e[3]=n,e[4]=i,e[5]=l,e[6]=a):a=e[6],a}function fY(t){return t.preventDefault()}function mY(t){const e=z.c(36),{editor:s,active:n,open:i,onOpenChange:r}=t,l=re(),[a,c]=P.useState(""),[d,h]=P.useState(!0),[u,f]=P.useState(!1);let p;e[0]!==n||e[1]!==s||e[2]!==r?(p=()=>{const N=s.getAttributes("link");c(typeof N.href=="string"?N.href:""),h(n?N.target==="_blank":!0),f(!1),r(!0)},e[0]=n,e[1]=s,e[2]=r,e[3]=p):p=e[3];const m=p;let g;e[4]!==s||e[5]!==r?(g=()=>{r(!1),s.chain().focus().run()},e[4]=s,e[5]=r,e[6]=g):g=e[6];const x=g;let b;e[7]!==a||e[8]!==s||e[9]!==d||e[10]!==r?(b=()=>{const N=Zw(a);if(N===""){s.chain().focus().extendMarkRange("link").unsetLink().run(),r(!1);return}if(!Xw(N)){f(!0);return}s.chain().focus().extendMarkRange("link").setLink({href:N,target:d?"_blank":null,rel:d?uY:null}).run(),r(!1)},e[7]=a,e[8]=s,e[9]=d,e[10]=r,e[11]=b):b=e[11];const y=b;let _;e[12]!==s||e[13]!==r?(_=()=>{s.chain().focus().extendMarkRange("link").unsetLink().run(),r(!1)},e[12]=s,e[13]=r,e[14]=_):_=e[14];const v=_;let L;e[15]!==l?(L=l("sectionsEditor.richTextLinkControl.linkButtonLabel"),e[15]=l,e[16]=L):L=e[16];const S=i?x:m;let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(ag,{size:14}),e[17]=w):w=e[17];let k;e[18]!==n||e[19]!==L||e[20]!==S?(k=o.jsx(es,{active:n,label:L,onClick:S,children:w}),e[18]=n,e[19]=L,e[20]=S,e[21]=k):k=e[21];let j;e[22]!==n||e[23]!==y||e[24]!==x||e[25]!==a||e[26]!==u||e[27]!==d||e[28]!==r||e[29]!==i||e[30]!==v||e[31]!==l?(j=i&&o.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 flex-col gap-1 rounded-md border bg-popover p-1 shadow-md",onBlur:N=>{N.currentTarget.contains(N.relatedTarget)||r(!1)},children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("input",{autoFocus:!0,type:"text","aria-label":l("sectionsEditor.richTextLinkControl.urlInputAriaLabel"),"aria-invalid":u,placeholder:l("sectionsEditor.richTextLinkControl.urlInputPlaceholder"),value:a,onChange:N=>{c(N.target.value),f(!1)},onKeyDown:N=>{N.key==="Enter"?(N.preventDefault(),y()):N.key==="Escape"&&(N.preventDefault(),x())},className:ie("h-7 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",u&&"text-destructive")}),o.jsx(es,{active:!1,label:l("sectionsEditor.richTextLinkControl.applyLinkLabel"),onClick:y,children:o.jsx(Kt,{size:14})}),n&&o.jsx(es,{active:!1,label:l("sectionsEditor.richTextLinkControl.removeLinkLabel"),onClick:v,children:o.jsx(Gs,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-0.5 rounded bg-muted/40 p-0.5",children:[o.jsx(fb,{active:!d,label:l("sectionsEditor.richTextLinkControl.sameTabLabel"),onSelect:()=>h(!1)}),o.jsx(fb,{active:d,label:l("sectionsEditor.richTextLinkControl.newTabLabel"),onSelect:()=>h(!0)})]})]}),e[22]=n,e[23]=y,e[24]=x,e[25]=a,e[26]=u,e[27]=d,e[28]=r,e[29]=i,e[30]=v,e[31]=l,e[32]=j):j=e[32];let C;return e[33]!==k||e[34]!==j?(C=o.jsxs("div",{className:"relative",children:[k,j]}),e[33]=k,e[34]=j,e[35]=C):C=e[35],C}function pY(t){const e=z.c(30),{editor:s}=t,n=re(),[i,r]=P.useState(!1),[l,a]=P.useState(""),[c,d]=P.useState(!1);let h;e[0]!==s?(h=s.isActive("link"),e[0]=s,e[1]=h):h=e[1];const u=h;let f;e[2]!==s||e[3]!==i?(f=()=>{if(i){r(!1);return}const w=s.getAttributes("link").href;a(typeof w=="string"?w:""),d(!1),r(!0)},e[2]=s,e[3]=i,e[4]=f):f=e[4];const p=f;let m;e[5]!==s?(m=()=>{s.chain().focus().extendMarkRange("link").unsetLink().run(),r(!1)},e[5]=s,e[6]=m):m=e[6];const g=m;let x;e[7]!==l||e[8]!==s||e[9]!==g?(x=()=>{const w=Zw(l);if(w===""){g();return}if(!Xw(w)){d(!0);return}s.chain().focus().extendMarkRange("link").setLink({href:w}).run(),r(!1)},e[7]=l,e[8]=s,e[9]=g,e[10]=x):x=e[10];const b=x;let y;e[11]!==n?(y=n("markdownEditor.link"),e[11]=n,e[12]=y):y=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ag,{size:14}),e[13]=_):_=e[13];let v;e[14]!==u||e[15]!==y||e[16]!==p?(v=o.jsx(es,{active:u,label:y,onClick:p,children:_}),e[14]=u,e[15]=y,e[16]=p,e[17]=v):v=e[17];let L;e[18]!==u||e[19]!==b||e[20]!==l||e[21]!==s||e[22]!==c||e[23]!==i||e[24]!==g||e[25]!==n?(L=i&&o.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md border bg-popover p-1 shadow-md",onBlur:w=>{w.currentTarget.contains(w.relatedTarget)||r(!1)},children:[o.jsx("input",{autoFocus:!0,type:"text","aria-label":n("markdownEditor.linkInputAriaLabel"),"aria-invalid":c,placeholder:n("markdownEditor.linkPlaceholder"),value:l,onChange:w=>{a(w.target.value),d(!1)},onKeyDown:w=>{w.key==="Enter"?(w.preventDefault(),b()):w.key==="Escape"&&(w.preventDefault(),r(!1),s.chain().focus().run())},className:ie("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",c&&"text-destructive")}),o.jsx(es,{active:!1,label:n("markdownEditor.linkApply"),onClick:b,children:o.jsx(Kt,{size:14})}),u&&o.jsx(es,{active:!1,label:n("markdownEditor.linkRemove"),onClick:g,children:o.jsx(Gs,{size:14})})]}),e[18]=u,e[19]=b,e[20]=l,e[21]=s,e[22]=c,e[23]=i,e[24]=g,e[25]=n,e[26]=L):L=e[26];let S;return e[27]!==v||e[28]!==L?(S=o.jsxs("div",{className:"relative",children:[v,L]}),e[27]=v,e[28]=L,e[29]=S):S=e[29],S}const rm=()=>{const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},mb=t=>{const e=z.c(2),{children:s}=t;let n;return e[0]!==s?(n=o.jsx("span",{className:"text-[11px] font-semibold leading-none",children:s}),e[0]=s,e[1]=n):n=e[1],n},eS=[1,2,3],gY=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function xY(t){const e=z.c(20),{editor:s}=t,n=re(),[i,r]=P.useState(null);let l;e[0]!==s?(l={editor:s,selector:bY},e[0]=s,e[1]=l):l=e[1];const a=X6(l);let c;e[2]!==n?(c=n("markdownEditor.heading1"),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==n?(d=n("markdownEditor.heading2"),e[4]=n,e[5]=d):d=e[5];let h;e[6]!==n?(h=n("markdownEditor.heading3"),e[6]=n,e[7]=h):h=e[7];let u;e[8]!==c||e[9]!==d||e[10]!==h?(u={1:c,2:d,3:h},e[8]=c,e[9]=d,e[10]=h,e[11]=u):u=e[11];const f=u;let p;e[12]!==s||e[13]!==f||e[14]!==i||e[15]!==a||e[16]!==n?(p=i&&o.jsxs(cY,{editor:s,shouldShow:gY,appendTo:i,className:"flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-md","aria-label":n("markdownEditor.toolbarAriaLabel"),children:[o.jsx(es,{active:a.bold,label:n("markdownEditor.bold"),onClick:()=>s.chain().focus().toggleBold().run(),children:o.jsx(w8,{size:14})}),o.jsx(es,{active:a.italic,label:n("markdownEditor.italic"),onClick:()=>s.chain().focus().toggleItalic().run(),children:o.jsx(S8,{size:14})}),o.jsx(es,{active:a.strike,label:n("markdownEditor.strikethrough"),onClick:()=>s.chain().focus().toggleStrike().run(),children:o.jsx(k8,{size:14})}),o.jsx(es,{active:a.code,label:n("markdownEditor.code"),onClick:()=>s.chain().focus().toggleCode().run(),children:o.jsx(ga,{size:14})}),o.jsx(rm,{}),eS.map((g,x)=>o.jsx(es,{active:a.headings[x]??!1,label:f[g],onClick:()=>s.chain().focus().toggleHeading({level:g}).run(),children:o.jsx(mb,{children:`H${g}`})},g)),o.jsx(rm,{}),o.jsx(es,{active:a.bulletList,label:n("markdownEditor.bulletList"),onClick:()=>s.chain().focus().toggleBulletList().run(),children:o.jsx(Bg,{size:14})}),o.jsx(es,{active:a.orderedList,label:n("markdownEditor.orderedList"),onClick:()=>s.chain().focus().toggleOrderedList().run(),children:o.jsx(mb,{children:"1."})}),o.jsx(es,{active:a.blockquote,label:n("markdownEditor.quote"),onClick:()=>s.chain().focus().toggleBlockquote().run(),children:o.jsx(TA,{size:14})}),o.jsx(rm,{}),o.jsx(pY,{editor:s})]}),e[12]=s,e[13]=f,e[14]=i,e[15]=a,e[16]=n,e[17]=p):p=e[17];let m;return e[18]!==p?(m=o.jsx("div",{ref:r,className:"relative z-20",children:p}),e[18]=p,e[19]=m):m=e[19],m}function bY(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:eS.map(s=>e.isActive("heading",{level:s})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}function K3(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Sa=K3();function tS(t){Sa=t}var Dl={exec:()=>null};function It(t,e=""){let s=typeof t=="string"?t:t.source,n={replace:(i,r)=>{let l=typeof r=="string"?r:r.source;return l=l.replace(Cn.caret,"$1"),s=s.replace(i,l),n},getRegex:()=>new RegExp(s,e)};return n}var vY=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Cn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},yY=/^(?:[ \t]*(?:\n|$))+/,_Y=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,LY=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,P0=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,wY=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,W3=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,sS=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nS=It(sS).replace(/bull/g,W3).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),SY=It(sS).replace(/bull/g,W3).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),q3=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,kY=/^[^\n]+/,G3=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,jY=It(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",G3).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),CY=It(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,W3).getRegex(),n1="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Y3=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,NY=It("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Y3).replace("tag",n1).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),iS=It(q3).replace("hr",P0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",n1).getRegex(),TY=It(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",iS).getRegex(),J3={blockquote:TY,code:_Y,def:jY,fences:LY,heading:wY,hr:P0,html:NY,lheading:nS,list:CY,newline:yY,paragraph:iS,table:Dl,text:kY},pb=It("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",P0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",n1).getRegex(),VY={...J3,lheading:SY,table:pb,paragraph:It(q3).replace("hr",P0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",n1).getRegex()},AY={...J3,html:It(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Y3).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Dl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:It(q3).replace("hr",P0).replace("heading",` *#{1,6} *[^
18
18
  ]`).replace("lheading",nS).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},PY=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,EY=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rS=/^( {2,}|\\)\n(?!\s*$)/,RY=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,kd=/[\p{P}\p{S}]/u,i1=/[\s\p{P}\p{S}]/u,Q3=/[^\s\p{P}\p{S}]/u,DY=It(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,i1).getRegex(),oS=/(?!~)[\p{P}\p{S}]/u,IY=/(?!~)[\s\p{P}\p{S}]/u,MY=/(?:[^\s\p{P}\p{S}]|~)/u,OY=It(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",vY?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),lS=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,$Y=It(lS,"u").replace(/punct/g,kd).getRegex(),BY=It(lS,"u").replace(/punct/g,oS).getRegex(),aS="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",zY=It(aS,"gu").replace(/notPunctSpace/g,Q3).replace(/punctSpace/g,i1).replace(/punct/g,kd).getRegex(),FY=It(aS,"gu").replace(/notPunctSpace/g,MY).replace(/punctSpace/g,IY).replace(/punct/g,oS).getRegex(),UY=It("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Q3).replace(/punctSpace/g,i1).replace(/punct/g,kd).getRegex(),HY=It(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,kd).getRegex(),KY="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",WY=It(KY,"gu").replace(/notPunctSpace/g,Q3).replace(/punctSpace/g,i1).replace(/punct/g,kd).getRegex(),qY=It(/\\(punct)/,"gu").replace(/punct/g,kd).getRegex(),GY=It(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),YY=It(Y3).replace("(?:-->|$)","-->").getRegex(),JY=It("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",YY).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Sf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,QY=It(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Sf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),cS=It(/^!?\[(label)\]\[(ref)\]/).replace("label",Sf).replace("ref",G3).getRegex(),dS=It(/^!?\[(ref)\](?:\[\])?/).replace("ref",G3).getRegex(),XY=It("reflink|nolink(?!\\()","g").replace("reflink",cS).replace("nolink",dS).getRegex(),gb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,X3={_backpedal:Dl,anyPunctuation:qY,autolink:GY,blockSkip:OY,br:rS,code:EY,del:Dl,delLDelim:Dl,delRDelim:Dl,emStrongLDelim:$Y,emStrongRDelimAst:zY,emStrongRDelimUnd:UY,escape:PY,link:QY,nolink:dS,punctuation:DY,reflink:cS,reflinkSearch:XY,tag:JY,text:RY,url:Dl},ZY={...X3,link:It(/^!?\[(label)\]\((.*?)\)/).replace("label",Sf).getRegex(),reflink:It(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Sf).getRegex()},Mp={...X3,emStrongRDelimAst:FY,emStrongLDelim:BY,delLDelim:HY,delRDelim:WY,url:It(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",gb).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:It(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",gb).getRegex()},eJ={...Mp,br:It(rS).replace("{2,}","*").getRegex(),text:It(Mp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},uh={normal:J3,gfm:VY,pedantic:AY},Bd={normal:X3,gfm:Mp,breaks:eJ,pedantic:ZY},tJ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xb=t=>tJ[t];function Xi(t,e){if(e){if(Cn.escapeTest.test(t))return t.replace(Cn.escapeReplace,xb)}else if(Cn.escapeTestNoEncode.test(t))return t.replace(Cn.escapeReplaceNoEncode,xb);return t}function bb(t){try{t=encodeURI(t).replace(Cn.percentDecode,"%")}catch{return null}return t}function vb(t,e){let s=t.replace(Cn.findPipe,(r,l,a)=>{let c=!1,d=l;for(;--d>=0&&a[d]==="\\";)c=!c;return c?"|":" |"}),n=s.split(Cn.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(Cn.slashPipe,"|");return n}function zd(t,e,s){let n=t.length;if(n===0)return"";let i=0;for(;i<n&&t.charAt(n-i-1)===e;)i++;return t.slice(0,n-i)}function sJ(t,e){if(t.indexOf(e[1])===-1)return-1;let s=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])s++;else if(t[n]===e[1]&&(s--,s<0))return n;return s>0?-2:-1}function nJ(t,e=0){let s=e,n="";for(let i of t)if(i===" "){let r=4-s%4;n+=" ".repeat(r),s+=r}else n+=i,s++;return n}function yb(t,e,s,n,i){let r=e.href,l=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let c={type:t[0].charAt(0)==="!"?"image":"link",raw:s,href:r,title:l,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,c}function iJ(t,e,s){let n=t.match(s.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
19
19
  `).map(r=>{let l=r.match(s.other.beginningSpace);if(l===null)return r;let[a]=l;return a.length>=i.length?r.slice(i.length):r}).join(`
20
20
  `)}var kf=class{options;rules;lexer;constructor(t){this.options=t||Sa}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let s=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?s:zd(s,`
@@ -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 S;return e[28]!==v||e[29]!==u?(S=o.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[u,v,L]}),e[28]=v,e[29]=u,e[30]=S):S=e[30],S}function bh(t){const e=z.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,h=l?0:a?1:r===1?.8:.55,u=l?10:30-r,f=!a;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=ie("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=p):p=e[0];const m=`translateY(${c}px) scale(${d})`,g=a?"auto":"none";let x;e[1]!==h||e[2]!==m||e[3]!==g||e[4]!==u?(x={transform:m,opacity:h,zIndex:u,transitionDuration:"1000ms",pointerEvents:g},e[1]=h,e[2]=m,e[3]=g,e[4]=u,e[5]=x):x=e[5];let b;return e[6]!==i||e[7]!==f||e[8]!==x?(b=o.jsx("div",{"aria-hidden":f,className:p,style:x,children:i}),e[6]=i,e[7]=f,e[8]=x,e[9]=b):b=e[9],b}function u1(t){const e=z.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:ie("size-2.5 rounded-full",oi)}),r=o.jsx("div",{className:ie("size-2.5 rounded-full",oi)}),l=o.jsx("div",{className:ie("size-2.5 rounded-full",oi)}),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:ie("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",nr)}),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 Rse(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(u1,{}),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:Nse.map(Dse)})})]}),t[1]=s):s=t[1],s}function Dse(t,e){if(e===Tk)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:ie("relative rounded-md",oi),children:o.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${Vk}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function Ise(){const t=z.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(u1,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:ie("w-[18%] rounded-md",nr),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:ie("rounded-md",nr),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),o.jsx("div",{className:ie("rounded-md",nr),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=r):r=t[4],r}function Mse(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(u1,{}),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:Ase.map(Ose)})})]}),t[1]=s):s=t[1],s}function Ose(t,e){return o.jsx("div",{className:ie("aspect-square rounded-md",Pse[e]?"bg-chart-2/70":oi),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function $se(){const t=z.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(u1,{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:ie("h-1.5 w-[70%] rounded-sm",oi)}),i=o.jsx("div",{className:ie("h-1.5 w-[55%] rounded-sm",oi)}),r=o.jsx("div",{className:ie("h-1.5 w-[80%] rounded-sm",oi)}),l=o.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",oi)}),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:ie("h-4 rounded-md",oi)})})]}),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:ie("h-1.5 w-[55%] rounded-sm",nr)})]})}),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:ie("h-4 w-10 rounded-full",nr)}),o.jsx("div",{className:ie("h-4 w-14 rounded-full",nr)})]}),t[8]=d):d=t[8];let h;t[9]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsxs("div",{className:ie("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",nr),children:[o.jsx("div",{className:ie("h-1.5 w-[50%] rounded-sm",oi)}),o.jsx("div",{className:ie("h-1 w-[75%] rounded-sm",oi)})]}),t[9]=h):h=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"flex h-full flex-col",children:[e,o.jsxs("div",{className:"flex min-h-0 flex-1",children:[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:[h,o.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[o.jsx("div",{className:ie("rounded-md",nr)}),o.jsx("div",{className:ie("rounded-md",nr)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function Kc(t){const e=z.c(52),s=re();if(t.kind==="starting"){let p;return e[0]!==t.claimPhase||e[1]!==t.progress?(p=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsx(Ese,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=p):p=e[2],p}if(t.kind==="errored"){const p=t.error.code===bp.githubNotAuthenticated,m=t.error.code===bp.githubConnectionMissing;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(go,{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 y;e[8]!==m||e[9]!==p||e[10]!==t.error.message||e[11]!==s?(y=m?s("sandbox.stateCard.githubConnectionMissingMessage"):p?s("sandbox.stateCard.githubNotAuthenticatedMessage"):t.error.message,e[8]=m,e[9]=p,e[10]=t.error.message,e[11]=s,e[12]=y):y=e[12];let _;e[13]!==y?(_=o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:y}),e[13]=y,e[14]=_):_=e[14];let v;e[15]!==m||e[16]!==p||e[17]!==t.connectionsHref||e[18]!==s?(v=(p||m)&&t.connectionsHref&&o.jsx(me,{asChild:!0,children:o.jsx("a",{href:t.connectionsHref,children:s(m?"sandbox.stateCard.linkRepoAgain":"sandbox.stateCard.reconnectGithub")})}),e[15]=m,e[16]=p,e[17]=t.connectionsHref,e[18]=s,e[19]=v):v=e[19];const L=t.onRetry;let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx($n,{className:"size-4"}),e[20]=S):S=e[20];let w;e[21]!==s?(w=s("sandbox.stateCard.retry"),e[21]=s,e[22]=w):w=e[22];let k;e[23]!==t.onRetry||e[24]!==w?(k=o.jsxs(me,{variant:"outline",onClick:L,children:[S," ",w]}),e[23]=t.onRetry,e[24]=w,e[25]=k):k=e[25];let j;e[26]!==v||e[27]!==k?(j=o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[v,k]}),e[26]=v,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(RA,{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(ql,{className:"size-4"}),e[42]=d):d=e[42];let h;e[43]!==s?(h=s("sandbox.stateCard.resume"),e[43]=s,e[44]=h):h=e[44];let u;e[45]!==t.onResume||e[46]!==h?(u=o.jsxs(me,{onClick:c,className:"mt-2",children:[d," ",h]}),e[45]=t.onResume,e[46]=h,e[47]=u):u=e[47];let f;return e[48]!==r||e[49]!==a||e[50]!==u?(f=o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[n,r,a,u]})}),e[48]=r,e[49]=a,e[50]=u,e[51]=f):f=e[51],f}function gx(t,e,s){return`deco:preview:last-page:${t}:${e}:${s}`}function Bse(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 xx(t){try{return Bse(localStorage.getItem(t))}catch{return null}}function zse(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function Ak(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 ev="site-links",Fse=/details?page|\bpdp\b/i,Use=/listingpage|\bplp\b/i;function Hse(t,e,s){const n=new Set;for(const a of s)Fse.test(a)&&n.add("product"),Use.test(a)&&n.add("category");const i=uf(il(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 Kse=["rosa","preto","pink","black"];function vh(t,e){const s=e.trim();return s?t(s):Kse.flatMap(n=>t(n))}function Wse(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 Pk=new Set(["vtex","shopify","shopify-mcp","magento","wake","linx","linx-impulse","nuvemshop","vnda","wap","salesforce"]);function bx(t){return t.split("/")[0]??""}function qse(t){const e=new Set;for(const s of t){const n=bx(s);Pk.has(n)&&e.add(n)}return e}function Gse(t,e){const s=bx(t);return!Pk.has(s)||e.size===0?!0:e.has(s)}const Yse=[{kind:"product",test:t=>t==="vtex/loaders/intelligentSearch/productList.ts",clientFilter:!1,buildRequests:(t,e)=>vh(s=>Wse(t,s),e),optionsFromPayload:yh},{kind:"product",test:t=>/magento\/.*products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>vh(s=>[{resolveType:t,props:{props:{search:s,pageSize:10,currentPage:1}}}],e),optionsFromPayload:yh},{kind:"product",test:t=>/algolia\/.*products?\/(list|suggestions)(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>vh(s=>[{resolveType:t,props:{term:s,hitsPerPage:10}}],e),optionsFromPayload:yh},{kind:"product",test:t=>/products?\/list(\.tsx?)?$/i.test(t),clientFilter:!1,buildRequests:(t,e)=>vh(s=>[{resolveType:t,props:{query:s,term:s,count:10,hitsPerPage:10}}],e),optionsFromPayload:yh},{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:sne}];function Jse(t,e,s=new Set){const n=[...e],i=a=>{const c=[];for(const d of Yse){if(d.kind!==a)continue;const h=n.find(u=>d.test(u)&&Gse(u,s));h&&c.push({cand:d,resolveType:h})}return c.find(d=>s.has(bx(d.resolveType)))??c[0]},r=(a,c,d)=>({kind:a.kind,id:`${a.kind}:${c}`,resolveType:c,clientFilter:a.clientFilter,isFallback:d,buildRequests:h=>a.buildRequests(c,h),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(Qse(t.has("category")?"category":"product")),l}function Qse(t){return{kind:t,id:ev,resolveType:ev,clientFilter:!0,isFallback:!0,homepageLinks:!0,optionsFromPayload:(e,s)=>lne(e,s)}}function Ol(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Xse(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=Ol(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=Ol(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 Ek(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 Rk(t){try{return decodeURIComponent(t)}catch{return t}}function Zse(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ene(t){const e=[];let s="^";for(const n of t)n.type==="text"?s+=Zse(n.text):(e.push(n.name),s+=n.name==="*"?"(.+)":"([^/]+)");return{pattern:new RegExp(`${s}$`),order:e}}function Dk(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=uf(il(e)),{pattern:r,order:l}=ene(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?Rk(d):null}function yh(t,e){const s=Ol(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=Ol(l);if(!a)continue;const c=Dk(a.url,e.template,e.paramName);if(!c||r.has(c))continue;r.add(c);const d=Ol(a.isVariantOf),h=typeof d?.name=="string"&&d.name||typeof a.name=="string"&&a.name||c,u=Array.isArray(a.image)?Ol(a.image[0]):null,f=typeof u?.url=="string"?u.url:void 0;i.push({value:c,label:h,image:f})}return i}function tne(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?Rk(s):null}function sne(t){const e=[],s=new Set,n=(i,r)=>{const l=Ol(i);if(!l)return;const a=typeof l.name=="string"&&l.name?l.name:"",c=a?[...r,a]:r,d=tne(l.url);if(d&&!s.has(d)&&(s.add(d),e.push({value:d,label:c.join(" › ")||d})),Array.isArray(l.children))for(const h of l.children)n(h,c)};if(Array.isArray(t))for(const i of t)n(i,[]);return e}const nne=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 ine(t){return(t.split("/").filter(Boolean).pop()??t).replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,s=>s.toUpperCase())}function rne(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 one(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 lne(t,e){const s=[],n=new Set,i=(r,l,a,c)=>{if(s.length>=200)return;const d=Dk(r,e.template,e.paramName);!d||n.has(d)||e.paramName==="*"&&/(^|\/)p$/.test(d)||a==="category"&&nne.has(d.split("/")[0]??"")||(n.add(d),s.push({value:d,label:l&&l.length<=80?l:ine(d),kind:a,image:c}))};for(const{url:r,name:l,image:a}of one(t))i(r,l,"product",a);for(const{href:r,text:l}of rne(t))r.startsWith("/")&&!r.startsWith("//")&&i(r,l,"category");return s}function Hd(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 Ik=1e4;function ane(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 cne(t,{resolveType:e,props:s}){const n=await fetch(X_(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Ik)});if(!n.ok)throw new Error(`Failed to fetch options: ${n.status}`);return n.json()}async function tv(t,e){const s=await fetch(Q_(t,e),{signal:AbortSignal.timeout(Ik)});if(!s.ok)throw new Error(`Failed to fetch page: ${s.status}`);return s.text()}async function dne(t,e,s){const n=e.optionsFromPayload(await tv(t,"/"),s),i=n.find(l=>l.kind==="category");if(!i)return n;const r=Ur(s.template,{[s.paramName]:i.value});if(r==="/")return n;try{const l=e.optionsFromPayload(await tv(t,r),s).filter(a=>a.kind==="product");return Ek([n,l])}catch{return n}}function une(t,e,s){return Ge.sandboxInvoke(`${t.orgSlug}/${t.virtualMcpId}/${t.branch}`,`path-param-${e.id}:${e.clientFilter?"":s}`)}async function hne(t,e,s,n){if(e.homepageLinks)return dne(t,e,n);const i=e.buildRequests?.(s)??[];if(i.length===0)return[];const r=await Promise.allSettled(i.map(a=>cne(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 Ek(l.map(a=>e.optionsFromPayload(a,n)))}function qp(t,e,s,n,i){return{queryKey:une(t,e,s),queryFn:()=>hne(t,e,s,n),enabled:i,staleTime:6e4,retry:1}}function Kd(t){const e=z.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 u;e[7]!==n||e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r?(u=f=>o.jsxs(Ft,{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(l0,{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:Ur(r,{[l]:f.value})})]})]},`${a}:${f.value}`),e[7]=n,e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=u):u=e[12],d=i.map(u),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 h;return e[13]!==s||e[14]!==d?(h=o.jsx(os,{heading:s,children:d}),e[13]=s,e[14]=d,e[15]=h):h=e[15],h}function sv(t){const e=z.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 fne(t){const e=z.c(52),{sources:s,template:n,paramName:i,value:r,sandboxRef:l,onCommit:a}=t,c=re(),[d,h]=P.useState(!1),[u,f]=P.useState(""),[p,m]=P.useState(""),g=P.useRef(null),x=i==="*"?c("sandbox.preview.catchAllParamLabel"):`:${i}`,b=ane(c),_=[...new Set(s.map(Te=>b[Te.kind].noun))].join(" or ");let v;e[0]!==c||e[1]!==_?(v=c("sandbox.pathParamPickerChip.searchPlaceholder",{options:_}),e[0]=c,e[1]=_,e[2]=v):v=e[2];const L=v,S={template:n,paramName:i};let w;e[3]!==u?(w=(Te,Me)=>({source:Te,query:Me,options:Te.clientFilter?Hd(Me.data??[],u):Me.data??[]}),e[3]=u,e[4]=w):w=e[4];const k=w,j=s.filter(_ne),C=s.filter(yne),N=ep({queries:j.map(Te=>qp(l,Te,p,S,d))});let T;e[5]!==N||e[6]!==k?(T=(Te,Me)=>k(Te,N[Me]),e[5]=N,e[6]=k,e[7]=T):T=e[7];const V=j.map(T),A=V.length===0||V.every(vne),E=ep({queries:C.map(Te=>qp(l,Te,p,S,d&&A))});let R;e[8]!==E||e[9]!==k?(R=(Te,Me)=>k(Te,E[Me]),e[8]=E,e[9]=k,e[10]=R):R=e[10];const D=C.map(R),I=A?D:V,O=I.length===1&&I[0]?.source.homepageLinks?I[0]:null,M=O&&!O.query.isLoading&&!O.query.isError?O?.query.data??[]:[],$=Hd(M.filter(bne),u),B=Hd(M.filter(xne),u),U=$.length>0&&B.length>0,H=Te=>{h(Te),g.current&&clearTimeout(g.current),f(Te?r:""),m(Te?r:"")};let W;e[11]===Symbol.for("react.memo_cache_sentinel")?(W=Te=>{f(Te),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{m(Te)},300)},e[11]=W):W=e[11];const K=W,G=Te=>{a(Te),H(!1)},Y=rL(u),X=Ur(n,{[i]:Y}),te=qt,se=Wt,ne="flex h-[85svh] flex-col gap-0 overflow-hidden p-0 sm:h-[520px] sm:max-w-[560px]",Q=gne;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 le;e[15]!==q?(le=o.jsx(ms,{className:"sr-only",children:o.jsx(Jt,{children:q})}),e[15]=q,e[16]=le):le=e[16];let J;e[17]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(l0,{size:16,className:"shrink-0 text-foreground"}),e[17]=J):J=e[17];let oe;e[18]!==c?(oe=c("sandbox.pathParamPickerChip.pickValueHeading"),e[18]=c,e[19]=oe):oe=e[19];let ee;e[20]!==x?(ee=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]=ee):ee=e[21];let he;e[22]!==oe||e[23]!==ee?(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:[oe," ",ee]})]}),e[22]=oe,e[23]=ee,e[24]=he):he=e[24];const ae=Fn,de=!1,ue="min-h-0 flex-1";let pe;e[25]!==L||e[26]!==u?(pe=o.jsx(An,{autoFocus:!0,placeholder:L,value:u,onValueChange:K}),e[25]=L,e[26]=u,e[27]=pe):pe=e[27];const Z=Pn,ge="flex max-h-none min-h-0 flex-1 flex-col overflow-hidden";let be;e[28]!==c?(be=c("sandbox.pathParamPickerChip.noResults"),e[28]=c,e[29]=be):be=e[29];let ke;e[30]!==be?(ke=o.jsx(hn,{children:be}),e[30]=be,e[31]=ke):ke=e[31];const we=Y&&o.jsx(os,{className:"shrink-0",children:o.jsxs(Ft,{value:`__raw__:${Y}`,className:"gap-3 py-2",onSelect:()=>G(Y),children:[o.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted",children:o.jsx(bo,{size:14,className:"text-muted-foreground"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm",children:c("sandbox.pathParamPickerChip.useRawValue",{rawTerm:Y,paramLabel:x})}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:X})]})]})}),Le=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(Kd,{heading:b.category.heading,iconKind:"category",options:$,template:n,paramName:i,keyPrefix:`${O?.source.id}:cat`,onSelect:G})}),o.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:o.jsx(Kd,{heading:b.product.heading,iconKind:"product",options:B,template:n,paramName:i,keyPrefix:`${O?.source.id}:prod`,onSelect:G})})]}):o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:I.map(Te=>{const{source:Me,query:Qe,options:We}=Te,{noun:Ve}=b[Me.kind];if(Qe.isLoading)return o.jsx(sv,{text:c("sandbox.pathParamPickerChip.loading",{noun:Ve})},Me.id);if(Qe.isError)return o.jsx(sv,{text:c("sandbox.pathParamPickerChip.couldNotLoad")},Me.id);if(Me.homepageLinks){const De=Qe.data??[];return o.jsxs(P.Fragment,{children:[o.jsx(Kd,{heading:b.category.heading,iconKind:"category",options:Hd(De.filter(pne),u),template:n,paramName:i,keyPrefix:`${Me.id}:cat`,onSelect:G}),o.jsx(Kd,{heading:b.product.heading,iconKind:"product",options:Hd(De.filter(mne),u),template:n,paramName:i,keyPrefix:`${Me.id}:prod`,onSelect:G})]},Me.id)}return o.jsx(Kd,{heading:I.length>1?b[Me.kind].heading:void 0,iconKind:Me.kind,options:We,template:n,paramName:i,keyPrefix:Me.id,onSelect:G},Me.id)})});let _e;e[32]!==Z||e[33]!==ke||e[34]!==we||e[35]!==Le?(_e=o.jsxs(Z,{className:ge,children:[ke,we,Le]}),e[32]=Z,e[33]=ke,e[34]=we,e[35]=Le,e[36]=_e):_e=e[36];let Ce;e[37]!==ae||e[38]!==pe||e[39]!==_e?(Ce=o.jsxs(ae,{shouldFilter:de,className:ue,children:[pe,_e]}),e[37]=ae,e[38]=pe,e[39]=_e,e[40]=Ce):Ce=e[40];let xe;e[41]!==se||e[42]!==le||e[43]!==he||e[44]!==Ce||e[45]!==Q?(xe=o.jsxs(se,{className:ne,onClick:Q,children:[le,he,Ce]}),e[41]=se,e[42]=le,e[43]=he,e[44]=Ce,e[45]=Q,e[46]=xe):xe=e[46];let Ne;return e[47]!==te||e[48]!==H||e[49]!==d||e[50]!==xe?(Ne=o.jsx(te,{open:d,onOpenChange:H,children:xe}),e[47]=te,e[48]=H,e[49]=d,e[50]=xe,e[51]=Ne):Ne=e[51],o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",title:c("sandbox.pathParamPickerChip.buttonTitle",{paramLabel:x}),className:"max-w-64 shrink-0 cursor-pointer truncate rounded-sm bg-violet-500/15 px-1 py-0.5 text-[12px] text-violet-600 hover:bg-violet-500/25 dark:text-violet-400",onClick:Te=>{Te.stopPropagation(),H(!0)},children:r||x}),Ne]})}function mne(t){return t.kind==="product"}function pne(t){return t.kind!=="product"}function gne(t){return t.stopPropagation()}function xne(t){return t.kind==="product"}function bne(t){return t.kind!=="product"}function vne(t){return!t.query.isLoading&&(t.query.isError||t.options.length===0)}function yne(t){return t.isFallback}function _ne(t){return!t.isFallback}function Lne(t){const e=z.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 p={template:n,paramName:i},m=s.filter(wne);c=ep,a=m.map(g=>qp(r,g,"",p,!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 h=c(d),[u,f]=P.useState(!1);if(!u)for(const p of h){if(p.isLoading)break;const m=p.data?.[0];if(m){f(!0),queueMicrotask(()=>l(m.value));break}}return null}function wne(t){return!t.isFallback}function Sne(t){const e=z.c(31),{name:s,value:n,onCommit:i}=t,r=re(),[l,a]=P.useState(n),[c,d]=P.useState(!1),h=P.useRef(!1);let u;e[0]!==s||e[1]!==r?(u=s==="*"?r("sandbox.preview.catchAllParamLabel"):`:${s}`,e[0]=s,e[1]=r,e[2]=u):u=e[2];const f=u,p=l||f;let m;e[3]!==p?(m=o.jsx("span",{"aria-hidden":!0,className:"invisible whitespace-pre px-1 py-0.5 text-[12px]",children:p}),e[3]=p,e[4]=m):m=e[4];let g;e[5]!==f||e[6]!==r?(g=r("sandbox.preview.valueForParam",{label:f}),e[5]=f,e[6]=r,e[7]=g):g=e[7];let x,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=k=>a(k.target.value),b=()=>d(!0),e[8]=x,e[9]=b):(x=e[8],b=e[9]);let y;e[10]!==n?(y=k=>{k.key==="Enter"&&k.currentTarget.blur(),k.key==="Escape"&&(h.current=!0,a(n),k.currentTarget.blur())},e[10]=n,e[11]=y):y=e[11];let _;e[12]!==l||e[13]!==i||e[14]!==n?(_=()=>{if(d(!1),h.current){h.current=!1;return}const k=rL(l);a(k),k!==n&&i(k)},e[12]=l,e[13]=i,e[14]=n,e[15]=_):_=e[15];let v;e[16]!==l||e[17]!==f||e[18]!==g||e[19]!==y||e[20]!==_?(v=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:kne,onChange:x,onFocus:b,onKeyDown:y,onBlur:_}),e[16]=l,e[17]=f,e[18]=g,e[19]=y,e[20]=_,e[21]=v):v=e[21];let L;e[22]!==m||e[23]!==v?(L=o.jsxs("span",{className:"relative inline-flex max-w-64 shrink-0 items-center overflow-hidden",children:[m,v]}),e[22]=m,e[23]=v,e[24]=L):L=e[24];let S;e[25]!==c||e[26]!==r?(S=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(DA,{size:10}),r("sandbox.preview.enterToGo")]}),e[25]=c,e[26]=r,e[27]=S):S=e[27];let w;return e[28]!==S||e[29]!==L?(w=o.jsxs(o.Fragment,{children:[L,S]}),e[28]=S,e[29]=L,e[30]=w):w=e[30],w}function kne(t){return t.stopPropagation()}const jne={loaders:"loader",actions:"action"},Mk=new Set(["workflows"]);function Ok(t){return jne[t]}function $k(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 Cne(t,e,s){return/\.tsx?$/.test(e)?!0:$k(t,e,s)}function Nne(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 Tne(t,e){return/\.tsx?$/.test(t)?!1:e.has(`${t}.ts`)||e.has(`${t}.tsx`)}function Bk(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")||hL.has(r)||Mk.has(vx(r))||Tne(r,i))continue;const l=_l(r,t);if(l.hidden)continue;const a=l.title&&l.title!==r?l.title:ws(r);n.push({resolveType:r,title:a})}return n.sort((r,l)=>r.title.localeCompare(l.title))}function nv(t,e){return Bk(t,e).length}function vx(t){return t.startsWith("deco-sites/")?t.split("/")[1]||"site":t.startsWith("$live")||t.startsWith("deco/")?"deco":t.split("/")[0]||"other"}const Vne={deco:"Deco",std:"Deco Standard",website:"Website"};function Ane(t){return Vne[t]??t}function zk(t){const e=vx(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 Fk(t,e,s){const n=[];for(const[i,r]of Object.entries(e)){if(Cne(t,i,s)||z9(i)||!r||typeof r!="object"||Array.isArray(r))continue;const l=r,a=l.__resolveType;typeof a=="string"&&(hL.has(a)||Mk.has(vx(a))||$k(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 Uk(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 Hk(t){const e=z.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=Ge.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=mo({orgSlug:s,virtualMcpId:n,branch:i,threadId:r},"config"),p=await fetch(f);return p.ok?(await p.json()).repoDir??null:null},e[5]=i,e[6]=s,e[7]=r,e[8]=n,e[9]=d):d=e[9];let h;return e[10]!==a||e[11]!==c||e[12]!==d?(h={queryKey:c,queryFn:d,enabled:a,staleTime:1/0},e[10]=a,e[11]=c,e[12]=d,e[13]=h):h=e[13],Tt(h).data??null}const Pne={target:null,editSeoPageKey:null,variantOverride:null};function Ene(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 Kk=P.createContext(null);function iv(t){const e=z.c(9),{children:s}=t,[n,i]=P.useReducer(Ene,Pne);let r,l,a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=u=>i({type:"select",target:u}),l=u=>i({type:"edit-seo",target:u}),a=()=>i({type:"consume-edit-seo"}),c=u=>i({type:"variant-override",params:u}),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 h;return e[6]!==s||e[7]!==d?(h=o.jsx(Kk,{value:d,children:s}),e[6]=s,e[7]=d,e[8]=h):h=e[8],h}function Wk(){const t=P.use(Kk);if(!t)throw new Error("useBlocksPreviewWorkspace must be used inside BlocksPreviewWorkspaceProvider");return t}const qk=P.createContext(!1),Rne=qk.Provider;function h1(){return P.useContext(qk)}function Gk(t){const e=z.c(6),{readOnly:s,className:n,children:i}=t;let r;e[0]!==i||e[1]!==s?(r=o.jsx(Rne,{value:s,children:i}),e[0]=i,e[1]=s,e[2]=r):r=e[2];let l;return e[3]!==n||e[4]!==r?(l=o.jsx("div",{className:n,children:r}),e[3]=n,e[4]=r,e[5]=l):l=e[5],l}function Dne(t){const e=z.c(12),{children:s}=t,n=re();let i;e[0]!==s?(i=o.jsx("div",{inert:!0,children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"absolute inset-0 cursor-not-allowed"}),e[2]=r):r=e[2];let l;e[3]!==i?(l=o.jsx(Fe,{asChild:!0,children:o.jsxs("div",{className:"relative opacity-70",children:[i,r]})}),e[3]=i,e[4]=l):l=e[4];let a;e[5]!==n?(a=n("sectionsEditor.readOnlyFieldTooltip"),e[5]=n,e[6]=a):a=e[6];let c;e[7]!==a?(c=o.jsx(Ue,{className:"max-w-[240px]",children:a}),e[7]=a,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=o.jsxs(He,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function yx(t){return(e,s)=>{UP(e),t(e,s)}}const Ine="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function f1(t){return bs(t)?.metadata?.fieldDescriptionTooltips??!1}function _x(t){const e=z.c(9),{description:s,virtualMcpId:n,children:i}=t,r=f1(n);if(!s||!r)return i;let l;e[0]!==i?(l=P.cloneElement(i,{className:ie(i.props.className,Ine)}),e[0]=i,e[1]=l):l=e[1];let a;e[2]!==l?(a=o.jsx(Fe,{asChild:!0,children:l}),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==s?(c=o.jsx(Ue,{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(He,{delayDuration:300,children:[a,c]}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Ks(t){const e=z.c(17),{htmlFor:s,label:n,description:i,labelClassName:r,virtualMcpId:l}=t;if(!f1(l)){let h;e[0]!==s||e[1]!==n||e[2]!==r?(h=o.jsx(Ot,{htmlFor:s,className:r,children:n}),e[0]=s,e[1]=n,e[2]=r,e[3]=h):h=e[3];let u;e[4]!==i?(u=i&&o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[4]=i,e[5]=u):u=e[5];let f;return e[6]!==h||e[7]!==u?(f=o.jsxs("div",{className:"space-y-0.5",children:[h,u]}),e[6]=h,e[7]=u,e[8]=f):f=e[8],f}let c;e[9]!==s||e[10]!==n||e[11]!==r?(c=o.jsx(Ot,{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(_x,{description:i,virtualMcpId:l,children:c}),e[13]=i,e[14]=c,e[15]=l,e[16]=d):d=e[16],d}const Mne=xi.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 One=Mne;const $ne=20,Yk=(t,e=0)=>{const s=[];return!t.children.length||e>$ne||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?s.push(n):n.children.length&&s.push(...Yk(n,e+1))}),s},Bne=t=>{if(!t.children.length)return;const e=Yk(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}`)})},Jk=IV.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Bne(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",gr(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}}}}),zne=xi.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const s=(e=r0(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()}}}),Qk=xi.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const s=(e=r0(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()}}}),Fne=xi.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>{var e;return(e=r0(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()}}}),Xk=xi.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>{var e;return(e=r0(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()}}}),Une=xi.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>{var e;return(e=r0(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()}}});xi.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(zne.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(Qk.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Fne.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(Xk.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Une.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(Jk.configure(this.options.textStyle)),t}});const Hne=["#000000","#525252","#a3a3a3","#ffffff","#e11d48","#ea580c","#ca8a04","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"];function Kne(t){const e=z.c(30),{editor:s,currentColor:n,open:i,onOpenChange:r}=t,l=re(),[a,c]=P.useState("#000000");let d;e[0]!==s||e[1]!==r?(d=S=>{s.chain().focus().setColor(S).run(),r(!1)},e[0]=s,e[1]=r,e[2]=d):d=e[2];const h=d;let u;e[3]!==s||e[4]!==r?(u=()=>{s.chain().focus().unsetColor().run(),r(!1)},e[3]=s,e[4]=r,e[5]=u):u=e[5];const f=u,p=i||n!==null;let m;e[6]!==l?(m=l("sectionsEditor.richTextColorControl.colorButtonLabel"),e[6]=l,e[7]=m):m=e[7];let g;e[8]!==r||e[9]!==i?(g=()=>r(!i),e[8]=r,e[9]=i,e[10]=g):g=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(sp,{size:14}),e[11]=x):x=e[11];const b=n??"currentColor";let y;e[12]!==b?(y=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]=y):y=e[13];let _;e[14]!==p||e[15]!==m||e[16]!==g||e[17]!==y?(_=o.jsx(es,{active:p,label:m,onClick:g,children:y}),e[14]=p,e[15]=m,e[16]=g,e[17]=y,e[18]=_):_=e[18];let v;e[19]!==h||e[20]!==f||e[21]!==n||e[22]!==a||e[23]!==r||e[24]!==i||e[25]!==l?(v=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:S=>{S.currentTarget.contains(S.relatedTarget)||r(!1)},children:[o.jsx("div",{className:"grid grid-cols-6 gap-1",children:Hne.map(S=>o.jsx("button",{type:"button","aria-label":S,"aria-pressed":n===S,onMouseDown:Gne,onClick:()=>h(S),className:ie("h-6 w-6 rounded border border-border/60 transition-transform cursor-pointer hover:scale-110",n===S&&"ring-2 ring-ring ring-offset-1"),style:{backgroundColor:S}},S))}),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:qne,onChange:S=>c(S.target.value),onBlur:()=>h(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:Wne,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]=h,e[20]=f,e[21]=n,e[22]=a,e[23]=r,e[24]=i,e[25]=l,e[26]=v):v=e[26];let L;return e[27]!==v||e[28]!==_?(L=o.jsxs("div",{className:"relative",children:[_,v]}),e[27]=v,e[28]=_,e[29]=L):L=e[29],L}function Wne(t){return t.preventDefault()}function qne(t){return t.stopPropagation()}function Gne(t){return t.preventDefault()}const _h=[1,2,3,4,5,6];function Yne(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 Jne=8,Qne=128,Xne=16,rv=1;function Zne({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r,inline:l=!1}){const a=re(),c=typeof e=="string"?e:"",d=P.useRef(s);d.current=s;const[h,u]=P.useState(!1),[f,p]=P.useState(!1),m=n9({extensions:[i9.configure({heading:l?!1:{levels:[..._h]},bulletList:l?!1:void 0,orderedList:l?!1:void 0,listItem:l?!1:void 0,blockquote:l?!1:void 0,link:{HTMLAttributes:{}}}),...l?[]:[One.configure({types:["heading","paragraph"]})],Jk,Xk,Qk],content:c||"",editorProps:{attributes:{class:ie("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:L})=>{const S=L.getHTML(),w=l?Yne(S):S;d.current(w==="<p></p>"||w===""?"":w)}}),g=X6({editor:m,selector:({editor:L})=>({bold:L?.isActive("bold")??!1,italic:L?.isActive("italic")??!1,underline:L?.isActive("underline")??!1,strike:L?.isActive("strike")??!1,headingLevel:_h.find(S=>L?.isActive("heading",{level:S})??!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(!m)return null;const x=g.headingLevel>0?`h${g.headingLevel}`:"paragraph",b=L=>{const S=m.chain().focus();if(L==="paragraph"){S.setParagraph().run();return}const w=_h.find(k=>`h${k}`===L);w&&S.setHeading({level:w}).run()},y=g.fontSize?parseInt(g.fontSize,10):NaN,_=Number.isFinite(y)?y:Xne,v=L=>{const S=Math.min(Qne,Math.max(Jne,L));m.chain().focus().setFontSize(`${S}px`).run()};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ks,{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(es,{active:g.bold,label:a("sectionsEditor.richTextField.bold"),onClick:()=>m.chain().focus().toggleBold().run(),children:o.jsx(w8,{size:14})}),o.jsx(es,{active:g.italic,label:a("sectionsEditor.richTextField.italic"),onClick:()=>m.chain().focus().toggleItalic().run(),children:o.jsx(S8,{size:14})}),o.jsx(es,{active:g.underline,label:a("sectionsEditor.richTextField.underline"),onClick:()=>m.chain().focus().toggleUnderline().run(),children:o.jsx(IA,{size:14})}),o.jsx(es,{active:g.strike,label:a("sectionsEditor.richTextField.strikethrough"),onClick:()=>m.chain().focus().toggleStrike().run(),children:o.jsx(k8,{size:14})}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsxs(ks,{value:x,onValueChange:b,children:[o.jsx(js,{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(As,{})}),o.jsxs(Cs,{children:[o.jsx(Dt,{value:"paragraph",children:a("sectionsEditor.richTextField.styleParagraph")}),_h.map(L=>o.jsx(Dt,{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(es,{active:!1,label:a("sectionsEditor.richTextField.fontSizeDecrease"),onClick:()=>v(_-rv),children:o.jsx(fg,{size:14})}),o.jsx("span",{className:"min-w-[2ch] text-center text-xs tabular-nums text-muted-foreground",children:_}),o.jsx(es,{active:!1,label:a("sectionsEditor.richTextField.fontSizeIncrease"),onClick:()=>v(_+rv),children:o.jsx(Ut,{size:14})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(Kne,{editor:m,currentColor:g.color,open:f,onOpenChange:p}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(es,{active:g.bulletList,label:a("sectionsEditor.richTextField.bulletList"),onClick:()=>m.chain().focus().toggleBulletList().run(),children:o.jsx(Bg,{size:14})}),o.jsx(es,{active:g.orderedList,label:a("sectionsEditor.richTextField.orderedList"),onClick:()=>m.chain().focus().toggleOrderedList().run(),children:o.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})})]}),o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(mY,{editor:m,active:g.link,open:h,onOpenChange:u}),!l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),o.jsx(es,{active:g.alignLeft,label:a("sectionsEditor.richTextField.alignLeft"),onClick:()=>m.chain().focus().setTextAlign("left").run(),children:o.jsx(FE,{size:14})}),o.jsx(es,{active:g.alignCenter,label:a("sectionsEditor.richTextField.alignCenter"),onClick:()=>m.chain().focus().setTextAlign("center").run(),children:o.jsx(MA,{size:14})}),o.jsx(es,{active:g.alignRight,label:a("sectionsEditor.richTextField.alignRight"),onClick:()=>m.chain().focus().setTextAlign("right").run(),children:o.jsx(OA,{size:14})}),o.jsx(es,{active:g.alignJustify,label:a("sectionsEditor.richTextField.alignJustify"),onClick:()=>m.chain().focus().setTextAlign("justify").run(),children:o.jsx($A,{size:14})})]})]}),o.jsx(r9,{editor:m})]})]})}const Dc=t=>String(t).padStart(2,"0"),eie="1900-01-01",tie="2099-12-31",sie="1900-01-01T00:00",nie="2099-12-31T23:59";function iie(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()}-${Dc(s.getUTCMonth()+1)}-${Dc(s.getUTCDate())}`}function rie(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function oie(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Dc(e.getMonth()+1)}-${Dc(e.getDate())}T${Dc(e.getHours())}:${Dc(e.getMinutes())}`}function lie(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function aie(t){const e=z.c(41),{id:s,withTime:n,value:i,onChange:r,calendarLabel:l}=t,[a,c]=P.useState(!1);let d;e[0]!==n?(d=O=>n?oie(O):iie(O),e[0]=n,e[1]=d):d=e[1];const h=d;let u;e[2]!==n?(u=O=>n?lie(O):rie(O),e[2]=n,e[3]=u):u=e[3];const f=u;let p;e[4]!==h||e[5]!==i?(p=()=>h(i),e[4]=h,e[5]=i,e[6]=p):p=e[6];const[m,g]=P.useState(p),[x,b]=P.useState(i);if(i!==x){b(i);const O=h(i);O!==m&&g(O)}let y;e[7]!==r||e[8]!==f?(y=O=>{g(O.target.value),r(f(O.target.value))},e[7]=r,e[8]=f,e[9]=y):y=e[9];const _=y;let v;if(e[10]!==i){const O=i?new Date(i):null;v=O&&!Number.isNaN(O.getTime())?O:null,e[10]=i,e[11]=v}else v=e[11];const L=v;let S;e[12]!==r||e[13]!==L||e[14]!==h||e[15]!==n?(S=O=>{if(!O)return;n&&L?O.setHours(L.getHours(),L.getMinutes(),0,0):O.setHours(0,0,0,0);const F=O.toISOString();g(h(F)),b(F),r(F),c(!1)},e[12]=r,e[13]=L,e[14]=h,e[15]=n,e[16]=S):S=e[16];const w=S,k=n?"datetime-local":"date",j=n?sie:eie,C=n?nie:tie;let N;e[17]!==h||e[18]!==i?(N=()=>g(h(i)),e[17]=h,e[18]=i,e[19]=N):N=e[19];let T;e[20]!==_||e[21]!==s||e[22]!==m||e[23]!==N||e[24]!==k||e[25]!==j||e[26]!==C?(T=o.jsx(gt,{id:s,type:k,min:j,max:C,value:m,onChange:_,onBlur:N,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[20]=_,e[21]=s,e[22]=m,e[23]=N,e[24]=k,e[25]=j,e[26]=C,e[27]=T):T=e[27];let V;e[28]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(hr,{className:"h-4 w-4"}),e[28]=V):V=e[28];let A;e[29]!==l?(A=o.jsx(ts,{asChild:!0,children:o.jsx(me,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":l,children:V})}),e[29]=l,e[30]=A):A=e[30];const E=L??void 0;let R;e[31]!==w||e[32]!==E?(R=o.jsx(ss,{className:"w-auto p-0",align:"end",onCloseAutoFocus:cie,children:o.jsx(o9,{mode:"single",selected:E,onSelect:w,initialFocus:!0})}),e[31]=w,e[32]=E,e[33]=R):R=e[33];let D;e[34]!==a||e[35]!==A||e[36]!==R?(D=o.jsxs(ns,{open:a,onOpenChange:c,children:[A,R]}),e[34]=a,e[35]=A,e[36]=R,e[37]=D):D=e[37];let I;return e[38]!==T||e[39]!==D?(I=o.jsxs("div",{className:"flex gap-1",children:[T,D]}),e[38]=T,e[39]=D,e[40]=I):I=e[40],I}function cie(t){return t.preventDefault()}function Lh(t){const e=z.c(76),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=re(),d=typeof n=="string"?n:"",h=s.format;if(h==="rich-text"||h==="rich-text-inline"||h==="html"){const _=h==="rich-text-inline";let v;return e[0]!==l||e[1]!==i||e[2]!==r||e[3]!==a||e[4]!==s||e[5]!==_||e[6]!==n?(v=o.jsx(Zne,{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]=v):v=e[7],v}if(h==="textarea"||h==="markdown"){const _=a?.virtualMcpId;let v;e[8]!==l||e[9]!==r||e[10]!==s.description||e[11]!==_?(v=o.jsx(Ks,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[8]=l,e[9]=r,e[10]=s.description,e[11]=_,e[12]=v):v=e[12];let L;e[13]!==i?(L=k=>i(k.target.value),e[13]=i,e[14]=L):L=e[14];let S;e[15]!==r||e[16]!==d||e[17]!==L?(S=o.jsx(ho,{id:r,value:d,onChange:L,rows:4}),e[15]=r,e[16]=d,e[17]=L,e[18]=S):S=e[18];let w;return e[19]!==v||e[20]!==S?(w=o.jsxs("div",{className:"space-y-2",children:[v,S]}),e[19]=v,e[20]=S,e[21]=w):w=e[21],w}const u=h==="date-time"||h==="datetime";if(h==="date"||u){const _=a?.virtualMcpId;let v;e[22]!==l||e[23]!==r||e[24]!==s.description||e[25]!==_?(v=o.jsx(Ks,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[22]=l,e[23]=r,e[24]=s.description,e[25]=_,e[26]=v):v=e[26];let L;e[27]!==c?(L=c("sectionsEditor.stringField.openCalendar"),e[27]=c,e[28]=L):L=e[28];let S;e[29]!==u||e[30]!==i||e[31]!==r||e[32]!==d||e[33]!==L?(S=o.jsx(aie,{id:r,withTime:u,value:d,onChange:i,calendarLabel:L}),e[29]=u,e[30]=i,e[31]=r,e[32]=d,e[33]=L,e[34]=S):S=e[34];let w;return e[35]!==v||e[36]!==S?(w=o.jsxs("div",{className:"space-y-2",children:[v,S]}),e[35]=v,e[36]=S,e[37]=w):w=e[37],w}if(h==="color-input"||h==="color"){const _=a?.virtualMcpId;let v;e[38]!==l||e[39]!==r||e[40]!==s.description||e[41]!==_?(v=o.jsx(Ks,{htmlFor:r,label:l,description:s.description,virtualMcpId:_}),e[38]=l,e[39]=r,e[40]=s.description,e[41]=_,e[42]=v):v=e[42];const L=d||"#000000";let S;e[43]!==i?(S=T=>i(T.target.value),e[43]=i,e[44]=S):S=e[44];let w;e[45]!==L||e[46]!==S?(w=o.jsx("input",{type:"color",value:L,onChange:S,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[45]=L,e[46]=S,e[47]=w):w=e[47];let k;e[48]!==i?(k=T=>i(T.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(gt,{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]!==w||e[55]!==j?(C=o.jsxs("div",{className:"flex items-center gap-2",children:[w,j]}),e[54]=w,e[55]=j,e[56]=C):C=e[56];let N;return e[57]!==v||e[58]!==C?(N=o.jsxs("div",{className:"space-y-2",children:[v,C]}),e[57]=v,e[58]=C,e[59]=N):N=e[59],N}const f=a?.virtualMcpId;let p;e[60]!==l||e[61]!==r||e[62]!==s.description||e[63]!==f?(p=o.jsx(Ks,{htmlFor:r,label:l,description:s.description,virtualMcpId:f}),e[60]=l,e[61]=r,e[62]=s.description,e[63]=f,e[64]=p):p=e[64];const m=h==="url"?"url":"text";let g;e[65]!==i?(g=_=>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]!==m||e[70]!==g||e[71]!==x?(b=o.jsx(gt,{id:r,type:m,value:d,onChange:g,placeholder:x,className:"h-10"}),e[67]=r,e[68]=d,e[69]=m,e[70]=g,e[71]=x,e[72]=b):b=e[72];let y;return e[73]!==p||e[74]!==b?(y=o.jsxs("div",{className:"space-y-2",children:[p,b]}),e[73]=p,e[74]=b,e[75]=y):y=e[75],y}const die=/^[+-]?\d*\.?\d*(?:[eE][+-]?\d*)?$/,uie=/^[+-]?\d*$/;function hie(t,e){return(e?uie:die).test(t)}function fie(t){const e=z.c(16),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=typeof n=="number"?String(n):"",[d,h]=P.useState(c),[u,f]=P.useState(c);c!==u&&(f(c),d!==""&&c!==""&&Number(d)===Number(c)||h(c));const p=a?.virtualMcpId;let m;e[0]!==l||e[1]!==r||e[2]!==s.description||e[3]!==p?(m=o.jsx(Ks,{htmlFor:r,label:l,description:s.description,virtualMcpId:p}),e[0]=l,e[1]=r,e[2]=s.description,e[3]=p,e[4]=m):m=e[4];const g=s.type==="integer"?"numeric":"decimal";let x;e[5]!==i||e[6]!==s.type?(x=_=>{const v=_.target.value,L=s.type==="integer";if(v!==""&&!hie(v,L))return;h(v);const S=Number(v);i(v===""||Number.isNaN(S)?void 0:S)},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(gt,{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 y;return e[13]!==m||e[14]!==b?(y=o.jsxs("div",{className:"space-y-2",children:[m,b]}),e[13]=m,e[14]=b,e[15]=y):y=e[15],y}function mie(t){const e=z.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 h;e[0]!==r||e[1]!==i||e[2]!==l.description||e[3]!==d?(h=o.jsx(Ks,{htmlFor:i,label:r,description:l.description,virtualMcpId:d}),e[0]=r,e[1]=i,e[2]=l.description,e[3]=d,e[4]=h):h=e[4];let u;e[5]!==n?(u=m=>n(m),e[5]=n,e[6]=u):u=e[6];let f;e[7]!==c||e[8]!==i||e[9]!==u?(f=o.jsx(Pi,{id:i,checked:c,onCheckedChange:u}),e[7]=c,e[8]=i,e[9]=u,e[10]=f):f=e[10];let p;return e[11]!==h||e[12]!==f?(p=o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[h,f]}),e[11]=h,e[12]=f,e[13]=p):p=e[13],p}const Lx="__enum_empty__",Zk="__enum_clear__";function wx(t){return t===""?Lx:String(t)}function pie(t,e){if(t===Lx)return"";const s=e.find(n=>wx(n)===t);return s!==void 0?s:t}function gie(t,e){if(t!==Zk)return pie(t,e)}function xie(t,e){return t==null?e.some(s=>s==="")?Lx:void 0:wx(t)}function bie(t){return t===""?"":String(t)}function vie(t){const e=z.c(39),{schema:s,value:n,onChange:i,path:r,label:l,required:a,sandbox:c}=t,d=re();let h;e[0]!==s.enum?(h=s.enum??[],e[0]=s.enum,e[1]=h):h=e[1];const u=h;let f;e[2]!==u||e[3]!==n?(f=xie(n,u),e[2]=u,e[3]=n,e[4]=f):f=e[4];const p=f;let m;e[5]!==u||e[6]!==a?(m=!a&&!u.some(_ie),e[5]=u,e[6]=a,e[7]=m):m=e[7];const g=m,x=c?.virtualMcpId;let b;e[8]!==l||e[9]!==r||e[10]!==s.description||e[11]!==x?(b=o.jsx(Ks,{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 y;e[13]!==i||e[14]!==u?(y=N=>i(gie(N,u)),e[13]=i,e[14]=u,e[15]=y):y=e[15];let _;e[16]!==d?(_=d("sectionsEditor.enumField.selectPlaceholder"),e[16]=d,e[17]=_):_=e[17];let v;e[18]!==_?(v=o.jsx(As,{placeholder:_}),e[18]=_,e[19]=v):v=e[19];let L;e[20]!==r||e[21]!==v?(L=o.jsx(js,{id:r,className:"h-10 w-full min-w-0",children:v}),e[20]=r,e[21]=v,e[22]=L):L=e[22];let S;e[23]!==g||e[24]!==d?(S=g&&o.jsx(Dt,{value:Zk,className:"text-muted-foreground",children:d("sectionsEditor.enumField.clearOption")}),e[23]=g,e[24]=d,e[25]=S):S=e[25];let w;e[26]!==u?(w=u.map(yie),e[26]=u,e[27]=w):w=e[27];let k;e[28]!==S||e[29]!==w?(k=o.jsxs(Cs,{children:[S,w]}),e[28]=S,e[29]=w,e[30]=k):k=e[30];let j;e[31]!==p||e[32]!==k||e[33]!==y||e[34]!==L?(j=o.jsxs(ks,{value:p,onValueChange:y,children:[L,k]}),e[31]=p,e[32]=k,e[33]=y,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 yie(t){const e=wx(t);return o.jsx(Dt,{value:e,children:bie(t)},e)}function _ie(t){return t===""}const ej={duration:180,easing:"cubic-bezier(0.2, 0, 0, 1)",sideEffects:void 0};function tj(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;return Array.isArray(e.variants)?e:null}function wu(t){return tj(t)?.variants?.[0]?.rule?.__resolveType===yd}function ov(t){return{__resolveType:hl,variants:[{value:t,rule:{__resolveType:yd}}]}}function sj(t){return wu(t)?tj(t)?.variants?.[0]?.value:t}function Ic(t){return wu(t)?sj(t):t}function Sx(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Es(e)){const n=t.section?.__resolveType;return typeof n=="string"?n:e}return e}function Lie(t){return t.includes("flags/multivariate")}function wie(t){return ws(t)}function Sie(t){const e=t.title?mp(t.title)?.blockId:void 0;return e||(t.title&&!t.title.includes("/")?t.title:pp(t.resolveType)??ws(t.resolveType))}function kie(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??wie(r)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const r=Sx(e.editorValue);r?.includes("/")&&i(r)}return s}function jie(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(hi(r)){const u=e.find(f=>f.resolveType===r);return u?u.resolveType:r}const d=e.find(u=>g5(u.resolveType,r));if(d)return d.resolveType;const h=e.find(u=>u.resolveType===r);if(h)return h.resolveType;if(r.includes("/"))return r}const l=typeof i.type=="string"?i.type:void 0;if(l){const d=e.find(h=>h.discriminatorValue===l||h.resolveType===l||g5(h.resolveType,l));if(d)return d.resolveType}let a=n,c=-1;for(const d of e){if(!d.schema?.properties)continue;const u=Object.keys(d.schema.properties).filter(f=>!f.startsWith("__")&&f!=="@type"&&f!=="action"&&f!=="alt").filter(f=>i[f]!==void 0).length;u>0&&u>c&&(c=u,a=d.resolveType)}return c>0,a}function lv(t,e,s){if(!t||typeof t!="object"||Array.isArray(t))return s??null;const n=Sx(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 Cie(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 nj(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Es(e.__resolveType))return null;const s=e.section;return!s||typeof s!="object"||Array.isArray(s)?null:s}function Nie(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const s=t,n=Sx(s);return n&&Lie(n)?Array.isArray(s.variants)&&s.variants.length>0:Object.keys(s).some(i=>!i.startsWith("__")&&i!=="@type")}function kx(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 Tie=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Vie=5,Aie=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function av(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:Aie.format(d)},l=r(n),a=r(i);return l&&a?`${l} → ${a}`:l?`From ${l}`:a?`Until ${a}`:null}function rd(t,e=0){if(!t)return"Default";if(e>Vie)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(Tie).join(" & "):ws(s)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return av(t)??ws(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`:ws(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(" - "):ws(s)}case"website/matchers/pathname.ts":{const i=t.case,{type:r,pathname:l}=i??{};return r&&l?`Pathname ${r} ${l}`:ws(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=>rd(a,e+1)).join(` ${l} `)}return ws(s)}default:{const i=av(t);return i||ws(s)||"Default"}}}function ij(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function rj(t,e){if(e.length===0)return 0;const s=ij(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(h=>!a.has(h)).filter(h=>s[h]!==void 0&&s[h]!==null&&s[h]!=="").length;d>i&&(i=d,n=r)}return n}function Pie(t,e){const s=ij(t),n=new Set(e);return Object.fromEntries(Object.entries(s).filter(([i])=>!n.has(i)))}function Eie(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}const Rie="$live/matchers/MatchAlways.ts";function Die(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType===x3||i.rule?.__resolveType===Rie)??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 Gp(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Gp);const e=t;if(e.__resolveType){const s=Die(e);return s===void 0?t:Gp(s)}return oj(e)}function oj(t){const e={};for(const[s,n]of Object.entries(t))e[s]=Gp(n);return e}function Iie(t,e){return e.split(".").reduce((s,n)=>{if(!(s==null||typeof s!="object"))return s[n]},t)}function lj(t){return t==null?"":Array.isArray(t)?t.map(lj).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Rf(t,e){if(!t.includes("{"))return;const s=oj(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,r,l)=>{const a=(r??l??"").trim();return lj(Iie(s,a))}).trim()||void 0}function Mie(t){return t.replace(/<[^>]*>/g,"").trim()}function Oie(t){return t.replace(/\{\{\{?[^{}]*\}?\}\}/g,"").replace(/\s+/g," ").trim()}function $ie(t){return/^Option \d+$/.test(t)}function Bie(t,e){if(e.includes("{"))return Rf(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 aj(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=Ic(t);const i=nj(n);if(i&&(n=i,n=Ic(n)),s?.titleBy){const l=Bie(n,s.titleBy);if(l)return l}if(s?.inlineUnionBranches?.length){const l=rj(n,s.inlineUnionBranches.map(c=>({discriminators:c.discriminators,propertyKeys:Object.keys(c.schema?.properties??{})}))),a=s.inlineUnionBranches[l]?.title;if(a&&!$ie(a)){const c=Rf(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=Mie(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/")?rd(n):ws(r);if(s?.title){const l=Rf(s.title,n);if(l)return l;if(!s.title.includes("{"))return s.title}}return`Item ${e+1}`}function Df(t,e){return t.map((s,n)=>aj(s,n,e))}function cj(t,e,s){return aj(t,e,s)}function zie(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 cv(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const s=zie(e);if(!s)return;const n=Rf(s,t);if(!n)return;const i=kx(n)||n;return Eie(i)}function jx(t){return t===po||t===hl}function m1(t,e){if(!Object.hasOwn(e,t))return null;const s=e[t]??{},n=s.__resolveType??t;return{data:{...s},resolveType:n}}function If(t,e){const s=t.__resolveType??"";if(!s)return null;if(Es(s)){const n=t.section??{};return dj(n,e)}if(jx(s)){const n=t.variants?.[0]?.value;return n?If(n,e):null}return!hi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:m1(s,e)}function dj(t,e){const s=t.__resolveType??"";if(!s)return null;if(jx(s)){const n=t.variants?.[0]?.value;return n?If(n,e):null}return!hi(s)||!Object.hasOwn(e,s)?{data:{...t},resolveType:s}:m1(s,e)}function uj(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t.__resolveType;if(typeof n!="string"||!hi(n)||!Object.hasOwn(e,n))return null;const i=m1(n,e);return i?{blockKey:n,...i}:null}function Z3e(t,e){if(!e.isSavedBlock)return null;if(e.isHidden){const r=(Es(t.__resolveType)?t.section:t)?.variants?.[0]?.value;if(!r)return null;const l=r.__resolveType??"";return Es(l)?r.section?.__resolveType??l??null:l||null}return(e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType)||null}function Fie(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 m1(n,s)}if(e.isHidden){const r=(Es(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t,l=r.__resolveType??"",a=Es(l)?r.section?.__resolveType??l:l;return jx(a)?null:If(r,s)}if(e.isLazy||Es(t.__resolveType)){const n=t.section??{};return dj(n,s)}return If(t,s)}function Nn(t){return typeof t=="string"?t:t.label}function Td(t){return typeof t=="object"}function dv(t){return Td(t)?t.arrayLabel:void 0}function uv(t){return Td(t)?t.fieldKey:void 0}function Uie(t){return Td(t)?t.ownerPath:void 0}function hv(t,e,s){return t!=null&&typeof t=="object"?{...t,label:e,itemIndex:s}:{label:e,itemIndex:s}}function Qu(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function ia(t){return t.normalize("NFC").trim()}function Hie(t,e){return e.length>0&&ia(Nn(e[0]))===ia(t)?e:[t,...e]}function Kie(t,e){return e.map(s=>{if(!Td(s))return s;const n=s.ownerPath??[];return n[0]===t?s:{...s,ownerPath:[t,...n]}})}function rs(t,e){return ia(t)===ia(e)}function Mf(t,e){return ia(t).replace(/\s+/g,"").toLowerCase()===ia(e).replace(/\s+/g,"").toLowerCase()}function Wie(t,e,s){return(s?.hasSiblingDrillDownFields??!1)||(s?.itemLabelFromSchema??!1)||rs(e,t)||s?.arrayKey!=null&&rs(e,s.arrayKey)}function wh(t,e,s,n,i){const r=ia(s);if(t.some(a=>rs(Nn(a),r)||rs(Nn(a),s)))return t;const l={label:s,itemIndex:n};return Wie(e,s,i)&&(l.arrayLabel=e),i?.arrayKey&&(l.fieldKey=i.arrayKey),[...t,l]}function qie(t,e){return t.slice(0,t.length-e.length)}function Gie(t,e,s,n){if(s.length===0)return s;const i=s[0];if(Td(i))return s;const r=n??ra(t,e),l=Nn(i);return rs(l,r)||rs(l,t)?s.slice(1):s}function ra(t,e){return e.title??Qu(t)}function Xu(t,e,s){const n=s[t];if(!n)return Qu(t);const i=ra(t,n);return e.some(l=>{if(l===t)return!1;const a=s[l];return a!=null&&ra(l,a)===i})?Qu(t):i}function exe(t,e){return e.isMultivariateSectionTop?0:t-2}function txe(t,e){return e<=0?[]:t.slice(0,e)}function Wc(t,e){return t.type==="array"&&t.items||d1(t)?!0:Array.isArray(e)}function hj(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&&(Wc(n)||n.type==="object"&&hj(n,e+1)))return!0}return!1}function fj(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("__")&&fj(n,e+1))return!0;return!1}function Yie(t,e,s={}){const n=t.filter(i=>{const r=e[i];if(!r)return!1;if(r.type==="object"&&hj(r))return!0;const l=s[i];return l!=null&&typeof l=="object"&&!Array.isArray(l)?fj(l):!1});return n.length>1?new Set(n):new Set}function fv(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Jie(t,e){if(t==null||typeof t!="object"||Array.isArray(t))return;const s=cj(t,e);return s===`Item ${e+1}`?void 0:s}function Su(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=Jie(r,i);if(l&&rs(l,e)||Su(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")&&(Mf(Qu(i),e)||Mf(i,e))||Su(r,e,s,n+1))return!0}return!1}function Yp(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(Wc(c)){const h=Xu(a,l,r);if(rs(h,e)||rs(a,e))return!0}const d=t[a];if(d!=null&&typeof d=="object"&&!Array.isArray(d)&&Yp(d,e,s,n+1))return!0}return!1}function $l(t,e,s,n,i,r){if(n.length===0)return null;const l=Nn(n[0]),a=uv(n[0]);if(a!=null)for(const b of t){const y=e[b];if(!(!y||!Wc(y,s[b]))&&b===a)return b}const c=n.flatMap(b=>Uie(b)??[]);if(c.length>0){const b=t.filter(y=>e[y]?.type==="block-ref"&&c.includes(y));if(b.length===1)return b[0]}for(const b of t){const y=e[b];if(!y||!Wc(y,s[b]))continue;const _=Xu(b,t,e);if(rs(l,_)||rs(l,b)||n.some(v=>{if(rs(Nn(v),_)||rs(Nn(v),b))return!0;const L=dv(v);return L!=null&&(rs(L,_)||rs(L,b))}))return b}for(const b of t){const y=e[b];if(!y||!Wc(y,s[b]))continue;const _=s[b];if(!Array.isArray(_))continue;if(Df(_,y.items).some(L=>rs(L,l)))return b}let d=null,h=!1,u=null,f=!1;for(const b of t){const y=e[b];if(y?.type!=="object"||!y.properties)continue;const _=Object.keys(y.properties),v=fv(s[b]),L=Xu(b,t,e);if((rs(l,L)||rs(l,b))&&$l(_,y.properties,v,n.slice(1),i,r)!=null){d===null?d=b:h=!0;continue}$l(_,y.properties,v,n,i,r)!=null&&(u===null?u=b:f=!0)}if(d!==null)return h?null:d;if(u!==null)return f?null:u;for(const b of t){const y=e[b];if(y?.type!=="inline-union"||!y.inlineUnionBranches?.length)continue;const _=fv(s[b]),v=ra(b,y);for(const L of y.inlineUnionBranches){const S=L.schema?.properties;if(!S)continue;const w=Object.keys(S);if($l(w,S,_,n,i,r)||(rs(l,v)||rs(l,b))&&$l(w,S,_,n.slice(1),i,r))return b}}let p=null;const m=[],g=n.map(dv).filter(b=>b!=null),x=n.map(uv).filter(b=>b!=null);for(const b of t){const y=e[b];if(y?.type!=="block-ref")continue;const _=ra(b,y);if(l!==_&&l!==b){const v=s[b],S=(i?uj(v,i):null)?.data??v;(Su(S,l)||x.some(w=>Su(S,w)||Yp(S,w,r))||g.some(w=>Su(S,w)||Yp(S,w,r)))&&m.push(b);continue}if(n.length>1){const v=s[b];if(v&&typeof v=="object"&&!Array.isArray(v)){const L=Nn(n[1]);if(Object.keys(v).some(w=>!w.startsWith("__")&&(Mf(Qu(w),L)||Mf(w,L))))return b}}p||(p=b)}return p||(m.length===1?m[0]:(m.length>1,null))}function Qie(t,e,s,n,i,r){return $l(t,e,s,n,i,r)}function Xie(t,e,s,n,i,r,l){if(i.length===0||!s.properties)return!1;const a=Object.keys(s.properties);if($l(a,s.properties,n,i,r,l))return!0;const c=Nn(i[0]);return!rs(c,e)&&!rs(c,t)?!1:i.length>1||$l(a,s.properties,n,i.slice(1),r,l)!==null}function mv(t,e,s,n,i){if(!Td(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=Df(t,e);if(s.itemIndex>=0&&s.itemIndex<t.length&&rs(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&&rs(l,s.label)?n:r.findIndex(a=>rs(a,s.label))}function Zie(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=mv(s,n,c,i,r);if(d>=0)return{index:d,innerPath:e.slice(a+1),crumbIndex:a}}const l=e.findIndex(a=>rs(Nn(a),t));if(l>=0&&e.length>l+1){const a=e[l+1],c=mv(s,n,a,i,r);if(c>=0)return{index:c,innerPath:e.slice(l+2),crumbIndex:l+1}}return null}function um(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===po}function ere(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(s=>um(s.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(s=>um(s.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(s=>um(s.resolveType)):!1}function tre(t,e){if(e==="global"||e==="sections"||d1(t))return!0;const s=t.type==="array"?t.items:void 0;return s?ere(s):!1}function pv(t){return Array.from({length:t},(e,s)=>({id:crypto.randomUUID(),index:s}))}function mj(t){return t.map((e,s)=>({...e,index:s}))}function sre(t,e){if(e===t.length)return t;if(e<t.length)return mj(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 nre(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 ire(t,e){return t.filter(s=>s.index!==e).map(s=>s.index>e?{...s,index:s.index-1}:s)}const rre="w-6 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]",ore="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]",lre="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 gv(t,e){return ie("h-6 shrink-0 overflow-hidden",e?rre:t?lre:ore)}function are(t){const e=z.c(8),{labelText:s,imageSrc:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(fd,{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 cre(t){const e=z.c(75),{sortableId:s,labelText:n,imageSrc:i,hidden:r,onToggleHidden:l,onOpen:a,onDuplicate:c,onRemove:d}=t,h=re(),u=h1();let f;e[0]!==s?(f={id:s,animateLayoutChanges:fre},e[0]=s,e[1]=f):f=e[1];const{attributes:p,listeners:m,setNodeRef:g,transform:x,isDragging:b}=e1(f);let y;e[2]!==x?(y=Ri.Transform.toString(x?{...x,x:0}:null),e[2]=x,e[3]=y):y=e[3];const _=b?0:void 0;let v;e[4]!==y||e[5]!==_?(v={transform:y,opacity:_},e[4]=y,e[5]=_,e[6]=v):v=e[6];const L=v;let S;e[7]!==p||e[8]!==u?(S=u?{}:p,e[7]=p,e[8]=u,e[9]=S):S=e[9];let w;e[10]!==m||e[11]!==u?(w=u?{}:m,e[10]=m,e[11]=u,e[12]=w):w=e[12];let k;e[13]!==a?(k=se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),a())},e[13]=a,e[14]=k):k=e[14];const j=b?"cursor-grabbing":"cursor-pointer";let C;e[15]!==j?(C=ie("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 N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(fd,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[17]=N):N=e[17];let T;e[18]!==i?(T=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]=T):T=e[19];const V=r&&"line-through opacity-50";let A;e[20]!==V?(A=ie("min-w-0 flex-1 truncate text-sm",V),e[20]=V,e[21]=A):A=e[21];let E;e[22]!==n||e[23]!==A?(E=o.jsx("span",{className:A,children:n}),e[22]=n,e[23]=A,e[24]=E):E=e[24];let R;e[25]!==r||e[26]!==l||e[27]!==u||e[28]!==h?(R=l&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",disabled:u,"aria-label":h(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem"),className:ie(gv(r===!0,r===!0)),onClick:se=>{se.stopPropagation(),l()},onPointerDown:hre,children:r?o.jsx(iE,{size:14}):o.jsx(p0,{size:14})})}),o.jsx(Ue,{side:"bottom",children:h(r?"sectionsEditor.arrayField.showItem":"sectionsEditor.arrayField.hideItem")})]}),e[25]=r,e[26]=l,e[27]=u,e[28]=h,e[29]=R):R=e[29];let D;e[30]!==n||e[31]!==h?(D=h("sectionsEditor.arrayField.openActionsFor",{label:n}),e[30]=n,e[31]=h,e[32]=D):D=e[32];let I;e[33]!==r?(I=ie(gv(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]=I):I=e[34];let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx(Qn,{size:14}),e[35]=O):O=e[35];let F;e[36]!==u||e[37]!==D||e[38]!==I?(F=o.jsx(Bt,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",disabled:u,"aria-label":D,className:I,onClick:ure,onPointerDown:dre,children:O})}),e[36]=u,e[37]=D,e[38]=I,e[39]=F):F=e[39];let M;e[40]!==c?(M=se=>{se.stopPropagation(),c()},e[40]=c,e[41]=M):M=e[41];let $;e[42]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(dn,{size:14}),e[42]=$):$=e[42];let B;e[43]!==h?(B=h("sectionsEditor.arrayField.duplicate"),e[43]=h,e[44]=B):B=e[44];let U;e[45]!==M||e[46]!==B?(U=o.jsxs(Ye,{onClick:M,children:[$,B]}),e[45]=M,e[46]=B,e[47]=U):U=e[47];let H;e[48]!==d?(H=se=>{se.stopPropagation(),d()},e[48]=d,e[49]=H):H=e[49];let W;e[50]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(Gs,{size:14}),e[50]=W):W=e[50];let K;e[51]!==h?(K=h("sectionsEditor.arrayField.delete"),e[51]=h,e[52]=K):K=e[52];let G;e[53]!==H||e[54]!==K?(G=o.jsxs(Ye,{className:"text-destructive focus:text-destructive",onClick:H,children:[W,K]}),e[53]=H,e[54]=K,e[55]=G):G=e[55];let Y;e[56]!==U||e[57]!==G?(Y=o.jsxs(zt,{align:"end",children:[U,G]}),e[56]=U,e[57]=G,e[58]=Y):Y=e[58];let X;e[59]!==F||e[60]!==Y?(X=o.jsxs($t,{children:[F,Y]}),e[59]=F,e[60]=Y,e[61]=X):X=e[61];let te;return e[62]!==n||e[63]!==a||e[64]!==g||e[65]!==L||e[66]!==T||e[67]!==E||e[68]!==R||e[69]!==X||e[70]!==S||e[71]!==w||e[72]!==k||e[73]!==C?(te=o.jsxs("div",{ref:g,style:L,...S,...w,role:"button",tabIndex:0,onClick:a,onKeyDown:k,className:C,title:n,children:[N,T,E,R,X]}),e[62]=n,e[63]=a,e[64]=g,e[65]=L,e[66]=T,e[67]=E,e[68]=R,e[69]=X,e[70]=S,e[71]=w,e[72]=k,e[73]=C,e[74]=te):te=e[74],te}function dre(t){return t.stopPropagation()}function ure(t){return t.stopPropagation()}function hre(t){return t.stopPropagation()}function fre(){return!1}function mre(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 pre(t){const e=t.split(".").filter(s=>!/^\d+$/.test(s));return e[e.length-1]??t}function Sh({schema:t,value:e,onChange:s,path:n,label:i,breadcrumbPath:r=[],onBreadcrumbChange:l,hasSiblingDrillDownFields:a,meta:c,decofile:d,onSaveReferencedBlock:h,containerResolveType:u,previewBaseUrl:f,onAddSectionItem:p,onRequestAddSection:m,sandbox:g}){const x=re(),b=h1(),y=f1(g?.virtualMcpId),_=Array.isArray(e)?e:[],v=t.items,L=pre(n),S={arrayKey:L,hasSiblingDrillDownFields:a,itemLabelFromSchema:!!(v?.titleBy||v?.inlineUnionBranches?.length)},w=tre(t,L),k=!w&&v?.type==="object",[j,C]=P.useState(null),N=Zie(i,r,_,v,j,L),T=N?.index??null;N===null?j!==null&&C(null):N.index!==j&&C(N.index);const[V,A]=P.useState(()=>pv(_.length)),[E,R]=P.useState(null),[D,I]=P.useState(n),[O,F]=P.useState(_.length),M=P.useRef(!1),$=P.useRef(null);D!==n?(I(n),F(_.length),A(pv(_.length)),C(null)):O!==_.length&&(F(_.length),A(ae=>sre(ae,_.length)));const B=(ae,de)=>cj(Ic(ae),de,v),U=ae=>{if(M.current)return;const de=B(_[ae],ae);C(ae),l?.(wh(r,i,de,ae,S))},H=ae=>{const de=[..._,ae];s(de);const ue=de.length-1;C(ue);const pe=B(ae,ue);l?.(wh(r,i,pe,ue,S))},W=()=>{const ae=v?.type,de=v?.default!==void 0?v.default:ae==="object"?{}:ae==="block-ref"?(()=>{const ge=v?.anyOfRefs?.[0]?.resolveType;return typeof ge!="string"||bu(ge)?{}:{__resolveType:ge}})():ae==="number"||ae==="integer"?0:ae==="boolean"?!1:ae==="array"?[]:"",ue=[..._,de];s(ue);const pe=ue.length-1;C(pe);const Z=B(de,pe);l?.(wh(r,i,Z,pe,S))},K=()=>{if(w){if(!f){ve.error(x("sectionsEditor.arrayField.startPreviewServer"));return}if(m){m({append:H});return}ve.error(x("sectionsEditor.arrayField.sectionPickerNotAvailable"));return}W()},G=ae=>{const de=_[ae],ue=typeof structuredClone=="function"?structuredClone(de):JSON.parse(JSON.stringify(de??null)),pe=[..._.slice(0,ae+1),ue,..._.slice(ae+1)];s(pe),A(Z=>nre(Z,ae))},Y=ae=>{const de=_[ae],ue=[..._];ue[ae]=wu(de)?sj(de):ov(de),s(ue)},X=ae=>{s(_.filter((de,ue)=>ue!==ae)),A(de=>ire(de,ae))},te=(ae,de)=>{const ue=[..._];if(ue[ae]=wu(_[ae])?ov(de):de,s(ue),ae===T&&N){const pe=B(_[ae],ae),Z=B(ue[ae],ae);if($.current={path:n,index:ae,label:Z},pe!==Z){const ge=[...r];ge[N.crumbIndex]=hv(r[N.crumbIndex],Z,ae),l?.(ge)}}},se=T0(vr(wa,{activationConstraint:{distance:8}}),vr(La,{coordinateGetter:t1})),ne=V.map(ae=>ae.id),Q=ae=>{R(String(ae.active.id))},q=ae=>{R(null);const{active:de,over:ue}=ae;if(!ue||de.id===ue.id)return;const pe=ne.indexOf(String(de.id)),Z=ne.indexOf(String(ue.id));pe===-1||Z===-1||(A(ge=>mj(ea([...ge],pe,Z))),s(ea([..._],pe,Z)),M.current=!0,requestAnimationFrame(()=>{M.current=!1}))},le=()=>{R(null)},J=E?V.find(ae=>ae.id===E):null,oe=J!=null?_[J.index]:void 0,ee=J!=null&&oe!==void 0?Df(_,v)[J.index]:null,he=J!=null&&oe!==void 0?cv(Ic(oe),v):void 0;if(T!==null&&T<_.length){const ae=Ic(_[T]),de=mre(ae,v,c,u,L),ue=()=>{if(!N)return wh(r,i,B(ae,T),T,S);const pe=r.slice(0,N.crumbIndex+1),Z=$.current,ge=Z?.path===n&&Z.index===T?Z.label:B(ae,T);return pe[N.crumbIndex]=hv(pe[N.crumbIndex],ge,T),pe};return o.jsx("div",{className:"min-w-0",children:de?.type==="object"&&de.properties?o.jsx(zi,{schema:de,value:ae,onChange:pe=>te(T,pe),basePath:`${n}.${T}`,breadcrumbPath:N?.innerPath??[],onBreadcrumbChange:pe=>{l?.([...ue(),...pe])},meta:c,decofile:d,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:p,onRequestAddSection:m,sandbox:g}):de?oa({schema:de,value:ae,onChange:pe=>te(T,pe),path:`${n}.${T}`,required:!0,label:de.title&&!de.title.includes("{{")?de.title:B(ae,T),breadcrumbPath:N?.innerPath??[],onBreadcrumbChange:pe=>{l?.([...ue(),...pe])},meta:c,decofile:d,onSaveReferencedBlock:h,previewBaseUrl:f,onAddSectionItem:p,onRequestAddSection:m,sandbox:g}):null})}return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx(_x,{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})]}),!y&&t.description&&o.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:t.description}),_.length>0&&o.jsx("div",{className:ie(E&&"cursor-grabbing"),children:o.jsxs(A0,{sensors:se,collisionDetection:A3,onDragStart:Q,onDragEnd:q,onDragCancel:le,children:[o.jsx(Z9,{items:ne,strategy:X9,children:o.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:(()=>{const ae=Df(_,v);return V.map(de=>{const ue=_[de.index];if(ue===void 0)return null;const pe=ae[de.index]??B(ue,de.index),Z=cv(Ic(ue),v);return o.jsx(cre,{sortableId:de.id,labelText:pe,imageSrc:Z,hidden:wu(ue),onToggleHidden:k?()=>Y(de.index):void 0,onOpen:()=>U(de.index),onDuplicate:()=>G(de.index),onRemove:()=>X(de.index)},de.id)})})()})}),kn.createPortal(o.jsx(Q9,{dropAnimation:ej,children:ee?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(are,{labelText:ee,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(Ut,{size:14}),x(w?"sectionsEditor.arrayField.addSection":"sectionsEditor.arrayField.addItem")]})]})}function gre(t){const e=z.c(53),{schema:s,value:n,onChange:i,path:r,label:l,breadcrumbPath:a,onBreadcrumbChange:c,focused:d,meta:h,decofile:u,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:m,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 y=b,[_,v]=P.useState(!1),L=f1(x?.virtualMcpId);let S;e[2]!==n?(S=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},e[2]=n,e[3]=S):S=e[3];const w=S;if(!s.properties)return null;let k;e[4]!==y||e[5]!==u||e[6]!==h||e[7]!==w||e[8]!==m||e[9]!==c||e[10]!==i||e[11]!==g||e[12]!==f||e[13]!==r||e[14]!==p||e[15]!==x||e[16]!==s?(k=o.jsx(zi,{schema:s,value:w,onChange:i,basePath:r,breadcrumbPath:y,onBreadcrumbChange:c,meta:h,decofile:u,onSaveReferencedBlock:f,previewBaseUrl:p,onAddSectionItem:m,onRequestAddSection:g,sandbox:x}),e[4]=y,e[5]=u,e[6]=h,e[7]=w,e[8]=m,e[9]=c,e[10]=i,e[11]=g,e[12]=f,e[13]=r,e[14]=p,e[15]=x,e[16]=s,e[17]=k):k=e[17];const j=k;if(d)return j;let C;e[18]!==r?(C=r.split(".").pop()??r,e[18]=r,e[19]=C):C=e[19];const N=C;let T;e[20]!==y||e[21]!==u||e[22]!==N||e[23]!==l||e[24]!==h||e[25]!==w||e[26]!==s?(T=Xie(N,l,s,w,y,u,h),e[20]=y,e[21]=u,e[22]=N,e[23]=l,e[24]=h,e[25]=w,e[26]=s,e[27]=T):T=e[27];const A=_||T,E=`${r}-fields`;let R;e[28]===Symbol.for("react.memo_cache_sentinel")?(R=()=>v(xre),e[28]=R):R=e[28];let D;e[29]!==A?(D=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:A?o.jsx(Gt,{size:16}):o.jsx(qs,{size:16})}),e[29]=A,e[30]=D):D=e[30];const I=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 F;e[33]!==s.description||e[34]!==O||e[35]!==I?(F=o.jsx(_x,{description:s.description,virtualMcpId:I,children:O}),e[33]=s.description,e[34]=O,e[35]=I,e[36]=F):F=e[36];let M;e[37]!==E||e[38]!==A||e[39]!==F||e[40]!==D?(M=o.jsxs("button",{type:"button","aria-expanded":A,"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:[D,F]}),e[37]=E,e[38]=A,e[39]=F,e[40]=D,e[41]=M):M=e[41];let $;e[42]!==s.description||e[43]!==L?($=!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]=$):$=e[44];let B;e[45]!==E||e[46]!==j||e[47]!==A?(B=A&&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]=A,e[48]=B):B=e[48];let U;return e[49]!==M||e[50]!==$||e[51]!==B?(U=o.jsxs("div",{className:"min-w-0 space-y-2",children:[M,$,B]}),e[49]=M,e[50]=$,e[51]=B,e[52]=U):U=e[52],U}function xre(t){return!t}function sxe(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 nxe(t){return structuredClone(t)}function ixe(t){return!t.isSavedBlock&&!t.isMultivariate&&!t.isHidden}function pj(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 Cx(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 Nx(t){const e=z.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,h]=P.useState(a),[u,f]=P.useState(s);s!==u&&(f(s),s&&h(a));let p;e[0]!==c||e[1]!==n?(p=$=>{!$&&!c&&n(!1)},e[0]=c,e[1]=n,e[2]=p):p=e[2];const m=p;let g;e[3]!==d||e[4]!==c||e[5]!==l?(g=async $=>{$.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=re();let y;e[7]!==b?(y=b("sectionsEditor.makeReusableModal.title"),e[7]=b,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsx(Jt,{children:y}),e[9]=y,e[10]=_):_=e[10];let v;e[11]!==b?(v=b("sectionsEditor.makeReusableModal.description"),e[11]=b,e[12]=v):v=e[12];let L;e[13]!==v?(L=o.jsx(Tn,{children:v}),e[13]=v,e[14]=L):L=e[14];let S;e[15]!==_||e[16]!==L?(S=o.jsxs(ms,{children:[_,L]}),e[15]=_,e[16]=L,e[17]=S):S=e[17];let w;e[18]!==b?(w=b("sectionsEditor.makeReusableModal.blockNameLabel"),e[18]=b,e[19]=w):w=e[19];let k;e[20]!==w?(k=o.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:w}),e[20]=w,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=$=>h($.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 N;e[25]!==d||e[26]!==c||e[27]!==C?(N=o.jsx(gt,{id:"block-id",value:d,onChange:j,placeholder:C,autoFocus:!0,disabled:c}),e[25]=d,e[26]=c,e[27]=C,e[28]=N):N=e[28];let T;e[29]!==k||e[30]!==N?(T=o.jsxs("div",{className:"py-4 space-y-2",children:[k,N]}),e[29]=k,e[30]=N,e[31]=T):T=e[31];let V;e[32]!==n?(V=()=>n(!1),e[32]=n,e[33]=V):V=e[33];let A;e[34]!==b?(A=b("sectionsEditor.makeReusableModal.cancel"),e[34]=b,e[35]=A):A=e[35];let E;e[36]!==c||e[37]!==V||e[38]!==A?(E=o.jsx(me,{type:"button",variant:"outline",onClick:V,disabled:c,children:A}),e[36]=c,e[37]=V,e[38]=A,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 D;e[43]!==c||e[44]!==b?(D=c?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),b("sectionsEditor.makeReusableModal.saving")]}):b("sectionsEditor.makeReusableModal.save"),e[43]=c,e[44]=b,e[45]=D):D=e[45];let I;e[46]!==R||e[47]!==D?(I=o.jsx(me,{type:"submit",disabled:R,children:D}),e[46]=R,e[47]=D,e[48]=I):I=e[48];let O;e[49]!==E||e[50]!==I?(O=o.jsxs(Jn,{children:[E,I]}),e[49]=E,e[50]=I,e[51]=O):O=e[51];let F;e[52]!==x||e[53]!==T||e[54]!==O||e[55]!==S?(F=o.jsx(Wt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:x,children:[S,T,O]})}),e[52]=x,e[53]=T,e[54]=O,e[55]=S,e[56]=F):F=e[56];let M;return e[57]!==m||e[58]!==s||e[59]!==F?(M=o.jsx(qt,{open:s,onOpenChange:m,children:F}),e[57]=m,e[58]=s,e[59]=F,e[60]=M):M=e[60],M}function bre(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 vre(t){const e=z.c(13),{blockKey:s}=t,n=re();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(Fe,{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(Ue,{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(He,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}function yre(t){const e=z.c(36),{path:s,open:n,onOpenChange:i,title:r,nested:l,nestedBlockRef:a,globalBlockKey:c,onDetach:d,onMakeGlobal:h}=t,u=re(),f=`${s}-loader-config`,p=a&&"ml-1";let m;e[0]!==p?(m=ie("rounded-lg border border-border/80 bg-muted/30",p),e[0]=p,e[1]=m):m=e[1];let g;e[2]!==i||e[3]!==n?(g=()=>i(!n),e[2]=i,e[3]=n,e[4]=g):g=e[4];let x;e[5]!==n?(x=o.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:n?o.jsx(Gt,{size:16}):o.jsx(qs,{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 y;e[9]!==c?(y=c&&o.jsx(vre,{blockKey:c}),e[9]=c,e[10]=y):y=e[10];let _;e[11]!==b||e[12]!==y?(_=o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,y]}),e[11]=b,e[12]=y,e[13]=_):_=e[13];let v;e[14]!==f||e[15]!==n||e[16]!==g||e[17]!==x||e[18]!==_?(v=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]=v):v=e[19];let L;e[20]!==c||e[21]!==d||e[22]!==h||e[23]!==u?(L=(d||h)&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":u("sectionsEditor.anyOfField.loaderActions"),className:"h-7 w-7 shrink-0 text-muted-foreground",children:o.jsx(Qn,{size:16})})}),o.jsxs(zt,{align:"end",className:"w-48",children:[c&&d&&o.jsxs(Ye,{onClick:d,children:[o.jsx(sl,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.detach")]}),!c&&h&&o.jsxs(Ye,{onClick:h,children:[o.jsx(zn,{className:"h-4 w-4"}),u("sectionsEditor.anyOfField.makeGlobal")]})]})]}),e[20]=c,e[21]=d,e[22]=h,e[23]=u,e[24]=L):L=e[24];let S;e[25]!==v||e[26]!==L?(S=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:[v,L]}),e[25]=v,e[26]=L,e[27]=S):S=e[27];let w;e[28]!==f||e[29]!==l||e[30]!==n?(w=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]=w):w=e[31];let k;return e[32]!==S||e[33]!==w||e[34]!==m?(k=o.jsxs("div",{className:m,children:[S,w]}),e[32]=S,e[33]=w,e[34]=m,e[35]=k):k=e[35],k}function xv(t){const e=z.c(42),{schema:s,value:n,onChange:i,path:r,label:l,breadcrumbPath:a,onBreadcrumbChange:c,meta:d,decofile:h,onSaveReferencedBlock:u,sandbox:f,previewBaseUrl:p,onRequestAddSection:m}=t,g=re(),x=(s.anyOfRefs??[]).filter(wre),b=h&&n?uj(n,h):null,y=b?.data??n,_=b?null:nj(y),v=_??y,L=kie(x,{savedBlockKey:b?.blockKey,editorValue:y}),S=L.length>0?jie(y,L,b?.blockKey):L[0]?.resolveType??"",k=s.type==="block-ref"&&L.some(Lre);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 N;e[3]!==a?(N=a??[],e[3]=a,e[4]=N):N=e[4];const T=N,V=k&&T.length>0&&Nn(T[0])===C,A=V?T.slice(1):T,E=V?te=>{c?.([C,...te])}:c,[R,D]=P.useState(S),[I,O]=P.useState(S);I!==S&&(O(S),D(S));const[F,M]=P.useState(()=>Nie(y,b?.blockKey)),[$,B]=P.useState(!1);if(L.length>0){const te=R||S;let se;e[5]!==te?(se=Ce=>Ce.resolveType===te,e[5]=te,e[6]=se):se=e[6];const ne=L.find(se),Q=lv(y,d,ne?.schema),q=Cie(Q??ne?.schema??null,s.discriminatorKey),le=s.discriminatorKey,J=Ce=>{D(Ce);const xe=L.find(Ve=>Ve.resolveType===Ce),Ne=lv(y,d,xe?.schema),Te=new Set(Object.keys((Ne??xe?.schema)?.properties??{})),Me=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},Qe=Object.fromEntries(Object.entries(Me).filter(Ve=>{const[De]=Ve;return Te.has(De)})),We={...bre(xe?.schema),...Qe};if(le){const Ve=xe?.discriminatorValue??Ce;i({...We,[le]:Ve});return}if(bu(Ce)){i(We);return}i({...We,__resolveType:Ce})};let oe;e[7]!==te||e[8]!==le||e[9]!==i?(oe=Ce=>{if(le||!bu(te)||Ce===null||typeof Ce!="object"||Array.isArray(Ce)){i(Ce);return}const{__resolveType:xe,...Ne}=Ce;i(Ne)},e[7]=te,e[8]=le,e[9]=i,e[10]=oe):oe=e[10];const ee=oe,he=q?.properties?o.jsx(zi,{schema:q,value:v,onChange:Ce=>{if(b&&u){u(b.blockKey,Ce);return}if(_){i({...y,section:Ce});return}ee(Ce)},basePath:r,breadcrumbPath:A,onBreadcrumbChange:E,meta:d,decofile:h,onSaveReferencedBlock:u,sandbox:f,previewBaseUrl:p,onRequestAddSection:m}):null;if(k&&he&&A.length>0){let Ce;return e[11]!==he?(Ce=o.jsx("div",{className:"min-w-0",children:he}),e[11]=he,e[12]=Ce):Ce=e[12],Ce}let ae;e[13]!==r?(ae=r.includes("."),e[13]=r,e[14]=ae):ae=e[14];const de=ae,ue=b?()=>{const{name:Ce,...xe}=b.data;i(xe)}:void 0,pe=!b&&!_&&!!u&&k&&!bu(te)&&te.includes("/"),Z=v&&typeof v=="object"&&!Array.isArray(v)?v:{},ge=Ce=>{if(!u)return;const xe=Ce.trim(),Ne=Cx(xe,h??{});if(Ne){ve.error(Ne);return}u(xe,{...Z,__resolveType:te,name:xe}),i({__resolveType:xe}),B(!1),ve.success(g("sectionsEditor.anyOfField.globalBlockSaved",{name:xe}))},be=f?.virtualMcpId;let ke;e[15]!==l||e[16]!==r||e[17]!==s.description||e[18]!==be?(ke=o.jsx(Ks,{htmlFor:r,label:l,description:s.description,virtualMcpId:be}),e[15]=l,e[16]=r,e[17]=s.description,e[18]=be,e[19]=ke):ke=e[19];let we;e[20]!==g?(we=g("sectionsEditor.anyOfField.selectPlaceholder"),e[20]=g,e[21]=we):we=e[21];let Le;e[22]!==we?(Le=o.jsx(As,{placeholder:we}),e[22]=we,e[23]=Le):Le=e[23];let _e;return e[24]!==r||e[25]!==Le?(_e=o.jsx(js,{id:r,className:"w-full min-w-0",children:Le}),e[24]=r,e[25]=Le,e[26]=_e):_e=e[26],o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1.5",children:[ke,o.jsxs(ks,{value:te||void 0,onValueChange:J,children:[_e,o.jsx(Cs,{children:L.map(_re)})]})]}),he&&(k?o.jsx(yre,{path:r,open:F,onOpenChange:M,title:g(de?"sectionsEditor.anyOfField.configuration":"sectionsEditor.anyOfField.loaderConfiguration"),nested:he,nestedBlockRef:de,globalBlockKey:b?.blockKey,onDetach:ue,onMakeGlobal:pe?()=>B(!0):void 0}):he),pe&&o.jsx(Nx,{open:$,onOpenChange:B,defaultBlockId:pj(ws(te)),onSubmit:ge})]})}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(Ks,{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=te=>i(te.target.value),e[32]=i,e[33]=K):K=e[33];const G=s.description??"";let Y;e[34]!==r||e[35]!==W||e[36]!==K||e[37]!==G?(Y=o.jsx("input",{id:r,type:"text",value:W,onChange:K,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:G}),e[34]=r,e[35]=W,e[36]=K,e[37]=G,e[38]=Y):Y=e[38];let X;return e[39]!==H||e[40]!==Y?(X=o.jsxs("div",{className:"space-y-1.5",children:[H,Y]}),e[39]=H,e[40]=Y,e[41]=X):X=e[41],X}function _re(t){const e=Sie(t);return o.jsx(Dt,{value:t.resolveType,children:e},t.resolveType)}function Lre(t){return t.resolveType.includes("/")&&!bu(t.resolveType)}function wre(t){return t.resolveType!==""}const hm=(t,e)=>t.match(new RegExp(`\\b${e}\\s*=\\s*"([^"]*)"`,"i"))?.[1];function Sre(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=hm(i,"id");if(!l)continue;const a=hm(i,"viewBox"),c=hm(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 kre(t){const e=await fetch(t);if(!e.ok)throw new Error(`Failed to fetch sprite sheet: ${e.status}`);return Sre(await e.text())}function jre(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 Cre(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 Nre(t,e){return t.length>0?t:e}function Tre(t,e){const s=e.trim().toLowerCase();return s?t.filter(n=>n.value.toLowerCase().includes(s)||(n.label??"").toLowerCase().includes(s)):t}function Vre({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 gj(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 Are(){return getComputedStyle(document.documentElement).getPropertyValue("--foreground").trim()||void 0}function Pre(t,e){if(t.previewSrc)return t.previewSrc;if(t.image)return t.image;if(t.icon)return gj(t.icon,e)}async function Ere(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 jre(a)}function bv(t){const e=z.c(9),{option:s,className:n,fg:i}=t;let r;e[0]!==i||e[1]!==s?(r=Pre(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=ie("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 Rre(t){const e=z.c(53),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=re(),d=s.options,h=a?.previewUrl,[u,f]=P.useState(!1),[p,m]=P.useState(""),[g,x]=P.useState(""),b=P.useRef(null);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=ee=>{m(ee),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{x(ee)},300)},e[0]=y):y=e[0];const _=y,v=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"",L=typeof n=="string"?n:"",S=s.format==="icon-select";let w;e[1]!==g||e[2]!==d||e[3]!==v?(w=Ge.sandboxInvoke(v,`dynamic-options:${d??""}:${g}`),e[1]=g,e[2]=d,e[3]=v,e[4]=w):w=e[4];let k;e[5]!==g||e[6]!==d||e[7]!==h?(k=()=>Ere(h,d,g||void 0),e[5]=g,e[6]=d,e[7]=h,e[8]=k):k=e[8];const j=!!h&&!!d&&(u||!!L);let C;e[9]!==w||e[10]!==k||e[11]!==j?(C={queryKey:w,queryFn:k,enabled:j,staleTime:6e4,retry:1},e[9]=w,e[10]=k,e[11]=j,e[12]=C):C=e[12];const N=Tt(C),T=N.data??[];let V;e[13]!==v?(V=Ge.sandboxSprite(v),e[13]=v,e[14]=V):V=e[14];let A;e[15]!==h||e[16]!==a?(A=()=>kre(eL({orgSlug:a.orgSlug,virtualMcpId:a.virtualMcpId,branch:a.branch,threadId:a.threadId,previewUrl:h},"/sprites.svg")),e[15]=h,e[16]=a,e[17]=A):A=e[17];const E=S&&!!a&&(u||!!L)&&(!d||N.isFetched&&T.length===0);let R;e[18]!==V||e[19]!==A||e[20]!==E?(R={queryKey:V,queryFn:A,enabled:E,staleTime:3e5,retry:1},e[18]=V,e[19]=A,e[20]=E,e[21]=R):R=e[21];const D=Tt(R),I=Cre(s.enum),O=D.data??{},F=Are(),M=Object.fromEntries(Object.entries(O).map(ee=>{const[he,ae]=ee;return[he,gj(ae,F)]})),$=S&&Object.keys(M).length>0?I.map(ee=>({...ee,previewSrc:M[ee.value]})):I,B=Nre(T,$),U=Tre(B,p);let H;e[22]!==L?(H=ee=>ee.value===L,e[22]=L,e[23]=H):H=e[23];const W=B.find(H),K=p.trim(),G=N.isFetched&&!N.isFetching&&p===g,Y=Vre({loaderPath:d,isIconSelect:S,enumFallbackCount:I.length,trimmedSearch:K,optionValues:B.map(Dre),optionsSettled:G});if((!h||!d)&&I.length===0){const ee=a?.virtualMcpId;let he;e[24]!==l||e[25]!==r||e[26]!==s.description||e[27]!==ee?(he=o.jsx(Ks,{htmlFor:r,label:l,description:s.description,virtualMcpId:ee}),e[24]=l,e[25]=r,e[26]=s.description,e[27]=ee,e[28]=he):he=e[28];let ae;e[29]!==i?(ae=pe=>i(pe.target.value),e[29]=i,e[30]=ae):ae=e[30];let de;e[31]!==L||e[32]!==r||e[33]!==ae?(de=o.jsx(gt,{id:r,type:"text",value:L,onChange:ae}),e[31]=L,e[32]=r,e[33]=ae,e[34]=de):de=e[34];let ue;return e[35]!==he||e[36]!==de?(ue=o.jsxs("div",{className:"space-y-2",children:[he,de]}),e[35]=he,e[36]=de,e[37]=ue):ue=e[37],ue}const te=a?.virtualMcpId;let se;e[38]!==l||e[39]!==r||e[40]!==s.description||e[41]!==te?(se=o.jsx(Ks,{htmlFor:r,label:l,description:s.description,virtualMcpId:te}),e[38]=l,e[39]=r,e[40]=s.description,e[41]=te,e[42]=se):se=e[42];const ne=W?o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(bv,{option:W,className:"h-6 w-6",fg:F}),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 Q;e[43]===Symbol.for("react.memo_cache_sentinel")?(Q=o.jsx(V9,{className:"size-4 shrink-0 opacity-50"}),e[43]=Q):Q=e[43];let q;e[44]!==u||e[45]!==ne?(q=o.jsx(ts,{asChild:!0,children:o.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":u,className:"h-10 w-full justify-between font-normal",children:[ne,Q]})}),e[44]=u,e[45]=ne,e[46]=q):q=e[46];let le;e[47]===Symbol.for("react.memo_cache_sentinel")?(le={width:"var(--radix-popover-trigger-width)"},e[47]=le):le=e[47];let J;e[48]!==c?(J=c("sectionsEditor.dynamicOptionsField.searchPlaceholder"),e[48]=c,e[49]=J):J=e[49];let oe;return e[50]!==p||e[51]!==J?(oe=o.jsx(An,{placeholder:J,className:"h-9",value:p,onValueChange:_}),e[50]=p,e[51]=J,e[52]=oe):oe=e[52],o.jsxs("div",{className:"space-y-2",children:[se,o.jsxs(ns,{open:u,onOpenChange:f,children:[q,o.jsx(ss,{className:"p-0",style:le,children:o.jsxs(Fn,{shouldFilter:!1,children:[oe,o.jsxs(Pn,{children:[!Y&&o.jsx(hn,{children:N.isLoading?c("sectionsEditor.dynamicOptionsField.loading"):c("sectionsEditor.dynamicOptionsField.noResults")}),o.jsx(os,{children:U.map(ee=>o.jsxs(Ft,{value:ee.value,className:"cursor-pointer",onSelect:()=>{i(ee.value===L?"":ee.value),f(!1)},children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(bv,{option:ee,className:ie(ee.image?"h-9 w-9":"h-6 w-6"),fg:F}),o.jsx("span",{className:"truncate",children:ee.label??ee.value})]}),o.jsx(Kt,{className:ie("ml-auto size-4 shrink-0",L===ee.value?"opacity-100":"opacity-0")})]},ee.value))}),Y&&o.jsx(os,{children:o.jsx(Ft,{value:K,className:"cursor-pointer",onSelect:()=>{i(K),m(""),x(""),f(!1)},children:o.jsx("span",{className:"truncate",children:c("sectionsEditor.dynamicOptionsField.useValue",{value:K})})})})]})]})})]})]})}function Dre(t){return t.value}function xj(t){const e=z.c(17),{org:s}=Be(),n=gs();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=y7,l=Ge.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 u=>{const{pageParam:f}=u;return await n.call("FILE_OBJECTS_LIST",{configId:t.configId,cursor:f??void 0,search:r,imageOnly:i||void 0})},e[8]=i,e[9]=t.configId,e[10]=r,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==c||e[15]!==d?(h={queryKey:l,enabled:c,staleTime:3e4,initialPageParam:null,queryFn:d,getNextPageParam:Ire},e[13]=l,e[14]=c,e[15]=d,e[16]=h):h=e[16],a(h)}function Ire(t){return t.nextCursor??void 0}function p1(){const t=z.c(2),{org:e}=Be();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(Mre);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],Vs(s)}function Mre(){return""}function Ore(){const t=z.c(8),{org:e}=Be(),s=gs(),n=cs();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:Ge.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],Vs(l)}function Tx(t){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(t)}function bj(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"file":t.slice(e+1).toLowerCase()}function Of(t){const e=t.split("/");return e[e.length-1]??t}function vj(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const g1="file-picker:last-config-id";function yj(t){const e=z.c(31),s=re(),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(Jt,{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(Tn,{children:a}),e[7]=a,e[8]=c):c=e[8];let d;e[9]!==l||e[10]!==c?(d=o.jsxs(ms,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11];let h;e[12]!==s?(h=b=>{const{error:y}=b;return o.jsx($re,{error:y??new Error(s("filePicker.filePickerDialog.failedToLoadBuckets"))})},e[12]=s,e[13]=h):h=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Pt,{className:"h-64 w-full"}),e[14]=u):u=e[14];let f;e[15]!==t?(f=b=>{t.onSelect(b),t.onOpenChange(!1)},e[15]=t,e[16]=f):f=e[16];let p;e[17]!==t.lockedConfigId||e[18]!==t.mode||e[19]!==f?(p=o.jsx(P.Suspense,{fallback:u,children:o.jsx(Bre,{mode:t.mode,lockedConfigId:t.lockedConfigId,onSelect:f})}),e[17]=t.lockedConfigId,e[18]=t.mode,e[19]=f,e[20]=p):p=e[20];let m;e[21]!==p||e[22]!==h?(m=o.jsx(Hs,{fallback:h,children:p}),e[21]=p,e[22]=h,e[23]=m):m=e[23];let g;e[24]!==m||e[25]!==d?(g=o.jsxs(Wt,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[d,m]}),e[24]=m,e[25]=d,e[26]=g):g=e[26];let x;return e[27]!==t.onOpenChange||e[28]!==t.open||e[29]!==g?(x=o.jsx(qt,{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 $re(t){const e=z.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 Bre(t){const e=z.c(32),{mode:s,lockedConfigId:n,onSelect:i}=t,r=J8();if(r.length===0){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Ure,{}),e[0]=m):m=e[0],m}if(n){let m;if(e[1]!==r||e[2]!==n){let x;e[4]!==n?(x=b=>b.id===n,e[4]=n,e[5]=x):x=e[5],m=r.find(x),e[1]=r,e[2]=n,e[3]=m}else m=e[3];const g=m;if(g){let x;return e[6]!==g||e[7]!==s||e[8]!==i?(x=o.jsx(fm,{config:g,mode:s,onSelect:i}),e[6]=g,e[7]=s,e[8]=i,e[9]=x):x=e[9],x}}if(r.length===1){const m=r[0];let g;return e[10]!==m||e[11]!==s||e[12]!==i?(g=o.jsx(fm,{config:m,mode:s,onSelect:i}),e[10]=m,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(g1):null,e[14]=l):l=e[14];const a=l;let c;e[15]!==r?(c=r.find(m=>m.id===a)?.id??r[0].id,e[15]=r,e[16]=c):c=e[16];const d=c;let h;e[17]!==r?(h=r.map(zre),e[17]=r,e[18]=h):h=e[18];let u;e[19]!==h?(u=o.jsx(md,{className:"self-start",children:h}),e[19]=h,e[20]=u):u=e[20];let f;if(e[21]!==r||e[22]!==s||e[23]!==i){let m;e[25]!==s||e[26]!==i?(m=g=>o.jsx(zl,{value:g.id,className:"min-h-0 flex-1 overflow-hidden flex flex-col",children:o.jsx(fm,{config:g,mode:s,onSelect:i})},g.id),e[25]=s,e[26]=i,e[27]=m):m=e[27],f=r.map(m),e[21]=r,e[22]=s,e[23]=i,e[24]=f}else f=e[24];let p;return e[28]!==d||e[29]!==u||e[30]!==f?(p=o.jsxs(ba,{defaultValue:d,onValueChange:Fre,className:"min-h-0 flex-1 flex flex-col",children:[u,f]}),e[28]=d,e[29]=u,e[30]=f,e[31]=p):p=e[31],p}function zre(t){return o.jsx(di,{value:t.id,children:t.name},t.id)}function Fre(t){typeof window<"u"&&window.localStorage.setItem(g1,t)}function Ure(){const t=z.c(12),e=re();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(Xn,{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 fm({config:t,mode:e,onSelect:s}){const n=re(),[i,r]=P.useState(""),l=R9(i,300),a=xj({configId:t.id,search:l,imageOnly:e==="image"}),c=p1(),[d,h]=P.useState(!1),u=P.useRef(null),f=e==="image"?"image/*":void 0;async function p(w){if(!w)return;const k=Array.from(w);if(k.length===0)return;let j=null;const C=[];for(const N of k)try{const T=await c.mutateAsync({configId:t.id,file:N});j??=T.publicUrl}catch(T){C.push(`${N.name} (${T instanceof Error?T.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 m(w){w.preventDefault(),h(!0)}function g(){h(!1)}function x(w){w.preventDefault(),w.stopPropagation(),h(!1),p(w.dataTransfer.files)}const y=(a.data?.pages??[]).flatMap(w=>w.items),_=y.filter(w=>e==="image"?Tx(w.key):!0),v=l.trim(),L=y.length>0||i.trim().length>0,S=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:()=>u.current?.click(),onDragOver:m,onDragLeave:g,onDrop:x,className:ie("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(Xn,{size:18,className:"text-muted-foreground"}),o.jsx("p",{className:"text-sm font-medium",children:c.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick")}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("filePicker.filePickerDialog.uploadSizeLimit")," ",n(e==="image"?"filePicker.filePickerDialog.imagesOnlyTypes":"filePicker.filePickerDialog.commonMediaTypes")]}),o.jsx("input",{ref:u,type:"file",accept:f,multiple:!0,className:"hidden",onChange:w=>{const k=Array.from(w.target.files??[]);w.target.value="",p(k)}})]}),L?o.jsx(N9,{value:i,onChange:r,isSearching:S,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?v?o.jsx(Wre,{query:v}):e==="image"&&y.length>0?o.jsx(Kre,{}):o.jsx(Hre,{}):e==="image"?o.jsx(qre,{items:_,onSelect:s}):o.jsx(Gre,{items:_,onSelect:s}),a.hasNextPage&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(me,{type:"button",variant:"outline",size:"sm",disabled:a.isFetchingNextPage,onClick:()=>a.fetchNextPage(),children:a.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),n("filePicker.filePickerDialog.loading")]}):n("filePicker.filePickerDialog.loadMore")})})]})]})}function Hre(){const t=z.c(12),e=re();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(xr,{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 Kre(){const t=z.c(12),e=re();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(xr,{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 Wre(t){const e=z.c(13),{query:s}=t,n=re();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(xr,{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 qre(t){const e=z.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(_j,{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 Gre(t){const e=z.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(_j,{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 _j(t){const e=z.c(58),{item:s,variant:n,onSelect:i}=t;let r;e[0]!==s.key?(r=bj(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 v;e[5]!==s.key||e[6]!==s.publicUrl?(v=o.jsx("img",{src:s.publicUrl,alt:s.key,loading:"lazy",className:"h-full w-full object-cover",onError:Yre}),e[5]=s.key,e[6]=s.publicUrl,e[7]=v):v=e[7];let L;e[8]!==s.key||e[9]!==_||e[10]!==v?(L=o.jsx("button",{type:"button",onClick:_,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:s.key,children:v}),e[8]=s.key,e[9]=_,e[10]=v,e[11]=L):L=e[11];let S;e[12]!==l?(S=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]=S):S=e[13];let w;e[14]!==s||e[15]!==i?(w=o.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:o.jsx(vv,{item:s,onSelect:i})}),e[14]=s,e[15]=i,e[16]=w):w=e[16];let k;e[17]!==s.key?(k=Of(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]!==S||e[23]!==w||e[24]!==j?(C=o.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[L,S,w,j]}),e[21]=L,e[22]=S,e[23]=w,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:Tx(s.key)?o.jsx(xr,{size:16,className:"text-muted-foreground"}):o.jsx(so,{size:16,className:"text-muted-foreground"})}),e[29]=s.key,e[30]=c):c=e[30];let d;e[31]!==s.key?(d=Of(s.key),e[31]=s.key,e[32]=d):d=e[32];let h;e[33]!==d?(h=o.jsx("p",{className:"truncate text-sm font-medium",children:d}),e[33]=d,e[34]=h):h=e[34];let u;e[35]!==s.key?(u=o.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:s.key}),e[35]=s.key,e[36]=u):u=e[36];let f;e[37]!==h||e[38]!==u?(f=o.jsxs("div",{className:"min-w-0 flex-1",children:[h,u]}),e[37]=h,e[38]=u,e[39]=f):f=e[39];let p;e[40]!==l?(p=o.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:l}),e[40]=l,e[41]=p):p=e[41];let m;e[42]!==s.size?(m=vj(s.size),e[42]=s.size,e[43]=m):m=e[43];let g;e[44]!==m?(g=o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:m}),e[44]=m,e[45]=g):g=e[45];let x;e[46]!==g||e[47]!==a||e[48]!==c||e[49]!==f||e[50]!==p?(x=o.jsxs("button",{type:"button",onClick:a,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[c,f,p,g]}),e[46]=g,e[47]=a,e[48]=c,e[49]=f,e[50]=p,e[51]=x):x=e[51];let b;e[52]!==s||e[53]!==i?(b=o.jsx(vv,{item:s,onSelect:i}),e[52]=s,e[53]=i,e[54]=b):b=e[54];let y;return e[55]!==x||e[56]!==b?(y=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]=y):y=e[57],y}function Yre(t){t.target.style.display="none"}function vv(t){const e=z.c(39),{item:s,onSelect:n}=t,i=re(),[r,l]=P.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 h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(E9,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx(Bt,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:Xre,"aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==s.publicUrl||e[9]!==n?(f=()=>n(s.publicUrl),e[8]=s.publicUrl,e[9]=n,e[10]=f):f=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Kt,{size:14}),e[11]=p):p=e[11];let m;e[12]!==i?(m=i("filePicker.filePickerDialog.useThis"),e[12]=i,e[13]=m):m=e[13];let g;e[14]!==f||e[15]!==m?(g=o.jsxs(Ye,{onClick:f,children:[p,m]}),e[14]=f,e[15]=m,e[16]=g):g=e[16];let x;e[17]!==r?(x=r?o.jsx(Kt,{size:14}):o.jsx(dn,{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 y;e[22]!==c||e[23]!==b||e[24]!==x?(y=o.jsxs(Ye,{onClick:c,children:[x,b]}),e[22]=c,e[23]=b,e[24]=x,e[25]=y):y=e[25];const _=s.publicUrl;let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(un,{size:14}),e[26]=v):v=e[26];let L;e[27]!==i?(L=i("filePicker.filePickerDialog.openInNewTab"),e[27]=i,e[28]=L):L=e[28];let S;e[29]!==s.publicUrl||e[30]!==L?(S=o.jsx(Ye,{asChild:!0,children:o.jsxs("a",{href:_,target:"_blank",rel:"noreferrer",onClick:Jre,children:[v,L]})}),e[29]=s.publicUrl,e[30]=L,e[31]=S):S=e[31];let w;e[32]!==y||e[33]!==S||e[34]!==g?(w=o.jsxs(zt,{align:"end",onClick:Qre,children:[g,y,S]}),e[32]=y,e[33]=S,e[34]=g,e[35]=w):w=e[35];let k;return e[36]!==w||e[37]!==u?(k=o.jsxs($t,{children:[u,w]}),e[36]=w,e[37]=u,e[38]=k):k=e[38],k}function Jre(t){return t.stopPropagation()}function Qre(t){return t.stopPropagation()}function Xre(t){return t.stopPropagation()}function Lj(){const t=z.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(Xn,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function wj(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Sj(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const Zre=["low","medium","high","original"];function kj(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function jj(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=eoe(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 Cj(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 h=d.indexOf("=");return(h>=0?d.slice(0,h):d)!==e});return s!==void 0&&c.push(`${e}=${s}`),`${a}${c.length?`?${c.join("&")}`:""}${i}`}function eoe(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 toe(t){if(!t)return;const e=jj(t,"quality");return kj(e)?e:void 0}function soe(t,e){return Cj(t,"quality",e)}function noe(t){return t?jj(t,"muted")!=="false":!0}function ioe(t,e){return Cj(t,"muted",e?void 0:"false")}function Nj(t){const e=z.c(36),{value:s,onChange:n,showMuted:i}=t,r=i===void 0?!1:i,l=re(),a=P.useId();let c;e[0]!==s?(c=toe(s),e[0]=s,e[1]=c):c=e[1];const d=c;let h;e[2]!==s?(h=noe(s),e[2]=s,e[3]=h):h=e[3];const u=h;let f;e[4]!==l?(f=l("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=l,e[5]=f):f=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(E9,{size:14}),e[6]=p):p=e[6];let m;e[7]!==f?(m=o.jsx(ts,{asChild:!0,children:o.jsx(me,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":f,children:p})}),e[7]=f,e[8]=m):m=e[8];let g;e[9]!==l?(g=l("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=l,e[10]=g):g=e[10];let x;e[11]!==g?(x=o.jsx(Ot,{className:"text-xs text-muted-foreground",children:g}),e[11]=g,e[12]=x):x=e[12];const b=d??"";let y;e[13]!==n||e[14]!==s?(y=j=>n(soe(s,kj(j)?j:void 0)),e[13]=n,e[14]=s,e[15]=y):y=e[15];let _;e[16]===Symbol.for("react.memo_cache_sentinel")?(_=Zre.map(roe),e[16]=_):_=e[16];let v;e[17]!==y||e[18]!==b?(v=o.jsx(_9,{type:"single",variant:"outline",size:"sm",value:b,onValueChange:y,children:_}),e[17]=y,e[18]=b,e[19]=v):v=e[19];let L;e[20]!==v||e[21]!==x?(L=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,v]}),e[20]=v,e[21]=x,e[22]=L):L=e[22];let S;e[23]!==u||e[24]!==a||e[25]!==n||e[26]!==r||e[27]!==l||e[28]!==s?(S=r&&o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(Ot,{htmlFor:a,className:"text-xs text-muted-foreground",children:l("sectionsEditor.mediaTransformControls.mutedLabel")}),o.jsx(Pi,{id:a,checked:u,onCheckedChange:j=>n(ioe(s,j))})]}),e[23]=u,e[24]=a,e[25]=n,e[26]=r,e[27]=l,e[28]=s,e[29]=S):S=e[29];let w;e[30]!==L||e[31]!==S?(w=o.jsx(ss,{align:"end",className:"w-auto min-w-52 p-3",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[L,S]})}),e[30]=L,e[31]=S,e[32]=w):w=e[32];let k;return e[33]!==w||e[34]!==m?(k=o.jsxs(ns,{children:[m,w]}),e[33]=w,e[34]=m,e[35]=k):k=e[35],k}function roe(t){return o.jsx(Qc,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function Tj(t,e,s){return e||(t.length===1?t[0].id:t.length===0?null:t.some(n=>n.id===s)?s:null)}function yv(t){const e=z.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 ooe(t){const e=z.c(81),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=re(),d=s.format==="video-uri",h=kx(n),[u,f]=P.useState(!1),[p,m]=P.useState(!1),g=h?wj(h):"",x=g?Sj(g):"",b=Dg(),y=p1();let _;e[0]!==b.data?.configs?(_=b.data?.configs??[],e[0]=b.data?.configs,e[1]=_):_=e[1];const v=a?.siteSlug;let L;e[2]!==_||e[3]!==v?(L=H9(_,v),e[2]=_,e[3]=v,e[4]=L):L=e[4];const S=L;let w;e[5]!==b.data?.configs||e[6]!==d||e[7]!==S?.id||e[8]!==i||e[9]!==f||e[10]!==c||e[11]!==y?(w=async function(Q){if(!Q)return;let q=Array.from(Q);if(q.length===0)return;if(d&&(q=q.filter(loe),q.length===0)){ve.error(c("sectionsEditor.fileField.videoFileError"));return}const le=Tj(b.data?.configs??[],S?.id,typeof window<"u"?window.localStorage.getItem(g1):null);if(!le){f(!0);return}try{const J=await y.mutateAsync({configId:le,file:q[0]});i(J.publicUrl),q.length>1&&ve.info(c("sectionsEditor.fileField.multiFileWarning",{fileName:q[0].name}))}catch(J){const oe=J;ve.error(oe instanceof Error?oe.message:c("sectionsEditor.fileField.uploadFailed"))}},e[5]=b.data?.configs,e[6]=d,e[7]=S?.id,e[8]=i,e[9]=f,e[10]=c,e[11]=y,e[12]=w):w=e[12];const k=w;let j;e[13]!==m?(j=function(Q){Q.preventDefault(),Q.dataTransfer.types.includes("Files")&&m(!0)},e[13]=m,e[14]=j):j=e[14];const C=j;let N;e[15]!==m?(N=function(Q){Q.currentTarget===Q.target&&m(!1)},e[15]=m,e[16]=N):N=e[16];const T=N;let V;e[17]!==k||e[18]!==m?(V=function(Q){Q.preventDefault(),Q.stopPropagation(),m(!1),k(Q.dataTransfer.files)},e[17]=k,e[18]=m,e[19]=V):V=e[19];const A=V,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(Ks,{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 D=p&&"border-primary ring-2 ring-primary/30",I=y.isPending&&"pointer-events-none opacity-60";let O;e[25]!==D||e[26]!==I?(O=ie("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",D,I),e[25]=D,e[26]=I,e[27]=O):O=e[27];let F;e[28]!==x||e[29]!==g||e[30]!==d||e[31]!==f||e[32]!==h||e[33]!==c||e[34]!==y.isPending?(F=h?d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>f(!0),"aria-label":c("sectionsEditor.fileField.replaceVideoLabel"),className:"relative block h-40 w-full cursor-pointer overflow-hidden bg-black",children:[o.jsx("video",{src:h,preload:"metadata",className:"h-full w-full object-contain"},h),o.jsx(Lj,{})]}),o.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[o.jsx(m4,{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(yv,{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(so,{size:18,className:"text-muted-foreground"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-medium",children:g}),o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:h})]}),o.jsx(yv,{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(m4,{size:20}):o.jsx(so,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:y.isPending?c("sectionsEditor.fileField.uploading"):c(d?"sectionsEditor.fileField.dropVideoHint":"sectionsEditor.fileField.dropFileHint")}),o.jsx("span",{className:"text-xs text-muted-foreground",children:c("sectionsEditor.fileField.sizeLimit")})]}),e[28]=x,e[29]=g,e[30]=d,e[31]=f,e[32]=h,e[33]=c,e[34]=y.isPending,e[35]=F):F=e[35];let M;e[36]!==p||e[37]!==c?(M=p&&o.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:o.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:c("sectionsEditor.fileField.dropToUpload")})}),e[36]=p,e[37]=c,e[38]=M):M=e[38];let $;e[39]!==T||e[40]!==C||e[41]!==A||e[42]!==O||e[43]!==F||e[44]!==M?($=o.jsxs("div",{onDragOver:C,onDragLeave:T,onDrop:A,className:O,children:[F,M]}),e[39]=T,e[40]=C,e[41]=A,e[42]=O,e[43]=F,e[44]=M,e[45]=$):$=e[45];let B;e[46]!==i?(B=ne=>i(ne.target.value),e[46]=i,e[47]=B):B=e[47];let U;e[48]!==r||e[49]!==h||e[50]!==B?(U=o.jsx(gt,{id:r,type:"url",value:h,onChange:B,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[48]=r,e[49]=h,e[50]=B,e[51]=U):U=e[51];let H;e[52]!==f||e[53]!==h||e[54]!==c?(H=!h&&o.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:()=>f(!0),className:"h-9 shrink-0",children:[o.jsx(Xn,{size:14}),c("sectionsEditor.fileField.browseButton")]}),e[52]=f,e[53]=h,e[54]=c,e[55]=H):H=e[55];let W;e[56]!==d||e[57]!==i||e[58]!==h?(W=d&&h&&o.jsx(Nj,{value:h,onChange:i,showMuted:!0}),e[56]=d,e[57]=i,e[58]=h,e[59]=W):W=e[59];let K;e[60]!==i||e[61]!==h||e[62]!==c?(K=h&&o.jsx(me,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.fileField.removeFileLabel"),children:o.jsx(Gs,{size:14})}),e[60]=i,e[61]=h,e[62]=c,e[63]=K):K=e[63];let G;e[64]!==U||e[65]!==H||e[66]!==W||e[67]!==K?(G=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[U,H,W,K]}),e[64]=U,e[65]=H,e[66]=W,e[67]=K,e[68]=G):G=e[68];let Y;e[69]!==i?(Y=ne=>i(ne),e[69]=i,e[70]=Y):Y=e[70];const X=S?.id??null;let te;e[71]!==u||e[72]!==f||e[73]!==Y||e[74]!==X?(te=o.jsx(yj,{open:u,onOpenChange:f,mode:"any",onSelect:Y,lockedConfigId:X}),e[71]=u,e[72]=f,e[73]=Y,e[74]=X,e[75]=te):te=e[75];let se;return e[76]!==$||e[77]!==G||e[78]!==te||e[79]!==R?(se=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[R,$,G,te]}),e[76]=$,e[77]=G,e[78]=te,e[79]=R,e[80]=se):se=e[80],se}function loe(t){return t.type.startsWith("video/")}const aoe=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function coe(t){const e=z.c(86),{schema:s,value:n,onChange:i,path:r,label:l,sandbox:a}=t,c=re(),d=kx(n),[h,u]=P.useState(!1),[f,p]=P.useState(!1),[m,g]=P.useState(!1),[x,b]=P.useState(!1),y=d?wj(d):"",_=y?Sj(y):"",v=Dg(),L=p1();let S;e[0]!==v.data?.configs?(S=v.data?.configs??[],e[0]=v.data?.configs,e[1]=S):S=e[1];const w=a?.siteSlug;let k;e[2]!==S||e[3]!==w?(k=H9(S,w),e[2]=S,e[3]=w,e[4]=k):k=e[4];const j=k;let C;e[5]!==i||e[6]!==b||e[7]!==g?(C=function(ee){g(!1),b(!1),i(ee)},e[5]=i,e[6]=b,e[7]=g,e[8]=C):C=e[8];const N=C;let T;e[9]!==v.data?.configs||e[10]!==j?.id||e[11]!==u||e[12]!==N||e[13]!==c||e[14]!==L?(T=async function(ee){if(!ee)return;const he=Array.from(ee).filter(doe);if(he.length===0){ve.error(c("sectionsEditor.imageField.onlyImageFilesAccepted"));return}const ae=Tj(v.data?.configs??[],j?.id,typeof window<"u"?window.localStorage.getItem(g1):null);if(!ae){u(!0);return}try{const de=await L.mutateAsync({configId:ae,file:he[0]});N(de.publicUrl),he.length>1&&ve.info(c("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:he[0].name}))}catch(de){const ue=de;ve.error(ue instanceof Error?ue.message:c("sectionsEditor.imageField.uploadFailed"))}},e[9]=v.data?.configs,e[10]=j?.id,e[11]=u,e[12]=N,e[13]=c,e[14]=L,e[15]=T):T=e[15];const V=T;let A;e[16]!==p?(A=function(ee){ee.preventDefault(),ee.dataTransfer.types.includes("Files")&&p(!0)},e[16]=p,e[17]=A):A=e[17];const E=A;let R;e[18]!==p?(R=function(ee){ee.currentTarget===ee.target&&p(!1)},e[18]=p,e[19]=R):R=e[19];const D=R;let I;e[20]!==V||e[21]!==p?(I=function(ee){ee.preventDefault(),ee.stopPropagation(),p(!1),V(ee.dataTransfer.files)},e[20]=V,e[21]=p,e[22]=I):I=e[22];const O=I,F=a?.virtualMcpId;let M;e[23]!==l||e[24]!==r||e[25]!==s.description||e[26]!==F?(M=o.jsx("div",{className:"min-w-0",children:o.jsx(Ks,{htmlFor:r,label:l,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:F})}),e[23]=l,e[24]=r,e[25]=s.description,e[26]=F,e[27]=M):M=e[27];const $=f&&"border-primary ring-2 ring-primary/30",B=L.isPending&&"pointer-events-none opacity-60";let U;e[28]!==$||e[29]!==B?(U=ie("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",$,B),e[28]=$,e[29]=B,e[30]=U):U=e[30];let H;e[31]!==_||e[32]!==y||e[33]!==x||e[34]!==m||e[35]!==l||e[36]!==b||e[37]!==g||e[38]!==u||e[39]!==d||e[40]!==c||e[41]!==L.isPending?(H=d?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>u(!0),"aria-label":c("sectionsEditor.imageField.replaceImage"),className:"relative block h-40 w-full cursor-pointer bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!x&&o.jsx("img",{src:d,alt:l,className:ie("h-full w-full object-contain transition-opacity",!m&&"opacity-0"),onLoad:()=>g(!0),onError:()=>b(!0)},d),x&&o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[o.jsx(xr,{size:20}),o.jsx("p",{className:"text-xs",children:c("sectionsEditor.imageField.previewUnavailable")})]}),!m&&!x&&o.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),o.jsx(Lj,{})]}),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:y}),_&&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:()=>u(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[o.jsx(xr,{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]=y,e[33]=x,e[34]=m,e[35]=l,e[36]=b,e[37]=g,e[38]=u,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]!==D||e[47]!==E||e[48]!==O||e[49]!==U||e[50]!==H||e[51]!==W?(K=o.jsxs("div",{onDragOver:E,onDragLeave:D,onDrop:O,className:U,children:[H,W]}),e[46]=D,e[47]=E,e[48]=O,e[49]=U,e[50]=H,e[51]=W,e[52]=K):K=e[52];let G;e[53]!==N?(G=oe=>N(oe.target.value),e[53]=N,e[54]=G):G=e[54];let Y;e[55]!==c?(Y=c("sectionsEditor.imageField.urlPlaceholder"),e[55]=c,e[56]=Y):Y=e[56];let X;e[57]!==r||e[58]!==d||e[59]!==G||e[60]!==Y?(X=o.jsx(gt,{id:r,type:"url",value:d,onChange:G,placeholder:Y,className:"h-9 min-w-0 flex-1"}),e[57]=r,e[58]=d,e[59]=G,e[60]=Y,e[61]=X):X=e[61];let te;e[62]!==u||e[63]!==d||e[64]!==c?(te=!d&&o.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:()=>u(!0),className:"h-9 shrink-0",children:[o.jsx(Xn,{size:14}),c("sectionsEditor.imageField.browse")]}),e[62]=u,e[63]=d,e[64]=c,e[65]=te):te=e[65];let se;e[66]!==N||e[67]!==d||e[68]!==c?(se=d&&o.jsxs(o.Fragment,{children:[o.jsx(Nj,{value:d,onChange:N}),o.jsx(me,{type:"button",variant:"ghost",size:"sm",onClick:()=>N(""),className:"h-9 shrink-0","aria-label":c("sectionsEditor.imageField.removeImage"),children:o.jsx(Gs,{size:14})})]}),e[66]=N,e[67]=d,e[68]=c,e[69]=se):se=e[69];let ne;e[70]!==X||e[71]!==te||e[72]!==se?(ne=o.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[X,te,se]}),e[70]=X,e[71]=te,e[72]=se,e[73]=ne):ne=e[73];let Q;e[74]!==N?(Q=oe=>N(oe),e[74]=N,e[75]=Q):Q=e[75];const q=j?.id??null;let le;e[76]!==h||e[77]!==u||e[78]!==Q||e[79]!==q?(le=o.jsx(yj,{open:h,onOpenChange:u,mode:"image",onSelect:Q,lockedConfigId:q}),e[76]=h,e[77]=u,e[78]=Q,e[79]=q,e[80]=le):le=e[80];let J;return e[81]!==M||e[82]!==K||e[83]!==ne||e[84]!==le?(J=o.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[M,K,ne,le]}),e[81]=M,e[82]=K,e[83]=ne,e[84]=le,e[85]=J):J=e[85],J}function doe(t){return aoe.has(t.type||"")}const uoe="0 0 1080 1080",hoe="matrix(1 0 0 1 540 540)",Vx=[{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 foe({selected:t,onSelect:e}){const s=re(),[n,i]=P.useState(uoe),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(h=>h===d?h:d)}catch{}};return o.jsx("svg",{ref:r,viewBox:n,role:"group","aria-label":s("sectionsEditor.brazilMap.ariaLabel"),className:"h-72 w-full rounded-md border border-border/60 bg-muted/20",children:o.jsx("g",{transform:hoe,children:Vx.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:ie("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 moe=[{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"}],poe="BR";function goe(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 xoe(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 boe(t,e){const s={...t,...e},n={};for(const i of["city","regionCode","country"])s[i]&&(n[i]=s[i]);return n}function _v(t){const e=z.c(37),{id:s,options:n,value:i,placeholder:r,emptyMessage:l,onChange:a}=t,[c,d]=P.useState(!1);let h;if(e[0]!==n||e[1]!==i){let w;e[3]!==i?(w=k=>k.value===i,e[3]=i,e[4]=w):w=e[4],h=n.find(w),e[0]=n,e[1]=i,e[2]=h}else h=e[2];const u=h;let f;e[5]!==r||e[6]!==u?(f=u?o.jsx("span",{className:"truncate",children:u.label}):o.jsx("span",{className:"text-muted-foreground",children:r}),e[5]=r,e[6]=u,e[7]=f):f=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(V9,{className:"size-4 shrink-0 opacity-50"}),e[8]=p):p=e[8];let m;e[9]!==s||e[10]!==c||e[11]!==f?(m=o.jsx(ts,{asChild:!0,children:o.jsxs(me,{id:s,variant:"outline",role:"combobox","aria-expanded":c,className:"h-10 w-full justify-between font-normal",children:[f,p]})}),e[9]=s,e[10]=c,e[11]=f,e[12]=m):m=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g={width:"var(--radix-popover-trigger-width)"},e[13]=g):g=e[13];let x;e[14]!==r?(x=o.jsx(An,{placeholder:r,className:"h-9"}),e[14]=r,e[15]=x):x=e[15];let b;e[16]!==l?(b=o.jsx(hn,{children:l}),e[16]=l,e[17]=b):b=e[17];let y;if(e[18]!==a||e[19]!==n||e[20]!==i){let w;e[22]!==a||e[23]!==i?(w=k=>o.jsxs(Ft,{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(Kt,{className:ie("ml-auto size-4 shrink-0",i===k.value?"opacity-100":"opacity-0")})]},k.value),e[22]=a,e[23]=i,e[24]=w):w=e[24],y=n.map(w),e[18]=a,e[19]=n,e[20]=i,e[21]=y}else y=e[21];let _;e[25]!==y?(_=o.jsx(os,{children:y}),e[25]=y,e[26]=_):_=e[26];let v;e[27]!==b||e[28]!==_?(v=o.jsxs(Pn,{children:[b,_]}),e[27]=b,e[28]=_,e[29]=v):v=e[29];let L;e[30]!==v||e[31]!==x?(L=o.jsx(ss,{className:"p-0",style:g,children:o.jsxs(Fn,{children:[x,v]})}),e[30]=v,e[31]=x,e[32]=L):L=e[32];let S;return e[33]!==c||e[34]!==L||e[35]!==m?(S=o.jsxs(ns,{open:c,onOpenChange:d,children:[m,L]}),e[33]=c,e[34]=L,e[35]=m,e[36]=S):S=e[36],S}const voe=moe.map(t=>({value:t.code,label:`${t.name} (${t.code})`})),yoe=Vx.map(t=>({value:t.code,label:`${t.name} (${t.code})`}));function Vj(t){const e=z.c(66),{schema:s,value:n,onChange:i,path:r,sandbox:l}=t,a=re();let c;e[0]!==n?(c=xoe(n),e[0]=n,e[1]=c):c=e[1];const d=c,{city:h,regionCode:u,country:f}=d;let p;e[2]!==s.properties?(p=s.properties??{},e[2]=s.properties,e[3]=p):p=e[3];const m=p;let g;e[4]!==m.country?.title||e[5]!==a?(g=m.country?.title??a("sectionsEditor.locationField.countryDefault"),e[4]=m.country?.title,e[5]=a,e[6]=g):g=e[6];const x=g;let b;e[7]!==m.regionCode?.title||e[8]!==a?(b=m.regionCode?.title??a("sectionsEditor.locationField.regionDefault"),e[7]=m.regionCode?.title,e[8]=a,e[9]=b):b=e[9];const y=b;let _;e[10]!==m.city?.title||e[11]!==a?(_=m.city?.title??a("sectionsEditor.locationField.cityDefault"),e[10]=m.city?.title,e[11]=a,e[12]=_):_=e[12];const v=_;let L;e[13]!==d||e[14]!==i?(L=j=>{i(boe(d,j))},e[13]=d,e[14]=i,e[15]=L):L=e[15];const S=L,w=f===poe;let k;if(e[16]!==h||e[17]!==v||e[18]!==f||e[19]!==x||e[20]!==S||e[21]!==w||e[22]!==r||e[23]!==u||e[24]!==y||e[25]!==l?.virtualMcpId||e[26]!==s.description||e[27]!==s.title||e[28]!==a){let j;e[30]!==u?(j=U=>U.code===u,e[30]=u,e[31]=j):j=e[31];const C=Vx.find(j),N=`${r}.country`;let T;e[32]!==s.title||e[33]!==a?(T=s.title??a("sectionsEditor.locationField.locationDefault"),e[32]=s.title,e[33]=a,e[34]=T):T=e[34];const V=l?.virtualMcpId;let A;e[35]!==s.description||e[36]!==T||e[37]!==V||e[38]!==N?(A=o.jsx(Ks,{htmlFor:N,label:T,description:s.description,virtualMcpId:V}),e[35]=s.description,e[36]=T,e[37]=V,e[38]=N,e[39]=A):A=e[39];const E=`${r}.country`;let R;e[40]!==x||e[41]!==E?(R=o.jsx(Ot,{htmlFor:E,className:"text-xs",children:x}),e[40]=x,e[41]=E,e[42]=R):R=e[42];const D=`${r}.country`;let I;e[43]!==a?(I=a("sectionsEditor.locationField.selectCountryPlaceholder"),e[43]=a,e[44]=I):I=e[44];let O;e[45]!==a?(O=a("sectionsEditor.locationField.noCountryFound"),e[45]=a,e[46]=O):O=e[46];let F;e[47]!==S?(F=U=>S({country:U,regionCode:"",city:""}),e[47]=S,e[48]=F):F=e[48];let M;e[49]!==f||e[50]!==D||e[51]!==I||e[52]!==O||e[53]!==F?(M=o.jsx(_v,{id:D,options:voe,value:f,placeholder:I,emptyMessage:O,onChange:F}),e[49]=f,e[50]=D,e[51]=I,e[52]=O,e[53]=F,e[54]=M):M=e[54];let $;e[55]!==R||e[56]!==M?($=o.jsxs("div",{className:"space-y-1.5",children:[R,M]}),e[55]=R,e[56]=M,e[57]=$):$=e[57];let B;e[58]!==f||e[59]!==S||e[60]!==w||e[61]!==r||e[62]!==u||e[63]!==y||e[64]!==a?(B=f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ot,{htmlFor:`${r}.regionCode`,className:"text-xs",children:y}),w?o.jsxs("div",{className:"space-y-2",children:[o.jsx(foe,{selected:u,onSelect:U=>S({regionCode:U===u?"":U,city:""})}),o.jsx(_v,{id:`${r}.regionCode`,options:yoe,value:u,placeholder:a("sectionsEditor.locationField.selectStatePlaceholder"),emptyMessage:a("sectionsEditor.locationField.noStateFound"),onChange:U=>S({regionCode:U,city:""})})]}):o.jsxs(o.Fragment,{children:[o.jsx(gt,{id:`${r}.regionCode`,type:"text",value:u,placeholder:a("sectionsEditor.locationField.regionCodePlaceholder"),onChange:U=>S({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]=S,e[60]=w,e[61]=r,e[62]=u,e[63]=y,e[64]=a,e[65]=B):B=e[65],k=o.jsxs("div",{className:"space-y-4",children:[A,$,B,f&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ot,{htmlFor:`${r}.city`,className:"text-xs",children:v}),o.jsx(gt,{id:`${r}.city`,type:"text",value:h,placeholder:w&&C?a("sectionsEditor.locationField.cityPlaceholderWithState",{state:C.name}):a("sectionsEditor.locationField.cityPlaceholder"),onChange:U=>S({city:U.target.value})}),o.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a("sectionsEditor.locationField.cityHelperText")})]})]}),e[16]=h,e[17]=v,e[18]=f,e[19]=x,e[20]=S,e[21]=w,e[22]=r,e[23]=u,e[24]=y,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 _oe(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 Loe(t){const e=z.c(52),s=re(),{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=rj(i,c.map(woe)),e[0]=n.inlineUnionBranches,e[1]=i,e[2]=c,e[3]=d):(c=e[2],d=e[3]);const h=d,[u,f]=P.useState(h),[p,m]=P.useState(h);p!==h&&(m(h),f(h));const g=Math.min(u,c.length-1),x=c[g];let b;e[4]!==c||e[5]!==r?(b=I=>{const O=Number(I);f(O),r({...c[O]?.discriminators??{}})},e[4]=c,e[5]=r,e[6]=b):b=e[6];const y=b;if(c.length===0)return null;let _;e[7]!==x?(_=x?_oe(x):null,e[7]=x,e[8]=_):_=e[8];const v=_;let L;if(e[9]!==x?.schema?.properties||e[10]!==i){let I;e[12]!==x?.schema?.properties?(I=x?.schema?.properties??{},e[12]=x?.schema?.properties,e[13]=I):I=e[13],L=Pie(i,Object.keys(I)),e[9]=x?.schema?.properties,e[10]=i,e[11]=L}else L=e[11];const S=L;let w;e[14]!==a||e[15]!==l||e[16]!==t.sandbox?.virtualMcpId||e[17]!==n.description?(w=a&&o.jsx(Ks,{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]=w):w=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(As,{placeholder:j}),e[21]=j,e[22]=C):C=e[22];let N;e[23]!==l||e[24]!==C?(N=o.jsx(js,{id:l,className:"w-full min-w-0",children:C}),e[23]=l,e[24]=C,e[25]=N):N=e[25];let T;if(e[26]!==c||e[27]!==s){let I;e[29]!==s?(I=(O,F)=>o.jsx(Dt,{value:String(F),children:Oie(O.title)||s("sectionsEditor.inlineUnionField.branchFallback",{index:F+1})},O.title),e[29]=s,e[30]=I):I=e[30],T=c.map(I),e[26]=c,e[27]=s,e[28]=T}else T=e[28];let V;e[31]!==T?(V=o.jsx(Cs,{children:T}),e[31]=T,e[32]=V):V=e[32];let A;e[33]!==y||e[34]!==V||e[35]!==k||e[36]!==N?(A=o.jsxs(ks,{value:k,onValueChange:y,children:[N,V]}),e[33]=y,e[34]=V,e[35]=k,e[36]=N,e[37]=A):A=e[37];let E;e[38]!==A||e[39]!==w?(E=o.jsxs("div",{className:"space-y-1.5",children:[w,A]}),e[38]=A,e[39]=w,e[40]=E):E=e[40];let R;e[41]!==x||e[42]!==v||e[43]!==r||e[44]!==l||e[45]!==S||e[46]!==t||e[47]!==i?(R=x&&(goe(x.schema?.properties)?o.jsx(Vj,{...t,schema:x.schema,onChange:I=>r({...S,...I,...x.discriminators??{}})}):v?o.jsx(zi,{schema:v,value:i,onChange:I=>r({...I,...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]=v,e[43]=r,e[44]=l,e[45]=S,e[46]=t,e[47]=i,e[48]=R):R=e[48];let D;return e[49]!==E||e[50]!==R?(D=o.jsxs("div",{className:"space-y-3",children:[E,R]}),e[49]=E,e[50]=R,e[51]=D):D=e[51],D}function woe(t){return{discriminators:t.discriminators,propertyKeys:Object.keys(t.schema?.properties??{})}}const Soe={lat:-21.9,lng:-41.42},Jp=1e5;let kh=null;function koe(t){return kh||(kh=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)}),kh)}function joe(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:Jp}}function Coe({schema:t,value:e,onChange:s,path:n,label:i,sandbox:r}){const l=Oc().googleMapsApiKey,a=P.useRef(s);a.current=s;const c=P.useRef(joe(e)),[d,h]=P.useState(null),u=P.useRef(null),f=p=>{if(!p||!l)return;const m={disposed:!1,circle:null,listeners:[]};return koe(l).then(g=>{if(m.disposed)return;const x=c.current,b=x?{lat:x.lat,lng:x.lng}:Soe,y=x?.radius??Jp,_=new g.Map(p,{center:b,zoom:y?Math.round(Math.log2(768e4/y))+1:4,draggable:!0,streetViewControl:!1,mapTypeControl:!1}),v=new g.Circle({strokeColor:"#2E6ED9",strokeOpacity:.8,strokeWeight:2,fillColor:"#2E6ED9",fillOpacity:.35,editable:!0,draggable:!0,map:_,center:b,radius:y});m.circle=v;const L=()=>{const w=v.getCenter(),k=v.getRadius();w&&a.current(`${w.lat()},${w.lng()},${k}`)},S=w=>{w&&m.listeners.push(w)};S(_.addListener("click",w=>{w.latLng&&(v.setCenter({lat:w.latLng.lat(),lng:w.latLng.lng()}),v.getRadius()||v.setRadius(Jp),L())})),S(v.addListener("radius_changed",L)),S(v.addListener("dragend",L))},g=>{m.disposed||h(g instanceof Error?g.message:"Failed to load map")}),()=>{m.disposed=!0;for(const g of m.listeners)try{g?.remove()}catch{}if(m.listeners=[],m.circle){try{m.circle.setMap(null)}catch{}m.circle=null}}};return u.current||(u.current=f),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ks,{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:u.current,id:n,className:"h-72 w-full rounded-md border border-border/60"}):o.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["The map picker is unavailable — set"," ",o.jsx("code",{className:"font-mono",children:"GOOGLE_MAPS_API_KEY"})," on the server to enable it."]})]})}const Noe="oklch(0.65 0.15 160)",Toe="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)]",Aj="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)]",rxe="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 Lv(t){return t.map(e=>e.label).join(`
624
- `)}function wv(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Voe(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 Aoe(t){return t.map((e,s)=>({...e,index:s}))}function Pj(t){const e=z.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:l,onDelete:a}=t,c=re(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let h;e[0]!==d?(h=ie("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=h):h=e[1];let u;e[2]!==h?(u=o.jsx(fd,{className:h}),e[2]=h,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(sl,{className:"h-4 w-4 shrink-0",style:{color:Noe}}),e[4]=f):f=e[4];let p;e[5]!==s?(p=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=p):p=e[6];let m;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==r||e[13]!==c?(m=!i&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:Eoe,onPointerDown:Poe,children:o.jsx(Qn,{size:14})})}),o.jsxs(zt,{align:"end",children:[r&&o.jsxs(Ye,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(C8,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Ye,{onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(dn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Ye,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(Gs,{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]=m):m=e[14];let g;return e[15]!==u||e[16]!==p||e[17]!==m?(g=o.jsxs(o.Fragment,{children:[u,f,p,m]}),e[15]=u,e[16]=p,e[17]=m,e[18]=g):g=e[18],g}function Poe(t){return t.stopPropagation()}function Eoe(t){return t.stopPropagation()}function Roe(t){const e=z.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:Doe},e[0]=s.id,e[1]=d):d=e[1];const{attributes:h,listeners:u,setNodeRef:f,transform:p,isDragging:m}=e1(d);let g;e[2]!==p?(g=Ri.Transform.toString(p?{...p,x:0}:null),e[2]=p,e[3]=g):g=e[3];const x=m?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const y=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 v=m?"cursor-grabbing":"cursor-grab",L=n?Aj:Toe;let S;e[9]!==v||e[10]!==L?(S=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",v,L),e[9]=v,e[10]=L,e[11]=S):S=e[11];let w;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(w=o.jsx(Pj,{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]=w):w=e[17];let k;return e[18]!==h||e[19]!==u||e[20]!==r||e[21]!==f||e[22]!==y||e[23]!==_||e[24]!==S||e[25]!==w?(k=o.jsx("div",{ref:f,style:y,...h,...u,onClick:r,onKeyDown:_,className:S,children:w}),e[18]=h,e[19]=u,e[20]=r,e[21]=f,e[22]=y,e[23]=_,e[24]=S,e[25]=w,e[26]=k):k=e[26],k}function Doe(){return!1}function Ioe(t){const e=z.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:h,onAdd:u}=t,f=re(),p=n.length>1;let m;e[0]!==n?(m=()=>wv(n),e[0]=n,e[1]=m):m=e[1];const[g,x]=P.useState(m),[b,y]=P.useState(null),[_,v]=P.useState(s),[L,S]=P.useState(n.length);let w;e[2]!==n?(w=()=>Lv(n),e[2]=n,e[3]=w):w=e[3];const[k,j]=P.useState(w),C=P.useRef(!1),N=Lv(n);_!==s?(v(s),S(n.length),j(N),x(wv(n))):(L!==n.length||k!==N)&&(S(n.length),j(N),x(de=>Voe(de,n)));let T;e[4]===Symbol.for("react.memo_cache_sentinel")?(T={activationConstraint:{distance:8}},e[4]=T):T=e[4];let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:t1},e[5]=V):V=e[5];const A=T0(vr(wa,T),vr(La,V));let E;e[6]!==g?(E=g.map(Moe),e[6]=g,e[7]=E):E=e[7];const R=E;let D;e[8]!==g?(D=de=>{const ue=String(de.active.id);y(g.find(pe=>pe.id===ue)??null)},e[8]=g,e[9]=D):D=e[9];const I=D;let O;e[10]!==R||e[11]!==h?(O=de=>{y(null);const{active:ue,over:pe}=de;if(!pe||ue.id===pe.id)return;const Z=R.indexOf(String(ue.id)),ge=R.indexOf(String(pe.id));Z===-1||ge===-1||(x(be=>Aoe(ea([...be],Z,ge))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),h(Z,ge))},e[10]=R,e[11]=h,e[12]=O):O=e[12];const F=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{y(null)},e[13]=M):M=e[13];const $=M;let B,U,H,W,K,G,Y,X,te,se,ne,Q,q;if(e[14]!==p||e[15]!==g||e[16]!==R||e[17]!==F||e[18]!==I||e[19]!==u||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==r||e[25]!==i||e[26]!==A||e[27]!==f){const de=We=>{C.current||r(We)};ne="space-y-1 border-b p-2";let ue;e[41]!==f?(ue=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ue):ue=e[42];let pe;e[43]!==ue?(pe=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ue}),e[43]=ue,e[44]=pe):pe=e[44];let Z;e[45]!==f?(Z=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=Z):Z=e[46];let ge;e[47]===Symbol.for("react.memo_cache_sentinel")?(ge=o.jsx(Ut,{size:14}),e[47]=ge):ge=e[47];let be;e[48]!==u||e[49]!==Z?(be=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":Z,className:"size-6",onClick:u,children:ge})}),e[48]=u,e[49]=Z,e[50]=be):be=e[50];let ke;e[51]!==f?(ke=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=ke):ke=e[52];let we;e[53]!==ke?(we=o.jsx(Ue,{children:ke}),e[53]=ke,e[54]=we):we=e[54];let Le;e[55]!==be||e[56]!==we?(Le=o.jsxs(He,{children:[be,we]}),e[55]=be,e[56]=we,e[57]=Le):Le=e[57];let _e;e[58]!==f?(_e=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=_e):_e=e[59];let Ce;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ce=o.jsx(Gs,{size:14}),e[60]=Ce):Ce=e[60];let xe;e[61]!==d||e[62]!==_e?(xe=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":_e,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Ce})}),e[61]=d,e[62]=_e,e[63]=xe):xe=e[63];let Ne;e[64]!==f?(Ne=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Ne):Ne=e[65];let Te;e[66]!==Ne?(Te=o.jsx(Ue,{children:Ne}),e[66]=Ne,e[67]=Te):Te=e[67];let Me;e[68]!==xe||e[69]!==Te?(Me=o.jsxs(He,{children:[xe,Te]}),e[68]=xe,e[69]=Te,e[70]=Me):Me=e[70];let Qe;e[71]!==Le||e[72]!==Me?(Qe=o.jsxs("div",{className:"flex items-center gap-0.5",children:[Le,Me]}),e[71]=Le,e[72]=Me,e[73]=Qe):Qe=e[73],e[74]!==pe||e[75]!==Qe?(Q=o.jsxs("div",{className:"flex items-center justify-between",children:[pe,Qe]}),e[74]=pe,e[75]=Qe,e[76]=Q):Q=e[76],U=A0,G=A,Y=A3,X=I,te=F,se=$,B=Z9,W=R,K=X9,q="space-y-0.5",H=g.map(We=>o.jsx(Roe,{entry:We,selected:We.index===i,canDelete:p,onSelect:()=>de(We.index),onRename:l?()=>l(We.index):void 0,onDuplicate:()=>a(We.index),onDelete:()=>c(We.index)},We.id)),e[14]=p,e[15]=g,e[16]=R,e[17]=F,e[18]=I,e[19]=u,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=r,e[25]=i,e[26]=A,e[27]=f,e[28]=B,e[29]=U,e[30]=H,e[31]=W,e[32]=K,e[33]=G,e[34]=Y,e[35]=X,e[36]=te,e[37]=se,e[38]=ne,e[39]=Q,e[40]=q}else B=e[28],U=e[29],H=e[30],W=e[31],K=e[32],G=e[33],Y=e[34],X=e[35],te=e[36],se=e[37],ne=e[38],Q=e[39],q=e[40];let le;e[77]!==H||e[78]!==q?(le=o.jsx("div",{className:q,children:H}),e[77]=H,e[78]=q,e[79]=le):le=e[79];let J;e[80]!==B||e[81]!==W||e[82]!==K||e[83]!==le?(J=o.jsx(B,{items:W,strategy:K,children:le}),e[80]=B,e[81]=W,e[82]=K,e[83]=le,e[84]=J):J=e[84];let oe;e[85]!==b||e[86]!==p?(oe=b?o.jsx("div",{className:ie("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",Aj),children:o.jsx(Pj,{label:b.label,canDelete:p,dragging:!0})}):null,e[85]=b,e[86]=p,e[87]=oe):oe=e[87];let ee;e[88]!==oe?(ee=kn.createPortal(o.jsx(Q9,{dropAnimation:ej,children:oe}),document.body),e[88]=oe,e[89]=ee):ee=e[89];let he;e[90]!==U||e[91]!==G||e[92]!==Y||e[93]!==X||e[94]!==te||e[95]!==se||e[96]!==J||e[97]!==ee?(he=o.jsxs(U,{sensors:G,collisionDetection:Y,onDragStart:X,onDragEnd:te,onDragCancel:se,children:[J,ee]}),e[90]=U,e[91]=G,e[92]=Y,e[93]=X,e[94]=te,e[95]=se,e[96]=J,e[97]=ee,e[98]=he):he=e[98];let ae;return e[99]!==ne||e[100]!==Q||e[101]!==he?(ae=o.jsxs("div",{className:ne,children:[Q,he]}),e[99]=ne,e[100]=Q,e[101]=he,e[102]=ae):ae=e[102],ae}function Moe(t){return t.id}const Ooe=[[/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"]],$oe={"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 mm(t){return xa(t)!==void 0}function Ax(t,e){if(e){if(mm(e))return e;const s=$oe[e];if(s&&mm(s))return s}for(const[s,n]of Ooe)if(s.test(t)&&mm(n))return n;return"FilterLines"}function Boe(t){return xa(t)??T9}function pm(t){const e=z.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let l;e[0]!==s?(l=Boe(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 h;e[2]!==c||e[3]!==i?(h=ie("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=h):h=e[4];let u;e[5]!==a||e[6]!==d?(u=o.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=o.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function oxe(t,e){return Ote(t,e).map(s=>{const n=e[s.blockKey]??{},i=mk(zte(s.blockKey),e,t);return{blockKey:s.blockKey,title:Zl(s.blockKey,n),description:rd(i),iconName:Ax(s.matcherResolveType)}})}const Ej="Users03";function zoe(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function Foe(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=_l(l,t);s.push({resolveType:l,title:a.title??ws(l),description:a.description,iconName:Ax(l,a.icon)})}return s}function Uoe(t,e){if(!t)return Ej;const s=e.find(n=>n.resolveType===t);return s?s.iconName:Ax(t)}function Hoe(t){const e=z.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[h,u]=P.useState(!1),f=re(),m=(i?d.find(Q=>Q.blockKey===i):void 0)?.iconName??Uoe(s,r),g=xa(m);let x;e[0]!==a||e[1]!==u?(x=Q=>{a(Q),u(!1)},e[0]=a,e[1]=u,e[2]=x):x=e[2];const b=x;let y;e[3]!==c||e[4]!==u?(y=Q=>{c?.(Q),u(!1)},e[3]=c,e[4]=u,e[5]=y):y=e[5];const _=y;let v;e[6]!==u?(v=()=>u(!0),e[6]=u,e[7]=v):v=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 S;e[10]!==n?(S=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Gt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=w):w=e[12];let k;e[13]!==v||e[14]!==L||e[15]!==S?(k=o.jsxs("button",{type:"button",onClick:v,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,S,w]}),e[13]=v,e[14]=L,e[15]=S,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 N;e[21]!==f?(N=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=N):N=e[22];let T;e[23]!==N?(T=o.jsx(An,{placeholder:N}),e[23]=N,e[24]=T):T=e[24];let V;e[25]!==f?(V=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=V):V=e[26];let A;e[27]!==V?(A=o.jsx(hn,{children:V}),e[27]=V,e[28]=A):A=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 D=`${E} ${R}`;let I;e[33]!==b?(I=()=>b(""),e[33]=b,e[34]=I):I=e[34];const O=!s&&!i&&"bg-accent/60";let F;e[35]!==O?(F=ie("gap-2.5",O),e[35]=O,e[36]=F):F=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(pm,{iconName:Ej,size:"sm"}),e[37]=M):M=e[37];let $;e[38]!==f?($=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=$):$=e[39];let B;e[40]!==$?(B=o.jsx("span",{className:"text-sm",children:$}),e[40]=$,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]!==D||e[50]!==I||e[51]!==F||e[52]!==W?(K=o.jsxs(Ft,{value:D,onSelect:I,className:F,children:[M,W]}),e[49]=D,e[50]=I,e[51]=F,e[52]=W,e[53]=K):K=e[53];let G;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let Q;e[59]!==i||e[60]!==s||e[61]!==b?(Q=q=>o.jsxs(Ft,{value:`${q.title} ${q.resolveType} ${q.description??""}`,onSelect:()=>b(q.resolveType),className:ie("gap-2.5",!i&&s===q.resolveType&&"bg-accent/60"),children:[o.jsx(pm,{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]=Q):Q=e[62],G=r.map(Q),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=G}else G=e[58];let Y;e[63]!==K||e[64]!==G?(Y=o.jsxs(os,{children:[K,G]}),e[63]=K,e[64]=G,e[65]=Y):Y=e[65];let X;e[66]!==i||e[67]!==d||e[68]!==_||e[69]!==f?(X=d.length>0&&o.jsx(os,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(Q=>o.jsxs(Ft,{value:`${Q.title} ${Q.blockKey} ${Q.description??""}`,onSelect:()=>_(Q.blockKey),className:ie("gap-2.5",i===Q.blockKey&&"bg-accent/60"),children:[o.jsx(pm,{iconName:Q.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:Q.title}),Q.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Q.description})]})]},Q.blockKey))}),e[66]=i,e[67]=d,e[68]=_,e[69]=f,e[70]=X):X=e[70];let te;e[71]!==A||e[72]!==Y||e[73]!==X?(te=o.jsxs(Pn,{children:[A,Y,X]}),e[71]=A,e[72]=Y,e[73]=X,e[74]=te):te=e[74];let se;e[75]!==h||e[76]!==u||e[77]!==C||e[78]!==T||e[79]!==te||e[80]!==j?(se=o.jsxs(SE,{open:h,onOpenChange:u,title:j,description:C,className:"sm:max-w-lg",filter:zoe,children:[T,te]}),e[75]=h,e[76]=u,e[77]=C,e[78]=T,e[79]=te,e[80]=j,e[81]=se):se=e[81];let ne;return e[82]!==se||e[83]!==k?(ne=o.jsxs(o.Fragment,{children:[k,se]}),e[82]=se,e[83]=k,e[84]=ne):ne=e[84],ne}const Koe="website/sections/Rendering/Lazy.tsx";function $f(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Px(t){if(!$f(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Es(e)}function Woe(t){return t!=null}function Qp(t){if(t==null)return t;if(Px(t)){const e=t.section;return e==null?null:$f(e)?e:{}}return $f(t)?t:void 0}function qoe(t,e){return t===null?null:Px(e)?{...e,section:t}:t}function lxe(t){return{__resolveType:t}}function axe(t,e){if(!Woe(e))return null;if(t){const s=Qp(e)??{};return{__resolveType:Koe,section:s}}return Px(e)?Qp(e)??null:$f(e)?e:null}const Goe="General";function od(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function Rj(t,e){return t===ml?Goe:e}function Dj(t){const e=ff(t),s=new Set,n=[];for(const i of e)od(i.resolveType)&&(hi(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:Rj(i.resolveType,i.title),description:i.description})));return n}function Ex(t){const e=hf(t),s=Bn(e,t),n=Dj(s?.properties?.seo);return n.length>0?n:Yoe(t)}function Yoe(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(!od(r))continue;const l=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:Rj(r,l)})}return s}function Ij(t){const e=Ex(t),s=e.find(n=>n.resolveType===ml);return s?s.resolveType:e[0]?.resolveType??ml}function Mj(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=Bn(s,t),i=Dj(n?.properties?.seo);if(i.length>0)return i}return Ex(t)}function Joe(t,e){const s=Mj(t,e),n=s.find(i=>i.resolveType===ml);return n?n.resolveType:s[0]?.resolveType??Ij(t)}function Qoe(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:Ij(t)}function Xoe(t,e,s){const n=s.__resolveType;return typeof n=="string"&&od(n)?n:Joe(t,e)}const Zoe=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),ml="website/sections/Seo/SeoV2.tsx",ele=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function ku(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function tle(t){return typeof t.__resolveType=="string"&&od(t.__resolveType)?!0:ele.some(e=>e in t)}function sle(t,e){for(const[s,n]of Object.entries(t)){if(!ku(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&Zoe.has(r))continue;const l=i.seo;if(ku(l)){const a=l;if(tle(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Xoe(e,i,a):typeof a.__resolveType=="string"&&od(a.__resolveType)?a.__resolveType:ml}}}for(const[s,n]of Object.entries(t)){if(!ku(n))continue;const i=n;if(typeof i.__resolveType=="string"&&od(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function nle(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function cxe(t,e,s){if(e.kind==="site"){const c=sle(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?Mj(s,c.blockData):void 0,build:d=>nle(c,d)}:null}const n=t[e.pageKey];if(!ku(n))return null;const i=n,r=i.seo,l=Qp(r),a=l&&ku(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:r,seoResolveType:s?Qoe(s,a):typeof a?.__resolveType=="string"?a.__resolveType:ml,seoTypeOptions:s?Ex(s):void 0,build:c=>({...i,seo:c===null?null:qoe(c,r)})}}const Rx=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],ile=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],rle=["jsonLD","title","description","noIndexing","configJsonLD"];function Oj(t){return t===ml||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function ole(t){switch(t){case"general":return Rx;case"pdp":return ile;case"plp":return rle;default:return null}}function $j(t,e){const s=ole(Oj(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 lle(){return Rx.filter(t=>t!=="type")}function ale(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function cle(t,e){return t[e]===void 0}function dle(t){const e=z.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:l}=t,a=re(),d=$j(s,ml).properties??{},h=lle();let u;e[0]!==r?(u=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=u):u=e[1];const f=u,[p,m]=P.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=P.useState(g);p!==l&&(m(l),b({}));let y;e[3]!==x||e[4]!==n?(y=j=>x[j]!==void 0?x[j]:cle(n,j),e[3]=x,e[4]=n,e[5]=y):y=e[5];const _=y;let v;e[6]!==i||e[7]!==r||e[8]!==n?(v=(j,C)=>{b(T=>({...T,[j]:C}));const N={...n};if(C)delete N[j];else{const T=r?.[j];N[j]=T??(j==="type"?"website":"")}i(N)},e[6]=i,e[7]=r,e[8]=n,e[9]=v):v=e[9];const L=v,S="min-w-0 space-y-6",w=Rx.map(j=>{const C=d[j];if(!C)return null;const N=f&&h.includes(j),T=N&&_(j),V=T?r?.[j]??n[j]:n[j],A=C.title??ale(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:ie(T&&"pointer-events-none opacity-60"),children:oa({schema:C,value:V,onChange:E=>{T||i({...n,[j]:E})},path:j,label:A,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:ule})}),N&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pi,{id:`seo-use-default-${j}`,checked:T,onCheckedChange:E=>L(j,E)}),o.jsx(Ot,{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]!==w?(k=o.jsx("div",{className:S,children:w},l),e[10]=l,e[11]=w,e[12]=k):k=e[12],k}function ule(){}function hle(t){const e=z.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(Oj(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(dle,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let h;e[8]!==n||e[9]!==s?(h=$j(s,n),e[8]=n,e[9]=s,e[10]=h):h=e[10];const u=h;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const p=a??fle;let m;return e[12]!==u||e[13]!==r||e[14]!==l||e[15]!==p||e[16]!==i?(m=o.jsx(zi,{schema:u,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:p},r),e[12]=u,e[13]=r,e[14]=l,e[15]=p,e[16]=i,e[17]=m):m=e[17],m}function fle(){}function mle(t){const e=z.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=re();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=P.useState(h);let p;e[1]!==u||e[2]!==d?(p=u.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(nf,{className:"size-3.5"})}),u.map((x,b)=>{const y=b===u.length-1,_=Nn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,b+1)),title:_,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",y?"font-medium text-foreground":"text-muted-foreground"),children:_})]},`${_}-${b}`)})]}),e[1]=u,e[2]=d,e[3]=p):p=e[3];let m;e[4]!==u||e[5]!==l||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(m=o.jsx(zi,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:u,onBreadcrumbChange:f,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=u,e[5]=l,e[6]=r,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=m):m=e[12];let g;return e[13]!==p||e[14]!==m?(g=o.jsxs("div",{className:"space-y-2",children:[p,m]}),e[13]=p,e[14]=m,e[15]=g):g=e[15],g}function dxe(t){const e=z.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:h,siteDefaultSeo:u,meta:f,decofile:p,onSaveReferencedBlock:m,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let y;e[0]!==a?(y=a===void 0?[]:a,e[0]=a,e[1]=y):y=e[1];const _=y;let v;e[2]!==s||e[3]!==_||e[4]!==p||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==r||e[10]!==b||e[11]!==m||e[12]!==x||e[13]!==g||e[14]!==h||e[15]!==u?(v=s&&n?h?o.jsx(hle,{schema:s,resolveType:h,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:l,siteDefaultSeo:u}):o.jsx(zi,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:_,onBreadcrumbChange:l,meta:f,decofile:p,onSaveReferencedBlock:m,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=_,e[4]=p,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=r,e[10]=b,e[11]=m,e[12]=x,e[13]=g,e[14]=h,e[15]=u,e[16]=v):v=e[16];const L=v;let S;e[17]!==c||e[18]!==L?(S=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]=S):S=e[19];let w;return e[20]!==d||e[21]!==S?(w=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,S]})}),e[20]=d,e[21]=S,e[22]=w):w=e[22],w}const uxe="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 hxe(t,e){return yse(t,e,rd)}function fxe(t){const e=z.c(68),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,l=re(),a=h1(),[c,d]=P.useState(n),[h,u]=P.useState(i),[f,p]=P.useState(s),[m,g]=P.useState(null),x=P.useRef(!1);f!==s&&(p(s),d(n),u(i),g(null));let b;e[0]!==i||e[1]!==h?(b=()=>{if(x.current){x.current=!1;return}const te=h.trim();if(te===i.trim()){u(i);return}g(te)},e[0]=i,e[1]=h,e[2]=b):b=e[2];const y=b;let _;e[3]!==r||e[4]!==m?(_=()=>{m!==null&&(u(m),r("path",m),g(null))},e[3]=r,e[4]=m,e[5]=_):_=e[5];const v=_;let L;e[6]!==i?(L=()=>{u(i),g(null)},e[6]=i,e[7]=L):L=e[7];const S=L;let w;e[8]!==r?(w=te=>{d(te.target.value),r("name",te.target.value)},e[8]=r,e[9]=w):w=e[9];let k;e[10]!==l?(k=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=k):k=e[11];let j;e[12]!==c||e[13]!==a||e[14]!==w||e[15]!==k?(j=o.jsx("input",{type:"text",value:c,readOnly:a,onChange:w,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:k}),e[12]=c,e[13]=a,e[14]=w,e[15]=k,e[16]=j):j=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=te=>u(te.target.value),e[17]=C):C=e[17];let N;e[18]!==i?(N=te=>{te.key==="Enter"?(te.preventDefault(),te.currentTarget.blur()):te.key==="Escape"&&(te.preventDefault(),x.current=!0,u(i),te.currentTarget.blur())},e[18]=i,e[19]=N):N=e[19];let T;e[20]!==l?(T=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[20]=l,e[21]=T):T=e[21];let V;e[22]!==y||e[23]!==h||e[24]!==a||e[25]!==N||e[26]!==T?(V=o.jsx("input",{type:"text",value:h,readOnly:a,onChange:C,onBlur:y,onKeyDown:N,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:T}),e[22]=y,e[23]=h,e[24]=a,e[25]=N,e[26]=T,e[27]=V):V=e[27];const A=m!==null;let E;e[28]!==S?(E=te=>{te||S()},e[28]=S,e[29]=E):E=e[29];let R;e[30]!==l?(R=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[30]=l,e[31]=R):R=e[31];let D;e[32]!==R?(D=o.jsx(oo,{children:R}),e[32]=R,e[33]=D):D=e[33];const I=m??"";let O;e[34]!==i||e[35]!==l||e[36]!==I?(O=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:I}),e[34]=i,e[35]=l,e[36]=I,e[37]=O):O=e[37];let F;e[38]!==O?(F=o.jsx(lo,{children:O}),e[38]=O,e[39]=F):F=e[39];let M;e[40]!==D||e[41]!==F?(M=o.jsxs(ro,{children:[D,F]}),e[40]=D,e[41]=F,e[42]=M):M=e[42];let $;e[43]!==l?($=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[43]=l,e[44]=$):$=e[44];let B;e[45]!==$?(B=o.jsx(co,{children:$}),e[45]=$,e[46]=B):B=e[46];let U;e[47]!==v?(U=te=>{te.preventDefault(),v()},e[47]=v,e[48]=U):U=e[48];let H;e[49]!==l?(H=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[49]=l,e[50]=H):H=e[50];let W;e[51]!==U||e[52]!==H?(W=o.jsx(uo,{onClick:U,children:H}),e[51]=U,e[52]=H,e[53]=W):W=e[53];let K;e[54]!==B||e[55]!==W?(K=o.jsxs(ao,{children:[B,W]}),e[54]=B,e[55]=W,e[56]=K):K=e[56];let G;e[57]!==M||e[58]!==K?(G=o.jsxs(io,{children:[M,K]}),e[57]=M,e[58]=K,e[59]=G):G=e[59];let Y;e[60]!==A||e[61]!==E||e[62]!==G?(Y=o.jsx(no,{open:A,onOpenChange:E,children:G}),e[60]=A,e[61]=E,e[62]=G,e[63]=Y):Y=e[63];let X;return e[64]!==V||e[65]!==Y||e[66]!==j?(X=o.jsxs("div",{className:"space-y-1",children:[j,V,Y]}),e[64]=V,e[65]=Y,e[66]=j,e[67]=X):X=e[67],X}function mxe(t){const e=z.c(13),{onClick:s}=t,n=re();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(f0,{size:14}),e[2]=r):r=e[2];let l;e[3]!==s||e[4]!==i?(l=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[3]=s,e[4]=i,e[5]=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(Ue,{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(He,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const Sv=new WeakMap;function ple(t,e){let s=Sv.get(e);s||(s=new Map,Sv.set(e,s));let n=s.get(t);return n===void 0&&(n=Bn(t,e),s.set(t,n)),n}function gle(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function xle(t,e){return{__resolveType:e,variants:[{rule:sd(),value:structuredClone(t)},{rule:sd(),value:structuredClone(t)}]}}function ble(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>px(n.rule));return s?s.value:e[e.length-1]?.value}function vle(t){const e=[...t.variants],s=e[e.length-1],n={rule:sd(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function yle(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function _le(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Lle(t,e,s){return e<t?t-1:Math.min(t,s-1)}function wle(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 Sle(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function kv(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const jv=new WeakMap;function kle(t){let e=jv.get(t);return e||(e=Foe(t),jv.set(t,e)),e}function Bj(t){const e=z.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=re(),{value:l,onChange:a,meta:c,path:d}=i,[h,u]=P.useState(0);if(!gle(l)){let F;e[0]!==r?(F=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=F):F=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(f0,{size:14}),e[2]=M):M=e[2];let $;e[3]!==r?($=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=r,e[4]=$):$=e[4];let B;return e[5]!==$?(B=o.jsx(Ue,{children:$}),e[5]=$,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(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":F,onClick:()=>{a(xle(l,s)),u(0)},children:M})}),B]}),n(i)]})}const f=l,p=f.variants,m=Math.min(h,p.length-1);let g;e[7]!==r?(g=(F,M)=>({index:M,label:rd(F.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=r,e[8]=g):g=e[8];const x=p.map(g),b=p[m],y=b?.rule??{},_=y.__resolveType??"",v=b?.value,L=c?kle(c):[],S=_&&c?ple(_,c):null,{__resolveType:w,...k}=y,j=()=>{a(ble(f)),u(0)},C=()=>{const F=vle(f);a(F),u(F.variants.length-1)},N=F=>{const M=yle(f,F);M&&(a(M),u(Lle(m,F,M.variants.length)))},T=F=>{const M=_le(f,F);a(M),u(F+1)},V=(F,M)=>{const $=wle(f,F,M);a($),m===F&&u(M)},A=F=>{const M=F?Fte(F,c):{__resolveType:x3};a(kv(f,m,M))},E=F=>{const M=F,$=_?{...M,__resolveType:_}:{...M};a(kv(f,m,$))},R=F=>{a(Sle(f,m,F))},D=`${d}-${f.__resolveType}`;let I;e[9]!==r?(I=r("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=r,e[10]=I):I=e[10];let O;return e[11]!==I?(O=o.jsx(Ot,{className:"text-xs text-muted-foreground",children:I}),e[11]=I,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(Ioe,{listKey:D,variants:x,selectedIndex:m,onSelect:u,onDuplicate:T,onDelete:N,onRemoveAll:j,onReorder:V,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(Hoe,{currentRt:_,currentLabel:rd(y),matchers:L,onSelect:A}),S&&o.jsx("div",{className:"pt-1",children:o.jsx(mle,{schema:S,value:k,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${m}-${_}`)})]}),n({...i,value:v,onChange:R})]})]})}const jle="website/loaders/secret.ts";function ju(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 Cle(){return{__resolveType:jle,name:"",encrypted:""}}function Nle(t){const{value:e,...s}=t;return s}function gm(t){const e=z.c(53),{schema:s,value:n,onChange:i,label:r,path:l,sandbox:a}=t,c=re();if(typeof n=="string"||n==null&&!ju(n)){const C=typeof n=="string"?n:"",N=a?.virtualMcpId;let T;e[0]!==r||e[1]!==l||e[2]!==s.description||e[3]!==N?(T=o.jsx(Ks,{htmlFor:l,label:r,description:s.description,virtualMcpId:N}),e[0]=r,e[1]=l,e[2]=s.description,e[3]=N,e[4]=T):T=e[4];let V;e[5]!==c?(V=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=V):V=e[6];let A;e[7]!==i?(A=D=>i(D.target.value),e[7]=i,e[8]=A):A=e[8];let E;e[9]!==l||e[10]!==C||e[11]!==V||e[12]!==A?(E=o.jsx(gt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:V,onChange:A,className:"h-10"}),e[9]=l,e[10]=C,e[11]=V,e[12]=A,e[13]=E):E=e[13];let R;return e[14]!==T||e[15]!==E?(R=o.jsxs("div",{className:"space-y-2",children:[T,E]}),e[14]=T,e[15]=E,e[16]=R):R=e[16],R}let d;e[17]!==n?(d=ju(n)?n:Cle(),e[17]=n,e[18]=d):d=e[18];const h=d,u=typeof h.name=="string"?h.name:"",f=typeof h.encrypted=="string"&&h.encrypted,p=`${l}-name`,m=a?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==p||e[22]!==m?(g=o.jsx(Ks,{htmlFor:p,label:r,description:s.description,virtualMcpId:m}),e[19]=r,e[20]=s.description,e[21]=p,e[22]=m,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let y;e[26]!==h||e[27]!==i?(y=C=>i({...h,name:C.target.value}),e[26]=h,e[27]=i,e[28]=y):y=e[28];let _;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==y?(_=o.jsx(gt,{id:x,value:u,placeholder:b,onChange:y,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=y,e[33]=_):_=e[33];const v=`${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 S;e[37]!==h||e[38]!==f||e[39]!==i?(S=C=>{const N=C.target.value;if(!N){i(f?Nle(h):h);return}i({...h,value:N})},e[37]=h,e[38]=f,e[39]=i,e[40]=S):S=e[40];let w;e[41]!==L||e[42]!==S||e[43]!==v?(w=o.jsx(gt,{id:v,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:L,onChange:S,className:"h-10"}),e[41]=L,e[42]=S,e[43]=v,e[44]=w):w=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]!==w||e[49]!==k||e[50]!==g||e[51]!==_?(j=o.jsxs("div",{className:"space-y-2",children:[g,_,w,k]}),e[48]=w,e[49]=k,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function Tle(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 h=d.schema;if(h&&(h.type==="array"&&l(h.items),h.properties))for(const u of Object.values(h.properties))u?.type==="array"&&l(u.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 h=d.properties??{},u=i.filter(f=>f in h).length*2+(d.titleBy?1:0);u>c&&(c=u,a=d)}return c>=2?a:void 0}function Vle(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 Ale=new Set(["__resolveType","@type"]);function Ple(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 Ele(t){if(d1(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 Cv(t){if(t.type==="array"&&t.items)return t;const e=t.items??Ele(t);return e?{...t,type:"array",items:e}:null}function Rle(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 zj(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(zi,{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 oa(t){const{schema:e,value:s}=t,n=a=>t.readOnly?o.jsx(Dne,{children:a},t.path):a;if(Ef(s)){const a=xse(s),c=Cv(e);if(a!==null&&c)return o.jsx(Sh,{...t,schema:c,value:a,onChange:d=>t.onChange(bse(s,d))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&d1(e)){const a=Cv(e);if(a)return o.jsx(Sh,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Ef(s)&&e.type==="block-ref"){const a=Tle(e,s)??Vle(s);if(a){const c={...e,type:"array",items:a};return o.jsx(Sh,{...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(Ple(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"},h=u=>oa({...u,schema:d});return o.jsx(Bj,{...t,multivariateResolveType:a.resolveType,renderInnerField:h},t.path)}return e.anyOfRefs?o.jsx(xv,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Loe,{...t},t.path);if(e.format==="image-uri")return n(o.jsx(coe,{...t},t.path));if(e.format==="file-uri"||e.format==="video-uri")return n(o.jsx(ooe,{...t},t.path));if(e.format==="map")return n(o.jsx(Coe,{...t},t.path));if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return n(o.jsx(Rre,{...t},t.path));if(e.format==="location")return n(o.jsx(Vj,{...t},t.path));if(e.enum&&e.enum.length>0)return n(o.jsx(vie,{...t},t.path));if(e.type==="anyOf")return o.jsx(xv,{...t},t.path);if(ju(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(gm,{...t},t.path);if(!e.format&&!e.enum){const a=zj(t);if(a)return a}const i=s??Rle(e.type,e.default);if(i==null)return ju(s)?n(o.jsx(gm,{...t},t.path)):null;if(ju(i))return n(o.jsx(gm,{...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(Sh,{...r},t.path);switch(l){case"boolean":return n(o.jsx(mie,{...r},t.path));case"number":case"integer":return n(o.jsx(fie,{...r},t.path));case"string":{const a=e.format;return n(a==="color-input"||a==="color"?o.jsx(Lh,{...r},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(Lh,{...r},t.path):o.jsx(Lh,{...r},t.path))}case"object":return i!==null&&typeof i=="object"&&!Array.isArray(i)?o.jsx(gre,{...r},t.path):null;default:return n(o.jsx(Lh,{...r},t.path))}}function Dle(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return oa({...t,schema:e});const s=zj(t);return s||oa(e?{...t,schema:e}:t)}function zi({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}){const p=re(),m=h1(),g=t.properties;if(!g)return t.type==="inline-union"?oa({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,readOnly:m}):null;if(gse(e)&&g.variants){const V=g.variants.items?.properties?.value;return o.jsx(Bj,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:A=>Dle(A,V)},n)}const x=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},b=Object.keys(g).filter(V=>!Ale.has(V)&&g[V]?.hidden!==!0),y=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:p("sectionsEditor.sectionsEditor.noEditableFields")});const _=(V,A)=>{if(A===void 0){const{[V]:E,...R}=x;s(R);return}s({...x,[V]:A})},v=typeof x.__resolveType=="string"?x.__resolveType:void 0,L=b.filter(V=>{const A=g[V];return A!=null&&Wc(A,x[V])}).length>1,S=Yie(b,g,x),w=i.length>0?Qie(b,g,x,i,a,l):null,k=w?g[w]:null,j=w&&k?[w]:b,C=w&&k?Gie(w,k,i,Xu(w,b,g)):i,N=qie(i,C),T=N.length>0&&r?V=>r([...N,...V]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:j.map(V=>{const A=g[V];if(!A)return null;const E=n?`${n}.${V}`:V,R=Xu(V,b,g),D=ra(V,A),F=(N.length===0&&b.some(M=>{const $=g[M];return M!==V&&$!=null&&ra(M,$)===D})||N.length===0&&S.has(V))&&T?A.type==="block-ref"?M=>T(Kie(V,M)):M=>T(Hie(R,M)):T;return oa({schema:A,value:x[V],onChange:M=>_(V,M),path:E,label:R,readOnly:m,required:y.has(V),breadcrumbPath:C,onBreadcrumbChange:F,hasSiblingDrillDownFields:L,focused:w===V,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:v,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f})})})}function Ile(t){const e=z.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(ct,{size:13,className:"animate-spin"}),"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(Kt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const Nv=3e4;function Mle(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 Ole(t,{resolveType:e,props:s}){let n;try{n=await fetch(X_(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Nv)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${Nv/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 $le(t){const e=z.c(2);let s;return e[0]!==t?(s={mutationFn:n=>Ole(t,n)},e[0]=t,e[1]=s):s=e[1],Vs(s)}function Fj({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:l,target:a,initialValue:c,isCreating:d,onCreate:h,onSaveReferencedBlock:u,onBack:f,showRun:p=!0}){const m=xs()?.taskId??null,g=re(),x=_o(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,y=Bn(a.resolveType,i),_=!y&&dz(a.resolveType,i),v=_?uz(c):null,L=y??v,[S,w]=P.useState(c),[k,j]=P.useState([]),[C,N]=P.useState(0),[T,V]=P.useState(!1),[A,E]=P.useState(null),[R,D]=P.useState(!1),[I,O]=P.useState(!1),[F,M]=P.useState(!1),$=A!==null,{save:B,flush:U,isPending:H}=mx({orgSlug:t,virtualMcpId:e,branch:s}),W=$le({orgSlug:t,virtualMcpId:e,branch:s,threadId:m});P.useEffect(()=>()=>{U()},[]);const K=Ok(l),G=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,threadId:m,previewUrl:n??void 0,siteSlug:b},X=oe=>{w(oe),a.mode==="saved"&&B(a.blockKey,{__resolveType:a.resolveType,...oe})},te=()=>{$?(E(null),V(!1),N(oe=>oe+1)):E(JSON.stringify(S,null,2))},se=oe=>{const ee=oe??"";try{const he=JSON.parse(ee);if(he&&typeof he=="object"&&!Array.isArray(he)){V(!1),X(he);return}V(!0)}catch{V(!0)}},ne=async oe=>{const ee=Cx(oe,r);if(ee){ve.error(ee);return}await h(oe,{__resolveType:a.resolveType,...S}),D(!1)},Q=()=>{O(!0),W.mutate({resolveType:a.resolveType,props:S})},q=()=>{n&&window.open(Mle(n,a.resolveType,S,Date.now()),"_blank","noopener")},le=[a.title,...k],J=oe=>{j(k.slice(0,oe)),N(ee=>ee+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(y9,{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:le.map((oe,ee)=>{const he=ee===le.length-1,ae=Nn(oe);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ee>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>J(ee),title:ae,className:ie("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:ae})]},`${ae}-${ee}`)})}),a.mode==="saved"&&o.jsx(Ile,{isPending:H,isError:!1}),p&&o.jsxs(me,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:Q,disabled:W.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[W.isPending?o.jsx(ct,{size:14,className:"animate-spin"}):o.jsx(ql,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>D(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:o.jsx(ug,{size:14})})}),o.jsx(Ue,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:$?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:te,"aria-label":g($?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":$,children:$?o.jsx(Is,{size:14}):o.jsx(ga,{size:14})})}),o.jsx(Ue,{side:"bottom",children:g($?"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:G,singular:K})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:ie("relative min-h-0 flex-1",I&&F&&"hidden"),children:[o.jsx(yl,{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:[v&&L===v&&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(zi,{schema:L,value:S,onChange:oe=>X(oe),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:u,sandbox:Y},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),A!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[T&&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(bd,{language:"json",height:"100%",code:A,onChange:se,onSave:oe=>{se(oe),U()}})})]})]}),I&&o.jsx(Ble,{singular:K,result:{isPending:W.isPending,error:W.error,data:W.data,hasRun:W.status!=="idle"},expanded:F,onToggleExpand:()=>M(oe=>!oe),onOpenInNewTab:n?q:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(Nx,{open:R,onOpenChange:D,defaultBlockId:"",isPending:d,onSubmit:ne})]})}function Ble(t){const e=z.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:l,onClose:a}=t,c=re();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const h=d,u=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==u?(f=ie("flex min-h-0 flex-col border-t",u),e[2]=u,e[3]=f):f=e[3];let p;e[4]!==c?(p=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=p):p=e[5];let m;e[6]!==p?(m=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p}),e[6]=p,e[7]=m):m=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(un,{size:14})})}),o.jsx(Ue,{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(BA,{size:14}):o.jsx(L8,{size:14}),e[15]=i,e[16]=b):b=e[16];let y;e[17]!==i||e[18]!==r||e[19]!==x||e[20]!==b?(y=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:r,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=r,e[19]=x,e[20]=b,e[21]=y):y=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 v;e[25]!==_?(v=o.jsx(Ue,{side:"bottom",children:_}),e[25]=_,e[26]=v):v=e[26];let L;e[27]!==v||e[28]!==y?(L=o.jsxs(He,{children:[y,v]}),e[27]=v,e[28]=y,e[29]=L):L=e[29];let S;e[30]!==c?(S=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=S):S=e[31];let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Is,{size:14}),e[32]=w):w=e[32];let k;e[33]!==a||e[34]!==S?(k=o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":S,children:w}),e[33]=a,e[34]=S,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]!==m?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[m,j]}),e[40]=j,e[41]=m,e[42]=C):C=e[42];let N;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==h||e[47]!==s||e[48]!==c?(N=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(ct,{size:16,className:"animate-spin"}),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(bd,{language:"json",height:"100%",code:h,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=h,e[47]=s,e[48]=c,e[49]=N):N=e[49];let T;return e[50]!==C||e[51]!==N||e[52]!==f?(T=o.jsxs("div",{className:f,children:[C,N]}),e[50]=C,e[51]=N,e[52]=f,e[53]=T):T=e[53],T}function zle(t){const e=z.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,blockKey:c}=t,d=re();let h;e[0]!==i||e[1]!==s||e[2]!==n?(h={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=h):h=e[3];const u=D0(h);let f;e[4]!==u?(f=yx((L,S)=>u.mutate({blockKey:L,data:S})),e[4]=u,e[5]=f):f=e[5];const p=f;let m;e[6]!==c||e[7]!==a?(m=Uk(a,c),e[6]=c,e[7]=a,e[8]=m):m=e[8];const{resolveType:g,props:x,title:b}=m;if(!g){let L;e[9]!==d?(L=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=L):L=e[10];let S;return e[11]!==L?(S=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]=S):S=e[12],S}const y=`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 v;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==u.isPending||e[24]!==p||e[25]!==y||e[26]!==_||e[27]!==n?(v=o.jsx(Fj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:"loaders",target:_,initialValue:x,isCreating:u.isPending,onCreate:Fle,onSaveReferencedBlock:p,showRun:!1},y),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=r,e[22]=x,e[23]=u.isPending,e[24]=p,e[25]=y,e[26]=_,e[27]=n,e[28]=v):v=e[28],v}async function Fle(){}const Ule="https://github.com/decocms/blocks";function Hle(){const t=z.c(14),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(zA,{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(un,{size:14}),t[7]=l):l=t[7];let a;t[8]!==r?(a=o.jsx(me,{size:"sm",asChild:!0,children:o.jsxs("a",{href:Ule,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(al,{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 Kle(t){const e=z.c(15),{source:s,onRetry:n}=t,i=re();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 h;e[8]!==n||e[9]!==d?(h=o.jsx(me,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=h):h=e[10];let u;return e[11]!==l||e[12]!==c||e[13]!==h?(u=o.jsx(al,{image:a,title:c,description:l,actions:h}),e[11]=l,e[12]=c,e[13]=h,e[14]=u):u=e[14],u}function fr(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Wle=P.lazy(()=>$s(()=>import("./sections-editor-Cx_CzMX5.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor})));function Tv(t){const e=z.c(59),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:l}=Be(),{currentBranch:a,taskId:c}=rn(),d=bs(s),h=Jg(d,a);let u;e[0]!==h||e[1]!==d?(u=vd(d)&&h,e[0]=h,e[1]=d,e[2]=u):u=e[2];const f=u,p=Zn(),m=Ll(),g=Wk(),x=p.lifecycle.phase==="running",b=m.previewUrl;let y;e[3]!==a||e[4]!==l||e[5]!==b||e[6]!==c||e[7]!==s?(y=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]=y):y=e[8];const _=y;let v;e[9]!==x?(v={fetchEnabled:x},e[9]=x,e[10]=v):v=e[10];const L=k0(_,v);let S;e[11]!==x?(S={fetchEnabled:x},e[11]=x,e[12]=S):S=e[12];const w=B9(_,S),k=gk({lifecyclePhase:p.lifecycle.phase,decofile:Af(L),meta:Af(w),hasEditableContent:U9(L.data,w.data),fastPreviewActive:En(s).runtime==="cms"});if(k.kind==="loading"){let H;return e[13]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(fr,{}),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(Hle,{}),e[14]=H):H=e[14],H}if(k.kind==="error"){let H;e[15]!==L||e[16]!==m||e[17]!==w||e[18]!==k.source?(H=()=>{if(k.source==="sandbox"){m.retry();return}Promise.all([L.refetch(),w.refetch()])},e[15]=L,e[16]=m,e[17]=w,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(Kle,{source:k.source,onRetry:W}),e[20]=W,e[21]=k.source,e[22]=K):K=e[22],K}let j;e[23]!==f?(j=H=>o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:o.jsx(Gk,{readOnly:f,className:"h-full min-h-0",children:H})}),e[23]=f,e[24]=j):j=e[24];const C=j,N=g.state.target;if(N?.kind==="loader"&&L.data&&w.data){const H=a??"",W=b??null;let K;e[25]!==L.data||e[26]!==w.data||e[27]!==l.slug||e[28]!==H||e[29]!==W||e[30]!==N.key||e[31]!==s?(K=o.jsx(zle,{orgSlug:l.slug,virtualMcpId:s,branch:H,previewUrl:W,meta:w.data,decofile:L.data,blockKey:N.key}),e[25]=L.data,e[26]=w.data,e[27]=l.slug,e[28]=H,e[29]=W,e[30]=N.key,e[31]=s,e[32]=K):K=e[32];let G;return e[33]!==C||e[34]!==K?(G=C(K),e[33]=C,e[34]=K,e[35]=G):G=e[35],G}let T;e[36]!==a||e[37]!==l.slug||e[38]!==N||e[39]!==s?(T=N||!a?null:xx(gx(l.slug,s,a)),e[36]=a,e[37]=l.slug,e[38]=N,e[39]=s,e[40]=T):T=e[40];const V=T;let A="/",E=null,R=null;N?.kind==="page"?(A=N.path,E=N.key):N?.kind==="section"?R=N.key:V&&(A=V.path,E=V.pageKey);const D=E?`page:${E}`:R?`section:${R}`:`path:${A}`;let I;e[41]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})}),e[41]=I):I=e[41];const O=a??"",F=b??void 0,M=R?null:r,$=!!E&&g.state.editSeoPageKey===E;let B;e[42]!==R||e[43]!==E||e[44]!==A||e[45]!==D||e[46]!==i||e[47]!==l.slug||e[48]!==F||e[49]!==M||e[50]!==$||e[51]!==O||e[52]!==s||e[53]!==g.consumeEditSeo||e[54]!==g.setVariantOverride?(B=o.jsx(P.Suspense,{fallback:I,children:o.jsx(Wle,{orgSlug:l.slug,virtualMcpId:s,branch:O,previewReady:!0,previewUrl:F,currentPath:A,activePageBlockKey:E,activeGlobalBlockKey:R,externalSelection:M,initialEditSeo:$,onExitSeo:g.consumeEditSeo,onVariantPreviewOverride:g.setVariantOverride,onViewJsonFile:i},D)}),e[42]=R,e[43]=E,e[44]=A,e[45]=D,e[46]=i,e[47]=l.slug,e[48]=F,e[49]=M,e[50]=$,e[51]=O,e[52]=s,e[53]=g.consumeEditSeo,e[54]=g.setVariantOverride,e[55]=B):B=e[55];let U;return e[56]!==C||e[57]!==B?(U=C(B),e[56]=C,e[57]=B,e[58]=U):U=e[58],U}function Vv(t){const e=z.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,l=re(),{org:a}=Be(),{currentBranch:c,taskId:d}=rn(),u=Ll().previewUrl;let f;e[0]!==c||e[1]!==a.slug||e[2]!==u||e[3]!==d||e[4]!==s?(f=c?{orgSlug:a.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:u}:null,e[0]=c,e[1]=a.slug,e[2]=u,e[3]=d,e[4]=s,e[5]=f):f=e[5];const m=k0(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:y}=mx(x),_=m.data?.[n],v=m.data===void 0&&m.isLoading,L=m.data!==void 0&&_===void 0,S=!c||L||v;let w;e[10]!==_?(w=_===void 0?"":JSON.stringify(_,null,2),e[10]=_,e[11]=w):w=e[11];const k=w;let j;e[12]!==n||e[13]!==S||e[14]!==b?(j=F=>{if(S)return;let M;try{M=JSON.parse(F)}catch{return}M===null||typeof M!="object"||Array.isArray(M)||b(n,M)},e[12]=n,e[13]=S,e[14]=b,e[15]=j):j=e[15];const C=j;let N;e[16]!==y?(N=()=>({flush:y}),e[16]=y,e[17]=N):N=e[17],P.useImperativeHandle(r,N);let T;e[18]!==l?(T=l("sectionsEditor.pageJsonDialog.titleShort"),e[18]=l,e[19]=T):T=e[19];let V;e[20]!==T?(V=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:T}),e[20]=T,e[21]=V):V=e[21];let A;e[22]!==l?(A=l("sectionsEditor.pageJsonDialog.close"),e[22]=l,e[23]=A):A=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Is,{size:14}),e[24]=E):E=e[24];let R;e[25]!==i||e[26]!==A?(R=o.jsx(me,{variant:"ghost",size:"icon",onClick:i,"aria-label":A,className:"size-7 shrink-0",children:E}),e[25]=i,e[26]=A,e[27]=R):R=e[27];let D;e[28]!==R||e[29]!==V?(D=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[V,R]}),e[28]=R,e[29]=V,e[30]=D):D=e[30];let I;e[31]!==m.data||e[32]!==y||e[33]!==k||e[34]!==v||e[35]!==L||e[36]!==n||e[37]!==S||e[38]!==C||e[39]!==l?(I=v?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin 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(bd,{code:k,language:"json",readOnly:S,height:"100%",onChange:F=>C(F??""),onSave:F=>{C(F),y()}},`${n}:${m.data===void 0?"loading":"ready"}`)}),e[31]=m.data,e[32]=y,e[33]=k,e[34]=v,e[35]=L,e[36]=n,e[37]=S,e[38]=C,e[39]=l,e[40]=I):I=e[40];let O;return e[41]!==D||e[42]!==I?(O=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[D,I]}),e[41]=D,e[42]=I,e[43]=O):O=e[43],O}function qle(t,e){return t===e?"preview":e}function Gle(t){return t.autoOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const Yle=500,Jle={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},Av=1,xm=["desktop","mobile","tablet"],Pv={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Ev(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Qle(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 jh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function bm(t,e){try{return new URL(t,e).href}catch{return null}}function Xle(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 h=40;return d===0?h+=30:/[\s/-]/.test(c[d-1]??"")&&(h+=20),h+=Math.round(s.length/c.length*20),h};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 Zle(t){const{onOpen:e}=t,[s,n]=P.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function eae(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function tae({virtualMcpId:t}){const e=re(),s=u0(),n=gl(),i=Dte(),{openPanel:r}=bi(),{currentBranch:l,taskId:a}=rn(),c=Wk(),d=ye=>r(ye),[h,u]=P.useState("preview"),[f,p]=P.useState(!1),[m,g]=P.useState("desktop"),[x,b]=P.useState(null),[y,_]=P.useState(null),v=P.useRef(null),L=P.useRef(null),[S,w]=P.useState(!1),k=P.useRef(null),j=()=>{k.current?.flush(),w(!1)},C=()=>w(ye=>(ye&&k.current?.flush(),!ye)),[N,T]=P.useState({width:0,height:0}),[V,A]=P.useState(null),[E,R]=P.useState(!1),[D,I]=P.useState(""),O=P.useRef(null),[F,M]=P.useState(!1),[$,B]=P.useState(),[U,H]=P.useState(null),[W,K]=P.useState(null),[G,Y]=P.useState(null),[X,te]=P.useState("/"),[se,ne]=P.useState(null),[Q,q]=P.useState({}),[le,J]=P.useState(!1),oe=P.useRef(null),ee=()=>{J(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>J(!1),15e3)},he=()=>{oe.current&&(clearTimeout(oe.current),oe.current=null),J(!1)},{org:ae}=Be(),de=Zn(),ue=Ll(),pe=ue.vmEntry,Z=ue.previewUrl,ge=de.lifecycle.phase,be=ge==="running",ke=s;Hk({orgSlug:ae.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:ke});const we=null,Le=_o(),_e=Le?.entity?.id===t?rg(Le.entity.metadata):null,Ce=En(t),xe=Le?.entity?.id===t&&Ce.runtime==="cms",Ne=Ce.projectDefault==="cms",Te=Yte({sandboxUrl:Z,previewServerUrl:_e,fastPreviewActive:xe}),Me=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:Z}:null,Qe=k0(Me,{fetchEnabled:be}),We=B9(Me,{fetchEnabled:be}),Ve=Qe.data,De=We.data,ot=`${t}:${l??""}`,[st,Ze]=P.useState(null),lt=gk({lifecyclePhase:ge,decofile:Af(Qe),meta:Af(We),hasEditableContent:U9(Ve,De),fastPreviewActive:xe,frameworkKnownMissing:st===ot});lt.kind==="empty"&&lt.reason==="framework-missing"&&st!==ot&&Ze(ot);const _t=lt.kind==="content",it=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l}:null,at=tse(it),Ie=Ve?pf(Ve).sort((ye,Pe)=>ye.name.localeCompare(Pe.name)):[],xt=Ve&&De?S3(Ve,De):[],fe=Ve&&De?Fk(De,Ve,"loaders"):[],Oe=il,tt=D?(()=>{const ye=D.toLowerCase();return Ie.map(Pe=>({page:Pe,score:Xle(Pe.name,Pe.path,ye)})).filter(({score:Pe})=>Pe>0).sort((Pe,ut)=>ut.score-Pe.score||Pe.page.path.length-ut.page.path.length).map(({page:Pe})=>Pe)})():Ie,ht=xt.filter(ye=>{if(!D)return!0;const Pe=D.toLowerCase();return ye.name.toLowerCase().includes(Pe)||ye.key.toLowerCase().includes(Pe)||ye.resolveType.toLowerCase().includes(Pe)}),dt=fe.filter(ye=>{if(!D)return!0;const Pe=D.toLowerCase();return ye.title.toLowerCase().includes(Pe)||ye.key.toLowerCase().includes(Pe)||ye.resolveType.toLowerCase().includes(Pe)}),Vt=W?fe.find(ye=>ye.key===W)??null:null,rt=U||W?null:gp(Ie,X,se),bt=U?U.name:Vt?.title??rt?.name,et=rt?.key??null,yt=rt?.path??null,ft=(et?Q[et]:void 0)??{},nt=Ur(X,ft),vt={};if(be&&Z&&De&&Ve){const ye=Nne(De,"loaders"),Pe=et?Ve[et]:void 0,ut=Xse(Pe,Ve,ds=>ye.has(ds)),wt=qse(ut);for(const ds of uf(X)){if(ds.type!=="param")continue;const pn=Hse(X,ds.name,ut),Qs=Jse(pn,ye,wt);Qs.length>0&&(vt[ds.name]=Qs)}}const mt=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,Lt=Ve&&et?Ck(Ve,et,0):[],Mt=Ve?Lk(Lt,Ve):[],ce=Mt.map(ye=>ye.isSavedBlock?ye.label:""),Se=Mt.map(ye=>ye.isSavedBlock?"global":ye.isMultivariate?"variant":"normal"),Ee=Lt.map(ye=>Kp(ye,Ve??{})),je=P.useRef(null),Xe=P.useRef(null),Ke=de.status.state==="paused",vs=de.phase,fn=Ak({claimPhase:vs,lifecycle:de.lifecycle}),At=ue.previewState,yi=ue.userStopped,Un=b0(Le?.entity?.id===t?Le.entity.metadata?.ui?.layout??null:null),Lo=hx(ae.slug,t??"",l??""),{url:mn}=vk(xe&&t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,previewServerUrl:_e??null,path:nt}:null),wo=Ne&&Ce.runtime==="sandbox",St=wte({previewState:At,progressStatus:fn.status,previewServerUrl:_e,fastPreviewActive:xe,fastPreviewReady:!!mn,codingSession:wo}),ei=St.mode!=="none",Sr=St.mode==="production"&&St.iframeBase?jh(St.iframeBase):null,So=!s,ti=St.mode==="production"?Sr:jh(Z),ko=Le?.entity?.id===t&&Le.entity.metadata?.fastPreviewInPlace===!0,Ln=St.mode==="production"&&xe&&ko&&h==="blocks",kr=P.useRef(null);Ln||(kr.current=mn);const Fi=kr.current,jo=Ln?Fi??mn:mn,Bs=Qle(St.mode==="sandbox"?gh(Ev(G??bm(nt,St.iframeBase)??St.iframeBase,m),c.state.variantOverride??[]):St.mode==="production"&&So?gh(Ev(bk(G??jo??bm(nt,St.iframeBase)??St.iframeBase,St.showWakingPill?qte:null),m),c.state.variantOverride??[]):null);P.useEffect(()=>{},[s,Sr,V]);const jr="sandbox.preview.openInNewTab",Ta=mn??(St.iframeBase?bm(nt,St.iframeBase):null),Co=St.mode==="production"?Ta?gh(Ta,c.state.variantOverride??[]):null:Bs??St.iframeBase,No=async()=>{const ye=Co;if(ye){window.open(ye,"_blank","noopener");return}},Cr=t&&l?gx(ae.slug,t,l):null,_i=ye=>{Cr&&zse(Cr,ye)},ys=c.state.target;P.useEffect(()=>{if(!(!ys||!Te||!De))if(ys.kind==="page"){const ye=Q[ys.key]??{};Xe.current=Ur(ys.path,ye),H(null),K(null),Y(null),ne(ys.key),te(ys.path),_i({path:ys.path,pageKey:ys.key,params:ye})}else if(ys.kind==="loader")Xe.current=null,H(null),K(ys.key),Y(null);else{const ye=xt.find(Pe=>Pe.key===ys.key);if(ye){Xe.current=null;const Pe=hf(De);K(null),H(ye),Y(Yb(Te,Pe,ye.key))}}},[ys,Te,De,Q]),P.useEffect(()=>{!et||yt===null||ys?.kind==="page"&&ys.key===et&&ys.path===yt||c.selectTarget({kind:"page",key:et,path:yt})},[et,yt,ys]);const[Va,To]=P.useState(null);if(At.kind==="iframe"&&Va!==At.previewUrl){const ye=Va!==null;To(At.previewUrl);const Pe=Cr?xx(Cr):null;if(Pe){if(Xe.current=Ur(Pe.path,Pe.params),te(Pe.path),ne(Pe.pageKey),Y(null),H(null),K(null),Pe.pageKey&&Object.keys(Pe.params).length>0){const ut=Pe.pageKey;q(wt=>({...wt,[ut]:Pe.params}))}}else ye&&(Xe.current=null,te("/"),Y(null),ne(null),H(null),K(null))}je.current=Bs;const Nr=Cte({iframeRef:v,src:St.mode==="sandbox"?Bs:null,active:St.mode==="sandbox"}),Tr=P.useRef(null);P.useEffect(()=>{if(!mn||!Bs||Tr.current===mn)return;Tr.current=mn;const ye=v.current;ye&&ye.getAttribute("src")!==Bs&&(ee(),ye.src=Bs)},[mn,Bs]);const Vr=()=>{const ye=v.current?.contentWindow,Pe=ti;if(!ye||!Pe||!Ve||!et)return;const ut=Ve[et];if(!ut||typeof ut!="object")return;const wt=Gte({previewBaseUrl:Pe,pageBlock:ut,decofile:Ve,path:nt,pathTemplate:X});if(!wt)return;const ds=gh(wt.src,c.state.variantOverride??[]);ye.postMessage({type:"cms-editor::render",src:ds,body:wt.body},Pe)},Li=P.useRef(null);P.useEffect(()=>{if(!Ln||U||W||!et||!Ve){Li.current=null;return}const ye=JSON.stringify({page:et,path:nt,pathTemplate:X,decofile:Ve});if(Li.current===ye)return;const Pe=Li.current===null;Li.current=ye,!Pe&&Vr()},[Ve,Ln,U,W,et,nt,X]);const Ui=P.useRef(null);P.useEffect(()=>{if(!Ln||U||W||!et||!Ve){Ui.current=null;return}const ye=JSON.stringify(c.state.variantOverride??null),Pe=Ui.current;Ui.current={page:et,sig:ye},!(!Pe||Pe.page!==et||Pe.sig===ye)&&Vr()},[c.state.variantOverride,Ln,U,W,et]);const Vo=!!t&&!!l&&!de.notFound&&!yi&&!Ke&&(vs?.kind==="ready"||ge!=="idle"),wn=St.mode!=="sandbox"&&h==="visual"?"preview":h;P.useEffect(()=>{const ye=ti;if(!ye)return;const Pe=ut=>{if(ut.origin===ye)if(ut.data?.type==="visual-editor::element-clicked"){const wt=ise.safeParse(ut.data.payload);wt.success&&b(wt.data)}else if(ut.data?.type==="cms-editor::section-clicked"){const wt=lse.safeParse(ut.data.payload);wt.success&&_({index:wt.data.sectionIndex,seq:wt.data.clickSeq})}else ut.data?.type==="cms-editor::render-start"?ee():(ut.data?.type==="cms-editor::render-end"||ut.data?.type==="cms-editor::render-error")&&he()};return window.addEventListener("message",Pe),()=>window.removeEventListener("message",Pe)},[ti]),P.useEffect(()=>{if(!E)return;const ye=Pe=>{O.current?.contains(Pe.target)||(R(!1),I(""))};return document.addEventListener("pointerdown",ye),()=>document.removeEventListener("pointerdown",ye)},[E]);const Ar=()=>{const ye=v.current?.contentWindow,Pe=jh(Z);!ye||!Pe||ye.postMessage({type:"visual-editor::activate",script:rse},Pe)},S1=()=>{const ye=v.current?.contentWindow,Pe=jh(Z);!ye||!Pe||ye.postMessage({type:"visual-editor::deactivate"},Pe)},Hi=()=>{const ye=v.current?.contentWindow,Pe=ti;!ye||!Pe||(ye.postMessage(St.mode==="production"?{type:"editor::inject",args:{script:Xb}}:{type:"visual-editor::activate",script:Xb},Pe),ye.postMessage({type:"cms-editor::set-labels",labels:ce,kinds:Se,keys:Ee},Pe))},Ed=()=>{const ye=v.current?.contentWindow,Pe=ti;!ye||!Pe||ye.postMessage({type:"cms-editor::deactivate"},Pe)},si=ye=>{const Pe=h;!n&&ye!==Pe&&(ye==="blocks"?L.current?.resize("30%"):L.current?.collapse()),ye!=="blocks"&&j(),u(ye),b(null),_(null),ye!=="blocks"&&K(null),Pe==="visual"&&S1(),ye==="visual"&&Ar(),Pe==="blocks"&&ye!=="blocks"&&Ed(),ye==="blocks"&&Hi()},Pr=ye=>{p(!0),si(qle(h,ye))},Ao=Gle({autoOpen:Un==="auto",blocksReady:_t,autoOpenResolved:f,editingMode:h}),Po=()=>{p(!0),si("blocks")},Eo=()=>{if(!v.current||!Bs)return;ee();const ye=v.current;ye.src=Bs};Iz(()=>{const ye=v.current;if(!ye)return;ee();const Pe=document.activeElement,ut=ye.tabIndex;ye.tabIndex=-1,ye.style.pointerEvents="none",ye.blur(),eae(ye,je.current);let wt;const ds=()=>{clearTimeout(wt),ye.tabIndex=ut,ye.style.pointerEvents="";const pn=document.activeElement;(!pn||pn===document.body||pn===ye)&&Pe?.focus(),ye.removeEventListener("load",ds)};ye.addEventListener("load",ds),wt=setTimeout(ds,3e3)});const Ro=()=>{const ye=xm.indexOf(m);g(xm[(ye+1)%xm.length])},Do=async()=>{let ye=null;try{ye=v.current?.contentWindow?.location?.href??null}catch{}const Pe=ye??Bs??Z;if(Pe)try{await navigator.clipboard.writeText(Pe),ve.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{ve.error(e("sandbox.preview.failedToCopyUrl"))}},Io=Nte({iframeBase:St.iframeBase,resolvedPath:nt,activeGlobalSectionName:U?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Cl=ye=>{const Pe=Q[ye.key]??{},ut=Ur(ye.path,Pe);(U||Oe(ut)!==Oe(nt))&&ee(),Xe.current=ut,H(null),K(null),Y(null),_(null),ne(ye.key),te(ye.path),_i({path:ye.path,pageKey:ye.key,params:Pe}),c.selectTarget({kind:"page",key:ye.key,path:ye.path})},Ki=(ye,Pe)=>{if(!et)return;const ut=et,wt={...ft,[ye]:Pe};Xe.current=Ur(X,wt),q(ds=>({...ds,[ut]:wt})),_i({path:X,pageKey:ut,params:wt})},Rd=ye=>{if(!Te||!De){ve.error(e("sandbox.preview.previewMetadataNotReady"));return}ee(),Xe.current=null;const Pe=hf(De),ut=Yb(Te,Pe,ye.key);H(ye),K(null),Y(ut),_(null),c.selectTarget({kind:"section",key:ye.key})},Aa=ye=>{H(null),K(ye.key),Y(null),si("blocks"),c.selectTarget({kind:"loader",key:ye.key})},Dd=async({name:ye,path:Pe,templateKey:ut})=>{if(!t||!l)return;const wt=_3(Pe);if(wt){B(wt);return}const ds=Pe.trim().startsWith("/")?Pe.trim():`/${Pe.trim()}`;if(Ie.some(Qs=>Oe(Qs.path)===Oe(ds))){B(e("sandbox.preview.pageAlreadyExists",{path:ds}));return}let pn;if(ut&&(pn=Ve?.[ut],!pn)){B(e("sandbox.preview.templateNoLongerExists"));return}B(void 0);try{const Qs=await at.mutateAsync({name:ye,path:ds,template:pn});M(!1),ve.success(e("sandbox.preview.pageCreated",{name:ye})),await xd(Yle),Cl({key:Qs.key,name:Qs.name,path:Qs.path}),si("blocks")}catch(Qs){B(Qs instanceof Error?Qs.message:e("sandbox.preview.failedToCreatePage"))}},Wi=ei&&(Vo||St.mode==="production"),Er=h==="blocks",Rr=ase({showPreviewToolbar:Wi,blocksState:lt}),qi=Rr&&Un!=="off"?o.jsx(uk,{title:e("sandbox.preview.cms"),tooltip:e(Er?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:FA},active:Er,onClick:()=>Pr("blocks"),testId:"preview-blocks-toggle",dataTour:Zr.edit}):null,Dr=Wi?o.jsxs(o.Fragment,{children:[o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(Xo,{onClick:Eo,"aria-label":e("sandbox.preview.refresh"),children:o.jsx($n,{size:16})})}),o.jsx(Ue,{side:"bottom",children:e("sandbox.preview.refresh")})]}),Rr&&o.jsxs("div",{ref:O,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:()=>R(ye=>!ye),children:[U&&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(ll,{size:11}),"Global"]}),Vt&&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(Jc,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:ie("text-[13px] font-medium text-foreground",bt==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:bt??Io}),!U&&!W&&bt!=null&&X&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:uf(X).map((ye,Pe)=>{if(ye.type==="text")return o.jsx("span",{className:ie(Pe===0?"min-w-0 truncate":"shrink-0"),children:ye.text},`text-${Pe}`);const ut=vt[ye.name];return ut&&mt?o.jsx(fne,{sources:ut,template:X,paramName:ye.name,value:ft[ye.name]??"",sandboxRef:mt,onCommit:wt=>Ki(ye.name,wt)},`${et}:${ye.name}`):o.jsx(Sne,{name:ye.name,value:ft[ye.name]??"",onCommit:wt=>Ki(ye.name,wt)},`${et}:${ye.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>R(ye=>!ye),"aria-label":e("sandbox.preview.choosePage"),children:o.jsx(Gt,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",E&&"rotate-180")})})]}),E&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(A9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:D,onChange:ye=>I(ye.target.value),onKeyDown:ye=>{if(ye.key!=="Enter")return;const Pe=D.trim();if(!Pe)return;const ut=tt.find(wt=>Oe(wt.path)===Oe(Pe));ut&&(ye.preventDefault(),R(!1),I(""),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:ye=>{ye.preventDefault(),R(!1),I(""),B(void 0),M(!0)},children:[o.jsx(Ut,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),tt.length===0&&ht.length===0&&dt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Ie.length===0&&xt.length===0&&fe.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[tt.length>0&&o.jsx("div",{className:"p-1.5",children:tt.map(ye=>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(),R(!1),I(""),Cl(ye)},children:[o.jsx(sl,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ye.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ye.path})]},ye.key))}),ht.length>0&&o.jsxs("div",{className:ie("p-1.5",tt.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")}),ht.map(ye=>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(),R(!1),I(""),Rd(ye)},children:[o.jsx(ll,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ye.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ye.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ye.key))]}),dt.length>0&&o.jsxs("div",{className:ie("p-1.5",(tt.length>0||ht.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")}),dt.map(ye=>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(),R(!1),I(""),Aa(ye)},children:[o.jsx(Jc,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ye.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ye.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ye.key))]})]})]})]}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(Xo,{"aria-label":e(jr),onClick:()=>{No()},children:o.jsx(un,{size:16})})}),o.jsx(Ue,{side:"bottom",children:e(jr)})]})]}):null,Mo=Wi?o.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[qi,qi&&o.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),Dr]}):null,Gi=Wi?o.jsx("div",{className:"flex shrink-0 items-center",children:o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:o.jsx(Qn,{size:14})})}),o.jsxs(zt,{align:"end",className:"w-44",children:[o.jsxs(Ye,{onClick:Do,children:[o.jsx(dn,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),Ve&&De&&o.jsxs(o.Fragment,{children:[o.jsx(Qr,{}),et&&o.jsxs(Ye,{onClick:()=>{c.editSeo({kind:"page",key:et,path:X}),si("blocks")},children:[o.jsx(pg,{size:14}),e("sandbox.preview.editSeo")]}),et&&o.jsxs(Ye,{onClick:()=>{try{d(yT(WB(et)))}catch{ve.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[o.jsx(ga,{size:14}),e("sandbox.preview.viewJson")]})]}),we,o.jsx(Qr,{}),o.jsxs(Ye,{onClick:()=>yte(e),children:[o.jsx(UA,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,Id=St.mode==="sandbox",Oo=Jle[m],wi=m==="desktop"&&(N.width===0||N.width>=Oo.width+2*Av),Ir=wi?1:Math.min(N.width>0?N.width/(Oo.width+2*Av):1,1),$o=wi?{width:"100%",height:"100%"}:{width:`${Oo.width}px`,height:N.height>0?`${N.height/Ir}px`:`${Oo.height}px`,transform:`scale(${Ir})`,transformOrigin:"top center"},Mr=ei?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:[Id&&o.jsxs(o.Fragment,{children:[o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(Xo,{onClick:()=>Pr("visual"),"aria-pressed":h==="visual","aria-label":e("sandbox.preview.visualEditor"),active:h==="visual",className:"rounded-full","data-tour":Zr.visualEditor,children:o.jsx(p4,{size:16})})}),o.jsx(Ue,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(Xo,{onClick:Ro,"aria-label":e(Pv[m]),className:"rounded-full","data-tour":Zr.device,children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[m==="mobile"&&o.jsx(HA,{size:16}),m==="tablet"&&o.jsx(KA,{size:16}),m==="desktop"&&o.jsx(WA,{size:16})]},m)})}),o.jsx(Ue,{side:"top",children:e(Pv[m])})]})]})}):null,Bo=(n||!!W)&&wn==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[Ao&&o.jsx(Zle,{onOpen:Po}),mt&&Object.entries(vt).map(([ye,Pe])=>(ft[ye]??"")===""?o.jsx(Lne,{sources:Pe,template:X,paramName:ye,sandboxRef:mt,onFill:ut=>Ki(ye,ut)},`${et}:${ye}`):null),i?o.jsxs(o.Fragment,{children:[Wi&&o.jsx(Ete,{children:Mo}),o.jsx(Rte,{children:Gi})]}):(Wi||Gi)&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex flex-1 items-center justify-start",children:qi}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Dr}),o.jsx("div",{className:"flex flex-1 items-center justify-end",children:Gi})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:Bo?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(Tv,{virtualMcpId:t,externalSelection:y,onViewJsonFile:C}),S&&et&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(Vv,{ref:k,virtualMcpId:t,pageKey:et,onClose:j})}),n&&Mr]}):o.jsxs(up,{orientation:"horizontal",disabled:wn!=="blocks",children:[o.jsx(Rc,{ref:L,id:"preview-blocks-editor",defaultSize:wn==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:wn==="blocks"&&o.jsx(Tv,{virtualMcpId:t,externalSelection:y,onViewJsonFile:C})}),wn==="blocks"&&o.jsx(hp,{withHandle:!0}),o.jsx(Rc,{id:"preview-canvas",defaultSize:wn==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(up,{orientation:"horizontal",disabled:!(S&&et),children:[S&&et&&o.jsxs(o.Fragment,{children:[o.jsx(Rc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(Vv,{ref:k,virtualMcpId:t,pageKey:et,onClose:j})}),o.jsx(hp,{withHandle:!0})]}),o.jsx(Rc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:ye=>{if(!ye)return;const Pe=()=>T(wt=>wt.width===ye.clientWidth&&wt.height===ye.clientHeight?wt:{width:ye.clientWidth,height:ye.clientHeight});Pe();const ut=new ResizeObserver(Pe);return ut.observe(ye),()=>ut.disconnect()},className:ie("h-full relative overflow-clip flex justify-center",ei&&!wi&&"bg-muted/30"),children:[(le||Lo)&&ei&&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"})}),St.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Kc,{kind:"starting",progress:fn,claimPhase:vs})}),At.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Kc,{kind:"suspended",onResume:ue.resume})}),At.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Kc,{kind:"errored",error:At.error,onRetry:ue.retry,connectionsHref:`/${ae.slug}/settings/connections`})}),St.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(ct,{size:18,className:"mt-0.5 shrink-0 animate-spin 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")})]})]}),wn==="visual"&&!x&&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(p4,{size:12}),e("sandbox.preview.clickElementToAsk")]}),wn==="visual"&&x&&o.jsx(kse,{element:x,onDismiss:()=>b(null)}),Mr,ei&&Bs&&o.jsx("div",{className:ie("shrink-0",!wi&&"border-x border-border bg-background shadow-sm"),style:$o,children:o.jsx("iframe",{ref:v,src:Bs,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Nr.handleError,onLoad:()=>{if(Nr.handleLoad(),he(),St.mode!=="sandbox"){St.mode==="production"&&!St.showWakingPill&&h==="blocks"&&Hi();return}if(Je("vm_preview_loaded",{view_mode:h,vm_id:pe?.sandboxHandle??null}),!U)try{const ye=v.current?.contentWindow?.location?.pathname;if(!ye)return;const Pe=Xe.current;if(Pe!==null&&(Xe.current=null,Oe(ye)!==Oe(Pe))||Oe(ye)===Oe(nt))return;te(ye),_i({path:ye,pageKey:se,params:ft})}catch{}h==="visual"&&Ar(),h==="blocks"&&Hi()}},St.iframeBase)})]})})]})})]})}),o.jsx(nse,{open:F,onOpenChange:M,isPending:at.isPending,error:$,templates:Ie,onSubmit:Dd})]})}function sae(t){const e=z.c(22),{virtualMcpId:s}=t,n=re(),i=bs(s),{activeTask:r,taskId:l,currentBranch:a}=rn(),c=SL(l),[d,h]=P.useState(!1);if(kL({threadId:l,sandboxBranch:r?.branch??a,agentHasRepo:nn(i?.metadata),threadHasRepo:nn(c)||nn(r?.metadata)})==="none"){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(Vn,{className:"size-7 text-foreground"})}),e[0]=p):p=e[0];let m;e[1]!==n?(m=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=m):m=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>h(!0),b=o.jsx(Vn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let y;e[7]!==n?(y=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsxs(me,{onClick:x,children:[b,y]}),e[9]=y,e[10]=_):_=e[10];let v;e[11]!==m||e[12]!==g||e[13]!==_?(v=o.jsx(al,{className:"h-full",image:p,title:m,description:g,actions:_}),e[11]=m,e[12]=g,e[13]=_,e[14]=v):v=e[14];let L;e[15]!==d?(L=o.jsx(Mg,{open:d,onOpenChange:h,mode:"agent"}),e[15]=d,e[16]=L):L=e[16];let S;return e[17]!==v||e[18]!==L?(S=o.jsxs(o.Fragment,{children:[v,L]}),e[17]=v,e[18]=L,e[19]=S):S=e[19],S}let f;return e[20]!==s?(f=o.jsx(tae,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const nae=P.lazy(()=>$s(()=>import("./file-explorer-DC_nRPAI.js"),__vite__mapDeps([168,1,2,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,103,105,96,106,107,80,123,150,100,147,115,86,87,88,89,90,91,92,93,94,95,97,98,99,101,102,104,108,109,110,111,112,113,114,83,116,117,118,119,120,121,122,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,81,148,149,151,152,153,154,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.FileExplorer})));function iae(t){const e=z.c(23),{openPath:s}=t,n=re(),i=_o(),{org:r}=Be(),{currentBranch:l,taskId:a}=rn(),c=i?.entity?.id??null,d=u0(),h=Ll(),u=Zn();h.vmEntry,u.lifecycle.phase;const f=d,p=c??"",m=l??"",g=a??null,x=f;let b;e[0]!==r.slug||e[1]!==p||e[2]!==m||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:p,branch:m,threadId:g,enabled:x},e[0]=r.slug,e[1]=p,e[2]=m,e[3]=g,e[4]=x,e[5]=b):b=e[5],Hk(b);const y=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;return e[8]!==k?(j=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:k}),e[8]=k,e[9]=j):j=e[9],j}let _;e[10]!==y||e[11]!==n?(_=y,e[10]=y,e[11]=n,e[12]=_):_=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})}),e[13]=v):v=e[13];const L=a??null;let S;e[14]!==l||e[15]!==s||e[16]!==r.slug||e[17]!==L||e[18]!==c?(S=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(P.Suspense,{fallback:v,children:o.jsx(nae,{orgSlug:r.slug,virtualMcpId:c,branch:l,threadId:L,openPath:s})})}),e[14]=l,e[15]=s,e[16]=r.slug,e[17]=L,e[18]=c,e[19]=S):S=e[19];let w;return e[20]!==_||e[21]!==S?(w=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[_,S]}),e[20]=_,e[21]=S,e[22]=w):w=e[22],w}function rae(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 oae(t,e,s){return typeof t!="string"?null:rae(Bn(t,e),s)}function Uj(t,e,s){if(!e||typeof t!="string")return!1;const n=oae(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function lae({orgSlug:t,virtualMcpId:e,branch:s}){const n=cs(),i=xs()?.taskId??null,r=S0(e),l=En(e).runtime==="cms";return Vs({mutationKey:s3(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const h=await C_({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return i3(n,{orgSlug:t,virtualMcpId:e,branch:s},h),await n.invalidateQueries({queryKey:R0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=w0(r,Pg(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():$9(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=Ge.decofile(c);await n.cancelQueries({queryKey:d});const h=n.getQueryData(d),u=!!h&&a in h,f=h?.[a];return n.setQueryData(d,p=>{if(!p)return p;const{[a]:m,...g}=p;return g}),{queryKey:d,blockKey:a,hadKey:u,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,h=>d.hadKey?{...h??{},[d.blockKey]:d.previousValue}:h)},onSuccess:()=>{n.invalidateQueries({queryKey:Ge.liveMeta(t,e,s)})}})}function Sc(t){const e=z.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 x1(t,e){return`${t}-${e}`}function Hj(t,e){return`site/apps/${t}/${e}.ts`}function Kj(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function aae(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function cae(t){return t==="local"?"Custom":"Installed"}function Wj(t,e,s){const n=new Set([x1(t,e),e].map(r=>r.toLowerCase())),i=Hj(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 dae(t,e){const s=t.vendor.alias,n=t.name,i=Wj(s,n,e);return{id:x1(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Hj(s,n),blockKey:i,installed:i!==null}}function uae(t,e,s){if(t===w3)return null;const n=Kj(t);if(!n)return null;const{vendor:i,app:r}=n,l=Wj(i,r,s),a=_l(t,e);return{id:x1(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 hae(t,e,s){const n=e.__resolveType;if(typeof n!="string"||nd(t,e)||!iL(n))return null;const i=Kj(n)??aae(t);if(!i)return null;const r=_l(n,s),{vendor:l,app:a}=i;return{id:x1(l,a),app:a,vendor:l,title:r.title??gf(t,e,s),description:r.description??"",category:cae(l),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function fae(t,e,s){const n=new Map;for(const r of t){const l=dae(r,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const l=uae(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=hae(r,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(mae)}function mae(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function pae(){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 gae(t,e,s){const n=z.c(12),i=s?.enabled??!0;let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ge.decoApps(),n[0]=r):r=n[0];let l;n[1]!==i?(l={queryKey:r,queryFn:pae,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Tt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?fae(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,h=a.isLoading&&!a.isError;let u;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==h?(u={catalog:d,isLoading:h,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=h,n[11]=u):u=n[11],u}function xae(t){const e=z.c(86),{active:s,counts:n,showBlog:i,onSelect:r}=t,l=re();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 h=s==="pages";let u;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==h?(u=o.jsx(Hn,{id:"pages",icon:sl,label:d,count:n.pages,active:h,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=h,e[10]=u):u=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const p=s==="sections";let m;e[13]!==n.sections||e[14]!==r||e[15]!==f||e[16]!==p?(m=o.jsx(Hn,{id:"sections",icon:ll,label:f,count:n.sections,active:p,onSelect:r}),e[13]=n.sections,e[14]=r,e[15]=f,e[16]=p,e[17]=m):m=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(Hn,{id:"apps",icon:b7,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 y;e[25]!==l?(y=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=y):y=e[26];const _=s==="redirects";let v;e[27]!==n.redirects||e[28]!==r||e[29]!==y||e[30]!==_?(v=o.jsx(Hn,{id:"redirects",icon:N8,label:y,count:n.redirects,active:_,onSelect:r}),e[27]=n.redirects,e[28]=r,e[29]=y,e[30]=_,e[31]=v):v=e[31];let L;e[32]!==l?(L=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=L):L=e[33];const S=s==="loaders";let w;e[34]!==n.loaders||e[35]!==r||e[36]!==L||e[37]!==S?(w=o.jsx(Hn,{id:"loaders",icon:Jc,label:L,count:n.loaders,active:S,onSelect:r}),e[34]=n.loaders,e[35]=r,e[36]=L,e[37]=S,e[38]=w):w=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(Hn,{id:"actions",icon:br,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 N;e[46]!==l?(N=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=N):N=e[47];const T=s==="site";let V;e[48]!==r||e[49]!==N||e[50]!==T?(V=o.jsx(Hn,{id:"site",icon:vg,label:N,active:T,onSelect:r}),e[48]=r,e[49]=N,e[50]=T,e[51]=V):V=e[51];let A;e[52]!==l?(A=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=A):A=e[53];const E=s==="seo";let R;e[54]!==r||e[55]!==A||e[56]!==E?(R=o.jsx(Hn,{id:"seo",icon:pg,label:A,active:E,onSelect:r}),e[54]=r,e[55]=A,e[56]=E,e[57]=R):R=e[57];let D;e[58]!==l?(D=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=D):D=e[59];const I=s==="calendar";let O;e[60]!==r||e[61]!==D||e[62]!==I?(O=o.jsx(Hn,{id:"calendar",icon:hr,label:D,active:I,onSelect:r}),e[60]=r,e[61]=D,e[62]=I,e[63]=O):O=e[63];let F;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==r||e[69]!==i||e[70]!==l?(F=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(Yc,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),o.jsx(Hn,{id:"posts",icon:so,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(Hn,{id:"authors",icon:Og,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(Hn,{id:"categories",icon:p9,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(Hn,{id:"post-schedule",icon:qA,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]=F):F=e[71];let M;e[72]!==b||e[73]!==v||e[74]!==w||e[75]!==C||e[76]!==V||e[77]!==R||e[78]!==O||e[79]!==F||e[80]!==u||e[81]!==m?(M=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,m,b,v,w,C,V,R,O,F]}),e[72]=b,e[73]=v,e[74]=w,e[75]=C,e[76]=V,e[77]=R,e[78]=O,e[79]=F,e[80]=u,e[81]=m,e[82]=M):M=e[82];let $;return e[83]!==c||e[84]!==M?($=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=$):$=e[85],$}function Hn(t){const e=z.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 h;e[3]!==d?(h=ie("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]=h):h=e[4];let u;e[5]!==n?(u=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=u):u=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 p;e[9]!==l||e[10]!==r?(p=r!==void 0&&o.jsx("span",{className:ie("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]=p):p=e[11];let m;return e[12]!==c||e[13]!==h||e[14]!==u||e[15]!==f||e[16]!==p?(m=o.jsxs("button",{type:"button",onClick:c,className:h,children:[u,f,p]}),e[12]=c,e[13]=h,e[14]=u,e[15]=f,e[16]=p,e[17]=m):m=e[17],m}function bae(t){const e=z.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=Ak({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(Kc,{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(Kc,{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(Kc,{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 vae=new Set(["clone-failed","install-failed","start-failed","crashed"]);function yae(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&&!vae.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Rv(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 _ae(t,e){const s=il,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 Lae(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 wae(t){const e=fx(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Sae(t,e){return yk(t,e)}const kae=1e3;function jae(t,e){for(let s=0;s<kae;s++){const n=fx(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Cae={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Nae={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Tae={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Vae(t){const e=z.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:l,error:a,templates:c,validate:d,onSubmit:h,onOpenChange:u}=t,f=l===void 0?!1:l,p=re(),[m,g]=P.useState(i),[x,b]=P.useState(r),[y,_]=P.useState(rl),[v,L]=P.useState(null),[S,w]=P.useState(s);s!==S&&(w(s),s&&(g(i),b(r),_(rl),L(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==u?(j=ae=>{!ae&&!f&&(L(null),u(!1))},e[0]=f,e[1]=u,e[2]=j):j=e[2];const C=j;let N;e[3]!==f||e[4]!==m||e[5]!==h||e[6]!==x||e[7]!==k||e[8]!==y||e[9]!==d?(N=async ae=>{ae.preventDefault();const de=m.trim(),ue=x.trim();if(!de||!ue||f)return;const pe=_3(ue);if(pe){L(pe);return}const Z=d?.({name:de,path:ue});if(Z){L(Z);return}L(null),await h({name:de,path:ue,templateKey:k&&y!==rl?y:null})},e[3]=f,e[4]=m,e[5]=h,e[6]=x,e[7]=k,e[8]=y,e[9]=d,e[10]=N):N=e[10];const T=N,V=v??a,A=Cae[n];let E;e[11]!==p||e[12]!==A?(E=p(A),e[11]=p,e[12]=A,e[13]=E):E=e[13];let R;e[14]!==E?(R=o.jsx(ms,{children:o.jsx(Jt,{children:E})}),e[14]=E,e[15]=R):R=e[15];let D;e[16]!==f||e[17]!==k||e[18]!==p||e[19]!==y||e[20]!==c?(D=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:p("sandbox.pageFormDialog.labelTemplate")}),o.jsx(_k,{id:"page-form-template",value:y,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=p,e[19]=y,e[20]=c,e[21]=D):D=e[21];let I;e[22]!==p?(I=p("sandbox.pageFormDialog.labelName"),e[22]=p,e[23]=I):I=e[23];let O;e[24]!==I?(O=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:I}),e[24]=I,e[25]=O):O=e[25];let F;e[26]===Symbol.for("react.memo_cache_sentinel")?(F=ae=>g(ae.target.value),e[26]=F):F=e[26];let M;e[27]!==p?(M=p("sandbox.pageFormDialog.placeholderName"),e[27]=p,e[28]=M):M=e[28];let $;e[29]!==f||e[30]!==m||e[31]!==M?($=o.jsx(gt,{id:"page-form-name",value:m,onChange:F,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=m,e[31]=M,e[32]=$):$=e[32];let B;e[33]!==$||e[34]!==O?(B=o.jsxs("div",{className:"space-y-1.5",children:[O,$]}),e[33]=$,e[34]=O,e[35]=B):B=e[35];let U;e[36]!==p?(U=p("sandbox.pageFormDialog.labelPath"),e[36]=p,e[37]=U):U=e[37];let H;e[38]!==U?(H=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=H):H=e[39];let W;e[40]===Symbol.for("react.memo_cache_sentinel")?(W=ae=>b(ae.target.value),e[40]=W):W=e[40];let K;e[41]!==p?(K=p("sandbox.pageFormDialog.placeholderPath"),e[41]=p,e[42]=K):K=e[42];let G;e[43]!==f||e[44]!==x||e[45]!==K?(G=o.jsx(gt,{id:"page-form-path",value:x,onChange:W,placeholder:K,disabled:f}),e[43]=f,e[44]=x,e[45]=K,e[46]=G):G=e[46];let Y;e[47]!==H||e[48]!==G?(Y=o.jsxs("div",{className:"space-y-1.5",children:[H,G]}),e[47]=H,e[48]=G,e[49]=Y):Y=e[49];let X;e[50]!==V?(X=V&&o.jsx("p",{className:"text-xs text-destructive",children:V}),e[50]=V,e[51]=X):X=e[51];let te;e[52]!==B||e[53]!==Y||e[54]!==X||e[55]!==D?(te=o.jsxs("div",{className:"space-y-4 py-4",children:[D,B,Y,X]}),e[52]=B,e[53]=Y,e[54]=X,e[55]=D,e[56]=te):te=e[56];let se;e[57]!==u?(se=()=>u(!1),e[57]=u,e[58]=se):se=e[58];let ne;e[59]!==p?(ne=p("sandbox.pageFormDialog.buttonCancel"),e[59]=p,e[60]=ne):ne=e[60];let Q;e[61]!==f||e[62]!==se||e[63]!==ne?(Q=o.jsx(me,{type:"button",variant:"outline",onClick:se,disabled:f,children:ne}),e[61]=f,e[62]=se,e[63]=ne,e[64]=Q):Q=e[64];let q;e[65]!==f||e[66]!==m||e[67]!==x?(q=!m.trim()||!x.trim()||f,e[65]=f,e[66]=m,e[67]=x,e[68]=q):q=e[68];let le;e[69]!==f||e[70]!==n||e[71]!==p?(le=f?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),p(Tae[n])]}):p(Nae[n]),e[69]=f,e[70]=n,e[71]=p,e[72]=le):le=e[72];let J;e[73]!==q||e[74]!==le?(J=o.jsx(me,{type:"submit",disabled:q,children:le}),e[73]=q,e[74]=le,e[75]=J):J=e[75];let oe;e[76]!==Q||e[77]!==J?(oe=o.jsxs(Jn,{children:[Q,J]}),e[76]=Q,e[77]=J,e[78]=oe):oe=e[78];let ee;e[79]!==T||e[80]!==te||e[81]!==oe||e[82]!==R?(ee=o.jsx(Wt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:T,children:[R,te,oe]})}),e[79]=T,e[80]=te,e[81]=oe,e[82]=R,e[83]=ee):ee=e[83];let he;return e[84]!==C||e[85]!==s||e[86]!==ee?(he=o.jsx(qt,{open:s,onOpenChange:C,children:ee}),e[84]=C,e[85]=s,e[86]=ee,e[87]=he):he=e[87],he}function Aae(t){const e=z.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:l,onOpenChange:a}=t,c=r===void 0?!1:r,d=re(),[h,u]=P.useState(i),[f,p]=P.useState(s);s!==f&&(p(s),s&&u(i));let m;e[0]!==c||e[1]!==a?(m=W=>{!W&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=m):m=e[2];const g=m;let x;e[3]!==c||e[4]!==h||e[5]!==l?(x=async W=>{W.preventDefault();const K=h.trim();!K||c||await l(K)},e[3]=c,e[4]=h,e[5]=l,e[6]=x):x=e[6];const b=x;let y;e[7]!==d?(y=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsx(Jt,{children:y}),e[9]=y,e[10]=_):_=e[10];let v;e[11]!==d?(v=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=v):v=e[12];let L;e[13]!==v?(L=o.jsx(Tn,{children:v}),e[13]=v,e[14]=L):L=e[14];let S;e[15]!==_||e[16]!==L?(S=o.jsxs(ms,{children:[_,L]}),e[15]=_,e[16]=L,e[17]=S):S=e[17];let w;e[18]!==d?(w=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=w):w=e[19];let k;e[20]!==w?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:w}),e[20]=w,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=W=>u(W.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==h?(C=o.jsx(gt,{id:"section-rename-name",value:h,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=h,e[25]=C):C=e[25];let N;e[26]!==k||e[27]!==C?(N=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=N):N=e[28];let T;e[29]!==d?(T=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=T):T=e[30];let V;e[31]!==T?(V=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:T}),e[31]=T,e[32]=V):V=e[32];let A;e[33]!==n?(A=o.jsx(gt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=A):A=e[34];let E;e[35]!==V||e[36]!==A?(E=o.jsxs("div",{className:"space-y-1.5",children:[V,A]}),e[35]=V,e[36]=A,e[37]=E):E=e[37];let R;e[38]!==N||e[39]!==E?(R=o.jsxs("div",{className:"space-y-4 py-4",children:[N,E]}),e[38]=N,e[39]=E,e[40]=R):R=e[40];let D;e[41]!==a?(D=()=>a(!1),e[41]=a,e[42]=D):D=e[42];let I;e[43]!==d?(I=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=I):I=e[44];let O;e[45]!==c||e[46]!==D||e[47]!==I?(O=o.jsx(me,{type:"button",variant:"outline",onClick:D,disabled:c,children:I}),e[45]=c,e[46]=D,e[47]=I,e[48]=O):O=e[48];let F;e[49]!==c||e[50]!==h?(F=!h.trim()||c,e[49]=c,e[50]=h,e[51]=F):F=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let $;e[55]!==F||e[56]!==M?($=o.jsx(me,{type:"submit",disabled:F,children:M}),e[55]=F,e[56]=M,e[57]=$):$=e[57];let B;e[58]!==O||e[59]!==$?(B=o.jsxs(Jn,{children:[O,$]}),e[58]=O,e[59]=$,e[60]=B):B=e[60];let U;e[61]!==b||e[62]!==R||e[63]!==B||e[64]!==S?(U=o.jsx(Wt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[S,R,B]})}),e[61]=b,e[62]=R,e[63]=B,e[64]=S,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=o.jsx(qt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function Pae(t){const e=z.c(7),{type:s}=t,n=vz[s];let i;e[0]!==n?(i=o.jsx(Fe,{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(Ue,{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(He,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const vm={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Dx=["posts","authors","categories"],Cu={posts:"post",authors:"author",categories:"category"};function Nu(t){return Dx.includes(t)}const Ix={posts:"post",authors:"author",categories:"category"},qj={posts:vm.post,authors:vm.author,categories:vm.category},Eae=Object.fromEntries(Object.entries(qj).map(([t,e])=>[e,t]));function Rae(t){return typeof t=="string"?Eae[t]??null:null}function pl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function fs(t){return typeof t=="string"?t:""}function Dae(t,e){switch(t){case"posts":return{label:fs(e.title)||"Untitled post",subtitle:fs(e.slug)};case"authors":return{label:fs(e.name)||"Unnamed author",subtitle:fs(e.email)};case"categories":return{label:fs(e.name)||"Unnamed category",subtitle:fs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Gj(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=pl(n);if(!i)continue;const r=Rae(i.__resolveType);if(!r)continue;const l=pl(i[Ix[r]])??{},{label:a,subtitle:c}=Dae(r,l);e[r].push({key:s,kind:r,label:a,subtitle:c})}for(const s of Dx)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function Iae(t,e){return Gj(t)[e]}function Zu(t,e){return Iae(t,e).map(s=>({key:s.key,payload:au(pl(t[s.key])??void 0,e)}))}const Dv=Object.freeze({});function au(t,e){return t?pl(t[Ix[e]])??Dv:Dv}function kc(t,e,s){return{name:t,__resolveType:qj[e],[Ix[e]]:s}}function pxe({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=f=>typeof f=="string"?f:fs(pl(f)?.[s]),l=f=>typeof f=="string"?f:fs(pl(f)?.name),a=f=>{const p=r(f),m=p?t.find(({payload:x})=>fs(x[s])===p):void 0;if(m)return m;const g=l(f);return g?t.find(({payload:x})=>fs(x.name)===g):void 0},c=t.map(({key:f,payload:p})=>({value:f,label:fs(p.name)||fs(p[s])||f})),d=new Map,h=[];return i.forEach((f,p)=>{const m=a(f);if(m){h.includes(m.key)||h.push(m.key);return}const g=`unresolved:${p}`;d.set(g,f),h.push(g),c.push({value:g,label:l(f)||r(f)||"Unknown"})}),{options:c,selectedValues:h,refsForValues:f=>f.map(p=>{const m=t.find(g=>g.key===p);return m?n(m.payload):d.get(p)}).filter(p=>p!==void 0)}}function la(t){return Array.isArray(t)?t:[]}function eo(t){if(typeof t=="string")return t;const e=pl(t);return e?fs(e.slug):""}function Mae(t){if(typeof t=="string")return t;const e=pl(t);return e?fs(e.email):""}function Yj(t){const e=[];return fs(t.title).trim()||e.push("Title"),fs(t.slug).trim()||e.push("Slug"),la(t.categories).map(eo).filter(Boolean).length===0&&e.push("Category"),fs(t.excerpt).trim()||e.push("Excerpt"),fs(t.image).trim()||e.push("Cover image"),e}const Jj=8;function Qj(t){const e=fs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function gxe(t,e){return e!=="published"||Qj(t)==="published"?!1:Yj(t).length>0}function Oae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Jj).toISOString()}function xxe(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=fs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?Oae(s):n}}function Xj(t){return Zu(t,"posts").map(({key:e,payload:s})=>({key:e,title:fs(s.title)||"Untitled post",slug:fs(s.slug),date:fs(s.date),scheduledDatetime:fs(s.scheduledDatetime),categorySlugs:la(s.categories).map(eo).filter(Boolean),authorEmails:la(s.authors).map(Mae).filter(Boolean),missing:Yj(s),status:Qj(s)}))}function $ae(t,e){const s=la(t.categories);return s.some(n=>eo(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function Bae(t,e){const s=la(t.categories);return s.length===1&&eo(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function bxe(t,e,s){const n=la(t.categories);if(!n.some(a=>eo(a)===e))return t;const i=n.map(a=>{const c=eo(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),r=new Set,l=i.filter(a=>{const c=eo(a);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:l}}function zae(t,e){const s=la(t.categories);return s.some(n=>eo(n)===e)?{...t,categories:s.filter(n=>eo(n)!==e)}:t}function Iv(t){return{...t,dateModified:new Date().toISOString()}}function Xp(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 ym(t,e){const s=`collections/blog/${e}/${Xp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Zj(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Xp(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-${Xp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Fae={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"}},Mv="Box";function Uae(t){return t.startsWith("site/")?"site":"app"}function Hae(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Wd(...t){for(const e of t)if(e!==void 0)return e}function vxe(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const r of Object.keys(i)){if(!qae(r)||e.has(r))continue;e.add(r);const l=_l(r,t),a=Kae(r),c=Fae[a],d=Uae(r),h=(d==="site"?Wd(l.title,c?.title):Wd(c?.title,l.title))??a,u=d==="site"?Wd(l.description,c?.description):Wd(c?.description,l.description),f=d==="site"?l.icon:void 0,p=f&&Hae(f)?f:void 0,m=p!==void 0?c?.iconName??Mv:Wd(f,c?.iconName)??Mv;s.push({resolveType:r,title:h,description:u,iconName:m,iconUrl:p,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function Kae(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Wae=["blog/sections/blocks/","site/sections/Blog/Post/"];function qae(t){return Wae.some(e=>t.startsWith(e))}const yxe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_xe=["January","February","March","April","May","June","July","August","September","October","November","December"],eC=1440*60*1e3;function Ul(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function Lxe(t){return new Date(t.getFullYear(),t.getMonth(),1)}function wxe(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Bf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function Zp(t,e){return Math.round((Ul(t).getTime()-Ul(e).getTime())/eC)}function Gae(t){const e=(t.getTime()-Ul(t).getTime())/eC;return Math.min(Math.max(e,0),1)}function Ov(t,e){return Zp(t,e)+Gae(t)}function Sxe(t){const e=Bf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(Bf(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 kxe(t,e){const s=Ul(t[0]),n=Bf(s,7),i=s.getTime(),r=n.getTime(),l=[];for(const d of e){const h=Ul(d.start),u=Ul(d.end);if(u.getTime()<s.getTime()||h.getTime()>=n.getTime())continue;const f=h.getTime()<s.getTime()?s:h,p=u.getTime()>=n.getTime()?Bf(n,-1):u,m=Zp(f,s),g=Zp(p,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),y=Ov(new Date(x),s),_=Math.max(Ov(new Date(b),s)-y,0);_<=0||l.push({variant:d,startCol:m,span:g,leftUnits:y,widthUnits:_})}l.sort((d,h)=>d.startCol-h.startCol||h.span-d.span||d.variant.blockKey.localeCompare(h.variant.blockKey));const a=[],c=[];for(const d of l){let h=a.findIndex(u=>u<=d.startCol);h===-1&&(h=a.length,a.push(0)),a[h]=d.startCol+d.span,c.push({...d,lane:h})}return c}function zf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const tC=/^(\d{4})-(\d{2})-(\d{2})$/;function Ff(t){const e=t.trim();if(!e)return null;const s=tC.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:Ul(n)}function Yae(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Jj);return{...Zj("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:zf(t)}}function Jae(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(tC.test(e))return Ff(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Qae(t,e){const s=Jae(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:"")===zf(s)&&(i.date=zf(n)),i}function Xae(t){return Ff(t.scheduledDatetime)??Ff(t.date)}function jxe(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:Ff(i.scheduledDatetime)!==null},l=Xae(i);if(!l){s.push(r);continue}const a=zf(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 Zae="0.161.0",ece="0.162.0",Cxe="deno task update";function $v(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Bv(t,e){const s=$v(t),n=$v(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 sC=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function tce(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=sC.exec(s)?.[1];if(n)return n}return null}function sce(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=sC.exec(n)?.[1];if(i)return i}return null}function nce(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=tce(t.denoJson)??sce(t.meta);return!e||Bv(e,Zae)<0?{kind:"outdated",version:e}:Bv(e,ece)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function Nxe(t){return t.kind==="publish-only"||t.kind==="full"}function Txe(t){return t.kind==="full"}function ice(t){const e=z.c(16),s=bs(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=S0(t.virtualMcpId),i=xs()?.taskId??null;let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r=Ge.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},w0(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}=Tt(c),h=d??null;let u;return e[12]!==s||e[13]!==t.meta||e[14]!==h?(u=nce({packageManager:s,denoJson:h,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=h,e[15]=u):u=e[15],u}function rce({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=re(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,h]=P.useState(!1),[u,f]=P.useState(c),[p,m]=P.useState(!1),g=!i||a,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},y=async _=>{if(!i||p)return;let v;try{v=JSON.parse(_)}catch{ve.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}m(!0);try{await i(v),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{m(!1)}};return o.jsx(qt,{open:t,onOpenChange:e,children:o.jsxs(Wt,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(ms,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(Jt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(me,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(vi,{size:12}):o.jsx(dn,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(me,{size:"sm",onClick:()=>y(u),disabled:!x||p,className:"h-7 text-xs",children:r(p?"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(bd,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{y(_)}})})]})})}function ki(t){const e=z.c(45),{icon:s,logoUrl:n,title:i,subtitle:r,active:l,accent:a,variantCount:c,trailing:d,selectable:h,selectionActive:u,selected:f,invalid:p,invalidReason:m,onToggleSelect:g,onClick:x,menu:b}=t,y=a==="global";let _;e[0]!==s||e[1]!==l||e[2]!==y||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(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(Ue,{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:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",y?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:ie("shrink-0",!y&&(l?"text-accent-foreground":"text-muted-foreground")),style:y?{color:g3}:void 0})}),e[0]=s,e[1]=l,e[2]=y,e[3]=n,e[4]=c,e[5]=_):_=e[5];const v=_,L=l?y?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":y?"hover:bg-global-section/10":"hover:bg-muted";let S;e[6]!==L?(S=ie("group relative flex min-w-0 items-center rounded-md transition-colors",L),e[6]=L,e[7]=S):S=e[7];let w;e[8]!==g||e[9]!==h||e[10]!==f||e[11]!==u||e[12]!==i?(w=h&&o.jsx("span",{className:ie("flex shrink-0 items-center pl-2.5 transition-opacity",f||u?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:oce,children:o.jsx(gd,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=h,e[10]=f,e[11]=u,e[12]=i,e[13]=w):w=e[13];const k=p&&!l&&"text-destructive";let j;e[14]!==k?(j=ie("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 N=l?"text-accent-foreground/70":"text-muted-foreground";let T;e[19]!==N?(T=ie("block truncate text-xs",N),e[19]=N,e[20]=T):T=e[20];let V;e[21]!==r||e[22]!==T?(V=o.jsx("span",{className:T,children:r}),e[21]=r,e[22]=T,e[23]=V):V=e[23];let A;e[24]!==V||e[25]!==C?(A=o.jsxs("span",{className:"min-w-0 flex-1",children:[C,V]}),e[24]=V,e[25]=C,e[26]=A):A=e[26];let E;e[27]!==l||e[28]!==p||e[29]!==m?(E=p&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:o.jsx(vn,{size:14})})}),m&&o.jsx(Ue,{side:"bottom",children:m})]}),e[27]=l,e[28]=p,e[29]=m,e[30]=E):E=e[30];let R;e[31]!==x||e[32]!==v||e[33]!==A||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:[v,A,E,d]}),e[31]=x,e[32]=v,e[33]=A,e[34]=E,e[35]=d,e[36]=R):R=e[36];let D;e[37]!==l||e[38]!==b?(D=b&&o.jsx("div",{className:ie("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=D):D=e[39];let I;return e[40]!==R||e[41]!==D||e[42]!==S||e[43]!==w?(I=o.jsxs("div",{className:S,children:[w,R,D]}),e[40]=R,e[41]=D,e[42]=S,e[43]=w,e[44]=I):I=e[44],I}function oce(t){return t.stopPropagation()}function el(t){const e=z.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 lce={loaders:Jc,actions:br},ace={loaders:"Loaders",actions:"Actions"},cce={analytics:WP,blog:Yc,commerce:Eg,site:GA,website:zn};function dce(t,e){return e===0?cce[t.toLowerCase()]??cl:cl}function Ch(t,e){return e===0?Ane(t):t}function uce(t){const e=z.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c}=t,d=re();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=P.useState(h),[p,m]=P.useState(null),[g,x]=P.useState(""),[b,y]=P.useState(vce),[_,v]=P.useState(c);_!==c&&(v(c),f([]),m(null),x(""),y(new Set));let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=U=>{y(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},e[1]=L):L=e[1];const S=L;let w;e[2]!==i||e[3]!==s||e[4]!==n?(w={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=w):w=e[5];const k=D0(w);let j;e[6]!==k?(j=yx((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const C=j;let N;e[8]!==c?(N=Ok(c),e[8]=c,e[9]=N):N=e[9];const T=N,V=lce[c];let A,E,R,D,I,O,F;if(e[10]!==V||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==p||e[23]!==T||e[24]!==d||e[25]!==n){R=Symbol.for("react.early_return_sentinel");e:{const U=[...Fk(l,a,c).map(bce),...Bk(l,c).map(xce)],H=g.trim().toLowerCase(),W=H.length>0,K=W?U.filter(xe=>xe.title.toLowerCase().includes(H)||xe.resolveType.toLowerCase().includes(H)):[],G=new Map,Y=[],X=new Map;if(!W){for(const xe of U){const Ne=xe.folderPath;if(!(Ne.length<u.length)&&u.every((Te,Me)=>Ne[Me]===Te))if(Ne.length===u.length)if(xe.savedKey!==void 0){const Te=X.get(xe.resolveType);Te?Te.push(xe):X.set(xe.resolveType,[xe])}else Y.push(xe);else{const Te=Ne[u.length],Me=G.get(Te)??{count:0,savedCount:0};xe.savedKey!==void 0?Me.savedCount=Me.savedCount+1:Me.count=Me.count+1,G.set(Te,Me)}}Y.sort(gce);for(const xe of X.values())xe.sort(pce)}const te=[...X.entries()].filter(xe=>{const[Ne]=xe;return!Y.some(Te=>Te.resolveType===Ne)}).flatMap(mce).sort(fce);let se;e[33]!==u?(se=(xe,Ne)=>Ch(xe.name,u.length).localeCompare(Ch(Ne.name,u.length)),e[33]=u,e[34]=se):se=e[34];const ne=[...G.entries()].map(hce).sort(se);let Q;e[35]===Symbol.for("react.memo_cache_sentinel")?(Q=xe=>{m(xe.savedKey!==void 0?{mode:"saved",key:xe.savedKey}:{mode:"available",resolveType:xe.resolveType,title:xe.title})},e[35]=Q):Q=e[35];const q=Q;let le;e[36]!==k||e[37]!==T||e[38]!==d?(le=async(xe,Ne)=>{await k.mutateAsync({blockKey:xe,data:Ne}),ve.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:T,blockId:xe})),m({mode:"saved",key:xe})},e[36]=k,e[37]=T,e[38]=d,e[39]=le):le=e[39];const J=le;let oe;e[40]!==a||e[41]!==p?(oe=yce(p,a),e[40]=a,e[41]=p,e[42]=oe):oe=e[42];const ee=oe;if(ee){const xe=`${ee.mode}:${ee.mode==="saved"?ee.blockKey:ee.resolveType}`;let Ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>m(null),e[43]=Ne):Ne=e[43];let Te;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]!==ee.editorTarget||e[55]!==ee.initialValue||e[56]!==n?(Te=o.jsx(Fj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c,target:ee.editorTarget,initialValue:ee.initialValue,isCreating:k.isPending,onCreate:J,onSaveReferencedBlock:C,onBack:Ne},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]=ee.editorTarget,e[55]=ee.initialValue,e[56]=n,e[57]=Te):Te=e[57],R=Te;break e}F="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 ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=()=>f([]),e[60]=ae):ae=e[60];const de=u.length===0?"font-medium text-foreground":"text-muted-foreground";let ue;e[61]!==de?(ue=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",de),e[61]=de,e[62]=ue):ue=e[62];const pe=ace[c];let Z;e[63]!==ue||e[64]!==pe?(Z=o.jsx("button",{type:"button",onClick:ae,className:ue,children:pe}),e[63]=ue,e[64]=pe,e[65]=Z):Z=e[65];let ge;e[66]!==u?(ge=u.map((xe,Ne)=>{const Te=Ne===u.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,Ne+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Te?"font-medium text-foreground":"text-muted-foreground"),children:Ch(xe,Ne)})]},`${xe}-${Ne}`)}),e[66]=u,e[67]=ge):ge=e[67];let be;e[68]!==he||e[69]!==Z||e[70]!==ge?(be=o.jsxs("nav",{"aria-label":he,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Z,ge]}),e[68]=he,e[69]=Z,e[70]=ge,e[71]=be):be=e[71];let ke;e[72]===Symbol.for("react.memo_cache_sentinel")?(ke=o.jsx(A9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=ke):ke=e[72];let we;e[73]===Symbol.for("react.memo_cache_sentinel")?(we=xe=>x(xe.target.value),e[73]=we):we=e[73];let Le;e[74]!==c||e[75]!==d?(Le=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Le):Le=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 Ce;e[80]!==g||e[81]!==Le||e[82]!==_e?(Ce=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[ke,o.jsx("input",{type:"text",value:g,onChange:we,placeholder:Le,"aria-label":_e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Le,e[82]=_e,e[83]=Ce):Ce=e[83],e[84]!==be||e[85]!==Ce?(E=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[be,Ce]}),e[84]=be,e[85]=Ce,e[86]=E):E=e[86],A=yl,O="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",D="mx-auto w-full max-w-4xl px-6 py-5",I=W?K.length===0?o.jsx(el,{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(ki,{icon:V,accent:xe.savedKey!==void 0?"global":void 0,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)},xe.savedKey??xe.resolveType))}):ne.length===0&&Y.length===0&&te.length===0?o.jsx(el,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[ne.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:ne.map(xe=>{const Ne=dce(xe.name,u.length);return o.jsxs("button",{type:"button",onClick:()=>f([...u,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(Ne,{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:Ch(xe.name,u.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[xe.count," ",xe.count===1?T:c,xe.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:xe.savedCount})]})]})]})]},xe.name)})}),(Y.length>0||te.length>0)&&o.jsxs("div",{className:ie("flex flex-col gap-1",ne.length>0&&"mt-4"),children:[Y.map(xe=>{const Ne=X.get(xe.resolveType)??[],Te=b.has(xe.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(ki,{icon:V,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)}),Ne.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>S(xe.resolveType),"aria-expanded":Te,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:g3},children:[Te?o.jsx(Gt,{size:12,className:"shrink-0"}):o.jsx(qs,{size:12,className:"shrink-0"}),d(Te?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Ne.length,")"]}),Te&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Ne.map(Me=>o.jsx(ki,{icon:V,accent:"global",title:Me.title,subtitle:Me.resolveType,active:!1,onClick:()=>q(Me)},Me.savedKey))})]})]},xe.resolveType)}),te.map(xe=>o.jsx(ki,{icon:V,accent:"global",title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)},xe.savedKey))]})]})}e[10]=V,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=u,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=p,e[23]=T,e[24]=d,e[25]=n,e[26]=A,e[27]=E,e[28]=R,e[29]=D,e[30]=I,e[31]=O,e[32]=F}else A=e[26],E=e[27],R=e[28],D=e[29],I=e[30],O=e[31],F=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let M;e[87]!==D||e[88]!==I?(M=o.jsx("div",{className:D,children:I}),e[87]=D,e[88]=I,e[89]=M):M=e[89];let $;e[90]!==A||e[91]!==M||e[92]!==O?($=o.jsx(A,{className:O,children:M}),e[90]=A,e[91]=M,e[92]=O,e[93]=$):$=e[93];let B;return e[94]!==E||e[95]!==$||e[96]!==F?(B=o.jsxs("div",{className:F,children:[E,$]}),e[94]=E,e[95]=$,e[96]=F,e[97]=B):B=e[97],B}function hce(t){const[e,s]=t;return{name:e,...s}}function fce(t,e){return t.title.localeCompare(e.title)}function mce(t){const[,e]=t;return e}function pce(t,e){return t.title.localeCompare(e.title)}function gce(t,e){return t.title.localeCompare(e.title)}function xce(t){return{resolveType:t.resolveType,title:t.title,folderPath:zk(t.resolveType)}}function bce(t){return{resolveType:t.resolveType,title:t.title,folderPath:zk(t.resolveType),savedKey:t.key}}function vce(){return new Set}function yce(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}=Uk(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function _ce(t){const e=z.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:h,isCreating:u,onCreate:f,onSaveReferencedBlock:p}=t,m=re(),g=_o(),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[y,_]=P.useState(b);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=[],e[1]=v):v=e[1];const[L,S]=P.useState(v),[w,k]=P.useState(0),[j,C]=P.useState(!1);let N;e[2]!==l||e[3]!==c?(N=Bn(c,l),e[2]=l,e[3]=c,e[4]=N):N=e[4];const T=N,V=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,A=xs()?.taskId??null,E=r??void 0;let R;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==A||e[10]!==n?(R={orgSlug:s,virtualMcpId:n,branch:i,threadId:A,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=A,e[10]=n,e[11]=R):R=e[11];const D=R;let I,O,F,M,$,B,U,H;if(e[12]!==a||e[13]!==L||e[14]!==y||e[15]!==f||e[16]!==m||e[17]!==d){const ue=[d,...L],pe=ge=>{S(L.slice(0,ge)),k(Lce)};let Z;e[26]!==a||e[27]!==y||e[28]!==f?(Z=async ge=>{const be=Cx(ge,a);if(be){ve.error(be);return}await f(ge,y),C(!1)},e[26]=a,e[27]=y,e[28]=f,e[29]=Z):Z=e[29],I=Z,M="flex h-full w-full min-w-0",F="flex min-w-0 flex-1 flex-col",O="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==m?($=m("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=m,e[31]=$):$=e[31],B="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ue.map((ge,be)=>{const ke=be===ue.length-1,we=Nn(ge);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[be>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>pe(be),title:we,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ke?"font-medium text-foreground":"text-muted-foreground"),children:we})]},`${we}-${be}`)}),e[12]=a,e[13]=L,e[14]=y,e[15]=f,e[16]=m,e[17]=d,e[18]=I,e[19]=O,e[20]=F,e[21]=M,e[22]=$,e[23]=B,e[24]=U,e[25]=H}else I=e[18],O=e[19],F=e[20],M=e[21],$=e[22],B=e[23],U=e[24],H=e[25];let W;e[32]!==$||e[33]!==B||e[34]!==U?(W=o.jsx("nav",{"aria-label":$,className:B,children:U}),e[32]=$,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 G;e[37]!==m?(G=m("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=m,e[38]=G):G=e[38];let Y;e[39]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(ug,{size:14}),e[39]=Y):Y=e[39];let X;e[40]!==u||e[41]!==G?(X=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:K,"aria-label":G,children:Y})}),e[40]=u,e[41]=G,e[42]=X):X=e[42];let te;e[43]!==m?(te=m("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=m,e[44]=te):te=e[44];let se;e[45]!==te?(se=o.jsx(Ue,{side:"bottom",children:te}),e[45]=te,e[46]=se):se=e[46];let ne;e[47]!==X||e[48]!==se?(ne=o.jsxs(He,{children:[X,se]}),e[47]=X,e[48]=se,e[49]=ne):ne=e[49];let Q;e[50]!==W||e[51]!==ne||e[52]!==H?(Q=o.jsxs("div",{className:H,children:[W,ne]}),e[50]=W,e[51]=ne,e[52]=H,e[53]=Q):Q=e[53];const q="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",le=m("sandbox.availableSectionEditor.localEditsHint",{typeLabel:V});let J;e[54]!==le?(J=o.jsx("p",{className:q,children:le}),e[54]=le,e[55]=J):J=e[55];let oe;e[56]!==O||e[57]!==Q||e[58]!==J?(oe=o.jsxs("div",{className:O,children:[Q,J]}),e[56]=O,e[57]=Q,e[58]=J,e[59]=oe):oe=e[59];let ee;e[60]!==a||e[61]!==L||e[62]!==w||e[63]!==y||e[64]!==l||e[65]!==p||e[66]!==D||e[67]!==T||e[68]!==m?(ee=o.jsx(yl,{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:T?o.jsx(zi,{schema:T,value:y,onChange:ue=>_(ue),basePath:"",breadcrumbPath:L,onBreadcrumbChange:S,meta:l,decofile:a,onSaveReferencedBlock:p,sandbox:D},w):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=L,e[62]=w,e[63]=y,e[64]=l,e[65]=p,e[66]=D,e[67]=T,e[68]=m,e[69]=ee):ee=e[69];let he;e[70]!==F||e[71]!==oe||e[72]!==ee?(he=o.jsxs("div",{className:F,children:[oe,ee]}),e[70]=F,e[71]=oe,e[72]=ee,e[73]=he):he=e[73];let ae;e[74]!==h||e[75]!==I||e[76]!==u||e[77]!==j?(ae=o.jsx(Nx,{open:j,onOpenChange:C,defaultBlockId:h,isPending:u,onSubmit:I}),e[74]=h,e[75]=I,e[76]=u,e[77]=j,e[78]=ae):ae=e[78];let de;return e[79]!==M||e[80]!==he||e[81]!==ae?(de=o.jsxs("div",{className:M,children:[he,ae]}),e[79]=M,e[80]=he,e[81]=ae,e[82]=de):de=e[82],de}function Lce(t){return t+1}var wce=Object.prototype.toString,Vd=Array.isArray||function(e){return wce.call(e)==="[object Array]"};function Mx(t){return typeof t=="function"}function Sce(t){return Vd(t)?"array":typeof t}function _m(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function zv(t,e){return t!=null&&typeof t=="object"&&e in t}function kce(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var jce=RegExp.prototype.test;function Cce(t,e){return jce.call(t,e)}var Nce=/\S/;function Tce(t){return!Cce(Nce,t)}var Vce={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Ace(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return Vce[s]})}var Pce=/\s*/,Ece=/\s+/,Fv=/\s*=/,Rce=/\s*\}/,Dce=/#|\^|\/|>|\{|&|=|!/;function Ice(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],l=!1,a=!1,c="",d=0;function h(){if(l&&!a)for(;r.length;)delete i[r.pop()];else r=[];l=!1,a=!1}var u,f,p;function m(k){if(typeof k=="string"&&(k=k.split(Ece,2)),!Vd(k)||k.length!==2)throw new Error("Invalid tags: "+k);u=new RegExp(_m(k[0])+"\\s*"),f=new RegExp("\\s*"+_m(k[1])),p=new RegExp("\\s*"+_m("}"+k[1]))}m(e||Mi.tags);for(var g=new I0(t),x,b,y,_,v,L;!g.eos();){if(x=g.pos,y=g.scanUntil(u),y)for(var S=0,w=y.length;S<w;++S)_=y.charAt(S),Tce(_)?(r.push(i.length),c+=_):(a=!0,s=!0,c+=" "),i.push(["text",_,x,x+1]),x+=1,_===`
624
+ `)}function wv(t){return t.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Voe(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 Aoe(t){return t.map((e,s)=>({...e,index:s}))}function Pj(t){const e=z.c(19),{label:s,canDelete:n,dragging:i,onRename:r,onDuplicate:l,onDelete:a}=t,c=re(),d=i?"opacity-100":"opacity-0 group-hover:opacity-100";let h;e[0]!==d?(h=ie("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=h):h=e[1];let u;e[2]!==h?(u=o.jsx(fd,{className:h}),e[2]=h,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(sl,{className:"h-4 w-4 shrink-0",style:{color:Noe}}),e[4]=f):f=e[4];let p;e[5]!==s?(p=o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=p):p=e[6];let m;e[7]!==n||e[8]!==i||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==r||e[13]!==c?(m=!i&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":c("sectionsEditor.sectionVariantList.openActionsFor",{label:s}),className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 data-[state=open]:opacity-100",onClick:Eoe,onPointerDown:Poe,children:o.jsx(Qn,{size:14})})}),o.jsxs(zt,{align:"end",children:[r&&o.jsxs(Ye,{onClick:x=>{x.stopPropagation(),r()},children:[o.jsx(C8,{size:14}),c("sectionsEditor.sectionVariantList.rename")]}),o.jsxs(Ye,{onClick:x=>{x.stopPropagation(),l?.()},children:[o.jsx(dn,{size:14}),c("sectionsEditor.sectionVariantList.duplicate")]}),o.jsxs(Ye,{variant:"destructive",disabled:!n,onClick:x=>{x.stopPropagation(),a?.()},children:[o.jsx(Gs,{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]=m):m=e[14];let g;return e[15]!==u||e[16]!==p||e[17]!==m?(g=o.jsxs(o.Fragment,{children:[u,f,p,m]}),e[15]=u,e[16]=p,e[17]=m,e[18]=g):g=e[18],g}function Poe(t){return t.stopPropagation()}function Eoe(t){return t.stopPropagation()}function Roe(t){const e=z.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:Doe},e[0]=s.id,e[1]=d):d=e[1];const{attributes:h,listeners:u,setNodeRef:f,transform:p,isDragging:m}=e1(d);let g;e[2]!==p?(g=Ri.Transform.toString(p?{...p,x:0}:null),e[2]=p,e[3]=g):g=e[3];const x=m?0:void 0;let b;e[4]!==g||e[5]!==x?(b={transform:g,opacity:x},e[4]=g,e[5]=x,e[6]=b):b=e[6];const y=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 v=m?"cursor-grabbing":"cursor-grab",L=n?Aj:Toe;let S;e[9]!==v||e[10]!==L?(S=ie("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",v,L),e[9]=v,e[10]=L,e[11]=S):S=e[11];let w;e[12]!==i||e[13]!==s.label||e[14]!==c||e[15]!==a||e[16]!==l?(w=o.jsx(Pj,{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]=w):w=e[17];let k;return e[18]!==h||e[19]!==u||e[20]!==r||e[21]!==f||e[22]!==y||e[23]!==_||e[24]!==S||e[25]!==w?(k=o.jsx("div",{ref:f,style:y,...h,...u,onClick:r,onKeyDown:_,className:S,children:w}),e[18]=h,e[19]=u,e[20]=r,e[21]=f,e[22]=y,e[23]=_,e[24]=S,e[25]=w,e[26]=k):k=e[26],k}function Doe(){return!1}function Ioe(t){const e=z.c(103),{listKey:s,variants:n,selectedIndex:i,onSelect:r,onRename:l,onDuplicate:a,onDelete:c,onRemoveAll:d,onReorder:h,onAdd:u}=t,f=re(),p=n.length>1;let m;e[0]!==n?(m=()=>wv(n),e[0]=n,e[1]=m):m=e[1];const[g,x]=P.useState(m),[b,y]=P.useState(null),[_,v]=P.useState(s),[L,S]=P.useState(n.length);let w;e[2]!==n?(w=()=>Lv(n),e[2]=n,e[3]=w):w=e[3];const[k,j]=P.useState(w),C=P.useRef(!1),N=Lv(n);_!==s?(v(s),S(n.length),j(N),x(wv(n))):(L!==n.length||k!==N)&&(S(n.length),j(N),x(de=>Voe(de,n)));let T;e[4]===Symbol.for("react.memo_cache_sentinel")?(T={activationConstraint:{distance:8}},e[4]=T):T=e[4];let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:t1},e[5]=V):V=e[5];const A=T0(vr(wa,T),vr(La,V));let E;e[6]!==g?(E=g.map(Moe),e[6]=g,e[7]=E):E=e[7];const R=E;let D;e[8]!==g?(D=de=>{const ue=String(de.active.id);y(g.find(pe=>pe.id===ue)??null)},e[8]=g,e[9]=D):D=e[9];const I=D;let O;e[10]!==R||e[11]!==h?(O=de=>{y(null);const{active:ue,over:pe}=de;if(!pe||ue.id===pe.id)return;const Z=R.indexOf(String(ue.id)),ge=R.indexOf(String(pe.id));Z===-1||ge===-1||(x(be=>Aoe(ea([...be],Z,ge))),C.current=!0,requestAnimationFrame(()=>{C.current=!1}),h(Z,ge))},e[10]=R,e[11]=h,e[12]=O):O=e[12];const F=O;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=()=>{y(null)},e[13]=M):M=e[13];const $=M;let B,U,H,W,K,G,Y,X,te,se,ne,Q,q;if(e[14]!==p||e[15]!==g||e[16]!==R||e[17]!==F||e[18]!==I||e[19]!==u||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==l||e[24]!==r||e[25]!==i||e[26]!==A||e[27]!==f){const de=We=>{C.current||r(We)};ne="space-y-1 border-b p-2";let ue;e[41]!==f?(ue=f("sectionsEditor.sectionVariantList.title"),e[41]=f,e[42]=ue):ue=e[42];let pe;e[43]!==ue?(pe=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:ue}),e[43]=ue,e[44]=pe):pe=e[44];let Z;e[45]!==f?(Z=f("sectionsEditor.sectionVariantList.addVariantAriaLabel"),e[45]=f,e[46]=Z):Z=e[46];let ge;e[47]===Symbol.for("react.memo_cache_sentinel")?(ge=o.jsx(Ut,{size:14}),e[47]=ge):ge=e[47];let be;e[48]!==u||e[49]!==Z?(be=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":Z,className:"size-6",onClick:u,children:ge})}),e[48]=u,e[49]=Z,e[50]=be):be=e[50];let ke;e[51]!==f?(ke=f("sectionsEditor.sectionVariantList.addVariant"),e[51]=f,e[52]=ke):ke=e[52];let we;e[53]!==ke?(we=o.jsx(Ue,{children:ke}),e[53]=ke,e[54]=we):we=e[54];let Le;e[55]!==be||e[56]!==we?(Le=o.jsxs(He,{children:[be,we]}),e[55]=be,e[56]=we,e[57]=Le):Le=e[57];let _e;e[58]!==f?(_e=f("sectionsEditor.sectionVariantList.removeAllVariantsAriaLabel"),e[58]=f,e[59]=_e):_e=e[59];let Ce;e[60]===Symbol.for("react.memo_cache_sentinel")?(Ce=o.jsx(Gs,{size:14}),e[60]=Ce):Ce=e[60];let xe;e[61]!==d||e[62]!==_e?(xe=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":_e,className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:Ce})}),e[61]=d,e[62]=_e,e[63]=xe):xe=e[63];let Ne;e[64]!==f?(Ne=f("sectionsEditor.sectionVariantList.removeAllVariants"),e[64]=f,e[65]=Ne):Ne=e[65];let Te;e[66]!==Ne?(Te=o.jsx(Ue,{children:Ne}),e[66]=Ne,e[67]=Te):Te=e[67];let Me;e[68]!==xe||e[69]!==Te?(Me=o.jsxs(He,{children:[xe,Te]}),e[68]=xe,e[69]=Te,e[70]=Me):Me=e[70];let Qe;e[71]!==Le||e[72]!==Me?(Qe=o.jsxs("div",{className:"flex items-center gap-0.5",children:[Le,Me]}),e[71]=Le,e[72]=Me,e[73]=Qe):Qe=e[73],e[74]!==pe||e[75]!==Qe?(Q=o.jsxs("div",{className:"flex items-center justify-between",children:[pe,Qe]}),e[74]=pe,e[75]=Qe,e[76]=Q):Q=e[76],U=A0,G=A,Y=A3,X=I,te=F,se=$,B=Z9,W=R,K=X9,q="space-y-0.5",H=g.map(We=>o.jsx(Roe,{entry:We,selected:We.index===i,canDelete:p,onSelect:()=>de(We.index),onRename:l?()=>l(We.index):void 0,onDuplicate:()=>a(We.index),onDelete:()=>c(We.index)},We.id)),e[14]=p,e[15]=g,e[16]=R,e[17]=F,e[18]=I,e[19]=u,e[20]=c,e[21]=a,e[22]=d,e[23]=l,e[24]=r,e[25]=i,e[26]=A,e[27]=f,e[28]=B,e[29]=U,e[30]=H,e[31]=W,e[32]=K,e[33]=G,e[34]=Y,e[35]=X,e[36]=te,e[37]=se,e[38]=ne,e[39]=Q,e[40]=q}else B=e[28],U=e[29],H=e[30],W=e[31],K=e[32],G=e[33],Y=e[34],X=e[35],te=e[36],se=e[37],ne=e[38],Q=e[39],q=e[40];let le;e[77]!==H||e[78]!==q?(le=o.jsx("div",{className:q,children:H}),e[77]=H,e[78]=q,e[79]=le):le=e[79];let J;e[80]!==B||e[81]!==W||e[82]!==K||e[83]!==le?(J=o.jsx(B,{items:W,strategy:K,children:le}),e[80]=B,e[81]=W,e[82]=K,e[83]=le,e[84]=J):J=e[84];let oe;e[85]!==b||e[86]!==p?(oe=b?o.jsx("div",{className:ie("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",Aj),children:o.jsx(Pj,{label:b.label,canDelete:p,dragging:!0})}):null,e[85]=b,e[86]=p,e[87]=oe):oe=e[87];let ee;e[88]!==oe?(ee=kn.createPortal(o.jsx(Q9,{dropAnimation:ej,children:oe}),document.body),e[88]=oe,e[89]=ee):ee=e[89];let he;e[90]!==U||e[91]!==G||e[92]!==Y||e[93]!==X||e[94]!==te||e[95]!==se||e[96]!==J||e[97]!==ee?(he=o.jsxs(U,{sensors:G,collisionDetection:Y,onDragStart:X,onDragEnd:te,onDragCancel:se,children:[J,ee]}),e[90]=U,e[91]=G,e[92]=Y,e[93]=X,e[94]=te,e[95]=se,e[96]=J,e[97]=ee,e[98]=he):he=e[98];let ae;return e[99]!==ne||e[100]!==Q||e[101]!==he?(ae=o.jsxs("div",{className:ne,children:[Q,he]}),e[99]=ne,e[100]=Q,e[101]=he,e[102]=ae):ae=e[102],ae}function Moe(t){return t.id}const Ooe=[[/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"]],$oe={"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 mm(t){return xa(t)!==void 0}function Ax(t,e){if(e){if(mm(e))return e;const s=$oe[e];if(s&&mm(s))return s}for(const[s,n]of Ooe)if(s.test(t)&&mm(n))return n;return"FilterLines"}function Boe(t){return xa(t)??T9}function pm(t){const e=z.c(11),{iconName:s,size:n,className:i}=t,r=n===void 0?"md":n;let l;e[0]!==s?(l=Boe(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 h;e[2]!==c||e[3]!==i?(h=ie("flex shrink-0 items-center justify-center rounded-full bg-muted",c,i),e[2]=c,e[3]=i,e[4]=h):h=e[4];let u;e[5]!==a||e[6]!==d?(u=o.jsx(a,{size:d,className:"text-muted-foreground"}),e[5]=a,e[6]=d,e[7]=u):u=e[7];let f;return e[8]!==h||e[9]!==u?(f=o.jsx("div",{className:h,children:u}),e[8]=h,e[9]=u,e[10]=f):f=e[10],f}function oxe(t,e){return Ote(t,e).map(s=>{const n=e[s.blockKey]??{},i=mk(zte(s.blockKey),e,t);return{blockKey:s.blockKey,title:Zl(s.blockKey,n),description:rd(i),iconName:Ax(s.matcherResolveType)}})}const Ej="Users03";function zoe(t,e){return t.toLowerCase().includes(e.trim().toLowerCase())?1:0}function Foe(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=_l(l,t);s.push({resolveType:l,title:a.title??ws(l),description:a.description,iconName:Ax(l,a.icon)})}return s}function Uoe(t,e){if(!t)return Ej;const s=e.find(n=>n.resolveType===t);return s?s.iconName:Ax(t)}function Hoe(t){const e=z.c(85),{currentRt:s,currentLabel:n,currentGlobalKey:i,matchers:r,globals:l,onSelect:a,onSelectGlobal:c}=t,d=l===void 0?[]:l,[h,u]=P.useState(!1),f=re(),m=(i?d.find(Q=>Q.blockKey===i):void 0)?.iconName??Uoe(s,r),g=xa(m);let x;e[0]!==a||e[1]!==u?(x=Q=>{a(Q),u(!1)},e[0]=a,e[1]=u,e[2]=x):x=e[2];const b=x;let y;e[3]!==c||e[4]!==u?(y=Q=>{c?.(Q),u(!1)},e[3]=c,e[4]=u,e[5]=y):y=e[5];const _=y;let v;e[6]!==u?(v=()=>u(!0),e[6]=u,e[7]=v):v=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 S;e[10]!==n?(S=o.jsx("span",{className:"flex-1 truncate",children:n}),e[10]=n,e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Gt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[12]=w):w=e[12];let k;e[13]!==v||e[14]!==L||e[15]!==S?(k=o.jsxs("button",{type:"button",onClick:v,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,S,w]}),e[13]=v,e[14]=L,e[15]=S,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 N;e[21]!==f?(N=f("sectionsEditor.matcherPicker.searchRulesPlaceholder"),e[21]=f,e[22]=N):N=e[22];let T;e[23]!==N?(T=o.jsx(An,{placeholder:N}),e[23]=N,e[24]=T):T=e[24];let V;e[25]!==f?(V=f("sectionsEditor.matcherPicker.noRulesFound"),e[25]=f,e[26]=V):V=e[26];let A;e[27]!==V?(A=o.jsx(hn,{children:V}),e[27]=V,e[28]=A):A=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 D=`${E} ${R}`;let I;e[33]!==b?(I=()=>b(""),e[33]=b,e[34]=I):I=e[34];const O=!s&&!i&&"bg-accent/60";let F;e[35]!==O?(F=ie("gap-2.5",O),e[35]=O,e[36]=F):F=e[36];let M;e[37]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(pm,{iconName:Ej,size:"sm"}),e[37]=M):M=e[37];let $;e[38]!==f?($=f("sectionsEditor.matcherPicker.alwaysLabel"),e[38]=f,e[39]=$):$=e[39];let B;e[40]!==$?(B=o.jsx("span",{className:"text-sm",children:$}),e[40]=$,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]!==D||e[50]!==I||e[51]!==F||e[52]!==W?(K=o.jsxs(Ft,{value:D,onSelect:I,className:F,children:[M,W]}),e[49]=D,e[50]=I,e[51]=F,e[52]=W,e[53]=K):K=e[53];let G;if(e[54]!==i||e[55]!==s||e[56]!==b||e[57]!==r){let Q;e[59]!==i||e[60]!==s||e[61]!==b?(Q=q=>o.jsxs(Ft,{value:`${q.title} ${q.resolveType} ${q.description??""}`,onSelect:()=>b(q.resolveType),className:ie("gap-2.5",!i&&s===q.resolveType&&"bg-accent/60"),children:[o.jsx(pm,{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]=Q):Q=e[62],G=r.map(Q),e[54]=i,e[55]=s,e[56]=b,e[57]=r,e[58]=G}else G=e[58];let Y;e[63]!==K||e[64]!==G?(Y=o.jsxs(os,{children:[K,G]}),e[63]=K,e[64]=G,e[65]=Y):Y=e[65];let X;e[66]!==i||e[67]!==d||e[68]!==_||e[69]!==f?(X=d.length>0&&o.jsx(os,{heading:f("sectionsEditor.matcherPicker.savedRulesHeading"),children:d.map(Q=>o.jsxs(Ft,{value:`${Q.title} ${Q.blockKey} ${Q.description??""}`,onSelect:()=>_(Q.blockKey),className:ie("gap-2.5",i===Q.blockKey&&"bg-accent/60"),children:[o.jsx(pm,{iconName:Q.iconName,size:"sm"}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("span",{className:"truncate text-sm",children:Q.title}),Q.description&&o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Q.description})]})]},Q.blockKey))}),e[66]=i,e[67]=d,e[68]=_,e[69]=f,e[70]=X):X=e[70];let te;e[71]!==A||e[72]!==Y||e[73]!==X?(te=o.jsxs(Pn,{children:[A,Y,X]}),e[71]=A,e[72]=Y,e[73]=X,e[74]=te):te=e[74];let se;e[75]!==h||e[76]!==u||e[77]!==C||e[78]!==T||e[79]!==te||e[80]!==j?(se=o.jsxs(SE,{open:h,onOpenChange:u,title:j,description:C,className:"sm:max-w-lg",filter:zoe,children:[T,te]}),e[75]=h,e[76]=u,e[77]=C,e[78]=T,e[79]=te,e[80]=j,e[81]=se):se=e[81];let ne;return e[82]!==se||e[83]!==k?(ne=o.jsxs(o.Fragment,{children:[k,se]}),e[82]=se,e[83]=k,e[84]=ne):ne=e[84],ne}const Koe="website/sections/Rendering/Lazy.tsx";function $f(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Px(t){if(!$f(t))return!1;const e=t.__resolveType;return typeof e=="string"&&Es(e)}function Woe(t){return t!=null}function Qp(t){if(t==null)return t;if(Px(t)){const e=t.section;return e==null?null:$f(e)?e:{}}return $f(t)?t:void 0}function qoe(t,e){return t===null?null:Px(e)?{...e,section:t}:t}function lxe(t){return{__resolveType:t}}function axe(t,e){if(!Woe(e))return null;if(t){const s=Qp(e)??{};return{__resolveType:Koe,section:s}}return Px(e)?Qp(e)??null:$f(e)?e:null}const Goe="General";function od(t){return/\/Seo(V\d+)?\.tsx$/i.test(t)||t.includes("/sections/Seo")}function Rj(t,e){return t===ml?Goe:e}function Dj(t){const e=ff(t),s=new Set,n=[];for(const i of e)od(i.resolveType)&&(hi(i.resolveType)||s.has(i.resolveType)||(s.add(i.resolveType),n.push({resolveType:i.resolveType,title:Rj(i.resolveType,i.title),description:i.description})));return n}function Ex(t){const e=hf(t),s=Bn(e,t),n=Dj(s?.properties?.seo);return n.length>0?n:Yoe(t)}function Yoe(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(!od(r))continue;const l=r.split("/").pop()?.replace(/\.tsx?$/,"")??r;s.push({resolveType:r,title:Rj(r,l)})}return s}function Ij(t){const e=Ex(t),s=e.find(n=>n.resolveType===ml);return s?s.resolveType:e[0]?.resolveType??ml}function Mj(t,e){const s=e.__resolveType;if(typeof s=="string"){const n=Bn(s,t),i=Dj(n?.properties?.seo);if(i.length>0)return i}return Ex(t)}function Joe(t,e){const s=Mj(t,e),n=s.find(i=>i.resolveType===ml);return n?n.resolveType:s[0]?.resolveType??Ij(t)}function Qoe(t,e){const s=e?.__resolveType;return typeof s=="string"&&s.length>0?s:Ij(t)}function Xoe(t,e,s){const n=s.__resolveType;return typeof n=="string"&&od(n)?n:Joe(t,e)}const Zoe=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]),ml="website/sections/Seo/SeoV2.tsx",ele=["title","titleTemplate","description","descriptionTemplate","image","favicon","type","noIndexing"];function ku(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function tle(t){return typeof t.__resolveType=="string"&&od(t.__resolveType)?!0:ele.some(e=>e in t)}function sle(t,e){for(const[s,n]of Object.entries(t)){if(!ku(n))continue;const i=n,r=i.__resolveType;if(typeof r=="string"&&Zoe.has(r))continue;const l=i.seo;if(ku(l)){const a=l;if(tle(a))return{blockKey:s,kind:"nested",seoData:a,blockData:i,seoResolveType:e?Xoe(e,i,a):typeof a.__resolveType=="string"&&od(a.__resolveType)?a.__resolveType:ml}}}for(const[s,n]of Object.entries(t)){if(!ku(n))continue;const i=n;if(typeof i.__resolveType=="string"&&od(i.__resolveType))return{blockKey:s,kind:"block",seoData:i,blockData:i,seoResolveType:i.__resolveType}}return null}function nle(t,e){return t.kind==="block"?e:{...t.blockData,seo:e}}function cxe(t,e,s){if(e.kind==="site"){const c=sle(t,s);return c?{blockKey:c.blockKey,seoData:c.seoData,seoResolveType:c.seoResolveType,siteKind:c.kind,seoTypeOptions:s?Mj(s,c.blockData):void 0,build:d=>nle(c,d)}:null}const n=t[e.pageKey];if(!ku(n))return null;const i=n,r=i.seo,l=Qp(r),a=l&&ku(l)?l:void 0;return{blockKey:e.pageKey,seoData:a,rawSeoData:r,seoResolveType:s?Qoe(s,a):typeof a?.__resolveType=="string"?a.__resolveType:ml,seoTypeOptions:s?Ex(s):void 0,build:c=>({...i,seo:c===null?null:qoe(c,r)})}}const Rx=["type","title","description","canonical","noIndexing","favicon","image","themeColor"],ile=["jsonLD","omitVariants","title","description","noIndexing","ignoreStructuredData"],rle=["jsonLD","title","description","noIndexing","configJsonLD"];function Oj(t){return t===ml||/\/Seo\/SeoV2\.tsx$/i.test(t)?"general":/\/Seo\/SeoPDP/i.test(t)?"pdp":/\/Seo\/SeoPLP/i.test(t)?"plp":"full"}function ole(t){switch(t){case"general":return Rx;case"pdp":return ile;case"plp":return rle;default:return null}}function $j(t,e){const s=ole(Oj(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 lle(){return Rx.filter(t=>t!=="type")}function ale(t){return t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim()}function cle(t,e){return t[e]===void 0}function dle(t){const e=z.c(13),{schema:s,value:n,onChange:i,siteDefaultSeo:r,formResetKey:l}=t,a=re(),d=$j(s,ml).properties??{},h=lle();let u;e[0]!==r?(u=!!r&&Object.keys(r).length>0,e[0]=r,e[1]=u):u=e[1];const f=u,[p,m]=P.useState(l);let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g={},e[2]=g):g=e[2];const[x,b]=P.useState(g);p!==l&&(m(l),b({}));let y;e[3]!==x||e[4]!==n?(y=j=>x[j]!==void 0?x[j]:cle(n,j),e[3]=x,e[4]=n,e[5]=y):y=e[5];const _=y;let v;e[6]!==i||e[7]!==r||e[8]!==n?(v=(j,C)=>{b(T=>({...T,[j]:C}));const N={...n};if(C)delete N[j];else{const T=r?.[j];N[j]=T??(j==="type"?"website":"")}i(N)},e[6]=i,e[7]=r,e[8]=n,e[9]=v):v=e[9];const L=v,S="min-w-0 space-y-6",w=Rx.map(j=>{const C=d[j];if(!C)return null;const N=f&&h.includes(j),T=N&&_(j),V=T?r?.[j]??n[j]:n[j],A=C.title??ale(j);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:ie(T&&"pointer-events-none opacity-60"),children:oa({schema:C,value:V,onChange:E=>{T||i({...n,[j]:E})},path:j,label:A,required:j==="type",breadcrumbPath:[],onBreadcrumbChange:ule})}),N&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pi,{id:`seo-use-default-${j}`,checked:T,onCheckedChange:E=>L(j,E)}),o.jsx(Ot,{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]!==w?(k=o.jsx("div",{className:S,children:w},l),e[10]=l,e[11]=w,e[12]=k):k=e[12],k}function ule(){}function hle(t){const e=z.c(18),{schema:s,resolveType:n,value:i,formResetKey:r,onChange:l,onBreadcrumbChange:a,siteDefaultSeo:c}=t;if(Oj(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(dle,{schema:s,value:i,onChange:g,siteDefaultSeo:c,formResetKey:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=g,e[6]=i,e[7]=x):x=e[7],x}let h;e[8]!==n||e[9]!==s?(h=$j(s,n),e[8]=n,e[9]=s,e[10]=h):h=e[10];const u=h;let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[11]=f):f=e[11];const p=a??fle;let m;return e[12]!==u||e[13]!==r||e[14]!==l||e[15]!==p||e[16]!==i?(m=o.jsx(zi,{schema:u,value:i,onChange:l,basePath:"",breadcrumbPath:f,onBreadcrumbChange:p},r),e[12]=u,e[13]=r,e[14]=l,e[15]=p,e[16]=i,e[17]=m):m=e[17],m}function fle(){}function mle(t){const e=z.c(16),{schema:s,value:n,onChange:i,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}=t,d=re();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=P.useState(h);let p;e[1]!==u||e[2]!==d?(p=u.length>0&&o.jsxs("nav",{"aria-label":d("sectionsEditor.sectionsEditorPanels.variantRuleBreadcrumb"),className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[o.jsx("button",{type:"button",onClick:()=>f([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:d("sectionsEditor.sectionsEditorPanels.backToRule"),children:o.jsx(nf,{className:"size-3.5"})}),u.map((x,b)=>{const y=b===u.length-1,_=Nn(x);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[b>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,b+1)),title:_,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",y?"font-medium text-foreground":"text-muted-foreground"),children:_})]},`${_}-${b}`)})]}),e[1]=u,e[2]=d,e[3]=p):p=e[3];let m;e[4]!==u||e[5]!==l||e[6]!==r||e[7]!==i||e[8]!==a||e[9]!==c||e[10]!==s||e[11]!==n?(m=o.jsx(zi,{schema:s,value:n,onChange:i,basePath:"",breadcrumbPath:u,onBreadcrumbChange:f,meta:r,decofile:l,onSaveReferencedBlock:a,sandbox:c}),e[4]=u,e[5]=l,e[6]=r,e[7]=i,e[8]=a,e[9]=c,e[10]=s,e[11]=n,e[12]=m):m=e[12];let g;return e[13]!==p||e[14]!==m?(g=o.jsxs("div",{className:"space-y-2",children:[p,m]}),e[13]=p,e[14]=m,e[15]=g):g=e[15],g}function dxe(t){const e=z.c(23),{activeSchema:s,formValue:n,formResetKey:i,onFormChange:r,onBreadcrumbChange:l,breadcrumbPath:a,emptyMessage:c,beforeForm:d,seoResolveType:h,siteDefaultSeo:u,meta:f,decofile:p,onSaveReferencedBlock:m,sandbox:g,previewBaseUrl:x,onRequestAddSection:b}=t;let y;e[0]!==a?(y=a===void 0?[]:a,e[0]=a,e[1]=y):y=e[1];const _=y;let v;e[2]!==s||e[3]!==_||e[4]!==p||e[5]!==i||e[6]!==n||e[7]!==f||e[8]!==l||e[9]!==r||e[10]!==b||e[11]!==m||e[12]!==x||e[13]!==g||e[14]!==h||e[15]!==u?(v=s&&n?h?o.jsx(hle,{schema:s,resolveType:h,value:n,formResetKey:i,onChange:r,onBreadcrumbChange:l,siteDefaultSeo:u}):o.jsx(zi,{schema:s,value:n,onChange:r,basePath:"",breadcrumbPath:_,onBreadcrumbChange:l,meta:f,decofile:p,onSaveReferencedBlock:m,sandbox:g,previewBaseUrl:x,onRequestAddSection:b},i):null,e[2]=s,e[3]=_,e[4]=p,e[5]=i,e[6]=n,e[7]=f,e[8]=l,e[9]=r,e[10]=b,e[11]=m,e[12]=x,e[13]=g,e[14]=h,e[15]=u,e[16]=v):v=e[16];const L=v;let S;e[17]!==c||e[18]!==L?(S=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]=S):S=e[19];let w;return e[20]!==d||e[21]!==S?(w=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,S]})}),e[20]=d,e[21]=S,e[22]=w):w=e[22],w}const uxe="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 hxe(t,e){return yse(t,e,rd)}function fxe(t){const e=z.c(68),{pageKey:s,initialName:n,initialPath:i,onFieldChange:r}=t,l=re(),a=h1(),[c,d]=P.useState(n),[h,u]=P.useState(i),[f,p]=P.useState(s),[m,g]=P.useState(null),x=P.useRef(!1);f!==s&&(p(s),d(n),u(i),g(null));let b;e[0]!==i||e[1]!==h?(b=()=>{if(x.current){x.current=!1;return}const te=h.trim();if(te===i.trim()){u(i);return}g(te)},e[0]=i,e[1]=h,e[2]=b):b=e[2];const y=b;let _;e[3]!==r||e[4]!==m?(_=()=>{m!==null&&(u(m),r("path",m),g(null))},e[3]=r,e[4]=m,e[5]=_):_=e[5];const v=_;let L;e[6]!==i?(L=()=>{u(i),g(null)},e[6]=i,e[7]=L):L=e[7];const S=L;let w;e[8]!==r?(w=te=>{d(te.target.value),r("name",te.target.value)},e[8]=r,e[9]=w):w=e[9];let k;e[10]!==l?(k=l("sectionsEditor.sectionsEditorPanels.pageNamePlaceholder"),e[10]=l,e[11]=k):k=e[11];let j;e[12]!==c||e[13]!==a||e[14]!==w||e[15]!==k?(j=o.jsx("input",{type:"text",value:c,readOnly:a,onChange:w,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:k}),e[12]=c,e[13]=a,e[14]=w,e[15]=k,e[16]=j):j=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=te=>u(te.target.value),e[17]=C):C=e[17];let N;e[18]!==i?(N=te=>{te.key==="Enter"?(te.preventDefault(),te.currentTarget.blur()):te.key==="Escape"&&(te.preventDefault(),x.current=!0,u(i),te.currentTarget.blur())},e[18]=i,e[19]=N):N=e[19];let T;e[20]!==l?(T=l("sectionsEditor.sectionsEditorPanels.pathPlaceholder"),e[20]=l,e[21]=T):T=e[21];let V;e[22]!==y||e[23]!==h||e[24]!==a||e[25]!==N||e[26]!==T?(V=o.jsx("input",{type:"text",value:h,readOnly:a,onChange:C,onBlur:y,onKeyDown:N,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:T}),e[22]=y,e[23]=h,e[24]=a,e[25]=N,e[26]=T,e[27]=V):V=e[27];const A=m!==null;let E;e[28]!==S?(E=te=>{te||S()},e[28]=S,e[29]=E):E=e[29];let R;e[30]!==l?(R=l("sectionsEditor.sectionsEditorPanels.changePathTitle"),e[30]=l,e[31]=R):R=e[31];let D;e[32]!==R?(D=o.jsx(oo,{children:R}),e[32]=R,e[33]=D):D=e[33];const I=m??"";let O;e[34]!==i||e[35]!==l||e[36]!==I?(O=l("sectionsEditor.sectionsEditorPanels.changePathDescription",{from:i,to:I}),e[34]=i,e[35]=l,e[36]=I,e[37]=O):O=e[37];let F;e[38]!==O?(F=o.jsx(lo,{children:O}),e[38]=O,e[39]=F):F=e[39];let M;e[40]!==D||e[41]!==F?(M=o.jsxs(ro,{children:[D,F]}),e[40]=D,e[41]=F,e[42]=M):M=e[42];let $;e[43]!==l?($=l("sectionsEditor.sectionsEditorPanels.changePathCancel"),e[43]=l,e[44]=$):$=e[44];let B;e[45]!==$?(B=o.jsx(co,{children:$}),e[45]=$,e[46]=B):B=e[46];let U;e[47]!==v?(U=te=>{te.preventDefault(),v()},e[47]=v,e[48]=U):U=e[48];let H;e[49]!==l?(H=l("sectionsEditor.sectionsEditorPanels.changePathConfirm"),e[49]=l,e[50]=H):H=e[50];let W;e[51]!==U||e[52]!==H?(W=o.jsx(uo,{onClick:U,children:H}),e[51]=U,e[52]=H,e[53]=W):W=e[53];let K;e[54]!==B||e[55]!==W?(K=o.jsxs(ao,{children:[B,W]}),e[54]=B,e[55]=W,e[56]=K):K=e[56];let G;e[57]!==M||e[58]!==K?(G=o.jsxs(io,{children:[M,K]}),e[57]=M,e[58]=K,e[59]=G):G=e[59];let Y;e[60]!==A||e[61]!==E||e[62]!==G?(Y=o.jsx(no,{open:A,onOpenChange:E,children:G}),e[60]=A,e[61]=E,e[62]=G,e[63]=Y):Y=e[63];let X;return e[64]!==V||e[65]!==Y||e[66]!==j?(X=o.jsxs("div",{className:"space-y-1",children:[j,V,Y]}),e[64]=V,e[65]=Y,e[66]=j,e[67]=X):X=e[67],X}function mxe(t){const e=z.c(13),{onClick:s}=t,n=re();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(f0,{size:14}),e[2]=r):r=e[2];let l;e[3]!==s||e[4]!==i?(l=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon","aria-label":i,className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[3]=s,e[4]=i,e[5]=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(Ue,{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(He,{children:[l,c]}),e[10]=l,e[11]=c,e[12]=d):d=e[12],d}const Sv=new WeakMap;function ple(t,e){let s=Sv.get(e);s||(s=new Map,Sv.set(e,s));let n=s.get(t);return n===void 0&&(n=Bn(t,e),s.set(t,n)),n}function gle(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.__resolveType=="string"&&Array.isArray(e.variants)}function xle(t,e){return{__resolveType:e,variants:[{rule:sd(),value:structuredClone(t)},{rule:sd(),value:structuredClone(t)}]}}function ble(t){const e=t.variants;if(e.length===0)return;const s=e.find(n=>px(n.rule));return s?s.value:e[e.length-1]?.value}function vle(t){const e=[...t.variants],s=e[e.length-1],n={rule:sd(),value:s?structuredClone(s.value):void 0};return{...t,variants:[...e,n]}}function yle(t,e){if(t.variants.length<=1)return null;const s=[...t.variants];return s.splice(e,1),{...t,variants:s}}function _le(t,e){const s=[...t.variants],n=s[e];return n?(s.splice(e+1,0,structuredClone(n)),{...t,variants:s}):t}function Lle(t,e,s){return e<t?t-1:Math.min(t,s-1)}function wle(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 Sle(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,value:s},{...t,variants:n}):t}function kv(t,e,s){const n=[...t.variants],i=n[e];return i?(n[e]={...i,rule:s},{...t,variants:n}):t}const jv=new WeakMap;function kle(t){let e=jv.get(t);return e||(e=Foe(t),jv.set(t,e)),e}function Bj(t){const e=z.c(13),{multivariateResolveType:s,renderInnerField:n,...i}=t,r=re(),{value:l,onChange:a,meta:c,path:d}=i,[h,u]=P.useState(0);if(!gle(l)){let F;e[0]!==r?(F=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[0]=r,e[1]=F):F=e[1];let M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(f0,{size:14}),e[2]=M):M=e[2];let $;e[3]!==r?($=r("sectionsEditor.multivariateFieldWrapper.addVariant"),e[3]=r,e[4]=$):$=e[4];let B;return e[5]!==$?(B=o.jsx(Ue,{children:$}),e[5]=$,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(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 size-6 text-muted-foreground hover:text-foreground","aria-label":F,onClick:()=>{a(xle(l,s)),u(0)},children:M})}),B]}),n(i)]})}const f=l,p=f.variants,m=Math.min(h,p.length-1);let g;e[7]!==r?(g=(F,M)=>({index:M,label:rd(F.rule)||r("sectionsEditor.multivariateFieldWrapper.variantN",{n:String(M+1)})}),e[7]=r,e[8]=g):g=e[8];const x=p.map(g),b=p[m],y=b?.rule??{},_=y.__resolveType??"",v=b?.value,L=c?kle(c):[],S=_&&c?ple(_,c):null,{__resolveType:w,...k}=y,j=()=>{a(ble(f)),u(0)},C=()=>{const F=vle(f);a(F),u(F.variants.length-1)},N=F=>{const M=yle(f,F);M&&(a(M),u(Lle(m,F,M.variants.length)))},T=F=>{const M=_le(f,F);a(M),u(F+1)},V=(F,M)=>{const $=wle(f,F,M);a($),m===F&&u(M)},A=F=>{const M=F?Fte(F,c):{__resolveType:x3};a(kv(f,m,M))},E=F=>{const M=F,$=_?{...M,__resolveType:_}:{...M};a(kv(f,m,$))},R=F=>{a(Sle(f,m,F))},D=`${d}-${f.__resolveType}`;let I;e[9]!==r?(I=r("sectionsEditor.multivariateFieldWrapper.ruleLabel"),e[9]=r,e[10]=I):I=e[10];let O;return e[11]!==I?(O=o.jsx(Ot,{className:"text-xs text-muted-foreground",children:I}),e[11]=I,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(Ioe,{listKey:D,variants:x,selectedIndex:m,onSelect:u,onDuplicate:T,onDelete:N,onRemoveAll:j,onReorder:V,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(Hoe,{currentRt:_,currentLabel:rd(y),matchers:L,onSelect:A}),S&&o.jsx("div",{className:"pt-1",children:o.jsx(mle,{schema:S,value:k,onChange:E,meta:c,decofile:i.decofile,onSaveReferencedBlock:i.onSaveReferencedBlock,sandbox:i.sandbox},`${m}-${_}`)})]}),n({...i,value:v,onChange:R})]})]})}const jle="website/loaders/secret.ts";function ju(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 Cle(){return{__resolveType:jle,name:"",encrypted:""}}function Nle(t){const{value:e,...s}=t;return s}function gm(t){const e=z.c(53),{schema:s,value:n,onChange:i,label:r,path:l,sandbox:a}=t,c=re();if(typeof n=="string"||n==null&&!ju(n)){const C=typeof n=="string"?n:"",N=a?.virtualMcpId;let T;e[0]!==r||e[1]!==l||e[2]!==s.description||e[3]!==N?(T=o.jsx(Ks,{htmlFor:l,label:r,description:s.description,virtualMcpId:N}),e[0]=r,e[1]=l,e[2]=s.description,e[3]=N,e[4]=T):T=e[4];let V;e[5]!==c?(V=c("sectionsEditor.secretField.secretValuePlaceholder"),e[5]=c,e[6]=V):V=e[6];let A;e[7]!==i?(A=D=>i(D.target.value),e[7]=i,e[8]=A):A=e[8];let E;e[9]!==l||e[10]!==C||e[11]!==V||e[12]!==A?(E=o.jsx(gt,{id:l,type:"password",value:C,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:V,onChange:A,className:"h-10"}),e[9]=l,e[10]=C,e[11]=V,e[12]=A,e[13]=E):E=e[13];let R;return e[14]!==T||e[15]!==E?(R=o.jsxs("div",{className:"space-y-2",children:[T,E]}),e[14]=T,e[15]=E,e[16]=R):R=e[16],R}let d;e[17]!==n?(d=ju(n)?n:Cle(),e[17]=n,e[18]=d):d=e[18];const h=d,u=typeof h.name=="string"?h.name:"",f=typeof h.encrypted=="string"&&h.encrypted,p=`${l}-name`,m=a?.virtualMcpId;let g;e[19]!==r||e[20]!==s.description||e[21]!==p||e[22]!==m?(g=o.jsx(Ks,{htmlFor:p,label:r,description:s.description,virtualMcpId:m}),e[19]=r,e[20]=s.description,e[21]=p,e[22]=m,e[23]=g):g=e[23];const x=`${l}-name`;let b;e[24]!==c?(b=c("sectionsEditor.secretField.secretNamePlaceholder"),e[24]=c,e[25]=b):b=e[25];let y;e[26]!==h||e[27]!==i?(y=C=>i({...h,name:C.target.value}),e[26]=h,e[27]=i,e[28]=y):y=e[28];let _;e[29]!==u||e[30]!==x||e[31]!==b||e[32]!==y?(_=o.jsx(gt,{id:x,value:u,placeholder:b,onChange:y,className:"h-10"}),e[29]=u,e[30]=x,e[31]=b,e[32]=y,e[33]=_):_=e[33];const v=`${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 S;e[37]!==h||e[38]!==f||e[39]!==i?(S=C=>{const N=C.target.value;if(!N){i(f?Nle(h):h);return}i({...h,value:N})},e[37]=h,e[38]=f,e[39]=i,e[40]=S):S=e[40];let w;e[41]!==L||e[42]!==S||e[43]!==v?(w=o.jsx(gt,{id:v,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:L,onChange:S,className:"h-10"}),e[41]=L,e[42]=S,e[43]=v,e[44]=w):w=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]!==w||e[49]!==k||e[50]!==g||e[51]!==_?(j=o.jsxs("div",{className:"space-y-2",children:[g,_,w,k]}),e[48]=w,e[49]=k,e[50]=g,e[51]=_,e[52]=j):j=e[52],j}function Tle(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 h=d.schema;if(h&&(h.type==="array"&&l(h.items),h.properties))for(const u of Object.values(h.properties))u?.type==="array"&&l(u.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 h=d.properties??{},u=i.filter(f=>f in h).length*2+(d.titleBy?1:0);u>c&&(c=u,a=d)}return c>=2?a:void 0}function Vle(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 Ale=new Set(["__resolveType","@type"]);function Ple(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 Ele(t){if(d1(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 Cv(t){if(t.type==="array"&&t.items)return t;const e=t.items??Ele(t);return e?{...t,type:"array",items:e}:null}function Rle(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 zj(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(zi,{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 oa(t){const{schema:e,value:s}=t,n=a=>t.readOnly?o.jsx(Dne,{children:a},t.path):a;if(Ef(s)){const a=xse(s),c=Cv(e);if(a!==null&&c)return o.jsx(Sh,{...t,schema:c,value:a,onChange:d=>t.onChange(bse(s,d))},t.path)}if(Array.isArray(s)&&e.type==="block-ref"&&d1(e)){const a=Cv(e);if(a)return o.jsx(Sh,{...t,schema:a,value:s,onChange:t.onChange},t.path)}if(Array.isArray(s)&&!Ef(s)&&e.type==="block-ref"){const a=Tle(e,s)??Vle(s);if(a){const c={...e,type:"array",items:a};return o.jsx(Sh,{...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(Ple(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"},h=u=>oa({...u,schema:d});return o.jsx(Bj,{...t,multivariateResolveType:a.resolveType,renderInnerField:h},t.path)}return e.anyOfRefs?o.jsx(xv,{...t},t.path):null}if(e.type==="inline-union")return o.jsx(Loe,{...t},t.path);if(e.format==="image-uri")return n(o.jsx(coe,{...t},t.path));if(e.format==="file-uri"||e.format==="video-uri")return n(o.jsx(ooe,{...t},t.path));if(e.format==="map")return n(o.jsx(Coe,{...t},t.path));if(e.format==="icon-select"||e.format==="dynamic-options"&&e.options)return n(o.jsx(Rre,{...t},t.path));if(e.format==="location")return n(o.jsx(Vj,{...t},t.path));if(e.enum&&e.enum.length>0)return n(o.jsx(vie,{...t},t.path));if(e.type==="anyOf")return o.jsx(xv,{...t},t.path);if(ju(s)||e.format==="password"||s==null&&e.format==="password")return o.jsx(gm,{...t},t.path);if(!e.format&&!e.enum){const a=zj(t);if(a)return a}const i=s??Rle(e.type,e.default);if(i==null)return ju(s)?n(o.jsx(gm,{...t},t.path)):null;if(ju(i))return n(o.jsx(gm,{...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(Sh,{...r},t.path);switch(l){case"boolean":return n(o.jsx(mie,{...r},t.path));case"number":case"integer":return n(o.jsx(fie,{...r},t.path));case"string":{const a=e.format;return n(a==="color-input"||a==="color"?o.jsx(Lh,{...r},t.path):a==="textarea"||a==="rich-text"||a==="html"?o.jsx(Lh,{...r},t.path):o.jsx(Lh,{...r},t.path))}case"object":return i!==null&&typeof i=="object"&&!Array.isArray(i)?o.jsx(gre,{...r},t.path):null;default:return n(o.jsx(Lh,{...r},t.path))}}function Dle(t,e){if(e&&(e.type==="block-ref"||e.anyOfRefs||e.properties))return oa({...t,schema:e});const s=zj(t);return s||oa(e?{...t,schema:e}:t)}function zi({schema:t,value:e,onChange:s,basePath:n,breadcrumbPath:i=[],onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f}){const p=re(),m=h1(),g=t.properties;if(!g)return t.type==="inline-union"?oa({schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,readOnly:m}):null;if(gse(e)&&g.variants){const V=g.variants.items?.properties?.value;return o.jsx(Bj,{schema:t,value:e,onChange:s,path:n,label:t.title??"",breadcrumbPath:i,onBreadcrumbChange:r,meta:l,decofile:a,onSaveReferencedBlock:c,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f,multivariateResolveType:e.__resolveType,renderInnerField:A=>Dle(A,V)},n)}const x=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},b=Object.keys(g).filter(V=>!Ale.has(V)&&g[V]?.hidden!==!0),y=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:p("sectionsEditor.sectionsEditor.noEditableFields")});const _=(V,A)=>{if(A===void 0){const{[V]:E,...R}=x;s(R);return}s({...x,[V]:A})},v=typeof x.__resolveType=="string"?x.__resolveType:void 0,L=b.filter(V=>{const A=g[V];return A!=null&&Wc(A,x[V])}).length>1,S=Yie(b,g,x),w=i.length>0?Qie(b,g,x,i,a,l):null,k=w?g[w]:null,j=w&&k?[w]:b,C=w&&k?Gie(w,k,i,Xu(w,b,g)):i,N=qie(i,C),T=N.length>0&&r?V=>r([...N,...V]):r;return o.jsx("div",{className:"min-w-0 space-y-6",children:j.map(V=>{const A=g[V];if(!A)return null;const E=n?`${n}.${V}`:V,R=Xu(V,b,g),D=ra(V,A),F=(N.length===0&&b.some(M=>{const $=g[M];return M!==V&&$!=null&&ra(M,$)===D})||N.length===0&&S.has(V))&&T?A.type==="block-ref"?M=>T(Kie(V,M)):M=>T(Hie(R,M)):T;return oa({schema:A,value:x[V],onChange:M=>_(V,M),path:E,label:R,readOnly:m,required:y.has(V),breadcrumbPath:C,onBreadcrumbChange:F,hasSiblingDrillDownFields:L,focused:w===V,meta:l,decofile:a,onSaveReferencedBlock:c,containerResolveType:v,previewBaseUrl:d,onAddSectionItem:h,onRequestAddSection:u,sandbox:f})})})}function Ile(t){const e=z.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(ct,{size:13,className:"animate-spin"}),"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(Kt,{size:13}),"Saved"]}),e[2]=i):i=e[2],i}const Nv=3e4;function Mle(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 Ole(t,{resolveType:e,props:s}){let n;try{n=await fetch(X_(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...s}),signal:AbortSignal.timeout(Nv)})}catch(a){throw a instanceof DOMException&&a.name==="TimeoutError"?new Error(`Run timed out after ${Nv/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 $le(t){const e=z.c(2);let s;return e[0]!==t?(s={mutationFn:n=>Ole(t,n)},e[0]=t,e[1]=s):s=e[1],Vs(s)}function Fj({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,kind:l,target:a,initialValue:c,isCreating:d,onCreate:h,onSaveReferencedBlock:u,onBack:f,showRun:p=!0}){const m=xs()?.taskId??null,g=re(),x=_o(),b=x?.entity?.id===e?x.entity.metadata?.siteSlug??null:null,y=Bn(a.resolveType,i),_=!y&&dz(a.resolveType,i),v=_?uz(c):null,L=y??v,[S,w]=P.useState(c),[k,j]=P.useState([]),[C,N]=P.useState(0),[T,V]=P.useState(!1),[A,E]=P.useState(null),[R,D]=P.useState(!1),[I,O]=P.useState(!1),[F,M]=P.useState(!1),$=A!==null,{save:B,flush:U,isPending:H}=mx({orgSlug:t,virtualMcpId:e,branch:s}),W=$le({orgSlug:t,virtualMcpId:e,branch:s,threadId:m});P.useEffect(()=>()=>{U()},[]);const K=Ok(l),G=a.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??a.resolveType,Y={orgSlug:t,virtualMcpId:e,branch:s,threadId:m,previewUrl:n??void 0,siteSlug:b},X=oe=>{w(oe),a.mode==="saved"&&B(a.blockKey,{__resolveType:a.resolveType,...oe})},te=()=>{$?(E(null),V(!1),N(oe=>oe+1)):E(JSON.stringify(S,null,2))},se=oe=>{const ee=oe??"";try{const he=JSON.parse(ee);if(he&&typeof he=="object"&&!Array.isArray(he)){V(!1),X(he);return}V(!0)}catch{V(!0)}},ne=async oe=>{const ee=Cx(oe,r);if(ee){ve.error(ee);return}await h(oe,{__resolveType:a.resolveType,...S}),D(!1)},Q=()=>{O(!0),W.mutate({resolveType:a.resolveType,props:S})},q=()=>{n&&window.open(Mle(n,a.resolveType,S,Date.now()),"_blank","noopener")},le=[a.title,...k],J=oe=>{j(k.slice(0,oe)),N(ee=>ee+1)};return o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[f&&o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:f,"aria-label":g("sandbox.runnableBlockEditor.backToList"),children:o.jsx(y9,{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:le.map((oe,ee)=>{const he=ee===le.length-1,ae=Nn(oe);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[ee>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>J(ee),title:ae,className:ie("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:ae})]},`${ae}-${ee}`)})}),a.mode==="saved"&&o.jsx(Ile,{isPending:H,isError:!1}),p&&o.jsxs(me,{size:"sm",variant:"outline",className:"h-8 shrink-0 gap-1.5",onClick:Q,disabled:W.isPending,"aria-label":g("sandbox.runnableBlockEditor.runAriaLabel",{singular:K}),children:[W.isPending?o.jsx(ct,{size:14,className:"animate-spin"}):o.jsx(ql,{size:14}),g("sandbox.runnableBlockEditor.run")]}),a.mode==="available"&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:d,onClick:()=>D(!0),"aria-label":g("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:K}),children:o.jsx(ug,{size:14})})}),o.jsx(Ue,{side:"bottom",children:g("sandbox.runnableBlockEditor.saveAsGlobal",{singular:K})})]}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:$?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:te,"aria-label":g($?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":$,children:$?o.jsx(Is,{size:14}):o.jsx(ga,{size:14})})}),o.jsx(Ue,{side:"bottom",children:g($?"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:G,singular:K})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[o.jsxs("div",{className:ie("relative min-h-0 flex-1",I&&F&&"hidden"),children:[o.jsx(yl,{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:[v&&L===v&&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(zi,{schema:L,value:S,onChange:oe=>X(oe),basePath:"",breadcrumbPath:k,onBreadcrumbChange:j,meta:i,decofile:r,onSaveReferencedBlock:u,sandbox:Y},C):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:_?g("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:K}):g("sandbox.runnableBlockEditor.noInputEmptyState",{singular:K})})]})})}),A!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[T&&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(bd,{language:"json",height:"100%",code:A,onChange:se,onSave:oe=>{se(oe),U()}})})]})]}),I&&o.jsx(Ble,{singular:K,result:{isPending:W.isPending,error:W.error,data:W.data,hasRun:W.status!=="idle"},expanded:F,onToggleExpand:()=>M(oe=>!oe),onOpenInNewTab:n?q:void 0,onClose:()=>{O(!1),M(!1)}})]}),o.jsx(Nx,{open:R,onOpenChange:D,defaultBlockId:"",isPending:d,onSubmit:ne})]})}function Ble(t){const e=z.c(54),{singular:s,result:n,expanded:i,onToggleExpand:r,onOpenInNewTab:l,onClose:a}=t,c=re();let d;e[0]!==n.data?(d=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=d):d=e[1];const h=d,u=i?"flex-1":"h-[45%] shrink-0";let f;e[2]!==u?(f=ie("flex min-h-0 flex-col border-t",u),e[2]=u,e[3]=f):f=e[3];let p;e[4]!==c?(p=c("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=c,e[5]=p):p=e[5];let m;e[6]!==p?(m=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:p}),e[6]=p,e[7]=m):m=e[7];let g;e[8]!==l||e[9]!==s||e[10]!==c?(g=l&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:l,"aria-label":c("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:o.jsx(un,{size:14})})}),o.jsx(Ue,{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(BA,{size:14}):o.jsx(L8,{size:14}),e[15]=i,e[16]=b):b=e[16];let y;e[17]!==i||e[18]!==r||e[19]!==x||e[20]!==b?(y=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:r,"aria-label":x,"aria-pressed":i,children:b})}),e[17]=i,e[18]=r,e[19]=x,e[20]=b,e[21]=y):y=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 v;e[25]!==_?(v=o.jsx(Ue,{side:"bottom",children:_}),e[25]=_,e[26]=v):v=e[26];let L;e[27]!==v||e[28]!==y?(L=o.jsxs(He,{children:[y,v]}),e[27]=v,e[28]=y,e[29]=L):L=e[29];let S;e[30]!==c?(S=c("sandbox.runnableBlockEditor.closeResult"),e[30]=c,e[31]=S):S=e[31];let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Is,{size:14}),e[32]=w):w=e[32];let k;e[33]!==a||e[34]!==S?(k=o.jsx(me,{variant:"ghost",size:"icon",className:"size-7",onClick:a,"aria-label":S,children:w}),e[33]=a,e[34]=S,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]!==m?(C=o.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[m,j]}),e[40]=j,e[41]=m,e[42]=C):C=e[42];let N;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==h||e[47]!==s||e[48]!==c?(N=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(ct,{size:16,className:"animate-spin"}),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(bd,{language:"json",height:"100%",code:h,readOnly:!0}):o.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:c("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:s})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=h,e[47]=s,e[48]=c,e[49]=N):N=e[49];let T;return e[50]!==C||e[51]!==N||e[52]!==f?(T=o.jsxs("div",{className:f,children:[C,N]}),e[50]=C,e[51]=N,e[52]=f,e[53]=T):T=e[53],T}function zle(t){const e=z.c(29),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,blockKey:c}=t,d=re();let h;e[0]!==i||e[1]!==s||e[2]!==n?(h={orgSlug:s,virtualMcpId:n,branch:i},e[0]=i,e[1]=s,e[2]=n,e[3]=h):h=e[3];const u=D0(h);let f;e[4]!==u?(f=yx((L,S)=>u.mutate({blockKey:L,data:S})),e[4]=u,e[5]=f):f=e[5];const p=f;let m;e[6]!==c||e[7]!==a?(m=Uk(a,c),e[6]=c,e[7]=a,e[8]=m):m=e[8];const{resolveType:g,props:x,title:b}=m;if(!g){let L;e[9]!==d?(L=d("sandbox.preview.loaderNoLongerExists"),e[9]=d,e[10]=L):L=e[10];let S;return e[11]!==L?(S=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]=S):S=e[12],S}const y=`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 v;return e[17]!==i||e[18]!==a||e[19]!==l||e[20]!==s||e[21]!==r||e[22]!==x||e[23]!==u.isPending||e[24]!==p||e[25]!==y||e[26]!==_||e[27]!==n?(v=o.jsx(Fj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:"loaders",target:_,initialValue:x,isCreating:u.isPending,onCreate:Fle,onSaveReferencedBlock:p,showRun:!1},y),e[17]=i,e[18]=a,e[19]=l,e[20]=s,e[21]=r,e[22]=x,e[23]=u.isPending,e[24]=p,e[25]=y,e[26]=_,e[27]=n,e[28]=v):v=e[28],v}async function Fle(){}const Ule="https://github.com/decocms/blocks";function Hle(){const t=z.c(14),e=re();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(zA,{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(un,{size:14}),t[7]=l):l=t[7];let a;t[8]!==r?(a=o.jsx(me,{size:"sm",asChild:!0,children:o.jsxs("a",{href:Ule,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(al,{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 Kle(t){const e=z.c(15),{source:s,onRetry:n}=t,i=re();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 h;e[8]!==n||e[9]!==d?(h=o.jsx(me,{variant:"outline",size:"sm",onClick:n,children:d}),e[8]=n,e[9]=d,e[10]=h):h=e[10];let u;return e[11]!==l||e[12]!==c||e[13]!==h?(u=o.jsx(al,{image:a,title:c,description:l,actions:h}),e[11]=l,e[12]=c,e[13]=h,e[14]=u):u=e[14],u}function fr(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Wle=P.lazy(()=>$s(()=>import("./sections-editor-DUyabDLF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor})));function Tv(t){const e=z.c(59),{virtualMcpId:s,externalSelection:n,onViewJsonFile:i}=t,r=n===void 0?null:n,{org:l}=Be(),{currentBranch:a,taskId:c}=rn(),d=bs(s),h=Jg(d,a);let u;e[0]!==h||e[1]!==d?(u=vd(d)&&h,e[0]=h,e[1]=d,e[2]=u):u=e[2];const f=u,p=Zn(),m=Ll(),g=Wk(),x=p.lifecycle.phase==="running",b=m.previewUrl;let y;e[3]!==a||e[4]!==l||e[5]!==b||e[6]!==c||e[7]!==s?(y=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]=y):y=e[8];const _=y;let v;e[9]!==x?(v={fetchEnabled:x},e[9]=x,e[10]=v):v=e[10];const L=k0(_,v);let S;e[11]!==x?(S={fetchEnabled:x},e[11]=x,e[12]=S):S=e[12];const w=B9(_,S),k=gk({lifecyclePhase:p.lifecycle.phase,decofile:Af(L),meta:Af(w),hasEditableContent:U9(L.data,w.data),fastPreviewActive:En(s).runtime==="cms"});if(k.kind==="loading"){let H;return e[13]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(fr,{}),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(Hle,{}),e[14]=H):H=e[14],H}if(k.kind==="error"){let H;e[15]!==L||e[16]!==m||e[17]!==w||e[18]!==k.source?(H=()=>{if(k.source==="sandbox"){m.retry();return}Promise.all([L.refetch(),w.refetch()])},e[15]=L,e[16]=m,e[17]=w,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(Kle,{source:k.source,onRetry:W}),e[20]=W,e[21]=k.source,e[22]=K):K=e[22],K}let j;e[23]!==f?(j=H=>o.jsx("div",{"data-testid":"blocks-panel",className:"h-full min-h-0 overflow-hidden",children:o.jsx(Gk,{readOnly:f,className:"h-full min-h-0",children:H})}),e[23]=f,e[24]=j):j=e[24];const C=j,N=g.state.target;if(N?.kind==="loader"&&L.data&&w.data){const H=a??"",W=b??null;let K;e[25]!==L.data||e[26]!==w.data||e[27]!==l.slug||e[28]!==H||e[29]!==W||e[30]!==N.key||e[31]!==s?(K=o.jsx(zle,{orgSlug:l.slug,virtualMcpId:s,branch:H,previewUrl:W,meta:w.data,decofile:L.data,blockKey:N.key}),e[25]=L.data,e[26]=w.data,e[27]=l.slug,e[28]=H,e[29]=W,e[30]=N.key,e[31]=s,e[32]=K):K=e[32];let G;return e[33]!==C||e[34]!==K?(G=C(K),e[33]=C,e[34]=K,e[35]=G):G=e[35],G}let T;e[36]!==a||e[37]!==l.slug||e[38]!==N||e[39]!==s?(T=N||!a?null:xx(gx(l.slug,s,a)),e[36]=a,e[37]=l.slug,e[38]=N,e[39]=s,e[40]=T):T=e[40];const V=T;let A="/",E=null,R=null;N?.kind==="page"?(A=N.path,E=N.key):N?.kind==="section"?R=N.key:V&&(A=V.path,E=V.pageKey);const D=E?`page:${E}`:R?`section:${R}`:`path:${A}`;let I;e[41]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})}),e[41]=I):I=e[41];const O=a??"",F=b??void 0,M=R?null:r,$=!!E&&g.state.editSeoPageKey===E;let B;e[42]!==R||e[43]!==E||e[44]!==A||e[45]!==D||e[46]!==i||e[47]!==l.slug||e[48]!==F||e[49]!==M||e[50]!==$||e[51]!==O||e[52]!==s||e[53]!==g.consumeEditSeo||e[54]!==g.setVariantOverride?(B=o.jsx(P.Suspense,{fallback:I,children:o.jsx(Wle,{orgSlug:l.slug,virtualMcpId:s,branch:O,previewReady:!0,previewUrl:F,currentPath:A,activePageBlockKey:E,activeGlobalBlockKey:R,externalSelection:M,initialEditSeo:$,onExitSeo:g.consumeEditSeo,onVariantPreviewOverride:g.setVariantOverride,onViewJsonFile:i},D)}),e[42]=R,e[43]=E,e[44]=A,e[45]=D,e[46]=i,e[47]=l.slug,e[48]=F,e[49]=M,e[50]=$,e[51]=O,e[52]=s,e[53]=g.consumeEditSeo,e[54]=g.setVariantOverride,e[55]=B):B=e[55];let U;return e[56]!==C||e[57]!==B?(U=C(B),e[56]=C,e[57]=B,e[58]=U):U=e[58],U}function Vv(t){const e=z.c(44),{virtualMcpId:s,pageKey:n,onClose:i,ref:r}=t,l=re(),{org:a}=Be(),{currentBranch:c,taskId:d}=rn(),u=Ll().previewUrl;let f;e[0]!==c||e[1]!==a.slug||e[2]!==u||e[3]!==d||e[4]!==s?(f=c?{orgSlug:a.slug,virtualMcpId:s,branch:c,threadId:d??null,previewUrl:u}:null,e[0]=c,e[1]=a.slug,e[2]=u,e[3]=d,e[4]=s,e[5]=f):f=e[5];const m=k0(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:y}=mx(x),_=m.data?.[n],v=m.data===void 0&&m.isLoading,L=m.data!==void 0&&_===void 0,S=!c||L||v;let w;e[10]!==_?(w=_===void 0?"":JSON.stringify(_,null,2),e[10]=_,e[11]=w):w=e[11];const k=w;let j;e[12]!==n||e[13]!==S||e[14]!==b?(j=F=>{if(S)return;let M;try{M=JSON.parse(F)}catch{return}M===null||typeof M!="object"||Array.isArray(M)||b(n,M)},e[12]=n,e[13]=S,e[14]=b,e[15]=j):j=e[15];const C=j;let N;e[16]!==y?(N=()=>({flush:y}),e[16]=y,e[17]=N):N=e[17],P.useImperativeHandle(r,N);let T;e[18]!==l?(T=l("sectionsEditor.pageJsonDialog.titleShort"),e[18]=l,e[19]=T):T=e[19];let V;e[20]!==T?(V=o.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:T}),e[20]=T,e[21]=V):V=e[21];let A;e[22]!==l?(A=l("sectionsEditor.pageJsonDialog.close"),e[22]=l,e[23]=A):A=e[23];let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Is,{size:14}),e[24]=E):E=e[24];let R;e[25]!==i||e[26]!==A?(R=o.jsx(me,{variant:"ghost",size:"icon",onClick:i,"aria-label":A,className:"size-7 shrink-0",children:E}),e[25]=i,e[26]=A,e[27]=R):R=e[27];let D;e[28]!==R||e[29]!==V?(D=o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2.5",children:[V,R]}),e[28]=R,e[29]=V,e[30]=D):D=e[30];let I;e[31]!==m.data||e[32]!==y||e[33]!==k||e[34]!==v||e[35]!==L||e[36]!==n||e[37]!==S||e[38]!==C||e[39]!==l?(I=v?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin 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(bd,{code:k,language:"json",readOnly:S,height:"100%",onChange:F=>C(F??""),onSave:F=>{C(F),y()}},`${n}:${m.data===void 0?"loading":"ready"}`)}),e[31]=m.data,e[32]=y,e[33]=k,e[34]=v,e[35]=L,e[36]=n,e[37]=S,e[38]=C,e[39]=l,e[40]=I):I=e[40];let O;return e[41]!==D||e[42]!==I?(O=o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-background",children:[D,I]}),e[41]=D,e[42]=I,e[43]=O):O=e[43],O}function qle(t,e){return t===e?"preview":e}function Gle(t){return t.autoOpen&&t.blocksReady&&!t.autoOpenResolved&&t.editingMode==="preview"}const Yle=500,Jle={mobile:{width:412,height:823},tablet:{width:1024,height:1366},desktop:{width:1280,height:800}},Av=1,xm=["desktop","mobile","tablet"],Pv={mobile:"sandbox.preview.deviceMobile",tablet:"sandbox.preview.deviceTablet",desktop:"sandbox.preview.deviceDesktop"};function Ev(t,e){try{const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}catch{return t}}function Qle(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 jh(t){if(!t)return null;try{return new URL(t,window.location.href).origin}catch{return null}}function bm(t,e){try{return new URL(t,e).href}catch{return null}}function Xle(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 h=40;return d===0?h+=30:/[\s/-]/.test(c[d-1]??"")&&(h+=20),h+=Math.round(s.length/c.length*20),h};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 Zle(t){const{onOpen:e}=t,[s,n]=P.useState(!1);return s||(n(!0),queueMicrotask(e)),null}function eae(t,e){try{t.contentWindow?.location.reload()}catch{e&&(t.src=e)}}function tae({virtualMcpId:t}){const e=re(),s=u0(),n=gl(),i=Dte(),{openPanel:r}=bi(),{currentBranch:l,taskId:a}=rn(),c=Wk(),d=ye=>r(ye),[h,u]=P.useState("preview"),[f,p]=P.useState(!1),[m,g]=P.useState("desktop"),[x,b]=P.useState(null),[y,_]=P.useState(null),v=P.useRef(null),L=P.useRef(null),[S,w]=P.useState(!1),k=P.useRef(null),j=()=>{k.current?.flush(),w(!1)},C=()=>w(ye=>(ye&&k.current?.flush(),!ye)),[N,T]=P.useState({width:0,height:0}),[V,A]=P.useState(null),[E,R]=P.useState(!1),[D,I]=P.useState(""),O=P.useRef(null),[F,M]=P.useState(!1),[$,B]=P.useState(),[U,H]=P.useState(null),[W,K]=P.useState(null),[G,Y]=P.useState(null),[X,te]=P.useState("/"),[se,ne]=P.useState(null),[Q,q]=P.useState({}),[le,J]=P.useState(!1),oe=P.useRef(null),ee=()=>{J(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>J(!1),15e3)},he=()=>{oe.current&&(clearTimeout(oe.current),oe.current=null),J(!1)},{org:ae}=Be(),de=Zn(),ue=Ll(),pe=ue.vmEntry,Z=ue.previewUrl,ge=de.lifecycle.phase,be=ge==="running",ke=s;Hk({orgSlug:ae.slug,virtualMcpId:t??"",branch:l??"",threadId:a??null,enabled:ke});const we=null,Le=_o(),_e=Le?.entity?.id===t?rg(Le.entity.metadata):null,Ce=En(t),xe=Le?.entity?.id===t&&Ce.runtime==="cms",Ne=Ce.projectDefault==="cms",Te=Yte({sandboxUrl:Z,previewServerUrl:_e,fastPreviewActive:xe}),Me=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,threadId:a??null,previewUrl:Z}:null,Qe=k0(Me,{fetchEnabled:be}),We=B9(Me,{fetchEnabled:be}),Ve=Qe.data,De=We.data,ot=`${t}:${l??""}`,[st,Ze]=P.useState(null),lt=gk({lifecyclePhase:ge,decofile:Af(Qe),meta:Af(We),hasEditableContent:U9(Ve,De),fastPreviewActive:xe,frameworkKnownMissing:st===ot});lt.kind==="empty"&&lt.reason==="framework-missing"&&st!==ot&&Ze(ot);const _t=lt.kind==="content",it=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l}:null,at=tse(it),Ie=Ve?pf(Ve).sort((ye,Pe)=>ye.name.localeCompare(Pe.name)):[],xt=Ve&&De?S3(Ve,De):[],fe=Ve&&De?Fk(De,Ve,"loaders"):[],Oe=il,tt=D?(()=>{const ye=D.toLowerCase();return Ie.map(Pe=>({page:Pe,score:Xle(Pe.name,Pe.path,ye)})).filter(({score:Pe})=>Pe>0).sort((Pe,ut)=>ut.score-Pe.score||Pe.page.path.length-ut.page.path.length).map(({page:Pe})=>Pe)})():Ie,ht=xt.filter(ye=>{if(!D)return!0;const Pe=D.toLowerCase();return ye.name.toLowerCase().includes(Pe)||ye.key.toLowerCase().includes(Pe)||ye.resolveType.toLowerCase().includes(Pe)}),dt=fe.filter(ye=>{if(!D)return!0;const Pe=D.toLowerCase();return ye.title.toLowerCase().includes(Pe)||ye.key.toLowerCase().includes(Pe)||ye.resolveType.toLowerCase().includes(Pe)}),Vt=W?fe.find(ye=>ye.key===W)??null:null,rt=U||W?null:gp(Ie,X,se),bt=U?U.name:Vt?.title??rt?.name,et=rt?.key??null,yt=rt?.path??null,ft=(et?Q[et]:void 0)??{},nt=Ur(X,ft),vt={};if(be&&Z&&De&&Ve){const ye=Nne(De,"loaders"),Pe=et?Ve[et]:void 0,ut=Xse(Pe,Ve,ds=>ye.has(ds)),wt=qse(ut);for(const ds of uf(X)){if(ds.type!=="param")continue;const pn=Hse(X,ds.name,ut),Qs=Jse(pn,ye,wt);Qs.length>0&&(vt[ds.name]=Qs)}}const mt=t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,threadId:a??null}:null,Lt=Ve&&et?Ck(Ve,et,0):[],Mt=Ve?Lk(Lt,Ve):[],ce=Mt.map(ye=>ye.isSavedBlock?ye.label:""),Se=Mt.map(ye=>ye.isSavedBlock?"global":ye.isMultivariate?"variant":"normal"),Ee=Lt.map(ye=>Kp(ye,Ve??{})),je=P.useRef(null),Xe=P.useRef(null),Ke=de.status.state==="paused",vs=de.phase,fn=Ak({claimPhase:vs,lifecycle:de.lifecycle}),At=ue.previewState,yi=ue.userStopped,Un=b0(Le?.entity?.id===t?Le.entity.metadata?.ui?.layout??null:null),Lo=hx(ae.slug,t??"",l??""),{url:mn}=vk(xe&&t&&l?{orgSlug:ae.slug,virtualMcpId:t,branch:l,previewServerUrl:_e??null,path:nt}:null),wo=Ne&&Ce.runtime==="sandbox",St=wte({previewState:At,progressStatus:fn.status,previewServerUrl:_e,fastPreviewActive:xe,fastPreviewReady:!!mn,codingSession:wo}),ei=St.mode!=="none",Sr=St.mode==="production"&&St.iframeBase?jh(St.iframeBase):null,So=!s,ti=St.mode==="production"?Sr:jh(Z),ko=Le?.entity?.id===t&&Le.entity.metadata?.fastPreviewInPlace===!0,Ln=St.mode==="production"&&xe&&ko&&h==="blocks",kr=P.useRef(null);Ln||(kr.current=mn);const Fi=kr.current,jo=Ln?Fi??mn:mn,Bs=Qle(St.mode==="sandbox"?gh(Ev(G??bm(nt,St.iframeBase)??St.iframeBase,m),c.state.variantOverride??[]):St.mode==="production"&&So?gh(Ev(bk(G??jo??bm(nt,St.iframeBase)??St.iframeBase,St.showWakingPill?qte:null),m),c.state.variantOverride??[]):null);P.useEffect(()=>{},[s,Sr,V]);const jr="sandbox.preview.openInNewTab",Ta=mn??(St.iframeBase?bm(nt,St.iframeBase):null),Co=St.mode==="production"?Ta?gh(Ta,c.state.variantOverride??[]):null:Bs??St.iframeBase,No=async()=>{const ye=Co;if(ye){window.open(ye,"_blank","noopener");return}},Cr=t&&l?gx(ae.slug,t,l):null,_i=ye=>{Cr&&zse(Cr,ye)},ys=c.state.target;P.useEffect(()=>{if(!(!ys||!Te||!De))if(ys.kind==="page"){const ye=Q[ys.key]??{};Xe.current=Ur(ys.path,ye),H(null),K(null),Y(null),ne(ys.key),te(ys.path),_i({path:ys.path,pageKey:ys.key,params:ye})}else if(ys.kind==="loader")Xe.current=null,H(null),K(ys.key),Y(null);else{const ye=xt.find(Pe=>Pe.key===ys.key);if(ye){Xe.current=null;const Pe=hf(De);K(null),H(ye),Y(Yb(Te,Pe,ye.key))}}},[ys,Te,De,Q]),P.useEffect(()=>{!et||yt===null||ys?.kind==="page"&&ys.key===et&&ys.path===yt||c.selectTarget({kind:"page",key:et,path:yt})},[et,yt,ys]);const[Va,To]=P.useState(null);if(At.kind==="iframe"&&Va!==At.previewUrl){const ye=Va!==null;To(At.previewUrl);const Pe=Cr?xx(Cr):null;if(Pe){if(Xe.current=Ur(Pe.path,Pe.params),te(Pe.path),ne(Pe.pageKey),Y(null),H(null),K(null),Pe.pageKey&&Object.keys(Pe.params).length>0){const ut=Pe.pageKey;q(wt=>({...wt,[ut]:Pe.params}))}}else ye&&(Xe.current=null,te("/"),Y(null),ne(null),H(null),K(null))}je.current=Bs;const Nr=Cte({iframeRef:v,src:St.mode==="sandbox"?Bs:null,active:St.mode==="sandbox"}),Tr=P.useRef(null);P.useEffect(()=>{if(!mn||!Bs||Tr.current===mn)return;Tr.current=mn;const ye=v.current;ye&&ye.getAttribute("src")!==Bs&&(ee(),ye.src=Bs)},[mn,Bs]);const Vr=()=>{const ye=v.current?.contentWindow,Pe=ti;if(!ye||!Pe||!Ve||!et)return;const ut=Ve[et];if(!ut||typeof ut!="object")return;const wt=Gte({previewBaseUrl:Pe,pageBlock:ut,decofile:Ve,path:nt,pathTemplate:X});if(!wt)return;const ds=gh(wt.src,c.state.variantOverride??[]);ye.postMessage({type:"cms-editor::render",src:ds,body:wt.body},Pe)},Li=P.useRef(null);P.useEffect(()=>{if(!Ln||U||W||!et||!Ve){Li.current=null;return}const ye=JSON.stringify({page:et,path:nt,pathTemplate:X,decofile:Ve});if(Li.current===ye)return;const Pe=Li.current===null;Li.current=ye,!Pe&&Vr()},[Ve,Ln,U,W,et,nt,X]);const Ui=P.useRef(null);P.useEffect(()=>{if(!Ln||U||W||!et||!Ve){Ui.current=null;return}const ye=JSON.stringify(c.state.variantOverride??null),Pe=Ui.current;Ui.current={page:et,sig:ye},!(!Pe||Pe.page!==et||Pe.sig===ye)&&Vr()},[c.state.variantOverride,Ln,U,W,et]);const Vo=!!t&&!!l&&!de.notFound&&!yi&&!Ke&&(vs?.kind==="ready"||ge!=="idle"),wn=St.mode!=="sandbox"&&h==="visual"?"preview":h;P.useEffect(()=>{const ye=ti;if(!ye)return;const Pe=ut=>{if(ut.origin===ye)if(ut.data?.type==="visual-editor::element-clicked"){const wt=ise.safeParse(ut.data.payload);wt.success&&b(wt.data)}else if(ut.data?.type==="cms-editor::section-clicked"){const wt=lse.safeParse(ut.data.payload);wt.success&&_({index:wt.data.sectionIndex,seq:wt.data.clickSeq})}else ut.data?.type==="cms-editor::render-start"?ee():(ut.data?.type==="cms-editor::render-end"||ut.data?.type==="cms-editor::render-error")&&he()};return window.addEventListener("message",Pe),()=>window.removeEventListener("message",Pe)},[ti]),P.useEffect(()=>{if(!E)return;const ye=Pe=>{O.current?.contains(Pe.target)||(R(!1),I(""))};return document.addEventListener("pointerdown",ye),()=>document.removeEventListener("pointerdown",ye)},[E]);const Ar=()=>{const ye=v.current?.contentWindow,Pe=jh(Z);!ye||!Pe||ye.postMessage({type:"visual-editor::activate",script:rse},Pe)},S1=()=>{const ye=v.current?.contentWindow,Pe=jh(Z);!ye||!Pe||ye.postMessage({type:"visual-editor::deactivate"},Pe)},Hi=()=>{const ye=v.current?.contentWindow,Pe=ti;!ye||!Pe||(ye.postMessage(St.mode==="production"?{type:"editor::inject",args:{script:Xb}}:{type:"visual-editor::activate",script:Xb},Pe),ye.postMessage({type:"cms-editor::set-labels",labels:ce,kinds:Se,keys:Ee},Pe))},Ed=()=>{const ye=v.current?.contentWindow,Pe=ti;!ye||!Pe||ye.postMessage({type:"cms-editor::deactivate"},Pe)},si=ye=>{const Pe=h;!n&&ye!==Pe&&(ye==="blocks"?L.current?.resize("30%"):L.current?.collapse()),ye!=="blocks"&&j(),u(ye),b(null),_(null),ye!=="blocks"&&K(null),Pe==="visual"&&S1(),ye==="visual"&&Ar(),Pe==="blocks"&&ye!=="blocks"&&Ed(),ye==="blocks"&&Hi()},Pr=ye=>{p(!0),si(qle(h,ye))},Ao=Gle({autoOpen:Un==="auto",blocksReady:_t,autoOpenResolved:f,editingMode:h}),Po=()=>{p(!0),si("blocks")},Eo=()=>{if(!v.current||!Bs)return;ee();const ye=v.current;ye.src=Bs};Iz(()=>{const ye=v.current;if(!ye)return;ee();const Pe=document.activeElement,ut=ye.tabIndex;ye.tabIndex=-1,ye.style.pointerEvents="none",ye.blur(),eae(ye,je.current);let wt;const ds=()=>{clearTimeout(wt),ye.tabIndex=ut,ye.style.pointerEvents="";const pn=document.activeElement;(!pn||pn===document.body||pn===ye)&&Pe?.focus(),ye.removeEventListener("load",ds)};ye.addEventListener("load",ds),wt=setTimeout(ds,3e3)});const Ro=()=>{const ye=xm.indexOf(m);g(xm[(ye+1)%xm.length])},Do=async()=>{let ye=null;try{ye=v.current?.contentWindow?.location?.href??null}catch{}const Pe=ye??Bs??Z;if(Pe)try{await navigator.clipboard.writeText(Pe),ve.success(e("sandbox.preview.urlCopiedToClipboard"))}catch{ve.error(e("sandbox.preview.failedToCopyUrl"))}},Io=Nte({iframeBase:St.iframeBase,resolvedPath:nt,activeGlobalSectionName:U?.name??null,noServerLabel:e("sandbox.preview.noServerRunning")}),Cl=ye=>{const Pe=Q[ye.key]??{},ut=Ur(ye.path,Pe);(U||Oe(ut)!==Oe(nt))&&ee(),Xe.current=ut,H(null),K(null),Y(null),_(null),ne(ye.key),te(ye.path),_i({path:ye.path,pageKey:ye.key,params:Pe}),c.selectTarget({kind:"page",key:ye.key,path:ye.path})},Ki=(ye,Pe)=>{if(!et)return;const ut=et,wt={...ft,[ye]:Pe};Xe.current=Ur(X,wt),q(ds=>({...ds,[ut]:wt})),_i({path:X,pageKey:ut,params:wt})},Rd=ye=>{if(!Te||!De){ve.error(e("sandbox.preview.previewMetadataNotReady"));return}ee(),Xe.current=null;const Pe=hf(De),ut=Yb(Te,Pe,ye.key);H(ye),K(null),Y(ut),_(null),c.selectTarget({kind:"section",key:ye.key})},Aa=ye=>{H(null),K(ye.key),Y(null),si("blocks"),c.selectTarget({kind:"loader",key:ye.key})},Dd=async({name:ye,path:Pe,templateKey:ut})=>{if(!t||!l)return;const wt=_3(Pe);if(wt){B(wt);return}const ds=Pe.trim().startsWith("/")?Pe.trim():`/${Pe.trim()}`;if(Ie.some(Qs=>Oe(Qs.path)===Oe(ds))){B(e("sandbox.preview.pageAlreadyExists",{path:ds}));return}let pn;if(ut&&(pn=Ve?.[ut],!pn)){B(e("sandbox.preview.templateNoLongerExists"));return}B(void 0);try{const Qs=await at.mutateAsync({name:ye,path:ds,template:pn});M(!1),ve.success(e("sandbox.preview.pageCreated",{name:ye})),await xd(Yle),Cl({key:Qs.key,name:Qs.name,path:Qs.path}),si("blocks")}catch(Qs){B(Qs instanceof Error?Qs.message:e("sandbox.preview.failedToCreatePage"))}},Wi=ei&&(Vo||St.mode==="production"),Er=h==="blocks",Rr=ase({showPreviewToolbar:Wi,blocksState:lt}),qi=Rr&&Un!=="off"?o.jsx(uk,{title:e("sandbox.preview.cms"),tooltip:e(Er?"sandbox.preview.exitEditor":"sandbox.preview.editContent"),labelCollapse:"sooner",icon:{kind:"component",Component:FA},active:Er,onClick:()=>Pr("blocks"),testId:"preview-blocks-toggle",dataTour:Zr.edit}):null,Dr=Wi?o.jsxs(o.Fragment,{children:[o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(Xo,{onClick:Eo,"aria-label":e("sandbox.preview.refresh"),children:o.jsx($n,{size:16})})}),o.jsx(Ue,{side:"bottom",children:e("sandbox.preview.refresh")})]}),Rr&&o.jsxs("div",{ref:O,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:()=>R(ye=>!ye),children:[U&&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(ll,{size:11}),"Global"]}),Vt&&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(Jc,{size:11}),e("sandbox.preview.loaderBadge")]}),o.jsx("span",{className:ie("text-[13px] font-medium text-foreground",bt==null?"min-w-0 flex-1 truncate":"min-w-0 shrink truncate"),children:bt??Io}),!U&&!W&&bt!=null&&X&&o.jsx("span",{className:"flex min-w-0 flex-1 items-center overflow-hidden whitespace-nowrap text-[12px] text-muted-foreground",children:uf(X).map((ye,Pe)=>{if(ye.type==="text")return o.jsx("span",{className:ie(Pe===0?"min-w-0 truncate":"shrink-0"),children:ye.text},`text-${Pe}`);const ut=vt[ye.name];return ut&&mt?o.jsx(fne,{sources:ut,template:X,paramName:ye.name,value:ft[ye.name]??"",sandboxRef:mt,onCommit:wt=>Ki(ye.name,wt)},`${et}:${ye.name}`):o.jsx(Sne,{name:ye.name,value:ft[ye.name]??"",onCommit:wt=>Ki(ye.name,wt)},`${et}:${ye.name}`)})})]}),o.jsx("button",{type:"button",className:"flex h-full shrink-0 items-center pl-1 pr-2",onClick:()=>R(ye=>!ye),"aria-label":e("sandbox.preview.choosePage"),children:o.jsx(Gt,{size:12,className:ie("shrink-0 text-muted-foreground transition-transform",E&&"rotate-180")})})]}),E&&o.jsxs("div",{className:"absolute left-1/2 top-full z-50 mt-1.5 w-[500px] max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[o.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[o.jsx(A9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("input",{type:"text",value:D,onChange:ye=>I(ye.target.value),onKeyDown:ye=>{if(ye.key!=="Enter")return;const Pe=D.trim();if(!Pe)return;const ut=tt.find(wt=>Oe(wt.path)===Oe(Pe));ut&&(ye.preventDefault(),R(!1),I(""),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:ye=>{ye.preventDefault(),R(!1),I(""),B(void 0),M(!0)},children:[o.jsx(Ut,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"flex-1 font-medium",children:e("sandbox.preview.createNewPage")})]})}),tt.length===0&&ht.length===0&&dt.length===0?o.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Ie.length===0&&xt.length===0&&fe.length===0?e("sandbox.preview.noPagesFound"):e("sandbox.preview.noSearchResults")}):o.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[tt.length>0&&o.jsx("div",{className:"p-1.5",children:tt.map(ye=>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(),R(!1),I(""),Cl(ye)},children:[o.jsx(sl,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ye.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ye.path})]},ye.key))}),ht.length>0&&o.jsxs("div",{className:ie("p-1.5",tt.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")}),ht.map(ye=>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(),R(!1),I(""),Rd(ye)},children:[o.jsx(ll,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ye.name}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ye.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ye.key))]}),dt.length>0&&o.jsxs("div",{className:ie("p-1.5",(tt.length>0||ht.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")}),dt.map(ye=>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(),R(!1),I(""),Aa(ye)},children:[o.jsx(Jc,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:ye.title}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ye.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},ye.key))]})]})]})]}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(Xo,{"aria-label":e(jr),onClick:()=>{No()},children:o.jsx(un,{size:16})})}),o.jsx(Ue,{side:"bottom",children:e(jr)})]})]}):null,Mo=Wi?o.jsxs("div",{className:"flex min-w-0 items-center gap-0.5",children:[qi,qi&&o.jsx("div",{className:"mx-0.5 h-5 w-px shrink-0 bg-border"}),Dr]}):null,Gi=Wi?o.jsx("div",{className:"flex shrink-0 items-center",children:o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon-sm","aria-label":e("sandbox.preview.moreOptions"),children:o.jsx(Qn,{size:14})})}),o.jsxs(zt,{align:"end",className:"w-44",children:[o.jsxs(Ye,{onClick:Do,children:[o.jsx(dn,{size:14}),e("sandbox.preview.copyCurrentUrl")]}),Ve&&De&&o.jsxs(o.Fragment,{children:[o.jsx(Qr,{}),et&&o.jsxs(Ye,{onClick:()=>{c.editSeo({kind:"page",key:et,path:X}),si("blocks")},children:[o.jsx(pg,{size:14}),e("sandbox.preview.editSeo")]}),et&&o.jsxs(Ye,{onClick:()=>{try{d(yT(WB(et)))}catch{ve.error(e("sandbox.preview.invalidPageBlockKey"))}},children:[o.jsx(ga,{size:14}),e("sandbox.preview.viewJson")]})]}),we,o.jsx(Qr,{}),o.jsxs(Ye,{onClick:()=>yte(e),children:[o.jsx(UA,{size:14}),e("cmsTour.menuItem")]})]})]})}):null,Id=St.mode==="sandbox",Oo=Jle[m],wi=m==="desktop"&&(N.width===0||N.width>=Oo.width+2*Av),Ir=wi?1:Math.min(N.width>0?N.width/(Oo.width+2*Av):1,1),$o=wi?{width:"100%",height:"100%"}:{width:`${Oo.width}px`,height:N.height>0?`${N.height/Ir}px`:`${Oo.height}px`,transform:`scale(${Ir})`,transformOrigin:"top center"},Mr=ei?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:[Id&&o.jsxs(o.Fragment,{children:[o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(Xo,{onClick:()=>Pr("visual"),"aria-pressed":h==="visual","aria-label":e("sandbox.preview.visualEditor"),active:h==="visual",className:"rounded-full","data-tour":Zr.visualEditor,children:o.jsx(p4,{size:16})})}),o.jsx(Ue,{side:"top",children:e("sandbox.preview.visualEditor")})]}),o.jsx("div",{className:"mx-0.5 h-5 w-px bg-border"})]}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(Xo,{onClick:Ro,"aria-label":e(Pv[m]),className:"rounded-full","data-tour":Zr.device,children:o.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[m==="mobile"&&o.jsx(HA,{size:16}),m==="tablet"&&o.jsx(KA,{size:16}),m==="desktop"&&o.jsx(WA,{size:16})]},m)})}),o.jsx(Ue,{side:"top",children:e(Pv[m])})]})]})}):null,Bo=(n||!!W)&&wn==="blocks";return o.jsxs("div",{className:"flex flex-col w-full h-full",children:[Ao&&o.jsx(Zle,{onOpen:Po}),mt&&Object.entries(vt).map(([ye,Pe])=>(ft[ye]??"")===""?o.jsx(Lne,{sources:Pe,template:X,paramName:ye,sandboxRef:mt,onFill:ut=>Ki(ye,ut)},`${et}:${ye}`):null),i?o.jsxs(o.Fragment,{children:[Wi&&o.jsx(Ete,{children:Mo}),o.jsx(Rte,{children:Gi})]}):(Wi||Gi)&&o.jsxs("div",{className:"@container/panel-header relative flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3 md:px-4",children:[o.jsx("div",{className:"flex flex-1 items-center justify-start",children:qi}),o.jsx("div",{className:"flex min-w-0 shrink items-center justify-center gap-0.5",children:Dr}),o.jsx("div",{className:"flex flex-1 items-center justify-end",children:Gi})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:Bo?o.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[o.jsx(Tv,{virtualMcpId:t,externalSelection:y,onViewJsonFile:C}),S&&et&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(Vv,{ref:k,virtualMcpId:t,pageKey:et,onClose:j})}),n&&Mr]}):o.jsxs(up,{orientation:"horizontal",disabled:wn!=="blocks",children:[o.jsx(Rc,{ref:L,id:"preview-blocks-editor",defaultSize:wn==="blocks"?"30%":"0%",minSize:"20%",collapsible:!0,collapsedSize:"0%",className:"min-w-0 overflow-hidden",children:wn==="blocks"&&o.jsx(Tv,{virtualMcpId:t,externalSelection:y,onViewJsonFile:C})}),wn==="blocks"&&o.jsx(hp,{withHandle:!0}),o.jsx(Rc,{id:"preview-canvas",defaultSize:wn==="blocks"?"70%":"100%",minSize:"35%",className:"min-w-0 overflow-hidden",children:o.jsxs(up,{orientation:"horizontal",disabled:!(S&&et),children:[S&&et&&o.jsxs(o.Fragment,{children:[o.jsx(Rc,{id:"preview-json-editor",defaultSize:"43%",minSize:"20%",className:"min-w-0 overflow-hidden",children:o.jsx(Vv,{ref:k,virtualMcpId:t,pageKey:et,onClose:j})}),o.jsx(hp,{withHandle:!0})]}),o.jsx(Rc,{id:"preview-canvas-inner",minSize:"30%",className:"min-w-0 overflow-hidden",children:o.jsxs("div",{ref:ye=>{if(!ye)return;const Pe=()=>T(wt=>wt.width===ye.clientWidth&&wt.height===ye.clientHeight?wt:{width:ye.clientWidth,height:ye.clientHeight});Pe();const ut=new ResizeObserver(Pe);return ut.observe(ye),()=>ut.disconnect()},className:ie("h-full relative overflow-clip flex justify-center",ei&&!wi&&"bg-muted/30"),children:[(le||Lo)&&ei&&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"})}),St.showBlockingOverlay&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Kc,{kind:"starting",progress:fn,claimPhase:vs})}),At.kind==="suspended"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Kc,{kind:"suspended",onResume:ue.resume})}),At.kind==="errored"&&o.jsx("div",{className:"absolute inset-0 z-30",children:o.jsx(Kc,{kind:"errored",error:At.error,onRetry:ue.retry,connectionsHref:`/${ae.slug}/settings/connections`})}),St.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(ct,{size:18,className:"mt-0.5 shrink-0 animate-spin 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")})]})]}),wn==="visual"&&!x&&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(p4,{size:12}),e("sandbox.preview.clickElementToAsk")]}),wn==="visual"&&x&&o.jsx(kse,{element:x,onDismiss:()=>b(null)}),Mr,ei&&Bs&&o.jsx("div",{className:ie("shrink-0",!wi&&"border-x border-border bg-background shadow-sm"),style:$o,children:o.jsx("iframe",{ref:v,src:Bs,className:"w-full h-full border-0",title:e("sandbox.preview.devServerPreviewTitle"),onError:Nr.handleError,onLoad:()=>{if(Nr.handleLoad(),he(),St.mode!=="sandbox"){St.mode==="production"&&!St.showWakingPill&&h==="blocks"&&Hi();return}if(Je("vm_preview_loaded",{view_mode:h,vm_id:pe?.sandboxHandle??null}),!U)try{const ye=v.current?.contentWindow?.location?.pathname;if(!ye)return;const Pe=Xe.current;if(Pe!==null&&(Xe.current=null,Oe(ye)!==Oe(Pe))||Oe(ye)===Oe(nt))return;te(ye),_i({path:ye,pageKey:se,params:ft})}catch{}h==="visual"&&Ar(),h==="blocks"&&Hi()}},St.iframeBase)})]})})]})})]})}),o.jsx(nse,{open:F,onOpenChange:M,isPending:at.isPending,error:$,templates:Ie,onSubmit:Dd})]})}function sae(t){const e=z.c(22),{virtualMcpId:s}=t,n=re(),i=bs(s),{activeTask:r,taskId:l,currentBranch:a}=rn(),c=SL(l),[d,h]=P.useState(!1);if(kL({threadId:l,sandboxBranch:r?.branch??a,agentHasRepo:nn(i?.metadata),threadHasRepo:nn(c)||nn(r?.metadata)})==="none"){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:o.jsx(Vn,{className:"size-7 text-foreground"})}),e[0]=p):p=e[0];let m;e[1]!==n?(m=n("mainPanelTabs.previewTab.noSourceToPreview"),e[1]=n,e[2]=m):m=e[2];let g;e[3]!==n?(g=n("mainPanelTabs.previewTab.connectGithubDescription"),e[3]=n,e[4]=g):g=e[4];let x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=()=>h(!0),b=o.jsx(Vn,{className:"size-4"}),e[5]=x,e[6]=b):(x=e[5],b=e[6]);let y;e[7]!==n?(y=n("mainPanelTabs.previewTab.connectGithub"),e[7]=n,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsxs(me,{onClick:x,children:[b,y]}),e[9]=y,e[10]=_):_=e[10];let v;e[11]!==m||e[12]!==g||e[13]!==_?(v=o.jsx(al,{className:"h-full",image:p,title:m,description:g,actions:_}),e[11]=m,e[12]=g,e[13]=_,e[14]=v):v=e[14];let L;e[15]!==d?(L=o.jsx(Mg,{open:d,onOpenChange:h,mode:"agent"}),e[15]=d,e[16]=L):L=e[16];let S;return e[17]!==v||e[18]!==L?(S=o.jsxs(o.Fragment,{children:[v,L]}),e[17]=v,e[18]=L,e[19]=S):S=e[19],S}let f;return e[20]!==s?(f=o.jsx(tae,{virtualMcpId:s}),e[20]=s,e[21]=f):f=e[21],f}const nae=P.lazy(()=>$s(()=>import("./file-explorer-C60EN7cX.js"),__vite__mapDeps([168,1,2,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,103,105,96,106,107,80,123,150,100,147,115,86,87,88,89,90,91,92,93,94,95,97,98,99,101,102,104,108,109,110,111,112,113,114,83,116,117,118,119,120,121,122,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,81,148,149,151,152,153,154,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.FileExplorer})));function iae(t){const e=z.c(23),{openPath:s}=t,n=re(),i=_o(),{org:r}=Be(),{currentBranch:l,taskId:a}=rn(),c=i?.entity?.id??null,d=u0(),h=Ll(),u=Zn();h.vmEntry,u.lifecycle.phase;const f=d,p=c??"",m=l??"",g=a??null,x=f;let b;e[0]!==r.slug||e[1]!==p||e[2]!==m||e[3]!==g||e[4]!==x?(b={orgSlug:r.slug,virtualMcpId:p,branch:m,threadId:g,enabled:x},e[0]=r.slug,e[1]=p,e[2]=m,e[3]=g,e[4]=x,e[5]=b):b=e[5],Hk(b);const y=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;return e[8]!==k?(j=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:k}),e[8]=k,e[9]=j):j=e[9],j}let _;e[10]!==y||e[11]!==n?(_=y,e[10]=y,e[11]=n,e[12]=_):_=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})}),e[13]=v):v=e[13];const L=a??null;let S;e[14]!==l||e[15]!==s||e[16]!==r.slug||e[17]!==L||e[18]!==c?(S=o.jsx("div",{className:"flex-1 relative overflow-hidden bg-background",children:o.jsx(P.Suspense,{fallback:v,children:o.jsx(nae,{orgSlug:r.slug,virtualMcpId:c,branch:l,threadId:L,openPath:s})})}),e[14]=l,e[15]=s,e[16]=r.slug,e[17]=L,e[18]=c,e[19]=S):S=e[19];let w;return e[20]!==_||e[21]!==S?(w=o.jsxs("div",{className:"flex flex-col w-full h-full",children:[_,S]}),e[20]=_,e[21]=S,e[22]=w):w=e[22],w}function rae(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 oae(t,e,s){return typeof t!="string"?null:rae(Bn(t,e),s)}function Uj(t,e,s){if(!e||typeof t!="string")return!1;const n=oae(t,e,s);return!!n&&Object.keys(n.properties??{}).length>0}function lae({orgSlug:t,virtualMcpId:e,branch:s}){const n=cs(),i=xs()?.taskId??null,r=S0(e),l=En(e).runtime==="cms";return Vs({mutationKey:s3(t,e,s),mutationFn:async({blockKey:a})=>{if(l){const h=await C_({orgSlug:t,virtualMcpId:e,branch:s},{delete:[a]});return i3(n,{orgSlug:t,virtualMcpId:e,branch:s},h),await n.invalidateQueries({queryKey:R0({orgSlug:t,virtualMcpId:e,branch:s,threadId:i})}),{ok:!0,existed:!0}}const c=w0(r,Pg(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():$9(d,"Delete")},onMutate:async({blockKey:a})=>{const c=`${t}/${e}/${s}`,d=Ge.decofile(c);await n.cancelQueries({queryKey:d});const h=n.getQueryData(d),u=!!h&&a in h,f=h?.[a];return n.setQueryData(d,p=>{if(!p)return p;const{[a]:m,...g}=p;return g}),{queryKey:d,blockKey:a,hadKey:u,previousValue:f}},onError:(a,c,d)=>{d&&n.setQueryData(d.queryKey,h=>d.hadKey?{...h??{},[d.blockKey]:d.previousValue}:h)},onSuccess:()=>{n.invalidateQueries({queryKey:Ge.liveMeta(t,e,s)})}})}function Sc(t){const e=z.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 x1(t,e){return`${t}-${e}`}function Hj(t,e){return`site/apps/${t}/${e}.ts`}function Kj(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function aae(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function cae(t){return t==="local"?"Custom":"Installed"}function Wj(t,e,s){const n=new Set([x1(t,e),e].map(r=>r.toLowerCase())),i=Hj(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 dae(t,e){const s=t.vendor.alias,n=t.name,i=Wj(s,n,e);return{id:x1(s,n),app:n,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Hj(s,n),blockKey:i,installed:i!==null}}function uae(t,e,s){if(t===w3)return null;const n=Kj(t);if(!n)return null;const{vendor:i,app:r}=n,l=Wj(i,r,s),a=_l(t,e);return{id:x1(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 hae(t,e,s){const n=e.__resolveType;if(typeof n!="string"||nd(t,e)||!iL(n))return null;const i=Kj(n)??aae(t);if(!i)return null;const r=_l(n,s),{vendor:l,app:a}=i;return{id:x1(l,a),app:a,vendor:l,title:r.title??gf(t,e,s),description:r.description??"",category:cae(l),logo:r.logo??r.icon,resolveType:n,blockKey:t,installed:!0}}function fae(t,e,s){const n=new Map;for(const r of t){const l=dae(r,s);n.set(l.id,l)}const i=e.manifest?.blocks?.apps??{};for(const r of Object.keys(i)){const l=uae(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=hae(r,l,e);!a||n.has(a.id)||n.set(a.id,a)}return[...n.values()].sort(mae)}function mae(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function pae(){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 gae(t,e,s){const n=z.c(12),i=s?.enabled??!0;let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=Ge.decoApps(),n[0]=r):r=n[0];let l;n[1]!==i?(l={queryKey:r,queryFn:pae,staleTime:3e5,retry:1,enabled:i},n[1]=i,n[2]=l):l=n[2];const a=Tt(l);let c;n[3]!==e||n[4]!==t||n[5]!==a.data?(c=t&&e?fae(a.data??[],t,e):[],n[3]=e,n[4]=t,n[5]=a.data,n[6]=c):c=n[6];const d=c,h=a.isLoading&&!a.isError;let u;return n[7]!==d||n[8]!==a.isError||n[9]!==a.refetch||n[10]!==h?(u={catalog:d,isLoading:h,isError:a.isError,refetch:a.refetch},n[7]=d,n[8]=a.isError,n[9]=a.refetch,n[10]=h,n[11]=u):u=n[11],u}function xae(t){const e=z.c(86),{active:s,counts:n,showBlog:i,onSelect:r}=t,l=re();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 h=s==="pages";let u;e[6]!==n.pages||e[7]!==r||e[8]!==d||e[9]!==h?(u=o.jsx(Hn,{id:"pages",icon:sl,label:d,count:n.pages,active:h,onSelect:r}),e[6]=n.pages,e[7]=r,e[8]=d,e[9]=h,e[10]=u):u=e[10];let f;e[11]!==l?(f=l("sandbox.collectionsSidebar.sections"),e[11]=l,e[12]=f):f=e[12];const p=s==="sections";let m;e[13]!==n.sections||e[14]!==r||e[15]!==f||e[16]!==p?(m=o.jsx(Hn,{id:"sections",icon:ll,label:f,count:n.sections,active:p,onSelect:r}),e[13]=n.sections,e[14]=r,e[15]=f,e[16]=p,e[17]=m):m=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(Hn,{id:"apps",icon:b7,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 y;e[25]!==l?(y=l("sandbox.collectionsSidebar.redirects"),e[25]=l,e[26]=y):y=e[26];const _=s==="redirects";let v;e[27]!==n.redirects||e[28]!==r||e[29]!==y||e[30]!==_?(v=o.jsx(Hn,{id:"redirects",icon:N8,label:y,count:n.redirects,active:_,onSelect:r}),e[27]=n.redirects,e[28]=r,e[29]=y,e[30]=_,e[31]=v):v=e[31];let L;e[32]!==l?(L=l("sandbox.collectionsSidebar.loaders"),e[32]=l,e[33]=L):L=e[33];const S=s==="loaders";let w;e[34]!==n.loaders||e[35]!==r||e[36]!==L||e[37]!==S?(w=o.jsx(Hn,{id:"loaders",icon:Jc,label:L,count:n.loaders,active:S,onSelect:r}),e[34]=n.loaders,e[35]=r,e[36]=L,e[37]=S,e[38]=w):w=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(Hn,{id:"actions",icon:br,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 N;e[46]!==l?(N=l("sandbox.collectionsSidebar.site"),e[46]=l,e[47]=N):N=e[47];const T=s==="site";let V;e[48]!==r||e[49]!==N||e[50]!==T?(V=o.jsx(Hn,{id:"site",icon:vg,label:N,active:T,onSelect:r}),e[48]=r,e[49]=N,e[50]=T,e[51]=V):V=e[51];let A;e[52]!==l?(A=l("sandbox.collectionsSidebar.seo"),e[52]=l,e[53]=A):A=e[53];const E=s==="seo";let R;e[54]!==r||e[55]!==A||e[56]!==E?(R=o.jsx(Hn,{id:"seo",icon:pg,label:A,active:E,onSelect:r}),e[54]=r,e[55]=A,e[56]=E,e[57]=R):R=e[57];let D;e[58]!==l?(D=l("sandbox.collectionsSidebar.calendar"),e[58]=l,e[59]=D):D=e[59];const I=s==="calendar";let O;e[60]!==r||e[61]!==D||e[62]!==I?(O=o.jsx(Hn,{id:"calendar",icon:hr,label:D,active:I,onSelect:r}),e[60]=r,e[61]=D,e[62]=I,e[63]=O):O=e[63];let F;e[64]!==s||e[65]!==n.authors||e[66]!==n.categories||e[67]!==n.posts||e[68]!==r||e[69]!==i||e[70]!==l?(F=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(Yc,{size:13,className:"shrink-0"}),l("sandbox.collectionsSidebar.blog")]}),o.jsx(Hn,{id:"posts",icon:so,label:l("sandbox.collectionsSidebar.posts"),count:n.posts,active:s==="posts",onSelect:r}),o.jsx(Hn,{id:"authors",icon:Og,label:l("sandbox.collectionsSidebar.authors"),count:n.authors,active:s==="authors",onSelect:r}),o.jsx(Hn,{id:"categories",icon:p9,label:l("sandbox.collectionsSidebar.categories"),count:n.categories,active:s==="categories",onSelect:r}),o.jsx(Hn,{id:"post-schedule",icon:qA,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]=F):F=e[71];let M;e[72]!==b||e[73]!==v||e[74]!==w||e[75]!==C||e[76]!==V||e[77]!==R||e[78]!==O||e[79]!==F||e[80]!==u||e[81]!==m?(M=o.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[u,m,b,v,w,C,V,R,O,F]}),e[72]=b,e[73]=v,e[74]=w,e[75]=C,e[76]=V,e[77]=R,e[78]=O,e[79]=F,e[80]=u,e[81]=m,e[82]=M):M=e[82];let $;return e[83]!==c||e[84]!==M?($=o.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[c,M]}),e[83]=c,e[84]=M,e[85]=$):$=e[85],$}function Hn(t){const e=z.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 h;e[3]!==d?(h=ie("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]=h):h=e[4];let u;e[5]!==n?(u=o.jsx(n,{size:16,className:"shrink-0"}),e[5]=n,e[6]=u):u=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 p;e[9]!==l||e[10]!==r?(p=r!==void 0&&o.jsx("span",{className:ie("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]=p):p=e[11];let m;return e[12]!==c||e[13]!==h||e[14]!==u||e[15]!==f||e[16]!==p?(m=o.jsxs("button",{type:"button",onClick:c,className:h,children:[u,f,p]}),e[12]=c,e[13]=h,e[14]=u,e[15]=f,e[16]=p,e[17]=m):m=e[17],m}function bae(t){const e=z.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=Ak({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(Kc,{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(Kc,{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(Kc,{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 vae=new Set(["clone-failed","install-failed","start-failed","crashed"]);function yae(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&&!vae.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Rv(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 _ae(t,e){const s=il,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 Lae(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 wae(t){const e=fx(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function Sae(t,e){return yk(t,e)}const kae=1e3;function jae(t,e){for(let s=0;s<kae;s++){const n=fx(e);if(!Object.hasOwn(t,n))return n}throw new Error("Could not generate a unique page block key")}const Cae={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Nae={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Tae={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Vae(t){const e=z.c(88),{open:s,mode:n,initialName:i,initialPath:r,isPending:l,error:a,templates:c,validate:d,onSubmit:h,onOpenChange:u}=t,f=l===void 0?!1:l,p=re(),[m,g]=P.useState(i),[x,b]=P.useState(r),[y,_]=P.useState(rl),[v,L]=P.useState(null),[S,w]=P.useState(s);s!==S&&(w(s),s&&(g(i),b(r),_(rl),L(null)));const k=n==="create"&&!!c?.length;let j;e[0]!==f||e[1]!==u?(j=ae=>{!ae&&!f&&(L(null),u(!1))},e[0]=f,e[1]=u,e[2]=j):j=e[2];const C=j;let N;e[3]!==f||e[4]!==m||e[5]!==h||e[6]!==x||e[7]!==k||e[8]!==y||e[9]!==d?(N=async ae=>{ae.preventDefault();const de=m.trim(),ue=x.trim();if(!de||!ue||f)return;const pe=_3(ue);if(pe){L(pe);return}const Z=d?.({name:de,path:ue});if(Z){L(Z);return}L(null),await h({name:de,path:ue,templateKey:k&&y!==rl?y:null})},e[3]=f,e[4]=m,e[5]=h,e[6]=x,e[7]=k,e[8]=y,e[9]=d,e[10]=N):N=e[10];const T=N,V=v??a,A=Cae[n];let E;e[11]!==p||e[12]!==A?(E=p(A),e[11]=p,e[12]=A,e[13]=E):E=e[13];let R;e[14]!==E?(R=o.jsx(ms,{children:o.jsx(Jt,{children:E})}),e[14]=E,e[15]=R):R=e[15];let D;e[16]!==f||e[17]!==k||e[18]!==p||e[19]!==y||e[20]!==c?(D=k&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:p("sandbox.pageFormDialog.labelTemplate")}),o.jsx(_k,{id:"page-form-template",value:y,onChange:_,templates:c??[],disabled:f})]}),e[16]=f,e[17]=k,e[18]=p,e[19]=y,e[20]=c,e[21]=D):D=e[21];let I;e[22]!==p?(I=p("sandbox.pageFormDialog.labelName"),e[22]=p,e[23]=I):I=e[23];let O;e[24]!==I?(O=o.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:I}),e[24]=I,e[25]=O):O=e[25];let F;e[26]===Symbol.for("react.memo_cache_sentinel")?(F=ae=>g(ae.target.value),e[26]=F):F=e[26];let M;e[27]!==p?(M=p("sandbox.pageFormDialog.placeholderName"),e[27]=p,e[28]=M):M=e[28];let $;e[29]!==f||e[30]!==m||e[31]!==M?($=o.jsx(gt,{id:"page-form-name",value:m,onChange:F,placeholder:M,autoFocus:!0,disabled:f}),e[29]=f,e[30]=m,e[31]=M,e[32]=$):$=e[32];let B;e[33]!==$||e[34]!==O?(B=o.jsxs("div",{className:"space-y-1.5",children:[O,$]}),e[33]=$,e[34]=O,e[35]=B):B=e[35];let U;e[36]!==p?(U=p("sandbox.pageFormDialog.labelPath"),e[36]=p,e[37]=U):U=e[37];let H;e[38]!==U?(H=o.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:U}),e[38]=U,e[39]=H):H=e[39];let W;e[40]===Symbol.for("react.memo_cache_sentinel")?(W=ae=>b(ae.target.value),e[40]=W):W=e[40];let K;e[41]!==p?(K=p("sandbox.pageFormDialog.placeholderPath"),e[41]=p,e[42]=K):K=e[42];let G;e[43]!==f||e[44]!==x||e[45]!==K?(G=o.jsx(gt,{id:"page-form-path",value:x,onChange:W,placeholder:K,disabled:f}),e[43]=f,e[44]=x,e[45]=K,e[46]=G):G=e[46];let Y;e[47]!==H||e[48]!==G?(Y=o.jsxs("div",{className:"space-y-1.5",children:[H,G]}),e[47]=H,e[48]=G,e[49]=Y):Y=e[49];let X;e[50]!==V?(X=V&&o.jsx("p",{className:"text-xs text-destructive",children:V}),e[50]=V,e[51]=X):X=e[51];let te;e[52]!==B||e[53]!==Y||e[54]!==X||e[55]!==D?(te=o.jsxs("div",{className:"space-y-4 py-4",children:[D,B,Y,X]}),e[52]=B,e[53]=Y,e[54]=X,e[55]=D,e[56]=te):te=e[56];let se;e[57]!==u?(se=()=>u(!1),e[57]=u,e[58]=se):se=e[58];let ne;e[59]!==p?(ne=p("sandbox.pageFormDialog.buttonCancel"),e[59]=p,e[60]=ne):ne=e[60];let Q;e[61]!==f||e[62]!==se||e[63]!==ne?(Q=o.jsx(me,{type:"button",variant:"outline",onClick:se,disabled:f,children:ne}),e[61]=f,e[62]=se,e[63]=ne,e[64]=Q):Q=e[64];let q;e[65]!==f||e[66]!==m||e[67]!==x?(q=!m.trim()||!x.trim()||f,e[65]=f,e[66]=m,e[67]=x,e[68]=q):q=e[68];let le;e[69]!==f||e[70]!==n||e[71]!==p?(le=f?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),p(Tae[n])]}):p(Nae[n]),e[69]=f,e[70]=n,e[71]=p,e[72]=le):le=e[72];let J;e[73]!==q||e[74]!==le?(J=o.jsx(me,{type:"submit",disabled:q,children:le}),e[73]=q,e[74]=le,e[75]=J):J=e[75];let oe;e[76]!==Q||e[77]!==J?(oe=o.jsxs(Jn,{children:[Q,J]}),e[76]=Q,e[77]=J,e[78]=oe):oe=e[78];let ee;e[79]!==T||e[80]!==te||e[81]!==oe||e[82]!==R?(ee=o.jsx(Wt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:T,children:[R,te,oe]})}),e[79]=T,e[80]=te,e[81]=oe,e[82]=R,e[83]=ee):ee=e[83];let he;return e[84]!==C||e[85]!==s||e[86]!==ee?(he=o.jsx(qt,{open:s,onOpenChange:C,children:ee}),e[84]=C,e[85]=s,e[86]=ee,e[87]=he):he=e[87],he}function Aae(t){const e=z.c(70),{open:s,blockKey:n,initialName:i,isPending:r,onSubmit:l,onOpenChange:a}=t,c=r===void 0?!1:r,d=re(),[h,u]=P.useState(i),[f,p]=P.useState(s);s!==f&&(p(s),s&&u(i));let m;e[0]!==c||e[1]!==a?(m=W=>{!W&&!c&&a(!1)},e[0]=c,e[1]=a,e[2]=m):m=e[2];const g=m;let x;e[3]!==c||e[4]!==h||e[5]!==l?(x=async W=>{W.preventDefault();const K=h.trim();!K||c||await l(K)},e[3]=c,e[4]=h,e[5]=l,e[6]=x):x=e[6];const b=x;let y;e[7]!==d?(y=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=y):y=e[8];let _;e[9]!==y?(_=o.jsx(Jt,{children:y}),e[9]=y,e[10]=_):_=e[10];let v;e[11]!==d?(v=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=v):v=e[12];let L;e[13]!==v?(L=o.jsx(Tn,{children:v}),e[13]=v,e[14]=L):L=e[14];let S;e[15]!==_||e[16]!==L?(S=o.jsxs(ms,{children:[_,L]}),e[15]=_,e[16]=L,e[17]=S):S=e[17];let w;e[18]!==d?(w=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=w):w=e[19];let k;e[20]!==w?(k=o.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:w}),e[20]=w,e[21]=k):k=e[21];let j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=W=>u(W.target.value),e[22]=j):j=e[22];let C;e[23]!==c||e[24]!==h?(C=o.jsx(gt,{id:"section-rename-name",value:h,onChange:j,autoFocus:!0,disabled:c}),e[23]=c,e[24]=h,e[25]=C):C=e[25];let N;e[26]!==k||e[27]!==C?(N=o.jsxs("div",{className:"space-y-1.5",children:[k,C]}),e[26]=k,e[27]=C,e[28]=N):N=e[28];let T;e[29]!==d?(T=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=T):T=e[30];let V;e[31]!==T?(V=o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:T}),e[31]=T,e[32]=V):V=e[32];let A;e[33]!==n?(A=o.jsx(gt,{value:n,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=n,e[34]=A):A=e[34];let E;e[35]!==V||e[36]!==A?(E=o.jsxs("div",{className:"space-y-1.5",children:[V,A]}),e[35]=V,e[36]=A,e[37]=E):E=e[37];let R;e[38]!==N||e[39]!==E?(R=o.jsxs("div",{className:"space-y-4 py-4",children:[N,E]}),e[38]=N,e[39]=E,e[40]=R):R=e[40];let D;e[41]!==a?(D=()=>a(!1),e[41]=a,e[42]=D):D=e[42];let I;e[43]!==d?(I=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=I):I=e[44];let O;e[45]!==c||e[46]!==D||e[47]!==I?(O=o.jsx(me,{type:"button",variant:"outline",onClick:D,disabled:c,children:I}),e[45]=c,e[46]=D,e[47]=I,e[48]=O):O=e[48];let F;e[49]!==c||e[50]!==h?(F=!h.trim()||c,e[49]=c,e[50]=h,e[51]=F):F=e[51];let M;e[52]!==c||e[53]!==d?(M=c?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=c,e[53]=d,e[54]=M):M=e[54];let $;e[55]!==F||e[56]!==M?($=o.jsx(me,{type:"submit",disabled:F,children:M}),e[55]=F,e[56]=M,e[57]=$):$=e[57];let B;e[58]!==O||e[59]!==$?(B=o.jsxs(Jn,{children:[O,$]}),e[58]=O,e[59]=$,e[60]=B):B=e[60];let U;e[61]!==b||e[62]!==R||e[63]!==B||e[64]!==S?(U=o.jsx(Wt,{className:"sm:max-w-md",children:o.jsxs("form",{onSubmit:b,children:[S,R,B]})}),e[61]=b,e[62]=R,e[63]=B,e[64]=S,e[65]=U):U=e[65];let H;return e[66]!==g||e[67]!==s||e[68]!==U?(H=o.jsx(qt,{open:s,onOpenChange:g,children:U}),e[66]=g,e[67]=s,e[68]=U,e[69]=H):H=e[69],H}function Pae(t){const e=z.c(7),{type:s}=t,n=vz[s];let i;e[0]!==n?(i=o.jsx(Fe,{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(Ue,{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(He,{children:[i,l]}),e[4]=i,e[5]=l,e[6]=a):a=e[6],a}const vm={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Dx=["posts","authors","categories"],Cu={posts:"post",authors:"author",categories:"category"};function Nu(t){return Dx.includes(t)}const Ix={posts:"post",authors:"author",categories:"category"},qj={posts:vm.post,authors:vm.author,categories:vm.category},Eae=Object.fromEntries(Object.entries(qj).map(([t,e])=>[e,t]));function Rae(t){return typeof t=="string"?Eae[t]??null:null}function pl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function fs(t){return typeof t=="string"?t:""}function Dae(t,e){switch(t){case"posts":return{label:fs(e.title)||"Untitled post",subtitle:fs(e.slug)};case"authors":return{label:fs(e.name)||"Unnamed author",subtitle:fs(e.email)};case"categories":return{label:fs(e.name)||"Unnamed category",subtitle:fs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Gj(t){const e={posts:[],authors:[],categories:[]};for(const[s,n]of Object.entries(t)){const i=pl(n);if(!i)continue;const r=Rae(i.__resolveType);if(!r)continue;const l=pl(i[Ix[r]])??{},{label:a,subtitle:c}=Dae(r,l);e[r].push({key:s,kind:r,label:a,subtitle:c})}for(const s of Dx)e[s].sort((n,i)=>n.label.localeCompare(i.label));return e}function Iae(t,e){return Gj(t)[e]}function Zu(t,e){return Iae(t,e).map(s=>({key:s.key,payload:au(pl(t[s.key])??void 0,e)}))}const Dv=Object.freeze({});function au(t,e){return t?pl(t[Ix[e]])??Dv:Dv}function kc(t,e,s){return{name:t,__resolveType:qj[e],[Ix[e]]:s}}function pxe({records:t,selected:e,valueField:s,toRef:n}){const i=Array.isArray(e)?e:[],r=f=>typeof f=="string"?f:fs(pl(f)?.[s]),l=f=>typeof f=="string"?f:fs(pl(f)?.name),a=f=>{const p=r(f),m=p?t.find(({payload:x})=>fs(x[s])===p):void 0;if(m)return m;const g=l(f);return g?t.find(({payload:x})=>fs(x.name)===g):void 0},c=t.map(({key:f,payload:p})=>({value:f,label:fs(p.name)||fs(p[s])||f})),d=new Map,h=[];return i.forEach((f,p)=>{const m=a(f);if(m){h.includes(m.key)||h.push(m.key);return}const g=`unresolved:${p}`;d.set(g,f),h.push(g),c.push({value:g,label:l(f)||r(f)||"Unknown"})}),{options:c,selectedValues:h,refsForValues:f=>f.map(p=>{const m=t.find(g=>g.key===p);return m?n(m.payload):d.get(p)}).filter(p=>p!==void 0)}}function la(t){return Array.isArray(t)?t:[]}function eo(t){if(typeof t=="string")return t;const e=pl(t);return e?fs(e.slug):""}function Mae(t){if(typeof t=="string")return t;const e=pl(t);return e?fs(e.email):""}function Yj(t){const e=[];return fs(t.title).trim()||e.push("Title"),fs(t.slug).trim()||e.push("Slug"),la(t.categories).map(eo).filter(Boolean).length===0&&e.push("Category"),fs(t.excerpt).trim()||e.push("Excerpt"),fs(t.image).trim()||e.push("Cover image"),e}const Jj=8;function Qj(t){const e=fs(t.status);return e===""||e==="published"?"published":e==="scheduled"?"scheduled":"draft"}function gxe(t,e){return e!=="published"||Qj(t)==="published"?!1:Yj(t).length>0}function Oae(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,Jj).toISOString()}function xxe(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const n=fs(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(n).getTime())?Oae(s):n}}function Xj(t){return Zu(t,"posts").map(({key:e,payload:s})=>({key:e,title:fs(s.title)||"Untitled post",slug:fs(s.slug),date:fs(s.date),scheduledDatetime:fs(s.scheduledDatetime),categorySlugs:la(s.categories).map(eo).filter(Boolean),authorEmails:la(s.authors).map(Mae).filter(Boolean),missing:Yj(s),status:Qj(s)}))}function $ae(t,e){const s=la(t.categories);return s.some(n=>eo(n)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function Bae(t,e){const s=la(t.categories);return s.length===1&&eo(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function bxe(t,e,s){const n=la(t.categories);if(!n.some(a=>eo(a)===e))return t;const i=n.map(a=>{const c=eo(a);return c===e||c===s.slug?{name:s.name,slug:s.slug}:a}),r=new Set,l=i.filter(a=>{const c=eo(a);return c?r.has(c)?!1:(r.add(c),!0):!0});return{...t,categories:l}}function zae(t,e){const s=la(t.categories);return s.some(n=>eo(n)===e)?{...t,categories:s.filter(n=>eo(n)!==e)}:t}function Iv(t){return{...t,dateModified:new Date().toISOString()}}function Xp(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 ym(t,e){const s=`collections/blog/${e}/${Xp(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function Zj(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Xp(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-${Xp(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Fae={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"}},Mv="Box";function Uae(t){return t.startsWith("site/")?"site":"app"}function Hae(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Wd(...t){for(const e of t)if(e!==void 0)return e}function vxe(t){const e=new Set,s=[],n=t.manifest?.blocks??{};for(const i of Object.values(n))for(const r of Object.keys(i)){if(!qae(r)||e.has(r))continue;e.add(r);const l=_l(r,t),a=Kae(r),c=Fae[a],d=Uae(r),h=(d==="site"?Wd(l.title,c?.title):Wd(c?.title,l.title))??a,u=d==="site"?Wd(l.description,c?.description):Wd(c?.description,l.description),f=d==="site"?l.icon:void 0,p=f&&Hae(f)?f:void 0,m=p!==void 0?c?.iconName??Mv:Wd(f,c?.iconName)??Mv;s.push({resolveType:r,title:h,description:u,iconName:m,iconUrl:p,source:d})}return s.sort((i,r)=>i.title.localeCompare(r.title))}function Kae(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Wae=["blog/sections/blocks/","site/sections/Blog/Post/"];function qae(t){return Wae.some(e=>t.startsWith(e))}const yxe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_xe=["January","February","March","April","May","June","July","August","September","October","November","December"],eC=1440*60*1e3;function Ul(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function Lxe(t){return new Date(t.getFullYear(),t.getMonth(),1)}function wxe(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Bf(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function Zp(t,e){return Math.round((Ul(t).getTime()-Ul(e).getTime())/eC)}function Gae(t){const e=(t.getTime()-Ul(t).getTime())/eC;return Math.min(Math.max(e,0),1)}function Ov(t,e){return Zp(t,e)+Gae(t)}function Sxe(t){const e=Bf(t,-t.getDay()),s=[];for(let n=0;n<6;n++){const i=[];for(let r=0;r<7;r++)i.push(Bf(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 kxe(t,e){const s=Ul(t[0]),n=Bf(s,7),i=s.getTime(),r=n.getTime(),l=[];for(const d of e){const h=Ul(d.start),u=Ul(d.end);if(u.getTime()<s.getTime()||h.getTime()>=n.getTime())continue;const f=h.getTime()<s.getTime()?s:h,p=u.getTime()>=n.getTime()?Bf(n,-1):u,m=Zp(f,s),g=Zp(p,f)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),i),b=Math.min(d.end.getTime(),r),y=Ov(new Date(x),s),_=Math.max(Ov(new Date(b),s)-y,0);_<=0||l.push({variant:d,startCol:m,span:g,leftUnits:y,widthUnits:_})}l.sort((d,h)=>d.startCol-h.startCol||h.span-d.span||d.variant.blockKey.localeCompare(h.variant.blockKey));const a=[],c=[];for(const d of l){let h=a.findIndex(u=>u<=d.startCol);h===-1&&(h=a.length,a.push(0)),a[h]=d.startCol+d.span,c.push({...d,lane:h})}return c}function zf(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const tC=/^(\d{4})-(\d{2})-(\d{2})$/;function Ff(t){const e=t.trim();if(!e)return null;const s=tC.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:Ul(n)}function Yae(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),Jj);return{...Zj("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:zf(t)}}function Jae(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(tC.test(e))return Ff(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Qae(t,e){const s=Jae(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:"")===zf(s)&&(i.date=zf(n)),i}function Xae(t){return Ff(t.scheduledDatetime)??Ff(t.date)}function jxe(t){const e=new Map,s=[];for(const i of t){const r={post:i,scheduled:Ff(i.scheduledDatetime)!==null},l=Xae(i);if(!l){s.push(r);continue}const a=zf(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 Zae="0.161.0",ece="0.162.0",Cxe="deno task update";function $v(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Bv(t,e){const s=$v(t),n=$v(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 sC=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function tce(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=sC.exec(s)?.[1];if(n)return n}return null}function sce(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=sC.exec(n)?.[1];if(i)return i}return null}function nce(t){if(t.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=tce(t.denoJson)??sce(t.meta);return!e||Bv(e,Zae)<0?{kind:"outdated",version:e}:Bv(e,ece)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function Nxe(t){return t.kind==="publish-only"||t.kind==="full"}function Txe(t){return t.kind==="full"}function ice(t){const e=z.c(16),s=bs(t.virtualMcpId)?.metadata?.runtime?.selected??null,n=S0(t.virtualMcpId),i=xs()?.taskId??null;let r;e[0]!==t.branch||e[1]!==t.orgSlug||e[2]!==t.virtualMcpId?(r=Ge.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},w0(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}=Tt(c),h=d??null;let u;return e[12]!==s||e[13]!==t.meta||e[14]!==h?(u=nce({packageManager:s,denoJson:h,meta:t.meta}),e[12]=s,e[13]=t.meta,e[14]=h,e[15]=u):u=e[15],u}function rce({open:t,onOpenChange:e,pageKey:s,decofile:n,onSave:i}){const r=re(),l=n[s],a=l===void 0,c=a?"":JSON.stringify(l,null,2),[d,h]=P.useState(!1),[u,f]=P.useState(c),[p,m]=P.useState(!1),g=!i||a,x=u!==c,b=()=>{navigator.clipboard.writeText(u).then(()=>{h(!0),setTimeout(()=>h(!1),2e3)})},y=async _=>{if(!i||p)return;let v;try{v=JSON.parse(_)}catch{ve.error(r("sectionsEditor.pageJsonDialog.invalidJsonError"));return}m(!0);try{await i(v),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{m(!1)}};return o.jsx(qt,{open:t,onOpenChange:e,children:o.jsxs(Wt,{className:"max-w-3xl p-0 gap-0",children:[o.jsxs(ms,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[o.jsx(Jt,{className:"text-sm font-semibold",children:r("sectionsEditor.pageJsonDialog.title")}),o.jsxs("div",{className:"flex items-center gap-2 mr-8",children:[o.jsxs(me,{variant:"ghost",size:"sm",onClick:b,className:"h-7 gap-1.5 text-xs",children:[d?o.jsx(vi,{size:12}):o.jsx(dn,{size:12}),r(d?"sectionsEditor.pageJsonDialog.copied":"sectionsEditor.pageJsonDialog.copy")]}),!g&&o.jsx(me,{size:"sm",onClick:()=>y(u),disabled:!x||p,className:"h-7 text-xs",children:r(p?"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(bd,{code:c,language:"json",readOnly:g,height:"100%",onChange:_=>f(_??""),onSave:_=>{y(_)}})})]})})}function ki(t){const e=z.c(45),{icon:s,logoUrl:n,title:i,subtitle:r,active:l,accent:a,variantCount:c,trailing:d,selectable:h,selectionActive:u,selected:f,invalid:p,invalidReason:m,onToggleSelect:g,onClick:x,menu:b}=t,y=a==="global";let _;e[0]!==s||e[1]!==l||e[2]!==y||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(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(s,{size:16,className:"shrink-0 text-success"})}),o.jsxs(Ue,{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:ie("flex size-8 shrink-0 items-center justify-center rounded-lg",y?"bg-global-section/15":"bg-muted"),children:o.jsx(s,{size:16,className:ie("shrink-0",!y&&(l?"text-accent-foreground":"text-muted-foreground")),style:y?{color:g3}:void 0})}),e[0]=s,e[1]=l,e[2]=y,e[3]=n,e[4]=c,e[5]=_):_=e[5];const v=_,L=l?y?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":y?"hover:bg-global-section/10":"hover:bg-muted";let S;e[6]!==L?(S=ie("group relative flex min-w-0 items-center rounded-md transition-colors",L),e[6]=L,e[7]=S):S=e[7];let w;e[8]!==g||e[9]!==h||e[10]!==f||e[11]!==u||e[12]!==i?(w=h&&o.jsx("span",{className:ie("flex shrink-0 items-center pl-2.5 transition-opacity",f||u?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:oce,children:o.jsx(gd,{checked:f,onCheckedChange:()=>g?.(),"aria-label":`Select ${i}`})}),e[8]=g,e[9]=h,e[10]=f,e[11]=u,e[12]=i,e[13]=w):w=e[13];const k=p&&!l&&"text-destructive";let j;e[14]!==k?(j=ie("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 N=l?"text-accent-foreground/70":"text-muted-foreground";let T;e[19]!==N?(T=ie("block truncate text-xs",N),e[19]=N,e[20]=T):T=e[20];let V;e[21]!==r||e[22]!==T?(V=o.jsx("span",{className:T,children:r}),e[21]=r,e[22]=T,e[23]=V):V=e[23];let A;e[24]!==V||e[25]!==C?(A=o.jsxs("span",{className:"min-w-0 flex-1",children:[C,V]}),e[24]=V,e[25]=C,e[26]=A):A=e[26];let E;e[27]!==l||e[28]!==p||e[29]!==m?(E=p&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx("span",{className:ie("flex shrink-0 items-center",l?"text-accent-foreground":"text-destructive"),children:o.jsx(vn,{size:14})})}),m&&o.jsx(Ue,{side:"bottom",children:m})]}),e[27]=l,e[28]=p,e[29]=m,e[30]=E):E=e[30];let R;e[31]!==x||e[32]!==v||e[33]!==A||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:[v,A,E,d]}),e[31]=x,e[32]=v,e[33]=A,e[34]=E,e[35]=d,e[36]=R):R=e[36];let D;e[37]!==l||e[38]!==b?(D=b&&o.jsx("div",{className:ie("pr-1 opacity-0 transition-opacity group-hover:opacity-100",l&&"opacity-100"),children:b}),e[37]=l,e[38]=b,e[39]=D):D=e[39];let I;return e[40]!==R||e[41]!==D||e[42]!==S||e[43]!==w?(I=o.jsxs("div",{className:S,children:[w,R,D]}),e[40]=R,e[41]=D,e[42]=S,e[43]=w,e[44]=I):I=e[44],I}function oce(t){return t.stopPropagation()}function el(t){const e=z.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 lce={loaders:Jc,actions:br},ace={loaders:"Loaders",actions:"Actions"},cce={analytics:WP,blog:Yc,commerce:Eg,site:GA,website:zn};function dce(t,e){return e===0?cce[t.toLowerCase()]??cl:cl}function Ch(t,e){return e===0?Ane(t):t}function uce(t){const e=z.c(98),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c}=t,d=re();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[0]=h):h=e[0];const[u,f]=P.useState(h),[p,m]=P.useState(null),[g,x]=P.useState(""),[b,y]=P.useState(vce),[_,v]=P.useState(c);_!==c&&(v(c),f([]),m(null),x(""),y(new Set));let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L=U=>{y(H=>{const W=new Set(H);return W.has(U)?W.delete(U):W.add(U),W})},e[1]=L):L=e[1];const S=L;let w;e[2]!==i||e[3]!==s||e[4]!==n?(w={orgSlug:s,virtualMcpId:n,branch:i},e[2]=i,e[3]=s,e[4]=n,e[5]=w):w=e[5];const k=D0(w);let j;e[6]!==k?(j=yx((U,H)=>k.mutate({blockKey:U,data:H})),e[6]=k,e[7]=j):j=e[7];const C=j;let N;e[8]!==c?(N=Ok(c),e[8]=c,e[9]=N):N=e[9];const T=N,V=lce[c];let A,E,R,D,I,O,F;if(e[10]!==V||e[11]!==i||e[12]!==a||e[13]!==c||e[14]!==l||e[15]!==b||e[16]!==s||e[17]!==u||e[18]!==r||e[19]!==k||e[20]!==C||e[21]!==g||e[22]!==p||e[23]!==T||e[24]!==d||e[25]!==n){R=Symbol.for("react.early_return_sentinel");e:{const U=[...Fk(l,a,c).map(bce),...Bk(l,c).map(xce)],H=g.trim().toLowerCase(),W=H.length>0,K=W?U.filter(xe=>xe.title.toLowerCase().includes(H)||xe.resolveType.toLowerCase().includes(H)):[],G=new Map,Y=[],X=new Map;if(!W){for(const xe of U){const Ne=xe.folderPath;if(!(Ne.length<u.length)&&u.every((Te,Me)=>Ne[Me]===Te))if(Ne.length===u.length)if(xe.savedKey!==void 0){const Te=X.get(xe.resolveType);Te?Te.push(xe):X.set(xe.resolveType,[xe])}else Y.push(xe);else{const Te=Ne[u.length],Me=G.get(Te)??{count:0,savedCount:0};xe.savedKey!==void 0?Me.savedCount=Me.savedCount+1:Me.count=Me.count+1,G.set(Te,Me)}}Y.sort(gce);for(const xe of X.values())xe.sort(pce)}const te=[...X.entries()].filter(xe=>{const[Ne]=xe;return!Y.some(Te=>Te.resolveType===Ne)}).flatMap(mce).sort(fce);let se;e[33]!==u?(se=(xe,Ne)=>Ch(xe.name,u.length).localeCompare(Ch(Ne.name,u.length)),e[33]=u,e[34]=se):se=e[34];const ne=[...G.entries()].map(hce).sort(se);let Q;e[35]===Symbol.for("react.memo_cache_sentinel")?(Q=xe=>{m(xe.savedKey!==void 0?{mode:"saved",key:xe.savedKey}:{mode:"available",resolveType:xe.resolveType,title:xe.title})},e[35]=Q):Q=e[35];const q=Q;let le;e[36]!==k||e[37]!==T||e[38]!==d?(le=async(xe,Ne)=>{await k.mutateAsync({blockKey:xe,data:Ne}),ve.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:T,blockId:xe})),m({mode:"saved",key:xe})},e[36]=k,e[37]=T,e[38]=d,e[39]=le):le=e[39];const J=le;let oe;e[40]!==a||e[41]!==p?(oe=yce(p,a),e[40]=a,e[41]=p,e[42]=oe):oe=e[42];const ee=oe;if(ee){const xe=`${ee.mode}:${ee.mode==="saved"?ee.blockKey:ee.resolveType}`;let Ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>m(null),e[43]=Ne):Ne=e[43];let Te;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]!==ee.editorTarget||e[55]!==ee.initialValue||e[56]!==n?(Te=o.jsx(Fj,{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,kind:c,target:ee.editorTarget,initialValue:ee.initialValue,isCreating:k.isPending,onCreate:J,onSaveReferencedBlock:C,onBack:Ne},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]=ee.editorTarget,e[55]=ee.initialValue,e[56]=n,e[57]=Te):Te=e[57],R=Te;break e}F="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 ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=()=>f([]),e[60]=ae):ae=e[60];const de=u.length===0?"font-medium text-foreground":"text-muted-foreground";let ue;e[61]!==de?(ue=ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",de),e[61]=de,e[62]=ue):ue=e[62];const pe=ace[c];let Z;e[63]!==ue||e[64]!==pe?(Z=o.jsx("button",{type:"button",onClick:ae,className:ue,children:pe}),e[63]=ue,e[64]=pe,e[65]=Z):Z=e[65];let ge;e[66]!==u?(ge=u.map((xe,Ne)=>{const Te=Ne===u.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>f(u.slice(0,Ne+1)),className:ie("min-w-0 truncate rounded-md px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Te?"font-medium text-foreground":"text-muted-foreground"),children:Ch(xe,Ne)})]},`${xe}-${Ne}`)}),e[66]=u,e[67]=ge):ge=e[67];let be;e[68]!==he||e[69]!==Z||e[70]!==ge?(be=o.jsxs("nav",{"aria-label":he,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Z,ge]}),e[68]=he,e[69]=Z,e[70]=ge,e[71]=be):be=e[71];let ke;e[72]===Symbol.for("react.memo_cache_sentinel")?(ke=o.jsx(A9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=ke):ke=e[72];let we;e[73]===Symbol.for("react.memo_cache_sentinel")?(we=xe=>x(xe.target.value),e[73]=we):we=e[73];let Le;e[74]!==c||e[75]!==d?(Le=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:c}),e[74]=c,e[75]=d,e[76]=Le):Le=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 Ce;e[80]!==g||e[81]!==Le||e[82]!==_e?(Ce=o.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[ke,o.jsx("input",{type:"text",value:g,onChange:we,placeholder:Le,"aria-label":_e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=Le,e[82]=_e,e[83]=Ce):Ce=e[83],e[84]!==be||e[85]!==Ce?(E=o.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[be,Ce]}),e[84]=be,e[85]=Ce,e[86]=E):E=e[86],A=yl,O="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",D="mx-auto w-full max-w-4xl px-6 py-5",I=W?K.length===0?o.jsx(el,{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(ki,{icon:V,accent:xe.savedKey!==void 0?"global":void 0,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)},xe.savedKey??xe.resolveType))}):ne.length===0&&Y.length===0&&te.length===0?o.jsx(el,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:c}),description:u.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):o.jsxs(o.Fragment,{children:[ne.length>0&&o.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:ne.map(xe=>{const Ne=dce(xe.name,u.length);return o.jsxs("button",{type:"button",onClick:()=>f([...u,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(Ne,{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:Ch(xe.name,u.length)}),o.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[xe.count," ",xe.count===1?T:c,xe.savedCount>0&&o.jsxs(o.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:xe.savedCount})]})]})]})]},xe.name)})}),(Y.length>0||te.length>0)&&o.jsxs("div",{className:ie("flex flex-col gap-1",ne.length>0&&"mt-4"),children:[Y.map(xe=>{const Ne=X.get(xe.resolveType)??[],Te=b.has(xe.resolveType);return o.jsxs("div",{className:"flex flex-col",children:[o.jsx(ki,{icon:V,title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)}),Ne.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",onClick:()=>S(xe.resolveType),"aria-expanded":Te,className:"flex items-center gap-1 self-start rounded-md px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:g3},children:[Te?o.jsx(Gt,{size:12,className:"shrink-0"}):o.jsx(qs,{size:12,className:"shrink-0"}),d(Te?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",Ne.length,")"]}),Te&&o.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:Ne.map(Me=>o.jsx(ki,{icon:V,accent:"global",title:Me.title,subtitle:Me.resolveType,active:!1,onClick:()=>q(Me)},Me.savedKey))})]})]},xe.resolveType)}),te.map(xe=>o.jsx(ki,{icon:V,accent:"global",title:xe.title,subtitle:xe.resolveType,active:!1,onClick:()=>q(xe)},xe.savedKey))]})]})}e[10]=V,e[11]=i,e[12]=a,e[13]=c,e[14]=l,e[15]=b,e[16]=s,e[17]=u,e[18]=r,e[19]=k,e[20]=C,e[21]=g,e[22]=p,e[23]=T,e[24]=d,e[25]=n,e[26]=A,e[27]=E,e[28]=R,e[29]=D,e[30]=I,e[31]=O,e[32]=F}else A=e[26],E=e[27],R=e[28],D=e[29],I=e[30],O=e[31],F=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let M;e[87]!==D||e[88]!==I?(M=o.jsx("div",{className:D,children:I}),e[87]=D,e[88]=I,e[89]=M):M=e[89];let $;e[90]!==A||e[91]!==M||e[92]!==O?($=o.jsx(A,{className:O,children:M}),e[90]=A,e[91]=M,e[92]=O,e[93]=$):$=e[93];let B;return e[94]!==E||e[95]!==$||e[96]!==F?(B=o.jsxs("div",{className:F,children:[E,$]}),e[94]=E,e[95]=$,e[96]=F,e[97]=B):B=e[97],B}function hce(t){const[e,s]=t;return{name:e,...s}}function fce(t,e){return t.title.localeCompare(e.title)}function mce(t){const[,e]=t;return e}function pce(t,e){return t.title.localeCompare(e.title)}function gce(t,e){return t.title.localeCompare(e.title)}function xce(t){return{resolveType:t.resolveType,title:t.title,folderPath:zk(t.resolveType)}}function bce(t){return{resolveType:t.resolveType,title:t.title,folderPath:zk(t.resolveType),savedKey:t.key}}function vce(){return new Set}function yce(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}=Uk(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:i},initialValue:n}}function _ce(t){const e=z.c(83),{orgSlug:s,virtualMcpId:n,branch:i,previewUrl:r,meta:l,decofile:a,resolveType:c,title:d,defaultBlockId:h,isCreating:u,onCreate:f,onSaveReferencedBlock:p}=t,m=re(),g=_o(),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[y,_]=P.useState(b);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=[],e[1]=v):v=e[1];const[L,S]=P.useState(v),[w,k]=P.useState(0),[j,C]=P.useState(!1);let N;e[2]!==l||e[3]!==c?(N=Bn(c,l),e[2]=l,e[3]=c,e[4]=N):N=e[4];const T=N,V=c.split("/").pop()?.replace(/\.tsx?$/,"")??c,A=xs()?.taskId??null,E=r??void 0;let R;e[5]!==x||e[6]!==i||e[7]!==s||e[8]!==E||e[9]!==A||e[10]!==n?(R={orgSlug:s,virtualMcpId:n,branch:i,threadId:A,previewUrl:E,siteSlug:x},e[5]=x,e[6]=i,e[7]=s,e[8]=E,e[9]=A,e[10]=n,e[11]=R):R=e[11];const D=R;let I,O,F,M,$,B,U,H;if(e[12]!==a||e[13]!==L||e[14]!==y||e[15]!==f||e[16]!==m||e[17]!==d){const ue=[d,...L],pe=ge=>{S(L.slice(0,ge)),k(Lce)};let Z;e[26]!==a||e[27]!==y||e[28]!==f?(Z=async ge=>{const be=Cx(ge,a);if(be){ve.error(be);return}await f(ge,y),C(!1)},e[26]=a,e[27]=y,e[28]=f,e[29]=Z):Z=e[29],I=Z,M="flex h-full w-full min-w-0",F="flex min-w-0 flex-1 flex-col",O="shrink-0 border-b px-3 py-2.5",H="flex min-w-0 items-center gap-2 overflow-hidden",e[30]!==m?($=m("sandbox.availableSectionEditor.editingBreadcrumb"),e[30]=m,e[31]=$):$=e[31],B="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",U=ue.map((ge,be)=>{const ke=be===ue.length-1,we=Nn(ge);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[be>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>pe(be),title:we,className:ie("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",ke?"font-medium text-foreground":"text-muted-foreground"),children:we})]},`${we}-${be}`)}),e[12]=a,e[13]=L,e[14]=y,e[15]=f,e[16]=m,e[17]=d,e[18]=I,e[19]=O,e[20]=F,e[21]=M,e[22]=$,e[23]=B,e[24]=U,e[25]=H}else I=e[18],O=e[19],F=e[20],M=e[21],$=e[22],B=e[23],U=e[24],H=e[25];let W;e[32]!==$||e[33]!==B||e[34]!==U?(W=o.jsx("nav",{"aria-label":$,className:B,children:U}),e[32]=$,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 G;e[37]!==m?(G=m("sandbox.availableSectionEditor.saveAsGlobalSection"),e[37]=m,e[38]=G):G=e[38];let Y;e[39]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(ug,{size:14}),e[39]=Y):Y=e[39];let X;e[40]!==u||e[41]!==G?(X=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{size:"icon",className:"size-8 shrink-0",disabled:u,onClick:K,"aria-label":G,children:Y})}),e[40]=u,e[41]=G,e[42]=X):X=e[42];let te;e[43]!==m?(te=m("sandbox.availableSectionEditor.saveAsGlobalSection"),e[43]=m,e[44]=te):te=e[44];let se;e[45]!==te?(se=o.jsx(Ue,{side:"bottom",children:te}),e[45]=te,e[46]=se):se=e[46];let ne;e[47]!==X||e[48]!==se?(ne=o.jsxs(He,{children:[X,se]}),e[47]=X,e[48]=se,e[49]=ne):ne=e[49];let Q;e[50]!==W||e[51]!==ne||e[52]!==H?(Q=o.jsxs("div",{className:H,children:[W,ne]}),e[50]=W,e[51]=ne,e[52]=H,e[53]=Q):Q=e[53];const q="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",le=m("sandbox.availableSectionEditor.localEditsHint",{typeLabel:V});let J;e[54]!==le?(J=o.jsx("p",{className:q,children:le}),e[54]=le,e[55]=J):J=e[55];let oe;e[56]!==O||e[57]!==Q||e[58]!==J?(oe=o.jsxs("div",{className:O,children:[Q,J]}),e[56]=O,e[57]=Q,e[58]=J,e[59]=oe):oe=e[59];let ee;e[60]!==a||e[61]!==L||e[62]!==w||e[63]!==y||e[64]!==l||e[65]!==p||e[66]!==D||e[67]!==T||e[68]!==m?(ee=o.jsx(yl,{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:T?o.jsx(zi,{schema:T,value:y,onChange:ue=>_(ue),basePath:"",breadcrumbPath:L,onBreadcrumbChange:S,meta:l,decofile:a,onSaveReferencedBlock:p,sandbox:D},w):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:m("sandbox.availableSectionEditor.noEditableFields")})})})}),e[60]=a,e[61]=L,e[62]=w,e[63]=y,e[64]=l,e[65]=p,e[66]=D,e[67]=T,e[68]=m,e[69]=ee):ee=e[69];let he;e[70]!==F||e[71]!==oe||e[72]!==ee?(he=o.jsxs("div",{className:F,children:[oe,ee]}),e[70]=F,e[71]=oe,e[72]=ee,e[73]=he):he=e[73];let ae;e[74]!==h||e[75]!==I||e[76]!==u||e[77]!==j?(ae=o.jsx(Nx,{open:j,onOpenChange:C,defaultBlockId:h,isPending:u,onSubmit:I}),e[74]=h,e[75]=I,e[76]=u,e[77]=j,e[78]=ae):ae=e[78];let de;return e[79]!==M||e[80]!==he||e[81]!==ae?(de=o.jsxs("div",{className:M,children:[he,ae]}),e[79]=M,e[80]=he,e[81]=ae,e[82]=de):de=e[82],de}function Lce(t){return t+1}var wce=Object.prototype.toString,Vd=Array.isArray||function(e){return wce.call(e)==="[object Array]"};function Mx(t){return typeof t=="function"}function Sce(t){return Vd(t)?"array":typeof t}function _m(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function zv(t,e){return t!=null&&typeof t=="object"&&e in t}function kce(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}var jce=RegExp.prototype.test;function Cce(t,e){return jce.call(t,e)}var Nce=/\S/;function Tce(t){return!Cce(Nce,t)}var Vce={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function Ace(t){return String(t).replace(/[&<>"'`=\/]/g,function(s){return Vce[s]})}var Pce=/\s*/,Ece=/\s+/,Fv=/\s*=/,Rce=/\s*\}/,Dce=/#|\^|\/|>|\{|&|=|!/;function Ice(t,e){if(!t)return[];var s=!1,n=[],i=[],r=[],l=!1,a=!1,c="",d=0;function h(){if(l&&!a)for(;r.length;)delete i[r.pop()];else r=[];l=!1,a=!1}var u,f,p;function m(k){if(typeof k=="string"&&(k=k.split(Ece,2)),!Vd(k)||k.length!==2)throw new Error("Invalid tags: "+k);u=new RegExp(_m(k[0])+"\\s*"),f=new RegExp("\\s*"+_m(k[1])),p=new RegExp("\\s*"+_m("}"+k[1]))}m(e||Mi.tags);for(var g=new I0(t),x,b,y,_,v,L;!g.eos();){if(x=g.pos,y=g.scanUntil(u),y)for(var S=0,w=y.length;S<w;++S)_=y.charAt(S),Tce(_)?(r.push(i.length),c+=_):(a=!0,s=!0,c+=" "),i.push(["text",_,x,x+1]),x+=1,_===`
625
625
  `&&(h(),c="",d=0,s=!1);if(!g.scan(u))break;if(l=!0,b=g.scan(Dce)||"name",g.scan(Pce),b==="="?(y=g.scanUntil(Fv),g.scan(Fv),g.scanUntil(f)):b==="{"?(y=g.scanUntil(p),g.scan(Rce),g.scanUntil(f),b="&"):y=g.scanUntil(f),!g.scan(f))throw new Error("Unclosed tag at "+g.pos);if(b==">"?v=[b,y,x,g.pos,c,d,s]:v=[b,y,x,g.pos],d++,i.push(v),b==="#"||b==="^")n.push(v);else if(b==="/"){if(L=n.pop(),!L)throw new Error('Unopened section "'+y+'" at '+x);if(L[1]!==y)throw new Error('Unclosed section "'+L[1]+'" at '+x)}else b==="name"||b==="{"||b==="&"?a=!0:b==="="&&m(y)}if(h(),L=n.pop(),L)throw new Error('Unclosed section "'+L[1]+'" at '+g.pos);return Oce(Mce(i))}function Mce(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 Oce(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 I0(t){this.string=t,this.tail=t,this.pos=0}I0.prototype.eos=function(){return this.tail===""};I0.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};I0.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 ld(t,e){this.view=t,this.cache={".":this.view},this.parent=e}ld.prototype.push=function(e){return new ld(e,this)};ld.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=zv(r,l[a])||kce(r,l[a])),r=r[l[a++]];else r=i.view[e],c=zv(i.view,e);if(c){n=r;break}i=i.parent}s[e]=n}return Mx(n)&&(n=n.call(this.view)),n};function Dn(){this.templateCache={_cache:{},set:function(e,s){this._cache[e]=s},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}Dn.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Dn.prototype.parse=function(e,s){var n=this.templateCache,i=e+":"+(s||Mi.tags).join(":"),r=typeof n<"u",l=r?n.get(i):void 0;return l==null&&(l=Ice(e,s),r&&n.set(i,l)),l};Dn.prototype.render=function(e,s,n,i){var r=this.getConfigTags(i),l=this.parse(e,r),a=s instanceof ld?s:new ld(s,void 0);return this.renderTokens(l,a,n,e,i)};Dn.prototype.renderTokens=function(e,s,n,i,r){for(var l="",a,c,d,h=0,u=e.length;h<u;++h)d=void 0,a=e[h],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};Dn.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(Vd(c))for(var h=0,u=c.length;h<u;++h)a+=this.renderTokens(e[4],s.push(c[h]),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(Mx(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}};Dn.prototype.renderInverted=function(e,s,n,i,r){var l=s.lookup(e[1]);if(!l||Vd(l)&&l.length===0)return this.renderTokens(e[4],s,n,i,r)};Dn.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
- `)};Dn.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),l=Mx(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],h=l;c==0&&d&&(h=this.indentPartial(l,d,a));var u=this.parse(h,r);return this.renderTokens(u,s,n,h,i)}}};Dn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Dn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Mi.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Mi.escape?String(r):i(r)};Dn.prototype.rawValue=function(e){return e[1]};Dn.prototype.getConfigTags=function(e){return Vd(e)?e:e&&typeof e=="object"?e.tags:void 0};Dn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Vd(e))return e.escape};var Mi={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){e0.templateCache=t},get templateCache(){return e0.templateCache}},e0=new Dn;Mi.clearCache=function(){return e0.clearCache()};Mi.parse=function(e,s){return e0.parse(e,s)};Mi.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Sce(e)+'" was given as the first argument for mustache#render(template, view, partials)');return e0.render(e,s,n,i)};Mi.escape=Ace;Mi.Scanner=I0;Mi.Context=ld;Mi.Writer=Dn;function $ce(t,e){const s={__resolveType:t},n=Lk([s],e)[0];return n?Fie(s,n,e):null}function Bce({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:l,onSaveReferencedBlock:a}){const c=re(),d=_o(),h=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=P.useState(()=>$ce(l,r)),[f,p]=P.useState(u?.data??{}),[m,g]=P.useState([]),[x,b]=P.useState(0),[y,_]=P.useState(!1),[v,L]=P.useState(null),S=v!==null,{save:w,flush:k}=mx({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?Bn(u.resolveType,i):null,C=r[l],N=C?Zl(l,C):l,T=xs()?.taskId??null,V={orgSlug:t,virtualMcpId:e,branch:s,threadId:T,previewUrl:n??void 0,siteSlug:h},A=O=>{p(O),w(l,O)},E=()=>{S?(L(null),_(!1),b(O=>O+1)):L(JSON.stringify(f,null,2))},R=O=>{const F=O??"";try{const M=JSON.parse(F);if(M&&typeof M=="object"&&!Array.isArray(M)){_(!1),A(M);return}_(!0)}catch{_(!0)}},D=[N,...m],I=O=>{g(m.slice(0,O)),b(F=>F+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:D.map((O,F)=>{const M=F===D.length-1,$=Nn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[F>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>I(F),title:$,className:ie("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:$})]},`${$}-${F}`)})}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:S?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":S,children:S?o.jsx(Is,{size:14}):o.jsx(ga,{size:14})})}),o.jsx(Ue,{side:"bottom",children:c(S?"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(yl,{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(zi,{schema:j,value:f,onChange:O=>A(O),basePath:"",breadcrumbPath:m,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:a,sandbox:V},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),v!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[y&&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(bd,{language:"json",height:"100%",code:v,onChange:R,onSave:O=>{R(O),k()}})})]})]})]})})}function zce(t){const e=z.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:h,onSaveReferencedBlock:u}=t,f=re();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(el,{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 y;e[7]!==s.title?(y=pj(s.title),e[7]=s.title,e[8]=y):y=e[8];let _;e[9]!==h||e[10]!==s.resolveType?(_=(L,S)=>h(s.resolveType,L,S),e[9]=h,e[10]=s.resolveType,e[11]=_):_=e[11];let v;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==u||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==y||e[23]!==_||e[24]!==i?(v=o.jsx(_ce,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:y,isCreating:d,onCreate:_,onSaveReferencedBlock:u},g),e[12]=r,e[13]=c,e[14]=d,e[15]=a,e[16]=u,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=y,e[23]=_,e[24]=i,e[25]=v):v=e[25],v}const p=`saved:${s.key}`;let m;return e[26]!==r||e[27]!==c||e[28]!==a||e[29]!==u||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==p||e[34]!==i?(m=o.jsx(Bce,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},p),e[26]=r,e[27]=c,e[28]=a,e[29]=u,e[30]=n,e[31]=l,e[32]=s.key,e[33]=p,e[34]=i,e[35]=m):m=e[35],m}const Uv="__all__",Hv={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Fce={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},Hh={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Kv="status:";function Wv(t){if(!t.startsWith(Kv))return null;const e=t.slice(Kv.length);return e in Hh?e:null}const qv=P.forwardRef(function(e,s){const n=z.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 h;n[6]!==l||n[7]!==d?(h=ie("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=h):h=n[8];let u;n[9]!==i?(u=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=u):u=n[10];let f;n[11]!==c?(f=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let p;n[13]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Gt,{size:12,className:"shrink-0 opacity-60"}),n[13]=p):p=n[13];let m;return n[14]!==a||n[15]!==s||n[16]!==h||n[17]!==u||n[18]!==f?(m=o.jsxs(me,{ref:s,type:"button",variant:"ghost",size:"sm",className:h,...a,children:[u,f,p]}),n[14]=a,n[15]=s,n[16]=h,n[17]=u,n[18]=f,n[19]=m):m=n[19],m});function Ox(t){const e=z.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 Uce(t){const e=z.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:h,onStatusFilterChange:u,onSortChange:f}=t,p=re();let m;if(e[0]!==s||e[1]!==r){let ee;e[3]!==r?(ee=he=>he.slug===r,e[3]=r,e[4]=ee):ee=e[4],m=s.find(ee),e[0]=s,e[1]=r,e[2]=m}else m=e[2];const g=m;let x;if(e[5]!==l||e[6]!==n){let ee;e[8]!==l?(ee=he=>he.email===l,e[8]=l,e[9]=ee):ee=e[9],x=n.find(ee),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,y=!!(r||l||a);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==p?(_=g?.name??b?.name??p(a?Hh[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=p,e[14]=_):_=e[14];const v=_,L=r?`cat:${r}`:l?`author:${l}`:a?`status:${a}`:Uv;let S;e[15]!==h||e[16]!==d||e[17]!==u?(S=()=>{d(null),h(null),u(null)},e[15]=h,e[16]=d,e[17]=u,e[18]=S):S=e[18];const w=S;let k;e[19]!==w||e[20]!==h||e[21]!==d||e[22]!==u?(k=ee=>{ee.startsWith("cat:")?(h(null),u(null),d(ee.slice(4))):ee.startsWith("author:")?(d(null),u(null),h(ee.slice(7))):Wv(ee)?(d(null),h(null),u(Wv(ee))):w()},e[19]=w,e[20]=h,e[21]=d,e[22]=u,e[23]=k):k=e[23];const j=k;let C;e[24]!==v||e[25]!==y?(C=o.jsx(Bt,{asChild:!0,children:o.jsx(qv,{icon:YA,active:y,value:v,className:"min-w-0 shrink"})}),e[24]=v,e[25]=y,e[26]=C):C=e[26];let N;e[27]!==p?(N=p("sandbox.postToolbar.filterBy"),e[27]=p,e[28]=N):N=e[28];let T;e[29]!==N?(T=o.jsx(Md,{children:N}),e[29]=N,e[30]=T):T=e[30];let V;e[31]!==p?(V=p("sandbox.postToolbar.allPosts"),e[31]=p,e[32]=V):V=e[32];let A;e[33]!==V?(A=o.jsx(Yn,{value:Uv,children:V}),e[33]=V,e[34]=A):A=e[34];let E;e[35]!==p?(E=p("sandbox.postToolbar.statusLabel"),e[35]=p,e[36]=E):E=e[36];let R;e[37]!==E?(R=o.jsx(Md,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=R):R=e[38];let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=Object.keys(Hh),e[39]=D):D=e[39];let I;e[40]!==i||e[41]!==p?(I=D.map(ee=>o.jsxs(Yn,{value:`status:${ee}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:p(Hh[ee])}),o.jsx(Ox,{count:i[ee]})]},`status:${ee}`)),e[40]=i,e[41]=p,e[42]=I):I=e[42];let O;e[43]!==s.length||e[44]!==p?(O=s.length>0&&o.jsx(Md,{className:"text-muted-foreground/70",children:p("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=p,e[45]=O):O=e[45];let F;e[46]!==s?(F=s.map(Kce),e[46]=s,e[47]=F):F=e[47];let M;e[48]!==n.length||e[49]!==p?(M=n.length>0&&o.jsx(Md,{className:"text-muted-foreground/70",children:p("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=p,e[50]=M):M=e[50];let $;e[51]!==n?($=n.map(Hce),e[51]=n,e[52]=$):$=e[52];let B;e[53]!==L||e[54]!==j||e[55]!==A||e[56]!==R||e[57]!==I||e[58]!==O||e[59]!==F||e[60]!==M||e[61]!==$?(B=o.jsxs(Xc,{value:L,onValueChange:j,children:[A,R,I,O,F,M,$]}),e[53]=L,e[54]=j,e[55]=A,e[56]=R,e[57]=I,e[58]=O,e[59]=F,e[60]=M,e[61]=$,e[62]=B):B=e[62];let U;e[63]!==B||e[64]!==T?(U=o.jsxs(zt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[T,B]}),e[63]=B,e[64]=T,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=o.jsxs($t,{children:[C,U]}),e[66]=U,e[67]=C,e[68]=H):H=e[68];let W;e[69]!==w||e[70]!==y||e[71]!==p?(W=y&&o.jsx(Wce,{label:p("sandbox.postToolbar.clearFilter"),onClick:w}),e[69]=w,e[70]=y,e[71]=p,e[72]=W):W=e[72];const K=Fce[c];let G;e[73]!==p||e[74]!==K?(G=p(K),e[73]=p,e[74]=K,e[75]=G):G=e[75];let Y;e[76]!==G?(Y=o.jsx(Bt,{asChild:!0,children:o.jsx(qv,{icon:JA,active:!0,value:G})}),e[76]=G,e[77]=Y):Y=e[77];let X;e[78]!==p?(X=p("sandbox.postToolbar.sortBy"),e[78]=p,e[79]=X):X=e[79];let te;e[80]!==X?(te=o.jsx(Md,{children:X}),e[80]=X,e[81]=te):te=e[81];let se;e[82]!==f?(se=ee=>f(ee),e[82]=f,e[83]=se):se=e[83];let ne;e[84]===Symbol.for("react.memo_cache_sentinel")?(ne=Object.keys(Hv),e[84]=ne):ne=e[84];let Q;e[85]!==p?(Q=ne.map(ee=>o.jsx(Yn,{value:ee,children:p(Hv[ee])},ee)),e[85]=p,e[86]=Q):Q=e[86];let q;e[87]!==c||e[88]!==se||e[89]!==Q?(q=o.jsx(Xc,{value:c,onValueChange:se,children:Q}),e[87]=c,e[88]=se,e[89]=Q,e[90]=q):q=e[90];let le;e[91]!==te||e[92]!==q?(le=o.jsxs(zt,{align:"end",className:"w-44",children:[te,q]}),e[91]=te,e[92]=q,e[93]=le):le=e[93];let J;e[94]!==Y||e[95]!==le?(J=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs($t,{children:[Y,le]})}),e[94]=Y,e[95]=le,e[96]=J):J=e[96];let oe;return e[97]!==H||e[98]!==W||e[99]!==J?(oe=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]=oe):oe=e[100],oe}function Hce(t){return o.jsxs(Yn,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Ox,{count:t.count})]},`author:${t.email}`)}function Kce(t){return o.jsxs(Yn,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Ox,{count:t.count})]},`cat:${t.slug}`)}function Wce(t){const e=z.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Is,{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 qce(t){const e=z.c(18),{checked:s,disabled:n,onToggle:i}=t,r=re();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(Fe,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Gce,children:o.jsx(gd,{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 h;e[13]!==d?(h=o.jsx(Ue,{side:"bottom",children:d}),e[13]=d,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==h?(u=o.jsxs(He,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=u):u=e[17],u}function Gce(t){return t.stopPropagation()}function Yce(t){const e=z.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:l}=t,a=re();let c;e[0]!==n||e[1]!==i?(c=o.jsx(qce,{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 h;e[6]!==d?(h=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=h):h=e[7];const u=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Gs,{size:14}),e[10]=p):p=e[10];let m;e[11]!==r||e[12]!==u||e[13]!==f?(m=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:r,"aria-label":f,children:p})}),e[11]=r,e[12]=u,e[13]=f,e[14]=m):m=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(Ue,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==m||e[20]!==x?(b=o.jsxs(He,{children:[m,x]}),e[19]=m,e[20]=x,e[21]=b):b=e[21];let y;e[22]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=y):y=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Is,{size:14}),e[24]=_):_=e[24];let v;e[25]!==l||e[26]!==y?(v=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":y,children:_})}),e[25]=l,e[26]=y,e[27]=v):v=e[27];let L;e[28]!==a?(L=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=L):L=e[29];let S;e[30]!==L?(S=o.jsx(Ue,{side:"bottom",children:L}),e[30]=L,e[31]=S):S=e[31];let w;e[32]!==v||e[33]!==S?(w=o.jsxs(He,{children:[v,S]}),e[32]=v,e[33]=S,e[34]=w):w=e[34];let k;e[35]!==b||e[36]!==w?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,w]}),e[35]=b,e[36]=w,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==h?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,h,k]}),e[38]=c,e[39]=k,e[40]=h,e[41]=j):j=e[41],j}function qd(t){const e=z.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:l,onDelete:a}=t,c=re();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Qn,{size:14}),e[2]=h):h=e[2];let u;e[3]!==d?(u=o.jsx(Bt,{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:Jce,children:h})}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(Ye,{onClick:n,children:[o.jsx(P9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let p;e[8]!==s||e[9]!==c?(p=s&&o.jsxs(Ye,{onClick:s,children:[o.jsx(dn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=p):p=e[10];let m;e[11]!==i||e[12]!==c?(m=i&&o.jsxs(o.Fragment,{children:[o.jsx(Qr,{}),o.jsxs(Ye,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(f0,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=m):m=e[13];let g;e[14]!==r||e[15]!==l||e[16]!==c?(g=(r||l)&&o.jsxs(o.Fragment,{children:[o.jsx(Qr,{}),r&&o.jsxs(Ye,{onClick:r,children:[o.jsx(pg,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&o.jsxs(Ye,{onClick:l,children:[o.jsx(ga,{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(Qr,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Gs,{size:14}),e[19]=b):b=e[19];let y;e[20]!==c?(y=c("sandbox.itemActions.delete"),e[20]=c,e[21]=y):y=e[21];let _;e[22]!==a||e[23]!==y?(_=o.jsxs(Ye,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,y]}),e[22]=a,e[23]=y,e[24]=_):_=e[24];let v;e[25]!==_||e[26]!==f||e[27]!==p||e[28]!==m||e[29]!==g?(v=o.jsxs(zt,{align:"end",className:"w-44",children:[f,p,m,g,x,_]}),e[25]=_,e[26]=f,e[27]=p,e[28]=m,e[29]=g,e[30]=v):v=e[30];let L;return e[31]!==v||e[32]!==u?(L=o.jsxs($t,{children:[u,v]}),e[31]=v,e[32]=u,e[33]=L):L=e[33],L}function Jce(t){return t.stopPropagation()}function Qce(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Xce(t){const e=new Map;for(const s of t){const n=Qce(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 Gv(t){const e=z.c(8),{icon:s,label:n,className:i}=t;let r;e[0]!==i?(r=ie("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 Yv=P.lazy(()=>$s(()=>import("./app-editor-DBcySaWI.js"),__vite__mapDeps([169,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,42,78,79,28,44,85,29,30,31,32,33,34,35,36,37,38,39,40,41,43,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,80,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,83,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,81,148,149,150,151,152,153,154,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.AppEditor}))),Zce=P.lazy(()=>$s(()=>import("./post-editor-RYd6MZIf.js"),__vite__mapDeps([170,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,30,59,29,31,32,33,34,35,36,37,38,39,40,41,28,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,80,83,171,143,145,159,160,132,119,84,140,172,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,173,174,116,117,118,79,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,141,142,144,146,147,81,148,149,150,151,152,153,154,78,155,156,157,158,161,162,163,164,165,166,167])).then(t=>({default:t.PostEditor}))),ede=P.lazy(()=>$s(()=>import("./record-editor-DD-wTaHw.js"),__vite__mapDeps([175,1,2,80,83,79,8,28,44,140,173,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,45,46,9,47,10,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,174,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,141,142,143,144,145,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.RecordEditor}))),tde=P.lazy(()=>$s(()=>import("./category-editor-T2MgeHT9.js"),__vite__mapDeps([176,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,36,39,59,29,30,31,32,33,34,35,37,38,40,41,28,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,123,80,83,172,159,160,132,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,173,174,116,117,118,79,119,120,121,122,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,161,162,163,164,165,166,167])).then(t=>({default:t.CategoryEditor}))),sde=P.lazy(()=>$s(()=>import("./bulk-category-panel-DITCXe6Q.js"),__vite__mapDeps([177,1,2,39,83,178,45,79,8,28,44])).then(t=>({default:t.BulkCategoryPanel}))),nde=P.lazy(()=>$s(()=>import("./sections-editor-Cx_CzMX5.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor}))),ide=P.lazy(()=>$s(()=>import("./seo-editor-CwIeX_yG.js"),__vite__mapDeps([179,1,2,42,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,43,44,45,46,9,47,10,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,82,83,84,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,80,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,81,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SeoEditor}))),rde=P.lazy(()=>$s(()=>import("./variant-calendar-ChVU0zWF.js"),__vite__mapDeps([180,1,2,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,83,78,79,84,181,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,80,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,81,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.VariantCalendar}))),ode=P.lazy(()=>$s(()=>import("./post-calendar-Z98btd7F.js"),__vite__mapDeps([182,1,2,30,29,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,183,78,79,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,83,80,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,81,148,149,150,151,152,153,154,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.PostCalendar}))),lde=P.lazy(()=>$s(()=>import("./redirect-editor-BcD4Ju-C.js"),__vite__mapDeps([184,1,2,145,8,80,83,79,28,44,174,33,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,86,29,30,31,32,34,35,36,37,38,39,40,41,42,43,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,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,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.RedirectEditor})));function ade(t){const e=z.c(20),{deepLinkPage:s}=t,n=_o(),{currentBranch:i}=rn(),{org:r}=Be(),l=n?.entity?.id??null,a=Zn(),c=Ll(),{runtime:d,previewServerUrl:h}=En(l),u=d==="cms";let f;e[0]!==u||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=yae({fastPreviewActive:u,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=u,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const p=f;if(p.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==p.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=o.jsx(bae,{state:p.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=p.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(el,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const m=u?h:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==p.devServerReady||e[14]!==p.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==m||e[18]!==l?(g=o.jsx(dde,{orgSlug:r.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:m,deepLinkPage:s,devServerReady:p.devServerReady,sandboxWarming:p.sandboxWarming}),e[11]=i,e[12]=s,e[13]=p.devServerReady,e[14]=p.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=m,e[18]=l,e[19]=g):g=e[19],g}const Jv=2e3,cde=15;function Qv(t,e,s,n){return typeof e!="string"||s&&(Uj(e,s,n)||t.state.dataUpdateCount>=cde)?!1:Jv}function dde({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:l,sandboxWarming:a}){const c=re(),d=xs()?.taskId??null,h=bs(e),u=Jg(h,s),f=vd(h)&&u,p={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:m,isLoading:g}=k0(p,{fetchEnabled:l}),[x,b]=P.useState("pages"),[y,_]=P.useState(null),[v,L]=P.useState(null),S=!!(r?.pageId||r?.path||r?.pathTemplate),[w,k]=P.useState(!1);if(S&&!w&&y===null&&m){k(!0);const ce=kz(pf(m),r??{});ce&&(b("pages"),_({collection:"pages",key:ce.key,path:ce.path}))}const[j,C]=P.useState(""),[N,T]=P.useState(null),[V,A]=P.useState(null),[E,R]=P.useState(null),[D,I]=P.useState("date-desc"),[O,F]=P.useState(()=>new Set),[M,$]=P.useState(null),B=()=>{F(new Set),$(null)},U=ce=>{_(ce),L(null)},[H,W]=P.useState(x);H!==x&&(W(x),C(""),T(null),A(null),R(null),I("date-desc"),F(new Set),$(null));const{data:K,isLoading:G,isFetching:Y}=B9(p,{fetchEnabled:l,refetchInterval:ce=>{const Se=ce.state.data;if(x==="apps"&&y&&y.collection==="apps"){const Ee=m?.[y.key];return Qv(ce,typeof Ee?.__resolveType=="string"?Ee.__resolveType:void 0,Se)}if(x==="site"&&m){const Ee=Se?xp(m,Se):null,je=m.site,Xe=Ee?.resolveType??(typeof je?.__resolveType=="string"?je.__resolveType:void 0);return Qv(ce,Xe,Se,["seo"])}return!1}}),X=(ce,Se)=>!Uj(ce,K,Se)&&(G||Y),{catalog:te,isLoading:se}=gae(K??void 0,m??void 0,{enabled:x==="apps"}),ne=ice({orgSlug:t,virtualMcpId:e,branch:s,meta:K}),Q=D0(p),q=lae(p),[le,J]=P.useState(null),[oe,ee]=P.useState(),[he,ae]=P.useState(null),[de,ue]=P.useState(null),[pe,Z]=P.useState(null),ge=!m||!K;if(g||G||ge&&a)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})});if(ge)return o.jsx(el,{title:"Could not load site data."});const be=pf(m).sort((ce,Se)=>ce.name.localeCompare(Se.name)),ke=mL(m).sort((ce,Se)=>ce.from.localeCompare(Se.from)),we=S3(m,K),Le=x==="sections"?gz(K):[],_e=xp(m,K),Ce=Gj(m),xe=Dx.some(ce=>Ce[ce].length>0),Ne=Nu(x)?Ce[x]:[],Te=(xe?Zu(m,"categories"):[]).map(({key:ce,payload:Se})=>{const Ee=typeof Se.slug=="string"?Se.slug:"",je=typeof Se.name=="string"?Se.name:"";return{slug:Ee||ce,name:je||Ee||ce}}).filter(ce=>ce.slug).sort((ce,Se)=>ce.name.localeCompare(Se.name)),Me=x==="posts"&&(O.size>0||M!==null),Qe=Me?Xj(m).filter(ce=>O.has(ce.key)):[],We=nv(K,"loaders"),Ve=nv(K,"actions");if(!U9(m,K)&&!xe&&We===0&&Ve===0)return o.jsx(el,{icon:vn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const De={pages:be.length,sections:we.length,apps:te.length,loaders:We,actions:Ve,redirects:ke.length,posts:Ce.posts.length,authors:Ce.authors.length,categories:Ce.categories.length},ot=new Set(be.map(ce=>il(ce.path))),st=new Set(be.map(ce=>ce.name)),Ze=new Set(we.map(ce=>ce.name)),lt=async ce=>{const Se=m[ce.key];if(!Se)return;const Ee=jk(m,ce.key),je=Ck(m,ce.key,Math.max(0,Ee-1)),Xe=_se(Se.sections,je);if(Xe)try{await Q.mutateAsync({blockKey:ce.key,data:{...Se,sections:Xe}}),ve.success(`Variant added to "${ce.name}"`),_({collection:"pages",key:ce.key,path:ce.path})}catch(Ke){ve.error(Ke instanceof Error?Ke.message:"Could not add variant")}},_t=()=>{ee(void 0),J({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},it=ce=>{ee(void 0),J({mode:"duplicate",sourceKey:ce.key,initialName:Rv(st,ce.name),initialPath:_ae(ot,ce.path)})},at=ce=>{ee(void 0),J({mode:"rename",sourceKey:ce.key,initialName:ce.name,initialPath:ce.path})},Ie=async ce=>{if(!le)return;const{mode:Se,sourceKey:Ee}=le;try{if(Se==="create"){let je;if(ce.templateKey){const Ke=m[ce.templateKey];if(!Ke)throw new Error("Selected template no longer exists.");je={...Ke,name:ce.name,path:ce.path}}else je=Sae(ce.name,ce.path);const Xe=jae(m,ce.name);await Q.mutateAsync({blockKey:Xe,data:je}),ve.success(`Created "${ce.name}"`),_({collection:"pages",key:Xe,path:ce.path})}else if(Se==="duplicate"&&Ee){const je=m[Ee];if(!je)throw new Error("Source page not found");const{key:Xe,data:Ke}=wae({source:je,pages:be,newName:ce.name,newPath:ce.path});await Q.mutateAsync({blockKey:Xe,data:Ke}),ve.success(`Duplicated as "${ce.name}"`),_({collection:"pages",key:Xe,path:ce.path})}else if(Se==="rename"&&Ee){const je=m[Ee];if(!je)throw new Error("Page not found");const Xe={...je,name:ce.name,path:ce.path};await Q.mutateAsync({blockKey:Ee,data:Xe}),ve.success("Page updated"),y?.collection==="pages"&&y.key===Ee&&_({collection:"pages",key:Ee,path:ce.path})}J(null)}catch(je){ee(je instanceof Error?je.message:"Save failed")}},xt=({path:ce})=>{if(!le)return null;const Se=il(ce);return(le.mode==="rename"?il(le.initialPath):null)!==Se&&ot.has(Se)?`A page with path "${ce}" already exists.`:null},fe=async(ce,Se,Ee)=>{await Q.mutateAsync({blockKey:Se,data:{...Ee,name:Se,__resolveType:ce}}),ve.success(c("sandbox.contentBrowser.createdSection",{name:Se})),_({collection:"sections",key:Se})},Oe=yx((ce,Se)=>Q.mutate({blockKey:ce,data:Se})),tt=async ce=>{const Se=m[ce.key];if(!Se){ve.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Ee=Lae(m,ce.key),je=Rv(Ze,ce.name),Xe={...Se,name:je};try{await Q.mutateAsync({blockKey:Ee,data:Xe}),ve.success(c("sandbox.contentBrowser.duplicatedSection",{name:ce.name})),_({collection:"sections",key:Ee})}catch(Ke){ve.error(Ke instanceof Error?Ke.message:c("sandbox.contentBrowser.duplicateFailed"))}},ht=async ce=>{if(!he)return;const Se=m[he];if(!Se){ve.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await Q.mutateAsync({blockKey:he,data:{...Se,name:ce}}),ve.success(c("sandbox.contentBrowser.sectionRenamed")),ae(null)}catch(Ee){ve.error(Ee instanceof Error?Ee.message:c("sandbox.contentBrowser.renameFailed"))}},dt=async()=>{const ce="/redirect-from",Se=Sz(m,ce),Ee=_z({from:ce,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await Q.mutateAsync({blockKey:Se,data:Ee}),ve.success("Created redirect"),_({collection:"redirects",key:Se})}catch(je){ve.error(je instanceof Error?je.message:"Could not create redirect")}},Vt=async ce=>{const Se=ym(m,ce),Ee=kc(Se,ce,Zj(ce));try{await Q.mutateAsync({blockKey:Se,data:Ee}),ve.success(`Created ${Cu[ce]}`),_({collection:ce,key:Se})}catch(je){ve.error(je instanceof Error?je.message:"Could not create")}},rt=async ce=>{const Se=ym(m,"posts"),Ee=kc(Se,"posts",Yae(ce));try{await Q.mutateAsync({blockKey:Se,data:Ee}),ve.success(c("sandbox.postCalendar.createdScheduledPost")),b("posts"),W("posts"),_({collection:"posts",key:Se}),L(null)}catch(je){ve.error(je instanceof Error?je.message:c("sandbox.postCalendar.couldNotCreate"))}},bt=async(ce,Se)=>{const Ee=m[ce],je=Ee?Qae(au(Ee,"posts"),Se):null;if(!je){ve.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await Q.mutateAsync({blockKey:ce,data:kc(ce,"posts",je)})}catch(Xe){ve.error(Xe instanceof Error?Xe.message:c("sandbox.postCalendar.couldNotReschedule"))}},et=async ce=>{const Se=m[ce.key];if(!Se){ve.error("Record not found.");return}const Ee=ym(m,ce.kind),je=ce.kind==="posts"?"title":"name",Xe={...structuredClone(au(Se,ce.kind)),[je]:`${ce.label} (copy)`};try{await Q.mutateAsync({blockKey:Ee,data:kc(Ee,ce.kind,Xe)}),ve.success(`Duplicated "${ce.label}"`),_({collection:ce.kind,key:Ee})}catch(Ke){ve.error(Ke instanceof Error?Ke.message:"Duplicate failed")}},yt=ce=>{F(Se=>{const Ee=new Set(Se);return Ee.has(ce)?Ee.delete(ce):Ee.add(ce),Ee})},ft=ce=>{b("posts"),W("posts"),_(null),L(null),C(""),T(null),A(null),R(null),I("date-desc"),F(new Set),$(ce||null)},nt=async(ce,Se)=>{const Ee=[...O];let je=0;for(const Xe of Ee){const Ke=m[Xe],vs=au(Ke,"posts"),fn=ce==="add"?$ae(vs,Se):Bae(vs,Se);fn!==vs&&(await Q.mutateAsync({blockKey:Xe,data:kc(Xe,"posts",Iv(fn))}),je+=1)}return je},vt=async(ce,Se)=>{const Ee=O.size;try{const je=await nt(ce,Se),Xe=ce==="add"?"Added to":"Moved",Ke=Ee-je;ve.success(`${Xe} ${je} ${je===1?"post":"posts"}`+(Ke>0?` (${Ke} already set)`:"")),B()}catch(je){ve.error(je instanceof Error?je.message:"Bulk update failed")}},mt=async()=>{if(de)try{if(de.kind==="blog-bulk"){for(const je of de.keys)await q.mutateAsync({blockKey:je});ve.success(`Deleted ${de.count} ${de.count===1?"post":"posts"}`),y&&y.collection!=="available-section"&&de.keys.includes(y.key)&&_(null),B(),ue(null);return}const{kind:ce,key:Se,label:Ee}=de;if(ce==="blog"){if(de.blogKind==="categories"){const je=au(m[Se],"categories").slug,Xe=typeof je=="string"?je:"";if(Xe)for(const{key:Ke,payload:vs}of Zu(m,"posts")){const fn=zae(vs,Xe);fn!==vs&&await Q.mutateAsync({blockKey:Ke,data:kc(Ke,"posts",Iv(fn))})}}await q.mutateAsync({blockKey:Se})}else await q.mutateAsync({blockKey:Se});ve.success(`Deleted "${Ee}"`),y&&y.collection!=="available-section"&&y.key===Se&&_(null),ue(null)}catch(ce){ve.error(ce instanceof Error?ce.message:"Delete failed")}},Lt=q.isPending||Q.isPending,Mt=de?.kind==="blog"?Cu[de.blogKind]:de?.kind==="blog-bulk"?`${de.count} ${de.count===1?"post":"posts"}`:de?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(xae,{active:x,counts:De,showBlog:xe,onSelect:ce=>{b(ce),_(null),L(null)}}),x!=="seo"&&x!=="site"&&x!=="calendar"&&x!=="post-schedule"&&x!=="loaders"&&x!=="actions"&&o.jsx(ude,{activeCollection:x,pages:be,redirects:ke,sections:we,availableSections:Le,appCatalog:te,appCatalogLoading:se,blogEntries:Ne,decofile:m,searchQuery:j,onSearchChange:C,postCategoryFilter:N,postAuthorFilter:V,postStatusFilter:E,postSort:D,onPostCategoryFilterChange:ce=>{T(ce),F(new Set)},onPostAuthorFilterChange:ce=>{A(ce),F(new Set)},onPostStatusFilterChange:ce=>{R(ce),F(new Set)},onPostSortChange:I,selectedPostKeys:O,postBulkPanelOpen:Me,onTogglePostSelect:yt,onSelectAllPosts:ce=>F(new Set(ce)),onClearPostSelection:()=>F(new Set),onExitPostSelection:B,onBulkDeletePosts:()=>ue({kind:"blog-bulk",keys:[...O],count:O.size}),selection:y,onSelect:U,onCreate:()=>{x==="pages"?_t():x==="redirects"?dt():Nu(x)&&Vt(x)},onDuplicatePage:it,onRenamePage:at,onAddPageVariant:lt,onDeletePage:ce=>ue({kind:"page",key:ce.key,label:ce.name}),onEditPageSeo:ce=>{const Se={collection:"pages",key:ce.key,path:ce.path};_(Se),L(ce.key)},onViewPageJson:ce=>Z(ce.key),onDuplicateSection:tt,onRenameSection:ce=>ae(ce.key),onDeleteSection:ce=>ue({kind:"section",key:ce.key,label:ce.name}),onDeleteRedirect:ce=>ue({kind:"redirect",key:ce.key,label:ce.from||ce.key}),onDuplicateBlog:et,onDeleteBlog:ce=>ue({kind:"blog",blogKind:ce.kind,key:ce.key,label:ce.label})}),o.jsx(Gk,{readOnly:f,className:"flex-1 min-w-0",children:x==="loaders"||x==="actions"?o.jsx(uce,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:K,decofile:m,kind:x}):o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:x==="calendar"?o.jsx(rde,{decofile:m}):x==="post-schedule"?o.jsx(ode,{decofile:m,support:ne,isCreating:Q.isPending,onCreate:ce=>{rt(ce)},onReschedule:(ce,Se)=>{bt(ce,Se)},onSelect:ce=>{b("posts"),W("posts"),_({collection:"posts",key:ce}),L(null)}}):x==="site"?_e?o.jsx(Yv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:_e.key,block:m[_e.key],decofile:m,meta:K,title:"Site",excludeFields:["seo"],schemaPending:X(_e.resolveType,["seo"]),previewBaseUrl:n},`site:${_e.key}`):o.jsx(el,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):x==="seo"?o.jsx(ide,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,meta:K,target:{kind:"site"},previewBaseUrl:i}):x==="sections"?o.jsx(zce,{selection:y?.collection==="sections"||y?.collection==="available-section"?y:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:K,decofile:m,isCreating:Q.isPending,onCreateAvailable:fe,onSaveReferencedBlock:Oe}):Me?o.jsx(sde,{posts:Qe,categories:Te,initialSlug:M,isPending:Q.isPending,onApply:(ce,Se)=>{vt(ce,Se)},onClose:B},M??"selection"):y&&y.collection!=="available-section"?y.collection==="apps"?o.jsx(Yv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:m[y.key],decofile:m,meta:K,previewBaseUrl:n,schemaPending:X(typeof m[y.key]?.__resolveType=="string"?String(m[y.key].__resolveType):void 0)},`app:${y.key}`):y.collection==="posts"?o.jsx(Zce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:m[y.key],decofile:m,meta:K,previewBaseUrl:i},`post:${y.key}`):y.collection==="categories"?o.jsx(tde,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:m[y.key],decofile:m,meta:K,onManagePosts:ft,onOpenPost:ce=>{b("posts"),W("posts"),_({collection:"posts",key:ce}),L(null)},previewBaseUrl:i},`category:${y.key}`):y.collection==="authors"?o.jsx(ede,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:y.key,block:m[y.key]},`authors:${y.key}`):y.collection==="redirects"?o.jsx(lde,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:m[y.key]},`redirect:${y.key}`):o.jsx(nde,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:y.collection==="pages"?y.path:"/",activePageBlockKey:y.collection==="pages"?y.key:null,activeGlobalBlockKey:y.collection==="sections"?y.key:null,initialEditSeo:y.collection==="pages"&&v===y.key,onExitSeo:()=>L(null)},y.collection==="pages"?`page:${y.key}`:`section:${y.key}`):o.jsx(el,{title:`Select ${Nu(x)?`a ${Cu[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.'})})}),le&&o.jsx(Vae,{open:!!le,mode:le.mode,initialName:le.initialName,initialPath:le.initialPath,isPending:Q.isPending,error:oe,templates:be,validate:xt,onSubmit:Ie,onOpenChange:ce=>{ce||(J(null),ee(void 0))}}),he&&o.jsx(Aae,{open:!!he,blockKey:he,initialName:we.find(ce=>ce.key===he)?.name??he,isPending:Q.isPending,onSubmit:ht,onOpenChange:ce=>{ce||ae(null)}}),pe&&o.jsx(rce,{open:!!pe,onOpenChange:ce=>{ce||Z(null)},pageKey:pe,decofile:m,onSave:ce=>Q.mutateAsync({blockKey:pe,data:ce})}),o.jsx(no,{open:!!de,onOpenChange:ce=>{!ce&&!Lt&&ue(null)},children:o.jsxs(io,{children:[o.jsxs(ro,{children:[o.jsx(oo,{children:`Delete ${Mt}?`}),o.jsx(lo,{children:de?.kind==="section"?`"${de.label}" will be removed. Pages that still reference it will lose this section.`:de?.kind==="blog-bulk"?`${de.count} ${de.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:de?`"${de.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(ao,{children:[o.jsx(co,{disabled:Lt,children:"Cancel"}),o.jsx(uo,{onClick:ce=>{ce.preventDefault(),mt()},disabled:Lt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Lt?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function ude(t){const e=z.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:h,searchQuery:u,onSearchChange:f,postCategoryFilter:p,postAuthorFilter:m,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:y,onPostStatusFilterChange:_,onPostSortChange:v,selectedPostKeys:L,postBulkPanelOpen:S,onTogglePostSelect:w,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:N,selection:T,onSelect:V,onCreate:A,onDuplicatePage:E,onRenamePage:R,onAddPageVariant:D,onDeletePage:I,onEditPageSeo:O,onViewPageJson:F,onDuplicateSection:M,onRenameSection:$,onDeleteSection:B,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:W}=t;let K,G,Y,X,te,se,ne;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==h||e[6]!==D||e[7]!==N||e[8]!==j||e[9]!==A||e[10]!==W||e[11]!==I||e[12]!==U||e[13]!==B||e[14]!==H||e[15]!==E||e[16]!==M||e[17]!==O||e[18]!==C||e[19]!==y||e[20]!==b||e[21]!==v||e[22]!==_||e[23]!==R||e[24]!==$||e[25]!==f||e[26]!==V||e[27]!==k||e[28]!==w||e[29]!==F||e[30]!==n||e[31]!==m||e[32]!==S||e[33]!==p||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==u||e[38]!==r||e[39]!==L||e[40]!==T){const J=u.toLowerCase(),oe=n.filter(fe=>!J||fe.name.toLowerCase().includes(J)||fe.path.toLowerCase().includes(J)),ee=i.filter(fe=>!J||fe.from.toLowerCase().includes(J)||fe.to.toLowerCase().includes(J)),he=r.filter(fe=>!J||fe.name.toLowerCase().includes(J)||fe.key.toLowerCase().includes(J)||fe.resolveType.toLowerCase().includes(J)),ae=l.filter(fe=>!J||fe.title.toLowerCase().includes(J)||fe.resolveType.toLowerCase().includes(J)||(fe.description?.toLowerCase().includes(J)??!1)),de=Xce(he),ue=a.filter(fe=>!J||fe.title.toLowerCase().includes(J)||fe.app.toLowerCase().includes(J)||fe.vendor.toLowerCase().includes(J)||fe.category.toLowerCase().includes(J)),pe=d.filter(fe=>!J||fe.label.toLowerCase().includes(J)||fe.subtitle.toLowerCase().includes(J)),Z=s==="posts",ge=pde,be=Z?Xj(h):[],ke=new Map,we=new Map,Le={published:0,scheduled:0,draft:0};for(const fe of be)Le[fe.status]=Le[fe.status]+1;for(const fe of be){for(const Oe of fe.categorySlugs)ke.set(Oe,(ke.get(Oe)??0)+1);for(const Oe of fe.authorEmails)we.set(Oe,(we.get(Oe)??0)+1)}const _e=(Z?Zu(h,"categories"):[]).map(fe=>{const{key:Oe,payload:tt}=fe,ht=ge(tt.slug)||Oe;return{slug:ht,name:ge(tt.name)||ge(tt.slug)||Oe,count:ke.get(ht)??0}}).filter(mde),Ce=(Z?Zu(h,"authors"):[]).map(fe=>{const{key:Oe,payload:tt}=fe,ht=ge(tt.email);return{email:ht,name:ge(tt.name)||ge(tt.email)||Oe,count:we.get(ht)??0}}).filter(fde);let xe;e[48]!==p?(xe=fe=>!p||fe.categorySlugs.includes(p),e[48]=p,e[49]=xe):xe=e[49];let Ne;e[50]!==m?(Ne=fe=>!m||fe.authorEmails.includes(m),e[50]=m,e[51]=Ne):Ne=e[51];let Te;e[52]!==g?(Te=fe=>!g||fe.status===g,e[52]=g,e[53]=Te):Te=e[53];let Me;e[54]!==x?(Me=(fe,Oe)=>{if(x==="az")return fe.title.localeCompare(Oe.title);if(x==="za")return Oe.title.localeCompare(fe.title);const tt=fe.date.localeCompare(Oe.date);return x==="date-asc"?tt:-tt},e[54]=x,e[55]=Me):Me=e[55];const Qe=be.filter(fe=>!J||fe.title.toLowerCase().includes(J)||fe.slug.toLowerCase().includes(J)).filter(xe).filter(Ne).filter(Te).sort(Me),We=L.size,Ve=Qe.map(hde),De=Ve.length>0&&Ve.every(fe=>L.has(fe)),ot=We>0||S,st=()=>{De?j():k(Ve)},Ze=`Search ${s}…`,lt=Nu(s)?`Create new ${Cu[s]}`:s==="redirects"?"Create new redirect":"Create new page",_t=s!=="apps"&&s!=="sections";te="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let it;e[56]===Symbol.for("react.memo_cache_sentinel")?(it=o.jsx(A9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=it):it=e[56];let at;e[57]!==f?(at=fe=>f(fe.target.value),e[57]=f,e[58]=at):at=e[58];let Ie;e[59]!==Ze||e[60]!==u||e[61]!==at?(Ie=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[it,o.jsx("input",{type:"text",value:u,onChange:at,placeholder:Ze,"aria-label":Ze,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=Ze,e[60]=u,e[61]=at,e[62]=Ie):Ie=e[62];let xt;e[63]!==lt||e[64]!==A||e[65]!==_t?(xt=_t&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:A,"aria-label":lt,children:o.jsx(Ut,{size:14})})}),o.jsx(Ue,{side:"bottom",children:lt})]}),e[63]=lt,e[64]=A,e[65]=_t,e[66]=xt):xt=e[66],e[67]!==Ie||e[68]!==xt?(se=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Ie,xt]}),e[67]=Ie,e[68]=xt,e[69]=se):se=e[69],ne=Z&&(ot?o.jsx(Yce,{count:We,allSelected:De,onToggleSelectAll:st,onDelete:N,onExit:C}):o.jsx(Uce,{categories:_e,authors:Ce,categoryFilter:p,statusCounts:Le,authorFilter:m,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:y,onStatusFilterChange:_,onSortChange:v})),K=yl,X="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",G="flex flex-col gap-1 p-1.5",Y=s==="pages"?oe.length===0?o.jsx(Sc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):oe.map(fe=>{const Oe=T?.collection==="pages"&&T.key===fe.key,tt=jk(h,fe.key);return o.jsx(ki,{icon:sl,title:fe.name,subtitle:fe.path,active:Oe,variantCount:tt,onClick:()=>V({collection:"pages",key:fe.key,path:fe.path}),menu:o.jsx(qd,{onDuplicate:()=>E(fe),onRename:()=>R(fe),onAddVariant:()=>D(fe),onEditSeo:()=>O(fe),onViewJson:()=>F(fe),onDelete:()=>I(fe)})},fe.key)}):s==="sections"?he.length===0&&ae.length===0?o.jsx(Sc,{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:[de.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Gv,{icon:ll,label:"Saved sections"}),de.map(fe=>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:fe.label}),fe.sections.map(Oe=>{const tt=T?.collection==="sections"&&T.key===Oe.key;return o.jsx(ki,{icon:ll,accent:"global",title:Oe.name,subtitle:fe.label,active:tt,onClick:()=>V({collection:"sections",key:Oe.key}),menu:o.jsx(qd,{onDuplicate:()=>M(Oe),onRename:()=>$(Oe),onDelete:()=>B(Oe)})},Oe.key)})]},fe.label))]}),ae.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Gv,{icon:sl,label:"Available sections",className:ie(de.length>0&&"mt-3")}),ae.map(fe=>{const Oe=T?.collection==="available-section"&&T.resolveType===fe.resolveType,tt=fe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(ki,{icon:sl,title:fe.title,subtitle:tt??fe.resolveType,active:Oe,onClick:()=>V({collection:"available-section",resolveType:fe.resolveType,title:fe.title})},fe.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(ct,{size:18,className:"animate-spin text-muted-foreground"})}):ue.length===0?o.jsx(Sc,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ue.map(fe=>{const Oe=T?.collection==="apps"&&fe.blockKey!==null&&T.key===fe.blockKey;return o.jsx(ki,{icon:b7,logoUrl:fe.logo,title:fe.title,subtitle:fe.category,active:Oe,trailing:fe.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(!fe.installed||!fe.blockKey){ve.message(`${fe.title} is not installed on this site.`);return}V({collection:"apps",key:fe.blockKey})}},fe.id)}):s==="redirects"?ee.length===0?o.jsx(Sc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ee.map(fe=>o.jsx(ki,{icon:N8,title:fe.from||"(no source)",subtitle:`→ ${fe.to||"(no target)"}`,active:T?.collection==="redirects"&&T.key===fe.key,trailing:o.jsx(Pae,{type:fe.type}),onClick:()=>V({collection:"redirects",key:fe.key}),menu:o.jsx(qd,{onDelete:()=>U(fe)})},fe.key)):Z?Qe.length===0?o.jsx(Sc,{hasItems:be.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Qe.map(fe=>{const Oe={key:fe.key,kind:"posts",label:fe.title,subtitle:fe.slug};return o.jsx(ki,{icon:so,title:fe.title,subtitle:fe.slug||"no slug",invalid:fe.missing.length>0,invalidReason:`Missing: ${fe.missing.join(", ")}`,active:T?.collection==="posts"&&T.key===fe.key,selectable:!0,selectionActive:ot,selected:L.has(fe.key),onToggleSelect:()=>w(fe.key),onClick:()=>ot?w(fe.key):V({collection:"posts",key:fe.key}),menu:o.jsx(qd,{onDuplicate:()=>H(Oe),onDelete:()=>W(Oe)})},fe.key)}):pe.length===0?o.jsx(Sc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Nu(s)?Cu[s]:"item"}.`}):pe.map(fe=>{const Oe=T?.collection===fe.kind&&T.key===fe.key;return o.jsx(ki,{icon:fe.kind==="posts"?so:fe.kind==="authors"?Og:p9,title:fe.label,subtitle:fe.subtitle,active:Oe,onClick:()=>V({collection:fe.kind,key:fe.key}),menu:o.jsx(qd,{onDuplicate:()=>H(fe),onDelete:()=>W(fe)})},fe.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=h,e[6]=D,e[7]=N,e[8]=j,e[9]=A,e[10]=W,e[11]=I,e[12]=U,e[13]=B,e[14]=H,e[15]=E,e[16]=M,e[17]=O,e[18]=C,e[19]=y,e[20]=b,e[21]=v,e[22]=_,e[23]=R,e[24]=$,e[25]=f,e[26]=V,e[27]=k,e[28]=w,e[29]=F,e[30]=n,e[31]=m,e[32]=S,e[33]=p,e[34]=x,e[35]=g,e[36]=i,e[37]=u,e[38]=r,e[39]=L,e[40]=T,e[41]=K,e[42]=G,e[43]=Y,e[44]=X,e[45]=te,e[46]=se,e[47]=ne}else K=e[41],G=e[42],Y=e[43],X=e[44],te=e[45],se=e[46],ne=e[47];let Q;e[70]!==G||e[71]!==Y?(Q=o.jsx("div",{className:G,children:Y}),e[70]=G,e[71]=Y,e[72]=Q):Q=e[72];let q;e[73]!==K||e[74]!==X||e[75]!==Q?(q=o.jsx(K,{className:X,children:Q}),e[73]=K,e[74]=X,e[75]=Q,e[76]=q):q=e[76];let le;return e[77]!==te||e[78]!==se||e[79]!==ne||e[80]!==q?(le=o.jsxs("div",{className:te,children:[se,ne,q]}),e[77]=te,e[78]=se,e[79]=ne,e[80]=q,e[81]=le):le=e[81],le}function hde(t){return t.key}function fde(t){return t.email}function mde(t){return t.slug}function pde(t){return typeof t=="string"?t:""}function gde(t){const e=z.c(17),{virtualMcpId:s}=t,n=re(),i=bs(s),{activeTask:r}=rn();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=xl(l);if(!(nn(i?.metadata)||nn(r?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(vn,{size:24,className:"text-muted-foreground/60"}),e[1]=h):h=e[1];let u;e[2]!==n?(u=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=u):u=e[3];let f;e[4]!==u?(f=o.jsx("div",{children:u}),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==n?(p=n("mainPanelTabs.contentTab.connectGithubDescription"),e[6]=n,e[7]=p):p=e[7];let m;e[8]!==p?(m=o.jsx("div",{className:"text-xs text-muted-foreground/80",children:p}),e[8]=p,e[9]=m):m=e[9];let g;return e[10]!==f||e[11]!==m?(g=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[h,f,m]}),e[10]=f,e[11]=m,e[12]=g):g=e[12],g}let d;return e[13]!==a.contentPageId||e[14]!==a.contentPath||e[15]!==a.contentPathTemplate?(d=o.jsx(ade,{deepLinkPage:{pageId:a.contentPageId,path:a.contentPath,pathTemplate:a.contentPathTemplate}}),e[13]=a.contentPageId,e[14]=a.contentPath,e[15]=a.contentPathTemplate,e[16]=d):d=e[16],d}function xde(t){const e=z.c(6),{virtualMcpId:s}=t,n=bs(s),i=J8();let r;e[0]!==i||e[1]!==n?(r=H9(i,Q8(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(bde,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=o.jsx(_de,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function bde(){const t=z.c(12),e=re();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(Rg,{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 vde(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function yde(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function _de(t){const e=z.c(99),{config:s}=t,n=re(),[i,r]=P.useState(""),l=R9(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=xj(a),d=p1(),[h,u]=P.useState(!1),[f,p]=P.useState(null),m=P.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 $=Array.from(M);if($.length===0)return;const B=[];for(const U of $)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===$.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(),u(!0)},e[8]=b):b=e[8];const y=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){u(!1)},e[9]=_):_=e[9];const v=_;let L;e[10]!==x?(L=function(M){M.preventDefault(),M.stopPropagation(),u(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=L):L=e[11];const S=L,[w,k]=fp();let j,C,N,T,V,A;if(e[12]!==s.name||e[13]!==l||e[14]!==k||e[15]!==w||e[16]!==x||e[17]!==h||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==S||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(Lde),$=yde(M,vde(w)),B=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;V="flex h-full min-h-0 flex-col gap-3 p-4";let H;e[31]!==n?(H=n("assets.browser.title"),e[31]=n,e[32]=H):H=e[32];let W;e[33]!==H?(W=o.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=W):W=e[34];let K;e[35]!==s.name||e[36]!==n?(K=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=K):K=e[37];let G;e[38]!==K?(G=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:K}),e[38]=K,e[39]=G):G=e[39];let Y;e[40]!==W||e[41]!==G?(Y=o.jsxs("div",{className:"min-w-0",children:[W,G]}),e[40]=W,e[41]=G,e[42]=Y):Y=e[42];let X;e[43]===Symbol.for("react.memo_cache_sentinel")?(X=()=>m.current?.click(),e[43]=X):X=e[43];let te;e[44]!==d.isPending?(te=d.isPending?o.jsx(ct,{size:14,className:"animate-spin"}):o.jsx(Xn,{size:14}),e[44]=d.isPending,e[45]=te):te=e[45];let se;e[46]!==n||e[47]!==d.isPending?(se=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=se):se=e[48];let ne;e[49]!==te||e[50]!==se||e[51]!==d.isPending?(ne=o.jsxs(me,{type:"button",size:"sm",disabled:d.isPending,onClick:X,children:[te,se]}),e[49]=te,e[50]=se,e[51]=d.isPending,e[52]=ne):ne=e[52];let Q;e[53]!==x?(Q=o.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:pe=>{const Z=Array.from(pe.target.files??[]);pe.target.value="",x(Z)}}),e[53]=x,e[54]=Q):Q=e[54],e[55]!==Y||e[56]!==ne||e[57]!==Q?(A=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Y,ne,Q]}),e[55]=Y,e[56]=ne,e[57]=Q,e[58]=A):A=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(N9,{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 le;e[65]===Symbol.for("react.memo_cache_sentinel")?(le=()=>m.current?.click(),e[65]=le):le=e[65];const J=h&&"border-primary bg-primary/5",oe=d.isPending&&"pointer-events-none opacity-60";let ee;e[66]!==J||e[67]!==oe?(ee=ie("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,oe),e[66]=J,e[67]=oe,e[68]=ee):ee=e[68];let he;e[69]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx(Xn,{size:16,className:"text-muted-foreground"}),e[69]=he):he=e[69];let ae;e[70]!==n?(ae=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ae):ae=e[71];let de;e[72]!==n?(de=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=de):de=e[73];let ue;e[74]!==ae||e[75]!==de?(ue=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[ae," ",de]}),e[74]=ae,e[75]=de,e[76]=ue):ue=e[76],e[77]!==S||e[78]!==ee||e[79]!==ue?(C=o.jsxs("button",{type:"button",onClick:le,onDragOver:y,onDragLeave:v,onDrop:S,className:ee,children:[he,ue]}),e[77]=S,e[78]=ee,e[79]=ue,e[80]=C):C=e[80],N="min-h-0 flex-1 overflow-y-auto pr-1",T=M.length===0?B?o.jsx(Xv,{title:n("filePicker.filePickerDialog.noMatches",{query:B}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(Xv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:$.map((pe,Z)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:pe.map(ge=>o.jsx(wde,{item:ge,onDelete:()=>p(ge)},ge.key))},Z))}),e[12]=s.name,e[13]=l,e[14]=k,e[15]=w,e[16]=x,e[17]=h,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=S,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=C,e[27]=N,e[28]=T,e[29]=V,e[30]=A}else j=e[25],C=e[26],N=e[27],T=e[28],V=e[29],A=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(me,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),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]!==N||e[86]!==T?(R=o.jsxs("div",{className:N,children:[T,E]}),e[84]=E,e[85]=N,e[86]=T,e[87]=R):R=e[87];let D;e[88]===Symbol.for("react.memo_cache_sentinel")?(D=()=>p(null),e[88]=D):D=e[88];let I;e[89]!==s.id||e[90]!==f?(I=o.jsx(jde,{configId:s.id,item:f,onClose:D}),e[89]=s.id,e[90]=f,e[91]=I):I=e[91];let O;return e[92]!==j||e[93]!==C||e[94]!==R||e[95]!==I||e[96]!==V||e[97]!==A?(O=o.jsxs("div",{className:V,children:[A,j,C,R,I]}),e[92]=j,e[93]=C,e[94]=R,e[95]=I,e[96]=V,e[97]=A,e[98]=O):O=e[98],O}function Lde(t){return t.items}function Xv(t){const e=z.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(xr,{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 wde(t){const e=z.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=bj(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let l;e[2]!==s.key?(l=Tx(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:Sde}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(so,{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 h=s.key;let u;e[12]!==s.key?(u=Of(s.key),e[12]=s.key,e[13]=u):u=e[13];let f;e[14]!==s.key||e[15]!==u?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:h,children:u}),e[14]=s.key,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==s.size?(p=vj(s.size),e[17]=s.size,e[18]=p):p=e[18];let m;e[19]!==r||e[20]!==p?(m=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",p]}),e[19]=r,e[20]=p,e[21]=m):m=e[21];let g;e[22]!==f||e[23]!==m?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,m]}),e[22]=f,e[23]=m,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(kde,{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 y;return e[31]!==b||e[32]!==d?(y=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]=y):y=e[33],y}function Sde(t){t.target.style.display="none"}function kde(t){const e=z.c(36),{item:s,onDelete:n}=t,i=re(),[r,l]=P.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 h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(E9,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx(Bt,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==r?(f=r?o.jsx(Kt,{size:14}):o.jsx(dn,{size:14}),e[8]=r,e[9]=f):f=e[9];let p;e[10]!==r||e[11]!==i?(p=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=p):p=e[12];let m;e[13]!==c||e[14]!==f||e[15]!==p?(m=o.jsxs(Ye,{onClick:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(un,{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 y;e[20]!==s.publicUrl||e[21]!==b?(y=o.jsx(Ye,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=y):y=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Gs,{size:14}),e[23]=_):_=e[23];let v;e[24]!==i?(v=i("assets.browser.deleteAction"),e[24]=i,e[25]=v):v=e[25];let L;e[26]!==n||e[27]!==v?(L=o.jsxs(Ye,{variant:"destructive",onClick:n,children:[_,v]}),e[26]=n,e[27]=v,e[28]=L):L=e[28];let S;e[29]!==y||e[30]!==L||e[31]!==m?(S=o.jsxs(zt,{align:"end",children:[m,y,L]}),e[29]=y,e[30]=L,e[31]=m,e[32]=S):S=e[32];let w;return e[33]!==S||e[34]!==u?(w=o.jsxs($t,{children:[u,S]}),e[33]=S,e[34]=u,e[35]=w):w=e[35],w}function jde(t){const e=z.c(47),{configId:s,item:n,onClose:i}=t,r=re(),l=Ore();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 h;e[6]!==i?(h=T=>!T&&i(),e[6]=i,e[7]=h):h=e[7];let u;e[8]!==r?(u=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=u):u=e[9];let f;e[10]!==u?(f=o.jsx(oo,{children:u}),e[10]=u,e[11]=f):f=e[11];let p;e[12]!==n||e[13]!==r?(p=r("assets.browser.deleteConfirmDescription",{name:n?Of(n.key):""}),e[12]=n,e[13]=r,e[14]=p):p=e[14];let m;e[15]!==p?(m=o.jsx(lo,{children:p}),e[15]=p,e[16]=m):m=e[16];let g;e[17]!==f||e[18]!==m?(g=o.jsxs(ro,{children:[f,m]}),e[17]=f,e[18]=m,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 y;e[22]!==l.isPending||e[23]!==b?(y=o.jsx(co,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=y):y=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=ie(K6({variant:"destructive"})),e[25]=_):_=e[25];const v=l.isPending;let L;e[26]!==c?(L=T=>{T.preventDefault(),c()},e[26]=c,e[27]=L):L=e[27];let S;e[28]!==l.isPending?(S=l.isPending?o.jsx(ct,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=S):S=e[29];let w;e[30]!==r?(w=r("assets.browser.deleteConfirm"),e[30]=r,e[31]=w):w=e[31];let k;e[32]!==l.isPending||e[33]!==L||e[34]!==S||e[35]!==w?(k=o.jsxs(uo,{className:_,disabled:v,onClick:L,children:[S,w]}),e[32]=l.isPending,e[33]=L,e[34]=S,e[35]=w,e[36]=k):k=e[36];let j;e[37]!==y||e[38]!==k?(j=o.jsxs(ao,{children:[y,k]}),e[37]=y,e[38]=k,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=o.jsxs(io,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let N;return e[43]!==C||e[44]!==d||e[45]!==h?(N=o.jsx(no,{open:d,onOpenChange:h,children:C}),e[43]=C,e[44]=d,e[45]=h,e[46]=N):N=e[46],N}const Lm={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:pa},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Jr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:m8}},Cde=["fast","smart","thinking"];function Nde(t){const e=z.c(19),{tier:s,onSelect:n}=t,i=re(),[r,l]=P.useState(!1),a=Lm[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=Lm[s];let h;e[2]!==i||e[3]!==d.labelKey?(h=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=h):h=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Gt,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==h?(f=o.jsx(ts,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,h,u]})}),e[6]=c,e[7]=h,e[8]=f):f=e[8];let p;e[9]!==n||e[10]!==i||e[11]!==s?(p=Cde.map(x=>{const b=Lm[x],y=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ie("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(y,{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(Kt,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=p):p=e[12];let m;e[13]!==p?(m=o.jsx(ss,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:p})}),e[13]=p,e[14]=m):m=e[14];let g;return e[15]!==r||e[16]!==f||e[17]!==m?(g=o.jsxs(ns,{open:r,onOpenChange:l,children:[f,m]}),e[15]=r,e[16]=f,e[17]=m,e[18]=g):g=e[18],g}function Tde(t){const e=z.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,l=re(),[a,c]=P.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let h;e[2]!==d?(h=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=h):h=e[3];let u;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(u=a?o.jsx(P.Suspense,{fallback:o.jsx(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:o.jsx(Vde,{override:i,onOverrideChange:r})}):o.jsx(Nde,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let f;e[11]!==r?(f=y=>{c(y),y||r(null)},e[11]=r,e[12]=f):f=e[12];let p;e[13]!==f||e[14]!==a?(p=o.jsx(Pi,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=p):p=e[15];let m;e[16]!==l?(m=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=m):m=e[17];let g;e[18]!==p||e[19]!==m?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[p,m]}),e[18]=p,e[19]=m,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u,g]}),e[21]=u,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==h||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[h,x]}),e[24]=h,e[25]=x,e[26]=b):b=e[26],b}function Vde(t){const e=z.c(25),{override:s,onOverrideChange:n}=t,i=re(),r=k9(),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]=P.useState(a);let h;e[4]!==c||e[5]!==l||e[6]!==r?(h=r.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=r,e[7]=h):h=e[7];const u=h;let f;e[8]!==r||e[9]!==s?(f=s&&r.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=r,e[9]=s,e[10]=f):f=e[10];const p=f;if(r.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let y;return e[13]!==b?(y=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=y):y=e[14],y}let m;e[15]!==i?(m=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=m):m=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const y=b.keyId??u??"";d(y),n({modelId:b.modelId,credentialId:y,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==p||e[22]!==m||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(yP,{variant:"bordered",placeholder:m,model:p,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=p,e[22]=m,e[23]=g,e[24]=x):x=e[24],x}const nC=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Fg,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:xr},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:ci},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:a0}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:cl,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:x9},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:P9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:cg},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Fu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:cl},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:QA}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Jc,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Jc},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Yc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Yc}]}],Ade=nC.flatMap(t=>t.tools.map(e=>e.name));function Pde(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Ede(t){const e=z.c(12),{agentId:s,value:n,onChange:i}=t,r=re();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(P.Suspense,{fallback:o.jsxs(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(Fg,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(Rde,{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 Zv(t){const e=z.c(17),{value:s,checked:n,onToggle:i,title:r,description:l,leading:a}=t;let c;e[0]!==n?(c=o.jsx(gd,{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 h;e[4]!==r?(h=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=h):h=e[5];let u;e[6]!==l?(u=l&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=u):u=e[7];let f;e[8]!==h||e[9]!==u?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h,u]}),e[8]=h,e[9]=u,e[10]=f):f=e[10];let p;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(p=o.jsxs(Ft,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=p):p=e[16],p}function ey(t){const e=z.c(27),{conn:s,label:n,icon:i,on:r,total:l,onToggle:a}=t,c=re(),d=r===l;let h;e[0]!==i||e[1]!==s?(h=s?o.jsx(Oi,{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]=h):h=e[2];let u;e[3]!==s?.title||e[4]!==n||e[5]!==c?(u=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==l?(p=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]=p):p=e[11];let m;e[12]!==a?(m=_=>{_.stopPropagation(),a()},e[12]=a,e[13]=m):m=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==m||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=m,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==p||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[p,x]}),e[20]=p,e[21]=x,e[22]=b):b=e[22];let y;return e[23]!==h||e[24]!==f||e[25]!==b?(y=o.jsxs("div",{className:"flex items-center gap-2",children:[h,f,b]}),e[23]=h,e[24]=f,e[25]=b,e[26]=y):y=e[26],y}function Rde(t){const e=z.c(83),{agentId:s,value:n,onChange:i}=t,r=re(),{org:l}=Be(),[a,c]=P.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 h=Qt(d);let u;e[4]!==h?(u={client:h},e[4]=h,e[5]=u):u=e[5];const{data:f,isLoading:p}=lg(u),m=pi();let g,x,b,y,_,v,L,S,w,k,j,C,N;if(e[6]!==m||e[7]!==f?.tools||e[8]!==p||e[9]!==i||e[10]!==a||e[11]!==r||e[12]!==n){const R=new Map(m.map($de)),D=new Map;for(const de of f?.tools??[]){const ue=dr(de._meta)??"__other__",pe=dd(de.name,ue==="__other__"?void 0:ue),Z=de.title,ge=Z&&Z!==de.name?Z:Pde(pe);D.has(ue)||D.set(ue,{clientId:ue,conn:R.get(ue),tools:[]}),D.get(ue).tools.push({name:de.name,display:ge,description:de.description})}const I=[...D.values()].sort(Ode),O=(f?.tools??[]).map(Mde),F=[...Ade,...O],M=n===null?new Set(F):new Set(n),$=F.every(de=>M.has(de)),B=de=>i(F.every(ue=>de.has(ue))?null:[...de]),U=de=>{const ue=new Set(M);ue.has(de)?ue.delete(de):ue.add(de),B(ue)},H=(de,ue)=>{const pe=new Set(M);for(const Z of de)ue?pe.add(Z):pe.delete(Z);B(pe)};y=ns,N=a,_=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(Fg,{size:14,className:"text-muted-foreground"}),e[26]=W):W=e[26];let K;e[27]!==$||e[28]!==r?(K=r($?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=$,e[28]=r,e[29]=K):K=e[29];const G=!$&&o.jsxs(UE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",F.length]});let Y;e[30]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Gt,{size:14,className:"text-muted-foreground"}),e[30]=Y):Y=e[30],e[31]!==K||e[32]!==G?(v=o.jsx(ts,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,K,G,Y]})}),e[31]=K,e[32]=G,e[33]=v):v=e[33],b=ss,j="p-0 w-80",C="start",x=Fn;let X;e[34]!==r?(X=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=X):X=e[35],e[36]!==X?(w=o.jsx(An,{placeholder:X}),e[36]=X,e[37]=w):w=e[37];const te=$?r("automations.automationConfig.allToolsEnabled",{count:F.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:F.length});let se;e[38]!==te?(se=o.jsx("span",{className:"text-xs text-muted-foreground",children:te}),e[38]=te,e[39]=se):se=e[39];let ne;e[40]!==i?(ne=()=>i(null),e[40]=i,e[41]=ne):ne=e[41];let Q;e[42]!==r?(Q=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=Q):Q=e[43];let q;e[44]!==$||e[45]!==ne||e[46]!==Q?(q=o.jsx("button",{type:"button",onClick:ne,disabled:$,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:Q}),e[44]=$,e[45]=ne,e[46]=Q,e[47]=q):q=e[47];let le;e[48]===Symbol.for("react.memo_cache_sentinel")?(le=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=le):le=e[48];let J;e[49]!==i?(J=()=>i([]),e[49]=i,e[50]=J):J=e[50];const oe=M.size===0;let ee;e[51]!==r?(ee=r("automations.automationConfig.clear"),e[51]=r,e[52]=ee):ee=e[52];let he;e[53]!==J||e[54]!==oe||e[55]!==ee?(he=o.jsx("button",{type:"button",onClick:J,disabled:oe,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ee}),e[53]=J,e[54]=oe,e[55]=ee,e[56]=he):he=e[56];let ae;e[57]!==q||e[58]!==he?(ae=o.jsxs("div",{className:"flex items-center gap-2",children:[q,le,he]}),e[57]=q,e[58]=he,e[59]=ae):ae=e[59],e[60]!==se||e[61]!==ae?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[se,ae]}),e[60]=se,e[61]=ae,e[62]=k):k=e[62],g=Pn,L="max-h-80",S=p?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(hn,{children:r("automations.automationConfig.noToolsFound")}),nC.map(de=>{const ue=de.tools.map(Ide),pe=ue.filter(Z=>M.has(Z)).length;return o.jsx(os,{heading:o.jsx(ey,{label:r(de.headingKey),icon:de.icon,on:pe,total:ue.length,onToggle:()=>H(ue,pe!==ue.length)}),children:de.tools.map(Z=>o.jsx(Zv,{value:`${r(Z.titleKey)} ${Z.name}`,checked:M.has(Z.name),onToggle:()=>U(Z.name),title:r(Z.titleKey),description:r(Z.descriptionKey),leading:o.jsx(Z.icon,{size:16,className:"text-muted-foreground"})},Z.name))},de.key)}),I.map(de=>{const ue=de.tools.map(Dde),pe=ue.filter(Z=>M.has(Z)).length;return o.jsx(os,{heading:o.jsx(ey,{conn:de.conn,on:pe,total:ue.length,onToggle:()=>H(ue,pe!==ue.length)}),children:de.tools.map(Z=>o.jsx(Zv,{value:`${Z.display} ${Z.name} ${de.conn?.title??""}`,checked:M.has(Z.name),onToggle:()=>U(Z.name),title:Z.display,description:Z.description},Z.name))},de.clientId)})]}),e[6]=m,e[7]=f?.tools,e[8]=p,e[9]=i,e[10]=a,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=y,e[17]=_,e[18]=v,e[19]=L,e[20]=S,e[21]=w,e[22]=k,e[23]=j,e[24]=C,e[25]=N}else g=e[13],x=e[14],b=e[15],y=e[16],_=e[17],v=e[18],L=e[19],S=e[20],w=e[21],k=e[22],j=e[23],C=e[24],N=e[25];let T;e[63]!==g||e[64]!==L||e[65]!==S?(T=o.jsx(g,{className:L,children:S}),e[63]=g,e[64]=L,e[65]=S,e[66]=T):T=e[66];let V;e[67]!==x||e[68]!==T||e[69]!==w||e[70]!==k?(V=o.jsxs(x,{children:[w,k,T]}),e[67]=x,e[68]=T,e[69]=w,e[70]=k,e[71]=V):V=e[71];let A;e[72]!==b||e[73]!==V||e[74]!==j||e[75]!==C?(A=o.jsx(b,{className:j,align:C,children:V}),e[72]=b,e[73]=V,e[74]=j,e[75]=C,e[76]=A):A=e[76];let E;return e[77]!==y||e[78]!==_||e[79]!==v||e[80]!==A||e[81]!==N?(E=o.jsxs(y,{open:N,onOpenChange:_,children:[v,A]}),e[77]=y,e[78]=_,e[79]=v,e[80]=A,e[81]=N,e[82]=E):E=e[82],E}function Dde(t){return t.name}function Ide(t){return t.name}function Mde(t){return t.name}function Ode(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function $de(t){return[t.id,t]}function Tu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Bde(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"),h=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${h} UTC`}return t}function zde(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 Fde(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 Ude(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Hde=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Kde({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const l=re(),{triggerAdd:a}=g0(),[c,d]=P.useState(!1),h=e??c,u=m=>{s?s(m):d(m)},f=async m=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),ve.success(l("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");ve.error(x)}},p=async()=>{try{const m=await a.mutateAsync({automation_id:t,type:"webhook"});u(!1),m.webhook?r?.(m.webhook):ve.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(m){const g=m instanceof Error?m.message:l("automations.addStarterPopover.failedAddWebhookStarter");ve.error(g)}};return o.jsxs($t,{open:h,onOpenChange:u,children:[o.jsx(Bt,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(Ut,{size:14}),l("automations.addStarterPopover.addStarter")]})}),o.jsxs(zt,{align:"end",className:"w-[200px]",children:[o.jsxs(rr,{children:[o.jsxs(or,{className:"gap-2.5",children:[o.jsx(gu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),o.jsx(lr,{className:"w-[160px]",children:Hde.map(m=>o.jsxs(Ye,{className:"gap-2.5",onSelect:()=>f(m.cron),disabled:a.isPending,children:[o.jsx(gu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:m.label})]},m.cron))})]}),o.jsxs(Ye,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[o.jsx(gu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),o.jsxs(Ye,{className:"gap-2.5",onSelect:()=>{u(!1),i?.()},children:[o.jsx(br,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),o.jsxs(Ye,{className:"gap-2.5",onSelect:()=>{p()},disabled:a.isPending,children:[o.jsx(zn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function iC(t){const e=z.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,h=re(),[u,f]=P.useState(null),[p,m]=P.useState("curl"),[g,x]=P.useState("header"),b=P.useId();let y;e[0]!==h?(y=async(I,O)=>{try{await navigator.clipboard.writeText(I),f(O),ve.success(h("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ve.error(h("automations.webhookSecretDialog.failedCopy"))}},e[0]=h,e[1]=y):y=e[1];const _=y;let v;e[2]!==g||e[3]!==r||e[4]!==i?(v=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=v):v=e[5];const L=v,S=i&&r?g==="header"?`curl -X POST "${L}" \\
627
+ `)};Dn.prototype.renderPartial=function(e,s,n,i){if(n){var r=this.getConfigTags(i),l=Mx(n)?n(e[1]):n[e[1]];if(l!=null){var a=e[6],c=e[5],d=e[4],h=l;c==0&&d&&(h=this.indentPartial(l,d,a));var u=this.parse(h,r);return this.renderTokens(u,s,n,h,i)}}};Dn.prototype.unescapedValue=function(e,s){var n=s.lookup(e[1]);if(n!=null)return n};Dn.prototype.escapedValue=function(e,s,n){var i=this.getConfigEscape(n)||Mi.escape,r=s.lookup(e[1]);if(r!=null)return typeof r=="number"&&i===Mi.escape?String(r):i(r)};Dn.prototype.rawValue=function(e){return e[1]};Dn.prototype.getConfigTags=function(e){return Vd(e)?e:e&&typeof e=="object"?e.tags:void 0};Dn.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Vd(e))return e.escape};var Mi={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){e0.templateCache=t},get templateCache(){return e0.templateCache}},e0=new Dn;Mi.clearCache=function(){return e0.clearCache()};Mi.parse=function(e,s){return e0.parse(e,s)};Mi.render=function(e,s,n,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Sce(e)+'" was given as the first argument for mustache#render(template, view, partials)');return e0.render(e,s,n,i)};Mi.escape=Ace;Mi.Scanner=I0;Mi.Context=ld;Mi.Writer=Dn;function $ce(t,e){const s={__resolveType:t},n=Lk([s],e)[0];return n?Fie(s,n,e):null}function Bce({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:i,decofile:r,blockKey:l,onSaveReferencedBlock:a}){const c=re(),d=_o(),h=d?.entity?.id===e?d.entity.metadata?.siteSlug??null:null,[u]=P.useState(()=>$ce(l,r)),[f,p]=P.useState(u?.data??{}),[m,g]=P.useState([]),[x,b]=P.useState(0),[y,_]=P.useState(!1),[v,L]=P.useState(null),S=v!==null,{save:w,flush:k}=mx({orgSlug:t,virtualMcpId:e,branch:s}),j=u?.resolveType?Bn(u.resolveType,i):null,C=r[l],N=C?Zl(l,C):l,T=xs()?.taskId??null,V={orgSlug:t,virtualMcpId:e,branch:s,threadId:T,previewUrl:n??void 0,siteSlug:h},A=O=>{p(O),w(l,O)},E=()=>{S?(L(null),_(!1),b(O=>O+1)):L(JSON.stringify(f,null,2))},R=O=>{const F=O??"";try{const M=JSON.parse(F);if(M&&typeof M=="object"&&!Array.isArray(M)){_(!1),A(M);return}_(!0)}catch{_(!0)}},D=[N,...m],I=O=>{g(m.slice(0,O)),b(F=>F+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:D.map((O,F)=>{const M=F===D.length-1,$=Nn(O);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[F>0&&o.jsx(qs,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>I(F),title:$,className:ie("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:$})]},`${$}-${F}`)})}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:S?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:E,"aria-label":c(S?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":S,children:S?o.jsx(Is,{size:14}):o.jsx(ga,{size:14})})}),o.jsx(Ue,{side:"bottom",children:c(S?"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(yl,{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(zi,{schema:j,value:f,onChange:O=>A(O),basePath:"",breadcrumbPath:m,onBreadcrumbChange:g,meta:i,decofile:r,onSaveReferencedBlock:a,sandbox:V},x):o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:c("sandbox.savedSectionEditor.noEditableFields")})})})}),v!==null&&o.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[y&&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(bd,{language:"json",height:"100%",code:v,onChange:R,onSave:O=>{R(O),k()}})})]})]})]})})}function zce(t){const e=z.c(36),{selection:s,orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,isCreating:d,onCreateAvailable:h,onSaveReferencedBlock:u}=t,f=re();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(el,{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 y;e[7]!==s.title?(y=pj(s.title),e[7]=s.title,e[8]=y):y=e[8];let _;e[9]!==h||e[10]!==s.resolveType?(_=(L,S)=>h(s.resolveType,L,S),e[9]=h,e[10]=s.resolveType,e[11]=_):_=e[11];let v;return e[12]!==r||e[13]!==c||e[14]!==d||e[15]!==a||e[16]!==u||e[17]!==n||e[18]!==l||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==y||e[23]!==_||e[24]!==i?(v=o.jsx(_ce,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,resolveType:x,title:b,defaultBlockId:y,isCreating:d,onCreate:_,onSaveReferencedBlock:u},g),e[12]=r,e[13]=c,e[14]=d,e[15]=a,e[16]=u,e[17]=n,e[18]=l,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=y,e[23]=_,e[24]=i,e[25]=v):v=e[25],v}const p=`saved:${s.key}`;let m;return e[26]!==r||e[27]!==c||e[28]!==a||e[29]!==u||e[30]!==n||e[31]!==l||e[32]!==s.key||e[33]!==p||e[34]!==i?(m=o.jsx(Bce,{orgSlug:n,virtualMcpId:i,branch:r,previewUrl:l,meta:a,decofile:c,blockKey:s.key,onSaveReferencedBlock:u},p),e[26]=r,e[27]=c,e[28]=a,e[29]=u,e[30]=n,e[31]=l,e[32]=s.key,e[33]=p,e[34]=i,e[35]=m):m=e[35],m}const Uv="__all__",Hv={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},Fce={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},Hh={published:"sandbox.postToolbar.statusPublished",scheduled:"sandbox.postToolbar.statusScheduled",draft:"sandbox.postToolbar.statusDraft"},Kv="status:";function Wv(t){if(!t.startsWith(Kv))return null;const e=t.slice(Kv.length);return e in Hh?e:null}const qv=P.forwardRef(function(e,s){const n=z.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 h;n[6]!==l||n[7]!==d?(h=ie("h-7 gap-1 px-1.5 text-xs",d,l),n[6]=l,n[7]=d,n[8]=h):h=n[8];let u;n[9]!==i?(u=o.jsx(i,{size:14,className:"shrink-0"}),n[9]=i,n[10]=u):u=n[10];let f;n[11]!==c?(f=c&&o.jsx("span",{className:"min-w-0 flex-1 truncate",children:c}),n[11]=c,n[12]=f):f=n[12];let p;n[13]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Gt,{size:12,className:"shrink-0 opacity-60"}),n[13]=p):p=n[13];let m;return n[14]!==a||n[15]!==s||n[16]!==h||n[17]!==u||n[18]!==f?(m=o.jsxs(me,{ref:s,type:"button",variant:"ghost",size:"sm",className:h,...a,children:[u,f,p]}),n[14]=a,n[15]=s,n[16]=h,n[17]=u,n[18]=f,n[19]=m):m=n[19],m});function Ox(t){const e=z.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 Uce(t){const e=z.c(101),{categories:s,authors:n,statusCounts:i,categoryFilter:r,authorFilter:l,statusFilter:a,sort:c,onCategoryFilterChange:d,onAuthorFilterChange:h,onStatusFilterChange:u,onSortChange:f}=t,p=re();let m;if(e[0]!==s||e[1]!==r){let ee;e[3]!==r?(ee=he=>he.slug===r,e[3]=r,e[4]=ee):ee=e[4],m=s.find(ee),e[0]=s,e[1]=r,e[2]=m}else m=e[2];const g=m;let x;if(e[5]!==l||e[6]!==n){let ee;e[8]!==l?(ee=he=>he.email===l,e[8]=l,e[9]=ee):ee=e[9],x=n.find(ee),e[5]=l,e[6]=n,e[7]=x}else x=e[7];const b=x,y=!!(r||l||a);let _;e[10]!==b?.name||e[11]!==g?.name||e[12]!==a||e[13]!==p?(_=g?.name??b?.name??p(a?Hh[a]:"sandbox.postToolbar.filterLabel"),e[10]=b?.name,e[11]=g?.name,e[12]=a,e[13]=p,e[14]=_):_=e[14];const v=_,L=r?`cat:${r}`:l?`author:${l}`:a?`status:${a}`:Uv;let S;e[15]!==h||e[16]!==d||e[17]!==u?(S=()=>{d(null),h(null),u(null)},e[15]=h,e[16]=d,e[17]=u,e[18]=S):S=e[18];const w=S;let k;e[19]!==w||e[20]!==h||e[21]!==d||e[22]!==u?(k=ee=>{ee.startsWith("cat:")?(h(null),u(null),d(ee.slice(4))):ee.startsWith("author:")?(d(null),u(null),h(ee.slice(7))):Wv(ee)?(d(null),h(null),u(Wv(ee))):w()},e[19]=w,e[20]=h,e[21]=d,e[22]=u,e[23]=k):k=e[23];const j=k;let C;e[24]!==v||e[25]!==y?(C=o.jsx(Bt,{asChild:!0,children:o.jsx(qv,{icon:YA,active:y,value:v,className:"min-w-0 shrink"})}),e[24]=v,e[25]=y,e[26]=C):C=e[26];let N;e[27]!==p?(N=p("sandbox.postToolbar.filterBy"),e[27]=p,e[28]=N):N=e[28];let T;e[29]!==N?(T=o.jsx(Md,{children:N}),e[29]=N,e[30]=T):T=e[30];let V;e[31]!==p?(V=p("sandbox.postToolbar.allPosts"),e[31]=p,e[32]=V):V=e[32];let A;e[33]!==V?(A=o.jsx(Yn,{value:Uv,children:V}),e[33]=V,e[34]=A):A=e[34];let E;e[35]!==p?(E=p("sandbox.postToolbar.statusLabel"),e[35]=p,e[36]=E):E=e[36];let R;e[37]!==E?(R=o.jsx(Md,{className:"text-muted-foreground/70",children:E}),e[37]=E,e[38]=R):R=e[38];let D;e[39]===Symbol.for("react.memo_cache_sentinel")?(D=Object.keys(Hh),e[39]=D):D=e[39];let I;e[40]!==i||e[41]!==p?(I=D.map(ee=>o.jsxs(Yn,{value:`status:${ee}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:p(Hh[ee])}),o.jsx(Ox,{count:i[ee]})]},`status:${ee}`)),e[40]=i,e[41]=p,e[42]=I):I=e[42];let O;e[43]!==s.length||e[44]!==p?(O=s.length>0&&o.jsx(Md,{className:"text-muted-foreground/70",children:p("sandbox.postToolbar.categoryLabel")}),e[43]=s.length,e[44]=p,e[45]=O):O=e[45];let F;e[46]!==s?(F=s.map(Kce),e[46]=s,e[47]=F):F=e[47];let M;e[48]!==n.length||e[49]!==p?(M=n.length>0&&o.jsx(Md,{className:"text-muted-foreground/70",children:p("sandbox.postToolbar.authorLabel")}),e[48]=n.length,e[49]=p,e[50]=M):M=e[50];let $;e[51]!==n?($=n.map(Hce),e[51]=n,e[52]=$):$=e[52];let B;e[53]!==L||e[54]!==j||e[55]!==A||e[56]!==R||e[57]!==I||e[58]!==O||e[59]!==F||e[60]!==M||e[61]!==$?(B=o.jsxs(Xc,{value:L,onValueChange:j,children:[A,R,I,O,F,M,$]}),e[53]=L,e[54]=j,e[55]=A,e[56]=R,e[57]=I,e[58]=O,e[59]=F,e[60]=M,e[61]=$,e[62]=B):B=e[62];let U;e[63]!==B||e[64]!==T?(U=o.jsxs(zt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[T,B]}),e[63]=B,e[64]=T,e[65]=U):U=e[65];let H;e[66]!==U||e[67]!==C?(H=o.jsxs($t,{children:[C,U]}),e[66]=U,e[67]=C,e[68]=H):H=e[68];let W;e[69]!==w||e[70]!==y||e[71]!==p?(W=y&&o.jsx(Wce,{label:p("sandbox.postToolbar.clearFilter"),onClick:w}),e[69]=w,e[70]=y,e[71]=p,e[72]=W):W=e[72];const K=Fce[c];let G;e[73]!==p||e[74]!==K?(G=p(K),e[73]=p,e[74]=K,e[75]=G):G=e[75];let Y;e[76]!==G?(Y=o.jsx(Bt,{asChild:!0,children:o.jsx(qv,{icon:JA,active:!0,value:G})}),e[76]=G,e[77]=Y):Y=e[77];let X;e[78]!==p?(X=p("sandbox.postToolbar.sortBy"),e[78]=p,e[79]=X):X=e[79];let te;e[80]!==X?(te=o.jsx(Md,{children:X}),e[80]=X,e[81]=te):te=e[81];let se;e[82]!==f?(se=ee=>f(ee),e[82]=f,e[83]=se):se=e[83];let ne;e[84]===Symbol.for("react.memo_cache_sentinel")?(ne=Object.keys(Hv),e[84]=ne):ne=e[84];let Q;e[85]!==p?(Q=ne.map(ee=>o.jsx(Yn,{value:ee,children:p(Hv[ee])},ee)),e[85]=p,e[86]=Q):Q=e[86];let q;e[87]!==c||e[88]!==se||e[89]!==Q?(q=o.jsx(Xc,{value:c,onValueChange:se,children:Q}),e[87]=c,e[88]=se,e[89]=Q,e[90]=q):q=e[90];let le;e[91]!==te||e[92]!==q?(le=o.jsxs(zt,{align:"end",className:"w-44",children:[te,q]}),e[91]=te,e[92]=q,e[93]=le):le=e[93];let J;e[94]!==Y||e[95]!==le?(J=o.jsx("div",{className:"ml-auto shrink-0",children:o.jsxs($t,{children:[Y,le]})}),e[94]=Y,e[95]=le,e[96]=J):J=e[96];let oe;return e[97]!==H||e[98]!==W||e[99]!==J?(oe=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]=oe):oe=e[100],oe}function Hce(t){return o.jsxs(Yn,{value:`author:${t.email}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Ox,{count:t.count})]},`author:${t.email}`)}function Kce(t){return o.jsxs(Yn,{value:`cat:${t.slug}`,children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),o.jsx(Ox,{count:t.count})]},`cat:${t.slug}`)}function Wce(t){const e=z.c(4),{label:s,onClick:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Is,{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 qce(t){const e=z.c(18),{checked:s,disabled:n,onToggle:i}=t,r=re();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(Fe,{asChild:!0,children:o.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Gce,children:o.jsx(gd,{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 h;e[13]!==d?(h=o.jsx(Ue,{side:"bottom",children:d}),e[13]=d,e[14]=h):h=e[14];let u;return e[15]!==c||e[16]!==h?(u=o.jsxs(He,{children:[c,h]}),e[15]=c,e[16]=h,e[17]=u):u=e[17],u}function Gce(t){return t.stopPropagation()}function Yce(t){const e=z.c(42),{count:s,allSelected:n,onToggleSelectAll:i,onDelete:r,onExit:l}=t,a=re();let c;e[0]!==n||e[1]!==i?(c=o.jsx(qce,{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 h;e[6]!==d?(h=o.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=h):h=e[7];const u=s===0;let f;e[8]!==a?(f=a("sandbox.postToolbar.deleteSelectedPosts"),e[8]=a,e[9]=f):f=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(Gs,{size:14}),e[10]=p):p=e[10];let m;e[11]!==r||e[12]!==u||e[13]!==f?(m=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:u,onClick:r,"aria-label":f,children:p})}),e[11]=r,e[12]=u,e[13]=f,e[14]=m):m=e[14];let g;e[15]!==a?(g=a("sandbox.postToolbar.deleteSelected"),e[15]=a,e[16]=g):g=e[16];let x;e[17]!==g?(x=o.jsx(Ue,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let b;e[19]!==m||e[20]!==x?(b=o.jsxs(He,{children:[m,x]}),e[19]=m,e[20]=x,e[21]=b):b=e[21];let y;e[22]!==a?(y=a("sandbox.postToolbar.exitSelection"),e[22]=a,e[23]=y):y=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Is,{size:14}),e[24]=_):_=e[24];let v;e[25]!==l||e[26]!==y?(v=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":y,children:_})}),e[25]=l,e[26]=y,e[27]=v):v=e[27];let L;e[28]!==a?(L=a("sandbox.postToolbar.exitSelection"),e[28]=a,e[29]=L):L=e[29];let S;e[30]!==L?(S=o.jsx(Ue,{side:"bottom",children:L}),e[30]=L,e[31]=S):S=e[31];let w;e[32]!==v||e[33]!==S?(w=o.jsxs(He,{children:[v,S]}),e[32]=v,e[33]=S,e[34]=w):w=e[34];let k;e[35]!==b||e[36]!==w?(k=o.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[b,w]}),e[35]=b,e[36]=w,e[37]=k):k=e[37];let j;return e[38]!==c||e[39]!==k||e[40]!==h?(j=o.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[c,h,k]}),e[38]=c,e[39]=k,e[40]=h,e[41]=j):j=e[41],j}function qd(t){const e=z.c(34),{onDuplicate:s,onRename:n,onAddVariant:i,onEditSeo:r,onViewJson:l,onDelete:a}=t,c=re();let d;e[0]!==c?(d=c("sandbox.itemActions.moreActions"),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Qn,{size:14}),e[2]=h):h=e[2];let u;e[3]!==d?(u=o.jsx(Bt,{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:Jce,children:h})}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==n||e[6]!==c?(f=n&&o.jsxs(Ye,{onClick:n,children:[o.jsx(P9,{size:14}),c("sandbox.itemActions.rename")]}),e[5]=n,e[6]=c,e[7]=f):f=e[7];let p;e[8]!==s||e[9]!==c?(p=s&&o.jsxs(Ye,{onClick:s,children:[o.jsx(dn,{size:14}),c("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=c,e[10]=p):p=e[10];let m;e[11]!==i||e[12]!==c?(m=i&&o.jsxs(o.Fragment,{children:[o.jsx(Qr,{}),o.jsxs(Ye,{onClick:i,className:"cursor-pointer text-success focus:text-success",children:[o.jsx(f0,{size:14}),c("sandbox.itemActions.addVariant")]})]}),e[11]=i,e[12]=c,e[13]=m):m=e[13];let g;e[14]!==r||e[15]!==l||e[16]!==c?(g=(r||l)&&o.jsxs(o.Fragment,{children:[o.jsx(Qr,{}),r&&o.jsxs(Ye,{onClick:r,children:[o.jsx(pg,{size:14}),c("sandbox.itemActions.editSeo")]}),l&&o.jsxs(Ye,{onClick:l,children:[o.jsx(ga,{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(Qr,{}),e[18]=x):x=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Gs,{size:14}),e[19]=b):b=e[19];let y;e[20]!==c?(y=c("sandbox.itemActions.delete"),e[20]=c,e[21]=y):y=e[21];let _;e[22]!==a||e[23]!==y?(_=o.jsxs(Ye,{onClick:a,className:"text-destructive focus:text-destructive",children:[b,y]}),e[22]=a,e[23]=y,e[24]=_):_=e[24];let v;e[25]!==_||e[26]!==f||e[27]!==p||e[28]!==m||e[29]!==g?(v=o.jsxs(zt,{align:"end",className:"w-44",children:[f,p,m,g,x,_]}),e[25]=_,e[26]=f,e[27]=p,e[28]=m,e[29]=g,e[30]=v):v=e[30];let L;return e[31]!==v||e[32]!==u?(L=o.jsxs($t,{children:[u,v]}),e[31]=v,e[32]=u,e[33]=L):L=e[33],L}function Jce(t){return t.stopPropagation()}function Qce(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function Xce(t){const e=new Map;for(const s of t){const n=Qce(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 Gv(t){const e=z.c(8),{icon:s,label:n,className:i}=t;let r;e[0]!==i?(r=ie("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 Yv=P.lazy(()=>$s(()=>import("./app-editor-CKOBupDJ.js"),__vite__mapDeps([169,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,42,78,79,28,44,85,29,30,31,32,33,34,35,36,37,38,39,40,41,43,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,80,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,83,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,81,148,149,150,151,152,153,154,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.AppEditor}))),Zce=P.lazy(()=>$s(()=>import("./post-editor-BPKO1Xmm.js"),__vite__mapDeps([170,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,30,59,29,31,32,33,34,35,36,37,38,39,40,41,28,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,80,83,171,143,145,159,160,132,119,84,140,172,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,173,174,116,117,118,79,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,141,142,144,146,147,81,148,149,150,151,152,153,154,78,155,156,157,158,161,162,163,164,165,166,167])).then(t=>({default:t.PostEditor}))),ede=P.lazy(()=>$s(()=>import("./record-editor-CUEBm5uF.js"),__vite__mapDeps([175,1,2,80,83,79,8,28,44,140,173,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,45,46,9,47,10,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,174,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,141,142,143,144,145,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.RecordEditor}))),tde=P.lazy(()=>$s(()=>import("./category-editor-CeGZPq10.js"),__vite__mapDeps([176,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,36,39,59,29,30,31,32,33,34,35,37,38,40,41,28,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,123,80,83,172,159,160,132,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,173,174,116,117,118,79,119,120,121,122,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,161,162,163,164,165,166,167])).then(t=>({default:t.CategoryEditor}))),sde=P.lazy(()=>$s(()=>import("./bulk-category-panel-Bs99v8a6.js"),__vite__mapDeps([177,1,2,39,83,178,45,79,8,28,44])).then(t=>({default:t.BulkCategoryPanel}))),nde=P.lazy(()=>$s(()=>import("./sections-editor-DUyabDLF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SectionsEditor}))),ide=P.lazy(()=>$s(()=>import("./seo-editor-nln9KG1F.js"),__vite__mapDeps([179,1,2,42,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,43,44,45,46,9,47,10,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,82,83,84,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,80,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,81,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.SeoEditor}))),rde=P.lazy(()=>$s(()=>import("./variant-calendar-DNADnJDP.js"),__vite__mapDeps([180,1,2,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,83,78,79,84,181,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,80,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,81,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.VariantCalendar}))),ode=P.lazy(()=>$s(()=>import("./post-calendar-nMyVgAGR.js"),__vite__mapDeps([182,1,2,30,29,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,183,78,79,3,4,5,6,7,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,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,83,80,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,81,148,149,150,151,152,153,154,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.PostCalendar}))),lde=P.lazy(()=>$s(()=>import("./redirect-editor-DEIkb4ZD.js"),__vite__mapDeps([184,1,2,145,8,80,83,79,28,44,174,33,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,86,29,30,31,32,34,35,36,37,38,39,40,41,42,43,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,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,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.RedirectEditor})));function ade(t){const e=z.c(20),{deepLinkPage:s}=t,n=_o(),{currentBranch:i}=rn(),{org:r}=Be(),l=n?.entity?.id??null,a=Zn(),c=Ll(),{runtime:d,previewServerUrl:h}=En(l),u=d==="cms";let f;e[0]!==u||e[1]!==c.previewState||e[2]!==a.lifecycle.phase?(f=yae({fastPreviewActive:u,previewState:c.previewState,lifecyclePhase:a.lifecycle.phase}),e[0]=u,e[1]=c.previewState,e[2]=a.lifecycle.phase,e[3]=f):f=e[3];const p=f;if(p.kind==="sandbox-card"){const x=`/${r.slug}/settings/connections`;let b;return e[4]!==p.state||e[5]!==c.start||e[6]!==x||e[7]!==a.lifecycle||e[8]!==a.phase?(b=o.jsx(bae,{state:p.state,claimPhase:a.phase,lifecycle:a.lifecycle,onStart:c.start,connectionsHref:x}),e[4]=p.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(el,{title:"Waiting for sandbox context…"}),e[10]=x):x=e[10],x}const m=u?h:c.previewUrl;let g;return e[11]!==i||e[12]!==s||e[13]!==p.devServerReady||e[14]!==p.sandboxWarming||e[15]!==c.previewUrl||e[16]!==r.slug||e[17]!==m||e[18]!==l?(g=o.jsx(dde,{orgSlug:r.slug,virtualMcpId:l,branch:i,previewUrl:c.previewUrl,sitePreviewUrl:m,deepLinkPage:s,devServerReady:p.devServerReady,sandboxWarming:p.sandboxWarming}),e[11]=i,e[12]=s,e[13]=p.devServerReady,e[14]=p.sandboxWarming,e[15]=c.previewUrl,e[16]=r.slug,e[17]=m,e[18]=l,e[19]=g):g=e[19],g}const Jv=2e3,cde=15;function Qv(t,e,s,n){return typeof e!="string"||s&&(Uj(e,s,n)||t.state.dataUpdateCount>=cde)?!1:Jv}function dde({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,sitePreviewUrl:i,deepLinkPage:r,devServerReady:l,sandboxWarming:a}){const c=re(),d=xs()?.taskId??null,h=bs(e),u=Jg(h,s),f=vd(h)&&u,p={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:n},{data:m,isLoading:g}=k0(p,{fetchEnabled:l}),[x,b]=P.useState("pages"),[y,_]=P.useState(null),[v,L]=P.useState(null),S=!!(r?.pageId||r?.path||r?.pathTemplate),[w,k]=P.useState(!1);if(S&&!w&&y===null&&m){k(!0);const ce=kz(pf(m),r??{});ce&&(b("pages"),_({collection:"pages",key:ce.key,path:ce.path}))}const[j,C]=P.useState(""),[N,T]=P.useState(null),[V,A]=P.useState(null),[E,R]=P.useState(null),[D,I]=P.useState("date-desc"),[O,F]=P.useState(()=>new Set),[M,$]=P.useState(null),B=()=>{F(new Set),$(null)},U=ce=>{_(ce),L(null)},[H,W]=P.useState(x);H!==x&&(W(x),C(""),T(null),A(null),R(null),I("date-desc"),F(new Set),$(null));const{data:K,isLoading:G,isFetching:Y}=B9(p,{fetchEnabled:l,refetchInterval:ce=>{const Se=ce.state.data;if(x==="apps"&&y&&y.collection==="apps"){const Ee=m?.[y.key];return Qv(ce,typeof Ee?.__resolveType=="string"?Ee.__resolveType:void 0,Se)}if(x==="site"&&m){const Ee=Se?xp(m,Se):null,je=m.site,Xe=Ee?.resolveType??(typeof je?.__resolveType=="string"?je.__resolveType:void 0);return Qv(ce,Xe,Se,["seo"])}return!1}}),X=(ce,Se)=>!Uj(ce,K,Se)&&(G||Y),{catalog:te,isLoading:se}=gae(K??void 0,m??void 0,{enabled:x==="apps"}),ne=ice({orgSlug:t,virtualMcpId:e,branch:s,meta:K}),Q=D0(p),q=lae(p),[le,J]=P.useState(null),[oe,ee]=P.useState(),[he,ae]=P.useState(null),[de,ue]=P.useState(null),[pe,Z]=P.useState(null),ge=!m||!K;if(g||G||ge&&a)return o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})});if(ge)return o.jsx(el,{title:"Could not load site data."});const be=pf(m).sort((ce,Se)=>ce.name.localeCompare(Se.name)),ke=mL(m).sort((ce,Se)=>ce.from.localeCompare(Se.from)),we=S3(m,K),Le=x==="sections"?gz(K):[],_e=xp(m,K),Ce=Gj(m),xe=Dx.some(ce=>Ce[ce].length>0),Ne=Nu(x)?Ce[x]:[],Te=(xe?Zu(m,"categories"):[]).map(({key:ce,payload:Se})=>{const Ee=typeof Se.slug=="string"?Se.slug:"",je=typeof Se.name=="string"?Se.name:"";return{slug:Ee||ce,name:je||Ee||ce}}).filter(ce=>ce.slug).sort((ce,Se)=>ce.name.localeCompare(Se.name)),Me=x==="posts"&&(O.size>0||M!==null),Qe=Me?Xj(m).filter(ce=>O.has(ce.key)):[],We=nv(K,"loaders"),Ve=nv(K,"actions");if(!U9(m,K)&&!xe&&We===0&&Ve===0)return o.jsx(el,{icon:vn,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const De={pages:be.length,sections:we.length,apps:te.length,loaders:We,actions:Ve,redirects:ke.length,posts:Ce.posts.length,authors:Ce.authors.length,categories:Ce.categories.length},ot=new Set(be.map(ce=>il(ce.path))),st=new Set(be.map(ce=>ce.name)),Ze=new Set(we.map(ce=>ce.name)),lt=async ce=>{const Se=m[ce.key];if(!Se)return;const Ee=jk(m,ce.key),je=Ck(m,ce.key,Math.max(0,Ee-1)),Xe=_se(Se.sections,je);if(Xe)try{await Q.mutateAsync({blockKey:ce.key,data:{...Se,sections:Xe}}),ve.success(`Variant added to "${ce.name}"`),_({collection:"pages",key:ce.key,path:ce.path})}catch(Ke){ve.error(Ke instanceof Error?Ke.message:"Could not add variant")}},_t=()=>{ee(void 0),J({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},it=ce=>{ee(void 0),J({mode:"duplicate",sourceKey:ce.key,initialName:Rv(st,ce.name),initialPath:_ae(ot,ce.path)})},at=ce=>{ee(void 0),J({mode:"rename",sourceKey:ce.key,initialName:ce.name,initialPath:ce.path})},Ie=async ce=>{if(!le)return;const{mode:Se,sourceKey:Ee}=le;try{if(Se==="create"){let je;if(ce.templateKey){const Ke=m[ce.templateKey];if(!Ke)throw new Error("Selected template no longer exists.");je={...Ke,name:ce.name,path:ce.path}}else je=Sae(ce.name,ce.path);const Xe=jae(m,ce.name);await Q.mutateAsync({blockKey:Xe,data:je}),ve.success(`Created "${ce.name}"`),_({collection:"pages",key:Xe,path:ce.path})}else if(Se==="duplicate"&&Ee){const je=m[Ee];if(!je)throw new Error("Source page not found");const{key:Xe,data:Ke}=wae({source:je,pages:be,newName:ce.name,newPath:ce.path});await Q.mutateAsync({blockKey:Xe,data:Ke}),ve.success(`Duplicated as "${ce.name}"`),_({collection:"pages",key:Xe,path:ce.path})}else if(Se==="rename"&&Ee){const je=m[Ee];if(!je)throw new Error("Page not found");const Xe={...je,name:ce.name,path:ce.path};await Q.mutateAsync({blockKey:Ee,data:Xe}),ve.success("Page updated"),y?.collection==="pages"&&y.key===Ee&&_({collection:"pages",key:Ee,path:ce.path})}J(null)}catch(je){ee(je instanceof Error?je.message:"Save failed")}},xt=({path:ce})=>{if(!le)return null;const Se=il(ce);return(le.mode==="rename"?il(le.initialPath):null)!==Se&&ot.has(Se)?`A page with path "${ce}" already exists.`:null},fe=async(ce,Se,Ee)=>{await Q.mutateAsync({blockKey:Se,data:{...Ee,name:Se,__resolveType:ce}}),ve.success(c("sandbox.contentBrowser.createdSection",{name:Se})),_({collection:"sections",key:Se})},Oe=yx((ce,Se)=>Q.mutate({blockKey:ce,data:Se})),tt=async ce=>{const Se=m[ce.key];if(!Se){ve.error(c("sandbox.contentBrowser.sectionNotFound"));return}const Ee=Lae(m,ce.key),je=Rv(Ze,ce.name),Xe={...Se,name:je};try{await Q.mutateAsync({blockKey:Ee,data:Xe}),ve.success(c("sandbox.contentBrowser.duplicatedSection",{name:ce.name})),_({collection:"sections",key:Ee})}catch(Ke){ve.error(Ke instanceof Error?Ke.message:c("sandbox.contentBrowser.duplicateFailed"))}},ht=async ce=>{if(!he)return;const Se=m[he];if(!Se){ve.error(c("sandbox.contentBrowser.sectionNotFound"));return}try{await Q.mutateAsync({blockKey:he,data:{...Se,name:ce}}),ve.success(c("sandbox.contentBrowser.sectionRenamed")),ae(null)}catch(Ee){ve.error(Ee instanceof Error?Ee.message:c("sandbox.contentBrowser.renameFailed"))}},dt=async()=>{const ce="/redirect-from",Se=Sz(m,ce),Ee=_z({from:ce,to:"/redirect-to",type:"temporary",discardQueryParameters:!1});try{await Q.mutateAsync({blockKey:Se,data:Ee}),ve.success("Created redirect"),_({collection:"redirects",key:Se})}catch(je){ve.error(je instanceof Error?je.message:"Could not create redirect")}},Vt=async ce=>{const Se=ym(m,ce),Ee=kc(Se,ce,Zj(ce));try{await Q.mutateAsync({blockKey:Se,data:Ee}),ve.success(`Created ${Cu[ce]}`),_({collection:ce,key:Se})}catch(je){ve.error(je instanceof Error?je.message:"Could not create")}},rt=async ce=>{const Se=ym(m,"posts"),Ee=kc(Se,"posts",Yae(ce));try{await Q.mutateAsync({blockKey:Se,data:Ee}),ve.success(c("sandbox.postCalendar.createdScheduledPost")),b("posts"),W("posts"),_({collection:"posts",key:Se}),L(null)}catch(je){ve.error(je instanceof Error?je.message:c("sandbox.postCalendar.couldNotCreate"))}},bt=async(ce,Se)=>{const Ee=m[ce],je=Ee?Qae(au(Ee,"posts"),Se):null;if(!je){ve.error(c("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await Q.mutateAsync({blockKey:ce,data:kc(ce,"posts",je)})}catch(Xe){ve.error(Xe instanceof Error?Xe.message:c("sandbox.postCalendar.couldNotReschedule"))}},et=async ce=>{const Se=m[ce.key];if(!Se){ve.error("Record not found.");return}const Ee=ym(m,ce.kind),je=ce.kind==="posts"?"title":"name",Xe={...structuredClone(au(Se,ce.kind)),[je]:`${ce.label} (copy)`};try{await Q.mutateAsync({blockKey:Ee,data:kc(Ee,ce.kind,Xe)}),ve.success(`Duplicated "${ce.label}"`),_({collection:ce.kind,key:Ee})}catch(Ke){ve.error(Ke instanceof Error?Ke.message:"Duplicate failed")}},yt=ce=>{F(Se=>{const Ee=new Set(Se);return Ee.has(ce)?Ee.delete(ce):Ee.add(ce),Ee})},ft=ce=>{b("posts"),W("posts"),_(null),L(null),C(""),T(null),A(null),R(null),I("date-desc"),F(new Set),$(ce||null)},nt=async(ce,Se)=>{const Ee=[...O];let je=0;for(const Xe of Ee){const Ke=m[Xe],vs=au(Ke,"posts"),fn=ce==="add"?$ae(vs,Se):Bae(vs,Se);fn!==vs&&(await Q.mutateAsync({blockKey:Xe,data:kc(Xe,"posts",Iv(fn))}),je+=1)}return je},vt=async(ce,Se)=>{const Ee=O.size;try{const je=await nt(ce,Se),Xe=ce==="add"?"Added to":"Moved",Ke=Ee-je;ve.success(`${Xe} ${je} ${je===1?"post":"posts"}`+(Ke>0?` (${Ke} already set)`:"")),B()}catch(je){ve.error(je instanceof Error?je.message:"Bulk update failed")}},mt=async()=>{if(de)try{if(de.kind==="blog-bulk"){for(const je of de.keys)await q.mutateAsync({blockKey:je});ve.success(`Deleted ${de.count} ${de.count===1?"post":"posts"}`),y&&y.collection!=="available-section"&&de.keys.includes(y.key)&&_(null),B(),ue(null);return}const{kind:ce,key:Se,label:Ee}=de;if(ce==="blog"){if(de.blogKind==="categories"){const je=au(m[Se],"categories").slug,Xe=typeof je=="string"?je:"";if(Xe)for(const{key:Ke,payload:vs}of Zu(m,"posts")){const fn=zae(vs,Xe);fn!==vs&&await Q.mutateAsync({blockKey:Ke,data:kc(Ke,"posts",Iv(fn))})}}await q.mutateAsync({blockKey:Se})}else await q.mutateAsync({blockKey:Se});ve.success(`Deleted "${Ee}"`),y&&y.collection!=="available-section"&&y.key===Se&&_(null),ue(null)}catch(ce){ve.error(ce instanceof Error?ce.message:"Delete failed")}},Lt=q.isPending||Q.isPending,Mt=de?.kind==="blog"?Cu[de.blogKind]:de?.kind==="blog-bulk"?`${de.count} ${de.count===1?"post":"posts"}`:de?.kind??"item";return o.jsxs("div",{className:"flex h-full w-full",children:[o.jsx(xae,{active:x,counts:De,showBlog:xe,onSelect:ce=>{b(ce),_(null),L(null)}}),x!=="seo"&&x!=="site"&&x!=="calendar"&&x!=="post-schedule"&&x!=="loaders"&&x!=="actions"&&o.jsx(ude,{activeCollection:x,pages:be,redirects:ke,sections:we,availableSections:Le,appCatalog:te,appCatalogLoading:se,blogEntries:Ne,decofile:m,searchQuery:j,onSearchChange:C,postCategoryFilter:N,postAuthorFilter:V,postStatusFilter:E,postSort:D,onPostCategoryFilterChange:ce=>{T(ce),F(new Set)},onPostAuthorFilterChange:ce=>{A(ce),F(new Set)},onPostStatusFilterChange:ce=>{R(ce),F(new Set)},onPostSortChange:I,selectedPostKeys:O,postBulkPanelOpen:Me,onTogglePostSelect:yt,onSelectAllPosts:ce=>F(new Set(ce)),onClearPostSelection:()=>F(new Set),onExitPostSelection:B,onBulkDeletePosts:()=>ue({kind:"blog-bulk",keys:[...O],count:O.size}),selection:y,onSelect:U,onCreate:()=>{x==="pages"?_t():x==="redirects"?dt():Nu(x)&&Vt(x)},onDuplicatePage:it,onRenamePage:at,onAddPageVariant:lt,onDeletePage:ce=>ue({kind:"page",key:ce.key,label:ce.name}),onEditPageSeo:ce=>{const Se={collection:"pages",key:ce.key,path:ce.path};_(Se),L(ce.key)},onViewPageJson:ce=>Z(ce.key),onDuplicateSection:tt,onRenameSection:ce=>ae(ce.key),onDeleteSection:ce=>ue({kind:"section",key:ce.key,label:ce.name}),onDeleteRedirect:ce=>ue({kind:"redirect",key:ce.key,label:ce.from||ce.key}),onDuplicateBlog:et,onDeleteBlog:ce=>ue({kind:"blog",blogKind:ce.kind,key:ce.key,label:ce.label})}),o.jsx(Gk,{readOnly:f,className:"flex-1 min-w-0",children:x==="loaders"||x==="actions"?o.jsx(uce,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:K,decofile:m,kind:x}):o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx(ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:x==="calendar"?o.jsx(rde,{decofile:m}):x==="post-schedule"?o.jsx(ode,{decofile:m,support:ne,isCreating:Q.isPending,onCreate:ce=>{rt(ce)},onReschedule:(ce,Se)=>{bt(ce,Se)},onSelect:ce=>{b("posts"),W("posts"),_({collection:"posts",key:ce}),L(null)}}):x==="site"?_e?o.jsx(Yv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:_e.key,block:m[_e.key],decofile:m,meta:K,title:"Site",excludeFields:["seo"],schemaPending:X(_e.resolveType,["seo"]),previewBaseUrl:n},`site:${_e.key}`):o.jsx(el,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):x==="seo"?o.jsx(ide,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,meta:K,target:{kind:"site"},previewBaseUrl:i}):x==="sections"?o.jsx(zce,{selection:y?.collection==="sections"||y?.collection==="available-section"?y:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:n,meta:K,decofile:m,isCreating:Q.isPending,onCreateAvailable:fe,onSaveReferencedBlock:Oe}):Me?o.jsx(sde,{posts:Qe,categories:Te,initialSlug:M,isPending:Q.isPending,onApply:(ce,Se)=>{vt(ce,Se)},onClose:B},M??"selection"):y&&y.collection!=="available-section"?y.collection==="apps"?o.jsx(Yv,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:m[y.key],decofile:m,meta:K,previewBaseUrl:n,schemaPending:X(typeof m[y.key]?.__resolveType=="string"?String(m[y.key].__resolveType):void 0)},`app:${y.key}`):y.collection==="posts"?o.jsx(Zce,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:m[y.key],decofile:m,meta:K,previewBaseUrl:i},`post:${y.key}`):y.collection==="categories"?o.jsx(tde,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:m[y.key],decofile:m,meta:K,onManagePosts:ft,onOpenPost:ce=>{b("posts"),W("posts"),_({collection:"posts",key:ce}),L(null)},previewBaseUrl:i},`category:${y.key}`):y.collection==="authors"?o.jsx(ede,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:y.key,block:m[y.key]},`authors:${y.key}`):y.collection==="redirects"?o.jsx(lde,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:y.key,block:m[y.key]},`redirect:${y.key}`):o.jsx(nde,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:n??void 0,currentPath:y.collection==="pages"?y.path:"/",activePageBlockKey:y.collection==="pages"?y.key:null,activeGlobalBlockKey:y.collection==="sections"?y.key:null,initialEditSeo:y.collection==="pages"&&v===y.key,onExitSeo:()=>L(null)},y.collection==="pages"?`page:${y.key}`:`section:${y.key}`):o.jsx(el,{title:`Select ${Nu(x)?`a ${Cu[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.'})})}),le&&o.jsx(Vae,{open:!!le,mode:le.mode,initialName:le.initialName,initialPath:le.initialPath,isPending:Q.isPending,error:oe,templates:be,validate:xt,onSubmit:Ie,onOpenChange:ce=>{ce||(J(null),ee(void 0))}}),he&&o.jsx(Aae,{open:!!he,blockKey:he,initialName:we.find(ce=>ce.key===he)?.name??he,isPending:Q.isPending,onSubmit:ht,onOpenChange:ce=>{ce||ae(null)}}),pe&&o.jsx(rce,{open:!!pe,onOpenChange:ce=>{ce||Z(null)},pageKey:pe,decofile:m,onSave:ce=>Q.mutateAsync({blockKey:pe,data:ce})}),o.jsx(no,{open:!!de,onOpenChange:ce=>{!ce&&!Lt&&ue(null)},children:o.jsxs(io,{children:[o.jsxs(ro,{children:[o.jsx(oo,{children:`Delete ${Mt}?`}),o.jsx(lo,{children:de?.kind==="section"?`"${de.label}" will be removed. Pages that still reference it will lose this section.`:de?.kind==="blog-bulk"?`${de.count} ${de.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:de?`"${de.label}" will be removed permanently. This can't be undone.`:null})]}),o.jsxs(ao,{children:[o.jsx(co,{disabled:Lt,children:"Cancel"}),o.jsx(uo,{onClick:ce=>{ce.preventDefault(),mt()},disabled:Lt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Lt?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function ude(t){const e=z.c(82),{activeCollection:s,pages:n,redirects:i,sections:r,availableSections:l,appCatalog:a,appCatalogLoading:c,blogEntries:d,decofile:h,searchQuery:u,onSearchChange:f,postCategoryFilter:p,postAuthorFilter:m,postStatusFilter:g,postSort:x,onPostCategoryFilterChange:b,onPostAuthorFilterChange:y,onPostStatusFilterChange:_,onPostSortChange:v,selectedPostKeys:L,postBulkPanelOpen:S,onTogglePostSelect:w,onSelectAllPosts:k,onClearPostSelection:j,onExitPostSelection:C,onBulkDeletePosts:N,selection:T,onSelect:V,onCreate:A,onDuplicatePage:E,onRenamePage:R,onAddPageVariant:D,onDeletePage:I,onEditPageSeo:O,onViewPageJson:F,onDuplicateSection:M,onRenameSection:$,onDeleteSection:B,onDeleteRedirect:U,onDuplicateBlog:H,onDeleteBlog:W}=t;let K,G,Y,X,te,se,ne;if(e[0]!==s||e[1]!==a||e[2]!==c||e[3]!==l||e[4]!==d||e[5]!==h||e[6]!==D||e[7]!==N||e[8]!==j||e[9]!==A||e[10]!==W||e[11]!==I||e[12]!==U||e[13]!==B||e[14]!==H||e[15]!==E||e[16]!==M||e[17]!==O||e[18]!==C||e[19]!==y||e[20]!==b||e[21]!==v||e[22]!==_||e[23]!==R||e[24]!==$||e[25]!==f||e[26]!==V||e[27]!==k||e[28]!==w||e[29]!==F||e[30]!==n||e[31]!==m||e[32]!==S||e[33]!==p||e[34]!==x||e[35]!==g||e[36]!==i||e[37]!==u||e[38]!==r||e[39]!==L||e[40]!==T){const J=u.toLowerCase(),oe=n.filter(fe=>!J||fe.name.toLowerCase().includes(J)||fe.path.toLowerCase().includes(J)),ee=i.filter(fe=>!J||fe.from.toLowerCase().includes(J)||fe.to.toLowerCase().includes(J)),he=r.filter(fe=>!J||fe.name.toLowerCase().includes(J)||fe.key.toLowerCase().includes(J)||fe.resolveType.toLowerCase().includes(J)),ae=l.filter(fe=>!J||fe.title.toLowerCase().includes(J)||fe.resolveType.toLowerCase().includes(J)||(fe.description?.toLowerCase().includes(J)??!1)),de=Xce(he),ue=a.filter(fe=>!J||fe.title.toLowerCase().includes(J)||fe.app.toLowerCase().includes(J)||fe.vendor.toLowerCase().includes(J)||fe.category.toLowerCase().includes(J)),pe=d.filter(fe=>!J||fe.label.toLowerCase().includes(J)||fe.subtitle.toLowerCase().includes(J)),Z=s==="posts",ge=pde,be=Z?Xj(h):[],ke=new Map,we=new Map,Le={published:0,scheduled:0,draft:0};for(const fe of be)Le[fe.status]=Le[fe.status]+1;for(const fe of be){for(const Oe of fe.categorySlugs)ke.set(Oe,(ke.get(Oe)??0)+1);for(const Oe of fe.authorEmails)we.set(Oe,(we.get(Oe)??0)+1)}const _e=(Z?Zu(h,"categories"):[]).map(fe=>{const{key:Oe,payload:tt}=fe,ht=ge(tt.slug)||Oe;return{slug:ht,name:ge(tt.name)||ge(tt.slug)||Oe,count:ke.get(ht)??0}}).filter(mde),Ce=(Z?Zu(h,"authors"):[]).map(fe=>{const{key:Oe,payload:tt}=fe,ht=ge(tt.email);return{email:ht,name:ge(tt.name)||ge(tt.email)||Oe,count:we.get(ht)??0}}).filter(fde);let xe;e[48]!==p?(xe=fe=>!p||fe.categorySlugs.includes(p),e[48]=p,e[49]=xe):xe=e[49];let Ne;e[50]!==m?(Ne=fe=>!m||fe.authorEmails.includes(m),e[50]=m,e[51]=Ne):Ne=e[51];let Te;e[52]!==g?(Te=fe=>!g||fe.status===g,e[52]=g,e[53]=Te):Te=e[53];let Me;e[54]!==x?(Me=(fe,Oe)=>{if(x==="az")return fe.title.localeCompare(Oe.title);if(x==="za")return Oe.title.localeCompare(fe.title);const tt=fe.date.localeCompare(Oe.date);return x==="date-asc"?tt:-tt},e[54]=x,e[55]=Me):Me=e[55];const Qe=be.filter(fe=>!J||fe.title.toLowerCase().includes(J)||fe.slug.toLowerCase().includes(J)).filter(xe).filter(Ne).filter(Te).sort(Me),We=L.size,Ve=Qe.map(hde),De=Ve.length>0&&Ve.every(fe=>L.has(fe)),ot=We>0||S,st=()=>{De?j():k(Ve)},Ze=`Search ${s}…`,lt=Nu(s)?`Create new ${Cu[s]}`:s==="redirects"?"Create new redirect":"Create new page",_t=s!=="apps"&&s!=="sections";te="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let it;e[56]===Symbol.for("react.memo_cache_sentinel")?(it=o.jsx(A9,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[56]=it):it=e[56];let at;e[57]!==f?(at=fe=>f(fe.target.value),e[57]=f,e[58]=at):at=e[58];let Ie;e[59]!==Ze||e[60]!==u||e[61]!==at?(Ie=o.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[it,o.jsx("input",{type:"text",value:u,onChange:at,placeholder:Ze,"aria-label":Ze,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[59]=Ze,e[60]=u,e[61]=at,e[62]=Ie):Ie=e[62];let xt;e[63]!==lt||e[64]!==A||e[65]!==_t?(xt=_t&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:A,"aria-label":lt,children:o.jsx(Ut,{size:14})})}),o.jsx(Ue,{side:"bottom",children:lt})]}),e[63]=lt,e[64]=A,e[65]=_t,e[66]=xt):xt=e[66],e[67]!==Ie||e[68]!==xt?(se=o.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Ie,xt]}),e[67]=Ie,e[68]=xt,e[69]=se):se=e[69],ne=Z&&(ot?o.jsx(Yce,{count:We,allSelected:De,onToggleSelectAll:st,onDelete:N,onExit:C}):o.jsx(Uce,{categories:_e,authors:Ce,categoryFilter:p,statusCounts:Le,authorFilter:m,statusFilter:g,sort:x,onCategoryFilterChange:b,onAuthorFilterChange:y,onStatusFilterChange:_,onSortChange:v})),K=yl,X="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",G="flex flex-col gap-1 p-1.5",Y=s==="pages"?oe.length===0?o.jsx(Sc,{hasItems:n.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):oe.map(fe=>{const Oe=T?.collection==="pages"&&T.key===fe.key,tt=jk(h,fe.key);return o.jsx(ki,{icon:sl,title:fe.name,subtitle:fe.path,active:Oe,variantCount:tt,onClick:()=>V({collection:"pages",key:fe.key,path:fe.path}),menu:o.jsx(qd,{onDuplicate:()=>E(fe),onRename:()=>R(fe),onAddVariant:()=>D(fe),onEditSeo:()=>O(fe),onViewJson:()=>F(fe),onDelete:()=>I(fe)})},fe.key)}):s==="sections"?he.length===0&&ae.length===0?o.jsx(Sc,{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:[de.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Gv,{icon:ll,label:"Saved sections"}),de.map(fe=>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:fe.label}),fe.sections.map(Oe=>{const tt=T?.collection==="sections"&&T.key===Oe.key;return o.jsx(ki,{icon:ll,accent:"global",title:Oe.name,subtitle:fe.label,active:tt,onClick:()=>V({collection:"sections",key:Oe.key}),menu:o.jsx(qd,{onDuplicate:()=>M(Oe),onRename:()=>$(Oe),onDelete:()=>B(Oe)})},Oe.key)})]},fe.label))]}),ae.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Gv,{icon:sl,label:"Available sections",className:ie(de.length>0&&"mt-3")}),ae.map(fe=>{const Oe=T?.collection==="available-section"&&T.resolveType===fe.resolveType,tt=fe.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return o.jsx(ki,{icon:sl,title:fe.title,subtitle:tt??fe.resolveType,active:Oe,onClick:()=>V({collection:"available-section",resolveType:fe.resolveType,title:fe.title})},fe.resolveType)})]})]}):s==="apps"?c?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(ct,{size:18,className:"animate-spin text-muted-foreground"})}):ue.length===0?o.jsx(Sc,{hasItems:a.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ue.map(fe=>{const Oe=T?.collection==="apps"&&fe.blockKey!==null&&T.key===fe.blockKey;return o.jsx(ki,{icon:b7,logoUrl:fe.logo,title:fe.title,subtitle:fe.category,active:Oe,trailing:fe.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(!fe.installed||!fe.blockKey){ve.message(`${fe.title} is not installed on this site.`);return}V({collection:"apps",key:fe.blockKey})}},fe.id)}):s==="redirects"?ee.length===0?o.jsx(Sc,{hasItems:i.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):ee.map(fe=>o.jsx(ki,{icon:N8,title:fe.from||"(no source)",subtitle:`→ ${fe.to||"(no target)"}`,active:T?.collection==="redirects"&&T.key===fe.key,trailing:o.jsx(Pae,{type:fe.type}),onClick:()=>V({collection:"redirects",key:fe.key}),menu:o.jsx(qd,{onDelete:()=>U(fe)})},fe.key)):Z?Qe.length===0?o.jsx(Sc,{hasItems:be.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):Qe.map(fe=>{const Oe={key:fe.key,kind:"posts",label:fe.title,subtitle:fe.slug};return o.jsx(ki,{icon:so,title:fe.title,subtitle:fe.slug||"no slug",invalid:fe.missing.length>0,invalidReason:`Missing: ${fe.missing.join(", ")}`,active:T?.collection==="posts"&&T.key===fe.key,selectable:!0,selectionActive:ot,selected:L.has(fe.key),onToggleSelect:()=>w(fe.key),onClick:()=>ot?w(fe.key):V({collection:"posts",key:fe.key}),menu:o.jsx(qd,{onDuplicate:()=>H(Oe),onDelete:()=>W(Oe)})},fe.key)}):pe.length===0?o.jsx(Sc,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Nu(s)?Cu[s]:"item"}.`}):pe.map(fe=>{const Oe=T?.collection===fe.kind&&T.key===fe.key;return o.jsx(ki,{icon:fe.kind==="posts"?so:fe.kind==="authors"?Og:p9,title:fe.label,subtitle:fe.subtitle,active:Oe,onClick:()=>V({collection:fe.kind,key:fe.key}),menu:o.jsx(qd,{onDuplicate:()=>H(fe),onDelete:()=>W(fe)})},fe.key)}),e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=d,e[5]=h,e[6]=D,e[7]=N,e[8]=j,e[9]=A,e[10]=W,e[11]=I,e[12]=U,e[13]=B,e[14]=H,e[15]=E,e[16]=M,e[17]=O,e[18]=C,e[19]=y,e[20]=b,e[21]=v,e[22]=_,e[23]=R,e[24]=$,e[25]=f,e[26]=V,e[27]=k,e[28]=w,e[29]=F,e[30]=n,e[31]=m,e[32]=S,e[33]=p,e[34]=x,e[35]=g,e[36]=i,e[37]=u,e[38]=r,e[39]=L,e[40]=T,e[41]=K,e[42]=G,e[43]=Y,e[44]=X,e[45]=te,e[46]=se,e[47]=ne}else K=e[41],G=e[42],Y=e[43],X=e[44],te=e[45],se=e[46],ne=e[47];let Q;e[70]!==G||e[71]!==Y?(Q=o.jsx("div",{className:G,children:Y}),e[70]=G,e[71]=Y,e[72]=Q):Q=e[72];let q;e[73]!==K||e[74]!==X||e[75]!==Q?(q=o.jsx(K,{className:X,children:Q}),e[73]=K,e[74]=X,e[75]=Q,e[76]=q):q=e[76];let le;return e[77]!==te||e[78]!==se||e[79]!==ne||e[80]!==q?(le=o.jsxs("div",{className:te,children:[se,ne,q]}),e[77]=te,e[78]=se,e[79]=ne,e[80]=q,e[81]=le):le=e[81],le}function hde(t){return t.key}function fde(t){return t.email}function mde(t){return t.slug}function pde(t){return typeof t=="string"?t:""}function gde(t){const e=z.c(17),{virtualMcpId:s}=t,n=re(),i=bs(s),{activeTask:r}=rn();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={strict:!1},e[0]=l):l=e[0];const a=xl(l);if(!(nn(i?.metadata)||nn(r?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(vn,{size:24,className:"text-muted-foreground/60"}),e[1]=h):h=e[1];let u;e[2]!==n?(u=n("mainPanelTabs.contentTab.noContentToEdit"),e[2]=n,e[3]=u):u=e[3];let f;e[4]!==u?(f=o.jsx("div",{children:u}),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==n?(p=n("mainPanelTabs.contentTab.connectGithubDescription"),e[6]=n,e[7]=p):p=e[7];let m;e[8]!==p?(m=o.jsx("div",{className:"text-xs text-muted-foreground/80",children:p}),e[8]=p,e[9]=m):m=e[9];let g;return e[10]!==f||e[11]!==m?(g=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[h,f,m]}),e[10]=f,e[11]=m,e[12]=g):g=e[12],g}let d;return e[13]!==a.contentPageId||e[14]!==a.contentPath||e[15]!==a.contentPathTemplate?(d=o.jsx(ade,{deepLinkPage:{pageId:a.contentPageId,path:a.contentPath,pathTemplate:a.contentPathTemplate}}),e[13]=a.contentPageId,e[14]=a.contentPath,e[15]=a.contentPathTemplate,e[16]=d):d=e[16],d}function xde(t){const e=z.c(6),{virtualMcpId:s}=t,n=bs(s),i=J8();let r;e[0]!==i||e[1]!==n?(r=H9(i,Q8(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(bde,{}),e[3]=c):c=e[3],c}let a;return e[4]!==l?(a=o.jsx(_de,{config:l}),e[4]=l,e[5]=a):a=e[5],a}function bde(){const t=z.c(12),e=re();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(Rg,{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 vde(t){return t<0||t<640?2:t<768?3:t<1024?4:5}function yde(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((n,i)=>s[i%e].push(n)),s}function _de(t){const e=z.c(99),{config:s}=t,n=re(),[i,r]=P.useState(""),l=R9(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=xj(a),d=p1(),[h,u]=P.useState(!1),[f,p]=P.useState(null),m=P.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 $=Array.from(M);if($.length===0)return;const B=[];for(const U of $)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===$.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(),u(!0)},e[8]=b):b=e[8];const y=b;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=function(){u(!1)},e[9]=_):_=e[9];const v=_;let L;e[10]!==x?(L=function(M){M.preventDefault(),M.stopPropagation(),u(!1),x(M.dataTransfer.files)},e[10]=x,e[11]=L):L=e[11];const S=L,[w,k]=fp();let j,C,N,T,V,A;if(e[12]!==s.name||e[13]!==l||e[14]!==k||e[15]!==w||e[16]!==x||e[17]!==h||e[18]!==c.data?.pages||e[19]!==c.isFetching||e[20]!==c.isFetchingNextPage||e[21]!==S||e[22]!==i||e[23]!==n||e[24]!==d.isPending){const M=(c.data?.pages??[]).flatMap(Lde),$=yde(M,vde(w)),B=l.trim(),U=i!==l||c.isFetching&&!c.isFetchingNextPage;V="flex h-full min-h-0 flex-col gap-3 p-4";let H;e[31]!==n?(H=n("assets.browser.title"),e[31]=n,e[32]=H):H=e[32];let W;e[33]!==H?(W=o.jsx("h2",{className:"text-sm font-semibold",children:H}),e[33]=H,e[34]=W):W=e[34];let K;e[35]!==s.name||e[36]!==n?(K=n("assets.browser.bucketLabel",{name:s.name}),e[35]=s.name,e[36]=n,e[37]=K):K=e[37];let G;e[38]!==K?(G=o.jsx("p",{className:"truncate text-xs text-muted-foreground",children:K}),e[38]=K,e[39]=G):G=e[39];let Y;e[40]!==W||e[41]!==G?(Y=o.jsxs("div",{className:"min-w-0",children:[W,G]}),e[40]=W,e[41]=G,e[42]=Y):Y=e[42];let X;e[43]===Symbol.for("react.memo_cache_sentinel")?(X=()=>m.current?.click(),e[43]=X):X=e[43];let te;e[44]!==d.isPending?(te=d.isPending?o.jsx(ct,{size:14,className:"animate-spin"}):o.jsx(Xn,{size:14}),e[44]=d.isPending,e[45]=te):te=e[45];let se;e[46]!==n||e[47]!==d.isPending?(se=d.isPending?n("filePicker.filePickerDialog.uploading"):n("filePicker.filePickerDialog.dropFilesOrClick"),e[46]=n,e[47]=d.isPending,e[48]=se):se=e[48];let ne;e[49]!==te||e[50]!==se||e[51]!==d.isPending?(ne=o.jsxs(me,{type:"button",size:"sm",disabled:d.isPending,onClick:X,children:[te,se]}),e[49]=te,e[50]=se,e[51]=d.isPending,e[52]=ne):ne=e[52];let Q;e[53]!==x?(Q=o.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:pe=>{const Z=Array.from(pe.target.files??[]);pe.target.value="",x(Z)}}),e[53]=x,e[54]=Q):Q=e[54],e[55]!==Y||e[56]!==ne||e[57]!==Q?(A=o.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[Y,ne,Q]}),e[55]=Y,e[56]=ne,e[57]=Q,e[58]=A):A=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(N9,{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 le;e[65]===Symbol.for("react.memo_cache_sentinel")?(le=()=>m.current?.click(),e[65]=le):le=e[65];const J=h&&"border-primary bg-primary/5",oe=d.isPending&&"pointer-events-none opacity-60";let ee;e[66]!==J||e[67]!==oe?(ee=ie("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,oe),e[66]=J,e[67]=oe,e[68]=ee):ee=e[68];let he;e[69]===Symbol.for("react.memo_cache_sentinel")?(he=o.jsx(Xn,{size:16,className:"text-muted-foreground"}),e[69]=he):he=e[69];let ae;e[70]!==n?(ae=n("filePicker.filePickerDialog.dropFilesOrClick"),e[70]=n,e[71]=ae):ae=e[71];let de;e[72]!==n?(de=n("filePicker.filePickerDialog.uploadSizeLimit"),e[72]=n,e[73]=de):de=e[73];let ue;e[74]!==ae||e[75]!==de?(ue=o.jsxs("p",{className:"text-xs text-muted-foreground",children:[ae," ",de]}),e[74]=ae,e[75]=de,e[76]=ue):ue=e[76],e[77]!==S||e[78]!==ee||e[79]!==ue?(C=o.jsxs("button",{type:"button",onClick:le,onDragOver:y,onDragLeave:v,onDrop:S,className:ee,children:[he,ue]}),e[77]=S,e[78]=ee,e[79]=ue,e[80]=C):C=e[80],N="min-h-0 flex-1 overflow-y-auto pr-1",T=M.length===0?B?o.jsx(Xv,{title:n("filePicker.filePickerDialog.noMatches",{query:B}),description:n("filePicker.filePickerDialog.tryDifferentSearchOrLoadMore")}):o.jsx(Xv,{title:n("filePicker.filePickerDialog.noFilesYet"),description:n("filePicker.filePickerDialog.dropFileToGetStarted")}):o.jsx("div",{ref:k,className:"flex items-start gap-3",children:$.map((pe,Z)=>o.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-3",children:pe.map(ge=>o.jsx(wde,{item:ge,onDelete:()=>p(ge)},ge.key))},Z))}),e[12]=s.name,e[13]=l,e[14]=k,e[15]=w,e[16]=x,e[17]=h,e[18]=c.data?.pages,e[19]=c.isFetching,e[20]=c.isFetchingNextPage,e[21]=S,e[22]=i,e[23]=n,e[24]=d.isPending,e[25]=j,e[26]=C,e[27]=N,e[28]=T,e[29]=V,e[30]=A}else j=e[25],C=e[26],N=e[27],T=e[28],V=e[29],A=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(me,{type:"button",variant:"outline",size:"sm",disabled:c.isFetchingNextPage,onClick:()=>c.fetchNextPage(),children:c.isFetchingNextPage?o.jsxs(o.Fragment,{children:[o.jsx(ct,{size:14,className:"animate-spin"}),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]!==N||e[86]!==T?(R=o.jsxs("div",{className:N,children:[T,E]}),e[84]=E,e[85]=N,e[86]=T,e[87]=R):R=e[87];let D;e[88]===Symbol.for("react.memo_cache_sentinel")?(D=()=>p(null),e[88]=D):D=e[88];let I;e[89]!==s.id||e[90]!==f?(I=o.jsx(jde,{configId:s.id,item:f,onClose:D}),e[89]=s.id,e[90]=f,e[91]=I):I=e[91];let O;return e[92]!==j||e[93]!==C||e[94]!==R||e[95]!==I||e[96]!==V||e[97]!==A?(O=o.jsxs("div",{className:V,children:[A,j,C,R,I]}),e[92]=j,e[93]=C,e[94]=R,e[95]=I,e[96]=V,e[97]=A,e[98]=O):O=e[98],O}function Lde(t){return t.items}function Xv(t){const e=z.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(xr,{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 wde(t){const e=z.c(34),{item:s,onDelete:n}=t;let i;e[0]!==s.key?(i=bj(s.key),e[0]=s.key,e[1]=i):i=e[1];const r=i;let l;e[2]!==s.key?(l=Tx(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:Sde}):o.jsx("div",{className:"flex aspect-square items-center justify-center",children:o.jsx(so,{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 h=s.key;let u;e[12]!==s.key?(u=Of(s.key),e[12]=s.key,e[13]=u):u=e[13];let f;e[14]!==s.key||e[15]!==u?(f=o.jsx("p",{className:"truncate text-xs font-medium",title:h,children:u}),e[14]=s.key,e[15]=u,e[16]=f):f=e[16];let p;e[17]!==s.size?(p=vj(s.size),e[17]=s.size,e[18]=p):p=e[18];let m;e[19]!==r||e[20]!==p?(m=o.jsxs("p",{className:"text-[10px] uppercase text-muted-foreground",children:[r," · ",p]}),e[19]=r,e[20]=p,e[21]=m):m=e[21];let g;e[22]!==f||e[23]!==m?(g=o.jsxs("div",{className:"min-w-0 flex-1",children:[f,m]}),e[22]=f,e[23]=m,e[24]=g):g=e[24];let x;e[25]!==s||e[26]!==n?(x=o.jsx(kde,{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 y;return e[31]!==b||e[32]!==d?(y=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]=y):y=e[33],y}function Sde(t){t.target.style.display="none"}function kde(t){const e=z.c(36),{item:s,onDelete:n}=t,i=re(),[r,l]=P.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 h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(E9,{size:14}),e[5]=h):h=e[5];let u;e[6]!==d?(u=o.jsx(Bt,{asChild:!0,children:o.jsx(me,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 rounded-md","aria-label":d,children:h})}),e[6]=d,e[7]=u):u=e[7];let f;e[8]!==r?(f=r?o.jsx(Kt,{size:14}):o.jsx(dn,{size:14}),e[8]=r,e[9]=f):f=e[9];let p;e[10]!==r||e[11]!==i?(p=i(r?"filePicker.filePickerDialog.copied":"filePicker.filePickerDialog.copyUrl"),e[10]=r,e[11]=i,e[12]=p):p=e[12];let m;e[13]!==c||e[14]!==f||e[15]!==p?(m=o.jsxs(Ye,{onClick:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16];const g=s.publicUrl;let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(un,{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 y;e[20]!==s.publicUrl||e[21]!==b?(y=o.jsx(Ye,{asChild:!0,children:o.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",children:[x,b]})}),e[20]=s.publicUrl,e[21]=b,e[22]=y):y=e[22];let _;e[23]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Gs,{size:14}),e[23]=_):_=e[23];let v;e[24]!==i?(v=i("assets.browser.deleteAction"),e[24]=i,e[25]=v):v=e[25];let L;e[26]!==n||e[27]!==v?(L=o.jsxs(Ye,{variant:"destructive",onClick:n,children:[_,v]}),e[26]=n,e[27]=v,e[28]=L):L=e[28];let S;e[29]!==y||e[30]!==L||e[31]!==m?(S=o.jsxs(zt,{align:"end",children:[m,y,L]}),e[29]=y,e[30]=L,e[31]=m,e[32]=S):S=e[32];let w;return e[33]!==S||e[34]!==u?(w=o.jsxs($t,{children:[u,S]}),e[33]=S,e[34]=u,e[35]=w):w=e[35],w}function jde(t){const e=z.c(47),{configId:s,item:n,onClose:i}=t,r=re(),l=Ore();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 h;e[6]!==i?(h=T=>!T&&i(),e[6]=i,e[7]=h):h=e[7];let u;e[8]!==r?(u=r("assets.browser.deleteConfirmTitle"),e[8]=r,e[9]=u):u=e[9];let f;e[10]!==u?(f=o.jsx(oo,{children:u}),e[10]=u,e[11]=f):f=e[11];let p;e[12]!==n||e[13]!==r?(p=r("assets.browser.deleteConfirmDescription",{name:n?Of(n.key):""}),e[12]=n,e[13]=r,e[14]=p):p=e[14];let m;e[15]!==p?(m=o.jsx(lo,{children:p}),e[15]=p,e[16]=m):m=e[16];let g;e[17]!==f||e[18]!==m?(g=o.jsxs(ro,{children:[f,m]}),e[17]=f,e[18]=m,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 y;e[22]!==l.isPending||e[23]!==b?(y=o.jsx(co,{disabled:x,children:b}),e[22]=l.isPending,e[23]=b,e[24]=y):y=e[24];let _;e[25]===Symbol.for("react.memo_cache_sentinel")?(_=ie(K6({variant:"destructive"})),e[25]=_):_=e[25];const v=l.isPending;let L;e[26]!==c?(L=T=>{T.preventDefault(),c()},e[26]=c,e[27]=L):L=e[27];let S;e[28]!==l.isPending?(S=l.isPending?o.jsx(ct,{size:14,className:"animate-spin"}):null,e[28]=l.isPending,e[29]=S):S=e[29];let w;e[30]!==r?(w=r("assets.browser.deleteConfirm"),e[30]=r,e[31]=w):w=e[31];let k;e[32]!==l.isPending||e[33]!==L||e[34]!==S||e[35]!==w?(k=o.jsxs(uo,{className:_,disabled:v,onClick:L,children:[S,w]}),e[32]=l.isPending,e[33]=L,e[34]=S,e[35]=w,e[36]=k):k=e[36];let j;e[37]!==y||e[38]!==k?(j=o.jsxs(ao,{children:[y,k]}),e[37]=y,e[38]=k,e[39]=j):j=e[39];let C;e[40]!==j||e[41]!==g?(C=o.jsxs(io,{children:[g,j]}),e[40]=j,e[41]=g,e[42]=C):C=e[42];let N;return e[43]!==C||e[44]!==d||e[45]!==h?(N=o.jsx(no,{open:d,onOpenChange:h,children:C}),e[43]=C,e[44]=d,e[45]=h,e[46]=N):N=e[46],N}const Lm={fast:{labelKey:"automations.automationConfig.tierFast",subtitleKey:"automations.automationConfig.tierFastSubtitle",icon:pa},smart:{labelKey:"automations.automationConfig.tierSmart",subtitleKey:"automations.automationConfig.tierSmartSubtitle",icon:Jr},thinking:{labelKey:"automations.automationConfig.tierThinking",subtitleKey:"automations.automationConfig.tierThinkingSubtitle",icon:m8}},Cde=["fast","smart","thinking"];function Nde(t){const e=z.c(19),{tier:s,onSelect:n}=t,i=re(),[r,l]=P.useState(!1),a=Lm[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=Lm[s];let h;e[2]!==i||e[3]!==d.labelKey?(h=i(d.labelKey),e[2]=i,e[3]=d.labelKey,e[4]=h):h=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Gt,{size:14,className:"text-muted-foreground"}),e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==h?(f=o.jsx(ts,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[c,h,u]})}),e[6]=c,e[7]=h,e[8]=f):f=e[8];let p;e[9]!==n||e[10]!==i||e[11]!==s?(p=Cde.map(x=>{const b=Lm[x],y=b.icon;return o.jsxs("button",{type:"button",onClick:()=>{n(x),l(!1)},className:ie("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[o.jsx(y,{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(Kt,{size:14,className:"text-foreground mt-0.5"})]},x)}),e[9]=n,e[10]=i,e[11]=s,e[12]=p):p=e[12];let m;e[13]!==p?(m=o.jsx(ss,{align:"start",className:"p-1 w-64",children:o.jsx("div",{className:"flex flex-col",children:p})}),e[13]=p,e[14]=m):m=e[14];let g;return e[15]!==r||e[16]!==f||e[17]!==m?(g=o.jsxs(ns,{open:r,onOpenChange:l,children:[f,m]}),e[15]=r,e[16]=f,e[17]=m,e[18]=g):g=e[18],g}function Tde(t){const e=z.c(27),{tier:s,onTierChange:n,override:i,onOverrideChange:r}=t,l=re(),[a,c]=P.useState(i!==null);let d;e[0]!==l?(d=l("automations.automationConfig.modelLabel"),e[0]=l,e[1]=d):d=e[1];let h;e[2]!==d?(h=o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:d}),e[2]=d,e[3]=h):h=e[3];let u;e[4]!==r||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==s||e[9]!==a?(u=a?o.jsx(P.Suspense,{fallback:o.jsx(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:l("automations.automationConfig.loadingModels")}),children:o.jsx(Vde,{override:i,onOverrideChange:r})}):o.jsx(Nde,{tier:s,onSelect:n}),e[4]=r,e[5]=n,e[6]=i,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let f;e[11]!==r?(f=y=>{c(y),y||r(null)},e[11]=r,e[12]=f):f=e[12];let p;e[13]!==f||e[14]!==a?(p=o.jsx(Pi,{checked:a,onCheckedChange:f,className:"cursor-pointer"}),e[13]=f,e[14]=a,e[15]=p):p=e[15];let m;e[16]!==l?(m=l("automations.automationConfig.specificModel"),e[16]=l,e[17]=m):m=e[17];let g;e[18]!==p||e[19]!==m?(g=o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[p,m]}),e[18]=p,e[19]=m,e[20]=g):g=e[20];let x;e[21]!==u||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[u,g]}),e[21]=u,e[22]=g,e[23]=x):x=e[23];let b;return e[24]!==h||e[25]!==x?(b=o.jsxs("div",{className:"flex flex-col gap-2",children:[h,x]}),e[24]=h,e[25]=x,e[26]=b):b=e[26],b}function Vde(t){const e=z.c(25),{override:s,onOverrideChange:n}=t,i=re(),r=k9(),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]=P.useState(a);let h;e[4]!==c||e[5]!==l||e[6]!==r?(h=r.some(b=>b.id===c)?c:l,e[4]=c,e[5]=l,e[6]=r,e[7]=h):h=e[7];const u=h;let f;e[8]!==r||e[9]!==s?(f=s&&r.some(b=>b.id===s.credentialId)?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[8]=r,e[9]=s,e[10]=f):f=e[10];const p=f;if(r.length===0){let b;e[11]!==i?(b=i("automations.automationConfig.connectAiProviderHint"),e[11]=i,e[12]=b):b=e[12];let y;return e[13]!==b?(y=o.jsx("span",{className:"text-xs text-muted-foreground italic",children:b}),e[13]=b,e[14]=y):y=e[14],y}let m;e[15]!==i?(m=i("automations.automationConfig.pickModelPlaceholder"),e[15]=i,e[16]=m):m=e[16];let g;e[17]!==u||e[18]!==n?(g=b=>{const y=b.keyId??u??"";d(y),n({modelId:b.modelId,credentialId:y,title:b.title??b.modelId})},e[17]=u,e[18]=n,e[19]=g):g=e[19];let x;return e[20]!==u||e[21]!==p||e[22]!==m||e[23]!==g?(x=o.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:o.jsx(yP,{variant:"bordered",placeholder:m,model:p,credentialId:u,onCredentialChange:d,onModelChange:g})}),e[20]=u,e[21]=p,e[22]=m,e[23]=g,e[24]=x):x=e[24],x}const nC=[{key:"capabilities",headingKey:"automations.automationConfig.builtinCapabilities",icon:Fg,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:xr},{name:"subtask",titleKey:"automations.automationConfig.toolSubtask",descriptionKey:"automations.automationConfig.toolSubtaskDesc",icon:ci},{name:"user_ask",titleKey:"automations.automationConfig.toolAskUser",descriptionKey:"automations.automationConfig.toolAskUserDesc",icon:a0}]},{key:"files",headingKey:"automations.automationConfig.filesCode",icon:cl,tools:[{name:"read",titleKey:"automations.automationConfig.toolReadFile",descriptionKey:"automations.automationConfig.toolReadFileDesc",icon:x9},{name:"write",titleKey:"automations.automationConfig.toolWriteFile",descriptionKey:"automations.automationConfig.toolWriteFileDesc",icon:P9},{name:"edit",titleKey:"automations.automationConfig.toolEditFile",descriptionKey:"automations.automationConfig.toolEditFileDesc",icon:cg},{name:"grep",titleKey:"automations.automationConfig.toolSearchContent",descriptionKey:"automations.automationConfig.toolSearchContentDesc",icon:Fu},{name:"glob",titleKey:"automations.automationConfig.toolFindFiles",descriptionKey:"automations.automationConfig.toolFindFilesDesc",icon:cl},{name:"bash",titleKey:"automations.automationConfig.toolRunCommand",descriptionKey:"automations.automationConfig.toolRunCommandDesc",icon:QA}]},{key:"context",headingKey:"automations.automationConfig.context",icon:Jc,tools:[{name:"read_resource",titleKey:"automations.automationConfig.toolReadResource",descriptionKey:"automations.automationConfig.toolReadResourceDesc",icon:Jc},{name:"read_prompt",titleKey:"automations.automationConfig.toolReadPrompt",descriptionKey:"automations.automationConfig.toolReadPromptDesc",icon:Yc},{name:"skill",titleKey:"automations.automationConfig.toolLoadSkill",descriptionKey:"automations.automationConfig.toolLoadSkillDesc",icon:Yc}]}],Ade=nC.flatMap(t=>t.tools.map(e=>e.name));function Pde(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Ede(t){const e=z.c(12),{agentId:s,value:n,onChange:i}=t,r=re();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(P.Suspense,{fallback:o.jsxs(me,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[o.jsx(Fg,{size:14}),r("automations.automationConfig.loadingTools")]}),children:o.jsx(Rde,{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 Zv(t){const e=z.c(17),{value:s,checked:n,onToggle:i,title:r,description:l,leading:a}=t;let c;e[0]!==n?(c=o.jsx(gd,{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 h;e[4]!==r?(h=o.jsx("span",{className:"truncate text-sm leading-tight",children:r}),e[4]=r,e[5]=h):h=e[5];let u;e[6]!==l?(u=l&&o.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:l}),e[6]=l,e[7]=u):u=e[7];let f;e[8]!==h||e[9]!==u?(f=o.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h,u]}),e[8]=h,e[9]=u,e[10]=f):f=e[10];let p;return e[11]!==i||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==s?(p=o.jsxs(Ft,{value:s,onSelect:i,className:"items-start gap-2.5 py-2",children:[c,d,f]}),e[11]=i,e[12]=c,e[13]=d,e[14]=f,e[15]=s,e[16]=p):p=e[16],p}function ey(t){const e=z.c(27),{conn:s,label:n,icon:i,on:r,total:l,onToggle:a}=t,c=re(),d=r===l;let h;e[0]!==i||e[1]!==s?(h=s?o.jsx(Oi,{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]=h):h=e[2];let u;e[3]!==s?.title||e[4]!==n||e[5]!==c?(u=s?.title??n??c("automations.automationConfig.otherTools"),e[3]=s?.title,e[4]=n,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx("span",{className:"truncate",children:u}),e[7]=u,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==l?(p=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]=p):p=e[11];let m;e[12]!==a?(m=_=>{_.stopPropagation(),a()},e[12]=a,e[13]=m):m=e[13];let g;e[14]!==d||e[15]!==c?(g=c(d?"automations.automationConfig.none":"automations.automationConfig.all"),e[14]=d,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==m||e[18]!==g?(x=o.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:g}),e[17]=m,e[18]=g,e[19]=x):x=e[19];let b;e[20]!==p||e[21]!==x?(b=o.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[p,x]}),e[20]=p,e[21]=x,e[22]=b):b=e[22];let y;return e[23]!==h||e[24]!==f||e[25]!==b?(y=o.jsxs("div",{className:"flex items-center gap-2",children:[h,f,b]}),e[23]=h,e[24]=f,e[25]=b,e[26]=y):y=e[26],y}function Rde(t){const e=z.c(83),{agentId:s,value:n,onChange:i}=t,r=re(),{org:l}=Be(),[a,c]=P.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 h=Qt(d);let u;e[4]!==h?(u={client:h},e[4]=h,e[5]=u):u=e[5];const{data:f,isLoading:p}=lg(u),m=pi();let g,x,b,y,_,v,L,S,w,k,j,C,N;if(e[6]!==m||e[7]!==f?.tools||e[8]!==p||e[9]!==i||e[10]!==a||e[11]!==r||e[12]!==n){const R=new Map(m.map($de)),D=new Map;for(const de of f?.tools??[]){const ue=dr(de._meta)??"__other__",pe=dd(de.name,ue==="__other__"?void 0:ue),Z=de.title,ge=Z&&Z!==de.name?Z:Pde(pe);D.has(ue)||D.set(ue,{clientId:ue,conn:R.get(ue),tools:[]}),D.get(ue).tools.push({name:de.name,display:ge,description:de.description})}const I=[...D.values()].sort(Ode),O=(f?.tools??[]).map(Mde),F=[...Ade,...O],M=n===null?new Set(F):new Set(n),$=F.every(de=>M.has(de)),B=de=>i(F.every(ue=>de.has(ue))?null:[...de]),U=de=>{const ue=new Set(M);ue.has(de)?ue.delete(de):ue.add(de),B(ue)},H=(de,ue)=>{const pe=new Set(M);for(const Z of de)ue?pe.add(Z):pe.delete(Z);B(pe)};y=ns,N=a,_=c;let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=o.jsx(Fg,{size:14,className:"text-muted-foreground"}),e[26]=W):W=e[26];let K;e[27]!==$||e[28]!==r?(K=r($?"automations.automationConfig.allTools":"automations.automationConfig.tools"),e[27]=$,e[28]=r,e[29]=K):K=e[29];const G=!$&&o.jsxs(UE,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[M.size,"/",F.length]});let Y;e[30]===Symbol.for("react.memo_cache_sentinel")?(Y=o.jsx(Gt,{size:14,className:"text-muted-foreground"}),e[30]=Y):Y=e[30],e[31]!==K||e[32]!==G?(v=o.jsx(ts,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[W,K,G,Y]})}),e[31]=K,e[32]=G,e[33]=v):v=e[33],b=ss,j="p-0 w-80",C="start",x=Fn;let X;e[34]!==r?(X=r("automations.automationConfig.searchToolsPlaceholder"),e[34]=r,e[35]=X):X=e[35],e[36]!==X?(w=o.jsx(An,{placeholder:X}),e[36]=X,e[37]=w):w=e[37];const te=$?r("automations.automationConfig.allToolsEnabled",{count:F.length}):r("automations.automationConfig.toolsEnabledCount",{enabled:M.size,total:F.length});let se;e[38]!==te?(se=o.jsx("span",{className:"text-xs text-muted-foreground",children:te}),e[38]=te,e[39]=se):se=e[39];let ne;e[40]!==i?(ne=()=>i(null),e[40]=i,e[41]=ne):ne=e[41];let Q;e[42]!==r?(Q=r("automations.automationConfig.selectAll"),e[42]=r,e[43]=Q):Q=e[43];let q;e[44]!==$||e[45]!==ne||e[46]!==Q?(q=o.jsx("button",{type:"button",onClick:ne,disabled:$,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:Q}),e[44]=$,e[45]=ne,e[46]=Q,e[47]=q):q=e[47];let le;e[48]===Symbol.for("react.memo_cache_sentinel")?(le=o.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[48]=le):le=e[48];let J;e[49]!==i?(J=()=>i([]),e[49]=i,e[50]=J):J=e[50];const oe=M.size===0;let ee;e[51]!==r?(ee=r("automations.automationConfig.clear"),e[51]=r,e[52]=ee):ee=e[52];let he;e[53]!==J||e[54]!==oe||e[55]!==ee?(he=o.jsx("button",{type:"button",onClick:J,disabled:oe,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:ee}),e[53]=J,e[54]=oe,e[55]=ee,e[56]=he):he=e[56];let ae;e[57]!==q||e[58]!==he?(ae=o.jsxs("div",{className:"flex items-center gap-2",children:[q,le,he]}),e[57]=q,e[58]=he,e[59]=ae):ae=e[59],e[60]!==se||e[61]!==ae?(k=o.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[se,ae]}),e[60]=se,e[61]=ae,e[62]=k):k=e[62],g=Pn,L="max-h-80",S=p?o.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("automations.automationConfig.loadingTools")}):o.jsxs(o.Fragment,{children:[o.jsx(hn,{children:r("automations.automationConfig.noToolsFound")}),nC.map(de=>{const ue=de.tools.map(Ide),pe=ue.filter(Z=>M.has(Z)).length;return o.jsx(os,{heading:o.jsx(ey,{label:r(de.headingKey),icon:de.icon,on:pe,total:ue.length,onToggle:()=>H(ue,pe!==ue.length)}),children:de.tools.map(Z=>o.jsx(Zv,{value:`${r(Z.titleKey)} ${Z.name}`,checked:M.has(Z.name),onToggle:()=>U(Z.name),title:r(Z.titleKey),description:r(Z.descriptionKey),leading:o.jsx(Z.icon,{size:16,className:"text-muted-foreground"})},Z.name))},de.key)}),I.map(de=>{const ue=de.tools.map(Dde),pe=ue.filter(Z=>M.has(Z)).length;return o.jsx(os,{heading:o.jsx(ey,{conn:de.conn,on:pe,total:ue.length,onToggle:()=>H(ue,pe!==ue.length)}),children:de.tools.map(Z=>o.jsx(Zv,{value:`${Z.display} ${Z.name} ${de.conn?.title??""}`,checked:M.has(Z.name),onToggle:()=>U(Z.name),title:Z.display,description:Z.description},Z.name))},de.clientId)})]}),e[6]=m,e[7]=f?.tools,e[8]=p,e[9]=i,e[10]=a,e[11]=r,e[12]=n,e[13]=g,e[14]=x,e[15]=b,e[16]=y,e[17]=_,e[18]=v,e[19]=L,e[20]=S,e[21]=w,e[22]=k,e[23]=j,e[24]=C,e[25]=N}else g=e[13],x=e[14],b=e[15],y=e[16],_=e[17],v=e[18],L=e[19],S=e[20],w=e[21],k=e[22],j=e[23],C=e[24],N=e[25];let T;e[63]!==g||e[64]!==L||e[65]!==S?(T=o.jsx(g,{className:L,children:S}),e[63]=g,e[64]=L,e[65]=S,e[66]=T):T=e[66];let V;e[67]!==x||e[68]!==T||e[69]!==w||e[70]!==k?(V=o.jsxs(x,{children:[w,k,T]}),e[67]=x,e[68]=T,e[69]=w,e[70]=k,e[71]=V):V=e[71];let A;e[72]!==b||e[73]!==V||e[74]!==j||e[75]!==C?(A=o.jsx(b,{className:j,align:C,children:V}),e[72]=b,e[73]=V,e[74]=j,e[75]=C,e[76]=A):A=e[76];let E;return e[77]!==y||e[78]!==_||e[79]!==v||e[80]!==A||e[81]!==N?(E=o.jsxs(y,{open:N,onOpenChange:_,children:[v,A]}),e[77]=y,e[78]=_,e[79]=v,e[80]=A,e[81]=N,e[82]=E):E=e[82],E}function Dde(t){return t.name}function Ide(t){return t.name}function Mde(t){return t.name}function Ode(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function $de(t){return[t.id,t]}function Tu(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Bde(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"),h=(l[1]??"0").padStart(2,"0");return`Every ${c} at ${d}:${h} UTC`}return t}function zde(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 Fde(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 Ude(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Hde=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Kde({automationId:t,open:e,onOpenChange:s,onCustomSelect:n,onEventSelect:i,onWebhookCreated:r}){const l=re(),{triggerAdd:a}=g0(),[c,d]=P.useState(!1),h=e??c,u=m=>{s?s(m):d(m)},f=async m=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),ve.success(l("automations.addStarterPopover.starterAdded")),u(!1)}catch(g){const x=g instanceof Error?g.message:l("automations.addStarterPopover.failedAddStarter");ve.error(x)}},p=async()=>{try{const m=await a.mutateAsync({automation_id:t,type:"webhook"});u(!1),m.webhook?r?.(m.webhook):ve.success(l("automations.addStarterPopover.webhookStarterAdded"))}catch(m){const g=m instanceof Error?m.message:l("automations.addStarterPopover.failedAddWebhookStarter");ve.error(g)}};return o.jsxs($t,{open:h,onOpenChange:u,children:[o.jsx(Bt,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(Ut,{size:14}),l("automations.addStarterPopover.addStarter")]})}),o.jsxs(zt,{align:"end",className:"w-[200px]",children:[o.jsxs(rr,{children:[o.jsxs(or,{className:"gap-2.5",children:[o.jsx(gu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.every")]}),o.jsx(lr,{className:"w-[160px]",children:Hde.map(m=>o.jsxs(Ye,{className:"gap-2.5",onSelect:()=>f(m.cron),disabled:a.isPending,children:[o.jsx(gu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.everyUnit",{unit:m.label})]},m.cron))})]}),o.jsxs(Ye,{className:"gap-2.5",onSelect:()=>{u(!1),n?.()},children:[o.jsx(gu,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.customCron")]}),o.jsxs(Ye,{className:"gap-2.5",onSelect:()=>{u(!1),i?.()},children:[o.jsx(br,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.event")]}),o.jsxs(Ye,{className:"gap-2.5",onSelect:()=>{p()},disabled:a.isPending,children:[o.jsx(zn,{size:14,className:"text-muted-foreground shrink-0"}),l("automations.addStarterPopover.webhook")]})]})]})}function iC(t){const e=z.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,h=re(),[u,f]=P.useState(null),[p,m]=P.useState("curl"),[g,x]=P.useState("header"),b=P.useId();let y;e[0]!==h?(y=async(I,O)=>{try{await navigator.clipboard.writeText(I),f(O),ve.success(h("automations.webhookSecretDialog.copied")),setTimeout(()=>f(null),1500)}catch{ve.error(h("automations.webhookSecretDialog.failedCopy"))}},e[0]=h,e[1]=y):y=e[1];const _=y;let v;e[2]!==g||e[3]!==r||e[4]!==i?(v=i&&r&&g==="url"?`${i.replace(/\/$/,"")}/${r}`:i??"",e[2]=g,e[3]=r,e[4]=i,e[5]=v):v=e[5];const L=v,S=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=p==="curl"?S:w;let j;e[6]!==c?(j=o.jsx(Jt,{children:c}),e[6]=c,e[7]=j):j=e[7];let C;e[8]!==d?(C=o.jsx(Tn,{children:d}),e[8]=d,e[9]=C):C=e[9];let N;e[10]!==j||e[11]!==C?(N=o.jsxs(ms,{children:[j,C]}),e[10]=j,e[11]=C,e[12]=N):N=e[12];let T;e[13]!==g||e[14]!==u||e[15]!==_||e[16]!==L||e[17]!==p||e[18]!==k||e[19]!==h||e[20]!==r||e[21]!==b||e[22]!==i?(T=i&&r?o.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.url")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:L}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>_(L,"url"),children:[o.jsx(dn,{size:13}),h(u==="url"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.tokenLabel")}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:r}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>_(r,"token"),children:[o.jsx(dn,{size:13}),h(u==="token"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:h("automations.webhookSecretDialog.snippet")}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(ba,{value:p,onValueChange:I=>m(I),children:o.jsxs(md,{className:"h-8 p-[2px]",children:[o.jsx(di,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),o.jsx(di,{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(gd,{id:b,checked:g==="url",onCheckedChange:I=>x(I?"url":"header")}),h("automations.webhookSecretDialog.tokenInUrl")]})]}),o.jsxs(me,{size:"sm",variant:"outline",onClick:()=>_(k,"example"),children:[o.jsx(dn,{size:13}),h(u==="example"?"automations.webhookSecretDialog.copied":"automations.webhookSecretDialog.copy")]})]}),o.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:o.jsx(bd,{code:k,language:p==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[13]=g,e[14]=u,e[15]=_,e[16]=L,e[17]=p,e[18]=k,e[19]=h,e[20]=r,e[21]=b,e[22]=i,e[23]=T):T=e[23];let V;e[24]!==n?(V=()=>n(!1),e[24]=n,e[25]=V):V=e[25];let A;e[26]!==h?(A=h("automations.webhookSecretDialog.done"),e[26]=h,e[27]=A):A=e[27];let E;e[28]!==A||e[29]!==V?(E=o.jsx(Jn,{children:o.jsx(me,{onClick:V,children:A})}),e[28]=A,e[29]=V,e[30]=E):E=e[30];let R;e[31]!==E||e[32]!==N||e[33]!==T?(R=o.jsxs(Wt,{className:"max-w-lg",children:[N,T,E]}),e[31]=E,e[32]=N,e[33]=T,e[34]=R):R=e[34];let D;return e[35]!==n||e[36]!==s||e[37]!==R?(D=o.jsx(qt,{open:s,onOpenChange:n,children:R}),e[35]=n,e[36]=s,e[37]=R,e[38]=D):D=e[38],D}function Wde(t){const e=z.c(137),{trigger:s,automationId:n,connectionName:i}=t,r=re(),{triggerAdd:l,triggerRemove:a,triggerRotateToken:c}=g0(),[d,h]=P.useState(!1),[u,f]=P.useState(!1),[p,m]=P.useState(null);let g;e[0]!==s.cron_expression?(g=s.cron_expression?Fde(s.cron_expression):null,e[0]=s.cron_expression,e[1]=g):g=e[1];const x=g,[b,y]=P.useState(x?.count??1),[_,v]=P.useState(!1),[L,S]=P.useState(s.cron_expression??""),w=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"))}h(!1)},e[2]=n,e[3]=a,e[4]=r,e[5]=s.id,e[6]=C):C=e[6];const N=C;let T;e[7]!==l||e[8]!==n||e[9]!==a||e[10]!==s.id?(T=async De=>{await l.mutateAsync({automation_id:n,type:"cron",cron_expression:De}),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]=T):T=e[11];const V=T;let A;e[12]!==L||e[13]!==V||e[14]!==r||e[15]!==s.cron_expression?(A=async()=>{const De=L.trim();if(!De||!Tu(De)||De===s.cron_expression){v(!1),S(s.cron_expression??"");return}try{await V(De),v(!1)}catch{ve.error(r("automations.triggerCard.failedToUpdateStarter")),S(s.cron_expression??""),v(!1)}},e[12]=L,e[13]=V,e[14]=r,e[15]=s.cron_expression,e[16]=A):A=e[16];const E=A;let R;e[17]!==n||e[18]!==c||e[19]!==s.id?(R=async()=>{f(!1);try{const De=await c.mutateAsync({trigger_id:s.id,automation_id:n});m({url:De.url,token:De.token})}catch(De){const ot=De,st=ot instanceof Error?ot.message:"Failed to rotate token";ve.error(st)}},e[17]=n,e[18]=c,e[19]=s.id,e[20]=R):R=e[20];const D=R;let I;e[21]!==x||e[22]!==V||e[23]!==r||e[24]!==s.cron_expression?(I=async De=>{if(!x)return;const ot=x.unit==="minutes"?5:1,st=Math.max(ot,De);st!==De&&y(st);const Ze=zde(st,x.unit);if(Ze!==s.cron_expression)try{await V(Ze)}catch{ve.error(r("automations.triggerCard.failedToUpdateStarter")),y(x.count)}},e[21]=x,e[22]=V,e[23]=r,e[24]=s.cron_expression,e[25]=I):I=e[25];const O=I;let F;e[26]!==k||e[27]!==j?(F=k?o.jsx(gu,{size:14,className:"text-muted-foreground shrink-0"}):j?o.jsx(zn,{size:14,className:"text-muted-foreground shrink-0"}):o.jsx(br,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=k,e[27]=j,e[28]=F):F=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]!==w||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:De=>y(parseInt(De.target.value)||1),onBlur:()=>O(b),onKeyDown:De=>{De.key==="Enter"&&De.target.blur(),De.key==="Escape"&&y(x.count)},disabled:w,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:Ude(x.unit,b)})]}):k&&_?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"text",value:L,onChange:De=>S(De.target.value),onBlur:E,onKeyDown:De=>{De.key==="Enter"&&De.target.blur(),De.key==="Escape"&&(v(!1),S(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),L&&!Tu(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?Bde(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(qde).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]=w,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 $;e[44]!==w?($=w&&o.jsx(ct,{size:13,className:"animate-spin text-muted-foreground"}),e[44]=w,e[45]=$):$=e[45];let B;e[46]!==x||e[47]!==k||e[48]!==_||e[49]!==s.cron_expression?(B=k&&!x&&!_&&o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{S(s.cron_expression??""),v(!0)},children:o.jsx(P9,{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(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:r("automations.triggerCard.rotateToken"),onClick:()=>f(!0),children:o.jsx($n,{size:13,className:"text-muted-foreground"})}),e[51]=j,e[52]=r,e[53]=U):U=e[53];let H;e[54]===Symbol.for("react.memo_cache_sentinel")?(H=o.jsx(me,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>h(!0),children:o.jsx(Ai,{size:13,className:"text-muted-foreground"})}),e[54]=H):H=e[54];let W;e[55]!==B||e[56]!==U||e[57]!==$?(W=o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[$,B,U,H]}),e[55]=B,e[56]=U,e[57]=$,e[58]=W):W=e[58];let K;e[59]!==W||e[60]!==F||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:[F,M,W]}),e[59]=W,e[60]=F,e[61]=M,e[62]=K):K=e[62];let G;e[63]!==r?(G=r("automations.triggerCard.removeStarter"),e[63]=r,e[64]=G):G=e[64];let Y;e[65]!==G?(Y=o.jsx(oo,{children:G}),e[65]=G,e[66]=Y):Y=e[66];let X;e[67]!==r?(X=r("automations.triggerCard.confirmRemoveStarter"),e[67]=r,e[68]=X):X=e[68];let te;e[69]!==X?(te=o.jsx(lo,{children:X}),e[69]=X,e[70]=te):te=e[70];let se;e[71]!==Y||e[72]!==te?(se=o.jsxs(ro,{children:[Y,te]}),e[71]=Y,e[72]=te,e[73]=se):se=e[73];let ne;e[74]!==r?(ne=r("automations.triggerCard.cancel"),e[74]=r,e[75]=ne):ne=e[75];let Q;e[76]!==ne?(Q=o.jsx(co,{children:ne}),e[76]=ne,e[77]=Q):Q=e[77];let q;e[78]!==r?(q=r("automations.triggerCard.remove"),e[78]=r,e[79]=q):q=e[79];let le;e[80]!==N||e[81]!==q?(le=o.jsx(uo,{onClick:N,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q}),e[80]=N,e[81]=q,e[82]=le):le=e[82];let J;e[83]!==Q||e[84]!==le?(J=o.jsxs(ao,{children:[Q,le]}),e[83]=Q,e[84]=le,e[85]=J):J=e[85];let oe;e[86]!==se||e[87]!==J?(oe=o.jsxs(io,{children:[se,J]}),e[86]=se,e[87]=J,e[88]=oe):oe=e[88];let ee;e[89]!==d||e[90]!==oe?(ee=o.jsx(no,{open:d,onOpenChange:h,children:oe}),e[89]=d,e[90]=oe,e[91]=ee):ee=e[91];let he;e[92]!==r?(he=r("automations.triggerCard.rotateWebhookToken"),e[92]=r,e[93]=he):he=e[93];let ae;e[94]!==he?(ae=o.jsx(oo,{children:he}),e[94]=he,e[95]=ae):ae=e[95];let de;e[96]!==r?(de=r("automations.triggerCard.rotateWebhookTokenDescription"),e[96]=r,e[97]=de):de=e[97];let ue;e[98]!==de?(ue=o.jsx(lo,{children:de}),e[98]=de,e[99]=ue):ue=e[99];let pe;e[100]!==ae||e[101]!==ue?(pe=o.jsxs(ro,{children:[ae,ue]}),e[100]=ae,e[101]=ue,e[102]=pe):pe=e[102];let Z;e[103]!==r?(Z=r("automations.triggerCard.cancel"),e[103]=r,e[104]=Z):Z=e[104];let ge;e[105]!==Z?(ge=o.jsx(co,{children:Z}),e[105]=Z,e[106]=ge):ge=e[106];let be;e[107]!==r?(be=r("automations.triggerCard.rotate"),e[107]=r,e[108]=be):be=e[108];let ke;e[109]!==D||e[110]!==be?(ke=o.jsx(uo,{onClick:D,children:be}),e[109]=D,e[110]=be,e[111]=ke):ke=e[111];let we;e[112]!==ge||e[113]!==ke?(we=o.jsxs(ao,{children:[ge,ke]}),e[112]=ge,e[113]=ke,e[114]=we):we=e[114];let Le;e[115]!==pe||e[116]!==we?(Le=o.jsxs(io,{children:[pe,we]}),e[115]=pe,e[116]=we,e[117]=Le):Le=e[117];let _e;e[118]!==u||e[119]!==Le?(_e=o.jsx(no,{open:u,onOpenChange:f,children:Le}),e[118]=u,e[119]=Le,e[120]=_e):_e=e[120];const Ce=p!==null;let xe;e[121]===Symbol.for("react.memo_cache_sentinel")?(xe=De=>{De||m(null)},e[121]=xe):xe=e[121];const Ne=p?.url??null,Te=p?.token??null;let Me;e[122]!==r?(Me=r("automations.triggerCard.newWebhookToken"),e[122]=r,e[123]=Me):Me=e[123];let Qe;e[124]!==r?(Qe=r("automations.triggerCard.newWebhookTokenDescription"),e[124]=r,e[125]=Qe):Qe=e[125];let We;e[126]!==Ce||e[127]!==Ne||e[128]!==Te||e[129]!==Me||e[130]!==Qe?(We=o.jsx(iC,{open:Ce,onOpenChange:xe,url:Ne,token:Te,title:Me,description:Qe}),e[126]=Ce,e[127]=Ne,e[128]=Te,e[129]=Me,e[130]=Qe,e[131]=We):We=e[131];let Ve;return e[132]!==K||e[133]!==ee||e[134]!==_e||e[135]!==We?(Ve=o.jsxs(o.Fragment,{children:[K,ee,_e,We]}),e[132]=K,e[133]=ee,e[134]=_e,e[135]=We,e[136]=Ve):Ve=e[136],Ve}function qde(t){const[e,s]=t;return`${e}: ${s}`}function Gde(t){const e=z.c(70),{automationId:s,onDone:n}=t,i=re();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const l=pi(r),[a,c]=P.useState(),[d,h]=P.useState();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const[f,p]=P.useState(u),{triggerAdd:m}=g0(),{data:g,isLoading:x}=HE(a);let b,y,_,v,L,S;if(e[2]!==m||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($=>$.type===d);let C;e[18]!==m||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 m.mutateAsync({automation_id:s,type:"event",event_type:d,connection_id:a,params:f}),Je("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]=m,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,y="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let N;e[26]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsx(br,{size:14,className:"text-muted-foreground shrink-0"}),e[26]=N):N=e[26];let T;e[27]!==i?(T=i("automations.eventTriggerForm.title"),e[27]=i,e[28]=T):T=e[28];let V;e[29]!==T?(V=o.jsx("span",{className:"text-sm font-medium",children:T}),e[29]=T,e[30]=V):V=e[30];let A;e[31]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(Ai,{size:13}),e[31]=A):A=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:A}),e[32]=n,e[33]=E):E=e[33],e[34]!==V||e[35]!==E?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[N,V,E]}),e[34]=V,e[35]=E,e[36]=_):_=e[36];const R=a??"";let D;e[37]===Symbol.for("react.memo_cache_sentinel")?(D=$=>{c($),h(void 0),p({})},e[37]=D):D=e[37];let I;e[38]!==i?(I=i("automations.eventTriggerForm.selectConnectionPlaceholder"),e[38]=i,e[39]=I):I=e[39];let O;e[40]!==I?(O=o.jsx(js,{className:"w-full",children:o.jsx(As,{placeholder:I})}),e[40]=I,e[41]=O):O=e[41];let F;e[42]!==i||e[43]!==l?(F=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(Qde),e[42]=i,e[43]=l,e[44]=F):F=e[44];let M;e[45]!==F?(M=o.jsx(Cs,{children:F}),e[45]=F,e[46]=M):M=e[46],e[47]!==R||e[48]!==O||e[49]!==M?(v=o.jsxs(ks,{value:R,onValueChange:D,children:[O,M]}),e[47]=R,e[48]=O,e[49]=M,e[50]=v):v=e[50],e[51]!==a||e[52]!==d||e[53]!==x||e[54]!==i||e[55]!==g?(L=a&&o.jsxs(ks,{value:d??"",onValueChange:$=>{h($),p({})},children:[o.jsx(js,{className:"w-full",children:x?o.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[o.jsx(ct,{size:13,className:"animate-spin"}),i("automations.eventTriggerForm.loadingEvents")]}):o.jsx(As,{placeholder:i("automations.eventTriggerForm.selectEventTypePlaceholder"),children:d??i("automations.eventTriggerForm.selectEventTypePlaceholder")})}),o.jsx(Cs,{children:g?.map(Jde)})]}),e[51]=a,e[52]=d,e[53]=x,e[54]=i,e[55]=g,e[56]=L):L=e[56],S=j?.paramsSchema&&Object.keys(j.paramsSchema).length>0&&o.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(j.paramsSchema).map($=>{const[B,U]=$;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(ks,{value:f[B]??"",onValueChange:H=>p(W=>({...W,[B]:H})),children:[o.jsx(js,{className:"w-full",children:o.jsx(As,{placeholder:i("automations.eventTriggerForm.selectParamPlaceholder",{key:B})})}),o.jsx(Cs,{children:U.enum.map(Yde)})]}):o.jsx("input",{type:"text",value:f[B]??"",onChange:H=>p(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]=m,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]=y,e[14]=_,e[15]=v,e[16]=L,e[17]=S}else b=e[12],y=e[13],_=e[14],v=e[15],L=e[16],S=e[17];let w;e[57]!==m||e[58]!==a||e[59]!==d||e[60]!==b||e[61]!==i?(w=a&&d&&o.jsx(me,{size:"sm",onClick:b,disabled:m.isPending,children:m.isPending?o.jsx(ct,{size:13,className:"animate-spin"}):i("automations.eventTriggerForm.addTriggerButton")}),e[57]=m,e[58]=a,e[59]=d,e[60]=b,e[61]=i,e[62]=w):w=e[62];let k;return e[63]!==y||e[64]!==_||e[65]!==v||e[66]!==L||e[67]!==S||e[68]!==w?(k=o.jsxs("div",{className:y,children:[_,v,L,S,w]}),e[63]=y,e[64]=_,e[65]=v,e[66]=L,e[67]=S,e[68]=w,e[69]=k):k=e[69],k}function Yde(t){return o.jsx(Dt,{value:t,children:t},t)}function Jde(t){return o.jsx(Dt,{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 Qde(t){return o.jsx(Dt,{value:t.id,children:t.title},t.id)}const Xde=30;function Zde(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 eue({automationId:t,automation:e,onBack:s,onDelete:n}){const i=re(),r=e.virtual_mcp_id,{org:l}=Be(),{update:a,triggerAdd:c,run:d}=g0(),h=pi(),u=new Map(h.map(q=>[q.id,q.title])),{openTask:f}=rn(),{openSidePanel:p}=vl(),{sendMessage:m}=gi(),g=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[x,b]=P.useState(g),[y,_]=P.useState(!1),[v,L]=P.useState(!1),[S,w]=P.useState(!1),[k,j]=P.useState(""),[C,N]=P.useState(!1),[T,V]=P.useState(null),[A,E]=P.useState(!1),[R,D]=P.useState(!1),[I,O]=P.useState(!1),F=async()=>{if(A)return;const le=qT(x).filter(J=>J.type==="text").map(J=>J.text).join(`
646
- `);if(le.trim()){E(!0);try{se(),Je("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:le.length}),p(),await m({tiptapDoc:CL({managerAgentId:r8.AUTOMATION_MANAGER(l.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:le})})}finally{E(!1)}}},M=e.models?.tier??"smart",$=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,B=G2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:$,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=B.watch("active"),[H,W]=P.useReducer(Zde,null),K=()=>{H!==null&&(Je("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(H.fields),save_count:H.saveCount,edit_duration_ms:Date.now()-H.start}),W({type:"reset"}))},G=async()=>{const q=B.control._formState.dirtyFields,le=Object.keys(q);if(le.length===0&&!I)return!0;const J=B.getValues(),oe=B.control._defaultValues;B.reset(J,{keepValues:!0});const ee=I;O(!1);const he={tier:J.tier,...J.modelOverride?{modelId:J.modelOverride.modelId,credentialId:J.modelOverride.credentialId,modelTitle:J.modelOverride.title}:{}},ae={id:t,name:J.name,active:J.active,models:he,tools:J.tools,maxAgentSteps:J.maxAgentSteps,messages:WT(x),temperature:0};try{await a.mutateAsync(ae)}catch{return B.reset(oe,{keepValues:!0}),ee&&O(!0),!1}const de=[...le];return ee&&de.push("messages"),W({type:"accumulate",now:Date.now(),fields:de}),te(),!0},{schedule:Y,flush:X}=rf({save:G}),{schedule:te,flush:se}=rf({delayMs:3e4,save:async()=>K()});P.useEffect(()=>{const q=B.watch(()=>Y());return()=>q.unsubscribe()},[]);const ne=q=>{if(b(q),!R){D(!0);return}O(!0),Y()},Q=async()=>{Je("automation_test_clicked",{automation_id:t,agent_id:r});const q=await X();if(se(),!!q){if(!x){ve.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const le=await d.mutateAsync(t);le.threadId&&(p(),f(le.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(me,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(y9,{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(Ss,{control:B.control,name:"name",render:({field:q})=>o.jsx(gt,{...q,placeholder:i("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(me,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(Gs,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ss,{control:B.control,name:"active",render:({field:q})=>o.jsx(Pi,{checked:q.value,onCheckedChange:le=>{q.onChange(le),X()},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(NL,{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(Kde,{automationId:t,open:y,onOpenChange:_,onCustomSelect:()=>{w(!0),N(!1),j("")},onEventSelect:()=>{N(!0),w(!1)},onWebhookCreated:q=>{Je("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),V(q)}})]}),e.triggers.length===0&&!S?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(Wde,{trigger:q,automationId:t,connectionName:q.connection_id?u.get(q.connection_id):void 0},q.id))}),S&&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(gu,{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||!Tu(q)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:q}),Je("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ve.success(i("automations.automationDetail.starterAdded")),w(!1),j("")}catch{ve.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async q=>{const le=k.trim();q.key==="Enter"&&le&&Tu(le)&&q.target.blur(),q.key==="Escape"&&(w(!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&&!Tu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(ct,{size:13,className:"animate-spin 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:()=>{w(!1),j("")},children:o.jsx(Ai,{size:13})})]}),C&&o.jsx(P.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(ct,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(Gde,{automationId:t,onDone:()=>N(!1)})}),o.jsx(iC,{open:T!==null,onOpenChange:q=>{q||V(null)},url:T?.url??null,token:T?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.instructions")}),o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:A||!x,onClick:F,children:[o.jsx(Jr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(w_,{tiptapDoc:x,setTiptapDoc:ne,placeholder:i("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(S_,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Q,disabled:!r,children:[o.jsx(t9,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(Ue,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(s8,{open:v,onOpenChange:L,className:"flex flex-col gap-2.5",children:[o.jsxs(e8,{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(Gt,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(t8,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(Tde,{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(Ede,{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(gt,{type:"number",min:1,max:100,className:"w-40",placeholder:i("automations.automationDetail.maxStepsPlaceholder",{default:Xde}),value:B.watch("maxAgentSteps")??"",onChange:q=>{const le=q.target.value.trim(),J=le===""?null:Number(le);B.setValue("maxAgentSteps",J===null||Number.isNaN(J)?null:J,{shouldDirty:!0})}})]})]})]})]})]})}const rC=[{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 oC(t){const e=rC.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function tue(t){const e=z.c(16),{automationId:s,triggerIds:n}=t,i=re(),[r,l]=P.useState("30d"),[a,c]=P.useState(sue);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;l(b),c(oC(b))},e[0]=d):d=e[0];let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(js,{className:"w-44",children:o.jsx(As,{})}),e[1]=h):h=e[1];let u;e[2]!==i?(u=rC.map(x=>o.jsx(Dt,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=u):u=e[3];let f;e[4]!==u?(f=o.jsx(Cs,{children:u}),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==f||e[7]!==r?(p=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(ks,{value:r,onValueChange:d,children:[h,f]})}),e[6]=f,e[7]=r,e[8]=p):p=e[8];let m;e[9]!==s||e[10]!==a||e[11]!==n?(m=o.jsx(MV,{automationId:s,triggerIds:n,range:a}),e[9]=s,e[10]=a,e[11]=n,e[12]=m):m=e[12];let g;return e[13]!==p||e[14]!==m?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[p,m]}),e[13]=p,e[14]=m,e[15]=g):g=e[15],g}function sue(){return oC("30d")}function nue(t){const e=z.c(5),{tabId:s}=t;let n;e[0]!==s?(n=S6(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(fr,{}),e[2]=r):r=e[2];let l;return e[3]!==i.id?(l=o.jsx(P.Suspense,{fallback:r,children:o.jsx(iue,{id:i.id})}),e[3]=i.id,e[4]=l):l=e[4],l}function iue(t){const e=z.c(41),{id:s}=t,n=re(),{openPanel:i}=bi(),{data:r,isLoading:l}=KE(s),[a,c]=P.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const h=d;if(l){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(fr,{}),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 N;return e[5]!==C?(N=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]=N):N=e[6],N}let u;e[7]!==r.triggers?(u=r.triggers.map(rue),e[7]=r.triggers,e[8]=u):u=e[8];const f=u;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(y9,{size:14}),e[9]=p):p=e[9];let m;e[10]!==n?(m=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=m):m=e[11];let g;e[12]!==h||e[13]!==m?(g=o.jsxs(me,{variant:"ghost",size:"sm",onClick:h,children:[p,m]}),e[12]=h,e[13]=m,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let y;e[19]!==n?(y=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=y):y=e[20];let _;e[21]!==y?(_={id:"runs",label:y},e[21]=y,e[22]=_):_=e[22];let v;e[23]!==b||e[24]!==_?(v=[b,_],e[23]=b,e[24]=_,e[25]=v):v=e[25];let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=C=>c(C),e[26]=L):L=e[26];let S;e[27]!==v||e[28]!==a?(S=o.jsx(e7,{tabs:v,activeTab:a,onTabChange:L}),e[27]=v,e[28]=a,e[29]=S):S=e[29];let w;e[30]!==S||e[31]!==g?(w=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,S]}),e[30]=S,e[31]=g,e[32]=w):w=e[32];let k;e[33]!==r||e[34]!==s||e[35]!==a||e[36]!==f?(k=a==="settings"?o.jsx(eue,{automationId:s,automation:r}):o.jsx(tue,{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]!==w||e[39]!==k?(j=o.jsx(Ti,{children:o.jsx(Ti.Content,{children:o.jsxs(Ti.Body,{children:[w,k]})})}),e[38]=w,e[39]=k,e[40]=j):j=e[40],j}function rue(t){return t.id}function oue(t){const e=z.c(29),{virtualMcpId:s}=t,n=re(),{openPanel:i}=bi(),{data:r}=WE(s),l=r===void 0?[]:r,{create:a}=g0(),[c,d]=P.useState(""),h=c.toLowerCase(),u=l.filter(R=>R.name.toLowerCase().includes(h));let f;e[0]!==i?(f=R=>i(`automation:${R}`),e[0]=i,e[1]=f):f=e[1];const p=f,m=async()=>{if(a.isPending)return;Je("automation_new_clicked",{virtual_mcp_id:s,existing_count:l.length});const R=await a.mutateAsync(qE(s));p(R.id)},g=a.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ut,{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 y;e[5]!==a.isPending||e[6]!==m||e[7]!==b?(y=o.jsxs(me,{size:"sm",onClick:m,disabled:g,children:[x,b]}),e[5]=a.isPending,e[6]=m,e[7]=b,e[8]=y):y=e[8];const _=y,v=Ti,L=Ti,S=Ti;let w;e[9]!==n?(w=n("automations.automationsList.title"),e[9]=n,e[10]=w):w=e[10];let k;e[11]!==w?(k=o.jsx(Ti.Title,{children:w}),e[11]=w,e[12]=k):k=e[12];const j=l.length>0&&o.jsx(N9,{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 N;e[16]!==k||e[17]!==C?(N=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=N):N=e[18];const T=l.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(al,{image:o.jsx(br,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:_})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(al,{image:o.jsx(br,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(R=>o.jsx(YE,{automation:R,onClick:()=>p(R.id)},R.id))});let V;e[19]!==N||e[20]!==T||e[21]!==S.Body?(V=o.jsxs(S.Body,{children:[N,T]}),e[19]=N,e[20]=T,e[21]=S.Body,e[22]=V):V=e[22];let A;e[23]!==V||e[24]!==L.Content?(A=o.jsx(L.Content,{children:V}),e[23]=V,e[24]=L.Content,e[25]=A):A=e[25];let E;return e[26]!==v||e[27]!==A?(E=o.jsx(v,{children:A}),e[26]=v,e[27]=A,e[28]=E):E=e[28],E}function lue(t){const e=z.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(fr,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(P.Suspense,{fallback:n,children:o.jsx(oue,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function aue(t){const e=z.c(60),{file:s,onClose:n}=t,i=re();let r,l;e[0]!==s.filename?(r=o.jsx(dl,{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=G8(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 h;e[11]!==i?(h=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=h):h=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx($u,{size:14}),e[13]=u):u=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:u}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let p;e[17]!==h||e[18]!==f?(p=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":h,asChild:!0,children:f})}),e[17]=h,e[18]=f,e[19]=p):p=e[19];let m;e[20]!==i?(m=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=m):m=e[21];let g;e[22]!==m?(g=o.jsx(Ue,{side:"bottom",children:m}),e[22]=m,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==p?(x=o.jsxs(He,{children:[p,g]}),e[24]=g,e[25]=p,e[26]=x):x=e[26];let b;e[27]!==i?(b=i("mainPanelTabs.fileTab.openInNewTab"),e[27]=i,e[28]=b):b=e[28];let y;e[29]!==s.downloadUrl?(y=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=y):y=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(un,{size:14}),e[31]=_):_=e[31];let v;e[32]!==b||e[33]!==y?(v=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:_})}),e[32]=b,e[33]=y,e[34]=v):v=e[34];let L;e[35]!==i?(L=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=L):L=e[36];let S;e[37]!==L?(S=o.jsx(Ue,{side:"bottom",children:L}),e[37]=L,e[38]=S):S=e[38];let w;e[39]!==v||e[40]!==S?(w=o.jsxs(He,{children:[v,S]}),e[39]=v,e[40]=S,e[41]=w):w=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(Ai,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let N;e[48]!==i?(N=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=N):N=e[49];let T;e[50]!==N?(T=o.jsx(Ue,{side:"bottom",children:N}),e[50]=N,e[51]=T):T=e[51];let V;e[52]!==C||e[53]!==T?(V=o.jsxs(He,{children:[C,T]}),e[52]=C,e[53]=T,e[54]=V):V=e[54];let A;return e[55]!==x||e[56]!==w||e[57]!==V||e[58]!==d?(A=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,w,V]}),e[55]=x,e[56]=w,e[57]=V,e[58]=d,e[59]=A):A=e[59],A}function cue(t){const e=z.c(31),{fileKey:s,taskId:n}=t,i=re(),{closePanel:r}=bi(),{data:l,isPending:a}=Y6(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 h;e[3]!==r?(h=()=>r(),e[3]=r,e[4]=h):h=e[4];const u=h;if(!d){if(a){let S;return e[5]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(W8,{})}),e[5]=S):S=e[5],S}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(dl,{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 y;e[12]!==b?(y=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=y):y=e[13];let _;e[14]!==i?(_=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=_):_=e[15];let v;e[16]!==u||e[17]!==_?(v=o.jsx(me,{variant:"ghost",size:"sm",onClick:u,children:_}),e[16]=u,e[17]=_,e[18]=v):v=e[18];let L;return e[19]!==x||e[20]!==y||e[21]!==v?(L=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,y,v]}),e[19]=x,e[20]=y,e[21]=v,e[22]=L):L=e[22],L}let f;e[23]!==d||e[24]!==u?(f=o.jsx(aue,{file:d,onClose:u}),e[23]=d,e[24]=u,e[25]=f):f=e[25];let p;e[26]!==d?(p=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(q8,{file:d})}),e[26]=d,e[27]=p):p=e[27];let m;return e[28]!==f||e[29]!==p?(m=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,p]}),e[28]=f,e[29]=p,e[30]=m):m=e[30],m}function due(t){const e=z.c(7),{onClose:s}=t,n=re();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(Sg,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=l):l=e[6],l}function uue(){const t=z.c(10),{closePanel:e}=bi();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(due,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(OE,{}),t[4]=r):r=t[4];let l;t[5]!==n?(l=o.jsx(P.Suspense,{fallback:o.jsx(Sg,{onClose:n,footer:null,children:r}),children:o.jsx(hue,{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(Hs,{fallback:i,children:l})}),t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function hue(t){const e=z.c(46),{onDone:s,onClose:n}=t,i=re(),{org:r}=Be();let l;e[0]!==r.id?(l=QV.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:bl,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=Qt(c);let h;e[5]!==a||e[6]!==r||e[7]!==d?(h={selfClient:d,org:r,cdConnectionId:a},e[5]=a,e[6]=r,e[7]=d,e[8]=h):h=e[8];const u=$E(h),[f,p]=P.useState(!1),[m,g]=P.useState(null);let x;e[9]!==d?(x={mutationFn:async A=>v7(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Vs(x);let y;e[11]!==s||e[12]!==b||e[13]!==u||e[14]!==i?(y=async()=>{if(g(null),u)try{await b.mutateAsync(u)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=u,e[14]=i,e[15]=y):y=e[15];const _=y;let v;e[16]!==m?(v=m?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:m}):null,e[16]=m,e[17]=v):v=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 S;e[21]!==_?(S=()=>{_()},e[21]=_,e[22]=S):S=e[22];let w;e[23]!==f||e[24]!==b.isPending||e[25]!==L||e[26]!==S?(w=o.jsx(hP,{ready:f,pending:b.isPending,label:L,onClick:S}),e[23]=f,e[24]=b.isPending,e[25]=L,e[26]=S,e[27]=w):w=e[27];let k;e[28]!==v||e[29]!==w?(k=o.jsxs(o.Fragment,{children:[v,w]}),e[28]=v,e[29]=w,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 N;e[35]!==a||e[36]!==r||e[37]!==u?(N=o.jsx(BE,{org:r,cdConnectionId:a,siteUrl:u,onReadinessChange:p}),e[35]=a,e[36]=r,e[37]=u,e[38]=N):N=e[38];let T;e[39]!==C||e[40]!==N?(T=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,N]}),e[39]=C,e[40]=N,e[41]=T):T=e[41];let V;return e[42]!==n||e[43]!==k||e[44]!==T?(V=o.jsx(Sg,{onClose:n,footer:k,children:T}),e[42]=n,e[43]=k,e[44]=T,e[45]=V):V=e[45],V}const fue=P.lazy(()=>$s(()=>import("./project-app-view-BHLllTKH.js"),__vite__mapDeps([185,1,2,86,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,87,88,89,15,11,16,23,90,91,92,93,94,95,96,97,98,99,100,7,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,101,102,103,104,105,106,107,108,109,110,111,112,113,114,83,80,115,118,122,123,124,125,126,127,128,129,130,131,116,117,79,119,120,121,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.AppViewContent})));function mue(){const t=z.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(fr,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(fr,{}),t[1]=d):d=t[1];let h;return t[2]!==i?(h=o.jsx(P.Suspense,{fallback:d,children:o.jsx(fue,{connectionId:i,toolName:XV})}),t[2]=i,t[3]=h):h=t[3],h}let r;t[4]!==n?(r=()=>o.jsx(lC,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(fr,{}),t[6]=l):l=t[6];let a;t[7]!==n?(a=o.jsx(P.Suspense,{fallback:l,children:o.jsx(gue,{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(Hs,{fallback:r,children:a})}),t[9]=r,t[10]=a,t[11]=c):c=t[11],c}const pue=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function lC(t){const e=z.c(27),{claimedSiteUrl:s,children:n}=t,i=re(),r=s??void 0;let l;e[0]!==r?(l=tp(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(yp,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(yp,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==i?(d=i("reports.emptyState.title"),e[3]=i,e[4]=d):d=e[4];let h;e[5]!==d?(h=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=h):h=e[6];let u;e[7]!==i?(u=i("reports.emptyState.description"),e[7]=i,e[8]=u):u=e[8];let f;e[9]!==u?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:u}),e[9]=u,e[10]=f):f=e[10];let p;e[11]!==h||e[12]!==f?(p=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[h,f]}),e[11]=h,e[12]=f,e[13]=p):p=e[13];let m;e[14]!==n||e[15]!==a?(m=n??(a?o.jsx("p",{className:"text-sm text-muted-foreground",children:a}):null),e[14]=n,e[15]=a,e[16]=m):m=e[16];let g;e[17]!==i?(g=pue.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]!==m?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[m,x]}),e[21]=x,e[22]=m,e[23]=b):b=e[23];let y;return e[24]!==b||e[25]!==p?(y=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,p,b]}),e[24]=b,e[25]=p,e[26]=y):y=e[26],y}function gue(t){const e=z.c(46),{claimedSiteUrl:s}=t,n=re(),i=Js(),{org:r}=Be();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:bl,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const a=Qt(l);let c;e[3]!==s?(c=tp(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,h]=P.useState(c),[u,f]=P.useState(null);let p;e[5]!==a?(p={mutationFn:async E=>v7(await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}})),retry:!1},e[5]=a,e[6]=p):p=e[6];const m=Vs(p);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==m?(g=async E=>{const R=zE(E);if(!R.ok){f(R.error);return}f(null);const D=tp(R.value)??void 0;Je("reports_start_diagnostic_submitted",{organization_id:r.id,domain:D});try{await m.mutateAsync(R.value)}catch(I){const O=I;Je("reports_start_diagnostic_failed",{organization_id:r.id,domain:D,error:O instanceof Error?O.message:String(O)}),f(O instanceof Error?O.message:"__configurationFailed");return}i({to:Pc.agents,params:{org:r.slug,project:ha(r.id).id,panel:void 0},search:{connect:"1",siteUrl:R.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=m,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=E=>{E.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const y=b;let _;e[15]!==n?(_=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=_):_=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=E=>h(E.target.value),e[17]=v):v=e[17];let L;e[18]!==n?(L=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=L):L=e[19];const S=!!u;let w;e[20]!==m.isPending||e[21]!==d||e[22]!==_||e[23]!==L||e[24]!==S?(w=o.jsx(gt,{"aria-label":_,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:v,placeholder:L,"aria-invalid":S,disabled:m.isPending}),e[20]=m.isPending,e[21]=d,e[22]=_,e[23]=L,e[24]=S,e[25]=w):w=e[25];let k;e[26]!==m.isPending||e[27]!==n?(k=m.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=m.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(bo,{size:16}),e[29]=j):j=e[29];let C;e[30]!==m.isPending||e[31]!==k?(C=o.jsxs(me,{type:"submit",className:"shrink-0",disabled:m.isPending,children:[k,j]}),e[30]=m.isPending,e[31]=k,e[32]=C):C=e[32];let N;e[33]!==w||e[34]!==C?(N=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[w,C]}),e[33]=w,e[34]=C,e[35]=N):N=e[35];let T;e[36]!==u||e[37]!==n?(T=u?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:JE(n,u)}):null,e[36]=u,e[37]=n,e[38]=T):T=e[38];let V;e[39]!==y||e[40]!==N||e[41]!==T?(V=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:y,children:[N,T]}),e[39]=y,e[40]=N,e[41]=T,e[42]=V):V=e[42];let A;return e[43]!==s||e[44]!==V?(A=o.jsx(lC,{claimedSiteUrl:s,children:V}),e[43]=s,e[44]=V,e[45]=A):A=e[45],A}function xue(t){const e=z.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,l=re();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(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{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(N6,{size:14})})}),o.jsx(Ue,{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 h;e[5]!==c?(h=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=h):h=e[6];let u;e[7]!==c?(u=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=u):u=e[8];let f;e[9]!==c||e[10]!==h||e[11]!==u?(f=o.jsx("button",{type:"button",onClick:h,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:u}),e[9]=c,e[10]=h,e[11]=u,e[12]=f):f=e[12];let p;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==l?(p=n.agentUpdated&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx($n,{size:12}),l("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(Ue,{side:"bottom",children:l("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=l,e[16]=p):p=e[16];let m;e[17]!==n.saving||e[18]!==l?(m=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]=m):m=e[19];let g;e[20]!==n||e[21]!==l?(g=n.deckDetected&&n.writable&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInline"),className:ie(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(C8,{size:14})})}),o.jsx(Ue,{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($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),children:o.jsx($u,{size:14})})}),o.jsxs(zt,{align:"end",children:[o.jsxs(Ye,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(XA,{size:14}),l("deck.deckToolbar.exportAsPdf")]}),o.jsx(Ye,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(x9,{size:14}),l("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx($u,{size:14})})})}),o.jsx(Ue,{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 y;e[30]!==c?(y=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=y):y=e[31];let _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(un,{size:14}),e[32]=_):_=e[32];let v;e[33]!==b||e[34]!==y?(v=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:_})}),e[33]=b,e[34]=y,e[35]=v):v=e[35];let L;e[36]!==l?(L=l("deck.deckToolbar.openInNewTab"),e[36]=l,e[37]=L):L=e[37];let S;e[38]!==L?(S=o.jsx(Ue,{side:"bottom",children:L}),e[38]=L,e[39]=S):S=e[39];let w;e[40]!==v||e[41]!==S?(w=o.jsxs(He,{children:[v,S]}),e[40]=v,e[41]=S,e[42]=w):w=e[42];let k;return e[43]!==w||e[44]!==d||e[45]!==f||e[46]!==p||e[47]!==m||e[48]!==g||e[49]!==x||e[50]!==r?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,f,p,m,g,x,w,r]}),e[43]=w,e[44]=d,e[45]=f,e[46]=p,e[47]=m,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const Vc=1;function bue(t){if(typeof t!="object"||t===null||t.v!==Vc||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 Wo extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function aC(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function vue(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?aC(s).length:null}function yue(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new Wo("no <deck-viewer> element in source","no-viewer");const i=aC(n),r=e.kind==="move"?e.from:e.at,l=i[r];if(!l)throw new Wo(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new Wo("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 Wo(`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 Wo(`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 Wo("replace html has no root element","bad-op");l.replaceWith(s.importNode(d,!0));break}default:throw new Wo(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
646
+ `);if(le.trim()){E(!0);try{se(),Je("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:le.length}),p(),await m({tiptapDoc:CL({managerAgentId:r8.AUTOMATION_MANAGER(l.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:le})})}finally{E(!1)}}},M=e.models?.tier??"smart",$=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,B=G2({defaultValues:{name:e.name,active:e.active,tier:M,modelOverride:$,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=B.watch("active"),[H,W]=P.useReducer(Zde,null),K=()=>{H!==null&&(Je("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(H.fields),save_count:H.saveCount,edit_duration_ms:Date.now()-H.start}),W({type:"reset"}))},G=async()=>{const q=B.control._formState.dirtyFields,le=Object.keys(q);if(le.length===0&&!I)return!0;const J=B.getValues(),oe=B.control._defaultValues;B.reset(J,{keepValues:!0});const ee=I;O(!1);const he={tier:J.tier,...J.modelOverride?{modelId:J.modelOverride.modelId,credentialId:J.modelOverride.credentialId,modelTitle:J.modelOverride.title}:{}},ae={id:t,name:J.name,active:J.active,models:he,tools:J.tools,maxAgentSteps:J.maxAgentSteps,messages:WT(x),temperature:0};try{await a.mutateAsync(ae)}catch{return B.reset(oe,{keepValues:!0}),ee&&O(!0),!1}const de=[...le];return ee&&de.push("messages"),W({type:"accumulate",now:Date.now(),fields:de}),te(),!0},{schedule:Y,flush:X}=rf({save:G}),{schedule:te,flush:se}=rf({delayMs:3e4,save:async()=>K()});P.useEffect(()=>{const q=B.watch(()=>Y());return()=>q.unsubscribe()},[]);const ne=q=>{if(b(q),!R){D(!0);return}O(!0),Y()},Q=async()=>{Je("automation_test_clicked",{automation_id:t,agent_id:r});const q=await X();if(se(),!!q){if(!x){ve.error(i("automations.automationDetail.noInstructionsConfigured"));return}try{const le=await d.mutateAsync(t);le.threadId&&(p(),f(le.threadId))}catch{}}};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(me,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(y9,{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(Ss,{control:B.control,name:"name",render:({field:q})=>o.jsx(gt,{...q,placeholder:i("automations.automationDetail.automationNamePlaceholder"),className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),n&&o.jsx(me,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:n,children:o.jsx(Gs,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ss,{control:B.control,name:"active",render:({field:q})=>o.jsx(Pi,{checked:q.value,onCheckedChange:le=>{q.onChange(le),X()},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(NL,{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(Kde,{automationId:t,open:y,onOpenChange:_,onCustomSelect:()=>{w(!0),N(!1),j("")},onEventSelect:()=>{N(!0),w(!1)},onWebhookCreated:q=>{Je("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),V(q)}})]}),e.triggers.length===0&&!S?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(Wde,{trigger:q,automationId:t,connectionName:q.connection_id?u.get(q.connection_id):void 0},q.id))}),S&&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(gu,{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||!Tu(q)))try{await c.mutateAsync({automation_id:t,type:"cron",cron_expression:q}),Je("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ve.success(i("automations.automationDetail.starterAdded")),w(!1),j("")}catch{ve.error(i("automations.automationDetail.failedToAddStarter"))}},onKeyDown:async q=>{const le=k.trim();q.key==="Enter"&&le&&Tu(le)&&q.target.blur(),q.key==="Escape"&&(w(!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&&!Tu(k)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:i("automations.automationDetail.invalid")}),c.isPending&&o.jsx(ct,{size:13,className:"animate-spin 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:()=>{w(!1),j("")},children:o.jsx(Ai,{size:13})})]}),C&&o.jsx(P.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(ct,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:i("automations.automationDetail.loadingConnections")})]}),children:o.jsx(Gde,{automationId:t,onDone:()=>N(!1)})}),o.jsx(iC,{open:T!==null,onOpenChange:q=>{q||V(null)},url:T?.url??null,token:T?.token??null})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:i("automations.automationDetail.instructions")}),o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:A||!x,onClick:F,children:[o.jsx(Jr,{size:13}),i("automations.automationDetail.improve")]})]}),o.jsx(w_,{tiptapDoc:x,setTiptapDoc:ne,placeholder:i("automations.automationDetail.instructionsPlaceholder"),children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(S_,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsxs(me,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:Q,disabled:!r,children:[o.jsx(t9,{size:16}),i("automations.automationDetail.test")]})}),o.jsx(Ue,{children:i("automations.automationDetail.testAutomation")})]})})]})})]}),o.jsxs(s8,{open:v,onOpenChange:L,className:"flex flex-col gap-2.5",children:[o.jsxs(e8,{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(Gt,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),o.jsxs(t8,{className:"flex flex-col gap-5 pt-0.5",children:[o.jsx(Tde,{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(Ede,{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(gt,{type:"number",min:1,max:100,className:"w-40",placeholder:i("automations.automationDetail.maxStepsPlaceholder",{default:Xde}),value:B.watch("maxAgentSteps")??"",onChange:q=>{const le=q.target.value.trim(),J=le===""?null:Number(le);B.setValue("maxAgentSteps",J===null||Number.isNaN(J)?null:J,{shouldDirty:!0})}})]})]})]})]})]})}const rC=[{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 oC(t){const e=rC.find(n=>n.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function tue(t){const e=z.c(16),{automationId:s,triggerIds:n}=t,i=re(),[r,l]=P.useState("30d"),[a,c]=P.useState(sue);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=x=>{const b=x;l(b),c(oC(b))},e[0]=d):d=e[0];let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(js,{className:"w-44",children:o.jsx(As,{})}),e[1]=h):h=e[1];let u;e[2]!==i?(u=rC.map(x=>o.jsx(Dt,{value:x.key,children:i(x.labelKey)},x.key)),e[2]=i,e[3]=u):u=e[3];let f;e[4]!==u?(f=o.jsx(Cs,{children:u}),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==f||e[7]!==r?(p=o.jsx("div",{className:"flex items-center justify-end",children:o.jsxs(ks,{value:r,onValueChange:d,children:[h,f]})}),e[6]=f,e[7]=r,e[8]=p):p=e[8];let m;e[9]!==s||e[10]!==a||e[11]!==n?(m=o.jsx(MV,{automationId:s,triggerIds:n,range:a}),e[9]=s,e[10]=a,e[11]=n,e[12]=m):m=e[12];let g;return e[13]!==p||e[14]!==m?(g=o.jsxs("div",{className:"flex flex-col gap-5",children:[p,m]}),e[13]=p,e[14]=m,e[15]=g):g=e[15],g}function sue(){return oC("30d")}function nue(t){const e=z.c(5),{tabId:s}=t;let n;e[0]!==s?(n=S6(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(fr,{}),e[2]=r):r=e[2];let l;return e[3]!==i.id?(l=o.jsx(P.Suspense,{fallback:r,children:o.jsx(iue,{id:i.id})}),e[3]=i.id,e[4]=l):l=e[4],l}function iue(t){const e=z.c(41),{id:s}=t,n=re(),{openPanel:i}=bi(),{data:r,isLoading:l}=KE(s),[a,c]=P.useState("settings");let d;e[0]!==i?(d=()=>i("automations"),e[0]=i,e[1]=d):d=e[1];const h=d;if(l){let C;return e[2]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(fr,{}),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 N;return e[5]!==C?(N=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]=N):N=e[6],N}let u;e[7]!==r.triggers?(u=r.triggers.map(rue),e[7]=r.triggers,e[8]=u):u=e[8];const f=u;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(y9,{size:14}),e[9]=p):p=e[9];let m;e[10]!==n?(m=n("mainPanelTabs.automationTab.backToList"),e[10]=n,e[11]=m):m=e[11];let g;e[12]!==h||e[13]!==m?(g=o.jsxs(me,{variant:"ghost",size:"sm",onClick:h,children:[p,m]}),e[12]=h,e[13]=m,e[14]=g):g=e[14];let x;e[15]!==n?(x=n("mainPanelTabs.automationTab.settings"),e[15]=n,e[16]=x):x=e[16];let b;e[17]!==x?(b={id:"settings",label:x},e[17]=x,e[18]=b):b=e[18];let y;e[19]!==n?(y=n("mainPanelTabs.automationTab.runs"),e[19]=n,e[20]=y):y=e[20];let _;e[21]!==y?(_={id:"runs",label:y},e[21]=y,e[22]=_):_=e[22];let v;e[23]!==b||e[24]!==_?(v=[b,_],e[23]=b,e[24]=_,e[25]=v):v=e[25];let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=C=>c(C),e[26]=L):L=e[26];let S;e[27]!==v||e[28]!==a?(S=o.jsx(e7,{tabs:v,activeTab:a,onTabChange:L}),e[27]=v,e[28]=a,e[29]=S):S=e[29];let w;e[30]!==S||e[31]!==g?(w=o.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[g,S]}),e[30]=S,e[31]=g,e[32]=w):w=e[32];let k;e[33]!==r||e[34]!==s||e[35]!==a||e[36]!==f?(k=a==="settings"?o.jsx(eue,{automationId:s,automation:r}):o.jsx(tue,{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]!==w||e[39]!==k?(j=o.jsx(Ti,{children:o.jsx(Ti.Content,{children:o.jsxs(Ti.Body,{children:[w,k]})})}),e[38]=w,e[39]=k,e[40]=j):j=e[40],j}function rue(t){return t.id}function oue(t){const e=z.c(29),{virtualMcpId:s}=t,n=re(),{openPanel:i}=bi(),{data:r}=WE(s),l=r===void 0?[]:r,{create:a}=g0(),[c,d]=P.useState(""),h=c.toLowerCase(),u=l.filter(R=>R.name.toLowerCase().includes(h));let f;e[0]!==i?(f=R=>i(`automation:${R}`),e[0]=i,e[1]=f):f=e[1];const p=f,m=async()=>{if(a.isPending)return;Je("automation_new_clicked",{virtual_mcp_id:s,existing_count:l.length});const R=await a.mutateAsync(qE(s));p(R.id)},g=a.isPending;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ut,{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 y;e[5]!==a.isPending||e[6]!==m||e[7]!==b?(y=o.jsxs(me,{size:"sm",onClick:m,disabled:g,children:[x,b]}),e[5]=a.isPending,e[6]=m,e[7]=b,e[8]=y):y=e[8];const _=y,v=Ti,L=Ti,S=Ti;let w;e[9]!==n?(w=n("automations.automationsList.title"),e[9]=n,e[10]=w):w=e[10];let k;e[11]!==w?(k=o.jsx(Ti.Title,{children:w}),e[11]=w,e[12]=k):k=e[12];const j=l.length>0&&o.jsx(N9,{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 N;e[16]!==k||e[17]!==C?(N=o.jsxs("div",{className:"flex flex-col gap-6",children:[k,C]}),e[16]=k,e[17]=C,e[18]=N):N=e[18];const T=l.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(al,{image:o.jsx(br,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.emptyTitle"),description:n("automations.automationsList.emptyDescription"),actions:_})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(al,{image:o.jsx(br,{size:48,className:"text-muted-foreground"}),title:n("automations.automationsList.noResultsTitle"),description:n("automations.automationsList.noResultsDescription",{search:c})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(R=>o.jsx(YE,{automation:R,onClick:()=>p(R.id)},R.id))});let V;e[19]!==N||e[20]!==T||e[21]!==S.Body?(V=o.jsxs(S.Body,{children:[N,T]}),e[19]=N,e[20]=T,e[21]=S.Body,e[22]=V):V=e[22];let A;e[23]!==V||e[24]!==L.Content?(A=o.jsx(L.Content,{children:V}),e[23]=V,e[24]=L.Content,e[25]=A):A=e[25];let E;return e[26]!==v||e[27]!==A?(E=o.jsx(v,{children:A}),e[26]=v,e[27]=A,e[28]=E):E=e[28],E}function lue(t){const e=z.c(3),{virtualMcpId:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(fr,{}),e[0]=n):n=e[0];let i;return e[1]!==s?(i=o.jsx(P.Suspense,{fallback:n,children:o.jsx(oue,{virtualMcpId:s})}),e[1]=s,e[2]=i):i=e[2],i}function aue(t){const e=z.c(60),{file:s,onClose:n}=t,i=re();let r,l;e[0]!==s.filename?(r=o.jsx(dl,{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=G8(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 h;e[11]!==i?(h=i("mainPanelTabs.fileTab.download"),e[11]=i,e[12]=h):h=e[12];let u;e[13]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx($u,{size:14}),e[13]=u):u=e[13];let f;e[14]!==s.downloadUrl||e[15]!==s.filename?(f=o.jsx("a",{href:s.downloadUrl,download:s.filename,children:u}),e[14]=s.downloadUrl,e[15]=s.filename,e[16]=f):f=e[16];let p;e[17]!==h||e[18]!==f?(p=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":h,asChild:!0,children:f})}),e[17]=h,e[18]=f,e[19]=p):p=e[19];let m;e[20]!==i?(m=i("mainPanelTabs.fileTab.download"),e[20]=i,e[21]=m):m=e[21];let g;e[22]!==m?(g=o.jsx(Ue,{side:"bottom",children:m}),e[22]=m,e[23]=g):g=e[23];let x;e[24]!==g||e[25]!==p?(x=o.jsxs(He,{children:[p,g]}),e[24]=g,e[25]=p,e[26]=x):x=e[26];let b;e[27]!==i?(b=i("mainPanelTabs.fileTab.openInNewTab"),e[27]=i,e[28]=b):b=e[28];let y;e[29]!==s.downloadUrl?(y=()=>window.open(s.downloadUrl,"_blank","noopener"),e[29]=s.downloadUrl,e[30]=y):y=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(un,{size:14}),e[31]=_):_=e[31];let v;e[32]!==b||e[33]!==y?(v=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:_})}),e[32]=b,e[33]=y,e[34]=v):v=e[34];let L;e[35]!==i?(L=i("mainPanelTabs.fileTab.openInNewTab"),e[35]=i,e[36]=L):L=e[36];let S;e[37]!==L?(S=o.jsx(Ue,{side:"bottom",children:L}),e[37]=L,e[38]=S):S=e[38];let w;e[39]!==v||e[40]!==S?(w=o.jsxs(He,{children:[v,S]}),e[39]=v,e[40]=S,e[41]=w):w=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(Ai,{size:14}),e[44]=j):j=e[44];let C;e[45]!==n||e[46]!==k?(C=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":k,onClick:n,children:j})}),e[45]=n,e[46]=k,e[47]=C):C=e[47];let N;e[48]!==i?(N=i("mainPanelTabs.fileTab.close"),e[48]=i,e[49]=N):N=e[49];let T;e[50]!==N?(T=o.jsx(Ue,{side:"bottom",children:N}),e[50]=N,e[51]=T):T=e[51];let V;e[52]!==C||e[53]!==T?(V=o.jsxs(He,{children:[C,T]}),e[52]=C,e[53]=T,e[54]=V):V=e[54];let A;return e[55]!==x||e[56]!==w||e[57]!==V||e[58]!==d?(A=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,x,w,V]}),e[55]=x,e[56]=w,e[57]=V,e[58]=d,e[59]=A):A=e[59],A}function cue(t){const e=z.c(31),{fileKey:s,taskId:n}=t,i=re(),{closePanel:r}=bi(),{data:l,isPending:a}=Y6(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 h;e[3]!==r?(h=()=>r(),e[3]=r,e[4]=h):h=e[4];const u=h;if(!d){if(a){let S;return e[5]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"h-full w-full bg-background",children:o.jsx(W8,{})}),e[5]=S):S=e[5],S}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(dl,{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 y;e[12]!==b?(y=o.jsx("span",{className:"text-sm text-muted-foreground",children:b}),e[12]=b,e[13]=y):y=e[13];let _;e[14]!==i?(_=i("mainPanelTabs.fileTab.close"),e[14]=i,e[15]=_):_=e[15];let v;e[16]!==u||e[17]!==_?(v=o.jsx(me,{variant:"ghost",size:"sm",onClick:u,children:_}),e[16]=u,e[17]=_,e[18]=v):v=e[18];let L;return e[19]!==x||e[20]!==y||e[21]!==v?(L=o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[x,y,v]}),e[19]=x,e[20]=y,e[21]=v,e[22]=L):L=e[22],L}let f;e[23]!==d||e[24]!==u?(f=o.jsx(aue,{file:d,onClose:u}),e[23]=d,e[24]=u,e[25]=f):f=e[25];let p;e[26]!==d?(p=o.jsx("div",{className:"relative min-h-0 flex-1",children:o.jsx(q8,{file:d})}),e[26]=d,e[27]=p):p=e[27];let m;return e[28]!==f||e[29]!==p?(m=o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[f,p]}),e[28]=f,e[29]=p,e[30]=m):m=e[30],m}function due(t){const e=z.c(7),{onClose:s}=t,n=re();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(Sg,{onClose:s,footer:null,children:r}),e[4]=s,e[5]=r,e[6]=l):l=e[6],l}function uue(){const t=z.c(10),{closePanel:e}=bi();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(due,{onClose:n}),t[2]=n,t[3]=i):i=t[3];let r;t[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(OE,{}),t[4]=r):r=t[4];let l;t[5]!==n?(l=o.jsx(P.Suspense,{fallback:o.jsx(Sg,{onClose:n,footer:null,children:r}),children:o.jsx(hue,{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(Hs,{fallback:i,children:l})}),t[7]=i,t[8]=l,t[9]=a):a=t[9],a}function hue(t){const e=z.c(46),{onDone:s,onClose:n}=t,i=re(),{org:r}=Be();let l;e[0]!==r.id?(l=QV.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:bl,orgId:r.id,orgSlug:r.slug},e[2]=r.id,e[3]=r.slug,e[4]=c):c=e[4];const d=Qt(c);let h;e[5]!==a||e[6]!==r||e[7]!==d?(h={selfClient:d,org:r,cdConnectionId:a},e[5]=a,e[6]=r,e[7]=d,e[8]=h):h=e[8];const u=$E(h),[f,p]=P.useState(!1),[m,g]=P.useState(null);let x;e[9]!==d?(x={mutationFn:async A=>v7(await d.callTool({name:"COMMERCE_DISCOVERY_RUN",arguments:{siteUrl:A}})),retry:!1},e[9]=d,e[10]=x):x=e[10];const b=Vs(x);let y;e[11]!==s||e[12]!==b||e[13]!==u||e[14]!==i?(y=async()=>{if(g(null),u)try{await b.mutateAsync(u)}catch{g(i("routes.commerceOnboarding.connectModal.somethingWentWrong"));return}s()},e[11]=s,e[12]=b,e[13]=u,e[14]=i,e[15]=y):y=e[15];const _=y;let v;e[16]!==m?(v=m?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:m}):null,e[16]=m,e[17]=v):v=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 S;e[21]!==_?(S=()=>{_()},e[21]=_,e[22]=S):S=e[22];let w;e[23]!==f||e[24]!==b.isPending||e[25]!==L||e[26]!==S?(w=o.jsx(hP,{ready:f,pending:b.isPending,label:L,onClick:S}),e[23]=f,e[24]=b.isPending,e[25]=L,e[26]=S,e[27]=w):w=e[27];let k;e[28]!==v||e[29]!==w?(k=o.jsxs(o.Fragment,{children:[v,w]}),e[28]=v,e[29]=w,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 N;e[35]!==a||e[36]!==r||e[37]!==u?(N=o.jsx(BE,{org:r,cdConnectionId:a,siteUrl:u,onReadinessChange:p}),e[35]=a,e[36]=r,e[37]=u,e[38]=N):N=e[38];let T;e[39]!==C||e[40]!==N?(T=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 overflow-y-auto",children:[C,N]}),e[39]=C,e[40]=N,e[41]=T):T=e[41];let V;return e[42]!==n||e[43]!==k||e[44]!==T?(V=o.jsx(Sg,{onClose:n,footer:k,children:T}),e[42]=n,e[43]=k,e[44]=T,e[45]=V):V=e[45],V}const fue=P.lazy(()=>$s(()=>import("./project-app-view-DLbH_B-S.js"),__vite__mapDeps([185,1,2,86,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,87,88,89,15,11,16,23,90,91,92,93,94,95,96,97,98,99,100,7,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,101,102,103,104,105,106,107,108,109,110,111,112,113,114,83,80,115,118,122,123,124,125,126,127,128,129,130,131,116,117,79,119,120,121,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.AppViewContent})));function mue(){const t=z.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(fr,{}),t[0]=d):d=t[0],d}if(e){let d;t[1]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(fr,{}),t[1]=d):d=t[1];let h;return t[2]!==i?(h=o.jsx(P.Suspense,{fallback:d,children:o.jsx(fue,{connectionId:i,toolName:XV})}),t[2]=i,t[3]=h):h=t[3],h}let r;t[4]!==n?(r=()=>o.jsx(lC,{claimedSiteUrl:n}),t[4]=n,t[5]=r):r=t[5];let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(fr,{}),t[6]=l):l=t[6];let a;t[7]!==n?(a=o.jsx(P.Suspense,{fallback:l,children:o.jsx(gue,{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(Hs,{fallback:r,children:a})}),t[9]=r,t[10]=a,t[11]=c):c=t[11],c}const pue=["reports.emptyState.checkPerformance","reports.emptyState.checkSeo","reports.emptyState.checkFunnel","reports.emptyState.checkTracking"];function lC(t){const e=z.c(27),{claimedSiteUrl:s,children:n}=t,i=re(),r=s??void 0;let l;e[0]!==r?(l=tp(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(yp,{className:"relative h-52 w-40 -rotate-6"}),o.jsx(yp,{className:"relative -ml-14 h-56 w-44 rotate-3"})]}),e[2]=c):c=e[2];let d;e[3]!==i?(d=i("reports.emptyState.title"),e[3]=i,e[4]=d):d=e[4];let h;e[5]!==d?(h=o.jsx("h2",{className:"text-lg font-medium leading-7 text-foreground",children:d}),e[5]=d,e[6]=h):h=e[6];let u;e[7]!==i?(u=i("reports.emptyState.description"),e[7]=i,e[8]=u):u=e[8];let f;e[9]!==u?(f=o.jsx("p",{className:"max-w-sm text-sm leading-5 text-muted-foreground",children:u}),e[9]=u,e[10]=f):f=e[10];let p;e[11]!==h||e[12]!==f?(p=o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[h,f]}),e[11]=h,e[12]=f,e[13]=p):p=e[13];let m;e[14]!==n||e[15]!==a?(m=n??(a?o.jsx("p",{className:"text-sm text-muted-foreground",children:a}):null),e[14]=n,e[15]=a,e[16]=m):m=e[16];let g;e[17]!==i?(g=pue.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]!==m?(b=o.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4",children:[m,x]}),e[21]=x,e[22]=m,e[23]=b):b=e[23];let y;return e[24]!==b||e[25]!==p?(y=o.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-8 p-6",children:[c,p,b]}),e[24]=b,e[25]=p,e[26]=y):y=e[26],y}function gue(t){const e=z.c(46),{claimedSiteUrl:s}=t,n=re(),i=Js(),{org:r}=Be();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:bl,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const a=Qt(l);let c;e[3]!==s?(c=tp(s??void 0)??"",e[3]=s,e[4]=c):c=e[4];const[d,h]=P.useState(c),[u,f]=P.useState(null);let p;e[5]!==a?(p={mutationFn:async E=>v7(await a.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:E}})),retry:!1},e[5]=a,e[6]=p):p=e[6];const m=Vs(p);let g;e[7]!==i||e[8]!==r.id||e[9]!==r.slug||e[10]!==m?(g=async E=>{const R=zE(E);if(!R.ok){f(R.error);return}f(null);const D=tp(R.value)??void 0;Je("reports_start_diagnostic_submitted",{organization_id:r.id,domain:D});try{await m.mutateAsync(R.value)}catch(I){const O=I;Je("reports_start_diagnostic_failed",{organization_id:r.id,domain:D,error:O instanceof Error?O.message:String(O)}),f(O instanceof Error?O.message:"__configurationFailed");return}i({to:Pc.agents,params:{org:r.slug,project:ha(r.id).id,panel:void 0},search:{connect:"1",siteUrl:R.value}})},e[7]=i,e[8]=r.id,e[9]=r.slug,e[10]=m,e[11]=g):g=e[11];const x=g;let b;e[12]!==d||e[13]!==x?(b=E=>{E.preventDefault(),x(d)},e[12]=d,e[13]=x,e[14]=b):b=e[14];const y=b;let _;e[15]!==n?(_=n("reports.emptyState.siteUrlLabel"),e[15]=n,e[16]=_):_=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=E=>h(E.target.value),e[17]=v):v=e[17];let L;e[18]!==n?(L=n("reports.emptyState.siteUrlPlaceholder"),e[18]=n,e[19]=L):L=e[19];const S=!!u;let w;e[20]!==m.isPending||e[21]!==d||e[22]!==_||e[23]!==L||e[24]!==S?(w=o.jsx(gt,{"aria-label":_,type:"text",inputMode:"url",className:"min-w-0 flex-1",value:d,onChange:v,placeholder:L,"aria-invalid":S,disabled:m.isPending}),e[20]=m.isPending,e[21]=d,e[22]=_,e[23]=L,e[24]=S,e[25]=w):w=e[25];let k;e[26]!==m.isPending||e[27]!==n?(k=m.isPending?n("reports.emptyState.starting"):n("reports.emptyState.start"),e[26]=m.isPending,e[27]=n,e[28]=k):k=e[28];let j;e[29]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(bo,{size:16}),e[29]=j):j=e[29];let C;e[30]!==m.isPending||e[31]!==k?(C=o.jsxs(me,{type:"submit",className:"shrink-0",disabled:m.isPending,children:[k,j]}),e[30]=m.isPending,e[31]=k,e[32]=C):C=e[32];let N;e[33]!==w||e[34]!==C?(N=o.jsxs("div",{className:"flex flex-col items-stretch gap-2 sm:flex-row sm:items-center",children:[w,C]}),e[33]=w,e[34]=C,e[35]=N):N=e[35];let T;e[36]!==u||e[37]!==n?(T=u?o.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:JE(n,u)}):null,e[36]=u,e[37]=n,e[38]=T):T=e[38];let V;e[39]!==y||e[40]!==N||e[41]!==T?(V=o.jsxs("form",{className:"flex w-full flex-col gap-2",onSubmit:y,children:[N,T]}),e[39]=y,e[40]=N,e[41]=T,e[42]=V):V=e[42];let A;return e[43]!==s||e[44]!==V?(A=o.jsx(lC,{claimedSiteUrl:s,children:V}),e[43]=s,e[44]=V,e[45]=A):A=e[45],A}function xue(t){const e=z.c(52),{readUrl:s,editor:n,downloadName:i,trailing:r}=t,l=re();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(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{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(N6,{size:14})})}),o.jsx(Ue,{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 h;e[5]!==c?(h=()=>window.open(c,"_blank","noopener"),e[5]=c,e[6]=h):h=e[6];let u;e[7]!==c?(u=o.jsx("span",{className:"truncate",children:c}),e[7]=c,e[8]=u):u=e[8];let f;e[9]!==c||e[10]!==h||e[11]!==u?(f=o.jsx("button",{type:"button",onClick:h,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:c,children:u}),e[9]=c,e[10]=h,e[11]=u,e[12]=f):f=e[12];let p;e[13]!==n.agentUpdated||e[14]!==n.reload||e[15]!==l?(p=n.agentUpdated&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx($n,{size:12}),l("deck.deckToolbar.agentUpdatedReload")]})}),o.jsx(Ue,{side:"bottom",children:l("deck.deckToolbar.agentRewriteWarning")})]}),e[13]=n.agentUpdated,e[14]=n.reload,e[15]=l,e[16]=p):p=e[16];let m;e[17]!==n.saving||e[18]!==l?(m=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]=m):m=e[19];let g;e[20]!==n||e[21]!==l?(g=n.deckDetected&&n.writable&&o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?l("deck.deckToolbar.doneEditing"):l("deck.deckToolbar.editInline"),className:ie(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(C8,{size:14})})}),o.jsx(Ue,{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($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),children:o.jsx($u,{size:14})})}),o.jsxs(zt,{align:"end",children:[o.jsxs(Ye,{onClick:()=>window.open(`${c}#print`,"_blank","noopener"),children:[o.jsx(XA,{size:14}),l("deck.deckToolbar.exportAsPdf")]}),o.jsx(Ye,{asChild:!0,children:o.jsxs("a",{href:c,download:i,children:[o.jsx(x9,{size:14}),l("deck.deckToolbar.downloadHtml")]})})]})]}):o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":l("deck.deckToolbar.download"),asChild:!0,children:o.jsx("a",{href:c,download:i,children:o.jsx($u,{size:14})})})}),o.jsx(Ue,{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 y;e[30]!==c?(y=()=>window.open(c,"_blank","noopener"),e[30]=c,e[31]=y):y=e[31];let _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(un,{size:14}),e[32]=_):_=e[32];let v;e[33]!==b||e[34]!==y?(v=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":b,onClick:y,children:_})}),e[33]=b,e[34]=y,e[35]=v):v=e[35];let L;e[36]!==l?(L=l("deck.deckToolbar.openInNewTab"),e[36]=l,e[37]=L):L=e[37];let S;e[38]!==L?(S=o.jsx(Ue,{side:"bottom",children:L}),e[38]=L,e[39]=S):S=e[39];let w;e[40]!==v||e[41]!==S?(w=o.jsxs(He,{children:[v,S]}),e[40]=v,e[41]=S,e[42]=w):w=e[42];let k;return e[43]!==w||e[44]!==d||e[45]!==f||e[46]!==p||e[47]!==m||e[48]!==g||e[49]!==x||e[50]!==r?(k=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[d,f,p,m,g,x,w,r]}),e[43]=w,e[44]=d,e[45]=f,e[46]=p,e[47]=m,e[48]=g,e[49]=x,e[50]=r,e[51]=k):k=e[51],k}const Vc=1;function bue(t){if(typeof t!="object"||t===null||t.v!==Vc||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 Wo extends Error{constructor(e,s){super(e),this.code=s,this.name="DeckOpError"}code}function aC(t){return[...t.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function vue(t){const s=new DOMParser().parseFromString(t,"text/html").querySelector("deck-viewer");return s?aC(s).length:null}function yue(t,e){const s=new DOMParser().parseFromString(t,"text/html"),n=s.querySelector("deck-viewer");if(!n)throw new Wo("no <deck-viewer> element in source","no-viewer");const i=aC(n),r=e.kind==="move"?e.from:e.at,l=i[r];if(!l)throw new Wo(`slide index ${r} out of range (${i.length})`,"stale-index");switch(e.kind){case"remove":{if(i.length<=1)throw new Wo("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 Wo(`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 Wo(`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 Wo("replace html has no root element","bad-op");l.replaceWith(s.importNode(d,!0));break}default:throw new Wo(`unknown op kind: ${e.kind}`,"bad-op")}return`${t.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
647
647
  `:""}${s.documentElement.outerHTML}
648
648
  `}const ty="home",_ue=400,Lue=800;function wue(t){const e=t.savePath!==void 0,{org:s}=Be(),n=cs(),i=B8(ty),[r,l]=P.useState(!1),[a,c]=P.useState(!1),[d,h]=P.useState(!1),[u,f]=P.useState(!1),[p,m]=P.useState(!1),[g,x]=P.useState(!1),[b,y]=P.useState(null),[_,v]=P.useState(null),[L,S]=P.useState(0),[w]=P.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),k=r||g||p,j=()=>{t.savePath!==void 0&&(n.invalidateQueries({queryKey:Ge.orgFsStat(s.id,ty,t.savePath)}),n.invalidateQueries({queryKey:Ge.orgFsRecent(s.id)}))},C=M=>{w.iframe?.contentWindow?.postMessage(M,"*")},N=()=>{w.source=null,f(!1),_&&y(_),S(M=>M+1),j()};t.statMarker!==_&&(v(t.statMarker),t.statMarker!==null&&(b===null?y(t.statMarker):w.selfMarkers.has(t.statMarker)||t.statMarker!==b&&(k?f(!0):(w.source=null,y(t.statMarker)))));const T=async()=>{w.saveTimer=null;const M=w.source;if(M===null){x(!1);return}m(!0);try{const $=await i.mutateAsync({path:t.savePath,body:M});w.selfMarkers.add(Cg($)),j()}catch($){console.error("[deck-editor] save failed",$),ve.error("Couldn't save deck edits — reloading the preview."),D.current.reload()}finally{m(!1),x(!1)}},V=M=>{x(!0),w.saveTimer&&clearTimeout(w.saveTimer),w.saveTimer=setTimeout(()=>{D.current.flushSave()},M)},A=(M,$,B)=>{C({v:Vc,type:"ack",opId:M,ok:$,error:B})},E=async M=>{if(!e){A(M.opId,!1,"read-only preview");return}try{if(w.source===null){const B=await fetch(t.readUrl,{credentials:"include"});if(!B.ok)throw new Error(`HTTP ${B.status}`);w.source=await B.text()}const $=vue(w.source);if($===null||$!==M.witness.childCount)throw new Wo(`slide count drifted (source ${$}, iframe ${M.witness.childCount})`,"stale-index");w.source=yue(w.source,M.op),A(M.opId,!0),V(M.op.kind==="replace"?Lue:_ue)}catch($){console.error("[deck-editor] op failed",M.op,$),A(M.opId,!1,$ instanceof Error?$.message:String($)),ve.error("That edit couldn't be saved — reloading the preview."),D.current.reload()}},R=M=>{if(!w.iframe||M.source!==w.iframe.contentWindow)return;const $=bue(M.data);if($){if($.type==="ready"){c(!0),D.current.editMode?C({v:Vc,type:"set-edit-mode",enabled:!0}):D.current.railOpen&&C({v:Vc,type:"set-rail",open:!0});return}$.type==="op"&&(w.queue=w.queue.then(()=>D.current.handleOp($)).catch(()=>{}))}},D=P.useRef({onMessage:R,handleOp:E,flushSave:T,reload:N,editMode:r,railOpen:d});D.current={onMessage:R,handleOp:E,flushSave:T,reload:N,editMode:r,railOpen:d};const[I]=P.useState(()=>{let M=null;return $=>{if($){w.iframe=$;const B=U=>D.current.onMessage(U);window.addEventListener("message",B),M=()=>window.removeEventListener("message",B)}else M?.(),M=null,w.iframe=null}}),O=M=>{h(M),C({v:Vc,type:"set-rail",open:M})},F=M=>{l(M),C({v:Vc,type:"set-edit-mode",enabled:M}),M&&h(!0),!M&&u&&!g&&!p&&N()};return{iframeRef:I,deckDetected:a,writable:e,displayedMarker:b===null?null:`${b}.${L}`,editMode:r,setEditMode:F,railOpen:d,setRailOpen:O,saving:p,agentUpdated:u,reload:N,postToIframe:C}}const Sue=300;function cC({readUrl:t,marker:e,title:s,savePath:n,trailing:i}){const r=wue({readUrl:t,statMarker:e,savePath:n}),[l,a]=P.useState(null);if(r.displayedMarker===null)return null;const c=t.includes("?")?"&":"?",d=`${t}${c}v=${encodeURIComponent(r.displayedMarker)}`,h=l===d;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(xue,{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:ie("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",h?"opacity-100":"opacity-0"),style:{transitionDuration:`${Sue}ms`},title:s},d)})]})}const kue=[{mode:"private",labelKey:"library.fileShareButton.modeOrgOnly",Icon:cd},{mode:"public",labelKey:"library.fileShareButton.modePublic",Icon:zn},{mode:"password",labelKey:"library.fileShareButton.modePassword",Icon:C9}];function dC(t){const e=z.c(56),{volume:s,path:n,kind:i,shareMode:r,effectivePublic:l,url:a}=t,c=re(),d=TP(s),{data:h}=Ng(s,n),u=h?.shareMode??r,p=(h?.effectivePublic??l)&&u==="private",m=i==="dir",g=m?"folder":"file",[x,b]=P.useState(!1),[y,_]=P.useState(""),[v,L]=P.useState(!1);let S;e[0]!==n||e[1]!==d||e[2]!==g||e[3]!==c?(S=(M,$)=>{d.mutate({path:n,mode:M,password:$},{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]=S):S=e[4];const w=S;let k;e[5]!==w?(k=M=>{if(M==="password"){b(!0);return}b(!1),w(M)},e[5]=w,e[6]=k):k=e[6];const j=k,C=x?"password":u;let N;e[7]!==c||e[8]!==a?(N=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]=N):N=e[9];const T=N;let V;e[10]!==v||e[11]!==T||e[12]!==c||e[13]!==a?(V=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(me,{variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:T,"aria-label":c("library.fileShareButton.copyLink"),children:v?o.jsx(Kt,{size:12,className:"text-success"}):o.jsx(dn,{size:12})})]}):null,e[10]=v,e[11]=T,e[12]=c,e[13]=a,e[14]=V):V=e[14];const A=V;if(p){let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx("div",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:o.jsx(zn,{size:16})}),e[15]=M):M=e[15];let $;e[16]!==c?($=c("library.fileShareButton.sharedViaParent"),e[16]=c,e[17]=$):$=e[17];let B;e[18]!==$?(B=o.jsx("span",{className:"text-sm font-medium text-foreground",children:$}),e[18]=$,e[19]=B):B=e[19];const U=m?"files in this folder":"this file";let H;e[20]!==c||e[21]!==U?(H=c("library.fileShareButton.inheritedDescription",{target:U}),e[20]=c,e[21]=U,e[22]=H):H=e[22];let W;e[23]!==H?(W=o.jsx("span",{className:"text-xs text-muted-foreground",children:H}),e[23]=H,e[24]=W):W=e[24];let K;e[25]!==W||e[26]!==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 G;return e[28]!==A||e[29]!==K?(G=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[K,A]}),e[28]=A,e[29]=K,e[30]=G):G=e[30],G}let E;e[31]!==C||e[32]!==j||e[33]!==d.isPending||e[34]!==c?(E=kue.map(M=>{const{mode:$,labelKey:B,Icon:U}=M;return o.jsxs("button",{type:"button",disabled:d.isPending,onClick:()=>j($),className:ie("flex flex-col items-center gap-1 rounded-md px-2 py-2 text-xs font-medium transition-colors disabled:opacity-60",C===$?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(U,{size:15}),c(B)]},$)}),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 D;e[38]!==C||e[39]!==m||e[40]!==c?(D=C==="private"?c("library.fileShareButton.privateDescription",{target:m?"these files":"this link"}):C==="public"?c(m?"library.fileShareButton.publicFolderDescription":"library.fileShareButton.publicFileDescription"):c("library.fileShareButton.passwordDescription",{target:m?"files in this folder":"this file"}),e[38]=C,e[39]=m,e[40]=c,e[41]=D):D=e[41];let I;e[42]!==D?(I=o.jsx("p",{className:"text-xs text-muted-foreground",children:D}),e[42]=D,e[43]=I):I=e[43];let O;e[44]!==C||e[45]!==w||e[46]!==u||e[47]!==y||e[48]!==d.isPending||e[49]!==c?(O=C==="password"&&o.jsxs("form",{className:"flex items-center gap-2",onSubmit:M=>{M.preventDefault(),y&&w("password",y)},children:[o.jsx(gt,{type:"password",value:y,onChange:M=>_(M.target.value),placeholder:c(u==="password"?"library.fileShareButton.newPasswordPlaceholder":"library.fileShareButton.passwordPlaceholder"),autoComplete:"new-password",className:"h-8 text-xs"}),o.jsx(me,{type:"submit",size:"sm",className:"shrink-0",disabled:!y||d.isPending,children:c(u==="password"?"library.fileShareButton.buttonUpdate":"library.fileShareButton.buttonSet")})]}),e[44]=C,e[45]=w,e[46]=u,e[47]=y,e[48]=d.isPending,e[49]=c,e[50]=O):O=e[50];let F;return e[51]!==A||e[52]!==R||e[53]!==I||e[54]!==O?(F=o.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-3",children:[R,I,O,A]}),e[51]=A,e[52]=R,e[53]=I,e[54]=O,e[55]=F):F=e[55],F}function e2(t){const e=z.c(21),{volume:s,path:n,shareMode:i,effectivePublic:r,url:l}=t,a=re();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(OP,{size:14}),e[2]=d):d=e[2];let h;e[3]!==c?(h=o.jsx(Fe,{asChild:!0,children:o.jsx(ts,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon","aria-label":c,children:d})})}),e[3]=c,e[4]=h):h=e[4];let u;e[5]!==a?(u=a("library.fileShareButton.share"),e[5]=a,e[6]=u):u=e[6];let f;e[7]!==u?(f=o.jsx(Ue,{side:"bottom",children:u}),e[7]=u,e[8]=f):f=e[8];let p;e[9]!==h||e[10]!==f?(p=o.jsxs(He,{children:[h,f]}),e[9]=h,e[10]=f,e[11]=p):p=e[11];let m;e[12]!==r||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==s?(m=o.jsx(ss,{align:"end",className:"w-80 p-3",children:o.jsx(dC,{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]=m):m=e[17];let g;return e[18]!==p||e[19]!==m?(g=o.jsxs(ns,{children:[p,m]}),e[18]=p,e[19]=m,e[20]=g):g=e[20],g}function jue(t){const e=z.c(14),{target:s,onOpenChange:n}=t,i=re(),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(ms,{children:o.jsx(Jt,{children:a})}),e[3]=a,e[4]=c):c=e[4];let d;e[5]!==s?(d=s&&o.jsx(dC,{...s}),e[5]=s,e[6]=d):d=e[6];let h;e[7]!==c||e[8]!==d?(h=o.jsxs(Wt,{className:"sm:max-w-md",children:[c,d]}),e[7]=c,e[8]=d,e[9]=h):h=e[9];let u;return e[10]!==n||e[11]!==r||e[12]!==h?(u=o.jsx(qt,{open:r,onOpenChange:n,children:h}),e[10]=n,e[11]=r,e[12]=h,e[13]=u):u=e[13],u}const wm="home";function Cue(t){const e=z.c(5),{label:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Pt,{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 Nue(t){const e=z.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=Ng(wm,s,n),r=jg(wm)(s);if(i.isPending||!i.data){const f=!i.isPending&&!i.data?"Waiting for the deck to sync…":void 0;let p;return e[1]!==f?(p=o.jsx(Cue,{label:f}),e[1]=f,e[2]=p):p=e[2],p}let l;e[3]!==i.data?(l=Cg(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 h;e[5]!==s||e[6]!==a||e[7]!==c||e[8]!==d?(h=o.jsx(e2,{volume:wm,path:s,shareMode:a,effectivePublic:c,url:d}),e[5]=s,e[6]=a,e[7]=c,e[8]=d,e[9]=h):h=e[9];let u;return e[10]!==s||e[11]!==r||e[12]!==l||e[13]!==h?(u=o.jsx(cC,{readUrl:r,marker:l,title:s,savePath:s,trailing:h}),e[10]=s,e[11]=r,e[12]=l,e[13]=h,e[14]=u):u=e[14],u}function Tue(t){const e=z.c(13),{previewPath:s}=t,n=re(),i=Js(),r=xo({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:Pc.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 h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(cl,{size:14}),e[7]=h):h=e[7];let u;e[8]!==n?(u=n("library.seeInLibrary.label"),e[8]=n,e[9]=u):u=e[9];let f;return e[10]!==d||e[11]!==u?(f=o.jsxs(me,{variant:"ghost",size:"sm",onClick:d,className:"shrink-0 gap-1.5 text-xs text-muted-foreground",children:[h,u]}),e[10]=d,e[11]=u,e[12]=f):f=e[12],f}const Vue=t=>/\.html?$/i.test(t);function sy(t){const e=z.c(10),{onClose:s}=t,n=re();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ai,{size:14}),e[0]=i):i=e[0];let r;e[1]!==s?(r=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{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(Ue,{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(He,{children:[r,a]}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c}function uC(t){const e=z.c(67),{previewPath:s,onClose:n,showSeeInLibrary:i,variant:r}=t,l=i===void 0?!1:i,a=re();let c;e[0]!==s?(c=Ig(s),e[0]=s,e[1]=c):c=e[1];const d=c,{volume:h,dirPath:u}=d,{data:f,isPending:p}=Ng(h,u),m=jg(h??"");let g,x,b,y,_,v,L,S,w;if(e[2]!==m||e[3]!==f||e[4]!==u||e[5]!==n||e[6]!==s||e[7]!==l||e[8]!==r||e[9]!==h){w=Symbol.for("react.early_return_sentinel");e:{x=ln(u),b=r==="dialog";let A;e[19]!==s||e[20]!==l?(A=l?o.jsx(Tue,{previewPath:s}):null,e[19]=s,e[20]=l,e[21]=A):A=e[21];const E=A;if(g=f&&f.kind==="file"?{key:s,filename:x,size:f.size,downloadUrl:m(f.path)}:null,g&&f&&Vue(x)){const D=g.downloadUrl;let I;e[22]!==f?(I=Cg(f),e[22]=f,e[23]=I):I=e[23];const O=h??"",F=f.shareMode??"private",M=f.effectivePublic??!1,$=window.location.origin+g.downloadUrl;let B;e[24]!==u||e[25]!==O||e[26]!==F||e[27]!==M||e[28]!==$?(B=o.jsx(e2,{volume:O,path:u,shareMode:F,effectivePublic:M,url:$}),e[24]=u,e[25]=O,e[26]=F,e[27]=M,e[28]=$,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(sy,{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],w=o.jsxs(o.Fragment,{children:[b&&o.jsx(Jt,{className:"sr-only",children:x}),o.jsx(cC,{readUrl:D,marker:I,title:x,savePath:h==="home"?u: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?(S=ie("flex shrink-0 items-center gap-1 border-b border-border/60",R),e[37]=R,e[38]=S):S=e[38],y="flex min-w-0 flex-1 items-center gap-2 px-2",_=o.jsx(dl,{filename:x,className:"h-4.5 w-3.5 shrink-0"}),v=b?o.jsx(Jt,{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:G8(g.size)})}e[2]=m,e[3]=f,e[4]=u,e[5]=n,e[6]=s,e[7]=l,e[8]=r,e[9]=h,e[10]=g,e[11]=x,e[12]=b,e[13]=y,e[14]=_,e[15]=v,e[16]=L,e[17]=S,e[18]=w}else g=e[10],x=e[11],b=e[12],y=e[13],_=e[14],v=e[15],L=e[16],S=e[17],w=e[18];if(w!==Symbol.for("react.early_return_sentinel"))return w;let k;e[39]!==y||e[40]!==_||e[41]!==v||e[42]!==L?(k=o.jsxs("div",{className:y,children:[_,v,L]}),e[39]=y,e[40]=_,e[41]=v,e[42]=L,e[43]=k):k=e[43];let j;e[44]!==f?.effectivePublic||e[45]!==f?.shareMode||e[46]!==g||e[47]!==u||e[48]!==a||e[49]!==h?(j=g&&o.jsxs(o.Fragment,{children:[o.jsx(e2,{volume:h??"",path:u,shareMode:f?.shareMode??"private",effectivePublic:f?.effectivePublic??!1,url:window.location.origin+g.downloadUrl}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",asChild:!0,children:o.jsx("a",{href:g.downloadUrl,download:g.filename,children:o.jsx($u,{size:14})})})}),o.jsx(Ue,{side:"bottom",children:a("library.previewContent.download")})]}),o.jsxs(He,{children:[o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>window.open(g.downloadUrl,"_blank","noopener"),children:o.jsx(un,{size:14})})}),o.jsx(Ue,{side:"bottom",children:a("library.previewContent.openInNewTab")})]})]}),e[44]=f?.effectivePublic,e[45]=f?.shareMode,e[46]=g,e[47]=u,e[48]=a,e[49]=h,e[50]=j):j=e[50];let C;e[51]!==b||e[52]!==n?(C=!b&&o.jsx(sy,{onClose:n}),e[51]=b,e[52]=n,e[53]=C):C=e[53];let N;e[54]!==j||e[55]!==C||e[56]!==S||e[57]!==k?(N=o.jsxs("div",{className:S,children:[k,j,C]}),e[54]=j,e[55]=C,e[56]=S,e[57]=k,e[58]=N):N=e[58];let T;e[59]!==g||e[60]!==x||e[61]!==p||e[62]!==a?(T=o.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:g?o.jsx(q8,{file:g}):p?o.jsx(W8,{}):o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[o.jsx(dl,{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]=p,e[62]=a,e[63]=T):T=e[63];let V;return e[64]!==N||e[65]!==T?(V=o.jsxs(o.Fragment,{children:[N,T]}),e[64]=N,e[65]=T,e[66]=V):V=e[66],V}function Aue(t){const e=z.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(uC,{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 Pue(t){const e=z.c(5),{path:s}=t,{closePanel:n}=bi();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(Aue,{previewPath:s,onClose:r,showSeeInLibrary:!0}),e[2]=r,e[3]=s,e[4]=l):l=e[4],l}function Eue(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"),h=t("library.brandComponentsPreview.infoBadge"),u=t("library.brandComponentsPreview.allChip"),f=t("library.brandComponentsPreview.incomeChip"),p=t("library.brandComponentsPreview.spendingChip"),m=t("library.brandComponentsPreview.emailPlaceholder");return`
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 $ue(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Oue).replaceAll("{{title}}",Mue).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function Bue(t){const e=z.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=Ou(s),l=Ou(i??"");if(r.isPending||i&&l.isPending){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(Pt,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=h):h=e[0],h}if(r.isError||!r.data){let h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=h):h=e[1],h}const a=l.data??null;let c;e[2]!==a||e[3]!==r.data?(c=$ue(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 cu(t){const e=z.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 zue(t){const e=z.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 u;e[7]!==i||e[8]!==l||e[9]!==r?(u=f=>{const p=r(f),m=`${f.name.replace(/^--brand-/,"")}: ${p}`;return i&&/^#/.test(p)?o.jsx("input",{type:"color","aria-label":f.name,title:m,value:nR(p),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:m,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:p}},f.name)},e[7]=i,e[8]=l,e[9]=r,e[10]=u):u=e[10],c=n.map(u),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 h;return e[13]!==a||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=h):h=e[15],h}function Fue(t){const e=z.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 hC(t){const e=z.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let l;e[0]!==s||e[1]!==n?(l=o.jsx(Fue,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],a=s.name.replace(u,""),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(gt,{value:n,onChange:u=>r(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=r,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==c||e[15]!==d?(h=o.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=h):h=e[16],h}function Gd(t){const e=z.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(cu,{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 u;e[7]!==i||e[8]!==l||e[9]!==r?(u=f=>o.jsx(hC,{token:f,value:r(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=r,e[10]=u):u=e[10],c=n.map(u),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 h;return e[13]!==a||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=h):h=e[15],h}function Uue({brandPath:t,onClose:e,variant:s}){const n=re(),{org:i}=Be(),r=Ig(t),l=r.volume??"",a=r.dirPath,c=ln(a),d=r.readOnly,h=cs(),u=c0(),f=B8(l),{upload:p,remove:m}=Mu(l),g=P.useRef(null),x=z8(l,a),b=x.data??[],y=Z=>b.some(ge=>ge.kind==="file"&&ln(ge.path)===Z),_=y("tokens.css"),v=y("brand.md"),L=y("slides-theme.html"),S=ZE(b),w=u(l,`${a}/tokens.css`),k=u(l,`${a}/brand.md`),j=u(l,`${a}/slides-theme.html`),C=Ou(w,{enabled:_}),N=Ou(k,{enabled:v}),[T,V]=P.useState(!1),[A,E]=P.useState({}),[R,D]=P.useState(null),[I,O]=P.useState(!1),[F,M]=P.useState(!1),[$,B]=P.useState("deck"),U=C.data?eR(C.data):[],H=Z=>U.find(ge=>ge.name===Z)?.value,W=Z=>A[Z.name]??Z.value,K=tR(U),G=U.filter(Z=>Z.kind==="font"),Y=U.filter(Z=>Z.kind==="type"),X=U.filter(Z=>Z.kind==="space"),te=U.filter(Z=>Z.kind==="radius"),se=U.filter(Z=>Z.kind==="shadow"),ne=U.filter(Z=>Z.kind==="motion"),Q=U.filter(Z=>Z.kind==="other"),q=(Z,ge)=>E(be=>({...be,[Z]:ge})),le=L&&$==="deck",J=R??N.data??"",oe=Object.entries(A).filter(([Z,ge])=>H(Z)!==ge),ee=R!==null&&R!==(N.data??""),he=oe.length>0||ee;function ae(){E({}),D(null),V(!1)}async function de(){O(!0);try{if(oe.length>0){let Z=C.data??"";for(const[ge,be]of oe)Z=sR(Z,ge,be);await f.mutateAsync({path:`${a}/tokens.css`,body:Z,contentType:"text/css; charset=utf-8"}),h.invalidateQueries({queryKey:Ge.fileText(w)})}ee&&R!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:R,contentType:"text/markdown; charset=utf-8"}),h.invalidateQueries({queryKey:Ge.fileText(k)})),h.invalidateQueries({queryKey:Ge.orgFsVolume(i.id,l)}),h.invalidateQueries({queryKey:Ge.orgFsRecent(i.id)}),E({}),D(null),V(!1),ve.success(n("library.brandPreview.brandSaved"))}catch(Z){ve.error(Z instanceof Error?Z.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function ue(Z){const ge=Z?.[0];if(!ge)return;const ke=`logo.${(ge.name.split(".").pop()??"png").toLowerCase()}`;try{await p.mutateAsync({dir:a,files:[new File([ge],ke,{type:ge.type})]}),S&&ln(S)!==ke&&await m.mutateAsync(S),ve.success(n("library.brandPreview.logoUpdated"))}catch(we){ve.error(we instanceof Error?we.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const pe=!x.isPending&&!_&&!v&&!S;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(sp,{size:18})}),s==="dialog"?o.jsx(Jt,{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&&(T?o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"ghost",size:"sm",onClick:ae,disabled:I,children:n("library.brandPreview.cancel")}),o.jsx(me,{size:"sm",disabled:!he||I,onClick:()=>{de()},children:n(I?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[o.jsx(ZA,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(zV,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(Is,{size:16})})}):o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(Is,{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(Pt,{className:"h-40 w-full rounded-xl"}),o.jsx(Pt,{className:"h-4 w-1/3"}),o.jsx(Pt,{className:"h-4 w-2/3"})]}):pe?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(F?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(Z=>!Z),onKeyDown:Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),M(ge=>!ge))},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:Z=>Z.stopPropagation(),children:[L&&o.jsx("button",{type:"button",onClick:()=>{B("deck"),M(!1)},className:ie("rounded-md px-2.5 py-1",le?"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:ie("rounded-md px-2.5 py-1",le?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),F?o.jsx(Gt,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(_7,{size:16,className:"shrink-0 text-muted-foreground"})]}),!F&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",le?"aspect-[16/9]":"h-96"),children:le?o.jsx(Bue,{readUrl:j,title:`${c} deck theme`,tokensUrl:w}):o.jsx(Iue,{tokensUrl:w})})})]}),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(cu,{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:S?o.jsx("img",{src:u(l,S),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(sp,{size:28,className:"text-muted-foreground/50"})}),T&&o.jsxs("div",{children:[o.jsxs(me,{variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Xn,{size:14}),n(S?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:Z=>{ue(Z.target.files)}})]})]})]}),K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(cu,{children:n("library.brandPreview.colors")}),K.map(Z=>o.jsx(zue,{family:Z.family,tokens:Z.tokens,editing:T,valueOf:W,onEdit:q},Z.family))]}),(G.length>0||Y.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(cu,{children:n("library.brandPreview.typography")}),G.map(Z=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:Z.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),T?o.jsx(gt,{value:W(Z),onChange:ge=>q(Z.name,ge.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(Z)},children:W(Z)})]},Z.name)),Y.map(Z=>o.jsx(hC,{token:Z,value:W(Z),editing:T,onEdit:q},Z.name))]}),o.jsx(Gd,{label:n("library.brandPreview.spacing"),tokens:X,editing:T,valueOf:W,onEdit:q}),o.jsx(Gd,{label:n("library.brandPreview.radius"),tokens:te,editing:T,valueOf:W,onEdit:q}),o.jsx(Gd,{label:n("library.brandPreview.shadows"),tokens:se,editing:T,valueOf:W,onEdit:q}),o.jsx(Gd,{label:n("library.brandPreview.motion"),tokens:ne,editing:T,valueOf:W,onEdit:q}),o.jsx(Gd,{label:n("library.brandPreview.tokens"),tokens:Q,editing:T,valueOf:W,onEdit:q}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(cu,{children:n("library.brandPreview.voiceGuidelines")}),T?o.jsx(ho,{value:J,onChange:Z=>D(Z.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):N.isPending&&v?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Pt,{className:"h-3 w-full"}),o.jsx(Pt,{className:"h-3 w-5/6"})]}):J.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(pd,{id:`brand-preview-${t}`,text:J})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function fC(t){const e=z.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(Wt,{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(Uue,{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(qt,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7],l}function mC(t){const e=z.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(Wt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(uC,{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(qt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function Hue(t){const e=z.c(11),{onOpenDir:s}=t,n=re(),i=QE();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(x0,{name:d.volume,glyph:Vn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:L7(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 $x(t){return`${window.location.origin}${t}`}function Vu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Kue=[Bu,"uploads","outputs"],pC=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Xn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Jr}],t2=new Set([...pC.map(t=>t.volume),Zc("public")]),Wue=6;function gC(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=X8(t),r=i?`public/${i}`:t==="home"?zu(s):t;return n?`${r}/${n}`:r}function Nh(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 Jo(t){const e=z.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 Kr(t){const e=z.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 b1(t){const e=z.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx(Kr,{children:Array.from({length:n*3},que)}),e[0]=n,e[1]=i):i=e[1],i}function que(t,e){return o.jsx(Pt,{className:"h-16 rounded-2xl"},e)}function Bx(t){const e=z.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 Gue(t){const e=z.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,l=re(),a=AP(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 h;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(h=o.jsx(x0,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:r}),e[6]=i,e[7]=r,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11],h}function Yue(t){const e=z.c(12),{onOpenDir:s}=t,n=re(),r=F8().data?.length??0;let l;e[0]!==s?(l=pC.map(h=>o.jsx(Gue,{volume:h.volume,descriptionKey:h.descriptionKey,glyph:h.glyph,onOpen:()=>s(h.volume)},h.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(x0,{name:Zc("public"),meta:n("library.libraryViews.skillSetsCount",{count:r}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:br,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(Hue,{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 Jue(t){const e=z.c(19),{segments:s,onNavigate:n}=t,{org:i}=Be();let r;e[0]!==s?(r=s[0]===Bu?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:zu(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Bu),children:zu(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let h;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=(p,m)=>{const g=s.slice(0,a+m+1).join("/"),x=m===l.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(qs,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Zc(p)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Zc(p)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],h=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=h}else h=e[10];let u;return e[16]!==d||e[17]!==h?(u=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,h]}),e[16]=d,e[17]=h,e[18]=u):u=e[18],u}function Que(t){const e=z.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:l,onDelete:a}=t,c=re(),{org:d}=Be(),h=c0(),u=VP(s,n);let f;e[0]!==h||e[1]!==l?(f=w=>l({volume:w.volume,path:w.path,kind:"file",shareMode:w.shareMode??"private",effectivePublic:w.effectivePublic??!1,url:$x(h(w.volume,w.path))}),e[0]=h,e[1]=l,e[2]=f):f=e[2];const p=f;if(u.isPending){let w;return e[3]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(b1,{rows:2}),e[3]=w):w=e[3],w}let m,g,x,b,y;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==i||e[8]!==c){y=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(Bx,{children:k}),e[17]=k,e[18]=j):j=e[18],y=j;break e}const w=(i||u.isPlaceholderData)&&"opacity-50";e[19]!==w?(b=ie("flex flex-col gap-3",w),e[19]=w,e[20]=b):b=e[20],m=Jo,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=u.data,e[6]=u.isPlaceholderData,e[7]=i,e[8]=c,e[9]=m,e[10]=g,e[11]=x,e[12]=b,e[13]=y}else m=e[9],g=e[10],x=e[11],b=e[12],y=e[13];if(y!==Symbol.for("react.early_return_sentinel"))return y;let _;e[21]!==m||e[22]!==x?(_=o.jsx(m,{children:x}),e[21]=m,e[22]=x,e[23]=_):_=e[23];let v;if(e[24]!==h||e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==p){let w;e[31]!==h||e[32]!==a||e[33]!==r||e[34]!==d||e[35]!==p?(w=k=>{const j=X8(k.volume)!==null;return o.jsx(w7,{filename:ln(k.path),updatedAt:k.updatedAt,downloadUrl:h(k.volume,k.path),subtitle:gC(k.volume,k.path,d.slug),publicState:Vu(k),onOpen:()=>r(Z8(k.volume,k.path)),onShare:j?void 0:()=>p(k),onDelete:j?void 0:()=>a({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=h,e[32]=a,e[33]=r,e[34]=d,e[35]=p,e[36]=w):w=e[36],v=g.map(w),e[24]=h,e[25]=a,e[26]=r,e[27]=d,e[28]=g,e[29]=p,e[30]=v}else v=e[30];let L;e[37]!==v?(L=o.jsx(Kr,{children:v}),e[37]=v,e[38]=L):L=e[38];let S;return e[39]!==b||e[40]!==_||e[41]!==L?(S=o.jsxs("div",{className:b,children:[_,L]}),e[39]=b,e[40]=_,e[41]=L,e[42]=S):S=e[42],S}function Xue(t){const e=z.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=re(),{org:l}=Be(),a=$8(),c=c0();let d;e[0]!==c||e[1]!==n?(d=y=>n({volume:y.volume,path:y.path,kind:"file",shareMode:y.shareMode??"private",effectivePublic:y.effectivePublic??!1,url:$x(c(y.volume,y.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const h=d;if(a.isPending){let y;e[3]!==r?(y=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=y):y=e[4];let _;e[5]!==y?(_=o.jsx(Jo,{children:y}),e[5]=y,e[6]=_):_=e[6];let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(b1,{}),e[7]=v):v=e[7];let L;return e[8]!==_?(L=o.jsxs("div",{className:"flex flex-col gap-3",children:[_,v]}),e[8]=_,e[9]=L):L=e[9],L}let u,f,p,m,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==h||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const y=(a.data??[]).slice(0,Wue);if(y.length===0){g=null;break e}p="flex flex-col gap-3";let _;e[22]!==r?(_=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=_):_=e[23],e[24]!==_?(m=o.jsx(Jo,{children:_}),e[24]=_,e[25]=m):m=e[25],u=Kr;let v;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==h?(v=L=>o.jsx(oR,{filename:ln(L.path),updatedAt:L.updatedAt,size:L.size,downloadUrl:c(L.volume,L.path),subtitle:gC(L.volume,L.path,l.slug),publicState:Vu(L),onOpen:()=>s(Z8(L.volume,L.path)),onShare:()=>h(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]=h,e[31]=v):v=e[31],f=y.map(v)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=h,e[16]=r,e[17]=u,e[18]=f,e[19]=p,e[20]=m,e[21]=g}else u=e[17],f=e[18],p=e[19],m=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==f?(x=o.jsx(u,{children:f}),e[32]=u,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==p||e[36]!==m||e[37]!==x?(b=o.jsxs("div",{className:p,children:[m,x]}),e[35]=p,e[36]=m,e[37]=x,e[38]=b):b=e[38],b}function Zue(t){const e=z.c(16),{onOpenDir:s}=t,n=re(),i=F8();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(b1,{}),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 h;return e[5]!==d?(h=o.jsx(Bx,{children:d}),e[5]=d,e[6]=h):h=e[6],h}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=h=>o.jsx(x0,{name:h,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${h}`)},h),e[11]=s,e[12]=n,e[13]=d):d=e[13],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(Kr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function e0e(t){const e=z.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:h,onMove:u}=t,f=re(),{org:p}=Be(),m=s.volume??"",g=z8(m,s.dirPath),x=c0();let b;e[0]!==s.isHomeRoot||e[1]!==p?(b=T=>s.isHomeRoot&&t2.has(T.toLowerCase())?`${zu(p.slug)}/${T}`:void 0,e[0]=s.isHomeRoot,e[1]=p,e[2]=b):b=e[2];const y=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?o.jsx(Yue,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const v=_;if(g.isPending){let T;e[6]!==v||e[7]!==f?(T=v&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.folders")}),o.jsx(Kr,{children:v})]}),e[6]=v,e[7]=f,e[8]=T):T=e[8];let V;e[9]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(b1,{rows:2}),e[9]=V):V=e[9];let A;return e[10]!==T?(A=o.jsxs(o.Fragment,{children:[T,V]}),e[10]=T,e[11]=A):A=e[11],A}if(g.isError){let T;e[12]!==g.error||e[13]!==f?(T=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=T):T=e[14];let V;return e[15]!==T?(V=o.jsx("p",{className:"text-sm text-destructive",children:T}),e[15]=T,e[16]=V):V=e[16],V}let L,S,w,k,j;if(e[17]!==y||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==h||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==a||e[30]!==v||e[31]!==f||e[32]!==m){j=Symbol.for("react.early_return_sentinel");e:{const T=g.data??[],V=T.filter(i0e),A=T.filter(n0e),E=T.filter(s0e),R=T.filter(t0e);if(T.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 $;e[41]!==M?($=o.jsx(Bx,{children:M}),e[41]=M,e[42]=$):$=e[42],j=$;break e}let D;e[43]!==s.readOnly||e[44]!==c||e[45]!==m?(D=M=>s.readOnly?void 0:()=>c({volume:m,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=m,e[46]=D):D=e[46];const I=D;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==m?(O=M=>s.readOnly?void 0:()=>a({volume:m,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?$x(x(m,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=m,e[51]=O):O=e[51];const F=O;L=V.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.skills")}),o.jsx(Kr,{children:V.map(M=>o.jsx(iR,{dirName:ln(M.path),updatedAt:M.updatedAt,skillMdUrl:x(m,`${M.path}/SKILL.md`),publicState:Vu(M),onOpen:()=>r(vc(s,M.path)),onBrowse:()=>n(vc(s,M.path)),onShare:F(M),onDelete:I(M),draggable:!s.readOnly,...Nh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),S=A.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.brands")}),o.jsx(Kr,{children:A.map(M=>o.jsx(rR,{dirName:ln(M.path),updatedAt:M.updatedAt,tokensUrl:x(m,`${M.path}/tokens.css`),onOpen:()=>l(vc(s,M.path)),onBrowse:()=>n(vc(s,M.path)),onDelete:I(M),draggable:!s.readOnly,...Nh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),w=(E.length>0||v)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.folders")}),o.jsxs(Kr,{children:[v,E.map(M=>o.jsx(x0,{name:ln(M.path),meta:L7(M.updatedAt),subtitle:y(ln(M.path)),readOnly:s.readOnly,publicState:Vu(M),onOpen:()=>n(vc(s,M.path)),onShare:F(M),onDelete:I(M),draggable:!s.readOnly,...Nh(M.path,"dir",{onDragStart:d,onContextMenu:h,onDrop:u})},M.path))]})]}),k=R.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.files")}),o.jsx(Kr,{children:R.map(M=>o.jsx(w7,{filename:ln(M.path),updatedAt:M.updatedAt,downloadUrl:x(m,M.path),publicState:Vu(M),onOpen:()=>i(vc(s,M.path)),onShare:F(M),onDelete:I(M),draggable:!s.readOnly,...Nh(M.path,"file",{onDragStart:d,onContextMenu:h})},M.path))})]})}e[17]=y,e[18]=x,e[19]=g.data,e[20]=s,e[21]=h,e[22]=c,e[23]=d,e[24]=u,e[25]=l,e[26]=n,e[27]=i,e[28]=r,e[29]=a,e[30]=v,e[31]=f,e[32]=m,e[33]=L,e[34]=S,e[35]=w,e[36]=k,e[37]=j}else L=e[33],S=e[34],w=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(Xue,{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 N;return e[57]!==L||e[58]!==S||e[59]!==w||e[60]!==k||e[61]!==C?(N=o.jsxs(o.Fragment,{children:[L,S,w,k,C]}),e[57]=L,e[58]=S,e[59]=w,e[60]=k,e[61]=C,e[62]=N):N=e[62],N}function t0e(t){return t.kind==="file"}function s0e(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function n0e(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function i0e(t){return t.kind==="dir"&&t.hasSkill}function r0e({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=re(),{org:i}=Be(),r=cs(),l=Js(),a=gl(),c=xl({strict:!1}),d=c.path||Bu,h=Ig(d),u=XE(),f=h.volume!==null&&u.has(h.volume)?{...h,readOnly:!0}:h,p=(Z,ge)=>l({to:".",search:be=>({...be,[Z]:ge||void 0})}),m=Z=>p("path",Z),g=(Z,ge)=>l({to:".",search:be=>({...be,preview:void 0,skill:void 0,brand:void 0,[Z]:ge})}),x=t??(Z=>g("preview",Z)),b=e??(Z=>g("skill",Z)),y=s??(Z=>g("brand",Z)),[_,v]=P.useState(""),L=R9(_.trim(),300),S=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,w=S?n("library.library.searchInPlaceholder",{folder:Zc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?zu(i.slug):Zc(f.segments.at(-1)??""),[j,C]=P.useState(null),[N,T]=P.useState(null),[V,A]=P.useState(!1),[E,R]=P.useState(""),[D,I]=P.useState(!1),[O,F]=P.useState(null),[M,$]=P.useState(""),B=P.useRef(null),[U,H]=P.useState(!1),W=P.useRef(0),K=f.readOnly?null:f.volume,{upload:G,mkdir:Y,move:X}=Mu(K??Bu),{remove:te}=Mu(j?.volume??"uploads");async function se(Z){if(!(!K||!Z||Z.length===0))try{await G.mutateAsync({dir:f.dirPath,files:[...Z]}),ve.success(Z.length===1?n("library.library.uploadedSingle",{filename:Z[0]?.name??""}):n("library.library.uploadedMultiple",{count:Z.length}))}catch(ge){ve.error(ge instanceof Error?ge.message:n("library.library.uploadFailed"))}finally{B.current&&(B.current.value="")}}const ne=K!==null;function Q(Z){return Z.dataTransfer.types.includes("Files")}function q(Z){!ne||!Q(Z)||(Z.preventDefault(),W.current+=1,H(!0))}function le(Z){!ne||!Q(Z)||Z.preventDefault()}function J(){ne&&(W.current=Math.max(0,W.current-1),W.current===0&&H(!1))}function oe(Z){ne&&(Z.preventDefault(),Z.stopPropagation(),W.current=0,H(!1),Z.dataTransfer.files.length>0&&se(Z.dataTransfer.files))}async function ee(){const Z=E.trim();if(!(!K||!Z)){if(f.isHomeRoot&&t2.has(Z.toLowerCase())){ve.error(n("library.library.folderNameReserved",{name:Z}));return}try{const ge=f.dirPath;await Y.mutateAsync(ge?`${ge}/${Z}`:Z),ve.success(n("library.library.folderCreated",{name:Z})),A(!1),R("")}catch(ge){ve.error(ge instanceof Error?ge.message:n("library.library.folderCreateFailed"))}}}async function he(){if(!j)return;const Z=j;try{await te.mutateAsync(Z.path),ve.success(n("library.library.deleted",{name:ln(Z.path)}))}catch(ge){ve.error(ge instanceof Error?ge.message:n("library.library.deleteFailed"))}finally{C(null)}}async function ae(){if(!O)return;const Z=M.trim();if(!Z||Z.includes("/")||Z.includes("..")||Z===ln(O.path)){I(!1),F(null),$("");return}if(O.kind==="dir"&&f.isHomeRoot&&t2.has(Z.toLowerCase())){ve.error(n("library.library.folderNameReserved",{name:Z}));return}try{const ge=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",be=ge?`${ge}/${Z}`:Z;await X.mutateAsync({from:O.path,to:be});const ke=Z.replace(/[<>]/g,"");ve.success(n("library.library.renamed",{name:ke}))}catch(ge){ve.error(ge instanceof Error?ge.message:n("library.library.renameFailed"))}finally{I(!1),F(null),$("")}}async function de(Z,ge){try{const be=ln(Z),ke=ge?`${ge}/${be}`:be;await X.mutateAsync({from:Z,to:ke}),ve.success(n("library.library.moved",{name:be,destination:ge||n("library.library.theLibrary")}))}catch(be){ve.error(be instanceof Error?be.message:n("library.library.moveFailed"))}}function ue(){for(const Z of Kue)r.invalidateQueries({queryKey:Ge.orgFsVolume(i.id,Z)});f.volume&&r.invalidateQueries({queryKey:Ge.orgFsVolume(i.id,f.volume)}),r.invalidateQueries({queryKey:Ge.orgFsRecent(i.id)}),r.invalidateQueries({queryKey:Ge.orgFsSearchRoot(i.id)}),r.invalidateQueries({queryKey:Ge.orgFsPublicSets(i.id)})}function pe(Z){Z.defaultPrevented||!K||Z.target.closest("input, textarea, button, a, [role='button']")||(Z.preventDefault(),A(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:q,onDragOver:le,onDragLeave:J,onDrop:oe,onContextMenu:pe,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(Xn,{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(Jue,{segments:f.segments,onNavigate:m})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(A9,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(gt,{value:_,onChange:Z=>v(Z.target.value),onKeyDown:Z=>{Z.key==="Escape"&&v("")},placeholder:w,className:"h-9 rounded-xl pr-9 pl-9"}),_&&o.jsx(me,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>v(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(Ai,{size:14})})]}),o.jsx(me,{variant:"ghost",size:"icon",onClick:ue,"aria-label":n("library.library.refresh"),children:o.jsx($n,{size:14})}),K&&o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[o.jsx(Ut,{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(p0,{size:12}),n("library.library.readOnly")]}):o.jsxs(me,{size:"sm",disabled:G.isPending,onClick:()=>B.current?.click(),children:[o.jsx(Xn,{size:14}),G.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:B,type:"file",multiple:!0,className:"hidden",onChange:Z=>{se(Z.target.files)}})]}),L?o.jsx(Que,{query:L,scope:S,stale:_.trim()!==L,onOpenFile:x,onShare:T,onDelete:C}):f.volume===null?o.jsx(Zue,{onOpenDir:m}):o.jsx(e0e,{location:f,onOpenDir:m,onOpenFile:x,onOpenSkill:b,onOpenBrand:y,onShare:T,onDelete:C,onContextMenu:(Z,ge)=>{F({path:Z,kind:ge}),$(ln(Z)),I(!0)},onMove:de},f.volume)]})}),a&&(c.preview?o.jsx(mC,{previewPath:c.preview,onClose:()=>p("preview",null)}):c.skill?o.jsx(Y8,{skillPath:c.skill,onClose:()=>p("skill",null)},c.skill):c.brand?o.jsx(fC,{brandPath:c.brand,onClose:()=>p("brand",null)},c.brand):null),o.jsx(qt,{open:V,onOpenChange:A,children:o.jsxs(Wt,{children:[o.jsxs(ms,{children:[o.jsx(Jt,{children:n("library.library.newFolderTitle")}),o.jsx(Tn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(gt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:Z=>R(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&ee()}}),o.jsxs(Jn,{children:[o.jsx(me,{variant:"outline",onClick:()=>A(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!E.trim()||Y.isPending,onClick:()=>{ee()},children:n("library.library.create")})]})]})}),o.jsx(qt,{open:D,onOpenChange:Z=>{I(Z),Z||(F(null),$(""))},children:o.jsxs(Wt,{children:[o.jsxs(ms,{children:[o.jsx(Jt,{children:O&&n("library.library.renameTitle",{name:ln(O.path)})}),o.jsx(Tn,{children:n("library.library.renameDescription")})]}),o.jsx(gt,{autoFocus:!0,value:M,onChange:Z=>$(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&ae()}}),o.jsxs(Jn,{children:[o.jsx(me,{variant:"outline",onClick:()=>I(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!M.trim()||X.isPending,onClick:()=>{ae()},children:n("library.library.rename")})]})]})}),o.jsx(jue,{target:N,onOpenChange:Z=>{Z||T(null)}}),o.jsx(no,{open:j!==null,onOpenChange:Z=>{Z||C(null)},children:o.jsxs(io,{children:[o.jsxs(ro,{children:[o.jsx(oo,{children:n("library.library.deleteTitle",{name:j?ln(j.path):""})}),o.jsx(lo,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(ao,{children:[o.jsx(co,{children:n("library.library.cancel")}),o.jsx(uo,{onClick:()=>{he()},children:n("library.library.delete")})]})]})})]})}function o0e(){const t=z.c(10),{openPanel:e}=bi(),[s,n]=P.useState(null),[i,r]=P.useState(null);let l;t[0]!==e?(l=o.jsx(r0e,{onOpenFile:h=>e(_T(h)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==s?(a=s&&o.jsx(Y8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=a):a=t[3];let c;t[4]!==i?(c=i&&o.jsx(fC,{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 ny=P.lazy(()=>$s(()=>import("./project-app-view-BHLllTKH.js"),__vite__mapDeps([185,1,2,86,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,87,88,89,15,11,16,23,90,91,92,93,94,95,96,97,98,99,100,7,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,101,102,103,104,105,106,107,108,109,110,111,112,113,114,83,80,115,118,122,123,124,125,126,127,128,129,130,131,116,117,79,119,120,121,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.AppViewContent}))),l0e=P.lazy(()=>$s(()=>import("./hosting-tab-DYQ8Rh0p.js"),__vite__mapDeps([186,1,2,30,28,42,46,9,29,31,32,33,34,35,36,37,38,39,40,41,8,43,44,45,47,10,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,143,80,83,123,7,79,90,187,23,15,11,16,152])).then(t=>({default:t.HostingTab}))),a0e=P.lazy(()=>$s(()=>import("./e2e-tab-Dmto2BvH.js"),__vite__mapDeps([188,1,2,37,28,42,29,30,31,32,33,34,35,36,38,39,40,41,8,43,44,45,46,9,47,10,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,143,80,83,123,7,79,90,187,23,15,11,16,152,86,87,88,89,91,92,93,94,95,96,97,98,99,100,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,119])).then(t=>({default:t.E2eTab}))),c0e=P.lazy(()=>$s(()=>import("./analytics-tab-D9IxcyEr.js"),__vite__mapDeps([189,1,2,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,143,145,80,83,90,111,112,113,123,7,187,23,15,11,16,152,190])).then(t=>({default:t.AnalyticsTab}))),d0e=P.lazy(()=>$s(()=>import("./cdn-tab-D-8RFlx4.js"),__vite__mapDeps([191,1,2,53,111,112,113,187,132,23,15,11,16,152,190,192,193])).then(t=>({default:t.CdnTab})));function u0e({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:i,automationTabParsed:r}){const l=R8(),a=Oc().monitorEnabled===!0||Oc().auth.localMode===!0;if(t==="overview")return o.jsx(zX,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(kZ,{})});if(LT(t))return o.jsx(V5,{virtualMcpId:e});if(t==="git")return o.jsx(ute,{virtualMcpId:e});if(t==="automations")return o.jsx(lue,{virtualMcpId:e});if(t==="preview")return o.jsx(sae,{virtualMcpId:e});const c=wT(t);if(c)return o.jsx(iae,{openPath:c.path});if(t==="content")return o.jsx(gde,{virtualMcpId:e});if(t==="assets")return o.jsx(xde,{virtualMcpId:e});if(t==="hosting"&&l.hosting)return o.jsx(l0e,{virtualMcpId:e});if(t==="e2e"&&l.e2e)return o.jsx(a0e,{virtualMcpId:e});if(t==="analytics"&&l.analytics)return o.jsx(c0e,{virtualMcpId:e});if(t==="cdn"&&a&&l.monitor)return o.jsx(d0e,{virtualMcpId:e});if(t==="files")return o.jsx(o0e,{});if(t==="reports")return o.jsx(mue,{});if(t==="connect-sources")return o.jsx(uue,{});if(r)return o.jsx(nue,{tabId:t});const d=j6(t);if(d)return o.jsx(Nue,{path:d.path},d.path);const h=k6(t);if(h)return o.jsx(cue,{fileKey:h.key,taskId:s});const u=C6(t);if(u)return o.jsx(Pue,{path:u.path},u.path);const f=ST(t);if(f){const m=i.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(P.Suspense,{fallback:o.jsx(fr,{}),children:o.jsx(ny,{connectionId:f.connectionId,toolName:f.toolName,args:m?.args},t)})}const p=n.find(m=>m.id===t);return p?o.jsx(P.Suspense,{fallback:o.jsx(fr,{}),children:o.jsx(ny,{connectionId:p.view.appId,toolName:p.id,args:p.view.args},t)}):o.jsx(V5,{virtualMcpId:e})}function h0e(t){const e=z.c(14),{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}=k3(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(fr,{}),e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(h=o.jsx(P.Suspense,{fallback:d,children:o.jsx(u0e,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=r,e[5]=c,e[6]=a,e[7]=l,e[8]=s,e[9]=n,e[10]=h):h=e[10];let u;return e[11]!==r||e[12]!==h?(u=o.jsx(Hs,{children:h},r),e[11]=r,e[12]=h,e[13]=u):u=e[13],u}function f0e(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&kT.has(t.mainTab))}const Hl="setup";function m0e(t){const e=z.c(57),s=re();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let v;e[3]!==t.scriptTabs?(v=L=>!t.scriptTabs.includes(L),e[3]=t.scriptTabs,e[4]=v):v=e[4],n=t.scripts.filter(v),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===Hl?t.onToggle():t.onSelectTab(Hl)},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(Gt,{className:"size-4"}):o.jsx(_7,{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(Fe,{asChild:!0,children:o.jsx(me,{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 h;e[17]!==t.open||e[18]!==s?(h=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=h):h=e[19];let u;e[20]!==h?(u=o.jsx(Ue,{children:h}),e[20]=h,e[21]=u):u=e[21];let f;e[22]!==d||e[23]!==u?(f=o.jsxs(He,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=f):f=e[24];const p=t.active===Hl;let m;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==p?(m=o.jsx(p0e,{active:p,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=p,e[29]=m):m=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(v=>o.jsx(x0e,{active:t.active===v,onClick:()=>{t.active===v?t.onToggle():t.onSelectTab(v)},onClose:()=>t.onCloseScript(v),t:s,children:v},v)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(b0e,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==m?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[m,g,x]}),e[36]=g,e[37]=x,e[38]=m,e[39]=b):b=e[39];let y;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?(y=t.showScriptControls?o.jsx(v0e,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(g0e,{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]=y):y=e[52];let _;return e[53]!==b||e[54]!==y||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,y]}),e[53]=b,e[54]=y,e[55]=f,e[56]=_):_=e[56],_}function p0e(t){const e=z.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=ie("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(cP,{className:"size-4"}),e[2]=h):h=e[2];let u;e[3]!==r?(u=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=u):u=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==u?(f=o.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[h,u]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=u,e[10]=f):f=e[10],f}function g0e(t){const e=z.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(ql,{className:"size-3.5"}),e[0]=d):d=e[0];let h;e[1]!==c?(h=c("sandbox.toolbar.start"),e[1]=c,e[2]=h):h=e[2];let u;return e[3]!==n||e[4]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:n,children:[d," ",h]}),e[3]=n,e[4]=h,e[5]=u):u=e[5],u}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(ql,{className:"size-3.5"}),e[6]=d):d=e[6];let h;e[7]!==c?(h=c("sandbox.toolbar.resume"),e[7]=c,e[8]=h):h=e[8];let u;return e[9]!==l||e[10]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:l,children:[d," ",h]}),e[9]=l,e[10]=h,e[11]=u):u=e[11],u}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx($n,{className:"size-3.5"}),e[12]=d):d=e[12];let h;e[13]!==c?(h=c("sandbox.toolbar.retry"),e[13]=c,e[14]=h):h=e[14];let u;return e[15]!==a||e[16]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:a,children:[d," ",h]}),e[15]=a,e[16]=h,e[17]=u):u=e[17],u}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,h=d?"rounded-r-none border-r-0":void 0;let u;e[18]!==h?(u=ie(h),e[18]=h,e[19]=u):u=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let p;e[22]!==i||e[23]!==u||e[24]!==f?(p=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:i,className:u,children:f})}),e[22]=i,e[23]=u,e[24]=f,e[25]=p):p=e[25];let m;e[26]!==c?(m=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=m):m=e[27];let g;e[28]!==m?(g=o.jsx(Ue,{children:m}),e[28]=m,e[29]=g):g=e[29];let x;e[30]!==p||e[31]!==g?(x=o.jsxs(He,{children:[p,g]}),e[30]=p,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(Gt,{className:"size-3"})})}),o.jsx(zt,{align:"end",children:o.jsxs(Ye,{onClick:r,children:[o.jsx($n,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=r,e[34]=d,e[35]=c,e[36]=b):b=e[36];let y;return e[37]!==x||e[38]!==b?(y=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=y):y=e[39],y}return null}function x0e(t){const e=z.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=ie("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",h=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let u;e[2]!==d||e[3]!==h?(u=ie("flex h-full items-center",d,h),e[2]=d,e[3]=h,e[4]=u):u=e[4];let f;e[5]!==r||e[6]!==n||e[7]!==u?(f=o.jsx("button",{type:"button",onClick:n,className:u,children:r}),e[5]=r,e[6]=n,e[7]=u,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==i||e[11]!==l?(p=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(Is,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=l,e[12]=p):p=e[12];let m;return e[13]!==c||e[14]!==f||e[15]!==p?(m=o.jsxs("div",{className:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16],m}function b0e(t){const e=z.c(27),{scripts:s,onRun:n}=t,i=re(),[r,l]=P.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(Ut,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=o.jsx(Fe,{asChild:!0,children:o.jsx(ts,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let h;e[5]!==i?(h=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=h):h=e[6];let u;e[7]!==h?(u=o.jsx(Ue,{children:h}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=o.jsxs(He,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let p;e[12]!==i?(p=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=p):p=e[13];let m;e[14]!==p?(m=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:p}),e[14]=p,e[15]=m):m=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(y=>o.jsxs("button",{type:"button",onClick:()=>{l(!1),n(y)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",y]},y)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==m||e[21]!==g?(x=o.jsxs(ss,{align:"start",className:"p-1 w-56",children:[m,g]}),e[20]=m,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==f?(b=o.jsxs(ns,{open:r,onOpenChange:l,children:[f,x]}),e[23]=r,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function v0e(t){const e=z.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(ct,{className:"size-3.5 animate-spin"}),e[0]=f):f=e[0];let p;e[1]!==l?(p=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=p):p=e[2];let m;return e[3]!==p?(m=o.jsxs(me,{variant:"outline",size:"xs",disabled:!0,children:[f," ",p]}),e[3]=p,e[4]=m):m=e[4],m}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(ql,{className:"size-3.5"}),e[5]=f):f=e[5];let p;e[6]!==l?(p=l("sandbox.toolbar.run"),e[6]=l,e[7]=p):p=e[7];let m;e[8]!==i||e[9]!==p?(m=o.jsx(Fe,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"xs",onClick:i,children:[f," ",p]})}),e[8]=i,e[9]=p,e[10]=m):m=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(Ue,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==m||e[16]!==x?(b=o.jsxs(He,{children:[m,x]}),e[15]=m,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(Fe,{asChild:!0,children:o.jsx(me,{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 h;e[25]!==d?(h=o.jsx(Ue,{children:d}),e[25]=d,e[26]=h):h=e[26];let u;return e[27]!==c||e[28]!==h?(u=o.jsxs(He,{children:[c,h]}),e[27]=c,e[28]=h,e[29]=u):u=e[29],u}var xC=Object.defineProperty,y0e=Object.getOwnPropertyDescriptor,_0e=(t,e)=>{for(var s in e)xC(t,s,{get:e[s],enumerable:!0})},Rs=(t,e,s,n)=>{for(var i=n>1?void 0:n?y0e(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&&xC(e,s,i),i},qe=(t,e)=>(s,n)=>e(s,n,t),iy="Terminal input",s2={get:()=>iy,set:t=>iy=t},ry="Too much output to announce, navigate to rows manually to read",n2={get:()=>ry,set:t=>ry=t};function L0e(t){return t.replace(/\r?\n/g,"\r")}function w0e(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function S0e(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function k0e(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");bC(i,e,s,n)}}function bC(t,e,s,n){t=L0e(t),t=w0e(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function vC(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 oy(t,e,s,n,i){vC(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Go(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function v1(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 j0e=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}},C0e=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,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)p<<=6,p|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-m;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[m++]=g,p<<=6,p|=g&63}f||(x===2?p<128?d--:e[n++]=p:x===3?p<2048||p>=55296&&p<=57343||p===65279||(e[n++]=p):p<65536||p>1114111||(e[n++]=p)),this.interim.fill(0)}let h=s-4,u=d;for(;u<s;){for(;u<h&&!((i=t[u])&128)&&!((r=t[u+1])&128)&&!((l=t[u+2])&128)&&!((a=t[u+3])&128);)e[n++]=i,e[n++]=r,e[n++]=l,e[n++]=a,u+=4;if(i=t[u++],i<128)e[n++]=i;else if((i&224)===192){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(c=(i&31)<<6|r&63,c<128){u--;continue}e[n++]=c}else if((i&240)===224){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[u++],(l&192)!==128){u--;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(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[u++],(l&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=l,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(i&7)<<18|(r&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},yC="",tl=" ",M0=class _C{constructor(){this.fg=0,this.bg=0,this.extended=new Uf}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 _C;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}},Uf=class LC{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 LC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},fi=class wC extends M0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Uf,this.combinedData=""}static fromCharData(e){let s=new wC;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?Go(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()]}},ly="di$target",i2="di$dependencies",Sm=new Map;function N0e(t){return t[i2]||[]}function on(t){if(Sm.has(t))return Sm.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");T0e(e,s,i)};return e._id=t,Sm.set(t,e),e}function T0e(t,e,s){e[ly]===e?e[i2].push({id:t,index:s}):(e[i2]=[{id:t,index:s}],e[ly]=e)}var In=on("BufferService"),SC=on("CoreMouseService"),Na=on("CoreService"),V0e=on("CharsetService"),zx=on("InstantiationService"),kC=on("LogService"),Mn=on("OptionsService"),jC=on("OscLinkService"),A0e=on("UnicodeService"),O0=on("DecorationService"),r2=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 fi,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let h=0;h<l;h++)if(!(c===-1&&!s.hasContent(h))){if(s.loadCell(h,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=h,a=r.extended.urlId;continue}else d=r.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&h===l-1){let u=this._oscLinkService.getLinkData(a)?.uri;if(u){let f={start:{x:c+1,y:t},end:{x:h+(!d&&h===l-1?1:0),y:t}},p=!1;if(!i?.allowNonHttpProtocols)try{let m=new URL(u);["http:","https:"].includes(m.protocol)||(p=!0)}catch{p=!0}p||n.push({text:u,range:f,activate:(m,g)=>i?i.activate(m,g,f):P0e(m,g),hover:(m,g)=>i?.hover?.(m,g,f),leave:(m,g)=>i?.leave?.(m,g,f)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=h,a=r.extended.urlId):(c=-1,a=-1)}}e(n)}};r2=Rs([qe(0,In),qe(1,Mn),qe(2,jC)],r2);function P0e(t,e){if(confirm(`Do you want to navigate to ${e}?
808
+ `);function $ue(t,e){const s=e?`<style>${e}</style>`:"";return t.replaceAll("{{{slides}}}",Oue).replaceAll("{{title}}",Mue).replace(/(src=")(\/deck-runtime\/)/g,`$1${window.location.origin}$2`).replace("</head>",`${s}</head>`)}function Bue(t){const e=z.c(8),{readUrl:s,title:n,tokensUrl:i}=t,r=Ou(s),l=Ou(i??"");if(r.isPending||i&&l.isPending){let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full w-full items-center justify-center p-6",children:o.jsx(Pt,{className:"aspect-[16/9] w-full max-w-3xl rounded-xl"})}),e[0]=h):h=e[0],h}if(r.isError||!r.data){let h;return e[1]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This theme is no longer available."}),e[1]=h):h=e[1],h}const a=l.data??null;let c;e[2]!==a||e[3]!==r.data?(c=$ue(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 cu(t){const e=z.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 zue(t){const e=z.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 u;e[7]!==i||e[8]!==l||e[9]!==r?(u=f=>{const p=r(f),m=`${f.name.replace(/^--brand-/,"")}: ${p}`;return i&&/^#/.test(p)?o.jsx("input",{type:"color","aria-label":f.name,title:m,value:nR(p),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:m,className:"size-7 rounded-md border border-border/60",style:{backgroundColor:p}},f.name)},e[7]=i,e[8]=l,e[9]=r,e[10]=u):u=e[10],c=n.map(u),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 h;return e[13]!==a||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-1.5",children:[a,d]}),e[13]=a,e[14]=d,e[15]=h):h=e[15],h}function Fue(t){const e=z.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 hC(t){const e=z.c(17),{token:s,value:n,editing:i,onEdit:r}=t;let l;e[0]!==s||e[1]!==n?(l=o.jsx(Fue,{token:s,value:n}),e[0]=s,e[1]=n,e[2]=l):l=e[2];let a;if(e[3]!==s.name){let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/^--brand-/,e[5]=u):u=e[5],a=s.name.replace(u,""),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(gt,{value:n,onChange:u=>r(s.name,u.target.value),className:"h-8 w-40 font-mono text-xs"}):o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n}),e[8]=i,e[9]=r,e[10]=s.name,e[11]=n,e[12]=d):d=e[12];let h;return e[13]!==l||e[14]!==c||e[15]!==d?(h=o.jsxs("div",{className:"flex items-center gap-3",children:[l,c,d]}),e[13]=l,e[14]=c,e[15]=d,e[16]=h):h=e[16],h}function Gd(t){const e=z.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(cu,{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 u;e[7]!==i||e[8]!==l||e[9]!==r?(u=f=>o.jsx(hC,{token:f,value:r(f),editing:i,onEdit:l},f.name),e[7]=i,e[8]=l,e[9]=r,e[10]=u):u=e[10],c=n.map(u),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 h;return e[13]!==a||e[14]!==d?(h=o.jsxs("div",{className:"flex flex-col gap-3",children:[a,d]}),e[13]=a,e[14]=d,e[15]=h):h=e[15],h}function Uue({brandPath:t,onClose:e,variant:s}){const n=re(),{org:i}=Be(),r=Ig(t),l=r.volume??"",a=r.dirPath,c=ln(a),d=r.readOnly,h=cs(),u=c0(),f=B8(l),{upload:p,remove:m}=Mu(l),g=P.useRef(null),x=z8(l,a),b=x.data??[],y=Z=>b.some(ge=>ge.kind==="file"&&ln(ge.path)===Z),_=y("tokens.css"),v=y("brand.md"),L=y("slides-theme.html"),S=ZE(b),w=u(l,`${a}/tokens.css`),k=u(l,`${a}/brand.md`),j=u(l,`${a}/slides-theme.html`),C=Ou(w,{enabled:_}),N=Ou(k,{enabled:v}),[T,V]=P.useState(!1),[A,E]=P.useState({}),[R,D]=P.useState(null),[I,O]=P.useState(!1),[F,M]=P.useState(!1),[$,B]=P.useState("deck"),U=C.data?eR(C.data):[],H=Z=>U.find(ge=>ge.name===Z)?.value,W=Z=>A[Z.name]??Z.value,K=tR(U),G=U.filter(Z=>Z.kind==="font"),Y=U.filter(Z=>Z.kind==="type"),X=U.filter(Z=>Z.kind==="space"),te=U.filter(Z=>Z.kind==="radius"),se=U.filter(Z=>Z.kind==="shadow"),ne=U.filter(Z=>Z.kind==="motion"),Q=U.filter(Z=>Z.kind==="other"),q=(Z,ge)=>E(be=>({...be,[Z]:ge})),le=L&&$==="deck",J=R??N.data??"",oe=Object.entries(A).filter(([Z,ge])=>H(Z)!==ge),ee=R!==null&&R!==(N.data??""),he=oe.length>0||ee;function ae(){E({}),D(null),V(!1)}async function de(){O(!0);try{if(oe.length>0){let Z=C.data??"";for(const[ge,be]of oe)Z=sR(Z,ge,be);await f.mutateAsync({path:`${a}/tokens.css`,body:Z,contentType:"text/css; charset=utf-8"}),h.invalidateQueries({queryKey:Ge.fileText(w)})}ee&&R!==null&&(await f.mutateAsync({path:`${a}/brand.md`,body:R,contentType:"text/markdown; charset=utf-8"}),h.invalidateQueries({queryKey:Ge.fileText(k)})),h.invalidateQueries({queryKey:Ge.orgFsVolume(i.id,l)}),h.invalidateQueries({queryKey:Ge.orgFsRecent(i.id)}),E({}),D(null),V(!1),ve.success(n("library.brandPreview.brandSaved"))}catch(Z){ve.error(Z instanceof Error?Z.message:n("library.brandPreview.failedSaveBrand"))}finally{O(!1)}}async function ue(Z){const ge=Z?.[0];if(!ge)return;const ke=`logo.${(ge.name.split(".").pop()??"png").toLowerCase()}`;try{await p.mutateAsync({dir:a,files:[new File([ge],ke,{type:ge.type})]}),S&&ln(S)!==ke&&await m.mutateAsync(S),ve.success(n("library.brandPreview.logoUpdated"))}catch(we){ve.error(we instanceof Error?we.message:n("library.brandPreview.logoUploadFailed"))}finally{g.current&&(g.current.value="")}}const pe=!x.isPending&&!_&&!v&&!S;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(sp,{size:18})}),s==="dialog"?o.jsx(Jt,{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&&(T?o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"ghost",size:"sm",onClick:ae,disabled:I,children:n("library.brandPreview.cancel")}),o.jsx(me,{size:"sm",disabled:!he||I,onClick:()=>{de()},children:n(I?"library.brandPreview.saving":"library.brandPreview.save")})]}):o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>V(!0),children:[o.jsx(ZA,{size:14}),n("library.brandPreview.edit")]})),s==="dialog"?o.jsx(zV,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:o.jsx(Is,{size:16})})}):o.jsx(me,{variant:"ghost",size:"icon",className:"size-8 shrink-0",onClick:e,children:o.jsx(Is,{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(Pt,{className:"h-40 w-full rounded-xl"}),o.jsx(Pt,{className:"h-4 w-1/3"}),o.jsx(Pt,{className:"h-4 w-2/3"})]}):pe?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(F?"library.brandPreview.showPreview":"library.brandPreview.hidePreview"),onClick:()=>M(Z=>!Z),onKeyDown:Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),M(ge=>!ge))},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:Z=>Z.stopPropagation(),children:[L&&o.jsx("button",{type:"button",onClick:()=>{B("deck"),M(!1)},className:ie("rounded-md px-2.5 py-1",le?"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:ie("rounded-md px-2.5 py-1",le?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:n("library.brandPreview.components")})]}),F?o.jsx(Gt,{size:16,className:"shrink-0 text-muted-foreground"}):o.jsx(_7,{size:16,className:"shrink-0 text-muted-foreground"})]}),!F&&o.jsx("div",{className:"px-4 pb-4",children:o.jsx("div",{className:ie("w-full overflow-hidden rounded-xl border border-border bg-muted/30",le?"aspect-[16/9]":"h-96"),children:le?o.jsx(Bue,{readUrl:j,title:`${c} deck theme`,tokensUrl:w}):o.jsx(Iue,{tokensUrl:w})})})]}),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(cu,{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:S?o.jsx("img",{src:u(l,S),alt:`${c} logo`,className:"max-h-full max-w-full object-contain"}):o.jsx(sp,{size:28,className:"text-muted-foreground/50"})}),T&&o.jsxs("div",{children:[o.jsxs(me,{variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>g.current?.click(),children:[o.jsx(Xn,{size:14}),n(S?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo")]}),o.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:Z=>{ue(Z.target.files)}})]})]})]}),K.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(cu,{children:n("library.brandPreview.colors")}),K.map(Z=>o.jsx(zue,{family:Z.family,tokens:Z.tokens,editing:T,valueOf:W,onEdit:q},Z.family))]}),(G.length>0||Y.length>0)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(cu,{children:n("library.brandPreview.typography")}),G.map(Z=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:Z.name.replace(/^--brand-font-?/,"")||n("library.brandPreview.defaultFont")}),T?o.jsx(gt,{value:W(Z),onChange:ge=>q(Z.name,ge.target.value),className:"h-9"}):o.jsx("span",{className:"truncate text-lg text-foreground",style:{fontFamily:W(Z)},children:W(Z)})]},Z.name)),Y.map(Z=>o.jsx(hC,{token:Z,value:W(Z),editing:T,onEdit:q},Z.name))]}),o.jsx(Gd,{label:n("library.brandPreview.spacing"),tokens:X,editing:T,valueOf:W,onEdit:q}),o.jsx(Gd,{label:n("library.brandPreview.radius"),tokens:te,editing:T,valueOf:W,onEdit:q}),o.jsx(Gd,{label:n("library.brandPreview.shadows"),tokens:se,editing:T,valueOf:W,onEdit:q}),o.jsx(Gd,{label:n("library.brandPreview.motion"),tokens:ne,editing:T,valueOf:W,onEdit:q}),o.jsx(Gd,{label:n("library.brandPreview.tokens"),tokens:Q,editing:T,valueOf:W,onEdit:q}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(cu,{children:n("library.brandPreview.voiceGuidelines")}),T?o.jsx(ho,{value:J,onChange:Z=>D(Z.target.value),placeholder:n("library.brandPreview.voicePlaceholder"),className:"min-h-48 font-mono text-sm"}):N.isPending&&v?o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Pt,{className:"h-3 w-full"}),o.jsx(Pt,{className:"h-3 w-5/6"})]}):J.trim()?o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:o.jsx(pd,{id:`brand-preview-${t}`,text:J})}):o.jsx("p",{className:"text-sm text-muted-foreground",children:n("library.brandPreview.noVoiceYet")})]})]})]})})]})}function fC(t){const e=z.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(Wt,{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(Uue,{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(qt,{open:!0,onOpenChange:i,children:r}),e[5]=i,e[6]=r,e[7]=l):l=e[7],l}function mC(t){const e=z.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(Wt,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",children:o.jsx(uC,{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(qt,{open:!0,onOpenChange:l,children:a}),e[6]=l,e[7]=a,e[8]=c):c=e[8],c}function Hue(t){const e=z.c(11),{onOpenDir:s}=t,n=re(),i=QE();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(x0,{name:d.volume,glyph:Vn,tone:"system",readOnly:!0,meta:`${d.repoOwner}/${d.repoName}`,subtitle:d.lastSyncError?n("library.syncedRepos.syncFailed"):d.lastSyncedAt?n("library.syncedRepos.syncedAgo",{ago:L7(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 $x(t){return`${window.location.origin}${t}`}function Vu(t){if(t.shareMode==="password")return"password";if(t.shareMode==="public"||t.readPublic)return"public";if(t.effectivePublic)return"inherited"}const Kue=[Bu,"uploads","outputs"],pC=[{volume:"uploads",descriptionKey:"library.libraryViews.volumeUploadsDescription",glyph:Xn},{volume:"outputs",descriptionKey:"library.libraryViews.volumeOutputsDescription",glyph:Jr}],t2=new Set([...pC.map(t=>t.volume),Zc("public")]),Wue=6;function gC(t,e,s){const n=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",i=X8(t),r=i?`public/${i}`:t==="home"?zu(s):t;return n?`${r}/${n}`:r}function Nh(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 Jo(t){const e=z.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 Kr(t){const e=z.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 b1(t){const e=z.c(2),{rows:s}=t,n=s===void 0?1:s;let i;return e[0]!==n?(i=o.jsx(Kr,{children:Array.from({length:n*3},que)}),e[0]=n,e[1]=i):i=e[1],i}function que(t,e){return o.jsx(Pt,{className:"h-16 rounded-2xl"},e)}function Bx(t){const e=z.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 Gue(t){const e=z.c(12),{volume:s,descriptionKey:n,glyph:i,onOpen:r}=t,l=re(),a=AP(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 h;return e[6]!==i||e[7]!==r||e[8]!==c||e[9]!==d||e[10]!==s?(h=o.jsx(x0,{name:s,meta:c,subtitle:d,glyph:i,tone:"system",onOpen:r}),e[6]=i,e[7]=r,e[8]=c,e[9]=d,e[10]=s,e[11]=h):h=e[11],h}function Yue(t){const e=z.c(12),{onOpenDir:s}=t,n=re(),r=F8().data?.length??0;let l;e[0]!==s?(l=pC.map(h=>o.jsx(Gue,{volume:h.volume,descriptionKey:h.descriptionKey,glyph:h.glyph,onOpen:()=>s(h.volume)},h.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(x0,{name:Zc("public"),meta:n("library.libraryViews.skillSetsCount",{count:r}),subtitle:n("library.libraryViews.curatedSkillSetsReadOnly"),glyph:br,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(Hue,{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 Jue(t){const e=z.c(19),{segments:s,onNavigate:n}=t,{org:i}=Be();let r;e[0]!==s?(r=s[0]===Bu?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:zu(i.slug)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(Bu),children:zu(i.slug)}),e[2]=c,e[3]=n,e[4]=i.slug,e[5]=d):d=e[5];let h;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=(p,m)=>{const g=s.slice(0,a+m+1).join("/"),x=m===l.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[o.jsx(qs,{size:12,className:"shrink-0 text-muted-foreground"}),x?o.jsx("span",{className:"truncate font-medium text-foreground",children:Zc(p)}):o.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(g),children:Zc(p)})]},g)},e[11]=a,e[12]=n,e[13]=l.length,e[14]=s,e[15]=f):f=e[15],h=l.map(f),e[6]=a,e[7]=n,e[8]=l,e[9]=s,e[10]=h}else h=e[10];let u;return e[16]!==d||e[17]!==h?(u=o.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[d,h]}),e[16]=d,e[17]=h,e[18]=u):u=e[18],u}function Que(t){const e=z.c(43),{query:s,scope:n,stale:i,onOpenFile:r,onShare:l,onDelete:a}=t,c=re(),{org:d}=Be(),h=c0(),u=VP(s,n);let f;e[0]!==h||e[1]!==l?(f=w=>l({volume:w.volume,path:w.path,kind:"file",shareMode:w.shareMode??"private",effectivePublic:w.effectivePublic??!1,url:$x(h(w.volume,w.path))}),e[0]=h,e[1]=l,e[2]=f):f=e[2];const p=f;if(u.isPending){let w;return e[3]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(b1,{rows:2}),e[3]=w):w=e[3],w}let m,g,x,b,y;if(e[4]!==s||e[5]!==u.data||e[6]!==u.isPlaceholderData||e[7]!==i||e[8]!==c){y=Symbol.for("react.early_return_sentinel");e:{if(g=u.data??[],g.length===0){let k;e[14]!==s||e[15]!==c?(k=c("library.libraryViews.noFilesMatch",{query:s}),e[14]=s,e[15]=c,e[16]=k):k=e[16];let j;e[17]!==k?(j=o.jsx(Bx,{children:k}),e[17]=k,e[18]=j):j=e[18],y=j;break e}const w=(i||u.isPlaceholderData)&&"opacity-50";e[19]!==w?(b=ie("flex flex-col gap-3",w),e[19]=w,e[20]=b):b=e[20],m=Jo,x=c("library.libraryViews.searchResults",{count:g.length})}e[4]=s,e[5]=u.data,e[6]=u.isPlaceholderData,e[7]=i,e[8]=c,e[9]=m,e[10]=g,e[11]=x,e[12]=b,e[13]=y}else m=e[9],g=e[10],x=e[11],b=e[12],y=e[13];if(y!==Symbol.for("react.early_return_sentinel"))return y;let _;e[21]!==m||e[22]!==x?(_=o.jsx(m,{children:x}),e[21]=m,e[22]=x,e[23]=_):_=e[23];let v;if(e[24]!==h||e[25]!==a||e[26]!==r||e[27]!==d||e[28]!==g||e[29]!==p){let w;e[31]!==h||e[32]!==a||e[33]!==r||e[34]!==d||e[35]!==p?(w=k=>{const j=X8(k.volume)!==null;return o.jsx(w7,{filename:ln(k.path),updatedAt:k.updatedAt,downloadUrl:h(k.volume,k.path),subtitle:gC(k.volume,k.path,d.slug),publicState:Vu(k),onOpen:()=>r(Z8(k.volume,k.path)),onShare:j?void 0:()=>p(k),onDelete:j?void 0:()=>a({volume:k.volume,path:k.path,kind:"file"})},`${k.volume}/${k.path}`)},e[31]=h,e[32]=a,e[33]=r,e[34]=d,e[35]=p,e[36]=w):w=e[36],v=g.map(w),e[24]=h,e[25]=a,e[26]=r,e[27]=d,e[28]=g,e[29]=p,e[30]=v}else v=e[30];let L;e[37]!==v?(L=o.jsx(Kr,{children:v}),e[37]=v,e[38]=L):L=e[38];let S;return e[39]!==b||e[40]!==_||e[41]!==L?(S=o.jsxs("div",{className:b,children:[_,L]}),e[39]=b,e[40]=_,e[41]=L,e[42]=S):S=e[42],S}function Xue(t){const e=z.c(39),{onOpenFile:s,onShare:n,onDelete:i}=t,r=re(),{org:l}=Be(),a=$8(),c=c0();let d;e[0]!==c||e[1]!==n?(d=y=>n({volume:y.volume,path:y.path,kind:"file",shareMode:y.shareMode??"private",effectivePublic:y.effectivePublic??!1,url:$x(c(y.volume,y.path))}),e[0]=c,e[1]=n,e[2]=d):d=e[2];const h=d;if(a.isPending){let y;e[3]!==r?(y=r("library.libraryViews.recentlyAdded"),e[3]=r,e[4]=y):y=e[4];let _;e[5]!==y?(_=o.jsx(Jo,{children:y}),e[5]=y,e[6]=_):_=e[6];let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(b1,{}),e[7]=v):v=e[7];let L;return e[8]!==_?(L=o.jsxs("div",{className:"flex flex-col gap-3",children:[_,v]}),e[8]=_,e[9]=L):L=e[9],L}let u,f,p,m,g;if(e[10]!==c||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==a.data||e[15]!==h||e[16]!==r){g=Symbol.for("react.early_return_sentinel");e:{const y=(a.data??[]).slice(0,Wue);if(y.length===0){g=null;break e}p="flex flex-col gap-3";let _;e[22]!==r?(_=r("library.libraryViews.recentlyAdded"),e[22]=r,e[23]=_):_=e[23],e[24]!==_?(m=o.jsx(Jo,{children:_}),e[24]=_,e[25]=m):m=e[25],u=Kr;let v;e[26]!==c||e[27]!==i||e[28]!==s||e[29]!==l||e[30]!==h?(v=L=>o.jsx(oR,{filename:ln(L.path),updatedAt:L.updatedAt,size:L.size,downloadUrl:c(L.volume,L.path),subtitle:gC(L.volume,L.path,l.slug),publicState:Vu(L),onOpen:()=>s(Z8(L.volume,L.path)),onShare:()=>h(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]=h,e[31]=v):v=e[31],f=y.map(v)}e[10]=c,e[11]=i,e[12]=s,e[13]=l,e[14]=a.data,e[15]=h,e[16]=r,e[17]=u,e[18]=f,e[19]=p,e[20]=m,e[21]=g}else u=e[17],f=e[18],p=e[19],m=e[20],g=e[21];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[32]!==u||e[33]!==f?(x=o.jsx(u,{children:f}),e[32]=u,e[33]=f,e[34]=x):x=e[34];let b;return e[35]!==p||e[36]!==m||e[37]!==x?(b=o.jsxs("div",{className:p,children:[m,x]}),e[35]=p,e[36]=m,e[37]=x,e[38]=b):b=e[38],b}function Zue(t){const e=z.c(16),{onOpenDir:s}=t,n=re(),i=F8();if(i.isPending){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(b1,{}),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 h;return e[5]!==d?(h=o.jsx(Bx,{children:d}),e[5]=d,e[6]=h):h=e[6],h}let a;if(e[7]!==s||e[8]!==l||e[9]!==n){let d;e[11]!==s||e[12]!==n?(d=h=>o.jsx(x0,{name:h,subtitle:n("library.libraryViews.readOnly"),readOnly:!0,onOpen:()=>s(`public/${h}`)},h),e[11]=s,e[12]=n,e[13]=d):d=e[13],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(Kr,{children:a}),e[14]=a,e[15]=c):c=e[15],c}function e0e(t){const e=z.c(63),{location:s,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onOpenBrand:l,onShare:a,onDelete:c,onDragStart:d,onContextMenu:h,onMove:u}=t,f=re(),{org:p}=Be(),m=s.volume??"",g=z8(m,s.dirPath),x=c0();let b;e[0]!==s.isHomeRoot||e[1]!==p?(b=T=>s.isHomeRoot&&t2.has(T.toLowerCase())?`${zu(p.slug)}/${T}`:void 0,e[0]=s.isHomeRoot,e[1]=p,e[2]=b):b=e[2];const y=b;let _;e[3]!==s.isHomeRoot||e[4]!==n?(_=s.isHomeRoot?o.jsx(Yue,{onOpenDir:n}):null,e[3]=s.isHomeRoot,e[4]=n,e[5]=_):_=e[5];const v=_;if(g.isPending){let T;e[6]!==v||e[7]!==f?(T=v&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.folders")}),o.jsx(Kr,{children:v})]}),e[6]=v,e[7]=f,e[8]=T):T=e[8];let V;e[9]===Symbol.for("react.memo_cache_sentinel")?(V=o.jsx(b1,{rows:2}),e[9]=V):V=e[9];let A;return e[10]!==T?(A=o.jsxs(o.Fragment,{children:[T,V]}),e[10]=T,e[11]=A):A=e[11],A}if(g.isError){let T;e[12]!==g.error||e[13]!==f?(T=g.error instanceof Error?g.error.message:f("library.libraryViews.failedToLoad"),e[12]=g.error,e[13]=f,e[14]=T):T=e[14];let V;return e[15]!==T?(V=o.jsx("p",{className:"text-sm text-destructive",children:T}),e[15]=T,e[16]=V):V=e[16],V}let L,S,w,k,j;if(e[17]!==y||e[18]!==x||e[19]!==g.data||e[20]!==s||e[21]!==h||e[22]!==c||e[23]!==d||e[24]!==u||e[25]!==l||e[26]!==n||e[27]!==i||e[28]!==r||e[29]!==a||e[30]!==v||e[31]!==f||e[32]!==m){j=Symbol.for("react.early_return_sentinel");e:{const T=g.data??[],V=T.filter(i0e),A=T.filter(n0e),E=T.filter(s0e),R=T.filter(t0e);if(T.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 $;e[41]!==M?($=o.jsx(Bx,{children:M}),e[41]=M,e[42]=$):$=e[42],j=$;break e}let D;e[43]!==s.readOnly||e[44]!==c||e[45]!==m?(D=M=>s.readOnly?void 0:()=>c({volume:m,path:M.path,kind:M.kind}),e[43]=s.readOnly,e[44]=c,e[45]=m,e[46]=D):D=e[46];const I=D;let O;e[47]!==x||e[48]!==s.readOnly||e[49]!==a||e[50]!==m?(O=M=>s.readOnly?void 0:()=>a({volume:m,path:M.path,kind:M.kind,shareMode:M.shareMode??"private",effectivePublic:M.effectivePublic??!1,url:M.kind==="file"?$x(x(m,M.path)):void 0}),e[47]=x,e[48]=s.readOnly,e[49]=a,e[50]=m,e[51]=O):O=e[51];const F=O;L=V.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.skills")}),o.jsx(Kr,{children:V.map(M=>o.jsx(iR,{dirName:ln(M.path),updatedAt:M.updatedAt,skillMdUrl:x(m,`${M.path}/SKILL.md`),publicState:Vu(M),onOpen:()=>r(vc(s,M.path)),onBrowse:()=>n(vc(s,M.path)),onShare:F(M),onDelete:I(M),draggable:!s.readOnly,...Nh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),S=A.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.brands")}),o.jsx(Kr,{children:A.map(M=>o.jsx(rR,{dirName:ln(M.path),updatedAt:M.updatedAt,tokensUrl:x(m,`${M.path}/tokens.css`),onOpen:()=>l(vc(s,M.path)),onBrowse:()=>n(vc(s,M.path)),onDelete:I(M),draggable:!s.readOnly,...Nh(M.path,"dir",{onDragStart:d,onContextMenu:h})},M.path))})]}),w=(E.length>0||v)&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.folders")}),o.jsxs(Kr,{children:[v,E.map(M=>o.jsx(x0,{name:ln(M.path),meta:L7(M.updatedAt),subtitle:y(ln(M.path)),readOnly:s.readOnly,publicState:Vu(M),onOpen:()=>n(vc(s,M.path)),onShare:F(M),onDelete:I(M),draggable:!s.readOnly,...Nh(M.path,"dir",{onDragStart:d,onContextMenu:h,onDrop:u})},M.path))]})]}),k=R.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(Jo,{children:f("library.libraryViews.files")}),o.jsx(Kr,{children:R.map(M=>o.jsx(w7,{filename:ln(M.path),updatedAt:M.updatedAt,downloadUrl:x(m,M.path),publicState:Vu(M),onOpen:()=>i(vc(s,M.path)),onShare:F(M),onDelete:I(M),draggable:!s.readOnly,...Nh(M.path,"file",{onDragStart:d,onContextMenu:h})},M.path))})]})}e[17]=y,e[18]=x,e[19]=g.data,e[20]=s,e[21]=h,e[22]=c,e[23]=d,e[24]=u,e[25]=l,e[26]=n,e[27]=i,e[28]=r,e[29]=a,e[30]=v,e[31]=f,e[32]=m,e[33]=L,e[34]=S,e[35]=w,e[36]=k,e[37]=j}else L=e[33],S=e[34],w=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(Xue,{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 N;return e[57]!==L||e[58]!==S||e[59]!==w||e[60]!==k||e[61]!==C?(N=o.jsxs(o.Fragment,{children:[L,S,w,k,C]}),e[57]=L,e[58]=S,e[59]=w,e[60]=k,e[61]=C,e[62]=N):N=e[62],N}function t0e(t){return t.kind==="file"}function s0e(t){return t.kind==="dir"&&!t.hasSkill&&!t.hasBrand}function n0e(t){return t.kind==="dir"&&t.hasBrand&&!t.hasSkill}function i0e(t){return t.kind==="dir"&&t.hasSkill}function r0e({onOpenFile:t,onOpenSkill:e,onOpenBrand:s}={}){const n=re(),{org:i}=Be(),r=cs(),l=Js(),a=gl(),c=xl({strict:!1}),d=c.path||Bu,h=Ig(d),u=XE(),f=h.volume!==null&&u.has(h.volume)?{...h,readOnly:!0}:h,p=(Z,ge)=>l({to:".",search:be=>({...be,[Z]:ge||void 0})}),m=Z=>p("path",Z),g=(Z,ge)=>l({to:".",search:be=>({...be,preview:void 0,skill:void 0,brand:void 0,[Z]:ge})}),x=t??(Z=>g("preview",Z)),b=e??(Z=>g("skill",Z)),y=s??(Z=>g("brand",Z)),[_,v]=P.useState(""),L=R9(_.trim(),300),S=!f.isHomeRoot&&f.volume!==null?{volume:f.volume,prefix:f.dirPath}:void 0,w=S?n("library.library.searchInPlaceholder",{folder:Zc(f.segments.at(-1)??"")}):n("library.library.searchPlaceholder"),k=f.isHomeRoot?zu(i.slug):Zc(f.segments.at(-1)??""),[j,C]=P.useState(null),[N,T]=P.useState(null),[V,A]=P.useState(!1),[E,R]=P.useState(""),[D,I]=P.useState(!1),[O,F]=P.useState(null),[M,$]=P.useState(""),B=P.useRef(null),[U,H]=P.useState(!1),W=P.useRef(0),K=f.readOnly?null:f.volume,{upload:G,mkdir:Y,move:X}=Mu(K??Bu),{remove:te}=Mu(j?.volume??"uploads");async function se(Z){if(!(!K||!Z||Z.length===0))try{await G.mutateAsync({dir:f.dirPath,files:[...Z]}),ve.success(Z.length===1?n("library.library.uploadedSingle",{filename:Z[0]?.name??""}):n("library.library.uploadedMultiple",{count:Z.length}))}catch(ge){ve.error(ge instanceof Error?ge.message:n("library.library.uploadFailed"))}finally{B.current&&(B.current.value="")}}const ne=K!==null;function Q(Z){return Z.dataTransfer.types.includes("Files")}function q(Z){!ne||!Q(Z)||(Z.preventDefault(),W.current+=1,H(!0))}function le(Z){!ne||!Q(Z)||Z.preventDefault()}function J(){ne&&(W.current=Math.max(0,W.current-1),W.current===0&&H(!1))}function oe(Z){ne&&(Z.preventDefault(),Z.stopPropagation(),W.current=0,H(!1),Z.dataTransfer.files.length>0&&se(Z.dataTransfer.files))}async function ee(){const Z=E.trim();if(!(!K||!Z)){if(f.isHomeRoot&&t2.has(Z.toLowerCase())){ve.error(n("library.library.folderNameReserved",{name:Z}));return}try{const ge=f.dirPath;await Y.mutateAsync(ge?`${ge}/${Z}`:Z),ve.success(n("library.library.folderCreated",{name:Z})),A(!1),R("")}catch(ge){ve.error(ge instanceof Error?ge.message:n("library.library.folderCreateFailed"))}}}async function he(){if(!j)return;const Z=j;try{await te.mutateAsync(Z.path),ve.success(n("library.library.deleted",{name:ln(Z.path)}))}catch(ge){ve.error(ge instanceof Error?ge.message:n("library.library.deleteFailed"))}finally{C(null)}}async function ae(){if(!O)return;const Z=M.trim();if(!Z||Z.includes("/")||Z.includes("..")||Z===ln(O.path)){I(!1),F(null),$("");return}if(O.kind==="dir"&&f.isHomeRoot&&t2.has(Z.toLowerCase())){ve.error(n("library.library.folderNameReserved",{name:Z}));return}try{const ge=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")):"",be=ge?`${ge}/${Z}`:Z;await X.mutateAsync({from:O.path,to:be});const ke=Z.replace(/[<>]/g,"");ve.success(n("library.library.renamed",{name:ke}))}catch(ge){ve.error(ge instanceof Error?ge.message:n("library.library.renameFailed"))}finally{I(!1),F(null),$("")}}async function de(Z,ge){try{const be=ln(Z),ke=ge?`${ge}/${be}`:be;await X.mutateAsync({from:Z,to:ke}),ve.success(n("library.library.moved",{name:be,destination:ge||n("library.library.theLibrary")}))}catch(be){ve.error(be instanceof Error?be.message:n("library.library.moveFailed"))}}function ue(){for(const Z of Kue)r.invalidateQueries({queryKey:Ge.orgFsVolume(i.id,Z)});f.volume&&r.invalidateQueries({queryKey:Ge.orgFsVolume(i.id,f.volume)}),r.invalidateQueries({queryKey:Ge.orgFsRecent(i.id)}),r.invalidateQueries({queryKey:Ge.orgFsSearchRoot(i.id)}),r.invalidateQueries({queryKey:Ge.orgFsPublicSets(i.id)})}function pe(Z){Z.defaultPrevented||!K||Z.target.closest("input, textarea, button, a, [role='button']")||(Z.preventDefault(),A(!0))}return o.jsxs("div",{className:"relative h-full",onDragEnter:q,onDragOver:le,onDragLeave:J,onDrop:oe,onContextMenu:pe,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(Xn,{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(Jue,{segments:f.segments,onNavigate:m})}),o.jsxs("div",{className:"relative w-full shrink-0 sm:w-56",children:[o.jsx(A9,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-muted-foreground"}),o.jsx(gt,{value:_,onChange:Z=>v(Z.target.value),onKeyDown:Z=>{Z.key==="Escape"&&v("")},placeholder:w,className:"h-9 rounded-xl pr-9 pl-9"}),_&&o.jsx(me,{variant:"ghost",size:"icon",className:"absolute top-1/2 right-1.5 size-7 -translate-y-1/2",onClick:()=>v(""),"aria-label":n("library.library.clearSearch"),children:o.jsx(Ai,{size:14})})]}),o.jsx(me,{variant:"ghost",size:"icon",onClick:ue,"aria-label":n("library.library.refresh"),children:o.jsx($n,{size:14})}),K&&o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[o.jsx(Ut,{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(p0,{size:12}),n("library.library.readOnly")]}):o.jsxs(me,{size:"sm",disabled:G.isPending,onClick:()=>B.current?.click(),children:[o.jsx(Xn,{size:14}),G.isPending?n("library.library.uploading"):n("library.library.uploadFile")]}),o.jsx("input",{ref:B,type:"file",multiple:!0,className:"hidden",onChange:Z=>{se(Z.target.files)}})]}),L?o.jsx(Que,{query:L,scope:S,stale:_.trim()!==L,onOpenFile:x,onShare:T,onDelete:C}):f.volume===null?o.jsx(Zue,{onOpenDir:m}):o.jsx(e0e,{location:f,onOpenDir:m,onOpenFile:x,onOpenSkill:b,onOpenBrand:y,onShare:T,onDelete:C,onContextMenu:(Z,ge)=>{F({path:Z,kind:ge}),$(ln(Z)),I(!0)},onMove:de},f.volume)]})}),a&&(c.preview?o.jsx(mC,{previewPath:c.preview,onClose:()=>p("preview",null)}):c.skill?o.jsx(Y8,{skillPath:c.skill,onClose:()=>p("skill",null)},c.skill):c.brand?o.jsx(fC,{brandPath:c.brand,onClose:()=>p("brand",null)},c.brand):null),o.jsx(qt,{open:V,onOpenChange:A,children:o.jsxs(Wt,{children:[o.jsxs(ms,{children:[o.jsx(Jt,{children:n("library.library.newFolderTitle")}),o.jsx(Tn,{children:n("library.library.newFolderDescription",{path:k||n("library.library.theLibrary")})})]}),o.jsx(gt,{autoFocus:!0,placeholder:n("library.library.folderNamePlaceholder"),value:E,onChange:Z=>R(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&ee()}}),o.jsxs(Jn,{children:[o.jsx(me,{variant:"outline",onClick:()=>A(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!E.trim()||Y.isPending,onClick:()=>{ee()},children:n("library.library.create")})]})]})}),o.jsx(qt,{open:D,onOpenChange:Z=>{I(Z),Z||(F(null),$(""))},children:o.jsxs(Wt,{children:[o.jsxs(ms,{children:[o.jsx(Jt,{children:O&&n("library.library.renameTitle",{name:ln(O.path)})}),o.jsx(Tn,{children:n("library.library.renameDescription")})]}),o.jsx(gt,{autoFocus:!0,value:M,onChange:Z=>$(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&ae()}}),o.jsxs(Jn,{children:[o.jsx(me,{variant:"outline",onClick:()=>I(!1),children:n("library.library.cancel")}),o.jsx(me,{disabled:!M.trim()||X.isPending,onClick:()=>{ae()},children:n("library.library.rename")})]})]})}),o.jsx(jue,{target:N,onOpenChange:Z=>{Z||T(null)}}),o.jsx(no,{open:j!==null,onOpenChange:Z=>{Z||C(null)},children:o.jsxs(io,{children:[o.jsxs(ro,{children:[o.jsx(oo,{children:n("library.library.deleteTitle",{name:j?ln(j.path):""})}),o.jsx(lo,{children:j?.kind==="dir"?n("library.library.deleteDirectoryDescription"):n("library.library.deleteFileDescription")})]}),o.jsxs(ao,{children:[o.jsx(co,{children:n("library.library.cancel")}),o.jsx(uo,{onClick:()=>{he()},children:n("library.library.delete")})]})]})})]})}function o0e(){const t=z.c(10),{openPanel:e}=bi(),[s,n]=P.useState(null),[i,r]=P.useState(null);let l;t[0]!==e?(l=o.jsx(r0e,{onOpenFile:h=>e(_T(h)),onOpenSkill:n,onOpenBrand:r}),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==s?(a=s&&o.jsx(Y8,{skillPath:s,onClose:()=>n(null)},s),t[2]=s,t[3]=a):a=t[3];let c;t[4]!==i?(c=i&&o.jsx(fC,{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 ny=P.lazy(()=>$s(()=>import("./project-app-view-DLbH_B-S.js"),__vite__mapDeps([185,1,2,86,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,87,88,89,15,11,16,23,90,91,92,93,94,95,96,97,98,99,100,7,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,101,102,103,104,105,106,107,108,109,110,111,112,113,114,83,80,115,118,122,123,124,125,126,127,128,129,130,131,116,117,79,119,120,121,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,81,148,149,150,151,152,153,154,78,155,156,84,157,158,159,160,161,162,163,164,165,166,167])).then(t=>({default:t.AppViewContent}))),l0e=P.lazy(()=>$s(()=>import("./hosting-tab-BjO3qC08.js"),__vite__mapDeps([186,1,2,30,28,42,46,9,29,31,32,33,34,35,36,37,38,39,40,41,8,43,44,45,47,10,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,143,80,83,123,7,79,90,187,23,15,11,16,152])).then(t=>({default:t.HostingTab}))),a0e=P.lazy(()=>$s(()=>import("./e2e-tab-CDsd7wp2.js"),__vite__mapDeps([188,1,2,37,28,42,29,30,31,32,33,34,35,36,38,39,40,41,8,43,44,45,46,9,47,10,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,143,80,83,123,7,79,90,187,23,15,11,16,152,86,87,88,89,91,92,93,94,95,96,97,98,99,100,4,5,14,17,18,19,20,21,3,6,12,13,22,24,25,26,27,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,119])).then(t=>({default:t.E2eTab}))),c0e=P.lazy(()=>$s(()=>import("./analytics-tab-HW971fV1.js"),__vite__mapDeps([189,1,2,29,30,31,32,33,34,35,36,37,38,39,40,41,8,28,42,43,44,45,46,9,47,10,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,143,145,80,83,90,111,112,113,123,7,187,23,15,11,16,152,190])).then(t=>({default:t.AnalyticsTab}))),d0e=P.lazy(()=>$s(()=>import("./cdn-tab-BkoLgXRq.js"),__vite__mapDeps([191,1,2,53,111,112,113,187,132,23,15,11,16,152,190,192,193])).then(t=>({default:t.CdnTab})));function u0e({activeTab:t,virtualMcpId:e,taskId:s,layoutTabs:n,expandedTools:i,automationTabParsed:r}){const l=R8(),a=Oc().monitorEnabled===!0||Oc().auth.localMode===!0;if(t==="overview")return o.jsx(zX,{});if(t==="board")return o.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:o.jsx(kZ,{})});if(LT(t))return o.jsx(V5,{virtualMcpId:e});if(t==="git")return o.jsx(ute,{virtualMcpId:e});if(t==="automations")return o.jsx(lue,{virtualMcpId:e});if(t==="preview")return o.jsx(sae,{virtualMcpId:e});const c=wT(t);if(c)return o.jsx(iae,{openPath:c.path});if(t==="content")return o.jsx(gde,{virtualMcpId:e});if(t==="assets")return o.jsx(xde,{virtualMcpId:e});if(t==="hosting"&&l.hosting)return o.jsx(l0e,{virtualMcpId:e});if(t==="e2e"&&l.e2e)return o.jsx(a0e,{virtualMcpId:e});if(t==="analytics"&&l.analytics)return o.jsx(c0e,{virtualMcpId:e});if(t==="cdn"&&a&&l.monitor)return o.jsx(d0e,{virtualMcpId:e});if(t==="files")return o.jsx(o0e,{});if(t==="reports")return o.jsx(mue,{});if(t==="connect-sources")return o.jsx(uue,{});if(r)return o.jsx(nue,{tabId:t});const d=j6(t);if(d)return o.jsx(Nue,{path:d.path},d.path);const h=k6(t);if(h)return o.jsx(cue,{fileKey:h.key,taskId:s});const u=C6(t);if(u)return o.jsx(Pue,{path:u.path},u.path);const f=ST(t);if(f){const m=i.find(g=>g.appId===f.connectionId&&g.toolName===f.toolName);return o.jsx(P.Suspense,{fallback:o.jsx(fr,{}),children:o.jsx(ny,{connectionId:f.connectionId,toolName:f.toolName,args:m?.args},t)})}const p=n.find(m=>m.id===t);return p?o.jsx(P.Suspense,{fallback:o.jsx(fr,{}),children:o.jsx(ny,{connectionId:p.view.appId,toolName:p.id,args:p.view.args},t)}):o.jsx(V5,{virtualMcpId:e})}function h0e(t){const e=z.c(14),{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}=k3(i);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(fr,{}),e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==c||e[6]!==a||e[7]!==l||e[8]!==s||e[9]!==n?(h=o.jsx(P.Suspense,{fallback:d,children:o.jsx(u0e,{activeTab:r,virtualMcpId:n,taskId:s,layoutTabs:l,expandedTools:a,automationTabParsed:c})}),e[4]=r,e[5]=c,e[6]=a,e[7]=l,e[8]=s,e[9]=n,e[10]=h):h=e[10];let u;return e[11]!==r||e[12]!==h?(u=o.jsx(Hs,{children:h},r),e[11]=r,e[12]=h,e[13]=u):u=e[13],u}function f0e(t){return t.hasClonableSource&&!t.fastPreviewActive&&!(t.mainTab!==null&&kT.has(t.mainTab))}const Hl="setup";function m0e(t){const e=z.c(57),s=re();let n;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let v;e[3]!==t.scriptTabs?(v=L=>!t.scriptTabs.includes(L),e[3]=t.scriptTabs,e[4]=v):v=e[4],n=t.scripts.filter(v),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===Hl?t.onToggle():t.onSelectTab(Hl)},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(Gt,{className:"size-4"}):o.jsx(_7,{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(Fe,{asChild:!0,children:o.jsx(me,{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 h;e[17]!==t.open||e[18]!==s?(h=t.open?s("sandbox.preview.collapseTerminal"):s("sandbox.preview.expandTerminal"),e[17]=t.open,e[18]=s,e[19]=h):h=e[19];let u;e[20]!==h?(u=o.jsx(Ue,{children:h}),e[20]=h,e[21]=u):u=e[21];let f;e[22]!==d||e[23]!==u?(f=o.jsxs(He,{children:[d,u]}),e[22]=d,e[23]=u,e[24]=f):f=e[24];const p=t.active===Hl;let m;e[25]!==l||e[26]!==t.open||e[27]!==s||e[28]!==p?(m=o.jsx(p0e,{active:p,open:t.open,onClick:l,t:s}),e[25]=l,e[26]=t.open,e[27]=s,e[28]=p,e[29]=m):m=e[29];let g;e[30]!==t||e[31]!==s?(g=t.scriptTabs.map(v=>o.jsx(x0e,{active:t.active===v,onClick:()=>{t.active===v?t.onToggle():t.onSelectTab(v)},onClose:()=>t.onCloseScript(v),t:s,children:v},v)),e[30]=t,e[31]=s,e[32]=g):g=e[32];let x;e[33]!==i||e[34]!==t.onAddScript?(x=o.jsx(b0e,{scripts:i,onRun:t.onAddScript}),e[33]=i,e[34]=t.onAddScript,e[35]=x):x=e[35];let b;e[36]!==g||e[37]!==x||e[38]!==m?(b=o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[m,g,x]}),e[36]=g,e[37]=x,e[38]=m,e[39]=b):b=e[39];let y;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?(y=t.showScriptControls?o.jsx(v0e,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript,t:s}):o.jsx(g0e,{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]=y):y=e[52];let _;return e[53]!==b||e[54]!==y||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,y]}),e[53]=b,e[54]=y,e[55]=f,e[56]=_):_=e[56],_}function p0e(t){const e=z.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=ie("flex h-6 items-center gap-1.5 rounded-md border px-2 text-xs",c),e[0]=c,e[1]=d):d=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(cP,{className:"size-4"}),e[2]=h):h=e[2];let u;e[3]!==r?(u=r("sandbox.toolbar.setupTab"),e[3]=r,e[4]=u):u=e[4];let f;return e[5]!==i||e[6]!==l||e[7]!==a||e[8]!==d||e[9]!==u?(f=o.jsxs("button",{type:"button","aria-pressed":l,"aria-expanded":a,onClick:i,className:d,children:[h,u]}),e[5]=i,e[6]=l,e[7]=a,e[8]=d,e[9]=u,e[10]=f):f=e[10],f}function g0e(t){const e=z.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(ql,{className:"size-3.5"}),e[0]=d):d=e[0];let h;e[1]!==c?(h=c("sandbox.toolbar.start"),e[1]=c,e[2]=h):h=e[2];let u;return e[3]!==n||e[4]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:n,children:[d," ",h]}),e[3]=n,e[4]=h,e[5]=u):u=e[5],u}if(s==="suspended"&&l){let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(ql,{className:"size-3.5"}),e[6]=d):d=e[6];let h;e[7]!==c?(h=c("sandbox.toolbar.resume"),e[7]=c,e[8]=h):h=e[8];let u;return e[9]!==l||e[10]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:l,children:[d," ",h]}),e[9]=l,e[10]=h,e[11]=u):u=e[11],u}if(s==="errored"&&a){let d;e[12]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx($n,{className:"size-3.5"}),e[12]=d):d=e[12];let h;e[13]!==c?(h=c("sandbox.toolbar.retry"),e[13]=c,e[14]=h):h=e[14];let u;return e[15]!==a||e[16]!==h?(u=o.jsxs(me,{variant:"outline",size:"xs",onClick:a,children:[d," ",h]}),e[15]=a,e[16]=h,e[17]=u):u=e[17],u}if(s==="starting"||s==="running"){const d=s==="running"&&!!r,h=d?"rounded-r-none border-r-0":void 0;let u;e[18]!==h?(u=ie(h),e[18]=h,e[19]=u):u=e[19];let f;e[20]!==c?(f=c("sandbox.toolbar.stop"),e[20]=c,e[21]=f):f=e[21];let p;e[22]!==i||e[23]!==u||e[24]!==f?(p=o.jsx(Fe,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",onClick:i,className:u,children:f})}),e[22]=i,e[23]=u,e[24]=f,e[25]=p):p=e[25];let m;e[26]!==c?(m=c("sandbox.toolbar.stopSandboxTooltip"),e[26]=c,e[27]=m):m=e[27];let g;e[28]!==m?(g=o.jsx(Ue,{children:m}),e[28]=m,e[29]=g):g=e[29];let x;e[30]!==p||e[31]!==g?(x=o.jsxs(He,{children:[p,g]}),e[30]=p,e[31]=g,e[32]=x):x=e[32];let b;e[33]!==r||e[34]!==d||e[35]!==c?(b=d&&o.jsxs($t,{children:[o.jsx(Bt,{asChild:!0,children:o.jsx(me,{variant:"outline",size:"xs",className:"rounded-l-none px-1","aria-label":c("sandbox.toolbar.moreActions"),children:o.jsx(Gt,{className:"size-3"})})}),o.jsx(zt,{align:"end",children:o.jsxs(Ye,{onClick:r,children:[o.jsx($n,{className:"size-3.5"})," ",c("sandbox.toolbar.restart")]})})]}),e[33]=r,e[34]=d,e[35]=c,e[36]=b):b=e[36];let y;return e[37]!==x||e[38]!==b?(y=o.jsxs("div",{className:"flex items-center",children:[x,b]}),e[37]=x,e[38]=b,e[39]=y):y=e[39],y}return null}function x0e(t){const e=z.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=ie("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",h=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let u;e[2]!==d||e[3]!==h?(u=ie("flex h-full items-center",d,h),e[2]=d,e[3]=h,e[4]=u):u=e[4];let f;e[5]!==r||e[6]!==n||e[7]!==u?(f=o.jsx("button",{type:"button",onClick:n,className:u,children:r}),e[5]=r,e[6]=n,e[7]=u,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==i||e[11]!==l?(p=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(Is,{className:"size-3.5"})}),e[9]=r,e[10]=i,e[11]=l,e[12]=p):p=e[12];let m;return e[13]!==c||e[14]!==f||e[15]!==p?(m=o.jsxs("div",{className:c,children:[f,p]}),e[13]=c,e[14]=f,e[15]=p,e[16]=m):m=e[16],m}function b0e(t){const e=z.c(27),{scripts:s,onRun:n}=t,i=re(),[r,l]=P.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(Ut,{className:"size-4"}),e[2]=c):c=e[2];let d;e[3]!==a?(d=o.jsx(Fe,{asChild:!0,children:o.jsx(ts,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"xs","aria-label":a,children:c})})}),e[3]=a,e[4]=d):d=e[4];let h;e[5]!==i?(h=i("sandbox.toolbar.runScript"),e[5]=i,e[6]=h):h=e[6];let u;e[7]!==h?(u=o.jsx(Ue,{children:h}),e[7]=h,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=o.jsxs(He,{children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let p;e[12]!==i?(p=i("sandbox.toolbar.runAScript"),e[12]=i,e[13]=p):p=e[13];let m;e[14]!==p?(m=o.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:p}),e[14]=p,e[15]=m):m=e[15];let g;e[16]!==n||e[17]!==s||e[18]!==i?(g=s.length===0?o.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:i("sandbox.toolbar.noScriptsFound")}):s.map(y=>o.jsxs("button",{type:"button",onClick:()=>{l(!1),n(y)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",y]},y)),e[16]=n,e[17]=s,e[18]=i,e[19]=g):g=e[19];let x;e[20]!==m||e[21]!==g?(x=o.jsxs(ss,{align:"start",className:"p-1 w-56",children:[m,g]}),e[20]=m,e[21]=g,e[22]=x):x=e[22];let b;return e[23]!==r||e[24]!==x||e[25]!==f?(b=o.jsxs(ns,{open:r,onOpenChange:l,children:[f,x]}),e[23]=r,e[24]=x,e[25]=f,e[26]=b):b=e[26],b}function v0e(t){const e=z.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(ct,{className:"size-3.5 animate-spin"}),e[0]=f):f=e[0];let p;e[1]!==l?(p=l("sandbox.toolbar.stopping"),e[1]=l,e[2]=p):p=e[2];let m;return e[3]!==p?(m=o.jsxs(me,{variant:"outline",size:"xs",disabled:!0,children:[f," ",p]}),e[3]=p,e[4]=m):m=e[4],m}if(!s){let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(ql,{className:"size-3.5"}),e[5]=f):f=e[5];let p;e[6]!==l?(p=l("sandbox.toolbar.run"),e[6]=l,e[7]=p):p=e[7];let m;e[8]!==i||e[9]!==p?(m=o.jsx(Fe,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"xs",onClick:i,children:[f," ",p]})}),e[8]=i,e[9]=p,e[10]=m):m=e[10];let g;e[11]!==l?(g=l("sandbox.toolbar.startProcess"),e[11]=l,e[12]=g):g=e[12];let x;e[13]!==g?(x=o.jsx(Ue,{children:g}),e[13]=g,e[14]=x):x=e[14];let b;return e[15]!==m||e[16]!==x?(b=o.jsxs(He,{children:[m,x]}),e[15]=m,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(Fe,{asChild:!0,children:o.jsx(me,{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 h;e[25]!==d?(h=o.jsx(Ue,{children:d}),e[25]=d,e[26]=h):h=e[26];let u;return e[27]!==c||e[28]!==h?(u=o.jsxs(He,{children:[c,h]}),e[27]=c,e[28]=h,e[29]=u):u=e[29],u}var xC=Object.defineProperty,y0e=Object.getOwnPropertyDescriptor,_0e=(t,e)=>{for(var s in e)xC(t,s,{get:e[s],enumerable:!0})},Rs=(t,e,s,n)=>{for(var i=n>1?void 0:n?y0e(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&&xC(e,s,i),i},qe=(t,e)=>(s,n)=>e(s,n,t),iy="Terminal input",s2={get:()=>iy,set:t=>iy=t},ry="Too much output to announce, navigate to rows manually to read",n2={get:()=>ry,set:t=>ry=t};function L0e(t){return t.replace(/\r?\n/g,"\r")}function w0e(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function S0e(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function k0e(t,e,s,n){if(t.stopPropagation(),t.clipboardData){let i=t.clipboardData.getData("text/plain");bC(i,e,s,n)}}function bC(t,e,s,n){t=L0e(t),t=w0e(t,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function vC(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 oy(t,e,s,n,i){vC(t,e,s),i&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Go(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function v1(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 j0e=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}},C0e=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,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)p<<=6,p|=g;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=x-m;for(;d<b;){if(d>=s)return 0;if(g=t[d++],(g&192)!==128){d--,f=!0;break}else this.interim[m++]=g,p<<=6,p|=g&63}f||(x===2?p<128?d--:e[n++]=p:x===3?p<2048||p>=55296&&p<=57343||p===65279||(e[n++]=p):p<65536||p>1114111||(e[n++]=p)),this.interim.fill(0)}let h=s-4,u=d;for(;u<s;){for(;u<h&&!((i=t[u])&128)&&!((r=t[u+1])&128)&&!((l=t[u+2])&128)&&!((a=t[u+3])&128);)e[n++]=i,e[n++]=r,e[n++]=l,e[n++]=a,u+=4;if(i=t[u++],i<128)e[n++]=i;else if((i&224)===192){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(c=(i&31)<<6|r&63,c<128){u--;continue}e[n++]=c}else if((i&240)===224){if(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[u++],(l&192)!==128){u--;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(u>=s)return this.interim[0]=i,n;if(r=t[u++],(r&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,n;if(l=t[u++],(l&192)!==128){u--;continue}if(u>=s)return this.interim[0]=i,this.interim[1]=r,this.interim[2]=l,n;if(a=t[u++],(a&192)!==128){u--;continue}if(c=(i&7)<<18|(r&63)<<12|(l&63)<<6|a&63,c<65536||c>1114111)continue;e[n++]=c}}return n}},yC="",tl=" ",M0=class _C{constructor(){this.fg=0,this.bg=0,this.extended=new Uf}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 _C;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}},Uf=class LC{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 LC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},fi=class wC extends M0{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Uf,this.combinedData=""}static fromCharData(e){let s=new wC;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?Go(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()]}},ly="di$target",i2="di$dependencies",Sm=new Map;function N0e(t){return t[i2]||[]}function on(t){if(Sm.has(t))return Sm.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");T0e(e,s,i)};return e._id=t,Sm.set(t,e),e}function T0e(t,e,s){e[ly]===e?e[i2].push({id:t,index:s}):(e[i2]=[{id:t,index:s}],e[ly]=e)}var In=on("BufferService"),SC=on("CoreMouseService"),Na=on("CoreService"),V0e=on("CharsetService"),zx=on("InstantiationService"),kC=on("LogService"),Mn=on("OptionsService"),jC=on("OscLinkService"),A0e=on("UnicodeService"),O0=on("DecorationService"),r2=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 fi,l=s.getTrimmedLength(),a=-1,c=-1,d=!1;for(let h=0;h<l;h++)if(!(c===-1&&!s.hasContent(h))){if(s.loadCell(h,r),r.hasExtendedAttrs()&&r.extended.urlId)if(c===-1){c=h,a=r.extended.urlId;continue}else d=r.extended.urlId!==a;else c!==-1&&(d=!0);if(d||c!==-1&&h===l-1){let u=this._oscLinkService.getLinkData(a)?.uri;if(u){let f={start:{x:c+1,y:t},end:{x:h+(!d&&h===l-1?1:0),y:t}},p=!1;if(!i?.allowNonHttpProtocols)try{let m=new URL(u);["http:","https:"].includes(m.protocol)||(p=!0)}catch{p=!0}p||n.push({text:u,range:f,activate:(m,g)=>i?i.activate(m,g,f):P0e(m,g),hover:(m,g)=>i?.hover?.(m,g,f),leave:(m,g)=>i?.leave?.(m,g,f)})}d=!1,r.hasExtendedAttrs()&&r.extended.urlId?(c=h,a=r.extended.urlId):(c=-1,a=-1)}}e(n)}};r2=Rs([qe(0,In),qe(1,Mn),qe(2,jC)],r2);function P0e(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 y1=on("CharSizeService"),vo=on("CoreBrowserService"),Fx=on("MouseService"),yo=on("RenderService"),E0e=on("SelectionService"),CC=on("CharacterJoinerService"),Ad=on("ThemeService"),NC=on("LinkProviderService"),R0e=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?ay.isErrorNoTelemetry(t)?new ay(t.message+`
811
811